M3 Operating System Development

A chronicle of the development of the M3 operating system

Tutorial – Simple Boot Sector running on eeePC

with one comment

Because I love gadgets, I got myself an eeePC 701 shortly after they came out. This was one of the first of the netbooks, and I was really enamored by the form-factor. I also really like the fact that it runs Linux.

Because I was bored, and slightly intimidated about working on my actual bootsector, I thought it would be fun to see if I could get the simple bootsector described here running on my eeePC.

Before I could do this, I needed to get and install the proper tools. Namely, Nasm and Qemu. This is pretty easy, thanks to the apt-get package manager. To install these, packages on an eeePC, follow these instructions:

sudo su
nano /etc/apt/sources.list

We need to add a repository for apt-get to look at, so add the following line to the file (note that this should all be on one line):

deb http://xnv4.xandros.com/xs2.0/upkg-srv2 etch main contrib non-free

Once you’ve added the line, hit Ctrl+O to save and Ctrl+X to quit. Now you need to tell apt-get to refresh its package lists (and grab lists from the new repository):

apt-get update

Now you can search your cached lists for the necessary packages. That’s how I found the ones for Nasm and Qemu named, appropriately, nasm and qemu. To install these, run the following commands:

apt-get install nasm
apt-get install qemu

You may be warned that the packages couldn’t be verified, but just type Y to install them anyway.

Voila! The tools are installed. Easy.

Now on to building the boot sector and running it on the emulator. We’ll use the same source code as in the other tutorial, and issue the same command to nasm to compile it:

nasm bootsect.asm -f bin -o bootsect.bin

The commands to create the floppy disk image using dd are also the same:

dd if=/dev/zero of=floppy.img bs=512 count=2880

dd if=bootsect.bin of=floppy.img conv=notrunc

Once we’ve got the floppy disk image, we have to use it to boot qemu. This is the main difference – the eeePC uses the command-line qemu, while OS X has the nice Q GUI. In this case, we want to tell qemu to use the image file as floppy disk drive A, and we’ll boot the virtual system using the command:

qemu -fda floppy.img

This tells Qemu to boot the system from floppy drive A, using the disk image floppy.img. A new window will open, and you should see the exact same boot screen as in the other tutorial, with a red A in the top left corner of the screen. Pretty painless, no?

I think that I’ll be using my Macbook for the bulk of the development, but it’s nice to know that I have options.


Written by m3os

March 5, 2009 at 8:43 am

Posted in Tutorial

Tagged with , , ,

One Response

Subscribe to comments with RSS.

  1. […] Before you can use apt-get, make sure that you have already added the apt-get repository that we added in our previous tutorial about getting our boot sector to run on the EeePC. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: