Commit 81cae4d4 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-sam.bkbits.net/kbuild

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents a6c13231 e09e5886
...@@ -23,7 +23,7 @@ with changes in the build system the most portable way to compile a ...@@ -23,7 +23,7 @@ with changes in the build system the most portable way to compile a
module outside the kernel is to use the kernel build system, module outside the kernel is to use the kernel build system,
kbuild. Use the following command-line: kbuild. Use the following command-line:
make -C path/to/kernel/src SUBDIRS=$PWD modules make -C path/to/kernel/src M=$PWD modules
This requires that a makefile exits made in accordance to This requires that a makefile exits made in accordance to
Documentation/kbuild/makefiles.txt. Read that file for more details on Documentation/kbuild/makefiles.txt. Read that file for more details on
...@@ -65,4 +65,4 @@ yourmodule-objs := file1.o file2.o file3.o ...@@ -65,4 +65,4 @@ yourmodule-objs := file1.o file2.o file3.o
# Invokes the kernel build system to come back to the current # Invokes the kernel build system to come back to the current
# directory and build yourmodule.ko. # directory and build yourmodule.ko.
default: default:
make -C ${KERNEL_SOURCE} SUBDIRS=`pwd` modules make -C ${KERNEL_SOURCE} M=`pwd` modules
...@@ -53,7 +53,7 @@ ifndef KBUILD_CHECKSRC ...@@ -53,7 +53,7 @@ ifndef KBUILD_CHECKSRC
KBUILD_CHECKSRC = 0 KBUILD_CHECKSRC = 0
endif endif
# Use make M=dir to specify direcotry of external module to build # Use make M=dir to specify directory of external module to build
# Old syntax make ... SUBDIRS=$PWD is still supported # Old syntax make ... SUBDIRS=$PWD is still supported
# Setting the environment variable KBUILD_EXTMOD take precedence # Setting the environment variable KBUILD_EXTMOD take precedence
ifdef SUBDIRS ifdef SUBDIRS
...@@ -130,16 +130,6 @@ else ...@@ -130,16 +130,6 @@ else
_all: modules _all: modules
endif endif
# Make sure we're not wasting cpu-cycles doing locale handling, yet do make
# sure error messages appear in the user-desired language
ifdef LC_ALL
LANG := $(LC_ALL)
LC_ALL :=
endif
LC_COLLATE := C
LC_CTYPE := C
export LANG LC_ALL LC_COLLATE LC_CTYPE
srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
TOPDIR := $(srctree) TOPDIR := $(srctree)
# FIXME - TOPDIR is obsolete, use srctree/objtree # FIXME - TOPDIR is obsolete, use srctree/objtree
...@@ -621,25 +611,44 @@ vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE ...@@ -621,25 +611,44 @@ vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
$(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds.s: $(vmlinux-dirs) ; $(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds.s: $(vmlinux-dirs) ;
# Handle descending into subdirectories listed in $(vmlinux-dirs) # Handle descending into subdirectories listed in $(vmlinux-dirs)
# Preset locale variables to speed up the build process. Limit locale
# tweaks to this spot to avoid wrong language settings when running
# make menuconfig etc.
# Error messages still appears in the original language
.PHONY: $(vmlinux-dirs) .PHONY: $(vmlinux-dirs)
$(vmlinux-dirs): prepare-all scripts $(vmlinux-dirs): prepare-all scripts
$(Q)$(MAKE) $(build)=$@ $(Q)if [ ! -z $$LC_ALL ]; then \
export LANG=$$LC_ALL; \
export LC_ALL= ; \
fi; \
export LC_COLLATE=C; export LC_CTYPE=C; \
$(MAKE) $(build)=$@
# Things we need to do before we recursively start building the kernel # Things we need to do before we recursively start building the kernel
# or the modules are listed in "prepare-all". # or the modules are listed in "prepare-all".
# A multi level approach is used. prepare1 is updated first, then prepare0. # A multi level approach is used. prepare1 is updated first, then prepare0.
# prepare-all is the collection point for the prepare targets. # prepare-all is the collection point for the prepare targets.
.PHONY: prepare-all prepare prepare0 prepare1 .PHONY: prepare-all prepare prepare0 prepare1 prepare2
# prepare 2 generate Makefile to be placed in output directory, if
# using a seperate output directory. This allows convinient use
# of make in output directory
prepare2:
$(Q)if [ ! $(srctree) -ef $(objtree) ]; then \
$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \
> $(objtree)/Makefile; \
fi
# prepare1 is used to check if we are building in a separate output directory, # prepare1 is used to check if we are building in a separate output directory,
# and if so do: # and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree) # 1) Check that make has not been executed in the kernel src $(srctree)
# 2) Create the include2 directory, used for the second asm symlink # 2) Create the include2 directory, used for the second asm symlink
prepare1: prepare1: prepare2
ifneq ($(KBUILD_SRC),) ifneq ($(KBUILD_SRC),)
@echo ' Using $(srctree) as source for kernel' @echo ' Using $(srctree) as source for kernel'
$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \ $(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
...@@ -760,9 +769,13 @@ _modinst_: ...@@ -760,9 +769,13 @@ _modinst_:
sleep 1; \ sleep 1; \
fi fi
@rm -rf $(MODLIB)/kernel @rm -rf $(MODLIB)/kernel
@rm -f $(MODLIB)/build @rm -f $(MODLIB)/source
@mkdir -p $(MODLIB)/kernel @mkdir -p $(MODLIB)/kernel
@ln -s $(TOPDIR) $(MODLIB)/build @ln -s $(srctree) $(MODLIB)/source
@if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
rm -f $(MODLIB)/build ; \
ln -s $(objtree) $(MODLIB)/build ; \
fi
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a # If System.map exists, run depmod. This deliberately does not have a
...@@ -1009,19 +1022,19 @@ endif # KBUILD_EXTMOD ...@@ -1009,19 +1022,19 @@ endif # KBUILD_EXTMOD
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
define all-sources define all-sources
( find . $(RCS_FIND_IGNORE) \ ( find $(srctree) $(RCS_FIND_IGNORE) \
\( -name include -o -name arch \) -prune -o \ \( -name include -o -name arch \) -prune -o \
-name '*.[chS]' -print; \ -name '*.[chS]' -print; \
find arch/$(ARCH) $(RCS_FIND_IGNORE) \ find $(srctree)/arch/$(ARCH) $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print; \ -name '*.[chS]' -print; \
find security/selinux/include $(RCS_FIND_IGNORE) \ find $(srctree)/security/selinux/include $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print; \ -name '*.[chS]' -print; \
find include $(RCS_FIND_IGNORE) \ find $(srctree)/include $(RCS_FIND_IGNORE) \
\( -name config -o -name 'asm-*' \) -prune \ \( -name config -o -name 'asm-*' \) -prune \
-o -name '*.[chS]' -print; \ -o -name '*.[chS]' -print; \
find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \ find $(srctree)/include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print; \ -name '*.[chS]' -print; \
find include/asm-generic $(RCS_FIND_IGNORE) \ find $(srctree)/include/asm-generic $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print ) -name '*.[chS]' -print )
endef endef
......
menu "Generic Driver Options" menu "Generic Driver Options"
config STANDALONE
bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
default y
help
Select this option if you don't have magic firmware for drivers that
need it.
If unsure, say Y.
config PREVENT_FIRMWARE_BUILD config PREVENT_FIRMWARE_BUILD
bool "Prevent firmware from being built" bool "Prevent firmware from being built"
default y default y
......
...@@ -41,15 +41,6 @@ config CLEAN_COMPILE ...@@ -41,15 +41,6 @@ config CLEAN_COMPILE
If unsure, say Y If unsure, say Y
config STANDALONE
bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
default y
help
Select this option if you don't have magic firmware for drivers that
need it.
If unsure, say Y.
config BROKEN config BROKEN
bool bool
depends on !CLEAN_COMPILE depends on !CLEAN_COMPILE
......
...@@ -5,24 +5,11 @@ ...@@ -5,24 +5,11 @@
# docproc: Preprocess .tmpl file in order to generate .sgml docs # docproc: Preprocess .tmpl file in order to generate .sgml docs
# conmakehash: Create arrays for initializing the kernel console tables # conmakehash: Create arrays for initializing the kernel console tables
host-progs := conmakehash kallsyms modpost mk_elfconfig pnmtologo bin2c host-progs := conmakehash kallsyms pnmtologo bin2c
always := $(host-progs) empty.o always := $(host-progs)
modpost-objs := modpost.o file2alias.o sumversion.o
subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-y += mod
# Let clean descend into subdirs # Let clean descend into subdirs
subdir- += basic lxdialog kconfig package subdir- += basic lxdialog kconfig package
# dependencies on generated files need to be listed explicitly
$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
quiet_cmd_elfconfig = MKELF $@
cmd_elfconfig = $(obj)/mk_elfconfig $(ARCH) < $< > $@
$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
$(call if_changed,elfconfig)
targets += elfconfig.h
...@@ -50,7 +50,7 @@ _modpost: $(modules) ...@@ -50,7 +50,7 @@ _modpost: $(modules)
# Step 2), invoke modpost # Step 2), invoke modpost
# Includes step 3,4 # Includes step 3,4
quiet_cmd_modpost = MODPOST quiet_cmd_modpost = MODPOST
cmd_modpost = scripts/modpost \ cmd_modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \
$(filter-out FORCE,$^) $(filter-out FORCE,$^)
......
This diff is collapsed.
#!/bin/sh
# Generates a small Makefile used in the root of the output
# directory, to allow make to be started from there.
# The Makefile also allow for more convinient build of external modules
# Usage
# $1 - Kernel src directory
# $2 - Output directory
# $3 - version
# $4 - patchlevel
cat << EOF
# Automatically generated by $0: don't edit
VERSION = $3
PATCHLEVEL = $4
KERNELSRC := $1
KERNELOUTPUT := $2
MAKEFLAGS += --no-print-directory
all:
\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
%::
\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
EOF
host-progs := modpost mk_elfconfig
always := $(host-progs) empty.o
modpost-objs := modpost.o file2alias.o sumversion.o
# dependencies on generated files need to be listed explicitly
$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
quiet_cmd_elfconfig = MKELF $@
cmd_elfconfig = $(obj)/mk_elfconfig $(ARCH) < $< > $@
$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
$(call if_changed,elfconfig)
targets += elfconfig.h
...@@ -27,7 +27,7 @@ typedef unsigned char __u8; ...@@ -27,7 +27,7 @@ typedef unsigned char __u8;
/* Big exception to the "don't include kernel headers into userspace, which /* Big exception to the "don't include kernel headers into userspace, which
* even potentially has different endianness and word sizes, since * even potentially has different endianness and word sizes, since
* we handle those differences explicitly below */ * we handle those differences explicitly below */
#include "../include/linux/mod_devicetable.h" #include "../../include/linux/mod_devicetable.h"
#define ADD(str, sep, cond, field) \ #define ADD(str, sep, cond, field) \
do { \ do { \
......
...@@ -31,9 +31,10 @@ KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE)) ...@@ -31,9 +31,10 @@ KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE))
MKSPEC := $(srctree)/scripts/package/mkspec MKSPEC := $(srctree)/scripts/package/mkspec
PREV := set -e; cd ..; PREV := set -e; cd ..;
# rpm-pkg
.PHONY: rpm-pkg rpm .PHONY: rpm-pkg rpm
$(objtree)/kernel.spec: $(MKSPEC) $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) > $@ $(CONFIG_SHELL) $(MKSPEC) > $@
rpm-pkg rpm: $(objtree)/kernel.spec rpm-pkg rpm: $(objtree)/kernel.spec
...@@ -52,6 +53,22 @@ rpm-pkg rpm: $(objtree)/kernel.spec ...@@ -52,6 +53,22 @@ rpm-pkg rpm: $(objtree)/kernel.spec
clean-rule += rm -f $(objtree)/kernel.spec clean-rule += rm -f $(objtree)/kernel.spec
# binrpm-pkg
.PHONY: binrpm-pkg
$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
binrpm-pkg: $(objtree)/binkernel.spec
$(MAKE)
set -e; \
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
set -e; \
mv -f $(objtree)/.tmp_version $(objtree)/.version
$(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
clean-rule += rm -f $(objtree)/binkernel.spec
# Deb target # Deb target
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# #
...@@ -67,5 +84,6 @@ clean-rule += && rm -rf $(objtree)/debian/ ...@@ -67,5 +84,6 @@ clean-rule += && rm -rf $(objtree)/debian/
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
help: help:
@echo ' rpm-pkg - Build the kernel as an RPM package' @echo ' rpm-pkg - Build the kernel as an RPM package'
@echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules'
@echo ' deb-pkg - Build the kernel as an deb package' @echo ' deb-pkg - Build the kernel as an deb package'
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net> # Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
# #
# how we were called determines which rpms we build and how we build them
if [ "$1" = "prebuilt" ]; then
PREBUILT=true
else
PREBUILT=false
fi
# starting to output the spec # starting to output the spec
if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
PROVIDES=kernel-drm PROVIDES=kernel-drm
...@@ -26,8 +33,12 @@ echo "License: GPL" ...@@ -26,8 +33,12 @@ echo "License: GPL"
echo "Group: System Environment/Kernel" echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community" echo "Vendor: The Linux Community"
echo "URL: http://www.kernel.org" echo "URL: http://www.kernel.org"
if ! $PREBUILT; then
echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL" echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL"
echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g" echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g"
fi
echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root" echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
echo "Provides: $PROVIDES" echo "Provides: $PROVIDES"
echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
...@@ -36,12 +47,20 @@ echo "" ...@@ -36,12 +47,20 @@ echo ""
echo "%description" echo "%description"
echo "The Linux Kernel, the operating system core itself" echo "The Linux Kernel, the operating system core itself"
echo "" echo ""
if ! $PREBUILT; then
echo "%prep" echo "%prep"
echo "%setup -q" echo "%setup -q"
echo "" echo ""
fi
echo "%build" echo "%build"
if ! $PREBUILT; then
echo "make clean && make" echo "make clean && make"
echo "" echo ""
fi
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