FL2440

来源:互联网 发布:c语言whilet--的用法 编辑:程序博客网 时间:2024/05/21 05:08
Linux系统在执行一条命令时,默认会到/bin、/sbin、/usr/bin、/usr/sbin这些路径下找,如果找不到则提示command not found,当然我们也可以
通过PATH环境变量告诉系统其它命令存放的路径。现在根文件系统树下这些路径里并没有Linux系统相关命令。
 
[shun@localhost ~]$ cd ~/fl2440/
[shun@localhost fl2440]$ ls
3rdparty  bootloader  crosstool  driver  images  linux  program
[shun@localhost fl2440]$ cd 3rdparty/ 
[shun@localhost 3rdparty]$wgethttps://busybox.net/downloads/busybox-1.27.1.tar.bz2
[shun@localhost 3rdparty]$tar -xjf busybox-1.27.1.tar.bz2
[shun@localhost 3rdparty]$cd busybox-1.27.1
[shun@localhost busybox-1.27.1]$ ls
applets                 coreutils    loginutils              README
applets_sh              debianutils  mailutils               runit
arch                    docs         Makefile                scripts
archival                e2fsprogs    Makefile.custom         selinux
AUTHORS                 editors      Makefile.flags          shell
busybox                 examples     Makefile.help           sysklogd
busybox.links           findutils    make_single_applets.sh  testsuite
busybox_unstripped      include      miscutils               TODO
busybox_unstripped.map  init         modutils                TODO_unicode
busybox_unstripped.out  INSTALL      networking              util-linux
Config.in               libbb        printutils
configs                 libpwdgrp    procps
console-tools           LICENSE      qemu_multiarch_testing
[shun@localhost busybox-1.27.1]$make menuconfig         #然后进行相应的设置

编译并安装busybox:
[shun@localhost busybox-1.27.1]$make &&  make install

切换到根文件系统树路径下,创建符号链接指向busybox程序:
[shun@localhost busybox-1.27.1]$ cd ../../linux/rootfs/
[shun@localhost rootfs]$ ls
apps  bin  data  dev  etc  info  lib  linuxrc  mnt  proc  root  sbin  sys  tmp  usr  var
[shun@localhost rootfs]$ ln -s bin/b
base64   busybox  
[shun@localhost rootfs]$ ln -s bin/busybox init
[shun@localhost rootfs]$ ls
apps  bin  data  dev  etc  info  init  lib  linuxrc  mnt  proc  root  sbin  sys  tmp  usr  var

列出根文件系统目录树下的Linux命令,这些命令其实都是符号链接到busybox:
[shun@localhost busybox-1.27.1]$ ls ../../linux/rootfs/bin/
ash      cttyhack       fatattr   iostat    lzop        nice           rpm           su
base64   date           fdflush   ipcalc    mkdir       pidof          run-parts     sync
busybox  dd             fgrep     kbd_mode  mknod       ping           scriptreplay  tar
cat      df             fsync     kill      mktemp      ping6          sed           touch
chattr   dmesg          getopt    link      more        pipe_progress  setarch       true
chgrp    dnsdomainname  grep      linux32   mount       printenv       setpriv       umount
chmod    dumpkmap       gunzip    linux64   mountpoint  ps             setserial     uname
chown    echo           gzip      ln        mpstat      pwd            sh            usleep
conspy   ed             hostname  login     mt          rev            sleep         vi
cp       egrep          hush      ls        mv          rm             stat          watch
cpio     false          ionice    lsattr    netstat     rmdir          stty          zcat
[shun@localhost busybox-1.27.1]$

创建/dev路径下的设备节点

  Linux下所有的东西都是文件,其中设备也是当作文件来处理。/dev路径下存放所有的Linux的设备文件,我们需要使用root权限执行mknod命令在这
里创建系统启动必须的设备文件节点,其他的设备节点将有mdev动态创建。

[shun@localhost ~]$ cd fl2440/linux/rootfs/
[shun@localhost rootfs]$ ls
apps  bin  data  dev  etc  info  init  lib  linuxrc  mnt  proc  root  sbin  sys  tmp  usr  var
[shun@localhost rootfs]$ sudo mknod -m666 dev/null c 1 3
[shun@localhost rootfs]$ sudo mknod -m666 dev/console c 5 1
[shun@localhost rootfs]$ sudo mknod -m666 dev/ttyS0 c 4 64
[shun@localhost rootfs]$ ls -l dev/
total 0
crw-rw-rw-. 1 root root 5,  1 Nov  6 21:03 console
crw-rw-rw-. 1 root root 1,  3 Nov  6 21:03 null
crw-rw-rw-. 1 root root 4, 64 Nov  6 21:04 ttyS0
[shun@localhost rootfs]$
[shun@localhost rootfs]$

创建/var路径下的文件

[shun@localhost rootfs]$ ln -s /tmp var/log
[shun@localhost rootfs]$ ln -s /tmp var/run
[shun@localhost rootfs]$ ln -s /tmp var/tmp
[shun@localhost rootfs]$ ls -l var/
total 0
lrwxrwxrwx. 1 shun shun 4 Nov  6 21:08 lock -> /tmp
lrwxrwxrwx. 1 shun shun 4 Nov  6 21:08 log -> /tmp
lrwxrwxrwx. 1 shun shun 4 Nov  6 21:08 run -> /tmp
lrwxrwxrwx. 1 shun shun 4 Nov  6 21:09 tmp -> /tmp
[shun@localhost rootfs]$
原创粉丝点击