Difference between revisions of "IoTGateway/BSP/Linux/iMX6/BuildingUbuntuRootfs"

From ESS-WIKI
Jump to: navigation, search
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:Building Ubuntu Rootfs for i.MX6}} <!--
+
{{DISPLAYTITLE:Building Ubuntu 14.04 Rootfs for i.MX6}} <!--
 
{| align="right"
 
{| align="right"
 
|-
 
|-
Line 8: Line 8:
 
= Host Prerequisites =
 
= Host Prerequisites =
  
get the following packages installed
+
:get the following packages installed
 +
 
 +
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo apt-get install binfmt-support qemu-user-static wget
 
sudo apt-get install binfmt-support qemu-user-static wget
Line 14: Line 16:
 
= Building Procedures =
 
= Building Procedures =
  
== get the ubuntu base image ==
+
== ubuntu base image ==
  
  
Line 25: Line 27:
 
sudo cp /etc/resolv.conf $ROOTFS/etc/resolv.conf
 
sudo cp /etc/resolv.conf $ROOTFS/etc/resolv.conf
 
</syntaxhighlight>
 
</syntaxhighlight>
== pre-enter chroot environment ==
+
== chroot environment ==
 +
 
 +
=== beginning ===
  
  
Line 34: Line 38:
 
sudo mount --bind /dev $ROOTFS/dev
 
sudo mount --bind /dev $ROOTFS/dev
 
sudo mount --bind /dev/pts $ROOTFS/dev/pts
 
sudo mount --bind /dev/pts $ROOTFS/dev/pts
</syntaxhighlight>
 
== enter chroot environment ==
 
 
 
<syntaxhighlight lang="bash">
 
 
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i
 
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i
 
</syntaxhighlight>
 
</syntaxhighlight>
== operations in chroot environment ==
 
 
 
=== installation ===
 
=== installation ===
  
Line 60: Line 57:
  
 
apt-get install sudo openssh-server net-tools wireless-tools lxde iputils-ping rsyslog alsa-utils --no-install-recommends
 
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 xserver-xorg x11-utils x11-xserver-utils xterm lxdm lxmusic
 
apt-get install xscreensaver --no-install-recommends
 
apt-get install xscreensaver --no-install-recommends
 
apt-get install alsa-base python python3-dbus python3-apport samba-common smbclient gvfs
 
apt-get install alsa-base python python3-dbus python3-apport samba-common smbclient gvfs
Line 76: Line 73:
 
apt-get install libfm-modules libglib2.0-data libgtk2.0-bin libhtml-form-perl libhtml-format-perl libfont-afm-perl \
 
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
 
libhttp-daemon-perl libio-socket-inet6-perl libjpeg-progs libmailtools-perl libpam-ck-connector libxp6
 +
 +
apt-get install firefox fonts-wqy-zenhei smplayer
 
</syntaxhighlight>
 
</syntaxhighlight>
=== configurations ===
+
=== configuration ===
  
  
Line 95: Line 94:
 
EOT
 
EOT
  
cat << EOT > /etc/init/ttymxc0.conf
+
sed -i "s/\tsleep 20/#\tsleep 20/;s/\tsleep 40/#\tsleep 40/;s/\tsleep 59/#\tsleep 59/" /etc/init/failsafe.conf
 +
 
 +
cat > /etc/init/ttymxc0.conf << EOT
 
start on stopped rc RUNLEVEL=[2345]
 
start on stopped rc RUNLEVEL=[2345]
 
stop on runlevel [!2345]
 
stop on runlevel [!2345]
Line 107: Line 108:
 
history -c && rm ~/.bash_history
 
history -c && rm ~/.bash_history
 
</syntaxhighlight>
 
</syntaxhighlight>
== leave chroot environment ==
+
=== ending ===
  
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
logout
 
logout
</syntaxhighlight>
 
== post-leave chroot environment ==
 
 
 
<syntaxhighlight lang="bash">
 
 
sudo umount -lf $ROOTFS/dev/pts
 
sudo umount -lf $ROOTFS/dev/pts
 
sudo umount -lf $ROOTFS/dev
 
sudo umount -lf $ROOTFS/dev
Line 124: Line 120:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
= Additional Stuff =
+
 
 +
== Ubuntu rootfs LXDE versioin ==
 +
 
 +
LXDE (abbreviation for Lightweight X11 Desktop Environment) is a free desktop environment with comparatively low resource requirements.
 +
 
 +
[[File:LXDE2.png|400px|LXDE2.png]]
  
 
== modules & firmware ==
 
== modules & firmware ==
  
Depending on chosen kernel, please copy/install proper modules or firmware to $ROOTFS/modules or $ROOTFS/firmwware.
+
Copy the modules.tgz to /lib/modules.
 +
 
 +
Depending on chosen kernel, please copy/install proper modules $ROOTFS/lib/modules.
 +
 
 +
Depending the official build version&nbsp;:
 +
 
 +
For example&nbsp;: 4411A1LIV8210 Check your lib module path
 +
 
 +
:[[File:Module.jpg|400px|Module.jpg]]
 +
 
 +
Load module
 +
<syntaxhighlight lang="bash">
 +
depmod -a 4.1.15-official_build_version
 +
sync
 +
</syntaxhighlight>If you already insert module, please send command "lsmod" and check it.
 +
:[[File:Depmod.jpg|400px|Depmod.jpg]]
 +
 
 +
Check your load module
 +
 
 +
:[[File:Lsmod.jpg|400px|Lsmod.jpg]]
  
[[Category:Editor]]
+
Depending on chosen kernel, please copy/install firmware $ROOTFS/lib/firmwware.

Latest revision as of 10:06, 24 August 2017


Host Prerequisites

get the following packages installed


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

Building Procedures

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

chroot environment

beginning

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
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i

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
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

apt-get install firefox fonts-wqy-zenhei smplayer

configuration

adduser adv && usermod -aG adm,sudo,audio,video,plugdev adv
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

sed -i "s/\tsleep 20/#\tsleep 20/;s/\tsleep 40/#\tsleep 40/;s/\tsleep 59/#\tsleep 59/" /etc/init/failsafe.conf

cat > /etc/init/ttymxc0.conf << EOT
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

ending

logout
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


Ubuntu rootfs LXDE versioin

LXDE (abbreviation for Lightweight X11 Desktop Environment) is a free desktop environment with comparatively low resource requirements.

LXDE2.png

modules & firmware

Copy the modules.tgz to /lib/modules.

Depending on chosen kernel, please copy/install proper modules $ROOTFS/lib/modules.

Depending the official build version :

For example : 4411A1LIV8210 Check your lib module path

Module.jpg

Load module

depmod -a 4.1.15-official_build_version
sync
If you already insert module, please send command "lsmod" and check it.
Depmod.jpg

Check your load module

Lsmod.jpg

Depending on chosen kernel, please copy/install firmware $ROOTFS/lib/firmwware.