Skip to contentSkip to conversation

How linux kernel is directly loaded?

Qemu-devel Thakur 3 participants 4 messages Feb 1, 2009

lore
Share & tools
lore

Thakur

author
#0 lore raw

Hi,

I was searching for code in qemu which is directly able to load linux kernel with -k option. Which file implements it? Can someone point me to location where this load process is described? My objective is to load the Minix kernel in same fashion.

Thanks

Best Regards
- Thakur

#1 lore raw
Quoted 6 lines · Thakur

Hi,

I was searching for code in qemu which is directly able to load linux kernel with -k option. Which file implements it? Can someone point me to location where this load process is described? My objective is to load the Minix kernel in same fashion.

For PC architecture, it's done in hw/pc.c. There are ELF, a.out and binary load functions available, if you need them for Minix.

author
#2 lore raw
Quoted 12 lines · Blue Swirl
Quoted 6 lines · Thakur

Hi,

I was searching for code in qemu which is directly able to load linux kernel with -k option. Which file implements it? Can someone point me to location where this load process is described? My objective is to load the Minix kernel in same fashion.

For PC architecture, it's done in hw/pc.c. There are ELF, a.out and binary load functions available, if you need them for Minix.

I don't have much knowledge of internals of qemu. I know how u-boot loads the linux kernel, so I was searching for similar pattern. :) How does qemu know the entry point of the kernel?

Thanks

Regards
- Himanshu

#3 lore raw
In reply to Thakur
Quoted 7 lines · Thakur

Hi,

I was searching for code in qemu which is directly able to load linux kernel with -k option. Which file implements it? Can someone point me to location where this load process is described? My objective is to load the Minix kernel in same fashion.

It's different for every architecture but since you're interested in Minix, I assume you're interested in x86.

The important bits are in hw/pc.c:load_linux().

Currently, the way this is implemented is by loading the kernel into memory and creating a tiny option rom that hijacks int19. int19 is the BIOS boot interrupt so this allows us to run our own tiny boot loader that loads the kernel that we previously loaded into memory.

Depending on how different the Minix boot protocol is, it should be relatively easy to adapt.

Regards,

Anthony Liguori

Quoted 8 lines

Thanks

Best Regards
- Thakur