[Top][All Lists]

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

Re: run a simple 16-bit real mode OS in qemu VM

From: Max Reitz
Subject: Re: run a simple 16-bit real mode OS in qemu VM
Date: Tue, 29 Oct 2019 10:48:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 29.10.19 07:45, bilsch01 wrote:
> I have a simple 16-bit real mode OS called JINX that I have been
> running/testing on a flash drive. I write the 8192 byte file, jsec2.bin,
> to a flash drive using the linux dd copy utility, and then boot the
> flash drive. The .bin file is a binary file created from assembly
> language using the nasm assembler. I want to run jsec2.bin in a VM using
> qemu. I don't know much about qemu. The three steps below are based on a
> tutorial for creating a VM for Ubuntu 15.04 Server. If someone can
> answer the QUESTION in step 2 below I may be moving down the road.
> 1) they create a 20GB hard disk image:
> qemu-img create ubuntu.img 20G
> 50 MB is plenty so I would try this:
> qemu-img create jinx.img 50M
> 2) they boot the Virtual machine:
> qemu-system-xi386 -hda ubuntu.img -boot d -cdrom
> /home/sk/Soft_Backup/OS\ Images/New/ubuntu-15.04-server-i386.iso -m 640
> HERE'S THE QUESTION: how do I adapt the above line to my situation:
> a) binary file of 16-bit code (no cdrom, no .iso)

The question of course is which medium you want to boot from then.

-hda/-hdb/... creates an IDE hard drive, -fda would create a floppy disk
drive.  You say you boot it from a USB flash drive on real hardware, so
if you want to do the same in qemu, you could do something like:

$ qemu-system-i386 \
    -device qemu-xhci \
    -drive id=disk-image,file=home/jinx/jsec2.bin,if=none,format=raw \
    -device usb-storage,drive=disk-image

And I suppose add “-hda jinx.img” if you need the HDD.  If so, you will
probably also need to add “-boot menu=on” and then press escape when
booting to get a boot menu from which you can select to boot from the
USB device.

> b) path/file is home/jinx/jsec2.bin
> c) required memory is 1 Mb
> 3) they boot the system with:
> qemu -hda ubuntu.img -m 640
> I would use:
> qemu -hda jinx.img -m 1

Do you really need to limit the memory to 1 MB?  The default is 128, so
you might as well just omit the -m option (unless your host has very
limited memory).  (And for me it looks like -m 1 will cause qemu/SeaBIOS
not to boot from USB.)

You might also want to add -enable-kvm to enable hardware virtualization
(for better performance), although I don’t know by heart whether that
works for real mode nowadays.


Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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