Boot from USB and Sata


#1

If the SD has a valid system the W2 boot from the SD card. Otherwise W2 look inside the uEnv.txt file in the eMMC. If uEnv.txt hold a line like “root=/dev/??? rw rootfstype=ext4 rootwait” then W2 boot from ??? device. The uEnv may have many such lines but only one begin without a comment symbol: #

If ??? is mmcblk0p2 then W2 boot the system in eMMC If ??? is sda2 then W2 boot the system in USB device like flash disk (tested only on USB 3 port) If ??? is sataa2 then W2 boot the system in SATA disk A (the one in the sata connector near the W2 edge).

Here we assume that device system was built using the tool “bpi-copy”. Then the linux system hold in partition index 2, the last digit in device identifier like in sda2.

The part of my uEnv.txt file in the eMMC holding the boot rules look like

# SD / eMMC
root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait 
# USB
#root=/dev/sda2 rw rootfstype=ext4 rootwait 
# SATA
#root=/dev/sataa2 rw rootfstype=ext4 rootwait 

With ubuntu 18.04 mate the file path is /media/pi/BPI-BOOT/bananapi/bpi-w2/linux/uEnv.txt (ubuntu)

To change the content of this file use the nano text editor in a terminal window. First change the current directory with command:

cd /media/pi/BPI-BOOT/bananapi/bpi-w2/linux

Then launch the text editor:

sudo nano uEnv.txt

Use the arrow keys to move the text cursor. Remember: there must be only one line beginning with “root=/dev/” without the comment symbol. To save uEnv.txt use CTRL-O and Return. To exit the nano text editor use CTRL-X.

The best and safest way to play with a new system is using a SD card. On computer with Linux or Windows install bpi-tools (untar bpi-tools.tgz) In a terminal window write the command:

sudo bpi-copy path_to_image_zip  /SD_Card_device

The path_to_image_zip is the linux/android distribution to write to the sd card and SD_Card_device is the device identifier (without partition number)

On my Linux computer, with Kali image on desktop, sd card on USB reader device sdb the command is:

sudo bpi-copy 'Desktop/2018-09-20-kali-xfce-desktop-demo-aarch64-bpi-w2-sd-emmc.img.zip' /dev/sdb

bpi-copy make 4 partitions. Two are unallocated.

The largest one BPI-ROOT is an ext4 partition at index 2 and hold the distribution system.

You can enlarge this partition with some disk tool and then copy any .zip image(s) to install on USB or SATA disk.

Then boot from SD card and install bpi-tools. The other partition BPI-BOOT is an fat16 partition at index 1 and hold uEnv.txt in bananapi/bpi-w2/linux folder. This partition is mounted at /media/pi/BPI-BOOT on desktop.

When the W2 is turned on the BPI-BOOT partition on eMMC is used to select the system device to boot according to the info in the uEnv.txt file as above.

The BPI-BOOT partition on device other than eMMC is not used. The content of the BPI-BOOT partition on device other than eMMC can even be completely deleted (prevent confusion about uEnv.txt to be modified), but do not delete the partition itself otherwise the index of this partition will no longer be valid in uEnv.txt

To install a new system on eMMC burn SD card on computer as above. Then copy the distribution (.zip file) to be installed on eMMC inside the SD Card . Insert the SD card in the slot, switch the SW4 at 1 and power on.

Open a terminal and write the command:

sudo bpi-copy path_to_zip_file_on_sd_card

without second parameter. Without destination bpi-copy select eMMC device by default.

To install a new system on USB or SATA disk use this command on a computer terminal:

sudo bpi-copy path_to_zip_file usb_or_sata_device

note that in the example above the the device identifier has no partition number.

Then open uEnv.txt to add/uncomment a line beginning by root=/dev/sda2 for USB disk or root=/dev/sataa2 for SATA disk.

Post-installation: I have tried two distributions that work without any problem

Desktop/2018-09-20-kali-xfce-desktop-demo-aarch64-bpi-w2-sd-emmc.img.zip

2018-09-19-openSUSE-Tumbleweed-ARM-XFCE-desktop-demo-aarch64-bpi-w2-sd-emmc.img.zip

My favorite distribution is

2018-09-16-ubuntu-18.04-mate-desktop-demo-aarch64-bpi-w2-sd-emmc.img.zip

but the GUI desktop does not appear unless I use the command “startx” on uart console. Then CTRL-X exit the previous command and menu bar is shown. The next time W2 will boot the GUI desktop will appear correctly.

Thanks to Kamil_S his precious suggestion and invaluable help with W2.