8 size
="$(echo -n "$cmdline" | wc -c)"
9 dd if="$input" bs
=3M count
=1 |
(
12 dd if=/dev
/zero bs
="$((512 - $size))" count
=1
13 dd bs
=512 count
=1 of
=/dev
/null
18 fstype
="$(mount | grep ' / ' | awk '{print $5}')"
20 ext2|jffs2
) echo "Copying from $fstype to yaffs2";;
21 *) echo "Invalid filesystem."; exit 1;;
24 [ -d /tmp
/cf2nand
] && {
25 echo "/tmp/cf2nand already exists"
30 mkdir
/tmp
/cf2nand
/rootfs
31 mount
-t "$fstype" /dev
/root
/tmp
/cf2nand
/rootfs ||
{
32 echo "Mounting rootfs failed."
36 boot
="$(find_mtd_part 'RouterBoard NAND Boot')"
37 main
="$(find_mtd_part 'RouterBoard NAND Main')"
38 [ -z "$boot" -o -z "$main" ] && {
39 echo "Cannot find NAND Flash partitions"
43 echo "Erasing filesystem..."
44 mtd erase Boot
2>/dev
/null
>/dev
/null
45 mtd erase Main
2>/dev
/null
>/dev
/null
49 mount
-t yaffs2
"$boot" /tmp
/cf2nand
/p1
50 mount
-t yaffs2
"$main" /tmp
/cf2nand
/p2
52 echo "Copying kernel..."
53 copy_kernel
/dev
/cf
/card
0/part1
/tmp
/cf2nand
/p
1/kernel
"root=/dev/mtdblock1 rootfstype=yaffs2 " 2>/dev
/null
>/dev
/null
54 umount
/tmp
/cf2nand
/p1
57 echo "Copying filesystem..."
58 ( cd /tmp
/cf2nand
/rootfs
; tar c .
) |
( cd /tmp
/cf2nand
/p2
; tar x
)
60 umount
/tmp
/cf2nand
/p2
63 umount
/tmp
/cf2nand
/rootfs
64 rmdir /tmp
/cf2nand
/rootfs
This page took 0.051029 seconds and 5 git commands to generate.