1.环境准备
- buildroot
- qemu
- 官网:QEMU
- 源码链接:QEMU / QEMU · GitLab
- 下载地址:Index of /
- ubuntu18.04
2.实战
1.buildroot编译
解压:
tar -xvf buildroot-2022.02.2.tar.gz
配置:
cd buildroot-2022.02.2
make qemu_aarch64_virt_defconfig
编译:
make
编译结果:
buildroot-2022.02.2/output/images
2.qemu编译
下载:
tar -jxvf qemu-4.1.1.tar.bz2
cd qemu-4.1.1
修改配置:
vim default-configs/aarch64-softmmu.mak
CONFIG_EDU=y
编译:
./configure --prefix=$PWD/ --target-list=aarch64-softmmu --enable-debug --enable-sdl --enable-kvm --enable-tools --disable-curl --disable-libssh
make
make install
提取文件
cd ..
mkdir -p release/qemu-arm64
cp qemu-4.1.1/bin qemu-4.1.1/ qemu-4.1.1/libexec qemu-4.1.1/share release/qemu-arm64 -ra
3.kernel rootfs安装
cp ../../../buildroot-2022.02.2/output/images/* bin/ -ra
touch qemu/release/qemu-arm64/bin/test_qemu.sh
vim qemu/release/qemu-arm64/bin/test_qemu.sh
chmod +x qemu/release/qemu-arm64/bin/test_qemu.sh
./qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel Image -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -nographic -device edu
./qemu/release/qemu-arm64/bin/test_qemu.sh
输入root登录
其实启动过程有些PCIE的信息打印出来
使用lspci得到pci的设备
关于这个pci的设备信息在qemu的docs/specs/edu.txt位置