Creating Ubuntu filesystem

Table of contents

Among one of file systems supported by ESPRESSObin is Ubuntu file system (available relases are 14.04 and 16.04). 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

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

user@laptop:~$ mkdir -p ubuntu
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$ mkdir fs
user@laptop:~/ubuntu$ cd fs/
user@laptop:~/ubuntu$ sudo tar -xvf ../ubuntu-base-14.04-core-arm64.tar.gz

Our fs/ directory now has Ubuntu file system:

user@laptop:~/ubuntu/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/fs$ sudo vi etc/init/rc-sysinit.conf

 12 # Default runlevel, this may be overriden on the kernel command-line
 13 # or by faking an old /etc/inittab entry

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/fs$ sudo vi etc/passwd

1 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/fs$ sudo vi etc/init/ttyMV0.conf

and in it we paste the following:

start on stopped rc or RUNLEVEL=[12345]
stop on runlevel [!12345]
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/fs$ sudo cp /home/user/kernel/4.4.8/arch/arm64/boot/Image boot/
espressobin@buildserver:~/ubuntu/fs$ sudo cp /home/user/kernel/4.4.8/arch/arm64/boot/dts/marvell/armada-3720-community.dtb boot/


Ubuntu 16.04

We will begin by downloading a copy of Ubuntu OS (16.04.2. 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.2/release/ubuntu-16.04.2-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.2-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
11376 inodes (12174 blocks) to write

[==========================================================================|] 12174/12174 100%

created 9484 files
created 1129 directories
created 1808 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   dev  home  media  opt   root  sbin  sys  usr
boot  etc  lib   mnt    proc  run   srv   tmp  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
# we need to remove 'x'

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

# s390 and s390x ports in LPAR mode

And that is it, the root file system is now able to run on ESPRESSObin. Optionally, you can zip the folder up to extract it later to a removable media such as microSD card or USB device.

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

Zipping up is recommended since this approach was used in the Boot from removable storage - Ubuntu page. So, click on that link to see how to transfer necessary images and the newly created file system to either microSD card or USB device.