Middle Ages: the setup( ) Function

The code of the setup( ) assembly language function has been placed by the linker at offset 0x200 of the kernel image file. The boot loader can therefore easily locate the code and copy it into RAM, starting from physical address 0x00090200.

The setup( ) function must initialize the hardware devices in the computer and set up the environment for the execution of the kernel program. Although the BIOS already initialized most hardware devices, Linux does not rely on it, but reinitializes the devices in its own manner to enhance portability and robustness. setup( ) performs essentially the following operations:

  1. In ACPI -compliant systems, it invokes a BIOS routine that builds a table in RAM describing the layout of the system’s physical memory (the table can be seen in the boot kernel messages by looking for the “BIOS-e820” label). In older systems, it invokes a BIOS routine that just returns the amount of RAM available in the system.

  2. Sets the keyboard repeat delay and rate. (When the user keeps a key pressed past a certain amount of time, the keyboard device sends the corresponding keycode over and over to the CPU.)

  3. Initializes the video adapter card.

  4. Reinitializes the disk controller and determines the hard disk parameters.

  5. Checks for an IBM Micro Channel bus (MCA).

  6. Checks for a PS/2 pointing device (bus mouse).

  7. Checks for Advanced Power Management (APM ) BIOS support.

  8. If the BIOS supports the Enhanced Disk Drive Services (EDD ), it invokes the proper ...

Get Understanding the Linux Kernel, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.