Commit 44e26651 authored by Kai Germaschewski's avatar Kai Germaschewski

Merge tp1.ruhr-uni-bochum.de:/scratch/kai/kernel/v2.5/linux-2.5.make-sam

into tp1.ruhr-uni-bochum.de:/scratch/kai/kernel/v2.5/linux-2.5.make
parents c99e695c db1c6c82
00-INDEX
- this file: info on the kernel build process
bug-list.txt
- known bugs in kbuild programs
commands.txt
- overview of kbuild commands
kconfig-language.txt
- specification of Config Language, the language in Kconfig files
random.txt
- description of generic config targets
makefiles.txt
- developer information for linux kernel makefiles
Bug List
21 January 1999
Michael Elizabeth Chastain, <mailto:mec@shout.net>
- If a variable has a value of "m" in the previous .config file,
and a type of bool in the Config script, then all the interpreters
get confused. This happens frequently when someone changes a
tristate option to a bool option and people in the field have
.config files with a value of 'm'. For example: CONFIG_PSMOUSE.
- CONFIG_MODVERSIONS has incorrect dependencies. If you have a
problem building the kernel, and you have CONFIG_MODVERSIONS turned
on, do a 'make dep' followed by 'make clean' before you try anything
else.
- 'make dep' uses multistage dependencies, so the .hdepend file contains
'touch' commands. As a result, building a kernel often touches files
in include/linux/*.h. This messes up CVS and other systems which like
to rely on file dates.
- 'make dep' fails for C files which include other C files, such as
drivers/cdrom/sbpcd2.c.
This diff is collapsed.
......@@ -9,20 +9,13 @@ modules packages aren't aware of some of the newer modular features
that the kernel now supports. The current required version is listed
in the file linux/Documentation/Changes.
* * * NOTE * * *
The kernel has been changed to remove kerneld support and use
the new kmod support. Keep this in mind when reading this file. Kmod
does the exact same thing as kerneld, but doesn't require an external
program (see Documentation/kmod.txt)
In the beginning...
-------------------
Anyway, your first step is to compile the kernel, as explained in the
file linux/README. It generally goes like:
make config
make dep
make *config <= usually menuconfig or xconfig
make clean
make zImage or make zlilo
......@@ -39,15 +32,16 @@ You will generally select the minimal resident set that is needed to boot:
plus those things that you just can't live without...
The set of modules is constantly increasing, and you will be able to select
the option "m" in "make config" for those features that the current kernel
the option "m" in "make menuconfig" for those features that the current kernel
can offer as loadable modules.
You also have a possibility to create modules that are less dependent on
the kernel version. This option can be selected during "make config", by
the kernel version. This option can be selected during "make *config", by
enabling CONFIG_MODVERSIONS, and is most useful on "stable" kernel versions,
such as the kernels from the 1.2 and 2.0 series.
such as the kernels from the 2.<even number> series.
If you have modules that are based on sources that are not included in
the official kernel sources, you will certainly like this option...
See below how to compile modules outside the official kernel.
Here is a sample of the available modules included in the kernel sources:
......@@ -83,22 +77,45 @@ When you have made the kernel, you create the modules by doing:
make modules
This will compile all modules and update the linux/modules directory.
In this directory you will then find a bunch of symbolic links,
pointing to the various object files in the kernel tree.
This will compile all modules. A module is identified by the
extension .ko, for kernel object.
Now, after you have created all your modules, you should also do:
make modules_install
This will copy all newly made modules into subdirectories under
"/lib/modules/kernel_release/", where "kernel_release" is something
like 2.0.1, or whatever the current kernel version is...
like 2.5.54, or whatever the current kernel version is.
Note: Installing modules may require root privileges.
As soon as you have rebooted the newly made kernel, you can install
and remove modules at will with the utilities: "insmod" and "rmmod".
After reading the man-page for insmod, you will also know how easy
it is to configure a module when you do "insmod" (hint: symbol=value).
Installing modules in a non-standard location
---------------------------------------------
When the modules needs to be installed under another directory
the INSTALL_MOD_PATH can be used to prefix "/lib/modules" as seen
in the following example:
make INSTALL_MOD_PATH=/frodo modules_install
This will install the modules in the directory /frodo/lib/modules.
/frodo can be a NFS mounted filesystem on another machine, allowing
out-of-the-box support for installation on remote machines.
Compiling modules outside the official kernel
---------------------------------------------
Often modules are developed outside the official kernel.
To keep up with changes in the build system the most portable way
to compile a module outside the kernel is to use the following command-line:
make -C path/to/kernel/src SUBDIRS=$PWD modules
This requires that a makefile exits made in accordance to
Documentation/kbuild/makefiles.txt.
Nifty features:
---------------
......
......@@ -299,12 +299,12 @@ export MODLIB
# normal descending-into-subdirs phase, since at that time
# we cannot yet know if we will need to relink vmlinux.
# So we descend into init/ inside the rule for vmlinux again.
vmlinux-objs := $(HEAD) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
head-y += $(HEAD)
vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
quiet_cmd_vmlinux__ = LD $@
define cmd_vmlinux__
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(HEAD) $(init-y) \
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
--start-group \
$(core-y) \
$(libs-y) \
......@@ -444,6 +444,8 @@ targets += arch/$(ARCH)/vmlinux.lds.s
$(Q)$(MAKE) $(build)=$(@D) $@
%.o: %.c scripts FORCE
$(Q)$(MAKE) $(build)=$(@D) $@
%/: scripts prepare FORCE
$(Q)$(MAKE) $(build)=$(@D)
%.ko: scripts FORCE
$(Q)$(MAKE) $(build)=$(@D) $@
%.lst: %.c scripts FORCE
......@@ -705,14 +707,14 @@ MRPROPER_DIRS += \
# clean - Delete all intermediate files
#
clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook scripts
$(addprefix _clean_,$(clean-dirs)):
clean-dirs += $(addprefix, _clean_,$(ALL_SUBDIRS) Documentation/DocBook scripts)
.PHONY: $(clean-dirs) clean archclean mrproper archmrproper distclean
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES)
clean: archclean $(addprefix _clean_,$(clean-dirs))
clean: archclean $(clean-dirs)
$(call cmd,rmclean)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
......
......@@ -90,7 +90,7 @@ endif
# BWX is most important, but we don't really want any emulation ever.
CFLAGS += $(cflags-y) -Wa,-mev6
HEAD := arch/alpha/kernel/head.o
head-y := arch/alpha/kernel/head.o
core-y += arch/alpha/kernel/ arch/alpha/mm/
core-$(CONFIG_MATHEMU) += arch/alpha/math-emu/
......@@ -125,8 +125,6 @@ include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(boot)
archmrproper:
CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h.tmp \
include/asm-$(ARCH)/asm_offsets.h
......
......@@ -61,7 +61,7 @@ DATAADDR := .
ifeq ($(CONFIG_CPU_26),y)
PROCESSOR := armo
HEAD := arch/arm/mach-arc/head.o arch/arm/kernel/init_task.o
head-y := arch/arm/mach-arc/head.o arch/arm/kernel/init_task.o
LDFLAGS_BLOB += --oformat elf26-littlearm
ifeq ($(CONFIG_ROM_KERNEL),y)
DATAADDR := 0x02080000
......@@ -73,7 +73,7 @@ endif
ifeq ($(CONFIG_CPU_32),y)
PROCESSOR := armv
HEAD := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
LDFLAGS_BLOB += --oformat elf32-littlearm
textaddr-y := 0xC0008000
endif
......@@ -181,7 +181,6 @@ MRPROPER_FILES += \
include/asm-arm/mach-types.h
# We use MRPROPER_FILES and CLEAN_FILES now
archmrproper:
archclean:
$(Q)$(MAKE) $(clean)=$(boot)
......
......@@ -3,8 +3,7 @@
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
# for "archclean" cleaning up for this architecture.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
......@@ -76,7 +75,7 @@ mcore-$(CONFIG_X86_SUMMIT) := mach-default
# default subarch .h files
mflags-y += -Iinclude/asm-i386/mach-default
HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
libs-y += arch/i386/lib/
core-y += arch/i386/kernel/ \
......@@ -92,8 +91,7 @@ AFLAGS += $(mflags-y)
boot := arch/i386/boot
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install
all: bzImage
......
......@@ -31,7 +31,7 @@ cflags-$(CONFIG_ITANIUM_BSTEP_SPECIFIC) += -mb-step
cflags-$(CONFIG_IA64_SGI_SN) += -DBRINGUP
CFLAGS += $(cflags-y)
HEAD := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
libs-y += arch/ia64/lib/
core-y += arch/ia64/kernel/ arch/ia64/mm/
......@@ -51,14 +51,13 @@ drivers-$(CONFIG_IA64_SGI_SN) += arch/ia64/sn/fakeprom/
makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/ia64/boot $(1)
maketool =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/ia64/tools $(1)
.PHONY: boot compressed archclean archmrproper include/asm-ia64/offsets.h
.PHONY: boot compressed include/asm-ia64/offsets.h
all compressed: vmlinux.gz
vmlinux.gz: vmlinux
$(call makeboot,vmlinux.gz)
archmrproper:
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/ia64/boot
......
......@@ -54,9 +54,9 @@ CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
endif
ifndef CONFIG_SUN3
HEAD := arch/m68k/kernel/head.o
head-y := arch/m68k/kernel/head.o
else
HEAD := arch/m68k/kernel/sun3-head.o
head-y := arch/m68k/kernel/sun3-head.o
endif
core-y += arch/m68k/kernel/ arch/m68k/mm/
......@@ -113,5 +113,3 @@ endif
archclean:
rm -f vmlinux.gz vmlinux.bz2
rm -f arch/m68k/kernel/m68k_defs.h arch/m68k/kernel/m68k_defs.d
archmrproper:
......@@ -84,7 +84,7 @@ CFLAGS += -DUTS_SYSNAME=\"uClinux\"
LDFLAGS_BLOB := --format binary --oformat elf32-m68k
HEAD := arch/m68knommu/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
head-y := arch/m68knommu/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h.tmp \
include/asm-$(ARCH)/asm-offsets.h \
......@@ -98,8 +98,6 @@ libs-y += arch/m68knommu/lib/
prepare: include/asm-$(ARCH)/asm-offsets.h
archmrproper:
archclean:
$(call descend arch/$(ARCH)/boot, subdirclean)
......
......@@ -256,7 +256,7 @@ endif
AFLAGS_vmlinux.lds.o := -DLOADADDR=$(LOADADDR)
HEAD := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
SUBDIRS := arch/mips/tools
......
......@@ -128,7 +128,7 @@ endif
LDFLAGS_vmlinux += -Ttext $(LOADADDR)
HEAD := arch/mips64/kernel/head.o arch/mips64/kernel/init_task.o
head-y := arch/mips64/kernel/head.o arch/mips64/kernel/init_task.o
SUBDIRS := arch/mips64/tools $(SUBDIRS)
core-y += arch/mips64/kernel/ arch/mips64/mm/
......
......@@ -56,7 +56,6 @@ head-y := arch/parisc/kernel/head.o
head-$(CONFIG_PARISC64) := arch/parisc/kernel/head64.o
CFLAGS += $(cflags-y)
HEAD := $(head-y)
core-y += $(addprefix arch/parisc/, kernel/pdc_cons.o kernel/process.o \
mm/ kernel/ hpux/ math-emu/ kernel/init_task.o )
......@@ -96,9 +95,6 @@ include/asm-parisc/offsets.h: arch/parisc/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@.tmp
@$(update-if-changed)
archclean:
archmrproper:
CLEAN_FILES += palo.conf lifimage include/asm-parisc/offsets.h \
include/asm-parisc/offsets.h.tmp
......
......@@ -36,15 +36,12 @@ ifdef CONFIG_MORE_COMPILE_OPTIONS
CFLAGS += $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
endif
head-y := head.o
head-$(CONFIG_8xx) := head_8xx.o
head-$(CONFIG_4xx) := head_4xx.o
head-$(CONFIG_440) := head_44x.o
head-y := arch/ppc/kernel/head.o
head-$(CONFIG_8xx) := arch/ppc/kernel/head_8xx.o
head-$(CONFIG_4xx) := arch/ppc/kernel/head_4xx.o
head-$(CONFIG_440) := arch/ppc/kernel/head_44x.o
HEAD := arch/ppc/kernel/$(head-y)
ifdef CONFIG_6xx
HEAD += arch/ppc/kernel/idle_6xx.o
endif
head-$(CONFIG_6xx) += arch/ppc/kernel/idle_6xx.o
core-y += arch/ppc/kernel/ arch/ppc/platforms/ \
arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/
......@@ -59,7 +56,7 @@ drivers-$(CONFIG_OCP) += arch/ppc/ocp/
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
.PHONY: $(BOOT_TARGETS) clean archclean archmrproper
.PHONY: $(BOOT_TARGETS)
all: zImage
......@@ -78,8 +75,6 @@ $(BOOT_TARGETS): vmlinux
archclean:
$(Q)$(MAKE) $(clean)=arch/ppc/boot
archmrproper:
prepare: include/asm-$(ARCH)/offsets.h checkbin
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
......
......@@ -22,7 +22,7 @@ CFLAGS += -msoft-float -pipe \
-Wno-uninitialized -mminimal-toc -mtraceback=full \
-finline-limit-2000 -mcpu=power4
HEAD := arch/ppc64/kernel/head.o
head-y := arch/ppc64/kernel/head.o
libs-y += arch/ppc64/lib/
core-y += arch/ppc64/kernel/
......
......@@ -20,7 +20,7 @@ LDFLAGS_BLOB := --format binary --oformat elf32-s390
CFLAGS += -pipe -fno-strength-reduce
HEAD := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/
libs-y += arch/$(ARCH)/lib/
......@@ -38,7 +38,6 @@ listing image: vmlinux
install: vmlinux
$(call makeboot, $@)
archmrproper:
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/$(ARCH)/boot
......
......@@ -21,7 +21,7 @@ LDFLAGS_BLOB := --format binary --oformat elf64-s390
CFLAGS += -pipe -fno-strength-reduce
HEAD := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/
libs-y += arch/$(ARCH)/lib/
......@@ -38,7 +38,6 @@ listing image: vmlinux
install: vmlinux
$(call makeboot, $@)
archmrproper:
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/$(ARCH)/boot
......
......@@ -53,7 +53,7 @@ endif
#
CFLAGS += -pipe
HEAD := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
......@@ -81,5 +81,3 @@ archclean:
$(MAKE) -C arch/$(ARCH)/stboards clean
# $(MAKE) -C arch/$(ARCH)/tools clean
archmrproper:
......@@ -37,7 +37,8 @@ endif
# Actual linking is done with "make image".
LDFLAGS_vmlinux = -r
HEAD := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o
head-y := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o
HEAD := $(head-y)
core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/
libs-y += arch/sparc/prom/ arch/sparc/lib/
......@@ -61,8 +62,6 @@ image tftpboot.img: vmlinux
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/$(ARCH)/boot
archmrproper:
prepare: include/asm-$(ARCH)/asm_offsets.h
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
......
......@@ -61,7 +61,7 @@ ifeq ($(CONFIG_MCOUNT),y)
CFLAGS := $(CFLAGS) -pg
endif
HEAD := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
core-y += arch/sparc64/kernel/ arch/sparc64/mm/
core-$(CONFIG_SOLARIS_EMUL) += arch/sparc64/solaris/
......@@ -74,10 +74,6 @@ drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
tftpboot.img vmlinux.aout:
$(Q)$(MAKE) $(build)=arch/sparc64/boot arch/sparc64/boot/$@
archclean:
archmrproper:
define archhelp
echo '* vmlinux - Standard sparc64 kernel'
echo ' vmlinux.aout - a.out kernel for sparc64'
......
......@@ -31,7 +31,7 @@ LDFLAGS_BLOB := -b binary --oformat elf32-little
OBJCOPY_FLAGS_BLOB := -I binary -O elf32-little -B v850e
HEAD := $(arch_dir)/kernel/head.o $(arch_dir)/kernel/init_task.o
head-y := $(arch_dir)/kernel/head.o $(arch_dir)/kernel/init_task.o
core-y += $(arch_dir)/kernel/
libs-y += $(arch_dir)/lib/
......
......@@ -48,7 +48,7 @@ CFLAGS += -fno-reorder-blocks
CFLAGS += -finline-limit=2000
#CFLAGS += -g
HEAD := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
libs-y += arch/x86_64/lib/
core-y += arch/x86_64/kernel/ arch/x86_64/mm/
......
......@@ -211,7 +211,7 @@ ifdef O_TARGET
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) FORCE
......@@ -236,11 +236,20 @@ endif
#
# Rule to link composite objects
#
# Composite objects are specified in kbuild makefile as follows:
# <composite-object>-objs := <list of .o files>
# or
# <composite-object>-y := <list of .o files>
link_multi_deps = \
$(filter $(addprefix $(obj)/, \
$($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
quiet_cmd_link_multi-y = LD $@
cmd_link_multi-y = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)
# We would rather have a list of rules like
# foo.o: $(foo-objs)
......@@ -264,7 +273,7 @@ targets += $(multi-used-y) $(multi-used-m)
ifndef CONFIG_MODVERSIONS
quiet_cmd_link_module = LD [M] $@
cmd_link_module = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o
cmd_link_module = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o
# Don't rebuilt vermagic.o unless we actually are in the init/ dir
ifneq ($(obj),init)
......
......@@ -128,6 +128,7 @@ hostc_flags = -Wp,-MD,$(depfile) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS)\
$(HOSTCFLAGS_$(*F).o)
hostcxx_flags = -Wp,-MD,$(depfile) $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS)\
$(HOSTCXXFLAGS_$(*F).o)
ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS)
# Finds the multi-part object the current object will be linked into
modname-multi = $(sort $(foreach m,$(multi-used),\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment