8

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)

1

4 Answers 4

10

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 their 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. Which then searched for the real OS on disk somewhere. I have also seen 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.

3
  • 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, 2013 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. Sep 20, 2013 at 8:40
  • @Earlz There is a famous story about how Paul Allen (co-founder of Microsoft) wrote a bootloader for his and Bill Gates' BASIC interpreter for the Altair on the airplane and then toggled it in by hand. (See en.wikipedia.org/wiki/Altair_BASIC, which doesn't quite give the details, but does recount the story.)
    – Ryan Reich
    Oct 1, 2016 at 0:22
4

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

3

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.

0

You put a floppy disk in another computer, use that computer to write your bootloader to the floppy disk, take the floppy disk out, put the floppy disk in the computer that has no bootloader, and turn it on.

The first computers were programmed with hardware switches, yes, but that is not relevant today. Today, you need to transfer the data from another computer. There is no other option.

Nobody has a floppy drive any more, but depending on how old the computer's BIOS is, you can also use a CD, a USB stick, or a network connection to another computer that's running the needed server software to serve bootloaders over the network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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