Hi, that answers my question. 
Thank you very much!
Chan Kim

> -----Original Message-----
> From: Peter Maydell <[email protected]>
> Sent: Saturday, January 16, 2021 9:55 PM
> To: Chan Kim <[email protected]>
> Cc: qemu-discuss <[email protected]>
> Subject: Re: When qemu starts kernel image (given by -kernel option), deos
> it initialize CPU registers like firmwares and bootloaders do before
> kernel loading?
> 
> On Sat, 16 Jan 2021 at 06:18, <[email protected]> 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