Build a 486 Bootloader with Your Kid

Gallagher Pryor Education 1 Comment

TL;DR. A lab at an elementary school level to illustrate to children that:

  • computers must be instructed,
  • instruction is stored on media,
  • the most basic instruction is a series of numbers.

These notes include links to materials and instructions that take you and a student through (1) starting linux on a vintage 486 computer, (2) assembling a boot-loader, (3) writing it to a floppy, and (4) starting a computer to show a message.

Boot a 486 with your boot-loader!

Intro

I built a bootloader with my children and share our work in this post. It is a lab, at an elementary school level, that you can repeat for yourself and share with the rising generation.

The intent of this activity is to drive home the idea that fundamental computing is not the abstraction that Apple devices or cloud platforms make it out to be. Rather, computers are machines that execute instructions to process data. Moreover, the computer and those instructions must physically exist somewhere.

As such, this activity utilizes floppy disks and their contemporary machines. The student needs to hold some data in their hand and experience a machine that reads and follows his or her instructions. Modern equipment lacks any such link to the tangible world; it is too fast and too vast for uninitiated minds to comprehend. This post tries to fix the situation.

Required Materials

The following items (sourced by links) have been proven to work:

  1. “Old computer” (just example from ebay)
  2. Real floppy disks
  3. IDE SD card interface (grab any SD card)
  4. PS/2 Keyboard and PS/2 Mouse
  5. VGA Monitor
  6. Bootloader Printable Instructions from Bergeron’s Excellent Site. This is the only bootloader on the web that runs on real hardware! Here is the bootloader assembly itself.
  7. Slackware 11.0 image

Preparing the Lab

1. Linux on a 486

Download the Slackware 11.0 image we provide. Burn to an SD card:

# on console as root... sdcard /dev/sdb
wget http://repo.arrayfire.com/pub/slack11.img
dd if=slack11.img of=/dev/sdb bs=1M status=progress

2. Connect the SD Card

Utilize the IDE SD card interface and an SD Card to connect a boot drive to the “Old computer” (just example from ebay).

The SD IDE interface and an SD card.
A beautiful 486 DX 50Mhz 32Mb RAM. From 1990.
Connect the SD card up with an IDE ribbon!

3. Setup the BIOS

On the old computer, specify the following drive geometry. Interestingly, this doesn’t matter that much as long as it is large enough. Make sure the floppy drive is enabled and the boot order hits the floppy first!

Make sure to specify a large-ish yet potentially fictional drive geometry for what is ultimately the attached SD card. Exact values don’t really matter. Also, remember to enable the A drive (floppy).

The Lab with the Student

1. The Machine does Nothing Without Instruction

Pull the SD card from the old machine. Turn it on. Aside from a memory check, the computer doesn’t do anything and flips out. Stress the absence of instruction to the student.

2. Boot the Machine

Re-insert the SD card. Click the power button on and pray to God. The machine should boot into a beautiful Slackware 11.0 from 2004. Login as root with password lkop098.

3. Write the Bootloader Code (or type by choice)

The Slack 11 image contains the source for the boot-loader already laid out: /root/boot.asm . You can utilize that pre-populated assembly or type the boot-loader out in vim. With the printout of the boot-loader instruction, it might be a good exercise to program it with the student while following the explanation.

On the other hand, this all depends on your student’s ability to focus.

Boot loader assembly thanks to Joe Bergeron.

4. Assemble and Examine the Bootloader

Assemble the boot-loader with NASM and have a look at the resulting numbers.

nasm -f bin boot.asm -o boot.com
hexdump boot.com
# 0000000 b8 c0 07 8e d8 b8 e0 07 8e d0 bc 00 20 e8 13 00
# 0000010 6a 00 e8 26 00 83 c4 02 68 6c 00 e8 2f 00 83 c4
# 0000020 02 fa f4 55 89 e5 60 b4 07 b0 00 b7 07 b9 00 00
# 0000030 b6 18 b2 4f cd 10 61 89 ec 5d c3 55 89 e5 60 8b
# 0000040 56 04 b4 02 b7 00 cd 10 61 89 ec 5d c3 55 89 e5
# 0000050 60 8b 76 04 b7 00 b3 00 b4 0e 8a 04 83 c6 01 0c
# 0000060 00 74 04 cd 10 eb f3 61 89 ec 5d c3 4f 68 20 62
# 0000070 6f 79 20 64 6f 20 49 20 73 75 72 65 20 6c 6f 76
# 0000080 65 20 61 73 73 65 6d 62 6c 79 21 00 00 00 00 00
# 0000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# *
# 00001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa
# 0000200

Critically, observe a few things with the student:

  • These are a series of numbers: b8, c0, and so on. There are 512 of them.
  • The numbers are instructions from start to finish.
  • The last two numbers at the end (55, aa) tell the computer that these are its first instructions. Without that at the end, the computer will not interpret these numbers as something to do!

4. Write to Disk

On the old computer, insert a floppy, and write the boot-loader to disk:

dd if=boot.com of=/dev/fd0
Just bone crunching and beautiful.

5. Boot and Boot

Put the floppy disk in the computer. It boots! Observe the disk spin and the message appear on the screen! The computer, the instructions, and the results are truly physical, now, and hopefully make sense. Stress to the student the numbers (instructions) came from the disk and without them, the computer would do nothing!

Boot a 486 with your boot-loader!

I hope this enlightens you and your students as to the true and beautiful nature of computing!


This is a strange world at which we’ve arrived where initially analog, bare-metal ideas have evolved into virtualized systems walled away from fundamentally important ideas. For instance, music was once consumed by radio – technology easily explained to kids as amplitude modulated light. Telephones could be much the same, but instead, electricity flows through wires. TV, while more complex, can be expressed as a composite of those systems.

Thus we arrive at computing. My kids listen to music, communicate, and watch their streams on iPads.

So, I embarked on an epic journey to teach them the fundamental ideas behind all the magic.

-Gallagher Pryor

Comments 1

Leave a Reply

Your email address will not be published.