Table of contents
Yocto root filesystem, kernel image and dtb file can be either:
- Built from source by following Build from source - Yocto tutorial or
- Downloaded from Tech Spec page, Software table under Yocto.
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 7,4G 0 disk └─sdb1 8:17 1 7,4G 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 create a new partition (sdb1) on the empty microSD card:
user@laptop:~$ (echo n; echo p; echo 1; echo ''; echo ''; echo w) | sudo fdisk /dev/sdb
and format this partition 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 the 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
Head into the mounted directory. Once in there, extract the marvell-image-machine-test-cb-88f3720-ddr3-espressobin.tar.bz2 rootfs archive:
user@laptop:~$ cd /mnt/sdcard user@laptop:/mnt/sdcard$ sudo tar -xvf /opt/yocto/espressobin/tmp/deploy/images/cb-88f3720-ddr3-espressobin/marvell-image-machine-test-cb-88f3720-ddr3-espressobin.tar.bz2
If you downloaded the rootfs archive from Tech Spec page, adjust the path above to point where you stored the downloaded archive.
The kernel image (Image-cb-88f3720-ddr3-espressobin.bin) and the dtb file for ESPRESSObin (Image-armada-3720-community.dtb) also need to be transferred to the boot/ directory on the newly extracted filesystem:
user@laptop:/mnt/sdcard$ sudo cp /opt/yocto/espressobin/tmp/deploy/images/cb-88f3720-ddr3-espressobin/Image-cb-88f3720-ddr3-espressobin.bin boot/ user@laptop:/mnt/sdcard$ sudo cp /opt/yocto/espressobin/tmp/deploy/images/cb-88f3720-ddr3-espressobin/Image-armada-3720-community.dtb boot/
Again, if using pre-available archive from Tech Spec page, adjust the paths of these files to where you extracted them on your system.
Our SD card is now ready and contains the necessary images. Exit the mounted directory and unmount it from your local machine:
user@laptop:/mnt/sdcard$ cd user@laptop:~$ sudo umount /mnt/sdcard
Setting U-Boot parameters
For the ESPRESSObin to boot the images and root filesystem we have placed on the removable media, we must configure valid 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 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>>
Firstly, check that the files on the SD card are recognized with ext4ls command:
Marvell>> ext4ls mmc 0:1
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.
Set valid Yocto image and device tree filenames and paths:
Marvell>> setenv image_name 'boot/Image-cb-88f3720-ddr3-espressobin.bin' Marvell>> setenv fdt_name 'boot/Image-armada-3720-community.dtb'
Next, define the bootmmc variable for booting 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 Yocto 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 and save these variables for the ESPRESSObin to automatically boot from the micro SD card on every reboot:
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. If you set the bootcmd variable, simply type reset. Log in with root:
Marvell>> run bootmmc switch to partitions #0, OK mmc0 is current device 12865536 bytes read in 725 ms (16.9 MiB/s) 11474 bytes read in 10 ms (1.1 MiB/s) ## Flattened Device Tree blob at 04f00000 Booting using the fdt blob at 0x4f00000 Using Device Tree in place at 0000000004f00000, end 0000000004f05cd1 Starting kernel ... [TRUNCATED OUTPUT] Marvell Embedded Linux 2.1 cb-88f3720-ddr3-espressobin /dev/ttyMV0 cb-88f3720-ddr3-espressobin login: root root@cb-88f3720-ddr3-espressobin:~#
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
and check that the file system, kernel image, and dtb file have been transferred correctly with the ext4ls command:
Marvell>> ext4ls usb 0:1
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-cb-88f3720-ddr3-espressobin.bin' Marvell>> setenv fdt_name boot/Image-armada-3720-community.dtb
Now set the bootusb variable which will be used 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 Yocto 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 and save these variables for the ESPRESSObin to automatically boot from the USB device across reboots:
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 (log in with root):
Marvell>> run bootusb