openwrtv3/openwrt/target/default/target_skeleton/etc/preinit

31 lines
726 B
Text
Raw Normal View History

#!/bin/sh
mount none /proc -t proc
insmod diag
echo 0x01 > /proc/sys/diag
sleep 1
if [ $(cat /proc/sys/reset) = 1 ] ; then
export FAILSAFE=true
while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done &
else
2005-02-28 07:04:51 +00:00
mount | grep jffs2 >&-
2005-03-04 07:59:08 +00:00
if [ $? = 0 ] ; then
mtd unlock rootfs
[ $(cat /proc/mtd | wc -l) = 6 ] && {
echo 5 > /proc/sys/diag
mtd unlock OpenWrt
mtd erase OpenWrt
jffs2root --move
}
mount -o remount,rw /dev/root /
2005-02-28 07:04:51 +00:00
else
mtd unlock mtd4
mount -t jffs2 /dev/mtdblock/4 /jffs
pivot_root /jffs /jffs/rom
2005-02-28 07:04:51 +00:00
mount none /dev -t devfs
mount none /proc -t proc
2005-03-01 06:56:22 +00:00
umount rom/proc rom/dev
2005-02-28 07:04:51 +00:00
fi
fi
2005-03-01 06:56:22 +00:00
mount none /tmp -t ramfs
exec /sbin/init