Note 1: Linux-2.6.25.8 and Linux-2.6.30.4 can use the same file system (major parts are same, the only difference is the driver module). The explaination in this tutorial is using 2.6.30.4 as an example.
Note 2. Suggest to do tut 12 first, and then come back to do this tuturial.
11.1 Build the frame
Create a directory “root_2.6.30.4” under “/opt/EmbedSky/”. Copy the compiled directories from busybox “bin”, “sbin”,”usr” and “linuxrc” to “root_2.6.30.4”.
Also need to create “dev”,”etc”,”home”,”lib”,”mnt”,”opt”,”proc”¡¢”root”,”sys”,”tmp”,”var” and “web”.
Also create a “lib” and “share” under the exsisting “usr”.
Use the following commands:
#mkdir -p /opt/EmbedSky/root_2.6.30.4
#cd /opt/EmbedSky/root_2.6.30.4
#cp -rf /opt/EmbedSky/busybox-1.13.0/_install/* .
#mkdir -p dev etc home/sky lib mnt/udisk mnt/sd opt proc root sys tmp usr/lib usr/share var
11.2 Add new contents
We suggest you do the the following contents manually so you can get familar with the important concepts. If you choose you can also copy the exisiting one from the ported file system from
http://www.cutedigi.com/forum/viewtopic.php?f=24&t=262.
“dev” directory:
The contents under “dev” will be automatically created by the system by calling “mdev” when kernel finished loading file system.
However, “mdev” is calling “init” to boot. Before using mdev to create “dev”, init will need “/dev/console” and “/dev/null”. So we need to statically create these two device files when build the file system:
#cd /opt/EmbedSky/root_2.6.30.4/dev
#mknod console c 5 1
#mknod null c 1 3
If we don’t create these two device files, during booting, the file system will report “Warning: unable to open an initial console.”
This warning message comes from line 778 int_post() in the kernel file “init/main.c”.
“etc” directory:
It’s used to store system config files. The frequent used files are stored under “etc/”.
Note: The mentioned files can be copied from the file system we provided. You can also use vi or gedit command to create them, and type the corresponding contents. The mentioned directories also need to be created.
fstab:Specify the file systems that need to be mounted.
group:User group.
inittab:config files for init process.
shadow:This file is used by “passwd” to create password.
passwd:password file.
profile:Config file of user enviroment.
mdev.conf:Starting from 2.6.18, linux stops using devfs, and use udev (mdev is simplied version of udev). mdev.conf can be blank or edit according to some rules. Here we add the scripts used to automatically mount SD and USB flash drive.
resolv.conf:It’s used to DNS information. DNS is needed when excess extra net.
The frequent used directories:
init.d:the starting file directory. There are one “rcS” file under this directory, it is used to store the booting config and the automatically started processes.
sysconfig:In the file system we provides, there is one file named “HOSTNAME”. The content of this file is: EmbedSky£¬ That’s why we will see “[root@EmbedSky /]” in the file system.
rc.d:It’s used to store some automatically called scrips in our file system.
boa:a directory only in our file system, used to store the config script of web server.
Now we list the contents of each files under “etc/”.
Note: If you want to build a brand new file system, you need to create these files.
fstab:
# device mount-point type options dump fsck order
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0
var /dev tmpfs defaults 0 0
ramfs /dev ramfs defaults 0 0
group:
root:*:0:
daemon:*:1:
bin:*:2:
sys:*:3:
adm:*:4:
tty:*:5:
disk:*:6:
lp:*:7:lp
mail:*:8:
news:*:9:
uucp:*:10:
proxy:*:13:
kmem:*:15:
dialout:*:20:
fax:*:21:
voice:*:22:
cdrom:*:24:
floppy:*:25:
tape:*:26:
sudo:*:27:
audio:*:29:
ppp:x:99:
500:x:500:sky
501:x:501:sky
inittab: please refer to the “examples/inittab” under the busybox directory.
# /etc/inittab
::sysinit:/etc/init.d/rcS
tq2440_serial0::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
Note 1:The red part in the reference files in busybox is ttySAC0, but we use tq2440_serial as device name in the serial driver for s3c24xx.(in Linux-2.6.25.8 kernel source file “drivers/serial/s3c2410.c”, line 949, in Linux-
2.6.30.4 kenerl source file “drivers/serial/samsung.c” line 888, we change it to tq2440_serial. We then use seerial 0 as control console, so we use tq2440_serial0.
Note 2: we need to change inittab to executable, recommended to use 777. Command: #chmod 777 inittab.
shadow:
The content is blank.
Comment: This file is used by passwd.
passwd:
root::0:0:root:/:/bin/sh
ftp::14:50:FTP User:/var/ftp:
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:
nobody:*:99:99:Nobody:/:
sky:$1$8GIZx6d9$L2ctqdXbYDzkbxNURpE4z/:502:502:Linux User,,,:/home/sky:/bin/sh
Note: the red part is the encrypted password. The method to get it to do run set password in a built filesystem (your host) using “passwd sky”, and open this file, then you will see this content.
profile:
# Ash profile
# vim: syntax=sh
# No core files by default
#ulimit -S -c 0 > /dev/null 2>&1
USER=”`id -un`”
LOGNAME=$USER
PS1='[u@h W]# ‘
PATH=$PATH
HOSTNAME=`/bin/hostname`
export USER LOGNAME PS1 PATH
Leave a Reply
You must be logged in to post a comment.