Changeset 1e3c84d in freewrt


Ignore:
Timestamp:
Aug 2, 2007, 4:27:19 PM (18 years ago)
Author:
Thorsten Glaser <tg@…>
Children:
deb59c9
Parents:
492449f
Message:

an apparently working mini-fo based solution

git-svn-id: svn://www.freewrt.org/trunk/freewrt@3389 afb5a338-a214-0410-bd46-81f09a774fd1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • target/linux/brcm-2.4/ramovl/files/sbin/mount_root

    r492449f r1e3c84d  
    11#!/bin/sh
    2 
    3 pivot() { # <new_root> <old_root>
    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         }
    11 }
    12 
    13 dupe() { # <new_root> <old_root>
    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"
    24 
    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"
    37 }
    38 
    39 mountdp() { # <device> <mount_point> <ignored> <fs>
    40         dev=$1; mnt=$2; shift 2; opt=$*
    41         mount $dev $mnt $opt
    42         dupe $mnt $rom
    43         pivot $mnt /rom
    44 }
    452
    463size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo)
    474mount none /tmp -t tmpfs -o size=$size
    485
    49 mkdir -p /tmp/root
    50 mountdp /tmp/root /mnt -o bind
     6echo "switching to overlay filesystem"
     7mount -t tmpfs none /jffs
     8mount -t mini_fo -o base=/,sto=/jffs / /mnt
     9mount -o move /proc /mnt/proc
     10pivot_root /mnt /mnt/rom
     11mount -o move /rom/dev /dev
     12mount -o move /rom/tmp /tmp
    5113
    5214mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777
Note: See TracChangeset for help on using the changeset viewer.