Libre Computer AML-S905X-CC eMMC Flashing Steps from Linux with pyamlboot

This method is an alternative to the recommended way of flashing eMMC. This method only works on certain Amlogic boards, board models beginning with AML- .

This method does not require a MicroSD card. For the other two methods, please see eMMC Flashing via MicroSD Card and u-boot.

Requirements

  • Le Potato board
  • eMMC 5.x module attached
  • USB Type A to USB Type A cable
  • Any Linux computer (not AMD) or SBC (Windows/Mac OS might work, untested)

Install the necessary tools and clone pyamlboot:

sudo apt install -y python3-usb
git clone --single-branch https://github.com/libre-computer-project/pyamlboot.git -b scripts
  1. Detach all peripherals including HDMI cable, USB devices, and MicroUSB power.
  2. Plug one end of the USB Type A cable into your computer/SBC with pyamlboot.
  3. Press and hold the K11/Uboot button on the board while attaching the other end of the USB Type A cable into the top left USB port next to the Ethernet. Release button.
  4. Attach auxiliary power via MicroUSB if your computer/SBC does not provide enough. (Optional)
    aml-s905x-cc-otg-port

Below are two actions. Only run one of the following actions per connect. If you need to run a different action, power off the board completely (usually HDMI, MicroUSB, and USB Type A) and repeat from step 3.

To erase eMMC user partition table and bootloader, run the following:

sudo pyamlboot/run.sh aml-s905x-cc erase-emmc
# erases first 1MB of eMMC user hardware partition
# this includes any MBR/GPT partition table and bootloader

To turn eMMC into a virtual flash drive to flash images, run the following:

sudo pyamlboot/run.sh aml-s905x-cc ums-emmc
# exposes eMMC user hardware partition as a flash drive after 5 seconds
# you do not have to erase the eMMC first before flashing images

Wait 10 seconds and a virtual flash drive should appear to your Linux machine/SBC. You can use gnome-disk-imager or dd to flash any of our images directly to the eMMC. This method of dumping to eMMC is limited by the Porgrammable IO USB transfer mode which has a peak write speed of around 10MB/s.

There is a known issue with AMD machines timing out on USB transfers. We have yet to figure out a workaround so please use Intel machines or an SBC to do this. If anyone at AMD is reading this, please fix your USB please :smiley:

2 Likes

I’ve encounter an error while trying to flash the eMMC, I can’t mount as virtual flash drive nor delete user partition due to the next error:

Using GX Family boot parameters
ROM: 2.4 Stage: 0.0
Writing /home/<user>/pyamlboot/files/libretech-cc/u-boot.bin.usb.bl2 at 0xd9000000...
[DONE]
Writing /home/<user>/pyamlboot/files/usbbl2runpara_ddrinit.bin at 0xd900c000...
[DONE]
Running at 0xd9000000...
[DONE]
Waiting...
[DONE]
ROM: 2.2 Stage: 0.8
Running at 0xd900c000...
[DONE]
Waiting...
[DONE]
Writing /home/<user>/pyamlboot/files/libretech-cc/u-boot.bin.usb.bl2 at 0xd9000000...
Traceback (most recent call last):
  File "./boot.py", line 132, in <module>
    usb.load_uboot()
  File "./boot.py", line 87, in load_uboot
    self.write_file(os.path.join(self.bpath, self.BL2_FILE), self.DDR_LOAD, large = 64)
  File "./boot.py", line 63, in write_file
    self.dev.writeLargeMemory(addr, b, large, fill)
  File "/home/<user>/pyamlboot/pyamlboot/pyamlboot.py", line 241, in writeLargeMemory
    self._writeLargeMemory(address+offset, data[offset:offset+writeLength], \
  File "/home/<user>/pyamlboot/pyamlboot/pyamlboot.py", line 215, in _writeLargeMemory
    self.dev.ctrl_transfer(bmRequestType = 0x40,
  File "/usr/lib/python3/dist-packages/usb/core.py", line 1036, in ctrl_transfer
    ret = self._ctx.backend.ctrl_transfer(
  File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 875, in ctrl_transfer
    ret = _check(self.lib.libusb_control_transfer(
  File "/usr/lib/python3/dist-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)

The device is connected, Is this a know issue?

  1. What CPU are you using? (AMD issue)
  2. Did you disconnect all the peripherals? (Power issue)
  3. Is your USB port providing enough power? (Power Issue)
  4. After you plug in the Type A to Type A cable, does providing auxiliary power via the MicroUSB port work?
1 Like

Thanks, it was a Power Issue, after providing auxiliary power on the MicroUSB the error appeared no more and I was able to flash the Ubuntu image using dd.

2 Likes

Hi,
thanks for the post and instructions.

i was able to get another raspberry pi and was able to get the device to be detected with the aux power

without power running lsusb doesnt show the amlogic gx chip
with aux power lsusb shows amlogic gx chip.
running the erase command i get:

sudo pyamlboot/run.sh aml-s905x-cc erase-emmc
Using GX Family boot parameters
ROM: 2.4 Stage: 0.0
Writing /usr/local/lib/python3.9/dist-packages/files/libretech-cc/u-boot.bin.usb.bl2 at 0xd9000000…
[DONE]
Writing /usr/local/lib/python3.9/dist-packages/files/usbbl2runpara_ddrinit.bin at 0xd900c000…
[DONE]
Running at 0xd9000000…
[DONE]
Waiting…
[DONE]
ROM: 2.2 Stage: 0.8
Running at 0xd900c000…
[DONE]
Waiting…
[DONE]
Writing /usr/local/lib/python3.9/dist-packages/files/libretech-cc/u-boot.bin.usb.bl2 at 0xd9000000…
[DONE]
Writing /usr/local/lib/python3.9/dist-packages/files/usbbl2runpara_runfipimg.bin at 0xd900c000…
[DONE]
Writing /usr/local/lib/python3.9/dist-packages/files/libretech-cc/u-boot.bin.usb.tpl at 0x200c000…
[DONE]
Writing scripts/libretech-cc-erase-emmc.scr at 0x8000000…
[DONE]
Running at 0xd900c000…
[DONE]

but when i run the other command “sudo pyamlboot/run.sh aml-s905x-cc ums-emmc”
It gives me some errors.

sudo pyamlboot/run.sh aml-s905x-cc ums-emmc
Using GX Family boot parameters
Traceback (most recent call last):
File “/home/naku/pyamlboot/./boot.py”, line 132, in
usb.load_uboot()
File “/home/naku/pyamlboot/./boot.py”, line 86, in load_uboot
self.init_ddr()
File “/home/naku/pyamlboot/./boot.py”, line 74, in init_ddr
self.soc_id()
File “/home/naku/pyamlboot/./boot.py”, line 54, in soc_id
s = self.dev.identify()
File “/home/naku/pyamlboot/pyamlboot/pyamlboot.py”, line 306, in identify
ret = self.dev.ctrl_transfer(bmRequestType = 0xc0,
File “/usr/local/lib/python3.9/dist-packages/usb/core.py”, line 1082, in ctrl_transfer
ret = self._ctx.backend.ctrl_transfer(
File “/usr/local/lib/python3.9/dist-packages/usb/backend/libusb1.py”, line 893, in ctrl_transfer
ret = _check(self.lib.libusb_control_transfer(
File “/usr/local/lib/python3.9/dist-packages/usb/backend/libusb1.py”, line 602, in _check
raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBTimeoutError: [Errno 110] Operation timed out

can you please help me out?

You can’t run it one after the other. Unplug everything and just run ums-emmc rather than erase-emmc.

3 Likes

thank you for the reply. i will try that out.

and then i can just mount the image and copy n dump the files over to the emmc drive?

The eMMC will show up as a USB mass storage device. Then you can use Gnome Disk Imager or some other disk utility like dd to flash the eMMC directly.

1 Like

hey i wanted to let you know i got it running :slight_smile: and ran updates its running ubuntu!
there were some power issues but iu got them solved and finally after several attempts it showed up as usb device i was able to use that tool baobab the gnome disk imager.

Thank you for your support. I would like to help out in the forum if possible :slight_smile:

could we use other low resource linux distros? like linux mate or the ones for digital signage?

See the notes at the top about weston. Weston is a wayland compositor and uses the least resources and comes pre-installed on the server images. It is much faster and tear free compared to X11. Ubuntu 22.04 Weston Desktop Help

1 Like

I have a Le Potato and a 64gb emmc module on the way from Amazon, but I’m curious if a mac can mount the Le Potato correctly in order to flash it. If not I have a Raspberry Pi Zero that should do the trick, but I’m still curious.

Should be able to on a Mac as long as you have the right python libraries. If it doesn’t work, post the error.

Where are the instructions to flash the eMMC from a uSD-booted Le Potato (or any other Libre computer)?

As in: flash uSD, insert blank eMMC and uSD into SBC, boot, now how to flash image onto eMMC using booted SBC?

Once you boot into Linux, you can flash the eMMC like any block device. The eMMC gets detected as /dev/mmcblk0.

1 Like

This helped me as well. :slight_smile: Thank you so much!

Is it the intention to use the eMMC module as a replacement for the SD card?

See Difference between MicroSD cards and eMMC Modules

Maybe I didn’t clarify myself good enough, sorry for that. My real question is: can I flash, for instance, the Raspbian image on the eMMC board so that the Le Potato SBC can boot from the eMMC module instead of the SD card? Which would mean that I can fully get rid of an SD card to boot up the system?

You can flash Le Potato’s eMMC. You can use the above guide to flash the regular SD card image to the eMMC and it will work. The other way is to just flash to /dev/mmcblk0 when booted from MicroSD card. Either way works.

Hi…I followed the procedure above and was able to successfully erase the emmc partition but I cannot get the next step to proceed. I have fully disconnected the La Frite board and powered it on exactly as before but every time I try to run the ums-emmc command it gives me the device not found error. I even tried re-running the erase-emmc as before but it also gives the same device not found error.

Is there a step I am missing? I only received the board and emmc modules a couple of days ago