OSp: Bare-metal OSv

In this post, I’d like to summarize what I did for bare-metal OSv, or OSp.

Fortunately, if you give up using some functions that rely on Virtio devices (e.g., networking), OSv is already capable of running on bare-metal with only two small fixes.

First, you need to skip AcpiReallocateRootTable() in drivers/acpi.cc. In this function, something causes triple fault and prevents OSv from booting up.

Second, you had better insert sleep() to wait for AHCI port linkup. Without it, OSv often mistakenly believes that AHCI ports won’t get ready.

The remaining tasks for bare-metal OSv are straightforward.

First, build the OSv’s disk image.

Then, you will get the image, build/release.x64/usr.img, which is in the QCOW2 format. So, next, convert it to the raw image (e.g., named bare.img).

Then, start your favorite OS on the target physical machine, on which bare-metal OSv is supposed to run, without mounting the primary local disk (e.g., you can use USB booting or network booting), and simply dd the bare.img you’ve just created onto the primary local disk.

Finally, restart the target physical machine from the local disk. OSp will show up :)


Since I’m tired of dd-ing OSv’s kernel image to the local disk each time I modified the source code of OSv, I make OSv kernel network-bootable (as shown in the figure).


First, apply the patch. Then, try git submodule update because the patch adds iPXE as a submodule.

Next, make the network-bootable image of OSv.

Then, use the script, scripts/embed, to specify the command parameters you want to pass to OSv.

Now, you have two important files: build/release.x64/loader.bin (network-bootable OSv kernel iage) and build/release.x64/loader.ipxe (network-bootable iPXE image). The remaining steps are for allowing PXE/iPXE chain-loading using the two files.

Setup TFTP server and put the two files (loader.bin and loader.ipxe) on the TFTP directory. Also, setup DHCP server so that the target client machine can be properly instructed during PXE booting. In the configuration file of DHCP (typically dhcp.conf), specify loader.ipxe as the boot file name for the client machine.

(How to setup TFTP/DHCP servers are well described in this article, for example.)

Here is the example of DHCP/TFTP configuration:

Finally, starts the client machine enabling PXE booting. Flying OSp will show up :)


In this movie, OSv performs network booting and lands on a physical machine (my HP server). I also applied the patch, which is for the physical 10GbE driver for OSv, so the OSv can also use network functions.

(Firmware initialization of my HP server takes more than a minute in that movie. Skip it if you are not interested in. Sorry…)


Because OSp runs on physical machines, things can be easily changed depending on underlying hardware. So, here I’ll note my server specification where I confirmed OSp ran. My HP server is ProLiant ML310e Gen8 v2 (Intel Xeon E3-1241 v3 @ 3.50GHz, PC3-12800E-11 4GB * 4, SAMSUNG HD103UJ 7200RPM 1T). Here I put the output of lspci, /proc/cpuinfo and hdparm -I on the server as a reference.

Also note that OSv has the AHCI driver but does not have drivers for other physical block devices such as SCSI or RAID controllers.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">