change from /jffs to /overlay, patch from Daniel Dickinson

SVN-Revision: 20356
This commit is contained in:
Florian Fainelli 2010-03-21 17:16:50 +00:00
parent e7f046805a
commit 7af8ee0481
16 changed files with 26 additions and 26 deletions

View File

@ -62,14 +62,13 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
$(call Image/Build,jffs2-$(1)) $(call Image/Build,jffs2-$(1))
endef endef
define Image/mkfs/jffs2 define Image/mkfs/jffs2
rm -rf $(TARGET_DIR)/jffs
$(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/sub,$(SZ))) $(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/mkfs/jffs2/sub,$(SZ)))
endef endef
endif endif
ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),y) ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),y)
define Image/mkfs/squashfs define Image/mkfs/squashfs
@mkdir -p $(TARGET_DIR)/jffs @mkdir -p $(TARGET_DIR)/overlay
$(MKSQUASHFS_CMD) $(TARGET_DIR) $(KDIR)/root.squashfs -nopad -noappend -root-owned $(SQUASHFS_OPTS) $(MKSQUASHFS_CMD) $(TARGET_DIR) $(KDIR)/root.squashfs -nopad -noappend -root-owned $(SQUASHFS_OPTS)
$(call Image/Build,squashfs) $(call Image/Build,squashfs)
endef endef

View File

@ -364,7 +364,7 @@ define Package/base-files/install
mkdir -p $(1)/dev mkdir -p $(1)/dev
mkdir -p $(1)/etc/crontabs mkdir -p $(1)/etc/crontabs
mkdir -p $(1)/etc/rc.d mkdir -p $(1)/etc/rc.d
mkdir -p $(1)/jffs mkdir -p $(1)/overlay
mkdir -p $(1)/lib/firmware mkdir -p $(1)/lib/firmware
$(if $(LIB_SUFFIX),-ln -s lib $(1)/lib$(LIB_SUFFIX)) $(if $(LIB_SUFFIX),-ln -s lib $(1)/lib$(LIB_SUFFIX))
mkdir -p $(1)/mnt mkdir -p $(1)/mnt

View File

@ -5,11 +5,11 @@
no_fo_mount_jffs() { no_fo_mount_jffs() {
# initialize jffs2 # initialize jffs2
mount "$mtdpart" /jffs -t jffs2 || exit mount "$mtdpart" /overlay -t jffs2 || exit
# workaround to ensure that union can attach properly # workaround to ensure that union can attach properly
sync sync
ls /jffs >/dev/null ls /overlay >/dev/null
} }
boot_hook_add no_fo no_fo_mount_jffs boot_hook_add no_fo no_fo_mount_jffs

View File

@ -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/jffs -t jffs2 || exit mount "$mtdpart" /rom/overlay -t jffs2 || exit
} }
boot_hook_add switch2jffs skip_if_rootfs_mounted boot_hook_add switch2jffs skip_if_rootfs_mounted

View File

@ -5,7 +5,7 @@
no_fo_pivot() { no_fo_pivot() {
# switch to the new (empty) jffs2 # switch to the new (empty) jffs2
fopivot /jffs /rom 1 fopivot /overlay /rom 1
} }
boot_hook_add no_fo no_fo_pivot boot_hook_add no_fo no_fo_pivot

View File

@ -8,7 +8,7 @@ copy_ramoverlay() {
mount -o remount,ro none / 2>&- mount -o remount,ro none / 2>&-
# copy ramoverlay to jffs2 # copy ramoverlay to jffs2
echo -n "copying files ... " echo -n "copying files ... "
cp -a /tmp/root/* /rom/jffs 2>&- cp -a /tmp/root/* /rom/overlay 2>&-
echo "done" echo "done"
} }

View File

@ -9,9 +9,9 @@ with_fo_pivot() {
pivot /rom /mnt pivot /rom /mnt
mount -o move /mnt /tmp/root mount -o move /mnt /tmp/root
# /jffs is the overlay # /overlay is the overlay
# /rom is the readonly # /rom is the readonly
fopivot /jffs /rom fopivot /overlay /rom
} }
boot_hook_add switch2jffs with_fo_pivot boot_hook_add switch2jffs with_fo_pivot

View File

@ -5,7 +5,7 @@
no_fo_cleanup() { no_fo_cleanup() {
echo "done" echo "done"
umount -l /jffs umount -l /overlay
umount -l /tmp/root umount -l /tmp/root
exit 0 exit 0
} }

View File

@ -42,7 +42,7 @@ dupe() { # <new_root> <old_root>
{ {
cd $2 cd $2
find . -xdev -type d find . -xdev -type d
echo "./dev ./jffs ./mnt ./proc ./tmp" echo "./dev ./overlay ./mnt ./proc ./tmp"
# xdev skips mounted directories # xdev skips mounted directories
cd $1 cd $1
} | xargs mkdir -p } | xargs mkdir -p
@ -69,7 +69,6 @@ pivot() { # <new_root> <old_root>
mount -o move $2/dev /dev mount -o move $2/dev /dev
mount -o move $2/tmp /tmp mount -o move $2/tmp /tmp
mount -o move $2/sys /sys 2>&- mount -o move $2/sys /sys 2>&-
mount -o move $2/jffs /jffs 2>&-
mount -o move $2/overlay /overlay 2>&- mount -o move $2/overlay /overlay 2>&-
return 0 return 0
} }

View File

@ -3,7 +3,8 @@
# Copyright (C) 2010 Vertical Communications # Copyright (C) 2010 Vertical Communications
find_mount_jffs2() { find_mount_jffs2() {
mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2 mkdir -p /tmp/overlay
mount "$(find_mtd_part rootfs_data)" /tmp/overlay -t jffs2
} }
jffs2_not_mounted() { jffs2_not_mounted() {

View File

@ -5,7 +5,8 @@
rootfs_pivot() { rootfs_pivot() {
check_skip || jffs2_not_mounted || { check_skip || jffs2_not_mounted || {
echo "switching to jffs2" echo "switching to jffs2"
fopivot /jffs /rom && pi_mount_skip_next=true mount -o move /tmp/overlay /overlay 2>&-
fopivot /overlay /rom && pi_mount_skip_next=true
} }
} }

View File

@ -35,7 +35,7 @@ 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/dev $1/tmp $1/jffs && \ mkdir -p $1$2 $1/proc $1/dev $1/tmp $1/overlay && \
mount -o move /proc $1/proc && \ mount -o move /proc $1/proc && \
pivot_root $1 $1$2 || { pivot_root $1 $1$2 || {
umount $1 $1 umount $1 $1
@ -43,7 +43,7 @@ pivot() { # <new_root> <old_root>
} }
mount -o move $2/dev /dev mount -o move $2/dev /dev
mount -o move $2/tmp /tmp mount -o move $2/tmp /tmp
mount -o move $2/jffs /jffs 2>&- mount -o move $2/overlay /overlay 2>&-
return 0 return 0
} }
@ -63,9 +63,9 @@ run_ramfs() { # <command> [...]
mount -o remount,ro /mnt mount -o remount,ro /mnt
umount -l /mnt umount -l /mnt
grep /jffs /proc/mounts > /dev/null && { grep /overlay /proc/mounts > /dev/null && {
mount -o remount,ro /jffs mount -o remount,ro /overlay
umount -l /jffs umount -l /overlay
} }
# spawn a new shell from ramdisk to reduce the probability of cache issues # spawn a new shell from ramdisk to reduce the probability of cache issues

View File

@ -27,8 +27,8 @@ if [ "${0##*/}" = "firstboot" ]; then
boot_run_hook jffs2reset boot_run_hook jffs2reset
else else
mtd erase "$partname" mtd erase "$partname"
mount "$mtdpart" /jffs -t jffs2 mount "$mtdpart" /overlay -t jffs2
fopivot /jffs /rom 1 fopivot /overlay /rom 1
fi fi
fi fi

View File

@ -16,8 +16,8 @@ determine_external_root() {
# extroot requires extroot and fstab config files, therefore # extroot requires extroot and fstab config files, therefore
# we assume configuration is incomplete and not to be used if either of them # we assume configuration is incomplete and not to be used if either of them
# is missing (for jffs versions of these files on squashfs image) # is missing (for jffs versions of these files on squashfs image)
if [ "$jffs" = "/jffs" ] && [ -r "/jffs/etc/config/fstab" ]; then if [ "$jffs" = "/tmp/overlay" ] && [ -r "/tmp/overlay/etc/config/fstab" ]; then
UCI_CONFIG_DIR="/jffs/etc/config" UCI_CONFIG_DIR="/tmp/overlay/etc/config"
ER_IS_SQUASHFS=true ER_IS_SQUASHFS=true
fi fi

View File

@ -10,7 +10,7 @@ external_root_pivot() {
check_skip || [ "$pi_extroot_mount_success" != "true" ] || { check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
echo "switching to external rootfs" echo "switching to external rootfs"
if [ "$ER_IS_SQUASHFS" = "true" ]; then if [ "$ER_IS_SQUASHFS" = "true" ]; then
umount /jffs umount /tmp/overlay
fi fi
mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true
} }

View File

@ -2,4 +2,4 @@ src/gz snapshots http://downloads.openwrt.org/snapshots/trunk/$S/packages
dest root / dest root /
dest ram /tmp dest ram /tmp
lists_dir ext /var/opkg-lists lists_dir ext /var/opkg-lists
option overlay_root /jffs option overlay_root /overlay