Changeset 3388

Show
Ignore:
Timestamp:
08/02/07 16:18:14 (1 year ago)
Author:
tg
Message:

symlink-based squashfs-with-tmpfs-overlay filesystem type (tested)
• Closes: #310
• untested if this breaks normal squashfs…

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/mk/targets.mk

    r3335 r3388  
    9494$(eval $(call rootfs_template,jffs2,JFFS2,rootfstype=jffs2 root=/dev/mtdblock2)) 
    9595$(eval $(call rootfs_template,squashfs,SQUASHFS,rootfstype=squashfs root=/dev/mtdblock2)) 
     96$(eval $(call rootfs_template,ramovl,RAMOVL,rootfstype=squashfs root=/dev/mtdblock2)) 
    9697$(eval $(call rootfs_template,nfs,NFS,root=/dev/nfs ip=dhcp)) 
    9798$(eval $(call rootfs_template,ext2-cf,EXT2_CF,root=/dev/cfa2)) 
  • trunk/freewrt/package/base-files/Makefile

    r3385 r3388  
    380380${_IPKGS_COOKIE}: ${TOPDIR}/.cfg/FWRT_TARGET_ROOTFS_JFFS2 
    381381${_IPKGS_COOKIE}: ${TOPDIR}/.cfg/FWRT_TARGET_ROOTFS_SQUASHFS 
     382${_IPKGS_COOKIE}: ${TOPDIR}/.cfg/FWRT_TARGET_ROOTFS_RAMOVL 
    382383${_IPKGS_COOKIE}: ${TOPDIR}/.cfg/FWRT_TARGET_ROOTFS_NFS 
    383384${_IPKGS_COOKIE}: ${TOPDIR}/.cfg/FWRT_TARGET_ROOTFS_EXT2_CF 
  • trunk/freewrt/package/fwcf/Config.in

    r3235 r3388  
    44        default y if FWRT_TARGET_ROOTFS_JFFS2 
    55        default y if FWRT_TARGET_ROOTFS_SQUASHFS 
     6        default y if FWRT_TARGET_ROOTFS_RAMOVL 
    67        default n 
    78        select FWRT_PACKAGE_MKSH 
  • trunk/freewrt/package/fwupdate/Config.in

    r3326 r3388  
    44        default n 
    55        depends on FWRT_TARGET_ROOTFS_JFFS2 || FWRT_TARGET_ROOTFS_SQUASHFS || \ 
     6            FWRT_TARGET_ROOTFS_RAMOVL || \ 
    67            FWRT_TARGET_ROOTFS_EXT2_CF || FWRT_TARGET_ROOTFS_YAFFS2 
    78        select FWRT_PACKAGE_TAR if FWRT_TARGET_ROOTFS_EXT2_CF 
  • trunk/freewrt/package/fwupdate/Makefile

    r3332 r3388  
    1818fs-script-${FWRT_TARGET_ROOTFS_JFFS2}=fs-mtd.sh 
    1919fs-script-${FWRT_TARGET_ROOTFS_SQUASHFS}=fs-mtd.sh 
     20fs-script-${FWRT_TARGET_ROOTFS_RAMOVL}=fs-mtd.sh 
    2021fs-script-${FWRT_TARGET_ROOTFS_EXT2_CF}=fs-tar.sh 
    2122fs-script-${FWRT_TARGET_ROOTFS_YAFFS2}=fs-tar.sh 
  • trunk/freewrt/package/mini_fo/Config.in

    r2557 r3388  
    33        tristate 
    44        default n 
    5         depends on ! FWRT_TARGET_ROOTFS_SQUASHFS 
     5        depends on !FWRT_KERNEL_MINI_FO 
    66        help 
    77          The mini fanout overlay file system. 
  • trunk/freewrt/package/mtd/Config.in

    r2557 r3388  
    44        default y if FWRT_TARGET_ROOTFS_JFFS2 
    55        default y if FWRT_TARGET_ROOTFS_SQUASHFS 
     6        default y if FWRT_TARGET_ROOTFS_RAMOVL 
    67        default n 
    78        depends on FWRT_TARGET_ROOTFS_JFFS2 || \ 
     9                   FWRT_TARGET_ROOTFS_RAMOVL || \ 
    810                   FWRT_TARGET_ROOTFS_SQUASHFS 
    911        help 
    1012          Update utility for trx firmware images. 
    11  
  • trunk/freewrt/target/Config.in

    r3335 r3388  
    4545choice  
    4646prompt "Embedded Device" 
     47        default FWRT_DEVICE_BRCM_ASUS_WL500G_PREMIUM if FWRT_TARGET_CATEGORY_MIPS 
    4748 
    4849# 
     
    300301        select FWRT_PACKAGE_JFFS2ROOT 
    301302        select FWRT_KERNEL_JFFS2_FS 
    302         select FWRT_KERNEL_SQUASHFS  
     303        select FWRT_KERNEL_SQUASHFS 
    303304        select FWRT_KERNEL_MINI_FO 
    304305        depends on FWRT_LINUX_2_4_BRCM || FWRT_LINUX_2_6_BRCM 
    305306        help 
    306307          Build firmware images with a read-only and highly compressed 
    307           (squashfs with lzma compression) root filesystem and a overlay 
     308          (squashfs with lzma compression) root filesystem and an overlay 
    308309          filesystem for a pseudo writable root filesystem. Only differences 
    309310          to the read-only image are kept on a writable jffs2 partition. 
     311 
     312config FWRT_TARGET_ROOTFS_RAMOVL 
     313        bool "read-only root filesystem and tmpfs (squashfs)" 
     314        select FWRT_PACKAGE_MTD 
     315        select FWRT_PACKAGE_FWCF 
     316        select FWRT_KERNEL_SQUASHFS 
     317        select FWRT_KERNEL_MINI_FO 
     318        depends on FWRT_LINUX_2_4_BRCM || FWRT_LINUX_2_6_BRCM 
     319        help 
     320          Build firmware images with a read-only and highly compressed 
     321          (squashfs with lzma compression) root filesystem and an overlay 
     322          filesystem for a pseudo writable root filesystem. Differences 
     323          to the read-only image are kept in RAM and lost on reboot. 
    310324 
    311325config FWRT_TARGET_ROOTFS_NFS 
  • trunk/freewrt/target/image/brcm/Makefile

    r3363 r3388  
    7676endif 
    7777 
    78 ifeq ($(FWRT_TARGET_ROOTFS_SQUASHFS),y) 
    79 $(KDIR)/root.squashfs
    80         rm -f $(KDIR)/root.squashfs 
     78ifeq ($(FWRT_TARGET_ROOTFS_SQUASHFS)$(FWRT_TARGET_ROOTFS_RAMOVL),y) 
     79$(KDIR)/root.$(FS)
     80        rm -f $(KDIR)/root.$(FS) 
    8181        $(STAGING_TOOLS)/bin/mksquashfs-lzma $(KDIR)/root \ 
    82                 $(KDIR)/root.squashfs $(SQUASHFS_OPTS) $(MAKE_TRACE) 
     82                $(KDIR)/root.$(FS) $(SQUASHFS_OPTS) $(MAKE_TRACE) 
    8383endif 
    8484 
     
    9090        cp $(BUILD_DIR)/loader.elf $(BIN_DIR)/kernel/bootloader-$(BOARD)-$(KERNEL).elf 
    9191 
    92 ifeq ($(FS),squashfs
     92ifneq ($(filter squashfs ramovl,$(strip ${FS})),
    9393$(STAGING_DIR)/$(FWRT_PREFIX)-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/loader.tmp.gz $(KDIR)/root.$(FS) $(KDIR)/vmlinux.lzma 
    9494        $(STAGING_TOOLS)/bin/trx -o $@ $(KDIR)/loader.tmp.gz $(KDIR)/vmlinux.lzma -a 1024 $(KDIR)/root.$(FS) $(MAKE_TRACE) 
  • trunk/freewrt/target/linux/brcm-2.4/ramovl/files/sbin/mount_root

    r1111 r3388  
    11#!/bin/sh 
    2 is_dirty() { 
    3         grep Broadcom /proc/cpuinfo >&- || return 1 
    4         OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" 
    5         return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"') 
    6 } 
    72 
    83pivot() { # <new_root> <old_root> 
    9         mount -o move /proc $1/proc && \ 
    10         pivot_root $1 $1$2 && { 
    11                 mount -o move $2/dev /dev 
    12                 mount -o move $2/tmp /tmp 
    13                 return 0 
    14         } 
     4        mount -o move /proc $1/proc && \ 
     5        pivot_root $1 $1$2 && { 
     6                mount -o move $2/dev /dev 
     7                mount -o bind $2/etc /etc 
     8                mount -o move $2/tmp /tmp 
     9                return 0 
     10        } 
    1511} 
    1612 
    1713dupe() { # <new_root> <old_root> 
    18         cd $1 
    19         echo -n "creating directories... " 
    20        
    21                 cd $2  
    22                 find . -xdev -type d 
    23                 echo "./dev ./jffs ./mnt ./proc ./tmp" 
    24                 # xdev skips mounted directories 
    25                 cd $1  
    26         } | xargs mkdir -p 
    27         echo "done" 
     14       cd $1 
     15       echo -n "creating directories... " 
     16       
     17                cd $2 
     18               find . -xdev -type d 
     19               echo "./dev ./jffs ./mnt ./proc ./tmp" 
     20               # xdev skips mounted directories 
     21                cd $1 
     22       } | xargs mkdir -p 
     23       echo "done" 
    2824 
    29         echo -n "setting up symlinks... " 
    30         for file in $(cd $2; find . -xdev -type f;); do 
    31                 case "$file" in 
    32                 ./rom/note) ;; #nothing 
    33                 ./etc/resolv.conf|\ 
    34                 ./usr/lib/ipkg/info) cp -af $2/$file $file;; 
    35                 *) ln -sf /rom/${file#./*} $file;; 
    36                 esac 
    37         done 
    38         for file in $(cd $2; find . -xdev -type l;); do 
    39                 cp -af $2/${file#./*} $file 
    40         done 
    41         echo "done" 
     25        echo -n "setting up symlinks... " 
     26        for file in $(cd $2; find . -xdev -type f); do 
     27                case "$file" in 
     28                ./etc*|./rom/note) ;; #nothing 
     29                ./usr/lib/ipkg/info) cp -af $2/$file $file;; 
     30                *) ln -sf /rom/${file#./*} $file;; 
     31                esac 
     32        done 
     33        for file in $(cd $2; find . -xdev -type l); do 
     34                cp -af $2/${file#./*} $file 
     35        done 
     36        echo "done" 
    4237} 
    4338 
    4439mountdp() { # <device> <mount_point> <ignored> <fs> 
    45         dev=$1; mnt=$2; shift 2; opt=$* 
    46         mount $dev $mnt $opt 
    47         dupe $mnt $rom 
    48         pivot $mnt /rom 
     40       dev=$1; mnt=$2; shift 2; opt=$* 
     41       mount $dev $mnt $opt 
     42       dupe $mnt $rom 
     43       pivot $mnt /rom 
    4944} 
    5045 
     
    5247mount none /tmp -t tmpfs -o size=$size 
    5348 
    54 mtd unlock linux 
    55 is_dirty 
    56 [ $? != 0 ] && { 
    57         echo "switching to overlay filesystem" 
    58         datanr=$(awk -F : '/data/ { print $1 }' /proc/mtd |sed "s#mtd##") 
    59         mount /dev/mtdblock/$datanr /jffs -t jffs2 
    60         mount -t mini_fo -o base=/,sto=/jffs /jffs /mnt 
    61         pivot /mnt /rom 
    62 } || { 
    63         echo "jffs2 unusable; using ramdisk" 
    64         mkdir -p /tmp/root 
    65         mountdp /tmp/root /mnt -o bind 
    66 
     49mkdir -p /tmp/root 
     50mountdp /tmp/root /mnt -o bind 
    6751 
    6852mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 
  • trunk/freewrt/target/linux/brcm-2.4/squashfs/files/sbin/mount_root

    r1111 r3388  
    1919        echo -n "creating directories... " 
    2020        { 
    21                 cd $2  
     21                cd $2 
    2222                find . -xdev -type d 
    2323                echo "./dev ./jffs ./mnt ./proc ./tmp" 
    2424                # xdev skips mounted directories 
    25                 cd $1  
     25                cd $1 
    2626        } | xargs mkdir -p 
    2727        echo "done"