Loading...
 

Boot from removable storage - Ubuntu

Here we will show you how to transfer the Ubuntu file system of your choosing (14.04.5 LTS or 16.04.4 LTS) to a removable media such as micro SD card or USB device, and how to boot these distributions on ESPRESSObin.

Ubuntu 14.04.5 LTS

 
Here we will extract the rootfs.tar.bz2 archive to either a micro SD card or a USB device. The rootfs.tar.bz2 can either be:

Preparing removable media


The instructions below on how to prepare your micro SD card are identical to how you would go about preparing a USB device.

Before transferring the file system we need to prepare our removable media. Insert the microSD card in your local Linux machine and you should usually see the microSD card listed as /dev/sd* device (or /dev/mmcblk0*) so make sure to check with lsblk:

user@laptop:/$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238,5G  0 disk 
├─sda1   8:1    0   487M  0 part /boot/efi
├─sda2   8:2    0 234,1G  0 part /
└─sda3   8:3    0   3,9G  0 part [SWAP]
sdb      8:16   1   3,7G  0 disk 
└─sdb1   8:17   1   3,7G  0 part


Our microSD card is here listed as /dev/sdb but it is not empty. Since we will be formatting our SD card, we want to clear everything from it first (back up the content from your SD card before this):

user@laptop:/$ sudo dd if=/dev/zero of=/dev/sdb bs=1M count=100


Now we will create a new partition (sdb1) on the empty SD card:

user@laptop:/$ (echo n; echo p; echo 1; echo ''; echo ''; echo w) | sudo fdisk /dev/sdb


and format it as EXT4 with:

  • If using e2fsprogs version < 1.43, do:
user@laptop:/$ sudo mkfs.ext4 /dev/sdb1
  • If using e2fsprogs version >=1.43, do:
user@laptop:/$ sudo mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdb1


Next, mount this partition on your local Linux machine (e.g. to /mnt/sdcard):

user@laptop:/$ sudo mkdir -p /mnt/sdcard
user@laptop:/$ sudo mount /dev/sdb1 /mnt/sdcard


Now head into the mounted directory and there extract the rootfs.tar.bz2 archive:

user@laptop:/$ cd /mnt/sdcard
user@laptop:/mnt/sdcard$ sudo tar -xvf /home/user/ubuntu_14.04/rootfs.tar.bz2


If you downloaded the rootfs archive from Tech Spec page, adjust the path above to point where you stored the downloaded archive. This archive already contains the kernel image and the dtb file in the boot directory.

Our SD card is now ready and contains the necessary images and Ubuntu file system. Exit the mounted directory and unmount it from your local machine with:

user@laptop:/mnt/sdcard$ cd
user@laptop:/$ sudo umount /mnt/sdcard

 

Setting U-Boot parameters


For the ESPRESSObin to boot Ubuntu file system and images placed on the removable media, we must configure U-Boot parameters to do so.

Micro SD card


Unplug the SD card from your local machine and plug it into the SD card slot on the ESPRESSObin, plug the power adapter and connect to the board using the micro USB cable and Serial connection.

When the boot starts, hit any key to stop autoboot and get to the Marvell U-Boot prompt:

Hit any key to stop autoboot:
Marvell>>


Optionally, check that the SD card has the necessary files using the ext4ls command:

Marvell>> ext4ls mmc 0:1
Marvell>> ext4ls mmc 0:1 boot


There are only a few variables required to boot from the micro SD card. You can print the currently defined variables at any point using printenv.

First, set proper image and device tree path and name:

Marvell>> setenv image_name boot/Image
Marvell>> setenv fdt_name boot/armada-3720-community.dtb


Next, define the bootmmc variable which we will use to boot from the micro SD card:

Marvell>> setenv bootmmc 'mmc dev 0; ext4load mmc 0:1 $kernel_addr $image_name;ext4load mmc 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk0p1 rw rootwait; booti $kernel_addr - $fdt_addr'


Be careful to set the root path above to point to where you have extracted the Ubuntu file system (first partition in our case). You can save the set variables at any time using the saveenv command.

Alternately, you can set identical values to the bootcmd variable for the ESPRESSObin to automatically boot from the micro SD card:

Marvell>> setenv bootcmd 'mmc dev 0; ext4load mmc 0:1 $kernel_addr $image_name;ext4load mmc 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk0p1 rw rootwait; booti $kernel_addr - $fdt_addr'


Finally, boot up the ESPRESSObin with run bootmmc or if you set the bootcmd variable simply type reset:

Marvell>> run bootmmc

[TRUNCATED OUTPUT]

Ubuntu 14.04.5 LTS localhost.localdomain ttyMV0

localhost login: root (automatic login)

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.52-armada-17.10.4-g719fc86-dirty aarch64)

 * Documentation:  https://help.ubuntu.com/

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

root@localhost:~#

 

USB device


Unplug the USB device from your local machine and plug it into a USB port on the ESPRESSObin, plug the power adapter and connect to the board via micro USB cable and Serial connection.

When the boot starts, hit any key to stop autoboot and get to the Marvell U-Boot prompt:

Hit any key to stop autoboot:
Marvell>>


First, we need to verify that the USB is recognized with usb start:

Marvell>> usb start
(Re)start USB...
USB0:   Register 2000104 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found


and check that the file system, kernel image, and dtb file have been transferred correctly with the ext4ls command:

Marvell>> ext4ls usb 0:1
Marvell>> ext4ls usb 0:1 boot


Adjust the commands above to how you partitioned your USB device.

There are only a few variables required to boot from the USB device. You can print the currently defined variables at any point using printenv.

First, set proper image and device tree path and name:

Marvell>> setenv image_name boot/Image
Marvell>> setenv fdt_name boot/armada-3720-community.dtb


and set bootusb variable which we will use to boot from the USB device

Marvell>> setenv bootusb 'usb start;ext4load usb 0:1 $kernel_addr $image_name;ext4load usb 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/sda1 rw rootwait; booti $kernel_addr - $fdt_addr'


Be careful to set the root path above to point to where you have extracted the Ubuntu file system (first partition in our case). You can save the set variables at any time using the saveenv command.

Alternately, you can set identical values to the bootcmd variable for the ESPRESSObin to automatically boot from the USB device:

Marvell>> setenv bootcmd 'usb start;ext4load usb 0:1 $kernel_addr $image_name;ext4load usb 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/sda1 rw rootwait; booti $kernel_addr - $fdt_addr'


Finally, boot the ESPRESSObin either with run bootusb or if you set the bootcmd variable simply type reset :

Marvell>> run bootusb

 

Ubuntu 16.04.4 LTS


Here we will show how to extract rootfs.tar.bz2 archive to either a micro SD card or a USB device. The rootfs.tar.bz2 can either be:

Preparing removable media


The instructions below on how to prepare your micro SD card are identical to how you would go about preparing a USB device.

Insert the microSD card in your local Linux machine, after which you should see the SD card listed most probably as /dev/sd* device (or /dev/mmcblk0*) so make sure to check with lsblk:

user@laptop:/$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238,5G  0 disk
├─sda1   8:1    0   487M  0 part /boot/efi
├─sda2   8:2    0 234,1G  0 part /
└─sda3   8:3    0   3,9G  0 part [SWAP]
sdb      8:16   1  14.9G  0 disk 
└─sdb1   8:17   1  14.9G  0 part


Our microSD card was recognized above as /dev/sdb/. Since we will be formatting our SD card, we want to clear everything from it first (back up content from your SD card before this):

user@laptop:/$ sudo dd if=/dev/zero of=/dev/sdb bs=1M count=100


Now create a new partition (sdb1) on the empty SD card:

user@laptop:/$ (echo n; echo p; echo 1; echo ''; echo ''; echo w) | sudo fdisk /dev/sdb


and format it as EXT4 with:

  • If using e2fsprogs version < 1.43, do:
user@laptop:/$ sudo mkfs.ext4 /dev/sdb1
  • If using e2fsprogs version >=1.43, do:
user@laptop:/$ sudo mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdb1


Next, mount this partition on your local Linux machine (e.g. to /mnt/sdcard):

user@laptop:/$ sudo mkdir -p /mnt/sdcard
user@laptop:/$ sudo mount /dev/sdb1 /mnt/sdcard


Now head into the mounted directory and there extract rootfs.tar.bz2 archive:

user@laptop:/$ cd /mnt/sdcard
user@laptop:/mnt/sdcard$ sudo tar -xvf /home/user/ubuntu_16.04/rootfs.tar.bz2


If you downloaded the rootfs from Tech Spec page, make sure to adjust the path above to point where you stored the downloaded archive.

Our SD card is now ready and contains the necessary images and Ubuntu file system. Exit the mounted directory and unmount it from your local machine with:

user@laptop:/mnt/sdcard$ cd
user@laptop:/$ sudo umount /mnt/sdcard

 

Setting U-Boot parameters


For the ESPRESSObin to boot Ubuntu file system and images placed on the removable media, we must configure U-Boot parameters to do so.

Micro SD card


Unplug the removable media you have transferred the file system to and plug it into the SD card slot on the ESPRESSObin, plug the power adapter and connect to the board using the micro USB cable and Serial connection.

When the boot starts, hit any key to stop autoboot and get to the Marvell U-Boot prompt:

Hit any key to stop autoboot:
Marvell>>


Check that the micro SD card has necessary files using the ext4ls command:

Marvell>> ext4ls mmc 0:1
Marvell>> ext4ls mmc 0:1 boot


There are only a few variables required to boot from microSD card. First, set proper image and device tree path and name:

Marvell>> setenv image_name boot/Image
Marvell>> setenv fdt_name boot/armada-3720-community.dtb


Next, set the boot command by defining the bootmmc variable, which we will use to boot from the microSD card:

Marvell>> setenv bootmmc 'mmc dev 0; ext4load mmc 0:1 $kernel_addr $image_name;ext4load mmc 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk0p1 rw rootwait; booti $kernel_addr - $fdt_addr'


Be careful to set the root path above to point to where you have extracted the Ubuntu file system (first partition in our case).

Alternately, set up the bootcmd variable for the ESPRESSObin to automatically boot with these values:

Marvell>> setenv bootcmd 'mmc dev 0; ext4load mmc 0:1 $kernel_addr $image_name;ext4load mmc 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk0p1 rw rootwait; booti $kernel_addr - $fdt_addr'


You can preserve the set variables across reboots using the saveenv command.

Finally, boot the ESPRESSObin either with run bootmmc or if you set the bootcmd variable simply type reset :

Marvell>> run bootmmc

[TRUNCATED OUTPUT]

Ubuntu 16.04.4 LTS localhost.localdomain ttyMV0

localhost login: root
Last login: Thu Feb 11 16:28:05 UTC 2016 on ttyMV0
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.52-armada-17.06.2-gcaa3a4f aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
root@localhost:~#

Log in with root.

USB device


Unplug the USB device from your local machine and plug it into a USB port on the ESPRESSObin, plug the power adapter and connect to the board via micro USB cable and Serial connection.

When the boot starts, hit any key to stop autoboot and get to the Marvell U-Boot prompt:

Hit any key to stop autoboot:
Marvell>>


First, check that our USB device was recognized with usb start:

Marvell>> usb start
(Re)start USB...
USB0:   Register 2000104 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found

 

and verify that the file system, kernel image and dtb file have been transferred correctly using the ext4ls command:

Marvell>> ext4ls usb 0:1
Marvell>> ext4ls usb 0:1 boot

 

There are only a few variables required to boot from the USB device. You can print the currently defined variables at any point using printenv.

First, set the proper image and device tree path and name:

Marvell>> setenv image_name boot/Image
Marvell>> setenv fdt_name boot/armada-3720-community.dtb


Next, define the bootusb variable which we will use to boot from the USB device:

Marvell>> setenv bootusb 'usb start;ext4load usb 0:1 $kernel_addr $image_name;ext4load usb 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/sda1 rw rootwait; booti $kernel_addr - $fdt_addr'


We can preserve the set variables across reboots with the saveenv command.

Alternately, you can set identical values to the bootcmd variable for the ESPRESSObin to automatically boot from the micro SD card:

Marvell>> setenv bootcmd 'usb start;ext4load usb 0:1 $kernel_addr $image_name;ext4load usb 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/sda1 rw rootwait; booti $kernel_addr - $fdt_addr'


Now boot by issuing run bootusb. If you set the bootcmd variable, simply type reset:

Marvell>> run bootusb


Log in with root.