Re: prog for no OS. language?

From: Rob Landley (landley@trommello.org)
Date: Mon Dec 31 2001 - 17:43:48 EST


On Monday 31 December 2001 02:52 am, samson swanson wrote:
> hello,
>
> I had a quick question. Say I want to write a program
> to run without an OS, what language/tools do i need?

The first thing you have to write is a boot sector. On Intel, this will be
written in 16 bit assembler.

> linus (if you read this) what language/means did you
> use to make your terminal emulation program before
> linux?

Linus wrote a book, you know. "Just for fun". Amazon should have it...

Or, if you don't have the patience, you could read this:

http://www.li.org/linuxhistory.php

Basically, if you're writing code without ANY OS behind it, you'll be doing
it in assembler, and in order to use 32 bit assembler, you first have to set
up the page tables and interrupt handlers (and know what the A20 line is for,
although you do NOT have to know why the heck it seems to live on the
keyboard controller...), set up your own scheduler (or pretty much disable
interrupts), and basically re-implement a small operating system in order to
get to the point where you can write in some other language (like C).

Linus did it because he was bored, and a college student. It took him 3
months (summer off from school). Why write a term program you boot into?
Becaue he was using minix as his os, and minix sucks at handling interrupts.
You try doing serial IO (to talk to the school's unix box through a modem)
when your serial port drops characters left and right. (I don't think he
even had a 16550a uart at the time... :)

To see what's involved when Linux boots up, read
http://www.moses.uklinux.net/patches/lki.html

You could also go look at the freedos project...

Just getting to 32 bit mode is a bit of an accomplishment, actually. Booting
modern intel hardware recapitulates phylogeny...

Rob
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:14 EST