mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-16 22:56:14 +02:00
Do not overload mount-call - trying to reduce confusion
The behaviour of calling 'mount' differed depending on whether it called the busybox-mount, the mount of util-linux, the mount defined in /lib/functions.sh and /lib/functions/boot.sh /etc/preinit even included /lib/functions.sh and /lib/functions/boot.sh, both re-defining 'mount'. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34792 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
c577d7187d
commit
53edda1e36
@ -66,7 +66,7 @@ start() {
|
|||||||
touch /var/log/lastlog
|
touch /var/log/lastlog
|
||||||
touch /tmp/resolv.conf.auto
|
touch /tmp/resolv.conf.auto
|
||||||
ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
|
ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
|
||||||
grep -q debugfs /proc/filesystems && mount -t debugfs debugfs /sys/kernel/debug
|
grep -q debugfs /proc/filesystems && mount -o noatime -t debugfs debugfs /sys/kernel/debug
|
||||||
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
||||||
|
|
||||||
load_modules /etc/modules.d/*
|
load_modules /etc/modules.d/*
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
START=39
|
START=39
|
||||||
start() {
|
start() {
|
||||||
[ -d /proc/bus/usb ] && {
|
[ -d /proc/bus/usb ] && {
|
||||||
/bin/mount -t usbfs none /proc/bus/usb
|
mount -o noatime -t usbfs none /proc/bus/usb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
no_fo_mount_jffs() {
|
no_fo_mount_jffs() {
|
||||||
# initialize jffs2
|
# initialize jffs2
|
||||||
mount "$mtdpart" /overlay -t jffs2 || exit
|
mount -o noatime "$mtdpart" /overlay -t jffs2 || exit
|
||||||
|
|
||||||
# workaround to ensure that union can attach properly
|
# workaround to ensure that union can attach properly
|
||||||
sync
|
sync
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Copyright (C) 2010 Vertical Communications
|
# Copyright (C) 2010 Vertical Communications
|
||||||
|
|
||||||
skip_if_rootfs_mounted() {
|
skip_if_rootfs_mounted() {
|
||||||
mount "$mtdpart" /rom/overlay -t jffs2 || exit
|
mount -o noatime -t jffs2 "$mtdpart" /rom/overlay || exit
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add switch2jffs skip_if_rootfs_mounted
|
boot_hook_add switch2jffs skip_if_rootfs_mounted
|
||||||
|
@ -6,9 +6,6 @@
|
|||||||
debug () {
|
debug () {
|
||||||
${DEBUG:-:} "$@"
|
${DEBUG:-:} "$@"
|
||||||
}
|
}
|
||||||
mount() {
|
|
||||||
busybox mount "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# newline
|
# newline
|
||||||
N="
|
N="
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
# Copyright (C) 2006-2010 OpenWrt.org
|
# Copyright (C) 2006-2010 OpenWrt.org
|
||||||
# Copyright (C) 2010 Vertical Communications
|
# Copyright (C) 2010 Vertical Communications
|
||||||
|
|
||||||
mount() {
|
|
||||||
/bin/busybox mount -o noatime "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
boot_hook_splice_start() {
|
boot_hook_splice_start() {
|
||||||
export -n PI_HOOK_SPLICE=1
|
export -n PI_HOOK_SPLICE=1
|
||||||
}
|
}
|
||||||
@ -112,12 +108,12 @@ dupe() { # <new_root> <old_root>
|
|||||||
}
|
}
|
||||||
|
|
||||||
pivot() { # <new_root> <old_root>
|
pivot() { # <new_root> <old_root>
|
||||||
mount -o move /proc $1/proc && \
|
mount -o noatime,move /proc $1/proc && \
|
||||||
pivot_root $1 $1$2 && {
|
pivot_root $1 $1$2 && {
|
||||||
mount -o move $2/dev /dev
|
mount -o noatime,move $2/dev /dev
|
||||||
mount -o move $2/tmp /tmp
|
mount -o noatime,move $2/tmp /tmp
|
||||||
mount -o move $2/sys /sys 2>&-
|
mount -o noatime,move $2/sys /sys 2>&-
|
||||||
mount -o move $2/overlay /overlay 2>&-
|
mount -o noatime,move $2/overlay /overlay 2>&-
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,16 +122,16 @@ fopivot() { # <rw_root> <ro_root> <dupe?>
|
|||||||
root=$1
|
root=$1
|
||||||
{
|
{
|
||||||
if grep -q overlay /proc/filesystems; then
|
if grep -q overlay /proc/filesystems; then
|
||||||
mount -t overlayfs -olowerdir=/,upperdir=$1 "overlayfs:$1" /mnt && root=/mnt
|
mount -o noatime,lowerdir=/,upperdir=$1 -t overlayfs "overlayfs:$1" /mnt && root=/mnt
|
||||||
elif grep -q mini_fo /proc/filesystems; then
|
elif grep -q mini_fo /proc/filesystems; then
|
||||||
mount -t mini_fo -o base=/,sto=$1 "mini_fo:$1" /mnt 2>&- && root=/mnt
|
mount -t mini_fo -o noatime,base=/,sto=$1 "mini_fo:$1" /mnt 2>&- && root=/mnt
|
||||||
else
|
else
|
||||||
mount --bind / /mnt
|
mount --bind -o noatime / /mnt
|
||||||
mount --bind -o union "$1" /mnt && root=/mnt
|
mount --bind -o noatime,union "$1" /mnt && root=/mnt
|
||||||
fi
|
fi
|
||||||
} || {
|
} || {
|
||||||
[ "$3" = "1" ] && {
|
[ "$3" = "1" ] && {
|
||||||
mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1
|
mount | grep "on $1 type" 2>&- 1>&- || mount -o noatime,bind $1 $1
|
||||||
dupe $1 $rom
|
dupe $1 $rom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +140,7 @@ fopivot() { # <rw_root> <ro_root> <dupe?>
|
|||||||
|
|
||||||
ramoverlay() {
|
ramoverlay() {
|
||||||
mkdir -p /tmp/root
|
mkdir -p /tmp/root
|
||||||
mount -t tmpfs -o mode=0755 root /tmp/root
|
mount -t tmpfs -o noatime,mode=0755 root /tmp/root
|
||||||
fopivot /tmp/root /rom 1
|
fopivot /tmp/root /rom 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
mount_no_mtd() {
|
mount_no_mtd() {
|
||||||
mtd unlock rootfs
|
mtd unlock rootfs
|
||||||
mount -o remount,rw /dev/root /
|
mount -o noatime,remount,rw /dev/root /
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_mtd() {
|
check_for_mtd() {
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
# Copyright (C) 2010 Vertical Communications
|
# Copyright (C) 2010 Vertical Communications
|
||||||
|
|
||||||
do_mount_procfs() {
|
do_mount_procfs() {
|
||||||
mount -t proc proc /proc
|
mount -o noatime -t proc proc /proc
|
||||||
}
|
}
|
||||||
|
|
||||||
do_mount_sysfs() {
|
do_mount_sysfs() {
|
||||||
mount -t sysfs sysfs /sys
|
mount -o noatime -tsysfs sysfs /sys
|
||||||
}
|
}
|
||||||
|
|
||||||
calc_tmpfs_size() {
|
calc_tmpfs_size() {
|
||||||
@ -16,7 +16,7 @@ calc_tmpfs_size() {
|
|||||||
|
|
||||||
do_mount_tmpfs() {
|
do_mount_tmpfs() {
|
||||||
calc_tmpfs_size
|
calc_tmpfs_size
|
||||||
mount -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp
|
mount -o noatime -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add preinit_essential do_mount_procfs
|
boot_hook_add preinit_essential do_mount_procfs
|
||||||
|
@ -6,19 +6,19 @@ do_move_devtmpfs() {
|
|||||||
local mnt="$(grep devtmpfs /proc/mounts)"
|
local mnt="$(grep devtmpfs /proc/mounts)"
|
||||||
mnt="${mnt#* }"; mnt="${mnt%% *}"
|
mnt="${mnt#* }"; mnt="${mnt%% *}"
|
||||||
|
|
||||||
[ "$mnt" = "/dev" ] || mount -o move "$mnt" /dev
|
[ "$mnt" = "/dev" ] || mount -o noatime,move "$mnt" /dev
|
||||||
}
|
}
|
||||||
|
|
||||||
do_mount_devfs() {
|
do_mount_devfs() {
|
||||||
mount -t devfs devfs /dev
|
mount -o noatime -t devfs devfs /dev
|
||||||
}
|
}
|
||||||
|
|
||||||
do_mount_hotplug() {
|
do_mount_hotplug() {
|
||||||
mount -t tmpfs -o mode=0755,size=512K tmpfs /dev
|
mount -t tmpfs -o noatime,mode=0755,size=512K tmpfs /dev
|
||||||
}
|
}
|
||||||
|
|
||||||
do_mount_udev() {
|
do_mount_udev() {
|
||||||
mount -n -t tmpfs -o mode=0755 udev /dev
|
mount -n -t tmpfs -o noatime,mode=0755 udev /dev
|
||||||
}
|
}
|
||||||
|
|
||||||
choose_device_fs() {
|
choose_device_fs() {
|
||||||
|
@ -7,7 +7,7 @@ init_devpts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_mount_devpts() {
|
do_mount_devpts() {
|
||||||
mount -t devpts devpts /dev/pts
|
mount -o noatime -t devpts devpts /dev/pts
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add preinit_essential init_devpts
|
boot_hook_add preinit_essential init_devpts
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
find_mount_jffs2() {
|
find_mount_jffs2() {
|
||||||
mkdir -p /tmp/overlay
|
mkdir -p /tmp/overlay
|
||||||
mount "$(find_mtd_part rootfs_data)" /tmp/overlay -t jffs2
|
mount -o noatime -t jffs2 "$(find_mtd_part rootfs_data)" /tmp/overlay
|
||||||
mtd -qq unlock rootfs_data
|
mtd -qq unlock rootfs_data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
rootfs_pivot() {
|
rootfs_pivot() {
|
||||||
check_skip || jffs2_not_mounted || {
|
check_skip || jffs2_not_mounted || {
|
||||||
echo "switching to jffs2"
|
echo "switching to jffs2"
|
||||||
mount -o move /tmp/overlay /overlay 2>&-
|
mount -o noatime,move /tmp/overlay /overlay 2>&-
|
||||||
fopivot /overlay /rom && pi_mount_skip_next=true
|
fopivot /overlay /rom && pi_mount_skip_next=true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,16 +36,16 @@ install_bin() { # <file> [ <symlink> ... ]
|
|||||||
pivot() { # <new_root> <old_root>
|
pivot() { # <new_root> <old_root>
|
||||||
mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1
|
mount | grep "on $1 type" 2>&- 1>&- || mount -o bind $1 $1
|
||||||
mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \
|
mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \
|
||||||
mount -o move /proc $1/proc && \
|
mount -o noatime,move /proc $1/proc && \
|
||||||
pivot_root $1 $1$2 || {
|
pivot_root $1 $1$2 || {
|
||||||
umount $1 $1
|
umount $1 $1
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
mount -o move $2/sys /sys
|
mount -o noatime,move $2/sys /sys
|
||||||
mount -o move $2/dev /dev
|
mount -o noatime,move $2/dev /dev
|
||||||
mount -o move $2/tmp /tmp
|
mount -o noatime,move $2/tmp /tmp
|
||||||
mount -o move $2/overlay /overlay 2>&-
|
mount -o noatime,move $2/overlay /overlay 2>&-
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ run_ramfs() { # <command> [...]
|
|||||||
umount -l /mnt
|
umount -l /mnt
|
||||||
|
|
||||||
grep /overlay /proc/mounts > /dev/null && {
|
grep /overlay /proc/mounts > /dev/null && {
|
||||||
mount -o remount,ro /overlay
|
mount -o noatime,remount,ro /overlay
|
||||||
umount -l /overlay
|
umount -l /overlay
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ if [ "${0##*/}" = "firstboot" ]; then
|
|||||||
boot_run_hook jffs2reset
|
boot_run_hook jffs2reset
|
||||||
else
|
else
|
||||||
mtd erase "$partname"
|
mtd erase "$partname"
|
||||||
mount "$mtdpart" /overlay -t jffs2
|
mount -o noatime "$mtdpart" /overlay -t jffs2
|
||||||
fopivot /overlay /rom 1
|
fopivot /overlay /rom 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
do_mount_procfs() {
|
do_mount_procfs() {
|
||||||
mount none /proc -t proc
|
mount -o noatime none /proc -t proc
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ set_state init
|
|||||||
echo "- init -"
|
echo "- init -"
|
||||||
|
|
||||||
[ -n "$SWITCH_ROOT_TMPFS" ] && {
|
[ -n "$SWITCH_ROOT_TMPFS" ] && {
|
||||||
mount none /mnt -t tmpfs
|
mount -o noatime none /mnt -t tmpfs
|
||||||
( cd /; find -xdev -type d ) | ( cd /mnt; xargs mkdir -p )
|
( cd /; find -xdev -type d ) | ( cd /mnt; xargs mkdir -p )
|
||||||
find / \! -type d -xdev | tar -cT /proc/self/fd/0 | tar -xC /mnt
|
find / \! -type d -xdev | tar -cT /proc/self/fd/0 | tar -xC /mnt
|
||||||
mkdir /mnt/proc /mnt/dev /mnt/tmp /mnt/sys
|
mkdir /mnt/proc /mnt/dev /mnt/tmp /mnt/sys
|
||||||
mount -o move /proc /mnt/proc
|
mount -o noatime,move /proc /mnt/proc
|
||||||
mount -o move /dev /mnt/dev
|
mount -o noatime,move /dev /mnt/dev
|
||||||
mount -o move /tmp /mnt/tmp
|
mount -o noatime,move /tmp /mnt/tmp
|
||||||
mount -o move /sys /mnt/sys
|
mount -o noatime,move /sys /mnt/sys
|
||||||
rm -rf /proc /dev /tmp /sys
|
rm -rf /proc /dev /tmp /sys
|
||||||
exec switch_root -c /dev/console /mnt /sbin/init
|
exec switch_root -c /dev/console /mnt /sbin/init
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ done
|
|||||||
COUNTER=0
|
COUNTER=0
|
||||||
while [ $COUNTER -lt 10 ]; do
|
while [ $COUNTER -lt 10 ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
mount $rootfs /mnt
|
mount -o noatime $rootfs /mnt
|
||||||
[ $? -eq "0" ] && let COUNTER=100;
|
[ $? -eq "0" ] && let COUNTER=100;
|
||||||
let COUNTER=COUNTER+1
|
let COUNTER=COUNTER+1
|
||||||
done
|
done
|
||||||
@ -84,12 +84,12 @@ done
|
|||||||
|
|
||||||
unset rootfs
|
unset rootfs
|
||||||
|
|
||||||
mount -o move /proc /mnt/proc
|
mount -o noatime,move /proc /mnt/proc
|
||||||
mount -o move /dev /mnt/dev
|
mount -o noatime,move /dev /mnt/dev
|
||||||
mount -o move /dev/pts /mnt/dev/pts
|
mount -o noatime,move /dev/pts /mnt/dev/pts
|
||||||
mount -o move /tmp /mnt/tmp
|
mount -o noatime,move /tmp /mnt/tmp
|
||||||
mount -o move /sys /mnt/sys
|
mount -o noatime,move /sys /mnt/sys
|
||||||
mount none /tmp -t tmpfs
|
mount -o noatime none /tmp -t tmpfs
|
||||||
killall -q hotplug2
|
killall -q hotplug2
|
||||||
exec switch_root -c /dev/console /mnt /sbin/init
|
exec switch_root -c /dev/console /mnt /sbin/init
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
# Copyright (C) 2010 Vertical Communications
|
# Copyright (C) 2010 Vertical Communications
|
||||||
|
|
||||||
do_mount_procfs() {
|
do_mount_procfs() {
|
||||||
mount -t proc none /proc
|
mount -o noatime -t proc none /proc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,5 @@
|
|||||||
# Copyright (C) 2010 Vertical Communications
|
# Copyright (C) 2010 Vertical Communications
|
||||||
|
|
||||||
do_mount_procfs() {
|
do_mount_procfs() {
|
||||||
mount -t proc none /proc
|
mount -o noatime -t proc none /proc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
do_mount_xenfs() {
|
do_mount_xenfs() {
|
||||||
[ -f /etc/modules.d/??-xenfs ] && {
|
[ -f /etc/modules.d/??-xenfs ] && {
|
||||||
insmod $(cat /etc/modules.d/??-xenfs)
|
insmod $(cat /etc/modules.d/??-xenfs)
|
||||||
mount none /proc/xen -t xenfs
|
mount -o noatime none /proc/xen -t xenfs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user