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

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

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目录下

 

相关文章:

  • 2022-12-23
  • 2021-12-20
  • 2021-11-26
  • 2022-01-04
  • 2021-11-12
  • 2021-11-17
猜你喜欢
  • 2021-12-06
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-04-05
相关资源
相似解决方案