Building Ubuntu Rootfs for i.MX6

From ESS-WIKI
Revision as of 06:40, 20 July 2017 by Winston.huang (talk | contribs)
Jump to: navigation, search


Host Prerequisites

get the following packages installed

sudo apt-get install binfmt-support qemu-user-static wget

Building Procedures

get the ubuntu base image

wget http://cdimage.ubuntu.com/ubuntu-base/releases/14.04/release/ubuntu-base-14.04-core-armhf.tar.gz
export ROOTFS=~/rootfs

mkdir $ROOTFS
sudo tar xpvf ubuntu-base-14.04-core-armhf.tar.gz -C $ROOTFS
sudo cp /etc/resolv.conf $ROOTFS/etc/resolv.conf

pre-enter chroot environment

sudo cp -a /usr/bin/qemu-arm-static $ROOTFS/usr/bin
sudo mount -t proc proc $ROOTFS/proc
sudo mount -t sysfs sysfs $ROOTFS/sys
sudo mount --bind /dev $ROOTFS/dev
sudo mount --bind /dev/pts $ROOTFS/dev/pts

enter chroot environment

HOME=/root sudo chroot $ROOTFS /bin/bash --login -i

operations in chroot environment

installation

cd ~
cat <<EOT > /etc/apt/sources.list
deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe multiverse
#deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe multiverse
#deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse

#deb http://ports.ubuntu.com/ubuntu-ports/ trusty main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main universe
EOT

apt-get update

apt-get install sudo openssh-server net-tools wireless-tools lxde iputils-ping rsyslog alsa-utils --no-install-recommends
apt-get install xserver-xorg x11-utils x11-xserver-utils xterm lxdm lxmusic chromium-browser
apt-get install xscreensaver --no-install-recommends
apt-get install alsa-base python python3-dbus python3-apport samba-common smbclient gvfs
apt-get install anacron at-spi2-core avahi-daemon bc bluez-alsa bogofilter btrfs-tools colord dc galculator \
gdbserver genisoimage gksu gtk2-engines gvfs-fuse gvfs-backends hicolor-icon-theme inputattach kerneloops-daemon \
krb5-locales lftp menu menu-xdg ncurses-term p7zip-full pcmciautils policykit-desktop-privileges python-xdg rfkill \
screen scrot smemcap ssh-import-id tcpd ttf-dejavu-core ttf-freefont usbutils wamerican wget wpasupplicant xml-core \
xz-utils zip

wget -P ~ http://launchpadlibrarian.net/197440683/libdrm-freedreno1_2.4.56-1~ubuntu2_armhf.deb
dpkg -i ~/libdrm-freedreno1_2.4.56-1~ubuntu2_armhf.deb

apt-get install libegl1-mesa libgles1-mesa libgles2-mesa libgtk-3-bin

apt-get install libfm-modules libglib2.0-data libgtk2.0-bin libhtml-form-perl libhtml-format-perl libfont-afm-perl \
libhttp-daemon-perl libio-socket-inet6-perl libjpeg-progs libmailtools-perl libpam-ck-connector libxp6

configurations

adduser adv && addgroup adv adm && addgroup adv sudo && addgroup adv audio && addgroup adv video && addgroup adv plugdev
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow
sed -i "s/# autologin=dgod/autologin=adv/" /etc/lxdm/lxdm.conf
echo "imx6" > /etc/hostname
echo -e "127.0.0.1    localhost \n127.0.1.1    `cat /etc/hostname`\n" > /etc/hosts

cat >> /etc/network/interfaces << EOT
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOT

cat << EOT > /etc/init/ttymxc0.conf
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -L 115200 ttymxc0
EOT

ln -sf ../run/resolvconf/resolv.conf /etc/resolv.conf
dpkg-reconfigure tzdata
apt-get clean
history -c && rm ~/.bash_history

leave chroot environment

logout

post-leave chroot environment

sudo umount -lf $ROOTFS/dev/pts
sudo umount -lf $ROOTFS/dev
sudo umount $ROOTFS/sys
sudo umount $ROOTFS/proc
sudo rm $ROOTFS/usr/bin/qemu-arm-static

Additional Stuff

The Ubuntu rootfs is fully getting ready after proper modules & firmware installed.

modules & firmware

copy the proper modules & firmware to $ROOTFS/lib/modules & $ROOTFS/lib/firmware