Table of contents
OpenWrt dtb file, image and root file system for ESPRESSObin can be either:
- built from source by following Build from source - Openwrt tutorial or
- downloaded from Tech Spec page, Software table
This page we will show you how to transfer those files to either microSD card or USB device and boot ESPRESSObin from it.
For OpenWrt 18.06 stable release, see
Creating bootable MicroSD card/USB device
The example instructions below show the case of Micro SD card in a card reader and are identical to how you would setup a bootable USB device. Furthermore, the instructions below are the same no matter which kernel or OpenWrt version is used.
First, 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 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 (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
and check again with lsblk that everything was cleared:
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
Next we will create a new partition (sdb1) on the empty SDcard:
user@laptop:~$ (echo n; echo p; echo 1; echo ''; echo ''; echo w) | sudo fdisk /dev/sdb [Example output] Welcome to fdisk (util-linux 2.27.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xff4497d6. Command (m for help): Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Partition number (1-4, default 1): First sector (2048-15523839, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839): Created a new partition 1 of type 'Linux' and of size 7,4 GiB. Command (m for help): The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
and we will format this partition as EXT4 with:
- For e2fsprogs < 1.43 use:
user@laptop:/$ sudo mkfs.ext4 /dev/sdb1
- For e2fsprogs >=1.43 use:
user@laptop:/$ sudo mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdb1
Mount the partition on our 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 and extract the OpenWrt root file system to it.
user@laptop:~$ cd /mnt/sdcard user@laptop:/mnt/sdcard$ sudo tar -xzf /opt/openwrt/openwrt-dd/bin/mvebu64/openwrt-mvebu64-armada-espressobin-rootfs.tar.gz -C .
Adjust the root file system path to point to the location where it was built or downloaded. Now, create a boot/ directory where the device tree file and image will be copied:
user@laptop:/mnt/sdcard$ sudo mkdir -p boot/ user@laptop:/mnt/sdcard$ sudo cp /opt/openwrt/openwrt-dd/bin/mvebu64/armada-3720-community.dtb boot/ user@laptop:/mnt/sdcard$ sudo cp /opt/openwrt/openwrt-dd/bin/mvebu64/openwrt-armada-ESPRESSObin-Image boot/
Again, adjust the path of the device tree file and image accordingly. Our SD card is now ready and contains necessary OpenWrt files. 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
Using MicroSD 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 via micro USB cable and serial connection as described in Quick User Guide, section Serial Connection.
For the ESPRESSObin to boot the OpenWrt files and root filesystem we have placed on the SD card, 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 the files on our SD card are recognized with ext4ls command which is used for listing files from an ext4-formatted partition and whose syntax is as follows:
ext4ls <dev[:part]> [directory]
So in our case, we want to list contents from mmc device 0 and its first partition:
Marvell>> ext4ls mmc 0:1
Now we can move onto setting U-Boot parameters. You can list all existing parameters with printenv command. 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 we set proper boot image and device tree name for our OpenWrt files:
Marvell>> setenv fdt_name 'boot/armada-3720-community.dtb' Marvell>> setenv image_name 'boot/openwrt-armada-ESPRESSObin-Image'
and set other necessary U-Boot parameters if they are not set already:
Marvell>> setenv ethact 'neta0' Marvell>> setenv set_bootargs 'setenv bootargs $console'
Lastly, we set the bootmmc variable which we will use to boot ESPRESSObin:
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'
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 save the environment with save:
Marvell>> saveenv
and boot with run bootmmc:
Marvell>> run bootmmc switch to partitions #0, OK mmc0 is current device 12969984 bytes read in 4698 ms (2.6 MiB/s) 8175 bytes read in 151 ms (52.7 KiB/s) ## Flattened Device Tree blob at 01000000 Booting using the fdt blob at 0x1000000 Using Device Tree in place at 0000000001000000, end 0000000001004fee Starting kernel ... [Truncated output] BusyBox v1.24.2 () built-in shell (ash) _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- DESIGNATED DRIVER (Bleeding Edge, 12009) ----------------------------------------------------- * 2 oz. Orange Juice Combine all juices in a * 2 oz. Pineapple Juice tall glass filled with * 2 oz. Grapefruit Juice ice, stir well. * 2 oz. Cranberry Juice ----------------------------------------------------- root@OpenWrt:/#
and that is it, you have successfully booted OpenWrt on your ESPRESSObin using a microSD card. View an example bootlog for 17.02 release here.
Using USB device
If you are using the USB stick to store the OpenWrt kernel image/dtb and root file system for ESPRESSObin, you will need to configure the U-Boot environment variables differently than those for Micro SD card in order to pick up the content from the USB stick.
Assuming you already have the USB stick with root file system created, first you will need to setup the proper connections on ESPRESSObin, plug in the USB stick to the USB port and power on the board. When the U-Boot starts please hit enter key to stop the autoboot process.
Hit any key to stop autoboot: 0 Marvell>> Marvell>>
Do usb reset command under U-Boot command line to activate the USB stick, the example below shows there is one USB storage device being detected.
Marvell>> usb reset (Re)start USB... USB0: Register 2000120 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
Then you may use the ext4ls command to list the files in the USB stick you have attached to the ESPRESSObin board. The command syntax is:
ext4ls <dev[:part]> [directory]
In this example the interface will be usb, dev should be 0, first partition should be 1:
Marvell>> ext4ls usb 0:1
To list the boot directory, we would use:
Marvell>> ext4ls usb 0:1 boot
You can use the printenv command to print all the existing variables under U-Boot. To boot the kernel and root file system from the USB stick, you will just need to change a few of the parameters. First, setup the correct kernel image name and device tree name:
Marvell>> setenv image_name 'boot/openwrt-armada-ESPRESSObin-Image' Marvell>> setenv fdt_name 'boot/armada-3720-community.dtb'
Next step is to create a new variable bootusb to hold the command to boot from USB stick:
Marvell>> setenv bootusb 'usb reset; 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'
Use save command to save the variables to the on-board SPI flash.
Marvell>> saveenv
Optionally, you can also setup the bootcmd variable for ESPRESSObin to automatically boot from the USB device every time you power on the board.
Marvell>> setenv bootcmd 'usb reset; 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' Marvell>> save
Now we can boot the kernel with:
Marvell>> run bootusb [Truncated output] Starting kernel ... [Truncated output] BusyBox v1.24.2 () built-in shell (ash) _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- DESIGNATED DRIVER (Bleeding Edge, 12009) ----------------------------------------------------- * 2 oz. Orange Juice Combine all juices in a * 2 oz. Pineapple Juice tall glass filled with * 2 oz. Grapefruit Juice ice, stir well. * 2 oz. Cranberry Juice ----------------------------------------------------- root@OpenWrt:/#
and that is it, you have successfully booted OpenWrt on your ESPRESSObin using a USB device.
OpenWrt 18.06
As of August 2018 and the 18.06 release, upstream support for ESPRESSObin is added to OpenWrt. Images, as well as supplementary files (packages, build tools, imagebuilder, and other useful files) for the ESPRESSObin board can be downloaded from the OpenWrt Download pages. Here we will show how to prepare and boot the SD card image (openwrt-18.06.0-mvebu-cortexa53-globalscale-espressobin-ext4-sdcard.img.gz).
It is recommended to use the latest U-Boot version (2017.03-armada-17.10), whereas older versions require additional effort (see here).
After downloading the SD card image, insert the micro SD card into your local Linux machine and write the image (naturally, replace sdX with the label of your SD card):
$ sudo su # zcat openwrt-18.06.0-mvebu-cortexa53-globalscale-espressobin-ext4-sdcard.img.gz > /dev/sdX # exit
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 via 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. There simply set the bootcmd variable to automatically boot OpenWrt on every reboot:
Marvell>> setenv bootcmd 'load mmc 0:1 0x4d00000 boot.scr; source 0x4d00000'
Optionally, save this environment with saveenv and finally reboot the board:
Marvell>> reset [Truncated output] Starting kernel ... [Truncated output] BusyBox v1.28.3 () built-in shell (ash) _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- OpenWrt 18.06.0, r7188-b0b5c64c22 ----------------------------------------------------- === WARNING! ===================================== There is no root password defined on this device! Use the "passwd" command to set up a new password in order to prevent unauthorized SSH logins. -------------------------------------------------- root@OpenWrt:/#