* [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)?
@ 2024-02-27 14:41 Kunkun Jiang via
2024-02-27 15:28 ` Peter Maydell
0 siblings, 1 reply; 6+ messages in thread
From: Kunkun Jiang via @ 2024-02-27 14:41 UTC (permalink / raw)
To: open list:All patches CC here; +Cc: wanghaibin.wang@huawei.com, Zenghui Yu
[-- Attachment #1: Type: text/plain, Size: 479 bytes --]
Hi everybody,
I want to start qemu-system-aarch64 with a vmlinux,
which is an ELF format file. The arm_load_elf() is
implemented in arm_setup_direct_kernel_boot(). So I
thought it was supporting the ELF format file.
But there's no output.
Here is my command line:
> qemu-system-aarch64 -machine virt,gic-version=3 -enable-kvm -smp 4 -m
> 1G -cpu host -kernel vmlinux -initrd fs -append "xxx"
Am I using it the wrong way?
Looking forward to your reply.
Thanks,
Kunkun Jiang
[-- Attachment #2: Type: text/html, Size: 1554 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? 2024-02-27 14:41 [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? Kunkun Jiang via @ 2024-02-27 15:28 ` Peter Maydell 2024-02-29 3:01 ` Kunkun Jiang via 0 siblings, 1 reply; 6+ messages in thread From: Peter Maydell @ 2024-02-27 15:28 UTC (permalink / raw) To: Kunkun Jiang Cc: open list:All patches CC here, wanghaibin.wang@huawei.com, Zenghui Yu On Tue, 27 Feb 2024 at 14:42, Kunkun Jiang via <qemu-devel@nongnu.org> wrote: > > Hi everybody, > > I want to start qemu-system-aarch64 with a vmlinux, > which is an ELF format file. The arm_load_elf() is > implemented in arm_setup_direct_kernel_boot(). So I > thought it was supporting the ELF format file. No, you can't do this. The hw/arm/boot.c code assumes that ELF files are "bare metal" binaries, whereas uImage format, AArch64 Image format, and raw binary files are Linux kernels. Only the last three kinds of files will be started with the boot protocol the Linux kernel expects. For AArch64, pass the -kernel option the path to the Image file, not the vmlinux file. thanks -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? 2024-02-27 15:28 ` Peter Maydell @ 2024-02-29 3:01 ` Kunkun Jiang via 2024-02-29 9:44 ` Peter Maydell 0 siblings, 1 reply; 6+ messages in thread From: Kunkun Jiang via @ 2024-02-29 3:01 UTC (permalink / raw) To: Peter Maydell Cc: open list:All patches CC here, wanghaibin.wang@huawei.com, Zenghui Yu Hi Peter, On 2024/2/27 23:28, Peter Maydell wrote: > On Tue, 27 Feb 2024 at 14:42, Kunkun Jiang via <qemu-devel@nongnu.org> wrote: >> Hi everybody, >> >> I want to start qemu-system-aarch64 with a vmlinux, >> which is an ELF format file. The arm_load_elf() is >> implemented in arm_setup_direct_kernel_boot(). So I >> thought it was supporting the ELF format file. > No, you can't do this. The hw/arm/boot.c code assumes > that ELF files are "bare metal" binaries, whereas > uImage format, AArch64 Image format, and raw binary files > are Linux kernels. Only the last three kinds of files will > be started with the boot protocol the Linux kernel expects. > > For AArch64, pass the -kernel option the path to the Image > file, not the vmlinux file. Yes, it works fine using Image files. I would also like to ask again, is it because AArch64 does not support vmlinux, or is it because qemu does not implement this capability? Thanks, Kunkun Jiang ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? 2024-02-29 3:01 ` Kunkun Jiang via @ 2024-02-29 9:44 ` Peter Maydell 2024-03-05 10:35 ` Kunkun Jiang via 0 siblings, 1 reply; 6+ messages in thread From: Peter Maydell @ 2024-02-29 9:44 UTC (permalink / raw) To: Kunkun Jiang Cc: open list:All patches CC here, wanghaibin.wang@huawei.com, Zenghui Yu On Thu, 29 Feb 2024 at 03:01, Kunkun Jiang <jiangkunkun@huawei.com> wrote: > > Hi Peter, > > On 2024/2/27 23:28, Peter Maydell wrote: > > On Tue, 27 Feb 2024 at 14:42, Kunkun Jiang via <qemu-devel@nongnu.org> wrote: > >> Hi everybody, > >> > >> I want to start qemu-system-aarch64 with a vmlinux, > >> which is an ELF format file. The arm_load_elf() is > >> implemented in arm_setup_direct_kernel_boot(). So I > >> thought it was supporting the ELF format file. > > No, you can't do this. The hw/arm/boot.c code assumes > > that ELF files are "bare metal" binaries, whereas > > uImage format, AArch64 Image format, and raw binary files > > are Linux kernels. Only the last three kinds of files will > > be started with the boot protocol the Linux kernel expects. > > > > For AArch64, pass the -kernel option the path to the Image > > file, not the vmlinux file. > > Yes, it works fine using Image files. > I would also like to ask again, is it because AArch64 does not > support vmlinux, or is it because qemu does not implement > this capability? As I said, it is because QEMU assumes that ELF files are bare metal images, not Linux kernel images. -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? 2024-02-29 9:44 ` Peter Maydell @ 2024-03-05 10:35 ` Kunkun Jiang via 2024-03-05 10:56 ` Peter Maydell 0 siblings, 1 reply; 6+ messages in thread From: Kunkun Jiang via @ 2024-03-05 10:35 UTC (permalink / raw) To: Peter Maydell Cc: open list:All patches CC here, wanghaibin.wang@huawei.com, Zenghui Yu, sundongxu3 Hi Peter, On 2024/2/29 17:44, Peter Maydell wrote: > On Thu, 29 Feb 2024 at 03:01, Kunkun Jiang <jiangkunkun@huawei.com> wrote: >> Hi Peter, >> >> On 2024/2/27 23:28, Peter Maydell wrote: >>> On Tue, 27 Feb 2024 at 14:42, Kunkun Jiang via <qemu-devel@nongnu.org> wrote: >>>> Hi everybody, >>>> >>>> I want to start qemu-system-aarch64 with a vmlinux, >>>> which is an ELF format file. The arm_load_elf() is >>>> implemented in arm_setup_direct_kernel_boot(). So I >>>> thought it was supporting the ELF format file. >>> No, you can't do this. The hw/arm/boot.c code assumes >>> that ELF files are "bare metal" binaries, whereas >>> uImage format, AArch64 Image format, and raw binary files >>> are Linux kernels. Only the last three kinds of files will >>> be started with the boot protocol the Linux kernel expects. >>> >>> For AArch64, pass the -kernel option the path to the Image >>> file, not the vmlinux file. >> Yes, it works fine using Image files. >> I would also like to ask again, is it because AArch64 does not >> support vmlinux, or is it because qemu does not implement >> this capability? > As I said, it is because QEMU assumes that ELF files are > bare metal images, not Linux kernel images. Sorry to bother you again. I still have a few questions. 1. What does "bare metal images" mean? Are they used in tcg mode? 2. How QEMU assumes an ELF file is a bare metal image? Can you post the corresponding code? 3. How can I make the hw/arm/boot.c code assumes the ELF files are Linux kernels? Looking forward to your reply. Thanks, Kunkun Jiang ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? 2024-03-05 10:35 ` Kunkun Jiang via @ 2024-03-05 10:56 ` Peter Maydell 0 siblings, 0 replies; 6+ messages in thread From: Peter Maydell @ 2024-03-05 10:56 UTC (permalink / raw) To: Kunkun Jiang Cc: open list:All patches CC here, wanghaibin.wang@huawei.com, Zenghui Yu, sundongxu3 On Tue, 5 Mar 2024 at 10:36, Kunkun Jiang <jiangkunkun@huawei.com> wrote: > > Hi Peter, > > On 2024/2/29 17:44, Peter Maydell wrote: > > On Thu, 29 Feb 2024 at 03:01, Kunkun Jiang <jiangkunkun@huawei.com> wrote: > >> Hi Peter, > >> > >> On 2024/2/27 23:28, Peter Maydell wrote: > >>> On Tue, 27 Feb 2024 at 14:42, Kunkun Jiang via <qemu-devel@nongnu.org> wrote: > >>>> Hi everybody, > >>>> > >>>> I want to start qemu-system-aarch64 with a vmlinux, > >>>> which is an ELF format file. The arm_load_elf() is > >>>> implemented in arm_setup_direct_kernel_boot(). So I > >>>> thought it was supporting the ELF format file. > >>> No, you can't do this. The hw/arm/boot.c code assumes > >>> that ELF files are "bare metal" binaries, whereas > >>> uImage format, AArch64 Image format, and raw binary files > >>> are Linux kernels. Only the last three kinds of files will > >>> be started with the boot protocol the Linux kernel expects. > >>> > >>> For AArch64, pass the -kernel option the path to the Image > >>> file, not the vmlinux file. > >> Yes, it works fine using Image files. > >> I would also like to ask again, is it because AArch64 does not > >> support vmlinux, or is it because qemu does not implement > >> this capability? > > As I said, it is because QEMU assumes that ELF files are > > bare metal images, not Linux kernel images. > > Sorry to bother you again. I still have a few questions. > 1. What does "bare metal images" mean? Are they used in tcg mode? By "bare metal image" I mean here guest code that is expecting to run as if it were the only thing that ever ran on the system, so that it starts up with the CPU coming straight out of reset. That is, it doesn't assume that it's been started via some kind of BIOS or bootloader that sets up registers and configures the hardware the way Linux wants to be started. > 2. How QEMU assumes an ELF file is a bare metal image? Can you post > the corresponding code? It's in hw/arm/boot.c, in the function arm_setup_direct_kernel_boot(). > 3. How can I make the hw/arm/boot.c code assumes the ELF files are > Linux kernels? You cannot -- changing this would break QEMU's compatibility with existing user command lines which assume they can pass an ELF file to QEMU to get the bare-metal-bootup behaviour. Do not try to pass a Linux kernel vmlinux ELF file to -kernel: as I have told you, this will not work. Pass instead the corresponding Image file. That will work and does not need any changes to QEMU itself. thanks -- PMM ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-05 10:57 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-02-27 14:41 [Question] Can I start qemu-system-aarch64 with a vmlinux(ELF format)? Kunkun Jiang via 2024-02-27 15:28 ` Peter Maydell 2024-02-29 3:01 ` Kunkun Jiang via 2024-02-29 9:44 ` Peter Maydell 2024-03-05 10:35 ` Kunkun Jiang via 2024-03-05 10:56 ` Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).