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
module outside the kernel is to use the kernel build system,
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
Documentation/kbuild/makefiles.txt. Read that file for more details on
......@@ -65,4 +65,4 @@ yourmodule-objs := file1.o file2.o file3.o
# Invokes the kernel build system to come back to the current
# directory and build yourmodule.ko.
default:
make -C ${KERNEL_SOURCE} SUBDIRS=`pwd` modules
make -C ${KERNEL_SOURCE} M=`pwd` modules
......@@ -53,7 +53,7 @@ ifndef KBUILD_CHECKSRC
KBUILD_CHECKSRC = 0
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
# Setting the environment variable KBUILD_EXTMOD take precedence
ifdef SUBDIRS
......@@ -130,16 +130,6 @@ else
_all: modules
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))
TOPDIR := $(srctree)
# FIXME - TOPDIR is obsolete, use srctree/objtree
......@@ -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) ;
# 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)
$(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
# or the modules are listed in "prepare-all".
# A multi level approach is used. prepare1 is updated first, then prepare0.
# 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,
# and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree)
# 2) Create the include2 directory, used for the second asm symlink
prepare1:
prepare1: prepare2
ifneq ($(KBUILD_SRC),)
@echo ' Using $(srctree) as source for kernel'
$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
......@@ -760,9 +769,13 @@ _modinst_:
sleep 1; \
fi
@rm -rf $(MODLIB)/kernel
@rm -f $(MODLIB)/build
@rm -f $(MODLIB)/source
@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
# If System.map exists, run depmod. This deliberately does not have a
......@@ -1009,19 +1022,19 @@ endif # KBUILD_EXTMOD
# ---------------------------------------------------------------------------
define all-sources
( find . $(RCS_FIND_IGNORE) \
( find $(srctree) $(RCS_FIND_IGNORE) \
\( -name include -o -name arch \) -prune -o \
-name '*.[chS]' -print; \
find arch/$(ARCH) $(RCS_FIND_IGNORE) \
find $(srctree)/arch/$(ARCH) $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print; \
find security/selinux/include $(RCS_FIND_IGNORE) \
find $(srctree)/security/selinux/include $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print; \
find include $(RCS_FIND_IGNORE) \
find $(srctree)/include $(RCS_FIND_IGNORE) \
\( -name config -o -name 'asm-*' \) -prune \
-o -name '*.[chS]' -print; \
find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
find $(srctree)/include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print; \
find include/asm-generic $(RCS_FIND_IGNORE) \
find $(srctree)/include/asm-generic $(RCS_FIND_IGNORE) \
-name '*.[chS]' -print )
endef
......
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
bool "Prevent firmware from being built"
default y
......
......@@ -41,15 +41,6 @@ config CLEAN_COMPILE
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
bool
depends on !CLEAN_COMPILE
......
......@@ -5,24 +5,11 @@
# docproc: Preprocess .tmpl file in order to generate .sgml docs
# conmakehash: Create arrays for initializing the kernel console tables
host-progs := conmakehash kallsyms modpost mk_elfconfig pnmtologo bin2c
always := $(host-progs) empty.o
modpost-objs := modpost.o file2alias.o sumversion.o
host-progs := conmakehash kallsyms pnmtologo bin2c
always := $(host-progs)
subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-y += mod
# Let clean descend into subdirs
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)
# Step 2), invoke modpost
# Includes step 3,4
quiet_cmd_modpost = MODPOST
cmd_modpost = scripts/modpost \
cmd_modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \
$(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;
/* Big exception to the "don't include kernel headers into userspace, which
* even potentially has different endianness and word sizes, since
* we handle those differences explicitly below */
#include "../include/linux/mod_devicetable.h"
#include "../../include/linux/mod_devicetable.h"
#define ADD(str, sep, cond, field) \
do { \
......
......@@ -31,9 +31,10 @@ KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE))
MKSPEC := $(srctree)/scripts/package/mkspec
PREV := set -e; cd ..;
# rpm-pkg
.PHONY: rpm-pkg rpm
$(objtree)/kernel.spec: $(MKSPEC)
$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) > $@
rpm-pkg rpm: $(objtree)/kernel.spec
......@@ -52,6 +53,22 @@ rpm-pkg rpm: $(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
# ---------------------------------------------------------------------------
#
......@@ -67,5 +84,6 @@ clean-rule += && rm -rf $(objtree)/debian/
# ---------------------------------------------------------------------------
help:
@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'
......@@ -9,6 +9,13 @@
# 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
if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
PROVIDES=kernel-drm
......@@ -26,8 +33,12 @@ echo "License: GPL"
echo "Group: System Environment/Kernel"
echo "Vendor: The Linux Community"
echo "URL: http://www.kernel.org"
if ! $PREBUILT; then
echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL"
echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g"
fi
echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
echo "Provides: $PROVIDES"
echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
......@@ -36,12 +47,20 @@ echo ""
echo "%description"
echo "The Linux Kernel, the operating system core itself"
echo ""
if ! $PREBUILT; then
echo "%prep"
echo "%setup -q"
echo ""
fi
echo "%build"
if ! $PREBUILT; then
echo "make clean && make"
echo ""
fi
echo "%install"
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