qemu 编译 qemu-system-arm 和 qemu-system-aarch64

  • qemu-6.1.0
./configure --target-list=arm-softmmu,aarch64-softmmu --prefix=/home/pop/work/qemu/qemu-out2   2>&1 | tee log_configure2.txt
make 2>&1 | tee log_build2.txt
make install 2>&1 | tee log_install2.txt
qemu-system-arm virt 更改Image加载地址
  • 编译原因
https://patchwork.ozlabs.org/project/qemu-devel/patch/1395718484-20424-1-git-send-email-joelf@ti.com/
我对arm 加载地址有要求

hw/arm/boot.c
  * They have different preferred image load offsets from system RAM base.
  */
 #define KERNEL_ARGS_ADDR 0x100
-#define KERNEL_LOAD_ADDR 0x00010000
+#define KERNEL_LOAD_ADDR 0x00208000
 #define KERNEL64_LOAD_ADDR 0x00080000
 
 typedef enum {

qemu-system-aarch64 virt 更改Image加载地址
hw/arm/boot.c
	load_aarch64_image
if (kernel_load_offset < BOOTLOADER_MAX_SIZE) {
	kernel_load_offset += 2 * MiB; // 0x200000 可以改为 0x400000
}
  • 更改为 0x000000
qemu-system-aarch64: Some ROM regions are overlapping
These ROM regions might have been loaded by direct user request or by default.
They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.

The following two regions overlap (in the cpu-memory-0 address space):
  arch/arm64/boot/Image (addresses 0x0000000040000000 - 0x0000000042124200)
  bootloader (addresses 0x0000000040000000 - 0x0000000040000028)
  • 更改为 0x400000
正常运行
qemu-system-aarch64 的 bootloader 是什么
  • 源数据
$ cat bootloader.txt 
0x40000000:     0x00c0  0x5800  0x03e1  0xaa1f  0x03e2  0xaa1f  0x03e3  0xaa1f
0x40000010:     0x0084  0x5800  0x0080  0xd61f  0x0000  0x4800  0x0000  0x0000
0x40000020:     0x0000  0x4040  0x0000  0x0000  0x0000  0x0000  0x0000  0x0000
  • recipe
$ bootloader2.txt
00000000: 00c0 5800 03e1 aa1f 03e2 aa1f 03e3 aa1f
00000010: 0084 5800 0080 d61f 0000 4800 0000 0000
00000020: 0000 4040 0000 0000 0000 0000 0000 0000
  • 生成bin文件
xxd -r bootloader2.txt bootloader.bin
  • 反汇编
$ aarch64-linux-gnu-objdump -D -b binary -m  aarch64 bootloader.bin  

bootloader.bin:     file format binary


Disassembly of section .data:

0000000000000000 <.data>:
   0:   0058c000        .inst   0x0058c000 ; undefined
   4:   1faae103        .inst   0x1faae103 ; undefined
   8:   1faae203        .inst   0x1faae203 ; undefined
   c:   1faae303        .inst   0x1faae303 ; undefined
  10:   00588400        .inst   0x00588400 ; undefined
  14:   1fd68000        fmsub   h0, h0, h22, h0
  18:   00480000        .inst   0x00480000 ; undefined
  1c:   00000000        .inst   0x00000000 ; undefined
  20:   40400000        .inst   0x40400000 ; undefined
        ...

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
qemu-system-aarch64是一个运行ARM64架构的虚拟机的命令行工具。当我们在运行这个命令时,如果没有指定虚拟机类型,也没有默认设置,就会出现 "qemu-system-aarch64: no machine specified, and there is no default" 的报错信息。 这个报错的原因是因为在运行qemu-system-aarch64命令时,我们需要指定要运行的虚拟机的类型。虚拟机类型是根据具体的应用或需求来选择的,例如rpi3表示树莓派3型号的虚拟机,virt表示通用的虚拟机类型等等。如果没有指定虚拟机类型,qemu无法确定具体要运行哪个虚拟机,因此会出现这个错误。 解决这个问题的方法是在运行qemu-system-aarch64命令时,使用"-machine"参数来指定要运行的虚拟机类型。例如,如果我们想运行rpi3类型的虚拟机,命令可以修改为: "qemu-system-aarch64 -machine rpi3"。同时,也可以通过"-M"参数来指定虚拟机类型,例如: "qemu-system-aarch64 -M rpi3"。 此外,这个报错信息也提示我们当前没有默认设置的虚拟机类型。要设置默认虚拟机类型,可以使用"-machine"或"-M"参数,加上要设置的虚拟机类型,例如: "qemu-system-aarch64 -machine virt"。这样,当我们运行qemu-system-aarch64命令时,就默认使用指定的虚拟机类型。 综上所述,qemu-system-aarch64: no machine specified, and there is no default报错信息是因为运行qemu-system-aarch64命令时没有指定虚拟机类型,并且也没有默认设置。需要使用"-machine"或"-M"参数来指定当前要运行的虚拟机类型。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值