source: freewrt/scripts/instprep-rb.sh@ 145c3b8

Last change on this file since 145c3b8 was 7c1a04d, checked in by Phil Sutter <n0-1@…>, 19 years ago

finally importing NAND flash target filesystem for rb532

To keep it consistent to the documentation, I renamed
the target from "flash" to "yaffs2". I also created the
necessary entry in target/Config.in, so it should be usable
now. Also the instprep-rb.sh script had to be touched (it
knows about the target fs it's used on).

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

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/bin/sh
2#
3# Prepare the RootFS for later use. Depending on
4# the chosen target device type, do some of the following:
5# * Create initial set of device nodes.
6# * Recursively change owner to root.
7# * Copy kernel to flash.
8#
9
10MYTARGET=@@TARGET_FS@@
11
12ME="`basename $0`"
13ID=`id -u`
14
15makenode() { # (name,type,major,minor)
16 if [ -c $1 ]; then
17 echo "skipping existing file \`$1'"
18 elif ! mknod $1 $2 $3 $4; then
19 echo "error creating file \`$1', aborting!"
20 exit 1
21 fi
22}
23help_quit() { # ()
24 echo "Usage:"
25 echo "$ME"
26 echo
27 echo "Prepare the RootFS right after installation for later use."
28 echo "If you want to know better, look at the source."
29 exit 1
30}
31
32[ $# -gt 0 ] && { echo "Too many arguments!"; help_quit;}
33[ "$ID" -ne 0 ] && { echo "You need to be root to run me!"; help_quit;}
34
35# check for myself in current dir
36if [ ! -f "${PWD}/$ME" ]; then
37 cd `dirname $0`
38fi
39
40case $MYTARGET in
41
42ext2-cf|nfs)
43echo "creating device nodes"
44makenode dev/null c 1 3
45makenode dev/tty c 5 0
46makenode dev/console c 5 1
47makenode dev/cfa b 13 0
48makenode dev/cfa1 b 13 1
49makenode dev/cfa2 b 13 2
50;;
51
52yaffs2)
53echo "copying over device nodes"
54cp -dpR /dev/null /dev/tty /dev/console /dev/mtd* dev/
55echo "copying over kernel"
56if [ -b /dev/mtdblock0 ]; then
57 mount -t yaffs2 /dev/mtdblock0 mnt/
58elif [ -b /dev/mtdblock/0 ]; then
59 mount -t yaffs2 /dev/mtdblock/0 mnt/
60else
61 echo "device node for first flash partition not found!"
62 exit 1
63fi
64cp kernel mnt/kernel
65umount mnt/
66;;
67
68*)
69echo "something is really going wrong here!"
70;;
71
72esac
73
74echo "recursively fixing ownership"
75chown -R root:root *
76
77exit 0
78
Note: See TracBrowser for help on using the repository browser.