-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manual_to_build_rootfs_for_ARM
240 lines (185 loc) · 5.66 KB
/
Manual_to_build_rootfs_for_ARM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
http://processors.wiki.ti.com/index.php/Creating_a_Root_File_System_for_Linux_on_OMAP35x
cd busybox--version
make ARCH=arm AROSS_COMPILE=arm-none-linux-gnueabi- defconfig
make ARCH=arm AROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
--enable static
make ARCH=arm AROSS_COMPILE=arm-none-linux-gnueabi-
make ARCH=arm AROSS_COMPILE=arm-none-linux-gnueabi- install
cp -r _install ../rootfs
cd ../rootfs
mknod ttySAC0 c 204 64
mknod tty0 c 4 0
[root@localhost target]# mkdir dev
[root@localhost target]# mknod dev/console c 5 1
[root@localhost target]# mkdir dev/pts
[root@localhost target]# mkdir etc
[root@localhost target]# mkdir etc/init.d
[root@localhost target]# mkdir lib
[root@localhost target]# mkdir mnt
[root@localhost target]# mkdir opt
[root@localhost target]# mkdir proc
[root@localhost target]# mkdir root
[root@localhost target]# mkdir sys
[root@localhost target]# mkdir tmp
[root@localhost target]# mkdir var
[root@localhost target]# mkdir var/log
[root@localhost target]# cd etc
[root@localhost etc]# vi fstab
proc /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
[root@localhost etc]# vi group
root:x:0:root
[root@localhost etc]# vi passwd
root::0:0:root:/root:/bin/ash
[root@localhost etc]# vi hosts
127.0.0.1 localhost
[root@localhost etc]# vi inittab
::sysinit:/etc/init.d/rcS
# /bin/ash
#
# Start an "askfirst" shell on the serial port
console::askfirst:-/bin/ash
# Stuff to do when restarting the init process
::restart:/sbin/init
# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a
[root@localhost etc]# vi init.d/rcS
#!/bin/sh
# ---------------------------------------------
# Common settings
# ---------------------------------------------
HOSTNAME=OMAP3EVM
VERSION=1.0.0
hostname $HOSTNAME
# ---------------------------------------------
# Prints execution status.
#
# arg1 : Execution status
# arg2 : Continue (0) or Abort (1) on error
# ---------------------------------------------
status ()
{
if [ $1 -eq 0 ] ; then
echo "[SUCCESS]"
else
echo "[FAILED]"
if [ $2 -eq 1 ] ; then
echo "... System init aborted."
exit 1
fi
fi
}
# ---------------------------------------------
# Get verbose
# ---------------------------------------------
echo ""
echo " System initialization..."
echo ""
echo " Hostname : $HOSTNAME"
echo " Filesystem : v$VERSION"
echo ""
echo ""
echo " Kernel release : `uname -s` `uname -r`"
echo " Kernel version : `uname -v`"
echo ""
# ---------------------------------------------
# MDEV Support
# (Requires sysfs support in the kernel)
# ---------------------------------------------
echo -n " Mounting /proc : "
mount -n -t proc /proc /proc
status $? 1
echo -n " Mounting /sys : "
mount -n -t sysfs sysfs /sys
status $? 1
echo -n " Mounting /dev : "
mount -n -t tmpfs mdev /dev
status $? 1
echo -n " Mounting /dev/pts : "
mkdir /dev/pts
mount -t devpts devpts /dev/pts
status $? 1
echo -n " Enabling hot-plug : "
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
status $? 0
echo -n " Populating /dev : "
mkdir /dev/input
mkdir /dev/snd
mdev -s
status $? 0
# ---------------------------------------------
# Disable power management
# (Requires sysfs support in the kernel)
# ---------------------------------------------
# echo -n " Disabling Power mgmt : "
# echo -n "1" > /sys/power/cpuidle_deepest_state
# status $? 1
# ---------------------------------------------
# Turn off LCD after 1 hour of inactivity
# (Requires sysfs support in the kernel)
# ---------------------------------------------
# echo -n " Turn off LCD after 1 hour : "
# echo -n "3600" > /sys/power/fb_timeout_value
# status $? 1
# ---------------------------------------------
# Mount the default file systems
# ---------------------------------------------
echo -n " Mounting other filesystems : "
mount -a
status $? 0
# ---------------------------------------------
# Set PATH
# ---------------------------------------------
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
# ---------------------------------------------
# Start other daemons
# ---------------------------------------------
echo -n " Starting syslogd : "
/sbin/syslogd
status $? 0
echo -n " Starting telnetd : "
/usr/sbin/telnetd
status $? 0
# ---------------------------------------------
# Done!
# ---------------------------------------------
echo ""
echo "System initialization complete."
# ---------------------------------------------
# Start demo app
# ---------------------------------------------
#if [[ -x /etc/init.d/demo_start ]]; then
# echo " Starting Demo Application..."
# /etc/init.d/demo_start &
# sleep 5
#fi
cat /proc/filesystems | grep -q debugfs
if [ $? -eq 0 ] ; then
echo -n " Mounting /debug : "
mount -n -t debugfs none /debug
status $? 1
fi
[root@localhost etc]# vi mdev.conf
audio 0:5 0666
console 0:5 0600
control.* 0:0 0660 @/bin/mv /dev/$MDEV /dev/snd/
dsp 0:5 0666
event.* 0:0 0600 @/bin/mv /dev/$MDEV /dev/input/
fb 0:5 0666
nfs 0:5 0770
null 0:0 0777
pcm.* 0:0 0660 @/bin/mv /dev/$MDEV /dev/snd/
rtc 0:0 0666
tty 0:5 0660
tty0* 0:5 0660
tty1* 0:5 0660
tty2* 0:5 0660
tty3* 0:5 0660
tty4* 0:5 0660
tty5* 0:5 0660
tty6* 0:5 0660
ttyS* 0:5 0640
urandom 0:0 0444
zero 0:0 0666