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 --- README | 1 + TODOS | 9 ++++++++- create_hdd.sh | 38 +++++++++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/README b/README index 24ee2d5..8f9434d 100644 --- a/README +++ b/README @@ -153,6 +153,7 @@ su cross ./create_ca-certificates-utils_shim.sh su cross ./create_cdrom.sh # or easier for direct testing, build stage 1 hard disk image + su cross ./create_hdd.sh # TODO FROM HERE: diff --git a/TODOS b/TODOS index bc40e1c..c858902 100644 --- a/TODOS +++ b/TODOS @@ -21,4 +21,11 @@ in build_stage1_package.sh - when uninstalling pacman in the chroot, you must rename pacman.pacsave back to pacman.conf as it is used for building packages - +- pacman has some issues with the sync databases (pacman -Syyu results + in): + debug: returning error 6 from _alpm_db_register_sync : wrong or NULL argument passed + error: could not register 'temp' database (wrong or NULL argument passed) + error: no usable package repositories configured. + installing and listing packages by hand works without problems. + debug: unregistering database 'local' + 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