summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-02-09 09:44:51 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-02-09 09:44:51 +0100
commit638553bb72897205307cdce4dbecf03a70f25cde (patch)
tree9fe836c81cbda57b38f3d182e3ce8a16637a18fc
parent140666b0971089ef34fb910313d0e42811dc0603 (diff)
downloadbootstrap32-638553bb72897205307cdce4dbecf03a70f25cde.tar.xz
cleaned and commented create_hdd.sh
-rw-r--r--README1
-rw-r--r--TODOS9
-rwxr-xr-xcreate_hdd.sh38
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 <<EOF
#!/bin/sh
mount -t proc proc /proc
@@ -53,6 +60,9 @@ EOF
cat > etc/resolv.conf <<EOF
nameserver 192.168.1.1
EOF
+
+# SSH confiuration: nobody user and host keys, keys for key based login
+
cat >> etc/group <<EOF
nobody:x:99:
EOF
@@ -69,16 +79,10 @@ ssh-keygen -b 2048 -t ed25519 -f etc/ssh/ssh_host_ed25519_key -N ''
chmod 0400 etc/ssh/ssh_host_*_key
mkdir root/.ssh
cp $HOME/.ssh/id_rsa.pub root/.ssh/authorized_keys
-chmod 0700 root/.ssh
-sudo chown -R root:root .
-sudo chmod 0775 etc/init/boot
-cd ..
-sudo umount mnt
-sudo partx -v --delete /dev/loop2
-sudo losetup -d /dev/loop2
+# add some test programs to test the C and C++ compiler
-cat > mnt/test.c <<EOF
+cat > root/test.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -90,7 +94,7 @@ int main( int argc, char *argv[] )
}
EOF
-cat > mnt/test.cpp <<EOF
+cat > root/test.cpp <<EOF
#include <iostream>
#include <cstdlib>
@@ -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