前置

还记得 编译 u-boot && kernel && rootfs 的产物吗

image.png

对于 initrd 默认运行 /init 作为初始化程序, 通过 rdinit=<init_path> 指定初始化程序。

对于 rootfs 默认运行 /sbin/init 作为初始化程序, 通过 init=<init_path> 指定初始化程序。

运行 u-boot

这会默认进入 u-boot , 退出 qemu 使用 C-a + x

qemu-system-aarch64 -machine virt \\
 --nographic -m 2G \\
 -cpu cortex-a72 -smp 4 \\
 -bios u-boot.bin

使用如下命令可使用 gdb 调试, gdb端口是 1234

qemu-system-aarch64 -machine virt \\
 --nographic -m 2G \\
 -cpu cortex-a72 -smp 4 \\
 -bios u-boot.bin \\
 -s -S

运行 kernel

qemu-system-aarch64 -machine virt \\
 --nographic -m 2G \\
 -cpu cortex-a72 -smp 4 \\
 -bios u-boot.bin \\
 -kernel Image

运行系统