ubuntu10.04 使用busybox制作根文件系统 1
2011-01-03 11:30
393 查看
参看之前的文字,下载了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 /* InfiniBand */
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=
'
[
/
u@/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
下载文件系统镜像到开发板上测试,使用情况如下:
以上配置是参看网络信息,本人还没有验证,今天元旦最后一天,还是出去走走,回来在对文件到配置作说明,制作。
修改 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 /* InfiniBand */
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=
'
[
/
u@/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
下载文件系统镜像到开发板上测试,使用情况如下:
以上配置是参看网络信息,本人还没有验证,今天元旦最后一天,还是出去走走,回来在对文件到配置作说明,制作。
相关文章推荐
- 使用Busybox制作CRAMFS文件系统成功
- 使用Busybox1.13.3制作 yaffs2根文件系统
- 使用BusyBox制作根文件系统的操作步骤
- 使用busybox-1.16.1,mkfs.jffs2制作jffs2文件系统
- 使用BusyBox制作Linux根文件系统
- 基于busybox制作mini2440根文件系统及使用nfs挂载
- 使用Busybox1.13.3制作yaffs2根文件系统
- 使用Busybox制作CRAMFS文件系统成功
- 使用Busybox制作根文件系统
- 使用Busybox-1.2.0制作根文件系统 .
- 使用BusyBox制作根文件系统【转】
- 使用busybox制作根文件系统(rootfs)
- linux-2.6.24.4内核移植到s3c2440----使用busybox-1.9.2制作根文件系统
- 使用BusyBox制作根文件系统 .
- 使用BusyBox制作Linux根文件系统
- 使用BusyBox制作Linux根文件系统
- 使用busybox-1.15.2制作jffs2文件系统
- 使用busybox制作linux根文件系统
- ubuntu10.04上ubifs文件系统的制作与移植过程
- 使用Busybox制作根文件系统