From 638553bb72897205307cdce4dbecf03a70f25cde Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 9 Feb 2018 09:44:51 +0100 Subject: cleaned and commented create_hdd.sh --- create_hdd.sh | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'create_hdd.sh') diff --git a/create_hdd.sh b/create_hdd.sh index d35f6bc..d1d735c 100755 --- a/create_hdd.sh +++ b/create_hdd.sh @@ -8,8 +8,8 @@ cd $CROSS_HOME umount mnt +rm -rf mnt sudo /sbin/losetup -d /dev/loop2 -rmdir mnt sudo rm -f arch486.img # prepare a plain image @@ -26,9 +26,12 @@ sudo mkfs.ext4 -O ^64bit /dev/loop2p1 mkdir mnt sudo mount /dev/loop2p1 mnt sudo cp -a i486-root/* mnt/. - sudo chown -R cross:cross mnt/. cd mnt + +# A simple ISOlinux boot loader booting from first partition, starting +# uinit wich start /etc/init/boot + mkdir boot/syslinux echo 'default /boot/vmlinuz-linux root=/dev/hda1 init=/sbin/init console=ttyS0 console=tty0' \ > boot/syslinux/syslinux.cfg @@ -36,6 +39,10 @@ sudo dd bs=440 count=1 if=/usr/lib/syslinux/bios/mbr.bin of=/dev/loop2 cp /usr/lib/syslinux/bios/*.c32 boot/syslinux/. sudo extlinux --install boot/syslinux/ mkdir -p etc/init + +# the unit boot script configuring virtual filesystems, the network +# and starts an SSH daemon + cat >etc/init/boot < etc/resolv.conf <> etc/group < mnt/test.c < root/test.c < #include #include @@ -90,7 +94,7 @@ int main( int argc, char *argv[] ) } EOF -cat > mnt/test.cpp < root/test.cpp < #include @@ -101,3 +105,15 @@ int main( void ) } EOF +# fix permissions (we only have root on the image) + +chmod 0700 root/.ssh +sudo chown -R root:root . +sudo chmod 0775 etc/init/boot + +# umount and clean up partitions and loopback devices + +cd .. +sudo umount mnt +sudo partx -v --delete /dev/loop2 +sudo losetup -d /dev/loop2 -- cgit v1.2.3-54-g00ecf