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.3 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 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.

Before transferring the Ubuntu 14.04.5 LTS file system we need to prepare our SD card or USB device. Insert the microSD card in your local Linux machine (use a USB microSD card reader if your laptop does not have a microSD card slot) and you should see the microSD 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   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 (of course, backup content from your SD card before this). We clear it with:

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 we mount this partition on our local Linux machine (e.g. we will mount it 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_14.04/rootfs.tar.bz2


If you downloaded the rootfs archive from Tech Spec pages, 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

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 micro USB cable and serial connection as described in Quick User Guide, section Serial Connection.

For the ESPRESSObin to boot Ubuntu file system and images have placed on the SD card, we must configure U-Boot parameters to do so. 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>> 
Marvell>>


Check that our SD card has necessary files we have transferred using ext4ls command:

Marvell>> ext4ls mmc 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 etc
<DIR>       4096 usr
<DIR>       4096 tmp
<DIR>       4096 proc
<DIR>       4096 media
<DIR>       4096 bin
<DIR>       4096 home
<DIR>       4096 sys
<DIR>       4096 var
<DIR>       4096 opt
<DIR>       4096 mnt
<DIR>       4096 srv
<DIR>       4096 run
<DIR>       4096 root
<DIR>       4096 lib
<DIR>       4096 sbin
<DIR>       4096 boot
<DIR>       4096 dev
Marvell>> ext4ls mmc 0:1 boot
<DIR>       4096 .
<DIR>       4096 ..
        12358656 Image
            8175 armada-3720-community.dtb


There are only a few variables we need to set (other needed variables should be set by default) in order to boot from micro SD card. First, set proper image and device tree path and name if they are not already set:

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


Next we setup the boot command by changing the bootmmc variable. We will use this variable to boot 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 (in our case we copied it to the first partition).

After this we can save the variables we have set so far:

Marvell>> save


or define the bootcmd variable with these values 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 we boot up the ESPRESSObin with run bootmmc (login with root):

Marvell>> run bootmmc
switch to partitions #0, OK
mmc0 is current device
12772864 bytes read in 811 ms (15 MiB/s)
11352 bytes read in 128 ms (85.9 KiB/s)

[TRUNCATED OUTPUT]

Ubuntu 14.04 LTS localhost.localdomain ttyMV0

localhost login: root (automatic login)

Welcome to Ubuntu 14.04 LTS (GNU/Linux 4.4.52-armada-17.06.2-gcaa3a4f 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:~#


View an example bootlog here.

USB device


Unplug the USB device from your local machine and plug it into an USB port on the ESPRESSObin, plug the power adapter and connect to the board via micro USB cable and serial connection as described in Quick User Guide, section Serial Connection.

For the ESPRESSObin to boot the images we have placed on the USB device, we must configure valid U-Boot parameters to do so. 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>>
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 ext4ls command:

Marvell>> ext4ls usb 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 tmp
<DIR>       4096 boot
<DIR>       4096 bin
<DIR>       4096 sys
<DIR>       4096 etc
<DIR>       4096 home
<DIR>       4096 sbin
<DIR>       4096 opt
<DIR>       4096 usr
<DIR>       4096 var
<DIR>       4096 proc
<DIR>       4096 run
<DIR>       4096 dev
<DIR>       4096 root
<DIR>       4096 lib
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 srv
Marvell>> ext4ls usb 0:1 boot
<DIR>       4096 .
<DIR>       4096 ..
        12772864 Image
           11352 armada-3720-community.dtb


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

using printenv we can list currently set U-Boot variables. If changed, here we need to set up correct values for image names:

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 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'


and lastly we boot by issuing run bootusb:

Marvell>> run bootusb
(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
12772864 bytes read in 811 ms (15 MiB/s)
11352 bytes read in 128 ms (85.9 KiB/s)

Ubuntu 14.04 LTS localhost.localdomain ttyMV0

localhost login: root (automatic login)

 * Stopping save kernel messages                                         [ OK ]
Welcome to Ubuntu 14.04 LTS (GNU/Linux 4.4.52-armada-17.06.2-gcaa3a4f 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:~#

 

Ubuntu 16.04.3 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.  If your laptop does not have a microSD card slot, use a USB microSD card reader. Once we have plugged the microSD card in our laptop, we 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


We can see that our microSD card was recognized as /dev/sdb/. Since we will be formatting our SD card, we want to clear everything from it first (of course, backup content from your SD card before this). We clear it with:

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 we mount this partition on our local Linux machine (e.g. we will mount it 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 pages, 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 micro USB cable and serial connection as described in Quick User Guide, section 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>> 
Marvell>>


Check that our SD card has necessary files we have transferred using ext4ls command (also check that the Image kernel image and armada-3720-community.dtb dtb file are in boot folder:

Marvell>> ext4ls mmc 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 tmp
<DIR>       4096 boot
<DIR>       4096 bin
<DIR>       4096 sys
<DIR>       4096 etc
<DIR>       4096 home
<DIR>       4096 sbin
<DIR>       4096 opt
<DIR>       4096 usr
<DIR>       4096 var
<DIR>       4096 proc
<DIR>       4096 run
<DIR>       4096 dev
<DIR>       4096 root
<DIR>       4096 lib
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 srv
Marvell>> ext4ls mmc 0:1 boot
<DIR>       4096 .
<DIR>       4096 ..
        12772864 Image
           11352 armada-3720-community.dtb


There are only a few variables we need to set (other needed variables should be set by default) in order to boot from microSD card. First, set proper image and device tree path and name if they are not already set:

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


Next we setup the boot command by changing the bootmmc variable. We will use this variable to boot 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 (in our case we copied it to the first partition).

After this we can save the variables we have set so far:

Marvell>> save


or setup the bootcmd variable for the ESPRESSObin to automatically boot with the desired variables:

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 we boot up the ESPRESSObin with run bootmmc:

Marvell>> run bootmmc
switch to partitions #0, OK
mmc0 is current device
12772864 bytes read in 4339 ms (2.8 MiB/s)
11352 bytes read in 72 ms (153.3 KiB/s)
## Flattened Device Tree blob at 04000000
   Booting using the fdt blob at 0x4000000
   Using Device Tree in place at 0000000004000000, end 0000000004005c57

Starting kernel ...

[TRUNCATED OUTPUT]

[  OK  ] Started Stop ureadahead data collection 45s after completed startup.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

Ubuntu 16.04.3 LTS localhost.localdomain ttyMV0

localhost login: root
Last login: Thu Feb 11 16:28:05 UTC 2016 on ttyMV0
Welcome to Ubuntu 16.04.3 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:~#

 

USB device


Unplug the USB device from your local machine and plug it into an USB port on the ESPRESSObin, plug the power adapter and connect to the board via micro USB cable and serial connection as described in Quick User Guide, section Serial Connection.

For the ESPRESSObin to boot the images we have placed on the USB device, we must configure valid U-Boot parameters to do so. 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>>
Marvell>>


First we can 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:

Marvell>> ext4ls usb 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 tmp
<DIR>       4096 boot
<DIR>       4096 bin
<DIR>       4096 sys
<DIR>       4096 etc
<DIR>       4096 home
<DIR>       4096 sbin
<DIR>       4096 opt
<DIR>       4096 usr
<DIR>       4096 var
<DIR>       4096 proc
<DIR>       4096 run
<DIR>       4096 dev
<DIR>       4096 root
<DIR>       4096 lib
<DIR>       4096 media
<DIR>       4096 mnt
<DIR>       4096 srv
Marvell>> ext4ls usb 0:1 boot
<DIR>       4096 .
<DIR>       4096 ..
        12772864 Image
           11352 armada-3720-community.dtb


using printenv we can list currently set U-Boot variables. If changed, here we need to set up correct values for image names:

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 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'


and lastly we boot by issuing run bootusb (login with root):

Marvell>> run bootusb
(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
12772864 bytes read in 803 ms (15.2 MiB/s)
11352 bytes read in 129 ms (85.9 KiB/s)
## Flattened Device Tree blob at 04000000
   Booting using the fdt blob at 0x4000000
   Using Device Tree in place at 0000000004000000, end 0000000004005c57

Starting kernel ...

[TRUNCATED OUTPUT]

[  OK  ] Started Stop ureadahead data collection 45s after completed startup.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

Ubuntu 16.04.3 LTS localhost.localdomain ttyMV0

localhost login: root
Welcome to Ubuntu 16.04.3 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

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:~#


And that is it, you have successfully booted Ubuntu 16.04.3 on your ESPRESSObin.