使用busybox1.21.1制作根文件系统

1. 下载源码

  https://busybox.net/downloads/

2. 解压

3. 修改Makefile

  ~/busybox-1.21.1$ vi Makefile

  164行:

  修改前:CROSS_COMPILE ?=
  修改后:CROSS_COMPILE ?= arm-linux-gnueabihf-

  190行:

  修改前:ARCH ?= $(SUBARCH)
  修改后:ARCH ?= arm

4. 配置

  ~/busybox-1.21.1$ make menuconfig

  Busybox Settings  --->

    Build Options  --->

      [*] Build BusyBox as a static binary (no shared libs)

5. 编译

  ~/busybox-1.21.1$ make

  ~/busybox-1.21.1$ mkdir install_dir

  ~/busybox-1.21.1$ make CONFIG_PREFIX=./install_dir install

  

6. 编写脚本,生成根文件系统目录

  ~$ vi create_rootfs.sh

  ~$ chmod +x create_rootfs.sh

  ~$ sudo ./create_rootfs.sh

  可以看到在当前目录下生成了rootfs文件夹和子文件夹。

7. 拷贝busybox编译生成的文件到rootfs文件夹下

  ~$ sudo cp -r busybox-1.21.1/install_dir/* rootfs/

8. 创建etc下的文件

  (1)inittab

  (2)init.d/rcS

  (3)fstab

  (4)profile

  (5)拷贝主机的passwd shadow group到/etc目录下

 

posted @ 2016-06-14 18:34  emlslxl  阅读(616)  评论(0编辑  收藏  举报