qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* How to run qemu
@ 2024-09-07 20:58 Kenneth Adam Miller
  2024-09-07 21:20 ` Kenneth Adam Miller
  2024-09-08  3:09 ` Donald R Laster Jr
  0 siblings, 2 replies; 4+ messages in thread
From: Kenneth Adam Miller @ 2024-09-07 20:58 UTC (permalink / raw)
  To: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

Hello,

I've got qemu built and now I need to figure out how to run it with what
I've got. I have a vmlinux and a bzImage that I want to serve as the kernel
that QEMU runs with, and a single binary, let's just call it
literally `program`, that I want to issue a command to run once QEMU boots
with the kernel.

I tried to figure out how to run the QEMU on my own, and made it as far as
this:

./qemu//bin/debug/native/qemu-system-x86_64 -enable-kvm -m 2048 -display
vnc=:89 \
        -netdev user,id=t0, -device rtl8139,netdev=t0,id=nic0 \
        -netdev user,id=t1, -device pcnet,netdev=t1,id=nic1 \
        -L ./qemu/pc-bios \
        -boot c -kernel $HOME/workspace/kvmctf-6.1.74/bzImage/bzImage

It runs, but there isn't any output to the screen to show it booting, and
QEMU runs the processor hard indefinitely. I need to be able to see
standard output and to be able to type into the console to enter the
command, and I don't know how to get it to or why it isn't showing that
already. Also, once that is working, I need a way to put `program` into the
QEMU session so that it can be run. Can someone help me? I think I need to
make an img file that can boot but I don't really know how to do that
either.

[-- Attachment #2: Type: text/html, Size: 1395 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to run qemu
  2024-09-07 20:58 How to run qemu Kenneth Adam Miller
@ 2024-09-07 21:20 ` Kenneth Adam Miller
  2024-09-08 10:49   ` BALATON Zoltan
  2024-09-08  3:09 ` Donald R Laster Jr
  1 sibling, 1 reply; 4+ messages in thread
From: Kenneth Adam Miller @ 2024-09-07 21:20 UTC (permalink / raw)
  To: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 2141 bytes --]

I found this:
https://qemu-project.gitlab.io/qemu/system/linuxboot.html
and this:
https://nickdesaulniers.github.io/blog/2018/10/24/booting-a-custom-linux-kernel-in-qemu-and-debugging-it-with-gdb/

So I now have serial output. But I still need to know how to put a binary
in the image so I can run it.

I made it a few steps further:

./qemu//bin/debug/native/qemu-system-x86_64 -enable-kvm -m 2048 -display
vnc=:89 \
        -netdev user,id=t0, -device rtl8139,netdev=t0,id=nic0 \
        -netdev user,id=t1, -device pcnet,netdev=t1,id=nic1 \
        -L ./qemu/pc-bios \
        -nographic \
        -append "console=ttyS0 nokaslr" \
        -initrd ramdisk.img \
        -boot c -kernel $HOME/workspace/kvmctf-6.1.74/bzImage/bzImage

On Sat, Sep 7, 2024 at 2:58 PM Kenneth Adam Miller <
kennethadammiller@gmail.com> wrote:

> Hello,
>
> I've got qemu built and now I need to figure out how to run it with what
> I've got. I have a vmlinux and a bzImage that I want to serve as the kernel
> that QEMU runs with, and a single binary, let's just call it
> literally `program`, that I want to issue a command to run once QEMU boots
> with the kernel.
>
> I tried to figure out how to run the QEMU on my own, and made it as far as
> this:
>
> ./qemu//bin/debug/native/qemu-system-x86_64 -enable-kvm -m 2048 -display
> vnc=:89 \
>         -netdev user,id=t0, -device rtl8139,netdev=t0,id=nic0 \
>         -netdev user,id=t1, -device pcnet,netdev=t1,id=nic1 \
>         -L ./qemu/pc-bios \
>         -boot c -kernel $HOME/workspace/kvmctf-6.1.74/bzImage/bzImage
>
> It runs, but there isn't any output to the screen to show it booting, and
> QEMU runs the processor hard indefinitely. I need to be able to see
> standard output and to be able to type into the console to enter the
> command, and I don't know how to get it to or why it isn't showing that
> already. Also, once that is working, I need a way to put `program` into the
> QEMU session so that it can be run. Can someone help me? I think I need to
> make an img file that can boot but I don't really know how to do that
> either.
>

[-- Attachment #2: Type: text/html, Size: 2883 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to run qemu
  2024-09-07 20:58 How to run qemu Kenneth Adam Miller
  2024-09-07 21:20 ` Kenneth Adam Miller
@ 2024-09-08  3:09 ` Donald R Laster Jr
  1 sibling, 0 replies; 4+ messages in thread
From: Donald R Laster Jr @ 2024-09-08  3:09 UTC (permalink / raw)
  To: Kenneth Adam Miller, QEMU Developers

Ken,

   Lookup starting the gvncviewer tool after you start the virtual machine.  To get the display for the VMs I run gvncviewer and sometimes spicec.

   Don

Kenneth Adam Miller wrote on 9/7/24 4:58 PM:
> Hello,
> 
> I've got qemu built and now I need to figure out how to run it with what I've got. I have a vmlinux and a bzImage that I want to serve as the kernel that QEMU runs with, and a single binary, let's just call it literally `program`, that I want to issue a command to run once QEMU boots with the kernel.
> 
> I tried to figure out how to run the QEMU on my own, and made it as far as this:
> 
> ./qemu//bin/debug/native/qemu-system-x86_64 -enable-kvm -m 2048 -display vnc=:89 \
>          -netdev user,id=t0, -device rtl8139,netdev=t0,id=nic0 \
>          -netdev user,id=t1, -device pcnet,netdev=t1,id=nic1 \
>          -L ./qemu/pc-bios \
>          -boot c -kernel $HOME/workspace/kvmctf-6.1.74/bzImage/bzImage
> 
> It runs, but there isn't any output to the screen to show it booting, and QEMU runs the processor hard indefinitely. I need to be able to see standard output and to be able to type into the console to enter the command, and I don't know how to get it to or why it isn't showing that already. Also, once that is working, I need a way to put `program` into the QEMU session so that it can be run. Can someone help me? I think I need to make an img file that can boot but I don't really know how to do that either.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to run qemu
  2024-09-07 21:20 ` Kenneth Adam Miller
@ 2024-09-08 10:49   ` BALATON Zoltan
  0 siblings, 0 replies; 4+ messages in thread
From: BALATON Zoltan @ 2024-09-08 10:49 UTC (permalink / raw)
  To: Kenneth Adam Miller; +Cc: QEMU Developers

On Sat, 7 Sep 2024, Kenneth Adam Miller wrote:
> I found this:
> https://qemu-project.gitlab.io/qemu/system/linuxboot.html
> and this:
> https://nickdesaulniers.github.io/blog/2018/10/24/booting-a-custom-linux-kernel-in-qemu-and-debugging-it-with-gdb/
>
> So I now have serial output. But I still need to know how to put a binary
> in the image so I can run it.

There are several ways but maybe the easiest is to put the binary in the 
initrd if you can edir that (try 'file ramdisk.img' to find out what 
format it's in) or make an iso from it and use -cdrom option to add it as 
a CD drive that they you can mount it if the kernel has appropriate 
drivers.

Regards,
BALATON Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-08 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-07 20:58 How to run qemu Kenneth Adam Miller
2024-09-07 21:20 ` Kenneth Adam Miller
2024-09-08 10:49   ` BALATON Zoltan
2024-09-08  3:09 ` Donald R Laster Jr

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).