Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a question that I really can't find a straight answer to. Let me start by saying I'm not asking for a step by step tutorial, or even plan on doing anything. I'm just curious.

I've been reading up all day on the development of operating systems, and how they're built from scratch. I have a pretty firm grip on the theory of it. However, there is one step I can't seem to find an answer for.

Before the existence of a full on, tool filled operating system, how would one even write a simple boot loader for a computer that doesn't any have a boot loader, or anything for that matter, in its boot sector? What would the very first step be after acquiring a computer with the bare minimal? (I.e., screen, keyboard, processor, ram, hdd, floppy)

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

Historically there were various ways:-

  • No OS at all. Executable was loaded in from first card, tape file or whatever.
  • Os hard coded in magnetic core memory. Cores were permanent magnets instead of plain ferrite, depending on the N/S orientation of the magnet it was a one or zero. The computers in the Gemini and Apollo spacecraft had all there programs "knitted" in this way.
  • First sector from disk. This was pretty standard on "mini" computers such as the PDP-11, the computer was hardwired to read the first track from the first disk and execute the code when it hit an EOF marker.
  • Custom boot device. The second generation IBM mainframes had a dedicated 12 inch floppy disk to load in a "microcode" OS. When then searched for the real OS on disk somewhere. I have also seem micros with dedicated cassette tape drives to load the OS. Operators were required to rewind or "turn over" the tape.

  • BIOS. A minimal OS is stored in ROM and the processor is hard wired to execute the ROM code on "power up". The ROM then gets the real OS from wherever. This is pretty much how all modern computers work. What the ROM actually does varies from processor to processor. Itel boxes generally have a very sophisticated BIOS program dedicated to each procesor "generation". Unix type boxes generally have a much simpler BIOS, Sun/Oracle boxes famously load a "FORTH" interpreter which then executes a simple script to load Solaris.

share|improve this answer
2  
Don't forget toggle switches! Many early computers had a row of toggle switches so that you could manually load a pre-bootloader to read from floppy or tape to load the actual bootloader and OS –  Earlz Sep 19 '13 at 15:37
    
@Earlz -- forgot about that. On a pdp-11 you could set the binary address of the boot device using the panel toggle switches. –  James Anderson Sep 20 '13 at 8:40
add comment

You need some way to create a ROM or EEPROM chip that can be installed on the motherboard and contains the bootloader. There's really a series of boot steps, starting with internal checks by the various chips (CPU, video card etc) followed by bus activation and discovery (the PCI-e bus controller locates everything connected to it and assigns IDs etc). Then the motherboard looks for a boot ROM and runs that code, which in turn finds the BIOS boot order and looks through that for a matching device, then loads the booter from that. Which in turn loads an OS.

The original boot chain was flicking switches that formed the ROM, then later using switches to program RAM, and so on right up to the modern multi-stage bootloaders.

share|improve this answer
add comment

In the really ancient days (such as the IBM 650 or PDP1) it was necessary to enter values into memory using front panel switches. Looking at pictures of really early computers, you saw two rows of lights - Address and Data. On a 16-bit computer there were 16 of these running across, usually color coded in groups of three or four for octal or hex, respectively.

The 'Reset' button would set the 'Address' counter to zero. One could then set the switches on the data bus to the desired value, and toggle the 'data write' button. This would write the switch settings into the memory at address 0. There were up-down toggle switches to allow you to move to the next or previous address. You could also set the switches for the address, and click 'address write'. Whatever was at that new address would be displayed on the 16 data lights.

Typically one would toggle in, using this technique, a read loop for reading values out of a card reader or paper tape. This would be just enough to load a larger block of code to proceed with the OS or application load. At the time, such computers had 4K to 16K words (or 8K to 32K bytes) so such loaders were tiny by modern standards. A read loop might only be three or five 16-bit words.

Front panel illustration

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.