ARM根文件系統(tǒng)制作
Busybox源碼:http://www.busybox.net/downloads/
本文引用地址:http://m.butianyuan.cn/article/201611/319536.htm# 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的內(nèi)容
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
這兩個設(shè)備節(jié)點需要root用戶建立,具體原因有待研究
4.
4.1 etc/mdev.conf文件,內(nèi)容可有可無。
4.2 passwd、group、shadow文件,手動、自動創(chuàng)建
手動創(chuàng)建是根據(jù)規(guī)范手動編寫這三個文件內(nèi)容
# 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
自動創(chuàng)建是使用busybox提供的adduser和passwd
在文件系統(tǒng)正常運行起來后,使用adduser命令,使用方法為:
#adduser root
然后就會在etc目錄下自動生成passwd
passwd:unknown uid 0
這表示不能為該用戶設(shè)置密碼,此時你會發(fā)現(xiàn)要passwd命令也無法使用。解決的辦法是,打開passwd文件,其內(nèi)容為:
root:x:1000:1000:Linux User…:/home/root:/bin/sh
將用戶ID和組ID均更改為0
打開group文件,其內(nèi)容為:
root:x:1000:
同樣將組ID改為0
然后,passwd命令就可以正常使用了。這時為root用戶設(shè)置口令:
#passwd root
根據(jù)提示輸入密碼。其中,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文件。
評論