Difference between revisions of "IoTGateway/BSP/Linux/Quark/BuildingDebianJessieRootfs"
From ESS-WIKI
| Line 13: | Line 13: | ||
== first stage rootfs == | == first stage rootfs == | ||
| − | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
SID=jessie | SID=jessie | ||
IMAGE=./image-$SID-quark.ext3 | IMAGE=./image-$SID-quark.ext3 | ||
| + | IMAGE_FULL=./image-full-quark.ext3 | ||
ROOTFS=~/rootfs | ROOTFS=~/rootfs | ||
dd if=/dev/zero of=$IMAGE bs=1G count=1 | dd if=/dev/zero of=$IMAGE bs=1G count=1 | ||
| − | + | dd if=$IMAGE_FULL of=$IMAGE bs=1M conv=notrunc,noerror | |
| + | e2fsck -f -y $IMAGE | ||
| + | resize2fs $IMAGE | ||
mkdir $ROOTFS | mkdir $ROOTFS | ||
sudo mount -o loop $IMAGE $ROOTFS | sudo mount -o loop $IMAGE $ROOTFS | ||
| + | pushd $ROOTFS | ||
| + | sudo rm -rf *[^lib] | ||
| + | sudo rm -rf lib/!(modules|firmware) | ||
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 rootfs == |
| − | |||
| − | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| − | |||
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i | HOME=/root sudo chroot $ROOTFS /bin/bash --login -i | ||
| − | + | SID=jessie | |
| − | + | export LANG=C | |
| − | + | /debootstrap/debootstrap --second-stage | |
| − | |||
| − | |||
cat <<EOT > /etc/apt/sources.list | cat <<EOT > /etc/apt/sources.list | ||
| − | deb http:// | + | 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:// | + | 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 | |
| − | + | dpkg-reconfigure locales | |
| − | + | apt-get install ntpdate | |
| − | |||
| − | |||
| − | apt-get install | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | dpkg - | ||
| − | |||
| − | |||
| − | |||
| − | apt-get install | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow | sed -i "s/^root:[^:]\+:/root::/" /etc/shadow | ||
echo "quark" > /etc/hostname | echo "quark" > /etc/hostname | ||
| − | |||
| − | |||
cat >> /etc/network/interfaces << EOT | cat >> /etc/network/interfaces << EOT | ||
| Line 91: | Line 68: | ||
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 | |
| − | |||
| − | |||
| − | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | |||
| + | == post-config == | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| − | |||
sudo rm $ROOTFS/etc/resolv.conf | sudo rm $ROOTFS/etc/resolv.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
[[Category:Editor]] | [[Category:Editor]] | ||
Revision as of 09:27, 1 November 2017
Contents
Host Required
Ubuntu 14.04 LTS
- All building procedures are verified in Ubuntu 14.04 LTS.
Building Procedures
first stage rootfs
SID=jessie
IMAGE=./image-$SID-quark.ext3
IMAGE_FULL=./image-full-quark.ext3
ROOTFS=~/rootfs
dd if=/dev/zero of=$IMAGE bs=1G count=1
dd if=$IMAGE_FULL of=$IMAGE bs=1M conv=notrunc,noerror
e2fsck -f -y $IMAGE
resize2fs $IMAGE
mkdir $ROOTFS
sudo mount -o loop $IMAGE $ROOTFS
pushd $ROOTFS
sudo rm -rf *[^lib]
sudo rm -rf lib/!(modules|firmware)
sudo debootstrap --arch=i386 --foreign $SID $ROOTFS
sudo cp /etc/resolv.conf $ROOTFS/etc
second stage rootfs
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
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 "s/# \"\\\e\[1~\"/\"\\\e\[1~\"/" /etc/inputrc; \
sed -i "s/# \"\\\e\[4~\"/\"\\\e\[4~\"/" /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 "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