Most embedded filesystems(rootfs) are build with debootstrap or Linaro. Let’s explore a third possibility with core-ubuntu filesystems.
Steps to perform on any Debian based distribution (preferably)
1) Create some directory of your choice and download the core rootfs from Ubuntu server
mkdir ~/ubuntu-rootfs && cd ubuntu-rootfs
wget http://cdimage.ubuntu.com/ubuntu-core/releases/14.04.1/release/ubuntu-core-14.04-core-armhf.tar.gz
2) Extract the downloaded image with ‘sudo’ to allow ‘mknod’ commands to work
sudo tar -xpf ubuntu-core-14.04-core-armhf.tar.gz
You may remove the ubuntu-core-14.04-core-armhf.tar.gz
file now.
Change directory cd ..
or cd -
3) Install qemu-user-static
from your package manager
sudo cp /usr/bin/qemu-arm-static usr/bin/
4) Mount proc, sys, dev, dev/pts
to new fileystem. We will use a simple bash script for mounting and un-mounting. Download ch-mount.sh to present directory.
sudo bash ch-mount.sh -m ubuntu-rootfs/
5) Once you are in chroot
environment, edit /etc/apt/sources.list
and un-comment all the repositories except the ones starting with deb-src.
You may use vim.tiny
text editor
6) To update repositories, copy your system’s(host machine’s) /etc/resolv.conf
to ~/ubuntu-rootfs/etc/resolv.conf
.Set proxies if required.
7) Now update the repositories
apt-get update
8) Now install minimal packages required for X server and some core utils
apt-get install language-pack-en-base sudo ssh net-tools ethtool wireless-tools lxde xfce4-power-manager xinit xorg network-manager iputils-ping rsyslog lightdm-gtk-greeter alsa-utils gnome-mplayer lightdm bash-completion lxtask htop python-gobject-2 python-gtk2 synaptic --no-install-recommends
9) Now add a user of your choice and include him in suitable groups
adduser student && addgroup student adm && addgroup student sudo && addgroup student audio
10) Add hostname to /etc/hostname
echo ‘netbook’ > /etc/hostname
10) Add host entry in /etc/hosts
127.0.0.1 localhost 127.0.1.1 netbook
11) Also on few ARM devices, if you are using source from Android kernel, then you may have to do the following too
groupadd -g 3003 android_inet && addgroup student android_inet
12) Make X used by ‘anyuser’
dpkg-reconfigure x11-common
13) To allow /etc/resolv.conf
to update DNS automatically based on network connection (as we changed that file previously to make internet work)
dpkg-reconfigure resolvconf
(Select ‘Yes’ to the first dialog box, i.e allow dynamic updates)
14) Set ‘timezone’
dpkg-reconfigure tzdata
15) Create directories for ‘firmware’ and ‘modules’ in ‘/lib'(ofcourse inside chroot) and copy your hardware specific files from host
cp -r /opt/out/modules/3.4.5 ~/ubuntu-rootfs/lib/modules
16)Optional. To enable login at serial console, add following in /etc/init/ttyS0.conf
file and run sudo start ttyS0
start on stopped rc or RUNLEVEL=[12345] stop on runlevel [!12345] respawn exec /sbin/getty -L 115200 ttyS0 vt102
That’s all, you may customize even further if required.