參看之前的文字,下載下傳了1.9.2版本和1.16.0版本,1.9.2使用gcc-3.4.1到時候,出現錯誤,檢視資料,說這個版本使用3.3.2沒問題。但是我想使用3.4.1是以下載下傳了較新到1.16.0 下載下傳: http://www.busybox.net/
修改 Makefile 修改ARCH和CROSS_COMPILE為如下
#gedit Makefile
#自己的交叉編譯器
CROSS_COMPILE = arm- linux-
#arm結構
ARCH = arm
配置busybox #make menuconfig
此時出現錯誤:In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:31:20: error: curses.h: 沒有那個檔案或目錄
In file included from scripts/kconfig/lxdialog/checklist.c:24:
解決辦法:ubuntu系統中缺少一個套件 ncurses devel ,把此套件安裝下即可
$ sudo apt-get install libncurses5-dev
下面隻列出虛注意的,未列出的為預設
Busybox Settings - - - >
General Configuration - - - >
Buffer allocation policy ( Allocate with Malloc) - - - >
[ * ] Show verbose applet usage messages
[ * ] Store applet usage messages in compressed form
[ * ] Support - - install [ - s] to install applet links at runtime
[ * ] Enable locale support ( system needs locale for this to work)
[ * ] Support for - - long- options
[ * ] Use the devpts filesystem for Unix98 PTYs
[ * ] Support writing pidfiles
[ * ] Runtime SUID/ SGID configuration via / etc/ busybox. conf
[ * ] Suppress warning message if / etc/ busybox. conf is not readable
( / proc/ self/ exe) Path to BusyBox executable
Build Options - - - >
[ * ] Build BusyBox as a static binary ( no shared libs)
[ * ] Build with Large File Support ( for accessing files > 2 GB)
Installation Options - - - >
[ ] Don
make的時候出現錯誤
coreutils/fsync.c: In function `fsync_main':
coreutils/fsync.c:27: error: `O_NOATIME' undeclared (first use in this function)
coreutils/fsync.c:27: error: (Each undeclared identifier is reported only once
coreutils/fsync.c:27: error: for each function it appears in.)
make[1]: *** [coreutils/fsync.o] 錯誤 1
make: *** [coreutils] 錯誤 2
經過查質料,把配置裡面的Coreutils裡的fsync不選中,重新編譯,就解決了,如下
Coreutils - - - >
[ ] fsync
繼續make,模阿是錯誤還很多:
miscutils/ionice.c: In function `ioprio_set':
miscutils/ionice.c:16: error: `SYS_ioprio_set' undeclared (first use in this function)
miscutils/ionice.c:16: error: (Each undeclared identifier is reported only once
miscutils/ionice.c:16: error: for each function it appears in.)
miscutils/ionice.c: In function `ioprio_get':
miscutils/ionice.c:21: error: `SYS_ioprio_get' undeclared (first use in this function)
make[1]: *** [miscutils/ionice.o] 錯誤 1
make: *** [miscutils] 錯誤 2
搞不懂這個是什麼,不過還是取消掉選項先:
Miscellaneous Utilities --->
[ ] ionice
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] 錯誤 1
make: *** [networking] 錯誤 2
networking/interface.c中添加
#define ARPHRD_INFINIBAND 32
In file included from util-linux/mkfs_vfat.c:13:
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:342: error: variable or field `__user' declared void
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:342: error: parse error before '*' token
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:360: error: parse error before '}' token
make[1]: *** [util-linux/mkfs_vfat.o] 錯誤 1
make: *** [util-linux] 錯誤 2
修改/usr/local/arm/3.4.1/arm-linux/sys-include/linux
中fd.h
添加#include <linux/compiler.h>
ok,如果有問題,在google。然後make install
--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------
順利的話,你會在busybox-1.16.0檔案夾下發現一個新的檔案夾 _install ,他就是你需要的該檔案系統,恭喜你,根檔案系統編譯成功了。
開始建構檔案系統 建立一個目錄myroot-2.6.12.0,把busybox- 1. 16. 0/_install/目錄下生成:bin、linuxrc、sbin、usr複制過來,并且在該目錄下建立檔案系統所需 要的其他目錄
#mkdir root- 2. 6. 33. 4
#cp - rf busybox- 1. 16. 0/ _install/ * root- 2. 6. 33. 4/
#cd root- 2. 6. 33. 4/
#mkdir dev etc home lib mnt opt proc tmp var www
向各目錄中添加檔案系統所需要的目錄或檔案,沒有提到的就不用添加。這裡要注意各種檔案的權限,建議都改為777,指令:#chmod 777 檔案名
"dev"目錄 ,建立兩個裝置檔案:
#mknod console c 5 1
#mknod null c 1 3
"etc"目錄 ,建立各種配置檔案并向裡面添加内容,沒有列出的就不用添加:
boa/boa.conf: boa WEB伺服器配置檔案,暫時為空。
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: plg
501: x: 501: fa
inittab: 系統init程序配置檔案,内容如下:
# /etc/inittab
::sysinit:/etc/init.d/rcS
console::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
mime.types: 暫時為空。
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::502:502:Linux User,,,:/home/mry:/bin/sh
rc.d/init.d/httpd: 内容如下:
#!/bin/sh
base= boa
# See how we were called.
case "$1" in
start)
/usr/sbin/$base
;;
stop)
pid= ` / bin/pidof $base`
if [ -n "$pid" ]; then
kill -9 $pid
fi
;;
esac
exit 0
sysconfig/HOSTNAME: 主機名稱檔案,内容如下:
MY2440
fstab: 系統挂載檔案系統清單,内容如下:
# device mount-point type options dump fsck order
none /proc proc defaults 0 0
none /dev/pts devpts mode= 0622 0 0
tmpfs /dev/shm tmpfs defaults 0 0
init.d/rcS: 系統啟動附加元件,内容如下:
#!/bin/sh
PATH= / sbin:/bin:/usr/sbin:/usr/bin
runlevel= S
prevlevel= N
umask 022
export PATH runlevel prevlevel
#
# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
/bin/mount -t proc none /proc
/bin/mount -t tmpfs none /tmp
/bin/mount -t tmpfs none /var
/bin/mkdir -p /var/log
/bin/hostname -F /etc/sysconfig/HOSTNAME
mdev.conf: mdev裝置配置檔案,暫時為空。
net.conf: 網絡配置檔案,暫時為空。
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= ' [ / [email protected]/h /W]/# '
PATH= $ PATH:/usr/local/bin
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH : / usr/local/lib
HOSTNAME= ` / bin/hostname`
export USER LOGNAME PS1 PATH LD_LIBRARY_PATH
resolv.conf: DNS配置檔案,内容如下:
nameserver 61.144.56.100
"home"目錄 :建立一個mry 目錄,與etc目錄passwd檔案中的mry 相對應
"lib"目錄 :這個裡面放的都是庫檔案,直接從交叉編譯器的庫檔案目錄中拷貝過來(也可以不拷貝):
#cp -f /usr/local/arm/arm-linux3.4.1/gcc-3.4.1-glibc-2.3.3/arm-linux/lib /*so* lib/ -a
使用yaffs制作工具編譯建構好的檔案系統。先解壓mkyaffs2image.tgz(可以在他們的網站上下載下傳),會自動解壓 到開發主機的/usr/sbin/目錄下。編譯後生成的檔案系統鏡像root-2.6.33.4.bin 也 在這個目錄下
#tar -zxvf mkyaffs2image.tgz
#mkyaffs2image root-2.6.33.4/ root-2.6.33.4.bin
下載下傳檔案系統鏡像到開發闆上測試,使用情況如下:
以上配置是參看網絡資訊,本人還沒有驗證,今天元旦最後一天,還是出去走走,回來在對檔案到配置作說明,制作。