XOmB Bare Bones

From XOmB wiki

Jump to: navigation, search

The XOmB Bare Bones distribution is a minimal 64 bit OS written in D, distilled from the main project by wilkie and Steve Klabnik.


Contents

About

The osdev wiki has a page called Bare Bones. On it, they show how to make a minimal OS written in the C programming language. When we started discussing programming an OS in D, some people indicated an interest in having a similar example, but in the D language.

We decided to oblige. We've distilled a minimal OS out of XOmB, and are releasing it as the "XOmB Bare Bones" distribution.

Why Bare Bones?

Part of XOmB's core values is education. We'd like to enable other people to work on systems, and that means systems other than our own, too. Not everyone wants to make the kind of OS we plan on turning XOmB into, other people might want to make a monolithic or microkernel. That's awesome, and we want to accommodate those people as well as ourselves.

Liber et Publicus is important, because it enables one person to do the work once, and let others stand on his shoulders to make the things they want. We'd be doing others a dis-service if we made our research available only to our project. We'd like to pick that low hanging fruit once, and then share it with the rest of the world. Of course, we'd then like to teach them how to pick fruit, but that's beyond the point. Not everyone cares about the actual boot process, and we'd like to make that Just Work for those people who want it to be there.

In addition, working with a base system is easier for people to get into. A new person who wants to help with the project can check out the XBB, and it'll help ease them into the complexity of the system.

Get XBB

For Users

If you'd like to make your own OS from XBB, or just wish to play around with it without contributing to XBB itself, you can download either a .zip or a .tgz file directly from GitHub. Just click the 'download' button to the right of the project name.

For Contributers to XBB

The git repository is located here. If you haven't used git before, check out our Using Git tutorial.

The short lowdown:

git clone git://github.com/xomboverlord/xomb-bare-bones.git

Once you've made some changes and wish to submit them back to us, click the pull request button, and we'll check over your patch and apply it if it's cool enough.

Using XBB

In order to compile XBB, you need a few things:

ldc
gcc
ld
dsss

You probably already have gcc and ld installed. To install dsss, follow the instructions here. To install LDC, follow the instructions here.

You probably also want to have bochs installed for testing, unless you want to burn an .iso for every build. At least version 2.3.7 is needed, with instructions on installing and basic usage found in our guide.

Alternatively, you could use VirtualBox version 2.1 with the cdrom set to be your ISO, the OS set to be other/unknown, 128 MB of RAM, 8MB VRAM, no hard drive, boot only cdrom, enable pae and enable VX-t/AMD-V (disable nested paging), disable acpi, disable io-apic, disable 3d acceleration, and disable all other peripherals.

We compile our D code with ldc, our ASM with gcc, ld for linking, and dsss for automated building. If you don't know how to install these, check the individual pages for instructions.

Once they are all installed, move into the build/ directory, and type

mkdir -p ~/.rebuild
cp ldc-xomb* ~/.rebuild/.
./configure.sh x86_64
dsss build

You can also simply specify x86 for a 32-bit build. The normal XOmB kernel will not support 32-bit, but we have added this to the bare-bones for educational purposes.

If everything goes according to plan, you should have a nice, fresh xomb.iso at the top level of build/. You can try this out by typing

bochs -q

It'll use the bochsrc that's in the build directory to start everything up, and you should be good to go.

XBB From Start to Finish

XBB From Start to Finish is a rundown of how the entire system works, from boot to kmain. It combines high level explanations with links to the relevant parts of our wiki, and the actual source code itself. It's intended to explain everything in enough detail for you to be able to start hacking around with the system after reading.

XBB Organization

The XBB directory looks like this:

$ tree -L 1
.
|-- LICENSE
|-- README
|-- build
|-- kernel

2 directories, 2 files

We've moved all of the source into kernel, because you (at some point) will want to write userspace code. You'd probably want to make another directory in the main tree with all of that code in it. The main XOmB project has libos/ and tools/ and such.

LICENSE

XBB is distributed under the WTFPL. This is the most free license we could possibly imagine that still contains a swear word, so have at it.

README

The readme contains a copy of this page, though it's not updated quite as often as this page is.

build/

 tree -L 1 build/
build/
|-- bochsrc
|-- dsss.conf
|-- dsss.last
|-- dsss_objs
|-- iso
|-- linker.ld
|-- xomb.dump
`-- xomb.iso

2 directories, 6 files

bochsrc

Assuming you're running bochs, we've given you a bochsrc.

dsss.conf

This file tells dsss how to build XBB.

dsss.last

This is another file that dsss generates.

dsss_objs

This directory contains all of the intermediate stuff that dsss needs to do its job.

iso

This directory contains a copy of the actual FS contained in xomb.iso.

linker.ld

This script lets ld know how it should link everything together.

xomb.dump

A dump of the iso. Very useful for seeing exactly what asm gets generated after compiling things.

xomb.iso

This is the actual .iso file that needs to be burnt to a CD (or run in some other manner) to run the OS!

kernel/

$ tree -L 1 kernel/
kernel/
|-- arch
|-- config.d
|-- core
|-- dev
`-- runtime

4 directories, 1 file

arch

This directory contains everything pertaining to architecture. If you wanted to port XBB to arm or something, the code would go in here.

config.d

This sets a bunch of configuration options, mostly relating to debugging information.

core

This is where it all goes down. The core kernel code is located inside.

dev

Everything in this directory pertains to devices.

runtime

The kernel D runtime. This runtime is nowhere near as robust as a full userspace runtime would be, as the kernel doesn't need such niceties as garbage collection. Just the bare minimum, thanks.

Personal tools
6pm coupons