: Embedded Linux Primer: A Practical, Real-World Approach

4.3.3. Makefile Targets

4.3.3. Makefile Targets

If you type make help at the top-level Linux source directory, you are presented with a list of targets that can be generated from the source tree. The most common use of make is to specify no target. This generates the kernel ELF file vmlinux and is the default binary image for your chosen architecture (for example, bzImage for x86). Specifying make with no target also builds all the device-driver modules (kernel-loadable modules) specified by the configuration.

Many architectures and machine types require binary targets specific to the architecture and bootloader in use. One of the more common architecture specific targets is zImage. In many architectures, this is the default target image that can be loaded and run on the target embedded system. One of the common mistakes that newcomers make is to specify bzImage as the make target. The bzImage target is specific to the x86/PC architecture. Contrary to popular myth, the bzImage is not a bzip2 -compressed image. It is a big zImage. Without going into the details of legacy PC architecture, it is enough to know that a bzImage is suitable only for PC-compatible machines with an industry-standard PC-style BIOS.

Listing 4-7 contains the output from make help from a recent Linux kernel. You can see from the listing that many targets are available in the top-level Linux kernel makefile. Each is listed along with a short description of its use. It is important to realize that even the help make target (as in make help) is architecture specific. You get a different list of architecture-specific targets depending on the architecture you pass on the make invocation. Listing 4-7 illustrates an invocation that specifies the ARM architecture, as you can see from the make command line.

Listing 4-7. Makefile Targets

$ make ARCH=arm help
Cleaning targets:
clean - remove most generated files but keep the config
mrproper - remove all generated files + config + various backup files
Configuration targets:
config - Update current config utilising a line-oriented program
menuconfig - Update current config utilising a menu based program
xconfig - Update current config utilising a QT based front-end
gconfig - Update current config utilising a GTK based front-end
oldconfig - Update current config utilising a provided .config as base
randconfig - New config with random answer to all options
defconfig - New config with default answer to all options
allmodconfig - New config selecting modules when possible
allyesconfig - New config where all options are accepted with yes
allnoconfig - New minimal config
Other generic targets:
all - Build all targets marked with [*]
* vmlinux - Build the bare kernel
* modules - Build all modules
modules_install - Install all modules
dir/ - Build all files in dir and below
dir/file.[ois] - Build specified target only
dir/file.ko - Build module including final link
rpm - Build a kernel as an RPM package
tags/TAGS - Generate tags file for editors
cscope - Generate cscope index
kernelrelease - Output the release version string
Static analysers
buildcheck - List dangling references to vmlinux discarded sections and
init sections from non-init sections
checkstack - Generate a list of stack hogs
namespacecheck - Name space analysis on compiled kernel
Kernel packaging:
rpm-pkg - Build the kernel as an RPM package
binrpm-pkg - Build an rpm package containing the compiled kernel and
modules
deb-pkg - Build the kernel as an deb package
tar-pkg - Build the kernel as an uncompressed tarball
targz-pkg - Build the kernel as a gzip compressed tarball
tarbz2-pkg - Build the kernel as a bzip2 compressed tarball
Documentation targets:
Linux kernel internal documentation in different formats:
xmldocs (XML DocBook), psdocs (Postscript), pdfdocs (PDF)
htmldocs (HTML), mandocs (man pages, use installmandocs to install)
Architecture specific targets (arm):
* zImage - Compressed kernel image (arch/arm/boot/zImage)
Image - Uncompressed kernel image (arch/arm/boot/Image)
* xipImage - XIP kernel image, if configured (arch/arm/boot/xipImage)
bootpImage - Combined zImage and initial RAM disk
(supply initrd image via make variable INITRD=<path>)
install - Install uncompressed kernel
zinstall - Install compressed kernel
Install using (your) ~/bin/installkernel or
(distribution) /sbin/installkernel or
install to $(INSTALL_PATH) and run lilo
assabet_defconfig - Build for assabet
badge4_defconfig - Build for badge4
bast_defconfig - Build for bast
cerfcube_defconfig - Build for cerfcube
clps7500_defconfig - Build for clps7500
collie_defconfig - Build for collie
corgi_defconfig - Build for corgi
ebsa110_defconfig - Build for ebsa110
edb7211_defconfig - Build for edb7211
enp2611_defconfig - Build for enp2611
ep80219_defconfig - Build for ep80219
epxa10db_defconfig - Build for epxa10db
footbridge_defconfig - Build for footbridge
fortunet_defconfig - Build for fortunet
h3600_defconfig - Build for h3600
h7201_defconfig - Build for h7201
h7202_defconfig - Build for h7202
hackkit_defconfig - Build for hackkit
integrator_defconfig - Build for integrator
iq31244_defconfig - Build for iq31244
iq80321_defconfig - Build for iq80321
iq80331_defconfig - Build for iq80331
iq80332_defconfig - Build for iq80332
ixdp2400_defconfig - Build for ixdp2400
ixdp2401_defconfig - Build for ixdp2401
ixdp2800_defconfig - Build for ixdp2800
ixdp2801_defconfig - Build for ixdp2801
ixp4xx_defconfig - Build for ixp4xx
jornada720_defconfig - Build for jornada720
lart_defconfig - Build for lart
lpd7a400_defconfig - Build for lpd7a400
lpd7a404_defconfig - Build for lpd7a404
lubbock_defconfig - Build for lubbock
lusl7200_defconfig - Build for lusl7200
mainstone_defconfig - Build for mainstone
mx1ads_defconfig - Build for mx1ads
neponset_defconfig - Build for neponset
netwinder_defconfig - Build for netwinder
omap_h2_1610_defconfig - Build for omap_h2_1610
pleb_defconfig - Build for pleb
poodle_defconfig - Build for poodle
pxa255-idp_defconfig - Build for pxa255-idp
rpc_defconfig - Build for rpc
s3c2410_defconfig - Build for s3c2410
shannon_defconfig - Build for shannon
shark_defconfig - Build for shark
simpad_defconfig - Build for simpad
smdk2410_defconfig - Build for smdk2410
spitz_defconfig - Build for spitz
versatile_defconfig - Build for versatile
make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
make O=dir [targets] Locate all output files in "dir", including .config
make C=1 [targets] Check all c source with $CHECK (sparse)
make C=2 [targets] Force check of all c source with $CHECK (sparse)
Execute "make" or "make all" to build all targets marked with [*]
For further info see the ./README file

Many of these targets you might never use. However, it is useful to know that they exist. As you can see from Listing 4-7, the targets listed with an asterisk are built by default. Notice the numerous default configurations, listed as *_defconfig. Recall from Section 4.2.2, "Compiling the Kernel," the command we used to preconfigure a pristine kernel source tree: We invoked make with an architecture and a default configuration. The default configuration was ixp4xx_defconfig, which appears in this list of ARM targets. This is a good way to discover all the default configurations available for a particular kernel release and architecture.


: 1.364. /Cache: 3 / 0