slitaz-modular diff initramfs/init @ rev 173

initramfs: Update initramfs.list. Add changes need for init script to work.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Jul 19 11:49:58 2012 +0000 (2012-07-19)
parents 85aca4fdc71d
children 29b33964d973
line diff
     1.1 --- a/initramfs/init	Fri Feb 24 18:58:07 2012 -0500
     1.2 +++ b/initramfs/init	Thu Jul 19 11:49:58 2012 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4  
     1.5  success()
     1.6  {
     1.7 -	cat > /tmp/init
     1.8 +	cat > /run/init
     1.9  	[ -d /proc/sys ] && umount /proc
    1.10  	echo -e "\\033[70G[ \\033[1;32mOK\\033[0;39m ]"
    1.11  	exit
    1.12 @@ -10,8 +10,7 @@
    1.13  
    1.14  launch_init()
    1.15  {
    1.16 -	mount --move /dev/pts /mnt/dev/pts
    1.17 -	mount --move /dev/shm /mnt/dev/shm
    1.18 +	mount --move /run /mnt/run
    1.19  	success <<EOT
    1.20  exec /sbin/switch_root mnt /sbin/init
    1.21  EOT
    1.22 @@ -68,6 +67,8 @@
    1.23  		fi
    1.24  		mount /dev/mapper/$dmlabel /mnt
    1.25  	fi
    1.26 +	grep -q subroot= /proc/cmdline && return
    1.27 +	grep -q loopfs= /proc/cmdline && return
    1.28  	if [ -d /mnt/etc ]; then
    1.29  		umount /sys
    1.30  		[ -n "$1" ] && for i in $@ ; do
    1.31 @@ -103,6 +104,7 @@
    1.32  	*raid0*)	modprobe raid0 ;;
    1.33  	*raid1*)	modprobe raid1 ;;
    1.34  	*raid[456]*)	modprobe raid456 ;;
    1.35 +	*mirror*)	modprobe dm-mirror ;;
    1.36  	esac
    1.37  done
    1.38  }
    1.39 @@ -110,14 +112,12 @@
    1.40  if [ "$1" != "logged" ]; then
    1.41  	mount -t devpts devpts /dev/pts
    1.42  	mount -t tmpfs tmpfs /dev/shm
    1.43 -	script -qc '/init logged' /dev/shm/boot.log
    1.44 -	. /tmp/init
    1.45 +	mount -t tmpfs tmpfs /run
    1.46 +	script -qc '/init logged' /run/boot.log
    1.47 +	. /run/init
    1.48  else
    1.49 -mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev
    1.50 -mountpoint -q /sys  || mount -t sysfs sys /sys -o nosuid,noexec,nodev
    1.51 -mountpoint -q /run  || mount -t tmpfs run /run -o mode=0755,nosuid,nodev
    1.52 -mountpoint -q /dev  || mount -t devtmpfs dev /dev -o mode=0755,nosuid
    1.53 -
    1.54 +mount -t proc proc /proc
    1.55 +mount -t sysfs sysfs /sys
    1.56  if grep -q dmraid= /proc/cmdline; then
    1.57  	root="$(sed 's/.*dmraid=\([^ ]*\).*/\1/' < /proc/cmdline)"
    1.58  	echo -n "Switching / to dmraid $root..."
    1.59 @@ -181,17 +181,14 @@
    1.60  	subroot="/$(sed 's/.*subroot=\([^ ]*\).*/\1/' < /proc/cmdline)" &&
    1.61  	echo -n "Chrooting to $subroot..."
    1.62  	mount --move /dev/pts /mnt$subroot/dev/pts
    1.63 -	shm=$subroot/dev/shm
    1.64 -	mount --move /dev/shm /mnt$shm &&
    1.65 -	if mv /usr/share/boot/busybox-static /mnt$shm 2> /dev/null; then
    1.66 -		success <<EOT
    1.67 -exec /sbin/switch_root mnt $shm/busybox-static chroot $subroot /sbin/init
    1.68 +	run=$subroot/run
    1.69 +	mount --move /run /mnt$run
    1.70 +	cp $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so /usr/sbin/chroot | sed \
    1.71 +	     's|.*=> \(/lib/l[^ ]*\).*|\1|;/^\//!d') /usr/sbin/chroot /mnt$run
    1.72 +	success <<EOT
    1.73 +export LD_LIBRARY_PATH=$run:/lib
    1.74 +exec /sbin/switch_root mnt $run/$(cd /mnt$run ; ls ld-*) $run/chroot $subroot /sbin/init
    1.75  EOT
    1.76 -	else
    1.77 -		success <<EOT
    1.78 -exec chroot /mnt$subroot /sbin/init
    1.79 -EOT
    1.80 -	fi
    1.81  fi
    1.82  echo -n "Switching / to tmpfs"
    1.83  size="$(grep rootfssize= < /proc/cmdline | \
    1.84 @@ -199,8 +196,8 @@
    1.85  free=$(busybox free | busybox awk '/Mem:/ { print int(($4*100)/$3) }')
    1.86  umount /proc
    1.87  [ -n "$size" ] || size="-o size=90%"
    1.88 -echo "exec /sbin/init" > /tmp/init
    1.89 -if [ $free -lt 50 ] || ! mount -t tmpfs $size tmpfs /mnt; then
    1.90 +echo "exec /sbin/init" > /run/init
    1.91 +if [ $free -lt 100 ] || ! mount -t tmpfs $size tmpfs /mnt; then
    1.92  	echo -e "\\033[70G[ \\033[1;33mSkipped\\033[0;39m]"
    1.93  	exit
    1.94  fi