fix initramfs images
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 16 Nov 2007 03:11:21 +0000 (03:11 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Fri, 16 Nov 2007 03:11:21 +0000 (03:11 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9557 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/generic-2.6/base-files/init

index 73bef61b2e6eaa9c1afa17e091b99458374ffe03..0c795c69b49bbc0038f25415c935441a21cd114d 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/sh
 # Copyright (C) 2006 OpenWrt.org
 
 #!/bin/sh
 # Copyright (C) 2006 OpenWrt.org
 
+. /etc/diag.sh
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 mount none /proc -t proc
 mount none /sys -t sysfs
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 mount none /proc -t proc
 mount none /sys -t sysfs
+size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc/meminfo)
+mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
 
 if grep devfs /proc/filesystems > /dev/null; then
        mount none /dev -t devfs
 
 if grep devfs /proc/filesystems > /dev/null; then
        mount none /dev -t devfs
@@ -34,7 +37,12 @@ mount none /dev/pts -t devpts
 
 # the root mount point can come from the kernel command line
 # or it can be overridden in the preinit.arch file
 
 # the root mount point can come from the kernel command line
 # or it can be overridden in the preinit.arch file
-[ -f /etc/preinit.arch ] && . /etc/preinit.arch
+trap 'FAILSAFE=true' USR1
+[ -e /etc/preinit.arch ] && . /etc/preinit.arch
+set_state preinit
+echo "$HOTPLUG" > /proc/sys/kernel/hotplug
+eval ${FAILSAFE:+failsafe}
+lock -w /tmp/.failsafe
 
 # if we have no root parameter, just go to running from ramfs
 [ -z $rootfs ] && {
 
 # if we have no root parameter, just go to running from ramfs
 [ -z $rootfs ] && {