qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

With "-kernel Image" method in arm64 virtual machine, where is the kerne


From: Chan Kim
Subject: With "-kernel Image" method in arm64 virtual machine, where is the kernel loaded, Ram or Rom?
Date: Mon, 14 Mar 2022 18:04:41 +0900

Hello all,

 

Using qemu, I was trying to compare A) the direct kernel loading (using -kernel Image option) with B) running from u-boot to load kernel Image and met with a problem.

When I load kernel directly using “-kernel Image” method for an arm64 virtual machine, it boots ok to the shell prompt.

In this situation, I examined where the kernel Image is loaded.

The qemu program (v.6.2.0) goes through this code in hw/arm/boot.c.

 

if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) && kernel_size < 0) {

         kernel_size = load_aarch64_image(info->kernel_filename,

                                          info->loader_start, &entry, as);

         is_linux = 1;

         if (kernel_size >= 0) {

             image_low_addr = entry;

             image_high_addr = image_low_addr + kernel_size;

         }

 

Inside load_aarch64_image function, I’ve checked, *entry becomes 0x80200000.

The Image file is loaded by this line there : rom_add_blob_fixed_as(filename, buffer, size, *entry, as);

The rom_add_blob_fixed_as is eventually ‘rom_add_blob’ function and there, the data is copied to a ‘struct Rom’ with the address set as 0x80200000 and this Rom is added to ‘roms’ (list of Rom).

 

After this, I tried to read the memory at 0x80200000 to see if this kernel Image is there but could not find it.

I used this method to see memory at 0x80200000 :

during the machab21q_init function,

Ram_ptr = memory_region_get_ram_ptr(machine->ram);  // to the virtual address of the memory in the host machine

In the (gdb), after kernel Image is loaded at 0x80200000.

(gdb) p ram_ptr

$6 = 0x7ffee2e00000

(gdb) p ram_ptr + 0x80200000

$7 = 0x7fff63000000

(gdb) x/16x $7

0x7fff63000000: 0x00000000  0x00000000  0x00000000  0x00000000

0x7fff63000010: 0x00000000  0x00000000  0x00000000  0x00000000

0x7fff63000020: 0x00000000  0x00000000  0x00000000  0x00000000

0x7fff63000030: 0x00000000  0x00000000  0x00000000  0x00000000

No data is there!

Is this because the kernel Image was loaded in one of the ‘Rom’ and not in the memory??

Can’t I really load the kernel Image at 0x80200000? (actually I want to load it at 0x80000000).

Thank you for reading and any help will be really appreciated.

 

Chan Kim

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]