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.