How to Recover Ubuntu

From ESS-WIKI
Revision as of 10:13, 22 July 2024 by Winston.huang (talk | contribs) (Created page with "{{DISPLAYTITLE:How to Recover Ubuntu}} == Set Up Ubuntu Host PC == On the Ubuntu host PC, follow these steps to install tools and configure your host PC: * Install genio-to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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 immediately
loginctl terminate-user $USER # *** desktop will be terminated ***
# sudo reboot
  • check if 20(dialout) and 46(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 Ubuntu Recovery Pack Ready

  • Obtain this pack through your local Advantech representative and extract it first.
tar xvf ${RECOVERY_PACK}.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 Recovery Pack to the Target Board

  • First change directory(cd) to the revoery pack directory, and run genio-flash:
cd ${RECOVERY_PACK}
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.
The flash tool should output the following messages:
Jumping to bootstrap at address 0x201000 in AArch64 mode
flashing writable=rootfs.img
< 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 writing image content to the storage:
Sending sparse 'writable' 1/17 (261712 KB)         OKAY [  6.936s]
Writing 'writable'                                 OKAY [ 19.022s]
Sending sparse 'writable' 2/17 (262016 KB)         OKAY [  6.959s]
Writing 'writable'                                 OKAY [ 17.793s]
Sending sparse 'writable' 3/17 (261922 KB)         OKAY [  6.852s]
Writing 'writable'                                 OKAY [ 15.435s]
Sending sparse 'writable' 4/17 (253224 KB)         OKAY [  6.600s]
Writing 'writable'                                 OKAY [ 11.948s]
Eventually, the flash tool would report the following logs once it finishes writing the onboard storage and reboot the board:
Sending sparse 'writable' 16/17 (262143 KB)        OKAY [  6.692s]
Writing 'writable'                                 OKAY [  9.236s]
Sending sparse 'writable' 17/17 (112636 KB)        OKAY [  2.916s]
Writing 'writable'                                 OKAY [  5.021s]
Finished. Total time: 539.208s
flashing ubuntu-boot=efi.img
Sending 'ubuntu-boot' (12803 KB)                   OKAY [  0.331s]
Writing 'ubuntu-boot'                              OKAY [  0.534s]
Finished. Total time: 0.876s
Rebooting                                          OKAY [  0.002s]
Finished. Total time: 0.052s