Difference between revisions of "IoTGateway/BSP/Linux/Debian/How to Create Debian10 Rootfs Base"
From ESS-WIKI
Line 66: | Line 66: | ||
cd ~ | cd ~ | ||
apt-get update | apt-get update | ||
− | apt -y install iputils-ping iproute2 lsb-release vim | + | apt -y install iputils-ping iproute2 lsb-release vim whois |
− | |||
− | |||
ln -sf bash /bin/sh | ln -sf bash /bin/sh | ||
ln -sf bash.1.gz /usr/share/man/man1/sh.1.gz | ln -sf bash.1.gz /usr/share/man/man1/sh.1.gz | ||
Line 85: | Line 83: | ||
groupadd -g 1000 adv | groupadd -g 1000 adv | ||
useradd -u 1000 -d /home/adv -m -g adv -G adm,sudo,audio adv | useradd -u 1000 -d /home/adv -m -g adv -G adm,sudo,audio adv | ||
− | CRYPT=$( | + | CRYPT=$(echo adv | mkpasswd -m sha-512 -s) |
sed -i "s|^adv:[^:]\+:|adv:$CRYPT:|" /etc/shadow | sed -i "s|^adv:[^:]\+:|adv:$CRYPT:|" /etc/shadow | ||
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow | sed -i "s/^root:[^:]\+:/root::/" /etc/shadow | ||
Line 116: | Line 114: | ||
= Basic rootfs is ready = | = Basic rootfs is ready = | ||
− | == keep the rootfs for future use== | + | == keep the rootfs for future use == |
Line 122: | Line 120: | ||
sudo tar zcvf ${ROOTFS}.tgz -C ${ROOTFS} . | sudo tar zcvf ${ROOTFS}.tgz -C ${ROOTFS} . | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
:Please go on to [[IoTGateway/BSP/Linux/Debian/How_to_create_Debian10_SDcard_image|create Debian 10 SD card image]] if needed | :Please go on to [[IoTGateway/BSP/Linux/Debian/How_to_create_Debian10_SDcard_image|create Debian 10 SD card image]] if needed |
Latest revision as of 06:31, 21 April 2020
Host Prerequisites
install required packages
sudo apt-get install binfmt-support qemu-user-static wget
sudo modprobe binfmt_misc
Building Procedures
set ARM architecture
export ARCH=arm64 # for i.MX8
export ARCH=armhf # for i.MX6
get the basic rootfs
export ROOTFS=~/rootfs_${ARCH}-deb10
sudo apt -y install debian-archive-keyring
sudo apt-key add /usr/share/keyrings/debian-archive-keyring.gpg
sudo qemu-debootstrap --arch=${ARCH} \
--keyring /usr/share/keyrings/debian-archive-keyring.gpg \
--variant=buildd \
--exclude=debfoster buster $ROOTFS http://ftp.debian.org/debian
go on in chroot
set the mount point
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 the chroot
HOME=/root sudo chroot $ROOTFS /bin/bash --login -i
installation
cd ~
apt-get update
apt -y install iputils-ping iproute2 lsb-release vim whois
ln -sf bash /bin/sh
ln -sf bash.1.gz /usr/share/man/man1/sh.1.gz
apt -y install sudo
apt -y install systemd systemd-sysv kmod
apt -y install network-manager
apt -y install parted
configuration
groupadd -g 1000 adv
useradd -u 1000 -d /home/adv -m -g adv -G adm,sudo,audio adv
CRYPT=$(echo adv | mkpasswd -m sha-512 -s)
sed -i "s|^adv:[^:]\+:|adv:$CRYPT:|" /etc/shadow
sed -i "s/^root:[^:]\+:/root::/" /etc/shadow
echo "unknown" > /etc/hostname
echo -e "127.0.0.1 localhost \n127.0.1.1 unknown\n" > /etc/hosts
ln -sf ../run/resolvconf/resolv.conf /etc/resolv.conf
apt-get clean
history -c
leave the chroot
logout
clear the mount point
sudo umount -lf $ROOTFS/dev/pts
sudo umount -lf $ROOTFS/dev
sudo umount $ROOTFS/sys
sudo umount $ROOTFS/proc
Basic rootfs is ready
keep the rootfs for future use
sudo tar zcvf ${ROOTFS}.tgz -C ${ROOTFS} .
- Please go on to create Debian 10 SD card image if needed