... continued from part 1.
creating basic filesystem structure (fedora-style)
DIRS="/etc/init.d /etc/rc.d /dev /root /media /mnt /proc /sys /run /tmp /usr/lib /usr/share /var/lib /var/db /var/cache /var/log /var/run /var/tmp /var/spool"
for x in $DIRS; do mkdir -p $FSROOT$x ; done
cd $FSROOT && ln -s usr/lib lib
cd $FSROOT && ln -s usr/lib usr/lib64
cd $FSROOT && ln -s usr/lib64 lib64
setting basic hostname for booting
echo busybox > $FSROOT/etc/hostname
basic mount points. for a chroot you may want to hash out the "/dev/root" entry.
cat <<__EOT__ > $FSROOT/etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
mdev /dev devtmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts defaults 0 0
#/dev/root / ext2 rw,defaults,errors=remount-ro 0 1
__EOT__
basic minimal user/group files.
curl https://salsa.debian.org/debian/base-passwd/raw/master/passwd.master > $FSROOT/etc/passwd
curl https://salsa.debian.org/debian/base-passwd/raw/master/group.master > $FSROOT/etc/group
basic minimal name/service/protocol resolution.
echo "127.0.0.1 localhost localhost.localdomain" > $FSROOT/etc/hosts
echo "::1 localhost localhost.localdomain" >> $FSROOT/etc/hosts
echo "nameserver 8.8.8.8" > $FSROOT/etc/resolv.conf
echo "nameserver 1.1.1.1" >> $FSROOT/etc/resolv.conf
curl https://salsa.debian.org/md/netbase/raw/master/etc-services > $FSROOT/etc/services
curl https://salsa.debian.org/md/netbase/raw/master/etc-protocols > $FSROOT/etc/protocols
this should make the basic chroot complete but is still unable to run glibc/java apps.
--tbc
creating basic filesystem structure (fedora-style)
DIRS="/etc/init.d /etc/rc.d /dev /root /media /mnt /proc /sys /run /tmp /usr/lib /usr/share /var/lib /var/db /var/cache /var/log /var/run /var/tmp /var/spool"
for x in $DIRS; do mkdir -p $FSROOT$x ; done
cd $FSROOT && ln -s usr/lib lib
cd $FSROOT && ln -s usr/lib usr/lib64
cd $FSROOT && ln -s usr/lib64 lib64
setting basic hostname for booting
echo busybox > $FSROOT/etc/hostname
basic mount points. for a chroot you may want to hash out the "/dev/root" entry.
cat <<__EOT__ > $FSROOT/etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
none /tmp tmpfs defaults 0 0
mdev /dev devtmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts defaults 0 0
#/dev/root / ext2 rw,defaults,errors=remount-ro 0 1
__EOT__
basic minimal user/group files.
curl https://salsa.debian.org/debian/base-passwd/raw/master/passwd.master > $FSROOT/etc/passwd
curl https://salsa.debian.org/debian/base-passwd/raw/master/group.master > $FSROOT/etc/group
basic minimal name/service/protocol resolution.
echo "127.0.0.1 localhost localhost.localdomain" > $FSROOT/etc/hosts
echo "::1 localhost localhost.localdomain" >> $FSROOT/etc/hosts
echo "nameserver 8.8.8.8" > $FSROOT/etc/resolv.conf
echo "nameserver 1.1.1.1" >> $FSROOT/etc/resolv.conf
curl https://salsa.debian.org/md/netbase/raw/master/etc-services > $FSROOT/etc/services
curl https://salsa.debian.org/md/netbase/raw/master/etc-protocols > $FSROOT/etc/protocols
this should make the basic chroot complete but is still unable to run glibc/java apps.
--tbc
Comments
Post a Comment