qemu-discuss
[Top][All Lists]
Advanced

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

Re: When qemu starts kernel image (given by -kernel option), deos it ini


From: Peter Maydell
Subject: Re: When qemu starts kernel image (given by -kernel option), deos it initialize CPU registers like firmwares and bootloaders do before kernel loading?
Date: Sat, 16 Jan 2021 12:54:40 +0000

On Sat, 16 Jan 2021 at 06:18, <ckim@etri.re.kr> wrote:
> My question is the same as the email subject.
>
> When qemu starts kernel image (given by -kernel option), deos it initialize 
> CPU registers like firmwares and bootloaders do before kernel loading?

The behaviour of -kernel depends on the target CPU type,
the machine type, and also on what kind of file you pass
to it. So it's not possible to say much in general.
In some cases it will do CPU register setup, in some cases not.

The most common behaviour is "do whatever this target
CPU type and board needs to do to boot a Linux kernel",
which tends to involve setting at least some CPU registers.
For instance for 32-bit Arm kernels (in uImage, zImage
or plain Image format) we do what is required
by the booting documentation:
https://www.kernel.org/doc/Documentation/arm/Booting
But different architectures do different things in the details.

Some uses of -kernel don't do "set up to boot a kernel", eg
if you pass an ELF file to an Arm target QEMU -kernel option
it just loads the ELF file and does nothing else to set up
the CPU.

Some uses of -kernel do much more complicated things, eg
for x86 PC machines QEMU will boot the BIOS in the guest
and then make the kernel file available to the BIOS for
it to do whatever it likes (which usually is "boot it").

thanks
-- PMM



reply via email to

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