lucas@ubuntu:~/Desktop/lab3$ sudo apt install axel lucas@ubuntu:~/Desktop/lab3$ axel -n 20 https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.4.34.tar.xz
lucas@ubuntu:~/Desktop/lab3$ xz -d linux-5.4.34.tar.xz lucas@ubuntu:~/Desktop/lab3$ tar -xvf linux-5.4.34.tar lucas@ubuntu:~/Desktop/lab3$ cd linux-5.4.34/
3. 配置内核选项
1 2
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ make defconfig lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ make menuconfig
4. 编译和运行
1 2
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ make -j$(nproc) lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ qemu-system-x86_64 -kernel arch/x86/boot/bzImage
5. 制作根文件系统
使用busybox
1 2 3 4 5
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ axel -n 20 https://busybox.net/downloads/busybox-1.31.1.tar.bz2 lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ tar -jxvf busybox-1.31.1.tar.bz2 lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ cd busybox-1.31.1
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/busybox-1.31.1$ make menuconfig
配置静态编译
1
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/busybox-1.31.1$ make -j$(nproc) && make install
制作内存根文件镜像
1 2 3 4 5 6
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/busybox-1.31.1$ cd ../../linux-5.4.34/ lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ mkdir rootfs lucas@ubuntu:~/Desktop/lab3/linux-5.4.34$ cd rootfs lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/rootfs$ cp ../busybox-1.31.1/_install/* ./ -rf lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/rootfs$ mkdir dev proc sys home lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/rootfs$ sudo cp -a /dev/{null,console,tty,tty1,tty2,tty3,tty4} dev/
制作init文件
1 2 3
lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/rootfs$ touch init lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/rootfs$ sudo apt install vim lucas@ubuntu:~/Desktop/lab3/linux-5.4.34/rootfs$ vim init