build_embed_linux_system

虚拟机和沙箱启动

虚拟机qemu模拟启动,讲解uboot,kernel和rootfs的启动加载过程

安装或者编译qemu环境

使用apt命令即可安装qemu环境。

#安装qemu
sudo apt-get install qemu-user-static

#用于arm平台的qemu工具
/usr/bin/qemu-system-arm

#用于aarch64平台的qemu工具
/usr/bin/qemu-system-aarch64

手动编译qemu

#下载qemu工具
wget https://download.qemu.org/qemu-8.2.2.tar.xz
tar -xvf qemu-8.2.2.tar.xz
cd qemu-8.2.2/

#环境检测,生成Makefile
./configure --prefix=$PWD/ --target-list="arm-softmmu arm-linux-user" --enable-debug --enable-sdl --enable-kvm --enable-tools --disable-curl --disable-coreaudio --disable-pa --disable-sdl --disable-sndio
make -j6

#build目录下的qemu-system-arm/qemu-system-aarch64即为生成的qemu虚拟机程序
build/qemu-system-arm

编译虚拟机内核

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- mx6ul_14x14_evk_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- -j6
./qemu-system-arm -M mcimx6ul-evk -m 512M -kernel ./u-boot -nographic -no-reboot

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- vexpress_ca9x4_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- -j6
./qemu-system-arm -M vexpress-a9 -m 512M -kernel ./u-boot -nographic -no-reboot

vexpress_ca9x4_defconfig
mx6ul_14x14_evk_defconfig

## 虚拟机命令

```shell
kernel_file="${SUPPORT_ENV_KERNEL_DIR}"/arch/arm/boot/zImage
dtb_file="${SUPPORT_ENV_KERNEL_DIR}"/arch/arm/boot/dts/imx6ull-qemu.dtb
rootfs_file="${PROGRAM_IMG}"/arm-ubuntu.img

#nogui
qemu-system-arm -M mcimx6ul-evk -m 512M -kernel "${kernel_file}" \
    -dtb "${dtb_file}"  \
    -nographic -serial mon:stdio \
    -drive file="${rootfs_file}",format=raw,id=mysdcard -device sd-card,drive=mysdcard \
    -append "console=ttymxc0,115200 rootfstype=ext4 root=/dev/mmcblk1 rw rootwait init=/sbin/init loglevel=8"

qemu问题整理 paaudio.c 默认加载,但是检测不到 scripts/meson-buildoptions.sh => 控制硬件的打开和关闭的编译选项 hw/arm/*.c 包含所有的开发板 hw/arm/boot.c 提供加载的接口

void info_vreport(const char *fmt, va_list ap), printf打印

加载顺序: qemu_init system/vl.c mcimx6ul_evk_init hw/arm/mcimx6ul-evk.c arm_load_kernel hw/arm/bootc

next_chapter

返回目录

直接开始下一章节说明: imx6ull平台启动说明