1.
Busybox源码:http://www.busybox.net/downloads/
# cd /home/liao
# tar –jxvf busybox-1.13.3.tar.bz2
# cd busybox-1.13.3
2. busybox编译
2.1修正Makefile
CROSS_COMPILE ?=arm-linux-
ARCH ?=arm
2.2
# make menuconfig
Busybox Settings—>
Build Options—>
[*] Build BusyBox as a static binary(no shared libs)
[*] Build with Large File Support(for accessing files>2GB)
[]Don’t use /usr
Applets links (as soft-links) —>
(./_install) BusyBox installation prefix
[*] vi-style line editing commands
[*]Fancy shell prompts
Linux Module Utilities—>
(/lib/modules)Default directory containing modules
(modules.dep)Default name of modules.dep
[ ] simplified modutils
[*] insmod
[*] rmmod
[*] lsmod
[*] modprobe
—–options common to multiple modutils
[ ] support version 2.2/2.4 Linux kernels
[*]Support tainted module checking with new kernels
[*]Support for module .aliases file
[*] support for modules.symbols file
Linux System Utilities —>
[*]Support /etc/mdev.conf
[*]Support command execution at device addition/removal
# make
# make install
编译犯错:
networking/interface.c:818: error: `ARPHRD_INFINIBAND undeclared here (not in a function)
networking/interface.c:818: error: initializer element is not constant
networking/interface.c:818: error: (near initialization for `ib_hwtype.type)
make[1]: *** [networking/interface.o]
make: *** [networking]
处理:在networking/interface.c文件中增加:
#define ARPHRD_INFINIBAND 32
编译后,在rootfs目录下会生成目录bin、sbin、usr和文件linuxrc的内容
3.
# mkdir dev etc lib proc sys mnt tmp var home boot root
# mkdir usr/lib usr/modules
# mkdir etc/init.d etc/sysconfig
# mkdir mnt/etc mnt/jffs2 mnt/data mnt/temp
# mkdir var/lib var/lock var/run var/tmp
# chmod 1777 tmp
# chmod 1777 var/tmp
# sudo mknod -m 600 dev/console c 5 1
# sudo mknod -m 600 dev/null c 1 3
这两个设备节点需求root用户树立,详细原因有待研讨
4.
4.1 etc/mdev.conf文件,内容可有可无。
4.2 passwd、group、shadow文件,手动、主动创立
手动创立是依据标准手动编写这三个文件内容
# cat passwd
root:x:0:0:root:/root:/bin/sh
passwd总共由7个字段组成,6个冒号将其离隔。它们的意义分别为:
1
2
3
4
5
6
7
#cat group
root:x:0:
group总共由4个字段组成,3个冒号将其离隔,它们的意义分别为:
1
2
3
4
#cat shadow
root:$1$3jZ93Mwq$oaeef6lWIuThavs8wD0Wh1:0:0:99999:7:::
shadow总共由9个字段组成,8个冒号将其离隔,它们的意义分别为:
1
2
3
4
5
6
7
8
9
主动创立是运用busybox供给的adduser和passwd
在文件体系正常运转起来后,运用adduser指令,运用方法为:
#adduser root
然后就会在etc目录下主动生成passwd
passwd:unknown uid 0
这总共不能为该用户设置暗码,此刻你会发现要passwd指令也无法运用。处理的方法是,翻开passwd文件,其内容为:
root:x:1000:1000:Linux User…:/home/root:/bin/sh
将用户ID和组ID均更改为0
翻开group文件,其内容为:
root:x:1000:
相同将组ID改为0
然后,passwd指令就能够正常运用了。这时为root用户设置口令:
#passwd root
依据提示输入暗码。其间,root用户登陆后的目录能够手动进行更改。
4.3 etc/inittab文件:
::sysinit:/etc/init.d/rcS
s3c2410_serial0::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a –r
4.4 etc/init.d/rcS文件:
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
echo “—————mount all————–“
mount -a
echo “—————Start mdev————-“
echo /sbin/mdev>/proc/sys/kernel/hotplug
mdev -s
echo “**************************************”
echo “Kernel version:linux-2.6.24”
echo “YC2440 rootfs”
echo “Designer:zechin.liao”
echo “Date:2010.12.22”
echo “**************************************”
/bin/hostname -F /etc/sysconfig/HOSTNAME
# chmod +x etc/init.d/rcS
4.5
#device
proc
none
sysfs
mdev
4.6
#Ash profile
#vim:syntax=sh
#No core file by defaults
#ulimit -S -c 0>/dev/null>&1
export LD_LIBRARY_PATH=/lib:/usr/lib
PATH=$PATH
USER=”id -un”
LOGNAME=$USER
PS1=[/u@/h /W]#
HOSTNAME=/bin/hostname
export USER LOGNAME PS1 PATH
暂时运用nfs挂载根文件,后边将介绍制造yaffs、jffs文件。