old-www/HOWTO/From-PowerUp-To-Bash-Prompt...

102 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>From Power Up To Bash Prompt: Hardware</TITLE>
<LINK HREF="From-PowerUp-To-Bash-Prompt-HOWTO-3.html" REL=next>
<LINK HREF="From-PowerUp-To-Bash-Prompt-HOWTO-1.html" REL=previous>
<LINK HREF="From-PowerUp-To-Bash-Prompt-HOWTO.html#toc2" REL=contents>
</HEAD>
<BODY>
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO-3.html">Next</A>
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO-1.html">Previous</A>
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO.html#toc2">Contents</A>
<HR>
<H2><A NAME="s2">2. Hardware</A></H2>
<P>When you first turn on your computer it tests itself to make sure everything is
in working order. This is called the ``Power on self test''. Then a program
called the bootstrap loader, located in the ROM BIOS, looks for
a boot sector. A boot sector is the first sector of a disk and has a small
program that can load an operating system. Boot sectors are marked with a magic
number 0xAA55 = 43603 at byte 0x1FE = 510. That's the last two bytes of the
sector. This is how the hardware can tell
whether the sector is a boot sector or not.
<P>
<P>The bootstrap loader has a list of places to look for a boot sector. My old
machine looks in the primary floppy drive, then the primary hard drive.
More modern machines can also look for a boot sector on a CD-ROM.
If it finds a boot sector, it loads it into memory and passes control to the
program that loads the operating system.
On a typical Linux system, this program will be LILO's first stage
boot loader. There are many different ways of setting your system up to boot
though. See the <EM>LILO User's Guide</EM> for details. See section
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO-3.html#lilo-links">LILO</A> for a URL.
<P>
<P>Obviously there is a lot more to say about what PC hardware does. But this is
not the place to say it. See one of the many good books about PC hardware.
<P>
<H2><A NAME="ss2.1">2.1 Configuration</A>
</H2>
<P>The machine stores some information about itself in its CMOS. This
includes what disks and RAM are in the system. The machine's BIOS contains a
program to let you modify these settings. Check the messages on your screen as
the machine is turned on to see how to access it. On my machine, you press the
delete key before it begins loading its operating system.
<P>
<H2><A NAME="hardware-ex"></A> <A NAME="ss2.2">2.2 Exercises</A>
</H2>
<P>A good way to learn about PC hardware is to build a machine out of second hand
parts. Get at least a 386 so you can easily run Linux on it. It won't cost much.
Ask around, someone might give you some of the parts you need.
<P>
<P>Check out, download compile and make a boot disk for
<A HREF="http://www.netspace.net.au/~gok/resources">Unios</A>.
(They used to have a home page at
<A HREF="http://www.unios.org">http://www.unios.org</A>,
but it disappeared)
This is just a bootable ``Hello World!'' program, consisting of just over 100
lines of assembler code. It would be good to see it converted to a format
that the GNU assembler <CODE>as</CODE> can understand.
<P>
<P>Open the boot disk image for unios with a hex editor. This image is 512 bytes
long, exactly one sector. Find the magic number 0xAA55. Do the same for
the boot sector from a bootable floppy disk or your own computer. You can
use the <CODE>dd</CODE> command to copy it to a file: <CODE>dd if=/dev/fd0 of=boot.sector</CODE>.
Be <EM>very</EM> careful to get <CODE>if</CODE> (input file) and <CODE>of</CODE>
(output file) the right way round!
<P>Check out the source code for LILO's boot loader.
<P>
<H2><A NAME="ss2.3">2.3 More Information</A>
</H2>
<P>
<UL>
<LI>
<A HREF="http://www.linuxdoc.org/HOWTO/Unix-and-Internet-Fundamentals-HOWTO.html">The Unix and Internet Fundamentals HOWTO</A>
by Eric S. Raymond,
especially section 3, <EM>What happens when you switch on a computer?</EM>
</LI>
<LI>The first chapter of <EM>The LILO User's Guide</EM> gives an excellent
explanation of PC disk partitions and booting.
See section
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO-3.html#lilo-links">LILO</A> for a URL.
</LI>
<LI><EM>The NEW Peter Norton Programmer's Guide to the IBM PC &amp; PS/2</EM>,
by Peter Norton and Richard Wilton, Microsoft Press 1988
There is a newer Norton book, which looks good, but I can't afford it right now!
</LI>
<LI>One of the many books available on upgrading PC's</LI>
</UL>
<P>
<P>
<P>
<HR>
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO-3.html">Next</A>
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO-1.html">Previous</A>
<A HREF="From-PowerUp-To-Bash-Prompt-HOWTO.html#toc2">Contents</A>
</BODY>
</HTML>