Loading...
 

Creating Ubuntu filesystem

Among one of file systems supported by ESPRESSObin is Ubuntu file system (available relases are 14.04.5 LTS and 16.04.3 LTS). Here we will show you how to create Ubuntu file system for ESPRESSObin for both releases. Note that you will need a Linux machine to follow the instructions on this page.

Ubuntu 14.04.5 LTS


We begin by downloading a copy of Ubuntu file system (14.04.5 LTS). Make a directory where you will download the file system (for example /home/espressobin/ubuntu_14.04/):

user@laptop:~$ mkdir -p ubuntu_14.04
user@laptop:~/ubuntu$ wget http://cdimage.ubuntu.com/ubuntu-base/releases/14.04/release/ubuntu-base-14.04-core-arm64.tar.gz


After the file system has downloaded, make a new directory where we will extract the file system:

user@laptop:~/ubuntu_14.04$ mkdir fs
user@laptop:~/ubuntu_14.04$ cd fs/
user@laptop:~/ubuntu_14.04$ sudo tar -xvf ../ubuntu-base-14.04-core-arm64.tar.gz


Our fs/ directory now has Ubuntu file system:

user@laptop:~/ubuntu_14.04/fs$ ls
bin   dev  home  media  opt   root  sbin  sys  usr
boot  etc  lib   mnt    proc  run   srv   tmp  var


Now we will need to edit few configuration files in order for the Ubuntu file system to later boot properly from microSD card. Open the file etc/init/rc-sysinit.conf and there set the variable DEFAULT_RUNLEVEL to 3:

user@laptop:~/ubuntu_14.04/fs$ sudo vi etc/init/rc-sysinit.conf

 # Default runlevel, this may be overriden on the kernel command-line
 # or by faking an old /etc/inittab entry
 env DEFAULT_RUNLEVEL=3


Next we will remove the login password for root by editing the /etc/passwd file (remove the x after the first root):

user@laptop:~/ubuntu_14.04/fs$ sudo vi etc/passwd

root::0:0:root:/root:/bin/bash


Last thing we need to do is to create a file ttyMV0.conf in /etc/init

user@laptop:~/ubuntu_14.04/fs$ sudo vi etc/init/ttyMV0.conf


and in it we paste the following (if this is incorrect the boot will freeze):

start on stopped rc or RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
exec /sbin/getty -L 115200 ttyMV0 vt100 -a root


Now we need to copy the kernel image and device tree to the boot directory:

user@laptop:~/ubuntu_14.04/fs$ sudo cp ~/kernel/4.4.52/arch/arm64/boot/Image boot/
user@laptop:~/ubuntu_14.04/fs$ sudo cp ~/kernel/4.4.52/arch/arm64/boot/dts/marvell/armada-3720-community.dtb boot/


Kernel image and dtb file are available by either following instructions at Build from source - Kernel or they can be downloaded at Tech Spec page, Software table under Linux kernel.

Lastly, we will zip the folder up to later extract it to a removable media such as micro SD card or USB stick:

user@laptop:~/ubuntu_14.04/fs$ cd ..
user@laptop:~/ubuntu_14.04$ sudo tar -cjvf rootfs.tar.bz2 -C fs/ .


This tar containing the Ubuntu 14.04.5 LTS root file system (with kernel binary and dtb file included) can also be downloaded from our Tech Spec page, Software table under Ubuntu 14.04.5 LTS.

Head over to Boot from removable storage - Ubuntu page to see how to properly format either a microSD card or USB device, extract the Ubuntu file system onto it and boot Ubuntu on your ESPRESSObin.

Ubuntu 16.04.3 LTS


We will begin by downloading a copy of Ubuntu OS (16.04.3. LTS). First we make a directory where we will download the iso image (for example /home/user/ubuntu_16.04/):

user@laptop:~$ mkdir -p ubuntu_16.04
user@laptop:~/ubuntu_16.04$ wget http://cdimage.ubuntu.com/releases/16.04.3/release/ubuntu-16.04.3-server-arm64.iso


After the iso image has been downloaded, create a new subdirectory where we will mount the iso image:

user@laptop:~/ubuntu_16.04$ mkdir tmp
user@laptop:~/ubuntu_16.04$ sudo mount -o loop ubuntu-16.04.3-server-arm64.iso tmp/


The Ubuntu file system (named filesystem.squashfs) is located in the /install subdirectory:

user@laptop:~/ubuntu_16.04$ ls tmp/install/
filesystem.manifest  filesystem.squashfs      hwe-initrd.gz  hwe-vmlinuz  netboot
filesystem.size      filesystem.squashfs.gpg  hwe-netboot    initrd.gz    vmlinuz


Next we will unsquash that file system into a directory named rootfs:

user@laptop:~/ubuntu_16.04$ sudo unsquashfs -d rootfs/ tmp/install/filesystem.squashfs
Parallel unsquashfs: Using 4 processors
11381 inodes (12201 blocks) to write

[=====================================================================================|] 12201/12201 100%

created 9488 files
created 1130 directories
created 1809 symlinks
created 79 devices
created 0 fifos


and we can list the contents of our file system:

user@laptop:~/ubuntu_16.04$ ls rootfs/
bin  boot  dev  etc  home  lib  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var


All that is left is a bit of tweaking of the created file system. First we need to remove the password for root login. To do that, we open rootfs/etc/passwd file and remove the first 'x' between root: and :0 so that the line looks like this:

# open the file with your favorite editor
user@laptop:~/ubuntu_16.04$ sudo vim rootfs/etc/passwd
# in the first line
root:x:0:0:root:/root:/bin/bash
# we need to remove 'x'
root::0:0:root:/root:/bin/bash


Next we need to append ttyMV0 to the end of file /etc/securetty so open the file:

user@laptop:~/ubuntu_16.04$ sudo vim rootfs/etc/securetty


and at the end of the file append ttyMV0 like this:

# Serial Console for MIPS Swarm
duart0
duart1

# s390 and s390x ports in LPAR mode
ttysclp0
ttyMV0


Lastly, we also need to copy the kernel binary and dtb file to the root file system. Kernel image and dtb file are available by either following instructions at Build from source - Kernel or they can be downloaded at Tech Spec page, Software table under Linux kernel. Either way, copy the Image kernel binary and the armada-8040-mcbin.dtb dtb file to the rootfs/boot directory:

user@laptop:/ubuntu$ sudo cp ~/kernel/4.4.52/arch/arm64/boot/Image rootfs/boot/
user@laptop:/ubuntu$ sudo cp ~/kernel/4.4.52/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtb rootfs/boot/


Now we will zip the folder up to later extract it to a removable media such as micro SD card or USB stick:

user@laptop:~/ubuntu_16.04$ sudo tar -cjvf rootfs.tar.bz2 -C rootfs/ .


This tar containing the Ubuntu root file system (with kernel binary and dtb file included) can also be downloaded from our Tech Spec page, Software table under Ubuntu 16.04.3 LTS.

Head over to Boot from removable storage - Ubuntu page to see how to properly format either a microSD card or USB device and extract the Ubuntu file system onto it.