Added support for PID 1 shell during boot. Added option to use local downloaded sources with no requirement on internet connection. Added option to use predefined configuration files for kernel and BusyBox. Initramfs structure has been reorganized - now /etc/03_init.sh can be edited and the persisted changes will be applied on reboot. Scripts 01 and 02 are not affected since they are used before the overlay takes place. Added helper script file which generates hard disk image as sparse file. QEMU scripts have been enhanced for easier boot with hard disk images. Internal comments have been improved.

This commit is contained in:
Ivan Davidov 2016-04-23 01:43:40 +03:00
parent 176ad909f7
commit 416670ca72
4 changed files with 56 additions and 3 deletions

View File

@ -1,7 +1,9 @@
#!/bin/sh
echo "Suppress most kernel messages."
dmesg -n 1
echo "Mount all core filesystems."
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t tmpfs none /tmp -o mode=1777

View File

@ -106,7 +106,7 @@ for DEVICE in /dev/* ; do
mkdir -p $UPPER_DIR
mkdir -p $WORK_DIR
mount -t overlay -o lowerdir=/mnt:$OVERLAY_DIR,upperdir=$UPPER_DIR,workdir=$WORK_DIR none /mnt 2>/dev/null
mount -t overlay -o lowerdir=$OVERLAY_DIR:/mnt,upperdir=$UPPER_DIR,workdir=$WORK_DIR none /mnt 2>/dev/null
OUT=$?
if [ ! "$OUT" = "0" ] ; then
@ -142,9 +142,9 @@ mount --move /tmp /mnt/tmp
# The new mountpoint becomes file system root. All original root folders are
# deleted automatically as part of the command execution. The '/sbin/init'
# process is invoked and it becomes the new PID 1 parent process.
exec switch_root /mnt /sbin/init
exec switch_root /mnt /etc/03_init.sh
echo "You can never see this... unless there is a serious bug..."
echo "(/etc/02_overlay.sh) - there is a serious bug..."
# Wait until any key has been pressed.
read -n1 -s

View File

@ -0,0 +1,46 @@
#!/bin/sh
# If you have persistent overlay support then you can edit this file and replace
# the default initialization of the system. For example, you could use this:
#
# exec setsid cttyhach sh
#
# This gives you PID 1 shell inside the initramfs area. Since this is a PID 1
# shell, you can still invoke the original initialization logic by executing
# this command:
#
# exec /sbin/init
cat << CEOF
Wait 5 seconds for the default system initialization process based on the
files /sbin/init and /etc/inittab or press any key for PID 1 shell.
CEOF
read -t 5 -n1 -s key
if [ "$key" = "" ] ; then
# Use default initialization logic based on configuration in '/etc/inittab'.
echo "Executing /sbin/init as PID 1."
exec /sbin/init
else
# Using no indentation for this snippet or otherwise it causes kernel panic.
cat << CEOF
This is PID 1 shell. Execute the following in order to continue with the
default system initialization process:
exec /sbin/init
CEOF
exec setsid cttyhack sh
fi
echo "(/etc/03_init.sh) - there is a serious bug..."
# Wait until any key has been pressed.
read -n1 -s

View File

@ -0,0 +1,5 @@
TODO 1- add documentation about this folder and the purpose of the predefined
configuration file.
TODO 2 - Edit all comments and readme files to use maximum 80 chars per line.