Difference between revisions of "IoTGateway/BSP/Linux/Quark/BuildingDebianJessieRootfs"

From ESS-WIKI
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
-->
 
-->
  
= Host Required =
+
= Host OS Required =
== Ubuntu 14.04 LTS ==
+
 
:All building procedures are verified in Ubuntu 14.04 LTS.
+
== Ubuntu 14.04 LTS amd64 ==
 +
 
 +
:All procedures are verified in Ubuntu 14.04 LTS amd64.
 +
 
 +
= Prerequisites =
 +
 
 +
== image-full-quark.ext3 ==
 +
 
 +
:extract from [[IoTGateway/BSP/Linux/Quark/Yocto_LBV2_User_Guide#Prebuilt_image_pack|prebuilt image pack]] or [[IoTGateway/BSP/Linux/Quark/Yocto_LBV2_User_Guide#To_build_all_image_files|build a new one]]
  
 
= Building Procedures =
 
= Building Procedures =
  
== first stage rootfs ==
+
== first stage ==
  
  
Line 18: Line 26:
 
SID=jessie
 
SID=jessie
 
IMAGE=./image-$SID-quark.ext3
 
IMAGE=./image-$SID-quark.ext3
 +
IMAGE_BSP=./image-full-quark.ext3
 
ROOTFS=~/rootfs
 
ROOTFS=~/rootfs
dd if=/dev/zero of=$IMAGE bs=1G count=1
+
ROOTFS_BSP=~/rootfs_bsp
mkfs.ext3 $IMAGE
+
dd if=/dev/zero of=$IMAGE bs=1M count=1800
mkdir $ROOTFS
+
sudo mkfs.ext3 -F $IMAGE
 +
mkdir -p $ROOTFS $ROOTFS_BSP
 +
sudo mount -o loop,ro $IMAGE_BSP $ROOTFS_BSP
 
sudo mount -o loop $IMAGE $ROOTFS
 
sudo mount -o loop $IMAGE $ROOTFS
 +
tar cf - -C $ROOTFS_BSP lib/{firmware,modules} | sudo tar xvf - -C $ROOTFS
 +
sudo umount $ROOTFS_BSP
 
sudo debootstrap --arch=i386 --foreign $SID $ROOTFS
 
sudo debootstrap --arch=i386 --foreign $SID $ROOTFS
 +
sudo cp /etc/resolv.conf $ROOTFS/etc
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
== second stage ==
  
== chroot environment ==
 
 
=== beginning ===
 
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
sudo cp /etc/resolv.conf $ROOTFS/etc
 
 
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i
 
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i
</syntaxhighlight>
+
SID=jessie
=== installation ===
+
export LANG=C
 
+
/debootstrap/debootstrap --second-stage
<syntaxhighlight lang="bash">
 
cd ~
 
 
cat <<EOT > /etc/apt/sources.list
 
cat <<EOT > /etc/apt/sources.list
deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe multiverse
+
deb http://ftp.uk.debian.org/debian $SID main contrib non-free
#deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe multiverse
+
deb-src http://ftp.uk.debian.org/debian $SID main contrib non-free
#deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse
+
deb http://ftp.uk.debian.org/debian $SID-updates main contrib non-free
 
+
deb-src http://ftp.uk.debian.org/debian $SID-updates main contrib non-free
#deb http://ports.ubuntu.com/ubuntu-ports/ trusty main universe
+
deb http://security.debian.org/debian-security $SID/updates main contrib non-free
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main universe
+
deb-src http://security.debian.org/debian-security $SID/updates main contrib non-free
 
EOT
 
EOT
 
 
apt-get update
 
apt-get update
 
+
apt-get install locales dialog
apt-get install sudo openssh-server net-tools wireless-tools lxde iputils-ping rsyslog alsa-utils --no-install-recommends
+
dpkg-reconfigure locales
apt-get install xserver-xorg x11-utils x11-xserver-utils xterm lxdm lxmusic
+
dpkg-reconfigure tzdata
apt-get install xscreensaver --no-install-recommends
+
apt-get install ntpdate
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
 
</syntaxhighlight>
 
=== configuration ===
 
<syntaxhighlight lang="bash">
 
 
 
 
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow
 
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow
 
echo "quark" > /etc/hostname
 
echo "quark" > /etc/hostname
echo -e "127.0.0.1    localhost \n127.0.1.1    `cat /etc/hostname`\n" > /etc/hosts
 
 
 
cat >> /etc/network/interfaces << EOT
 
cat >> /etc/network/interfaces << EOT
  
Line 82: Line 68:
 
EOT
 
EOT
  
sed -i "s/# \"\\\e\[1~\"/\"\\\e\[1~\"/" /etc/inputrc; \
+
sed -i '/# "\\e\[5~": history/s/^# "\\e\[5~"/"\\e\[A"/' /etc/inputrc
sed -i "s/# \"\\\e\[4~\"/\"\\\e\[4~\"/" /etc/inputrc; \
+
sed -i '/# "\\e\[6~": history/s/^# "\\e\[6~"/"\\e\[B"/' /etc/inputrc
sed -i "s/# \"\\\e\[3~\"/\"\\\e\[3~\"/" /etc/inputrc; \
 
sed -i "s/# \"\\\e\[5~\"\: history/\"\\\e\[A\": history/" /etc/inputrc; \
 
sed -i "s/# \"\\\e\[6~\"\: history/\"\\\e\[B\": history/" /etc/inputrc
 
 
 
 
sed -i '/^# .*dircolors/s/^# //; /^# .*LS_OPTIONS/s/^# //;' /root/.bashrc
 
sed -i '/^# .*dircolors/s/^# //; /^# .*LS_OPTIONS/s/^# //;' /root/.bashrc
 
sed -i "s/\xf0\x0f\xb1\x8b/\x90\x0f\xb1\x8b/g" /lib/i386-linux-gnu/libpthread-2.19.so
 
sed -i "s/\xf0\x0f\xb1\x8b/\x90\x0f\xb1\x8b/g" /lib/i386-linux-gnu/libpthread-2.19.so
 
sed -i '/\[Service\]/a Environment="TERM=xterm"' "/lib/systemd/system/serial-getty@.service"
 
sed -i '/\[Service\]/a Environment="TERM=xterm"' "/lib/systemd/system/serial-getty@.service"
 
+
logout
dpkg-reconfigure tzdata
 
apt-get clean
 
history -c && rm ~/.bash_history
 
 
</syntaxhighlight>
 
</syntaxhighlight>
=== ending ===
+
== post-config ==
  
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
logout
 
 
sudo rm $ROOTFS/etc/resolv.conf
 
sudo rm $ROOTFS/etc/resolv.conf
 +
sudo umount $ROOTFS
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
== sdcard\boot\grub\grub.conf&nbsp; ==
 +
<pre>default 2
 +
timeout 5
  
== modules & firmware ==
+
color white/blue white/cyan
 
 
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
+
title Quark X1000 kernel-SPI initrd-SPI IMR-On IO-APIC/HPET NoEMU
<syntaxhighlight lang="bash">
+
&nbsp; &nbsp; kernel --spi root=/dev/ram0 console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw
depmod -a 4.1.15-official_build_version
+
&nbsp; &nbsp; initrd --spi
sync
 
</syntaxhighlight>If you already insert module, please send command "lsmod" and check it.
 
:[[File:Depmod.jpg|400px|Depmod.jpg]]
 
  
Check your load module
+
title Quark X1000 kernel-MassStorage iot-devkit on SD IMR-On IO-APIC/HPET NoEMU debug
 +
&nbsp; &nbsp; root (hd0,0)
 +
&nbsp; &nbsp; kernel /bzImage root=/dev/mmcblk0p2 rootwait console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5
  
:[[File:Lsmod.jpg|400px|Lsmod.jpg]]
+
title Quark X1000 kernel-MassStorage initrd-MassStorage RootFS-MassStorage IMR-On IO-APIC/HPET NoEMU debug
 +
&nbsp; &nbsp; root (hd0,0)
 +
&nbsp; &nbsp; kernel /bzImage root=/dev/ram0 console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5 rootimage=image-full-quark.ext3
 +
&nbsp; &nbsp; initrd /core-image-minimal-initramfs-quark.cpio.gz
  
Depending on chosen kernel, please copy/install firmware $ROOTFS/lib/firmwware.
+
</pre>
[[Category:Editor]]
 

Latest revision as of 10:29, 5 January 2018


Host OS Required

Ubuntu 14.04 LTS amd64

All procedures are verified in Ubuntu 14.04 LTS amd64.

Prerequisites

image-full-quark.ext3

extract from prebuilt image pack or build a new one

Building Procedures

first stage

SID=jessie
IMAGE=./image-$SID-quark.ext3
IMAGE_BSP=./image-full-quark.ext3
ROOTFS=~/rootfs
ROOTFS_BSP=~/rootfs_bsp
dd if=/dev/zero of=$IMAGE bs=1M count=1800
sudo mkfs.ext3 -F $IMAGE
mkdir -p $ROOTFS $ROOTFS_BSP
sudo mount -o loop,ro $IMAGE_BSP $ROOTFS_BSP
sudo mount -o loop $IMAGE $ROOTFS
tar cf - -C $ROOTFS_BSP lib/{firmware,modules} | sudo tar xvf - -C $ROOTFS
sudo umount $ROOTFS_BSP
sudo debootstrap --arch=i386 --foreign $SID $ROOTFS
sudo cp /etc/resolv.conf $ROOTFS/etc

second stage

HOME=/root sudo chroot $ROOTFS /bin/bash --login -i
SID=jessie
export LANG=C
/debootstrap/debootstrap --second-stage
cat <<EOT > /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian $SID main contrib non-free
deb-src http://ftp.uk.debian.org/debian $SID main contrib non-free
deb http://ftp.uk.debian.org/debian $SID-updates main contrib non-free
deb-src http://ftp.uk.debian.org/debian $SID-updates main contrib non-free
deb http://security.debian.org/debian-security $SID/updates main contrib non-free
deb-src http://security.debian.org/debian-security $SID/updates main contrib non-free
EOT
apt-get update
apt-get install locales dialog
dpkg-reconfigure locales
dpkg-reconfigure tzdata
apt-get install ntpdate
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow
echo "quark" > /etc/hostname
cat >> /etc/network/interfaces << EOT

auto eth0
iface eth0 inet dhcp
EOT

sed -i '/# "\\e\[5~": history/s/^# "\\e\[5~"/"\\e\[A"/' /etc/inputrc
sed -i '/# "\\e\[6~": history/s/^# "\\e\[6~"/"\\e\[B"/' /etc/inputrc
sed -i '/^# .*dircolors/s/^# //; /^# .*LS_OPTIONS/s/^# //;' /root/.bashrc
sed -i "s/\xf0\x0f\xb1\x8b/\x90\x0f\xb1\x8b/g" /lib/i386-linux-gnu/libpthread-2.19.so
sed -i '/\[Service\]/a Environment="TERM=xterm"' "/lib/systemd/system/serial-getty@.service"
logout

post-config

sudo rm $ROOTFS/etc/resolv.conf
sudo umount $ROOTFS

sdcard\boot\grub\grub.conf 

default 2
timeout 5

color white/blue white/cyan

title Quark X1000 kernel-SPI initrd-SPI IMR-On IO-APIC/HPET NoEMU
    kernel --spi root=/dev/ram0 console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw
    initrd --spi

title Quark X1000 kernel-MassStorage iot-devkit on SD IMR-On IO-APIC/HPET NoEMU debug
    root (hd0,0)
    kernel /bzImage root=/dev/mmcblk0p2 rootwait console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5

title Quark X1000 kernel-MassStorage initrd-MassStorage RootFS-MassStorage IMR-On IO-APIC/HPET NoEMU debug
    root (hd0,0)
    kernel /bzImage root=/dev/ram0 console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5 rootimage=image-full-quark.ext3
    initrd /core-image-minimal-initramfs-quark.cpio.gz