toram support
parent
e6026c54a2
commit
2c54c8282e
1
TODO
1
TODO
|
|
@ -1,3 +1,4 @@
|
||||||
* copy DOC/* to Live Kit created
|
* copy DOC/* to Live Kit created
|
||||||
* describe meaning of special files in bundles
|
* describe meaning of special files in bundles
|
||||||
* bootinst.sh for linux (using extlinux preferably)
|
* bootinst.sh for linux (using extlinux preferably)
|
||||||
|
- maybe find a way to boot from ANY filesystem using extlinux if that is possible (loop ext2)
|
||||||
|
|
@ -32,6 +32,7 @@ init_union "$CHANGES" "$UNION"
|
||||||
DATA="$(find_data 60 "$DATAMNT")"
|
DATA="$(find_data 60 "$DATAMNT")"
|
||||||
|
|
||||||
# copy to RAM if needed
|
# copy to RAM if needed
|
||||||
|
DATA="$(copy_to_ram "$DATA")"
|
||||||
|
|
||||||
debug_shell
|
debug_shell
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ copy_including_deps /$LMK/kernel/fs/fuse
|
||||||
copy_including_deps /$LMK/modules.*
|
copy_including_deps /$LMK/modules.*
|
||||||
|
|
||||||
depmod -b $INITRAMFS
|
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
|
echo "root::0:0::/root:/bin/bash" >$INITRAMFS/etc/passwd
|
||||||
touch $INITRAMFS/etc/{m,fs}tab
|
touch $INITRAMFS/etc/{m,fs}tab
|
||||||
|
|
|
||||||
28
livekitlib
28
livekitlib
|
|
@ -195,12 +195,14 @@ init_union()
|
||||||
#
|
#
|
||||||
mounted_device()
|
mounted_device()
|
||||||
{
|
{
|
||||||
|
debug_log "mounted_device"
|
||||||
|
|
||||||
local MNT TARGET
|
local MNT TARGET
|
||||||
MNT="$1"
|
MNT="$1"
|
||||||
while [ "$MNT" != "/" -a "$MNT" != "." -a "$MNT" != "" ]; do
|
while [ "$MNT" != "/" -a "$MNT" != "." -a "$MNT" != "" ]; do
|
||||||
TARGET="$(grep -F " $MNT " /proc/mounts | cut -d " " -f 1)"
|
TARGET="$(grep -F " $MNT " /proc/mounts | cut -d " " -f 1)"
|
||||||
if [ "$TARGET" != "" ]; then
|
if [ "$TARGET" != "" ]; then
|
||||||
echo "$TARGET"
|
echo "$TARGET:$MNT"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
MNT="$(dirname $MNT)"
|
MNT="$(dirname $MNT)"
|
||||||
|
|
@ -266,7 +268,7 @@ find_data()
|
||||||
DATA="$(find_data_try "$2")"
|
DATA="$(find_data_try "$2")"
|
||||||
if [ "$DATA" != "" ]; then
|
if [ "$DATA" != "" ]; then
|
||||||
echo "" >&2
|
echo "" >&2
|
||||||
echo "* found in $(mounted_device "$DATA")" >&2
|
echo "* Found in $(mounted_device "$DATA" | cut -d : -f 1)" >&2
|
||||||
echo "$DATA"
|
echo "$DATA"
|
||||||
return
|
return
|
||||||
fi
|
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
|
# Mount squashfs filesystem bundles
|
||||||
# and add them to union
|
# and add them to union
|
||||||
# $1 = directory where to search for bundles
|
# $1 = directory where to search for bundles
|
||||||
|
|
@ -321,6 +343,8 @@ change_root()
|
||||||
{
|
{
|
||||||
umount /proc
|
umount /proc
|
||||||
umount /sys
|
umount /sys
|
||||||
|
rm -Rf /lib/modules # this will no longer be needed at all
|
||||||
|
|
||||||
cd "$1"
|
cd "$1"
|
||||||
|
|
||||||
# make sure important devices are in union
|
# make sure important devices are in union
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue