HOWTO: update/flash/re-flash La Frite firmware from another Linux computer

edited August 17 in AML-S805X-AC
This tutorial is for re-flashing La Frite's SPI NOR should it be corrupted. Under normal circumstances, you can update the firmware directly from LOST without having to do this. It requires an USB Type A to Type A cable and another Linux-based host computer (another La Frite will work). For simplicity, Debian will be assumed.

Install git, wget, Python 3, and its USB libraries on the host computer.
sudo apt-get install git wget python3 python3-usb
Clone Amlogic GXL git repo on the host computer.
git clone https://github.com/libre-computer-project/pyamlboot.git --single-branch --branch gxl
Connect a USB Type A to USB Type A cable to your computer. While holding down the u-boot button on La Frite, connect the USB Type A cable from the computer to the USB Type A port closest to the IR sensor. Optionally connect HDMI monitor to La Frite.
On host computer, start the flashing process.
pyamlboot/flash-firmware.sh aml-s805x-ac
If this reports an error, switch USB ports a few times and it should work. AMD machines seem to have USB controller issues and require more than one try. Check the HDMI monitor for flashing status. It should take no more than a minute. After it finishes flashing, reboot the device.

Comments

  • edited September 2019
    Just tried several times/different timing/holding for a time/just pressing repeatedly the u-boot button upon connection to Mac and eMMC was unable to be detected automatically for flashing.
    Though selecting the eMMC as USB option on boot works.

    Has the button option been implemented already at some firmware revision? I used revision 5 (latest).

    Edit: My bad, confused the eMMC when this is used for the firmware itself. Thanks for clarification @loverpi
  • The u-boot button is for flashing the firmware not the eMMC.
  • Doesn't work


    Traceback (most recent call last):
      File "./boot.py", line 126, in <module>
        usb.load_uboot()
      File "./boot.py", line 88, in load_uboot
        self.write_file(os.path.join(self.bpath, self.TPL_FILE), self.UBOOT_LOAD, large = 64, fill = True)
      File "./boot.py", line 62, in write_file
        self.dev.writeLargeMemory(addr, b, large, fill)
      File "/home/guillaume/Téléchargements/pyamlboot/pyamlboot/pyamlboot.py", line 238, in writeLargeMemory
        blockLength, appendZeros)
      File "/home/guillaume/Téléchargements/pyamlboot/pyamlboot/pyamlboot.py", line 218, in _writeLargeMemory
        ep.write(data[offset:offset+blockLength], 1000)
      File "/usr/lib/python3.7/site-packages/usb/core.py", line 387, in write
        return self.device.write(self, data, timeout)
      File "/usr/lib/python3.7/site-packages/usb/core.py", line 948, in write
        self.__get_timeout(timeout)
      File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 824, in bulk_write
        timeout)
      File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 920, in __write
        _check(retval)
      File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 595, in _check
        raise USBError(_strerror(ret), ret, _libusb_errno[ret])
    usb.core.USBError: [Errno 110] Operation timed out
    Unable to push firmware updater to board.

  • And if I increase the timeout value:

    Traceback (most recent call last):
      File "./boot.py", line 126, in <module>
        usb.load_uboot()
      File "./boot.py", line 88, in load_uboot
        self.write_file(os.path.join(self.bpath, self.TPL_FILE), self.UBOOT_LOAD, large = 64, fill = True)
      File "./boot.py", line 62, in write_file
        self.dev.writeLargeMemory(addr, b, large, fill)
      File "/home/guillaume/Téléchargements/pyamlboot/pyamlboot/pyamlboot.py", line 238, in writeLargeMemory
        blockLength, appendZeros)
      File "/home/guillaume/Téléchargements/pyamlboot/pyamlboot/pyamlboot.py", line 218, in _writeLargeMemory
        ep.write(data[offset:offset+blockLength], 1000000)
      File "/usr/lib/python3.7/site-packages/usb/core.py", line 387, in write
        return self.device.write(self, data, timeout)
      File "/usr/lib/python3.7/site-packages/usb/core.py", line 948, in write
        self.__get_timeout(timeout)
      File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 824, in bulk_write
        timeout)
      File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 920, in __write
        _check(retval)
      File "/usr/lib/python3.7/site-packages/usb/backend/libusb1.py", line 595, in _check
        raise USBError(_strerror(ret), ret, _libusb_errno[ret])
    usb.core.USBError: [Errno 19] No such device (it may have been disconnected)
    Unable to push firmware updater to board.


  • edited October 2019
    Using another usb port seemed to work. But the board still doesn't work. LEDs are blinking forever and nothing happens
    EDIT: Changing the power supply solved that

    All works :)

  • how can i build the firmware from source?
  • Because I took me a while to figure this out, I want to point out that, even if the board can be powered by the standard USB port (the one next to the IR sensor), it needs to be powered via the microusb port for the flashing to proceed.

    Otherwise the board will simply reboot without the installation proceeding
  • @Sushi It depends on the power output of the USB port you are using. Anything that can output the standard 500mA should work.
  • edited May 15
    Can you guys tell me what your CPU/chipsets are?
  • edited June 12
    Hi..i have tried something for my OS upgrade where the situation was similar. The recovery USB to be created on another Windows PC from the the BIOS update file. That method should work, but it is always scary flashing BIOS since it is one of the rare time that software can brick a PC.
    pcb manufacturer
  • @MarcoHarn You can't brick the board because there's a hard coded loader that is the ultimate failsafe if the flash is corrupted.
  • So I recently moved to an AMD machine and this flash tool does not work that well. It seems that AMD's USB controller stack still has some issues that only time will resolve. If it doesn't work for you, try on an Intel machine.
  • Tried about every possible combination between USB ports, drives, left-right port, power capable USB supplies, pushing the Uboot button for 1 sec, 2 , 3 , 5 , 10, not, .... seconds, .... but all I get on my monitor after 5 seconds is: no signal (and a pretty red and a pretty green light an my La Frite).

    The idea is that you can't kill the Onboard loader, right?

    So how do I reflash the La Frite? Or is it dead (and if it is, I have JTAG, and other tools to do low level...)

  • edited June 10
    loverpi said:
    @MarcoHarn You can't brick the board because there's a hard coded loader that is the ultimate failsafe if the flash is corrupted.
    So how do I get into the hard coded loader, because I can't seem to be able to do anything now. No loader, no "bios", no eMMC startup, no ....

  • @Ingmar If the SPI loader is corrupt, you're not going to get video. Hold down the u-boot button while you connect the Type A cable from your computer to the USB Type A port closest to the IR. Then run the program per the instructions.
Sign In or Register to comment.