How to write disk images to eMMC from PC (linux) - TheMediocritist/RadxaZero_Experiments GitHub Wiki

1] Boot the Zero to USB Boot mode

2] Download and run the prebuilt USB Disk loader (unless you previously installed this).

wget https://dl.radxa.com/zero/images/loader/rz-udisk-loader.bin
boot-g12.py rz-udisk-loader.bin
lsusb
Bus 002 Device 004: ID 18d1:fada Google Inc. USB download gadget Serial: AMLG12A-RADXA-ZERO

The PC should show a USB Disk device, which is the eMMC of Zero.

3] Find the name of the eMMC:

lsblk

It should be sd(something), for example, here is a 128GB Zero called sda:

lsblk
NAME         MAJ:MIN RM   SIZE  RO  TYPE  MOUNTPOINT
sda            8:0    1 115.2G   0  disk  
mmcblk0      179:0    0  58.2G   0  disk
-mmcblk0p1   179:1    0   512M   0  part  /boot/efi
-mmcblk0p2   179:2    0  57.8G   0  part  /
mmcblk0boot0 179:8    0     4M   1  disk
mmcblk0boot1 179:16   0     4M   1  disk

!! WARNING !! Make sure you have correctly identified your Zero's eMMC, otherwise you might bork your PC's linux install!!

4] Choose a distro you'd like to use, and download it. Current linux distributions

If your disk image is compressed (eg. ends in .img.xz) extract it now.

unxz path_to_disk_img/img_file.img.xz

5] Copy disk image to eMMc:

sudo dd if=path_to_disk_img/img_file.img of=/dev/your_device_id bs=1M status=progress

eg.

sudo dd if=Twister-OS_Armbian_Focal_20.10_xfce-rockpi-zero-beta2.img of=/dev/sda bs=1M status=progress

At this point, you will probably still need to install the bootloader.

How to install bootloader to eMMC from PC (linux)

1] Download u-boot.bin:

wget https://dl.radxa.com/zero/images/loader/u-boot.bin

Note: at time of writing, Radxa have been testing alternative builds of u-boot. Check here to see if there is a newer version.

2] Write the u-boot.bin to eMMC:

sudo dd if=u-boot.bin of=/dev/sdx bs=512 seek=1

3] Unplug and plug USB C, Zero should boot into linux from the eMMC.

Note: Some distros might take a few minutes to boot the first time while they expand their filesystem. If it doesn't seem to be working, leave it for ten minutes before assuming it failed.