2 # Copyright (C) 2006-2010 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
10 eval "$hook=\"\${$hook:+\${$hook}\${value:+\$sep}}\$value\""
15 for boot_func
in $
(eval "echo \"\$${1}_hook\""); do
21 local PART
="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
22 local PREFIX
=/dev
/mtdblock
25 [ -d /dev
/mtdblock
] && PREFIX
=/dev
/mtdblock
/
26 echo "${PART:+$PREFIX$PART}"
30 mtdpart
="$(find_mtd_part rootfs_data)"
31 magic
=$
(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
32 [ "$magic" != "deadc0de" ]
35 dupe
() { # <new_root> <old_root>
37 echo -n "creating directories... "
41 echo "./dev ./jffs ./mnt ./proc ./tmp"
42 # xdev skips mounted directories
47 echo -n "setting up symlinks... "
48 for file in $
(cd $2; find .
-xdev -type f
;); do
50 .
/rom
/note
) ;; #nothing
52 .
/usr
/lib
/opkg
/info
/*) cp -af $2/$file $file;;
53 *) ln -sf /rom
/${file#./*} $file;;
56 for file in $
(cd $2; find .
-xdev -type l
;); do
57 cp -af $2/${file#./*} $file
62 pivot
() { # <new_root> <old_root>
63 mount
-o move
/proc
$1/proc
&& \
64 pivot_root
$1 $1$2 && {
65 mount
-o move
$2/dev
/dev
66 mount
-o move
$2/tmp
/tmp
67 mount
-o move
$2/sys
/sys
2>&-
68 mount
-o move
$2/jffs
/jffs
2>&-
73 fopivot
() { # <rw_root> <ro_root> <dupe?>
76 if grep -q mini_fo
/proc
/filesystems
; then
77 mount
-t mini_fo
-o base
=/,sto
=$1 "mini_fo:$1" /mnt
2>&- && root
=/mnt
80 mount
--bind -o union
"$1" /mnt
&& root
=/mnt
84 mount |
grep "on $1 type" 2>&- 1>&- || mount
-o bind $1 $1
93 mount
-t tmpfs root
/tmp
/root
94 fopivot
/tmp
/root
/rom
1
This page took 0.058214 seconds and 5 git commands to generate.