Architecture Dependencies

Versions 2.0 and later of the Linux kernel are fairly portable across platforms, which means that most of the code runs on all the supported architectures without the need to differentiate among them. Everything we have seen in this tour up to now is completely independent of the hardware platform.

The arch directory tree is a minor part of the Linux kernel that contains the platform-specific code. Every system-dependent function is replicated in each arch subdirectory, so that the structure of all the subdirectories is similar. The most important of these subdirectories is kernel, which hosts every system-specific function related to the main kernel source directory.

There are two assembly sources that are always found under kernel. head.S is the startup code executed at system boot; it sometimes includes some of the exception-handling code. The other file is entry.S, which includes the entry points to kernel space. In particular, every such file contains the sys_call_table for its own architecture; every architecture has a different table to associate system call numbers to functions.

Other commonly found subdirectories are lib, which hosts the optimized checksum routines for network packets and sometimes includes other low-level operations such as string operations; mm, which deals with low-level handling of page faults (fault.c) and the initialization code called at system boot (init.c); and boot, which contains the code needed to bring up the system. ...

Get Linux Device Drivers 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.