Updating firmware on LibreComputer La Frite in 2022

I've had a Libre Computer La Frite SBC (aml-s805x-ac) for a few years now, and I haven't done a lot with it. But, on a whim, I decided to pick it back up and, first things first, update the firmware.

Unfortunately, the most recent release (2021-07-r1) has an incorrect boot script that still looks for the previous release (2020-07-r7).

Well, now what?

Wait, can't you rename the bin file?

Possibly? I found some reports of this not working in my searching, but I didn't actually try it myself. Based on how I eventually made a working install script, I have a fair degree of confidence this would work. But that's not an interesting blog post, is it? :D So if you've tried renaming the bin file and had no success, read on.

I'm LOST without you

The firmware includes LOST -- LibreComputer OS Tool -- which purports to allow you to download firmware updates and operating systems directly from the Internet. So, I tried this option first.

Unfortunately, the service that is supposed to service LOST requests is, well, lost. The DNS resolves, but the server doesn't respond, so I must assume the server is down or the service is decommissioned.

Editing the script

You can't just edit the u-boot-2020-07-r7.scr file, because its u-boot header includes a CRC and modifying the script will break the CRC.

creating a new SCR file

What I ended up doing was using mkimage to process the script (which is just a text file) and generate a fresh u-boot header so the CRC would be correct.

  1. Install u-boot-tools

    If you're on a Mac, I suggest installing Docker Desktop and building this Dockerfile

  2. excise the script from the original *scr file. I used dd to do this:
    dd if=u-boot-2020-07-r7.scr of=boot.sh bs=1 count=1203 skip=72
    
  3. Open boot.sh in a text editor and replace u-boot-2020-07-r7.bin with u-boot-2021-07-r1.bin, then save and close the file.

  4. Create the image with the following command:

    # If you're using the above docker image, launch the container
    # with the working directory mounted to /mnt/uboot
    #
    # skip to the mkimage line if you've got u-boot-tools installed
    # natively.
    docker run -it --rm -v$(pwd):/mnt/uboot uboot
    # the container starts in '/' so change to our work directory
    cd /mnt/uboot
    # now make the image
    mkimage -A arm64 -O u-boot -T script -C none -a 0x0 -e 0x0 -d boot.sh boot.scr
    
  5. copy boot.scr and u-boot-2021-07-r1.bin to your thumb drive

Once these steps are complete, you are ready to update the firmware following the standard procedure.