Date:2011-02-10 11:13:34 (13 years 1 month ago)
Author:Xiangfu Liu
Commit:c631197a379aede07e8977a04274e99749bd17b4
Message:nanonote script file mtd.nn update help message and data partition size

Files: nanonote-files/script-files/usr/bin/mtd.nn (3 diffs)

Change Details

nanonote-files/script-files/usr/bin/mtd.nn
11#!/bin/bash
2
3__VERSION__=2011-02-02
24
35if [ "$1" == "flash" ] && [ "$#" == "3" ]; then
46    case "$2" in
57    "bootloader")
6    echo "not implenment"
8        echo "not implenment"
79    #flash_eraseall /dev/mtd0
810    exit 0
911    ;;
...... 
2729fi
2830
2931if [ "$1" == "mount" ] && [ "$#" == "3" ]; then
30    MOUNT_POINT="$3"
32    if [ "$2" == "rootfs" ] || [ "$2" == "data" ]; then
33    MOUNT_POINT="$3"
34    if [ "$2" == "rootfs" ]; then
35        PARTITION="2"
36    elif [ "$2" == "data" ]; then
37        PARTITION="3"
38    fi
3139
32    if [ "$2" == "rootfs" ]; then
33    PARTITION="2"
34    elif [ "$2" == "data" ]; then
35    PARTITION="3"
36    fi
40    mkdir -p $MOUNT_POINT
41    if [ "$?" != "0" ]; then
42        echo "mkdir -p $MOUNT_POINT Fail"
43        exit 1
44    fi
3745
38    ubiattach /dev/ubi_ctrl -m ${PARTITION}
39    DEV_UBI=`dmesg | grep "UBI: attached mtd${PARTITION} to" | cut -d ":" -f 2 | cut -d " " -f 5`
40    mkdir -p $MOUNT_POINT
41    if [ -d "$3" ]; then
42    echo "$3 not a folder"
43    exit 1
46    ubiattach /dev/ubi_ctrl -m ${PARTITION}
47    DEV_UBI=`dmesg | grep "UBI: attached mtd${PARTITION} to" | cut -d ":" -f 2 | cut -d " " -f 5`
48    mount -t ubifs ${DEV_UBI}_0 $MOUNT_POINT
49        exit 0
4450    fi
45
46    mount -t ubifs ${DEV_UBI}_0 $MOUNT_POINT
4751fi
4852
49
50if [ "$1" == "format_data" ]; then
53if [ "$1" == "format_data_default" ]; then
5154    ubiformat /dev/mtd3 -y
5255    ubiattach /dev/ubi_ctrl -m 3
53    ubimkvol /dev/ubi1 -s 1730MiB -N data
56    ubimkvol /dev/ubi1 -s 1400MiB -N data
5457    exit 0
5558fi
5659
...... 
7780fi
7881
7982echo "\
80Usage: $0 [-d <version>] [-l <path to local images>] [-h]
81     -d <> I will download and flash a specific version of OpenWrt images
83Usage: $0 [ command ] [ <para1> <para2> <para3> ]
84     flash bootloader|kernel|rootfs|data image_file
85             flash nand partition using <image_file>
8286
83     -l <> I will flash images present in <arg>
84            (missing files will be skipped)
87     mount rootfs|data mount_point
88             mount nand partition
8589
86     -h you already found out
90     format_data_default
91             lookinside for more detari
92             NOTICE:
93                     this command will format data
94                     partition, create a default
95                     1400MB volume, named 'data',
96                     ALL data will lost after run.
8797
88OpenWrt reflash script for qi-hardware Ben NanoNote
89written by: Xiangfu Liu (xiangfu@sharism.cc)
98     fw_setenv_default
99             reset bootloader default variable
100             lookinside for more detail
101             NOTICE:
102                     this command write hardcode
103                     variables to nand, so it must
104                     run once before you want change
105                     change it.
90106
91                                                     version: ${__VERSION__}
92Please report bugs to developer@lists.qi-hardware.com"
93exit 1
107script file for Qi Hardware Ben NanoNote
108written by: Xiangfu Liu (xiangfu@sharism.cc)
109written with Emacs in Ben NanoNote
110                             version: ${__VERSION__}
111Report bugs to developer@lists.qi-hardware.com"
112exit 0

Archive Download the corresponding diff file



interactive