Êíèãà: Embedded Linux Primer: A Practical, Real-World Approach

16.1.1. The Architecture Branch

16.1.1. The Architecture Branch

In Chapter 4, "The Linux Kernel: A Different Perspective," we introduced the overall structure of the Linux kernel source tree. We spend the majority of this chapter examining the architecture-specific branch of the Linux kernel sources. Listing 16-1 shows the contents of .../arch from a recent kernel snapshot. As we pointed out in Chapter 4, the .../arch subdirectory is the second largest in terms of size, and in a recent Linux release, the largest in terms of file count (excluding the .../include directory). Only the .../drivers subdirectory is larger in size.

Listing 16-1. Linux Kernel .../arch Directory Listing

[chris@pluto linux]$ ls ./arch
alpha  cris   i386  m68k       parisc  s390  sparc    v850
arm    frv    ia64  m68knommu  ppc     sh    sparc64  x86_64
arm26  h8300  m32r  mips       ppc64   sh64  um       xtensa

From this listing, you can see support for 24 separate architectures within the Linux kernel. We refer to each as an architecture branch to facilitate our discussions.

Each architecture branch has some common components. For example, each top-level architecture branch contains a Kconfig file. You will recall from Chapter 4 that Kconfig drives the kernel configuration utility. Of course, each top-level architecture branch also has a corresponding makefile. All the top-level architectures contain a kernel subdirectory because a number of kernel features are architecture dependent. All but two contain an mm subdirectory. This is where the architecture-dependent memory management code is found.

Many top-level architecture branches contain a boot subdirectory, which is used to build (through its own makefile) a specific bootable target for that architecture. Many also contain mach-* subdirectories. These are used to hold code for specific machines or hardware platforms. Another subdirectory that appears frequently in the architecture branch is configs. This subdirectory exists for many of the more popular architectures and contains default configurations for each supported hardware platform.

Throughout the rest of this chapter, we focus our discussion and examples on the PowerPC architecture. It is one of the most popular, with support for many processors and boards. Listing 16-2 shows the contents of the configs directory for the .../arch/ppc PowerPC branch of a recent Linux kernel release.

Listing 16-2. PowerPC configs Directory Contents

[chris@pluto linux]$ ls ./arch/ppc/configs/
ads8272_defconfig   IVMS8_defconfig        prpmc750_defconfig
apus_defconfig      katana_defconfig       prpmc800_defconfig
bamboo_defconfig    lite5200_defconfig     radstone_defconfig
bseip_defconfig     lopec_defconfig        redwood5_defconfig
bubinga_defconfig   luan_defconfig         redwood6_defconfig
chestnut_defconfig  mbx_defconfig          rpx8260_defconfig
common_defconfig    mpc834x_sys_defconfig  rpxcllf_defconfig
cpci405_defconfig   mpc8540_ads_defconfig  rpxlite_defconfig
cpci690_defconfig   mpc8548_cds_defconfig  sandpoint_defconfig
ebony_defconfig     mpc8555_cds_defconfig  spruce_defconfig
ep405_defconfig     mpc8560_ads_defconfig  stx_gp3_defconfig
est8260_defconfig   mpc86x_ads_defconfig   sycamore_defconfig
ev64260_defconfig   mpc885ads_defconfig    TQM823L_defconfig
ev64360_defconfig   mvme5100_defconfig     TQM8260_defconfig
FADS_defconfig      ocotea_defconfig       TQM850L_defconfig
gemini_defconfig    pmac_defconfig         TQM860L_defconfig
hdpu_defconfig      power3_defconfig       walnut_defconfig
ibmchrp_defconfig   pplus_defconfig

Each one of these entries in the configs directory of the PowerPC architecture branch represents a specific port to a hardware platform. For example, walnut_defconfig defines the default configuration for the AMCC Walnut PPC405 evaluation platform. The mpc8540_ads_defconfig file represents the default configuration for the Freescale MPC8540 ADS evaluation board. As described in Chapter 4, to build a kernel for these reference platforms you first configure your kernel source tree with these configuration defaults, as follows:

$ make ARCH=ppc CROSS_COMPILE=ppc_85xx- mpc8540_ads_defconfig

This invocation of make (from the top-level Linux directory) configures the kernel source tree with a default configuration for the Freescale MPC8540 ADS evaluation board.

One aspect of the Linux kernel source tree that has not achieved significant unification is the way in which each architecture handles platform-specific files. In the PowerPC branch, you find a platforms directory that contains platform-specific code. Looking through this directory, you will see many source files named after the respective hardware platform. There are also a few subdirectories under .../arch/ppc/platforms for specific PowerPC variants.

In contrast, the ARM branch contains a series of mach-* directories, each representing a specific hardware platform, while the MIPS branch has a set of subdirectories named for a specific platform.

Îãëàâëåíèå êíèãè

Îãëàâëåíèå ñòàòüè/êíèãè

Ãåíåðàöèÿ: 1.282. Çàïðîñîâ Ê ÁÄ/Cache: 3 / 0
ïîäåëèòüñÿ
Ââåðõ Âíèç