Table of contents
Among one of file systems supported by ESPRESSObin is ArchLinux ARM file system. Here we will show you how to transfer ArchLinux ARM file system for ESPRESSObin to either a microSD card or USB device. Note that you will need a Linux machine to follow the instructions on this page.
Preparing removable storage
Creating bootable microSD card
Before we can download and extract ArchLinux ARM file system on microSD card, we need to prepare the SD card. 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.
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
and check again with lsblk that everything was cleared. 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 [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 0x0c01515c. 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-7744511, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-7744511, default 7744511): Created a new partition 1 of type 'Linux' and of size 3,7 GiB. Command (m for help): The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
and format it 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
Next we mount this partition on our local Linux machine (e.g. we will mount it to /mnt/):
user@laptop:~$ sudo mount /dev/sdb1 /mnt/
Now we will make a directory where we will download the file system (e.g. /home/user/archlinux/):
user@laptop:~$ mkdir archlinux && cd archlinux user@laptop:~/archlinux$ wget http://os.archlinuxarm.org/os/ArchLinuxARM-espressobin-latest.tar.gz
Now as root (not as sudo) download and extract the file system:
user@laptop:~/archlinux$ sudo su root@laptop:~/archlinux# bsdtar -xpf ArchLinuxARM-espressobin-latest.tar.gz -C /mnt/
Lastly unmount the SD card from your local machine and exit sudo:
root@laptop:~/archlinux# umount /mnt root@laptop:~/archlinux# exit exit
Insert the micro SD card into the SD card slot on the ESPRESSObin and connect an Ethernet cable to the WAN port (next to the USB 3.0 port)
Creating bootable USB device
Instructions for setting up a bootable USB device are similar to the instructions above with a minor exception. After untaring the ArchLinuxARM-espressobin-latest.tar.gz to your USB device, head to boot/ directory and create a file uEnv_usb.txt:
root@laptop:~/archlinux# cd /mnt root@laptop:~/mnt$ vim boot/uEnv_usb.txt
and in there paste the following:
kernel_addr=0x2000000 ramdisk_addr=0x1100000 fdt_addr=0x1000000 fdt_high=0xffffffffffffffff image_name=/boot/Image ramdisk_name=/boot/initramfs-linux.uimg fdt_name=/boot/dtbs/marvell/armada-3720-espressobin.dtb get_env=if ext4load usb 0:1 $loadaddr /boot/uEnv_usb.txt; then env import -t $loadaddr $filesize; if test -n ${uenvcmd}; then run uenvcmd; fi; fi get_images=ext4load usb 0:1 $kernel_addr $image_name && ext4load usb 0:1 $fdt_addr $fdt_name get_ramdisk=ext4load usb 0:1 $ramdisk_addr $ramdisk_name bootargs=console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 root=/dev/sda1 rw rootwait bootcmd=usb start; run get_env; if run get_images; then if run get_ramdisk; then booti $kernel_addr $ramdisk_addr $fdt_addr; else booti $kernel_addr - $fdt_addr; fi; fi
Save and exit the file, after which you can exit the mounted directory and unmount the USB device.
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 using micro USB cable and serial connection as described in Quick User Guide, section Serial Connection.
For the ESPRESSObin to boot ArchLinux filesystem and images we 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>>
Here we need to set several environment variables:
Marvell>> mmc dev 0 Marvell>> ext4load mmc 0 $loadaddr /boot/uEnv.txt Marvell>> env import -t $loadaddr $filesize
and save the environment with:
Marvell>> saveenv
Lastly we boot the system with (login as the default user alarm with the password alarm):
Marvell>> boot [Truncated output] [ OK ] Reached target Multi-User System. [ OK ] Reached target Graphical Interface. [ 15.200064] mv88e6085 d0032004.mdio-mii:01 wan: Link is Up - 1Gbps/Full - flow control rx/tx [ 15.208772] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready Arch Linux 4.16.6-1-ARCH (ttyMV0) alarm login: alarm alarm Password: [alarm@alarm ~]$
The default root password is root.
Using USB device
If you are using the USB stick to store the ArchLinux 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
after which load the environment variables from the boot/uEnv_usb.txt file we have made earlier:
Marvell>> ext4load usb 0:1 $loadaddr /boot/uEnv_usb.txt 766 bytes read in 30 ms (24.4 KiB/s) Marvell>> env import -t $loadaddr $filesize
Optionally, you can save these variables to boot from the USB every time you startup ESPRESSObin:
Marvell>> saveenv
and lastly boot the system using the boot command (login as the default user alarm with the password alarm):
Marvell>> boot [Truncated output] [ OK ] Reached target Multi-User System. [ OK ] Reached target Graphical Interface. [ 17.905590] mv88e6085 d0032004.mdio-mii:01 wan: Link is Up - 1Gbps/Full - flow control rx/tx [ 17.914394] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready Arch Linux 4.16.6-1-ARCH (ttyMV0) alarm login: alarm Password: [alarm@alarm ~]$
The default root password is root.
Default system configuration
Few notes regarding the default system configuration:
- All network interface configuration is handled by systemd-networkd, with the configurations in /etc/systemd/network.
- Plug an Ethernet cable into the WAN port on the ESPRESSObin (the port closest to the USB 3.0 port). This port is instantiated as the wan interface for connecting to the Internet.
- This is set up via wan.network. The eth0.network file is required to bring up the link on the eth0 interface to bring up all three ports.
- The two other ethernet ports are the lan0 and lan1 interfaces, and have been combined into the bridge interface br0 with the static IP 10.0.0.1.
- These are set up via lan.network, br0.network, and br0.netdev.
- The br0 interface is set up for IP masquerading through the wan interface, and both have IP forwarding enabled.
- The dnsmasq service is started on boot to provide a DHCP server for the br0 interface, serving the IP range 10.0.0.5-10.0.0.250.