Changeset 10221


Ignore:
Timestamp:
2008-01-18T18:52:26+01:00 (10 years ago)
Author:
juhosg
Message:

[adm5120] cleanup wget2nand script (closes #3049)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/adm5120/router_le/base-files/sbin/wget2nand

    r10110 r10221  
    99. /etc/functions.sh 
    1010 
    11 [ -d /tmp/wget2nand ] && { 
    12         echo "/tmp/wget2nand already exists" 
     11[ -d /tmp/wget2nand-rootfs ] && { 
     12        echo "/tmp/wget2nand-rootfs already exists" 
     13        exit 1 
     14} 
     15 
     16[ -d /tmp/wget2nand-kernel ] && { 
     17        echo "/tmp/wget2nand-kernel already exists" 
    1318        exit 1 
    1419} 
     
    2227} 
    2328 
    24  
    2529# first get an address for br-lan using udhcpc 
    2630killall udhcpc 
    2731/sbin/udhcpc -i br-lan 
    2832 
    29 boot="$(find_mtd_part 'RouterBoard NAND Boot')" 
    30 main="$(find_mtd_part 'rootfs')" 
    31 [ -z "$boot" -o -z "$main" ] && { 
     33mtd_kernel="$(find_mtd_part 'kernel')" 
     34mtd_rootfs="$(find_mtd_part 'rootfs')" 
     35[ -z "$mtd_kernel" -o -z "$mtd_rootfs" ] && { 
    3236        echo "Cannot find NAND Flash partitions" 
    3337        exit 1 
    3438} 
    3539 
    36 echo "Erasing filesystem." 
    37 mtd erase Boot 2>/dev/null >/dev/null 
    38 mtd erase Main 2>/dev/null >/dev/null 
     40echo "Erasing filesystem..." 
     41mtd erase kernel 2>/dev/null >/dev/null 
     42mtd erase rootfs 2>/dev/null >/dev/null 
    3943 
    40 echo "Mounting $main as new root and $boot as boot partition" 
     44echo "Mounting $mtd_rootfs as new root and $mtd_kernel as kernel partition" 
    4145 
    42 mkdir /tmp/wget2nand/ 
    43 mkdir /tmp/wget2nand-boot 
    44 mount -t yaffs2 "$main" /tmp/wget2nand/ 
    45 mount -t yaffs2 "$boot" /tmp/wget2nand-boot 
     46mkdir /tmp/wget2nand-rootfs 
     47mkdir /tmp/wget2nand-kernel 
     48mount -t yaffs2 "$mtd_rootfs" /tmp/wget2nand-rootfs 
     49mount -t yaffs2 "$mtd_kernel" /tmp/wget2nand-kernel 
    4650 
    47 echo "Erasing existing files." 
    48 rm -rf /tmp/wget2nand/* 
     51echo "Erasing existing files..." 
     52rm -rf /tmp/wget2nand-rootfs/* 
    4953 
    5054echo "Copying filesystem..." 
    51 ( wget -O - $url/openwrt-adm5120-2.6-rootfs.tgz) | ( cd /tmp/wget2nand/; tar xvz ) 
     55( wget -O - $url/openwrt-adm5120-2.6-rootfs.tgz) | ( cd /tmp/wget2nand-rootfs/; tar xvz ) 
    5256# RouterBOOT is looking for a kernel named "kernel" 
    53 wget -O /tmp/wget2nand-boot/kernel $url/openwrt-adm5120-2.6-rb1xx-kernel 
     57wget -O /tmp/wget2nand-kernel/kernel $url/openwrt-adm5120-2.6-rb1xx-kernel 
    5458 
    55 chmod +x /tmp/wget2nand-boot/kernel 
     59chmod +x /tmp/wget2nand-kernel/kernel 
    5660 
    5761# make sure everything is written before we unmount the partitions 
    58 echo "chmod ugo+x /" > /tmp/wget2nand/etc/uci-defaults/set_root_permission 
     62echo "chmod ugo+x /" > /tmp/wget2nand-rootfs/etc/uci-defaults/set_root_permission 
    5963sync 
    60 ls /tmp/wget2nand-boot/ 
    61 ls /tmp/wget2nand/ 
     64ls /tmp/wget2nand-kernel/ 
     65ls /tmp/wget2nand-rootfs/ 
    6266# unmount the partitions and remove the directories into which they were mounted 
    63 umount /tmp/wget2nand-boot 
    64 umount /tmp/wget2nand 
    65 rmdir /tmp/wget2nand-boot 
    66 rmdir /tmp/wget2nand 
     67umount /tmp/wget2nand-kernel 
     68umount /tmp/wget2nand-rootfs 
     69rmdir /tmp/wget2nand-kernel 
     70rmdir /tmp/wget2nand-rootfs 
    6771 
    6872# all done 
Note: See TracChangeset for help on using the changeset viewer.