diff --git a/TODO b/TODO index 0c1a2cf..b07ec00 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ * copy DOC/* to Live Kit created * describe meaning of special files in bundles * bootinst.sh for linux (using extlinux preferably) + - maybe find a way to boot from ANY filesystem using extlinux if that is possible (loop ext2) \ No newline at end of file diff --git a/initramfs/init b/initramfs/init index bb48914..2932587 100644 --- a/initramfs/init +++ b/initramfs/init @@ -32,6 +32,7 @@ init_union "$CHANGES" "$UNION" DATA="$(find_data 60 "$DATAMNT")" # copy to RAM if needed +DATA="$(copy_to_ram "$DATA")" debug_shell diff --git a/initramfs/initramfs_create b/initramfs/initramfs_create index c4a5976..153af77 100755 --- a/initramfs/initramfs_create +++ b/initramfs/initramfs_create @@ -69,6 +69,10 @@ copy_including_deps /$LMK/kernel/fs/fuse copy_including_deps /$LMK/modules.* depmod -b $INITRAMFS +# trim modules.order file. Perhaps we could remove it entirely +MODULEORDER="$(cd "$INITRAMFS/$LMK/"; find -name "*.ko" | sed -r "s:^./::g" | tr "\n" "|" | sed -r "s:[.]:.:g")" +cat $INITRAMFS/$LMK/modules.order | grep -E "$MODULEORDER"/foo/bar > $INITRAMFS/$LMK/_ +mv $INITRAMFS/$LMK/_ $INITRAMFS/$LMK/modules.order echo "root::0:0::/root:/bin/bash" >$INITRAMFS/etc/passwd touch $INITRAMFS/etc/{m,fs}tab diff --git a/livekitlib b/livekitlib index 167e600..476a0ae 100644 --- a/livekitlib +++ b/livekitlib @@ -195,12 +195,14 @@ init_union() # mounted_device() { + debug_log "mounted_device" + local MNT TARGET MNT="$1" while [ "$MNT" != "/" -a "$MNT" != "." -a "$MNT" != "" ]; do TARGET="$(grep -F " $MNT " /proc/mounts | cut -d " " -f 1)" if [ "$TARGET" != "" ]; then - echo "$TARGET" + echo "$TARGET:$MNT" return fi MNT="$(dirname $MNT)" @@ -266,7 +268,7 @@ find_data() DATA="$(find_data_try "$2")" if [ "$DATA" != "" ]; then echo "" >&2 - echo "* found in $(mounted_device "$DATA")" >&2 + echo "* Found in $(mounted_device "$DATA" | cut -d : -f 1)" >&2 echo "$DATA" return fi @@ -280,6 +282,26 @@ find_data() } +# Copy data to RAM if requested +# $1 = live data directory +# +copy_to_ram() +{ + local DM RAM + + if grep -vq toram /proc/cmdline; then + echo "$1" + return + fi + + DM="$(mounted_device "$1" | cut -d : -f 2-)" + RAM="$DM.ram" + echo "* Copying $LIVEKITNAME data to RAM..." >&2 + cp -a $DM $RAM + echo "$RAM/$LIVEKITNAME" + umount -n $DM +} + # Mount squashfs filesystem bundles # and add them to union # $1 = directory where to search for bundles @@ -321,6 +343,8 @@ change_root() { umount /proc umount /sys + rm -Rf /lib/modules # this will no longer be needed at all + cd "$1" # make sure important devices are in union