From 7619fe0848dc5f31d5c4c4cadd2ec067bd5c55d1 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 17 Jul 2005 22:52:59 +0000 Subject: move target/default/target_skeleton into package/base-files, put all the default files in ipkg packages, cleanup some junk in toolchain/, toolchain/ no longer changes build_mipsel/root git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1494 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 package/base-files/default/sbin/mount_root (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root new file mode 100755 index 000000000..b4ec2ca56 --- /dev/null +++ b/package/base-files/default/sbin/mount_root @@ -0,0 +1,25 @@ +#!/bin/sh +if [ "$1" != "failsafe" ]; then + mount | grep jffs2 >&- + if [ $? = 0 ] ; then + if [ $(cat /proc/mtd | wc -l) = 6 ]; then + echo 5 > /proc/sys/diag + mtd unlock linux + mtd erase OpenWrt + jffs2root --move + else + mtd unlock rootfs + mount -o remount,rw /dev/root / + fi + else + mtd unlock OpenWrt + mount -t jffs2 /dev/mtdblock/4 /jffs + pivot_root /jffs /jffs/rom + mount none /proc -t proc + mount none /dev -t devfs + umount /rom/proc rom/dev >&- + fi +fi +mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50% +mkdir -p /dev/pts +mount none /dev/pts -t devpts -- cgit v1.2.3 From a44985f42c551baae99a2c6f461c94ec86d9e310 Mon Sep 17 00:00:00 2001 From: mbm Date: Wed, 20 Jul 2005 19:58:40 +0000 Subject: updates from whiterussian git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1504 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index b4ec2ca56..29c5126ba 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -12,12 +12,14 @@ if [ "$1" != "failsafe" ]; then mount -o remount,rw /dev/root / fi else - mtd unlock OpenWrt - mount -t jffs2 /dev/mtdblock/4 /jffs - pivot_root /jffs /jffs/rom - mount none /proc -t proc - mount none /dev -t devfs - umount /rom/proc rom/dev >&- + if [ -z "$(nvram get no_root_swap)" ]; then + mtd unlock OpenWrt + mount -t jffs2 /dev/mtdblock/4 /jffs + pivot_root /jffs /jffs/rom + mount none /proc -t proc + mount none /dev -t devfs + umount /rom/proc rom/dev >&- + fi fi fi mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50% -- cgit v1.2.3 From 6dc988729c78347c590675fe4bfdb9bb408fffc7 Mon Sep 17 00:00:00 2001 From: wbx Date: Sat, 10 Sep 2005 18:28:33 +0000 Subject: add nvram.sh to all startup scripts, no errors on wgt634u git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1892 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 1 + 1 file changed, 1 insertion(+) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 29c5126ba..ae78ee488 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh if [ "$1" != "failsafe" ]; then mount | grep jffs2 >&- if [ $? = 0 ] ; then -- cgit v1.2.3 From 6f038752364538d052dfc3571242f8e0830b5106 Mon Sep 17 00:00:00 2001 From: wbx Date: Fri, 30 Sep 2005 11:36:37 +0000 Subject: check if some /proc files exist, before using it, for systems without diag kernel modul git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2008 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index ae78ee488..32a6ee548 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -4,7 +4,7 @@ if [ "$1" != "failsafe" ]; then mount | grep jffs2 >&- if [ $? = 0 ] ; then if [ $(cat /proc/mtd | wc -l) = 6 ]; then - echo 5 > /proc/sys/diag + [ -f /proc/sys/diag ] && echo 5 > /proc/sys/diag mtd unlock linux mtd erase OpenWrt jffs2root --move -- cgit v1.2.3 From efbc756b232a92ad8176ed8cc3d37846939c8245 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 17 Oct 2005 21:27:07 +0000 Subject: some fixes/cleanups for the init scripts git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2152 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 32a6ee548..bc8d69c79 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -13,7 +13,7 @@ if [ "$1" != "failsafe" ]; then mount -o remount,rw /dev/root / fi else - if [ -z "$(nvram get no_root_swap)" ]; then + if [ \! -x /usr/sbin/nvram -o -z "$(nvram get no_root_swap)" ]; then mtd unlock OpenWrt mount -t jffs2 /dev/mtdblock/4 /jffs pivot_root /jffs /jffs/rom -- cgit v1.2.3 From 3c8c1d5d8129266fead520436949c40d62813d1f Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 22 Oct 2005 19:54:33 +0000 Subject: add base-files change from whiterussian git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2257 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index bc8d69c79..c8edaaa2f 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,10 +1,15 @@ #!/bin/sh . /etc/nvram.sh +is_clean() { + OFFSET="$((0x$(dd if=/dev/mtdblock/1 bs=1 skip=$((0x14)) count=2 2>&- | hexdump | grep 0000000 | cut -d ' ' -f 2) - 1))" + dd if=/dev/mtdblock/1 bs=1 skip=$OFFSET count=1 2>&- | hexdump -v | grep ' 0000' > /dev/null && return 255 || return 0 +} + if [ "$1" != "failsafe" ]; then mount | grep jffs2 >&- if [ $? = 0 ] ; then if [ $(cat /proc/mtd | wc -l) = 6 ]; then - [ -f /proc/sys/diag ] && echo 5 > /proc/sys/diag + echo 5 > /proc/sys/diag mtd unlock linux mtd erase OpenWrt jffs2root --move @@ -13,7 +18,11 @@ if [ "$1" != "failsafe" ]; then mount -o remount,rw /dev/root / fi else - if [ \! -x /usr/sbin/nvram -o -z "$(nvram get no_root_swap)" ]; then + if [ -z "$(nvram get no_root_swap)" ]; then + is_clean || { + mtd erase OpenWrt + jffs2root --clean + } mtd unlock OpenWrt mount -t jffs2 /dev/mtdblock/4 /jffs pivot_root /jffs /jffs/rom -- cgit v1.2.3 From 170b2b423d7d0430c0e181fbb66ff3d9ea4aac59 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 7 Nov 2005 01:30:03 +0000 Subject: disable squashfs auto-clean for non-broadcom stuff git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2365 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 1 + 1 file changed, 1 insertion(+) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index c8edaaa2f..c393e06f3 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,6 +1,7 @@ #!/bin/sh . /etc/nvram.sh is_clean() { + grep Broadcom /proc/cpuinfo 2>&- >&- || return 0 OFFSET="$((0x$(dd if=/dev/mtdblock/1 bs=1 skip=$((0x14)) count=2 2>&- | hexdump | grep 0000000 | cut -d ' ' -f 2) - 1))" dd if=/dev/mtdblock/1 bs=1 skip=$OFFSET count=1 2>&- | hexdump -v | grep ' 0000' > /dev/null && return 255 || return 0 } -- cgit v1.2.3 From e5b50a025f2fbc9b038e8600541551c1decba998 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 11 Dec 2005 21:34:46 +0000 Subject: unlock linux partition before running jffs2root --clean. fixes #97 git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2615 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 1 + 1 file changed, 1 insertion(+) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index c393e06f3..e855b41a1 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -22,6 +22,7 @@ if [ "$1" != "failsafe" ]; then if [ -z "$(nvram get no_root_swap)" ]; then is_clean || { mtd erase OpenWrt + mtd unlock linux jffs2root --clean } mtd unlock OpenWrt -- cgit v1.2.3 From f4eb6ef7174d320541f2d601f4b8938f875eefad Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 22 Jan 2006 23:38:29 +0000 Subject: fix typo git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3038 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index e855b41a1..bd9b815e1 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -30,7 +30,7 @@ if [ "$1" != "failsafe" ]; then pivot_root /jffs /jffs/rom mount none /proc -t proc mount none /dev -t devfs - umount /rom/proc rom/dev >&- + umount /rom/proc /rom/dev >&- fi fi fi -- cgit v1.2.3 From 46225926c8c36b914ad7423bb7e6f36a42b92298 Mon Sep 17 00:00:00 2001 From: mbm Date: Wed, 1 Feb 2006 10:47:17 +0000 Subject: move sysfs to mount_root git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3107 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 1 + 1 file changed, 1 insertion(+) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index bd9b815e1..427ff0444 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -37,3 +37,4 @@ fi mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50% mkdir -p /dev/pts mount none /dev/pts -t devpts +grep sysfs /proc/filesystems >&- && mount -t sysfs none /sys -- cgit v1.2.3 From 82daa5e9c007b2a16aa9e8c5526fd8d034ee4541 Mon Sep 17 00:00:00 2001 From: mbm Date: Wed, 1 Feb 2006 23:53:19 +0000 Subject: change cp to $(CP) git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3112 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 427ff0444..693c694c1 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -30,7 +30,7 @@ if [ "$1" != "failsafe" ]; then pivot_root /jffs /jffs/rom mount none /proc -t proc mount none /dev -t devfs - umount /rom/proc /rom/dev >&- + umount /rom/proc rom/dev >&- fi fi fi -- cgit v1.2.3 From cad490a0db13c37f43e753db9c2228eac2cfe98f Mon Sep 17 00:00:00 2001 From: mbm Date: Thu, 2 Feb 2006 10:07:28 +0000 Subject: fixes files from [3112] git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3114 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 693c694c1..427ff0444 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -30,7 +30,7 @@ if [ "$1" != "failsafe" ]; then pivot_root /jffs /jffs/rom mount none /proc -t proc mount none /dev -t devfs - umount /rom/proc rom/dev >&- + umount /rom/proc /rom/dev >&- fi fi fi -- cgit v1.2.3 From 676c017ecfced2e37aeec176f8aa6b9df90024f3 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 5 Apr 2006 02:09:22 +0000 Subject: large init script cleanup and merge of whiterussian changes, new dnsmasq config handling git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3588 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 40 +++++++++++++----------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 427ff0444..38252e83f 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,40 +1,34 @@ #!/bin/sh -. /etc/nvram.sh -is_clean() { - grep Broadcom /proc/cpuinfo 2>&- >&- || return 0 - OFFSET="$((0x$(dd if=/dev/mtdblock/1 bs=1 skip=$((0x14)) count=2 2>&- | hexdump | grep 0000000 | cut -d ' ' -f 2) - 1))" - dd if=/dev/mtdblock/1 bs=1 skip=$OFFSET count=1 2>&- | hexdump -v | grep ' 0000' > /dev/null && return 255 || return 0 +is_dirty() { + grep Broadcom /proc/cpuinfo >&- || return 1 + OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" + return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"') } +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)&- if [ $? = 0 ] ; then if [ $(cat /proc/mtd | wc -l) = 6 ]; then - echo 5 > /proc/sys/diag - mtd unlock linux mtd erase OpenWrt jffs2root --move else - mtd unlock rootfs mount -o remount,rw /dev/root / fi else - if [ -z "$(nvram get no_root_swap)" ]; then - is_clean || { - mtd erase OpenWrt - mtd unlock linux - jffs2root --clean - } - mtd unlock OpenWrt - mount -t jffs2 /dev/mtdblock/4 /jffs - pivot_root /jffs /jffs/rom - mount none /proc -t proc - mount none /dev -t devfs - umount /rom/proc /rom/dev >&- - fi + . /bin/firstboot + is_dirty + [ $? != 0 ] && { + mount /dev/mtdblock/4 /jffs + pivot /jffs /rom + } || ramoverlay fi fi -mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50% + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 mkdir -p /dev/pts mount none /dev/pts -t devpts -grep sysfs /proc/filesystems >&- && mount -t sysfs none /sys +mount -t sysfs none /sys 2>&- -- cgit v1.2.3 From 89ca788b2d7c218c98dd112c567e4bf2d92c4864 Mon Sep 17 00:00:00 2001 From: mbm Date: Sat, 8 Apr 2006 21:11:49 +0000 Subject: fix a bug that prevents the wgt634u from initializing the filesystem properly git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3601 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 38252e83f..88a836c80 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -22,9 +22,13 @@ if [ "$1" != "failsafe" ]; then . /bin/firstboot is_dirty [ $? != 0 ] && { - mount /dev/mtdblock/4 /jffs + echo "switching to jffs2" + mount /dev/mtdblock/4 /jffs -t jffs2 pivot /jffs /rom - } || ramoverlay + } || { + echo "jffs2 unusable; using ramdisk" + ramoverlay + } fi fi -- cgit v1.2.3 From 7885524586983ec44edf08324cfc7c63574b5388 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 15 Jun 2006 17:21:17 +0000 Subject: clean up handling of the root filesystem mount - remove broadcom specific junk from the generic base-files part git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3951 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 36 +++--------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 88a836c80..6c8805c08 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,38 +1,8 @@ #!/bin/sh -is_dirty() { - grep Broadcom /proc/cpuinfo >&- || return 1 - OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" - return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"') -} - size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)&- - if [ $? = 0 ] ; then - if [ $(cat /proc/mtd | wc -l) = 6 ]; then - mtd erase OpenWrt - jffs2root --move - else - mount -o remount,rw /dev/root / - fi - else - . /bin/firstboot - is_dirty - [ $? != 0 ] && { - echo "switching to jffs2" - mount /dev/mtdblock/4 /jffs -t jffs2 - pivot /jffs /rom - } || { - echo "jffs2 unusable; using ramdisk" - ramoverlay - } - fi -fi - -mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +mount none /proc -t proc +mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777 mkdir -p /dev/pts mount none /dev/pts -t devpts mount -t sysfs none /sys 2>&- +mount -o remount,rw /dev/root / -- cgit v1.2.3 From 293ad9c61ec69dab1eafa98b2c35c62fc15ccefc Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 20 Jun 2006 15:40:14 +0000 Subject: mount /proc earlier in /sbin/mount_root git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4022 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 6c8805c08..647c25327 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,6 +1,6 @@ #!/bin/sh -size=$(awk '/Mem:/ {l=5242880;print((s=$2/2) Date: Tue, 27 Jun 2006 00:36:13 +0000 Subject: add copyright headers to base-files scripts and config files git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4090 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/sbin/mount_root | 2 ++ 1 file changed, 2 insertions(+) (limited to 'package/base-files/default/sbin/mount_root') diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 647c25327..81660f006 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + mount none /proc -t proc size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)