Permalink
Browse files

toram support

  • Loading branch information...
1 parent e6026c5 commit 2c54c8282e35d6b327a9b7ef9ee6eb8248536a29 @Tomas-M committed Sep 22, 2012
Showing with 32 additions and 2 deletions.
  1. +1 −0 TODO
  2. +1 −0 initramfs/init
  3. +4 −0 initramfs/initramfs_create
  4. +26 −2 livekitlib
View
@@ -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
@@ -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
@@ -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
@@ -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

0 comments on commit 2c54c82

Please sign in to comment.