Erich Focht wrote:
> --- init        (Revision 4041)
> +++ init        (Arbeitskopie)
> @@ -6,11 +6,16 @@
> 
>  echo "initramfs detected: init called"
> 
> +delete_rootfs_files() {
> +   sleep 10
> +   rm -rf /
> +}
> +
>  mkdir -p /new_root || shellout
>  mount tmpfs /new_root -t tmpfs $tmpfs_opts || shellout
>  cd / || shellout
>  cp -a `/bin/ls | grep -v new_root` /new_root/ || shellout
>  cd /new_root || shellout
>  mkdir -p old_root || shellout
> -
> +delete_rootfs_files >/dev/null </dev/null 2>&1 &
>  mount --move .  / && exec chroot . /linuxrc
> 

wow! This resolves the memory consumption problem! but there's still the
compatibility issue... anyway after a bit of googling I came across
switch_root that *does* it in a very clean way (honestly I didn't know
this command):

http://busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/util-linux/switch_root.c?rev=18493&view=auto

It's also in busybox 1.1.1 and it seems to work too. So, what do you
think about the following patch?

-Andrea

Index: initrd_source/skel/init
===================================================================
--- initrd_source/skel/init     (revision 4042)
+++ initrd_source/skel/init     (working copy)
@@ -6,16 +6,14 @@

 echo "initramfs detected: init called"

-delete_rootfs_files() {
-   sleep 10
-   rm -rf /
-}
-
 mkdir -p /new_root || shellout
 mount tmpfs /new_root -t tmpfs $tmpfs_opts || shellout
 cd / || shellout
 cp -a `/bin/ls | grep -v new_root` /new_root/ || shellout
 cd /new_root || shellout
 mkdir -p old_root || shellout
-delete_rootfs_files >/dev/null </dev/null 2>&1 &
-mount --move .  / && exec chroot . /linuxrc
+
+exec switch_root . /linuxrc
+
+echo "error: switch_root failed."
+shellout

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to