toram support

pull/5/head
Tomas M 2012-09-22 01:48:23 -05:00
parent e6026c54a2
commit 2c54c8282e
4 changed files with 32 additions and 2 deletions

1
TODO
View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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