Chinaunix首页 | 论坛 | 博客
  • 博客访问: 336108
  • 博文数量: 92
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 960
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-21 19:38
文章分类

全部博文(92)

文章存档

2010年(71)

2009年(21)

我的朋友

分类: 嵌入式

2009-09-22 16:44:20

I use busybox-1.13.0.tar to build my own root file system 

cd busybox
(1)Add a cross-tool chain
export PATH=$PATH:/home/linux/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin

make defconfig
make menuconfig
#Configuration:we have based on the default configuration, and then configure it as a static compiler. Do not install / usr path,to get rid of the "#" under the taskset Miscellaneous Utilities, or being wrong, as following:

Busybox setting
                ->builds options
                        ->
build busybox as a static binary
                ->installitation options
                        ->
don’t use /usr
Miscellaneous Utilities ―>
                ] taskset
saving and quit. 

(2)Compiling and install
make ARCH=arm CROSS_COMPILE=arm-softfloat-linux-gnu-

ARCH:Specify the platform
CROSS_COMPILE:Specify the compile tool

#Remove the installation linuxrc
cd /opt/armlinux/rootfs
rm linuxrc

 

(3#make

    #make install

After make install, a new directory: _install will be built under the busybox installing directory, in which you can find busybox executable file(/bin) and the link point.

# ls bin
        deallocvt   hexdump   mkdir          resize       tftpd
[[        delgroup    hostid    mkfifo         rm           time
addgroup  deluser     hostname  mknod          rmdir        top
adduser   df          hush      mktemp         rtcwake      touch
ar        diff        id        more           run-parts    tr
arping    dirname     install   mount          runsv        traceroute
ash       dmesg       ip        mountpoint     runsvdir     true
awk       dos2unix    ipaddr    msh            rx           tty
basename  du          ipcalc    mt             script       ttysize
bunzip2   dumpkmap    ipcrm     mv             sed          udpsvd
busybox   dumpleases  ipcs      nc             seq          umount
bzcat     echo        iplink    netstat        setarch      uname
bzip2     ed          iproute   nice           setkeycodes  uncompress
cal       egrep       iprule    nmeter         setsid       unexpand
cat       eject       iptunnel  nohup          setuidgid    uniq
catv      env         kbd_mode  nslookup       sh           unix2dos
chat      envdir      kill      od             sha1sum      unlzma
chattr    envuidgid   killall   openvt         showkey      unzip
chgrp     ether-wake  killall5  passwd         sleep        uptime
chmod     expand      last      patch          softlimit    usleep
chown     expr        length    pgrep          sort         uudecode
chpst     false       less      pidof          split        uuencode
chrt      fdflush     linux32   ping           stat         vi
chvt      fdformat    linux64   ping6          strings      vlock
cksum     fgrep       ln        pipe_progress  stty         watch
clear     find        logger    pkill          su           wc
cmp       fold        login     printenv       sum          wget
comm      free        logname   printf         sv           which
cp        ftpget      lpq       ps             sync         who
cpio      ftpput      lpr       pscan          tac          whoami
crontab   fuser       ls        pwd            tail         xargs
cryptpw   getopt      lsattr    readahead      tar          yes
cttyhack  grep        lzmacat   readlink       tcpsvd       zcat
cut       gunzip      makemime  realpath       tee

(4) Improve the directory generated under the directory  /busybox-1.13.0/_install

  #mkdir dev etc lib mnt proc var tmp sys root

 etc is for adding init file

 Entering the etc directory and establish inittab file, the content as following : 

 #this is run first except when booting in sigle-user mode.

 ::sysinit: /etc/init.d/reS

 #/bin/sh invocations on selected ttys

 #Start an "askfirst" shell on the console(whatever that may be)

 ::askfirst: /bin/sh

 #Stuff to do when restarting the init process

 ::ctrlaltdel:/sbin/reboot

 #Stuff to do before rebooting

 ::shutdown:/bin/umount -a -r

 

 Entering etc directory,and establish init.d directory, enter init.d directory and creat rcs file, the content as following

  #!/bin/sh

 #This is the first script called by init process

 /bin/mount -a

 mkdir /dev/pts

 mount -t dev/pts dev/pts dev/pts

 echo /sbin/mdev > /proc/sys/kernel/hotplug

 mdev -s

saving and quit

#chmod 777 rcS    

Entering etc directory, and creat fstab file, the cotent as following:

#device    mount-point    type   options   dump   fsck order

proc       /proc          proc   defaults      0

tmpfs      /tmp           tmpfs  defaults      0

sysfs      /sys           sysfs  defaults      0

tmpfs      /dev           tmpfs  defaults      0

 

Adding two nod under /dev

#mknod console c 5 1

#mknod null c 1 3

 

 

(5)Establishing the embedded system lib

在 /home/linux/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu/lib 下

 #vim cp.sh

the content as following:

#! /bin/bash
#cp.sh

for file in libc libcrypt libdl libm libpthread libresolv libutil
do
cp $file-*.so /opt/armlinux/busybox-1.13.0/_install/lib

cp -d $file.so.[*0-9] /opt/armlinux/busybox-1.13.0/_install/lib

done
cp -d ld*.so* /opt/armlinux/busybox-1.13.0/_install/lib

 

Reducing the size of lib

# arm-softfloat-linux-gnu-strip *.so


阅读(1399) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~