Commit 51188b23 authored by Sam Ravnborg's avatar Sam Ravnborg

Merge mars.ravnborg.org:/home/sam/bk/linux-2.6

into mars.ravnborg.org:/home/sam/bk/sepout
parents 157e3d70 e272a0c6
...@@ -4,3 +4,5 @@ kconfig-language.txt ...@@ -4,3 +4,5 @@ kconfig-language.txt
- specification of Config Language, the language in Kconfig files - specification of Config Language, the language in Kconfig files
makefiles.txt makefiles.txt
- developer information for linux kernel makefiles - developer information for linux kernel makefiles
modules.txt
- how to build modules and to install them
For now this is a raw copy from the old Documentation/modules.txt,
which was removed in 2.6.0-test5.
The information herein is correct but not complete.
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.
This diff is collapsed.
...@@ -108,11 +108,26 @@ SOFTWARE REQUIREMENTS ...@@ -108,11 +108,26 @@ SOFTWARE REQUIREMENTS
you can just update packages when obvious problems arise during you can just update packages when obvious problems arise during
build or operation. build or operation.
CONFIGURING the kernel: BUILD directory for the kernel:
When compiling the kernel all output files will per default be
stored together with the kernel source code.
Using the option "make O=output/dir" allow you to specify an alternate
place for the output files (including .config).
Example:
kernel source code: /usr/src/linux-2.6.N
build directory: /home/name/build/kernel
To configure and build the kernel use:
cd /usr/src/linux-2.6.N
make O=/home/name/build/kernel menuconfig
make O=/home/name/build/kernel
sudo make O=/home/name/build/kernel install_modules install
- Do a "make config" to configure the basic kernel. "make config" needs Please note: If the 'O=output/dir' option is used then it must be
bash to work: it will search for bash in $BASH, /bin/bash and /bin/sh used for all invocations of make.
(in that order), so one of those must be correct for it to work.
CONFIGURING the kernel:
Do not skip this step even if you are only upgrading one minor Do not skip this step even if you are only upgrading one minor
version. New configuration options are added in each release, and version. New configuration options are added in each release, and
......
...@@ -99,4 +99,4 @@ zlilo: $(BOOTIMAGE) ...@@ -99,4 +99,4 @@ zlilo: $(BOOTIMAGE)
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
install: $(BOOTIMAGE) install: $(BOOTIMAGE)
sh $(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
...@@ -58,10 +58,6 @@ bzImage: zImage ...@@ -58,10 +58,6 @@ bzImage: zImage
$(BOOT_TARGETS): vmlinux $(BOOT_TARGETS): vmlinux
$(Q)$(MAKE) $(build)=arch/ppc/boot $@ $(Q)$(MAKE) $(build)=arch/ppc/boot $@
%_config: arch/ppc/configs/%_defconfig
rm -f .config arch/ppc/defconfig
cp -f arch/ppc/configs/$(@:config=defconfig) .config
archclean: archclean:
$(Q)$(MAKE) $(clean)=arch/ppc/boot $(Q)$(MAKE) $(clean)=arch/ppc/boot
......
...@@ -41,10 +41,6 @@ boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm ...@@ -41,10 +41,6 @@ boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm
$(boottarget-y): vmlinux $(boottarget-y): vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
%_config: arch/ppc64/configs/%_defconfig
rm -f .config arch/ppc64/defconfig
cp -f arch/ppc64/configs/$(@:config=defconfig) arch/ppc64/defconfig
bootimage-$(CONFIG_PPC_PSERIES) := zImage bootimage-$(CONFIG_PPC_PSERIES) := zImage
bootimage-$(CONFIG_PPC_ISERIES) := vmlinux.sm bootimage-$(CONFIG_PPC_ISERIES) := vmlinux.sm
BOOTIMAGE := $(bootimage-y) BOOTIMAGE := $(bootimage-y)
......
...@@ -14,6 +14,16 @@ include $(obj)/Makefile ...@@ -14,6 +14,16 @@ include $(obj)/Makefile
include scripts/Makefile.lib include scripts/Makefile.lib
ifneq ($(KBUILD_SRC),)
# Create output directory if not already present
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
# Create directories for object files if directory does not exist
# Needed when obj-y := dir/file.o syntax is used
_dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
endif
ifdef EXTRA_TARGETS ifdef EXTRA_TARGETS
$(warning kbuild: $(obj)/Makefile - Usage of EXTRA_TARGETS is obsolete in 2.5. Please fix!) $(warning kbuild: $(obj)/Makefile - Usage of EXTRA_TARGETS is obsolete in 2.5. Please fix!)
endif endif
......
...@@ -63,4 +63,4 @@ cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) ...@@ -63,4 +63,4 @@ cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir # Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
# Usage: # Usage:
# $(Q)$(MAKE) $(clean)=dir # $(Q)$(MAKE) $(clean)=dir
clean := -f scripts/Makefile.clean obj clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
...@@ -58,6 +58,11 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) ...@@ -58,6 +58,11 @@ multi-objs := $(multi-objs-y) $(multi-objs-m)
# in the local directory # in the local directory
subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
# $(obj-dirs) is a list of directories that contain object files
obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
obj-dirs += $(foreach f,$(host-progs), $(if $(dir $(f)),$(dir $(f))))
obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
# Replace multi-part objects by their individual parts, look at local dir only # Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
...@@ -107,6 +112,7 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) ...@@ -107,6 +112,7 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
host-progs := $(addprefix $(obj)/,$(host-progs)) host-progs := $(addprefix $(obj)/,$(host-progs))
host-csingle := $(addprefix $(obj)/,$(host-csingle)) host-csingle := $(addprefix $(obj)/,$(host-csingle))
host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
...@@ -129,15 +135,46 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d) ...@@ -129,15 +135,46 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
# where foo and bar are the name of the modules. # where foo and bar are the name of the modules.
basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))) modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
$(basename_flags) $(modname_flags) _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS)\ _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o)
hostc_flags = -Wp,-MD,$(depfile) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS)\ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
$(HOSTCFLAGS_$(*F).o)
hostcxx_flags = -Wp,-MD,$(depfile) $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS)\
$(HOSTCXXFLAGS_$(*F).o) # If building the kernel in a separate objtree expand all occurrences
# of -Idir to -Idir -I$(srctree)/dir.
# hereby allowing gcc to locate files in both trees. Local tree first.
ifeq ($(KBUILD_SRC),)
__c_flags = $(_c_flags)
__a_flags = $(_a_flags)
__hostc_flags = $(_hostc_flags)
__hostcxx_flags = $(_hostcxx_flags)
else
flags = $(foreach o,$($(1)),\
$(if $(filter -I%,$(o)),$(patsubst -I%,-I$(srctree)/%,$(o)),$(o)))
# -I$(obj) locate generated .h files
# -I$(srctree)/$(src) locate .h files in srctree, from generated .c files
# FIXME: Replace both with specific EXTRA_CFLAGS statements
__c_flags = -I$(obj) -I$(srctree)/$(src) $(call flags,_c_flags)
__a_flags = $(call flags,_a_flags)
__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
__hostcxx_flags = $(call flags,_hostcxx_flags)
endif
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
$(__c_flags) $(modkern_cflags) \
$(basename_flags) $(modname_flags)
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
$(__a_flags) $(modkern_aflags)
hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS)
# Finds the multi-part object the current object will be linked into # Finds the multi-part object the current object will be linked into
...@@ -225,14 +262,14 @@ if_changed_rule = $(if $(strip $? \ ...@@ -225,14 +262,14 @@ if_changed_rule = $(if $(strip $? \
# If quiet is set, only print short version of command # If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) cmd = @$(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
# $(call descend,<dir>,<target>) # $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target> # Recursively call a sub-make in <dir> with target <target>
# Usage is deprecated, because make do not see this as an invocation of make. # Usage is deprecated, because make do not see this as an invocation of make.
descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2) descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
# Usage: # Usage:
# $(Q)$(MAKE) $(build)=dir # $(Q)$(MAKE) $(build)=dir
build := -f scripts/Makefile.build obj build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
...@@ -35,7 +35,7 @@ targets += $(modules) ...@@ -35,7 +35,7 @@ targets += $(modules)
# Compile version info for unresolved symbols # Compile version info for unresolved symbols
quiet_cmd_cc_o_c = CC $@ quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) -Wp,-MD,$(depfile) $(CFLAGS) $(CFLAGS_MODULE) \ cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \
-c -o $@ $< -c -o $@ $<
$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE $(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
......
...@@ -40,6 +40,9 @@ allmodconfig: $(obj)/conf ...@@ -40,6 +40,9 @@ allmodconfig: $(obj)/conf
defconfig: $(obj)/conf defconfig: $(obj)/conf
$< -d arch/$(ARCH)/Kconfig $< -d arch/$(ARCH)/Kconfig
%_defconfig: $(obj)/conf
$(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig
# Help text used by make help # Help text used by make help
help: help:
@echo ' oldconfig - Update current config utilising a line-oriented program' @echo ' oldconfig - Update current config utilising a line-oriented program'
......
...@@ -26,6 +26,7 @@ enum { ...@@ -26,6 +26,7 @@ enum {
set_no, set_no,
set_random set_random
} input_mode = ask_all; } input_mode = ask_all;
char *defconfig_file;
static int indent = 1; static int indent = 1;
static int valid_stdin = 1; static int valid_stdin = 1;
...@@ -483,11 +484,12 @@ static void check_conf(struct menu *menu) ...@@ -483,11 +484,12 @@ static void check_conf(struct menu *menu)
int main(int ac, char **av) int main(int ac, char **av)
{ {
int i = 1;
const char *name; const char *name;
struct stat tmpstat; struct stat tmpstat;
if (ac > 1 && av[1][0] == '-') { if (ac > i && av[i][0] == '-') {
switch (av[1][1]) { switch (av[i++][1]) {
case 'o': case 'o':
input_mode = ask_new; input_mode = ask_new;
break; break;
...@@ -498,6 +500,15 @@ int main(int ac, char **av) ...@@ -498,6 +500,15 @@ int main(int ac, char **av)
case 'd': case 'd':
input_mode = set_default; input_mode = set_default;
break; break;
case 'D':
input_mode = set_default;
defconfig_file = av[i++];
if (!defconfig_file) {
printf("%s: No default config file specified\n",
av[0]);
exit(1);
}
break;
case 'n': case 'n':
input_mode = set_no; input_mode = set_no;
break; break;
...@@ -516,18 +527,21 @@ int main(int ac, char **av) ...@@ -516,18 +527,21 @@ int main(int ac, char **av)
printf("%s [-o|-s] config\n", av[0]); printf("%s [-o|-s] config\n", av[0]);
exit(0); exit(0);
} }
name = av[2]; }
} else name = av[i];
name = av[1]; if (!name) {
printf("%s: Kconfig file missing\n", av[0]);
}
conf_parse(name); conf_parse(name);
//zconfdump(stdout); //zconfdump(stdout);
switch (input_mode) { switch (input_mode) {
case set_default: case set_default:
name = conf_get_default_confname(); if (!defconfig_file)
if (conf_read(name)) { defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) {
printf("***\n" printf("***\n"
"*** Can't find default configuration \"%s\"!\n" "*** Can't find default configuration \"%s\"!\n"
"***\n", name); "***\n", defconfig_file);
exit(1); exit(1);
} }
break; break;
......
...@@ -27,7 +27,7 @@ echo "Summary: The Linux Kernel" ...@@ -27,7 +27,7 @@ echo "Summary: The Linux Kernel"
echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g" echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g"
# we need to determine the NEXT version number so that uname and # we need to determine the NEXT version number so that uname and
# rpm -q will agree # rpm -q will agree
echo "Release: `. scripts/mkversion`" echo "Release: `. $srctree/scripts/mkversion`"
echo "License: GPL" echo "License: GPL"
echo "Group: System Environment/Kernel" echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community" echo "Vendor: The Linux Community"
...@@ -45,7 +45,7 @@ echo "%prep" ...@@ -45,7 +45,7 @@ echo "%prep"
echo "%setup -q" echo "%setup -q"
echo "" echo ""
echo "%build" echo "%build"
echo "make clean oldconfig all" echo "make clean all"
echo "" echo ""
echo "%install" echo "%install"
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules'
......
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