│ ┌↑(-)─────────────────────────────────────────────────────────────────┐ │ │ │[ ] Support NSA Security Enhanced Linux(NEW) │ │ │ │[ ] Clean up all memory before exiting(usually not needed)(NEW) │ │ │ │[*] Support LOG_INFO level syslog messages(NEW) │ │ │ │--- Build Options │ │ │ │[ ] Build staticbinary(no shared libs)(NEW)// target │ │ │ │[ ] Build position independent executable(NEW) │ │ │ │[ ] Force NOMMU build(NEW) │ │ │ │[ ] Build shared libbusybox(NEW) │ │ │ │() Cross compiler prefix(NEW) │ │ │ │() Path to sysroot(NEW)
在“Build static binary”处按“Y”选中(采用静态编译,为了不添加动态链接库)
直接退出,退出时保存,接下来就是busybox编译了:
1 2
➜ make -j4 ➜ make install
这个“_install”就是编译好的文件了,输入以下指令:(复制 rootfs )
1
➜ cp rootfs -r ..
在 _install 目录下创建以下文件夹
1 2 3 4
➜ mkdir proc mkdir sys touch init chmod +x init
init 为 linux 的初始化脚本,内容为:
1 2 3 4 5 6 7 8
#!/bin/sh mkdir /tmp mount -t proc none /proc mount -t sysfs none /sys mount -t debugfs none /sys/kernel/debug mount -t tmpfs none /tmp mdev -s # We need this to find /dev/sda later setsid /bin/cttyhack setuidgid 1000 /bin/sh