操作平台: Ubuntu 16.04 64bit server
我们在Ubuntu下,通过qemu运行自制的Linux + busybox的amd64 Linux OS.
1,Linux内核
a,下载Linux kernel
下载地址: https://www.kernel.org/
我下载的是linux-5.12.13.
b,编译Linux kernel
配置config
make O=out_x86_64 x86_64_defconfig
make O=out_x86_64 menuconfig
配置menuconfig
General setup --->
----> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
Device Drivers --->
[*] Block devices --->
<*> RAM block device support
(65536) Default RAM disk size (kbytes)
编译
make O=out_x86_64 bzImage -j4
编译完成之后,会在源码目录生成linux-5.12.13/out_x86_64/arch/x86_64/boot/bzImage;
2,Busybox
a,下载Busybox
下载地址: https://busybox.net/downloads/
我下载的是busybox-1.33.1
b,配置busybox
make menuconfig
做如下配置:
Busybox Settings --->
Build Options --->
[*] Build BusyBox as a static binary (no shared libs)
c,编译&安装
#编译
make -j4
#安装,执行则会在busybox源码目录下生成_install文件夹
make install
3,制作文件系统
a,创建文件夹