[Top][All Lists]

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

Re: Creating image of OS to run with qemu.

From: Jakob Bohm
Subject: Re: Creating image of OS to run with qemu.
Date: Thu, 31 Oct 2019 23:33:39 +0100
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0

On 31/10/2019 09:12, bilsch01 wrote:
I have executable code for my simple OS in a binary file (jsec2.bin) created using nasm assembler. I have been running it from a flash drive with a boot sector that loads the executable to memory and jumps to it.  File jsec2.bin is not bootable by itself. I want to start running it with qemu - no flash drive involved.  I do not want qemu to use a virtual flash drive either. I want to use the qemu floppy image switch, -fda. However the -fda switch will only work if there is a aa55 boot sector mark at the end of the first sector of the image.

qemu-system-i386 -fda jsec2.bin will not work.  Here's some other possibilities:

1) I need an image of a bootable floppy with a bootsector that jumps to a file named jsec2.bin just like an msdos boot sector jumps to the file named IO.SYS contained in the file system on the disk. Is there a tool that I can adapt to this purpose?

Look at the source code of the boot sector of the floppy/hard drive
version of the "SysLinux" boot loader.  (See wiki.syslinux.org)

Or look at the source code for of the boot sector of the FreeDOS OS.

Both are free systems that apparently use that technique of loading a
file from FAT12/FAT16 file systems as used on floppies.

2) possibly there is some way to make a grub floppy image or iso that boots the executable in jsec2.bin.  If there is a way using a grub tool?

Actually, both of these ideas suck because I want to use qemu for running the code as I develop it and these ideas are slow and cumbersome.  Any suggestions will be appreciated. Thanks   Bill S.

Option 3: If you can get a working copy of SysLinux 4.xx (not version 5
or above), you can write your OS as a "comboot" file that runs almost
under raw BIOS but with a few helper features to get things started.
Comboot files are loaded at address xxxx:0100 with the bytes from
xxxx:0000 to xxxx:00FF filled with some nice info.

Option 4: Mark your code blob as a PC-style "extension ROM" (as found
on some plug in cards like hard drive controllers or video cards).

This involves adding a few simple headers, padding the file size to a
power of 2 between 1KB and 64KB, and telling qemu this is a ROM to be
mapped into address space at some address between C000:0000 and
EFC0:0000 (Note: C000:0000 to C000:7FFF are typically used for Video
BIOS already).  For more information, refer to your BIOS technical

As you are working in real mode, I have written the addresses in
segment:offset notation.

Option 5: Emulate the file format and startup entrypoint of Linux
kernels as supported by all the Linux boot loaders (including
the one built into qemu itself using the "--kernel" option).  This
is more complex and may involve running at least the beginning
of your code in 32 bit mode.


Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

reply via email to

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