qemu arm start u-boot from flash(1)

Qemu have an arm virt machine simulation.

We can use it to study u-boot and kernel.

Step1:get u-boot

git clone https://source.denx.de/u-boot/u-boot.git

Step2:modify u-boot env address

configs/qemu_arm_defconfig => CONFIG_ENV_ADDR=0x100000

Step3:compile u-boot.

make CROSS_COMPILE=arm-linux-gnueabi- qemu_arm_defconfig
make CROSS_COMPILE=arm-linux-gnueabi- -j10

Step4: prepare flash,64M

dd if=/dev/zero of=pflash.bin bs=256K count=256 conv=sync
dd if=u-boot.bin of=pflash.bin bs=256K count=256 conv=sync,notrunc

Step5: start qemu virt machine

qemu-system-arm -m 1024 -smp 2 -cpu cortex-a15 -M virt -nographic -drive if=pflash,file=pflash.bin,format=raw

use ctrl+a x to exit uboot console. Or ctrl+a c to switch to qemu monitor.

QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1) This version have issue in saveenv.

QEMU emulator version 9.0.1 This version is good.

posted on 2024-07-17 13:21  石头上长出青苔  阅读(11)  评论(0)    收藏  举报