How to Flash Image
From ESS-WIKI
Contents
Set Up Ubuntu Host PC
On the Ubuntu host PC, follow these steps to install tools and configure your host PC:
- Install genio-tool and its dependencies. This is used to flash Ubuntu images to the target board.
# Ubuntu 22.04
sudo apt update
sudo apt install python3-pip
pip3 install --upgrade pip
sudo apt install fastboot
pip3 install -U genio-tools
- Add two new udev rules and add your user account to the
plugdev
&dialout
group:
cat << EOT | sudo tee /etc/udev/rules.d/96-genio-board.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0e8d", ATTR{idProduct}=="201c", MODE="0660", $ GROUP="plugdev"
EOT
cat << EOT | sudo tee /etc/udev/rules.d/72-aiot.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0e8d", ATTR{idProduct}=="201c", MODE="0660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTR{idVendor}=="0e8d", ATTR{idProduct}=="0003", MODE="0660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", MODE="0660", TAG+="uaccess"
SUBSYSTEM=="gpio", MODE="0660", TAG+="uaccess"
EOT
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo usermod -a -G plugdev,dialout $USER
# completely logout then re-login, or just reboot
loginctl terminate-user $USER # *** desktop will be terminated ***
# sudo reboot
- check if
20(dialout)
and46(plugdev)
are list in the effective group ID ...
id
- check if the genio-tools does work
genio-config
- make sure every item's result is OK
fastboot: OK udev rules: OK (md5: a3b2767b42ee01d7c62bf394400528ae) Serial device write access: OK
Get Image Ready
- Download the image and extract it first.
tar xvf ${IMAGE}.tgz
Connect the Target Board to the Host PC
- Confirm the power adaptor has been connected to the board.
- Use one Type-A to Type-A USB cable to connect the host PC and the target board (DOWNLOAD supported USB port)
- (optional) Use debug console to monitor flashing process
- Turn the target board power on
Flash Ubuntu Image to the Target Board
- First change directory(cd) to the image directory, and run genio-flash:
cd ${IMAGE}
genio-flash
- The tool should have the following output:
Looking for MediaTek SoC matching USB device 0e8d:0003
- The line Looking for MediaTek SoC matching USB device 0e8d:0003 shows that genio-flash tool is waiting for the board to be reset into download mode to start the flash programming procedure.
- Follow these steps to enter download mode:
- Press the DOWNLOAD button and hold it ...
- Press and release the RESET button.
- Press the DOWNLOAD button and hold it ...
- The tool should output the following messages:
Jumping to bootstrap at address 0x201000 in AArch64 mode
erasing mmc0
< waiting for any device >
- Release the DOWNLOAD button after the tool outputs
< waiting for any device >
- The flash tool should continue with the following message, which shows the progress of erasing the onboard storage and writing image content to the storage:
Erasing 'mmc0' (bootloader) request sz: 0x747c00000, real erase len: 0x0 OKAY [ 1.031s] Finished. Total time: 1.035s erasing mmc0boot0 Erasing 'mmc0boot0' (bootloader) request sz: 0x400000, real erase len: 0x400000 OKAY [ 0.005s] Finished. Total time: 0.009s erasing mmc0boot1 Erasing 'mmc0boot1' (bootloader) request sz: 0x400000, real erase len: 0x400000 OKAY [ 0.004s] Finished. Total time: 0.009s flashing mmc0=ubuntu.img Sending sparse 'mmc0' 1/17 (261730 KB) OKAY [ 11.772s] Writing 'mmc0' OKAY [ 17.996s] Sending sparse 'mmc0' 2/17 (262139 KB) OKAY [ 12.311s]
- Eventually, the flash tool would report the following logs once it finishes writing the onboard storage and reboot the board:
Sending sparse 'mmc0' 17/17 (220307 KB) OKAY [ 9.935s] Writing 'mmc0' OKAY [ 8.762s] Finished. Total time: 607.491s flashing mmc0boot0=bl2.img Sending 'mmc0boot0' (233 KB) OKAY [ 0.012s] Writing 'mmc0boot0' OKAY [ 0.018s] Finished. Total time: 0.078s flashing mmc0boot1=u-boot-env.bin Sending 'mmc0boot1' (4 KB) OKAY [ 0.002s] Writing 'mmc0boot1' OKAY [ 0.006s] Finished. Total time: 0.015s flashing bootloaders=fip.bin Sending 'bootloaders' (1784 KB) OKAY [ 0.079s] Writing 'bootloaders' OKAY [ 0.071s] Finished. Total time: 0.182s flashing bootloaders_b=fip.bin Sending 'bootloaders_b' (1784 KB) OKAY [ 0.069s] Writing 'bootloaders_b' OKAY [ 0.071s] Finished. Total time: 0.149s flashing firmware=firmware.vfat Sending 'firmware' (32768 KB) OKAY [ 1.337s] Writing 'firmware' OKAY [ 1.160s] Finished. Total time: 2.858s flashing firmware_b=firmware.vfat Sending 'firmware_b' (32768 KB) OKAY [ 1.338s] Writing 'firmware_b' OKAY [ 1.160s] Finished. Total time: 2.530s flashing bootassets=bootassets.vfat Sending 'bootassets' (32768 KB) OKAY [ 1.282s] Finished. Total time: 2.721s Rebooting OKAY [ 0.002s] Finished. Total time: 0.052s