* Updated README.

* Mostly implemented all necessary target. Does not
  build yet and a number of problems still need to
  be resolved (see debian/rules for details).

svn path=/branches/kernel-image-2.6.11/; revision=3104
This commit is contained in:
Jurij Smakov 2005-05-14 05:55:07 +00:00
parent 754c6795b1
commit 93519f0dce
4 changed files with 164 additions and 94 deletions

71
README
View File

@ -46,42 +46,61 @@ this file include the setting of the following variables:
include_common_config include_common_config
Setting it to 'no' will prevent the common kernel config from being Setting it to 'no' will prevent the common kernel config from being
included for this particular architecture. included for this particular architecture. Typical usage:
header_dirs include_common_config := no
headers_dirs
This variable is substituted into the headers-install script, This variable is substituted into the headers-install script,
controlling which asm-* directories are included into the controlling which asm-* directories are included into the
kernel-headers package. By default it is set to karch (see kernel-headers package. By default it is set to karch (see
above). For sparc, for example, if will have to be set to above). See header-install.in file for detail. Typical usage:
'sparc | sparc64' for the correct packages to be generated. See
headers-install file for details. headers_dirs := sparc | sparc64
arch_makeflags headers_subarch
The subarch to pass to the --subarch option for the make-kpkg
call to build the kernel-headers. Typical usage:
headers_subarch := sparc64
added_patches
Setting this variable to non-empty value will cause an option
--added_patches to be added to the make-kpkg 'build' and
'kernel-image' calls. The value of the variable will be
given as an argument for the --added-patchs option. The value
of this variable may contain a special string @uver@ which
is going to be expanded into the upstream kernel's version
with dots replaced by underscores (for example, 2_6_11 for the
kernel version 2.6.11). Typical usage:
added_patches := debian,hppa-@uver@
build_subarch
Setting this variable to non-empty value will cause an option
--subarch to be added to 'build' and 'kernel-image' make-kpkg
calls, followed by the flavour for which the kernel is built.
In general, if you wish to add subarch support for your
architecture, you should contact kernel-package maintainer
to ensure that the flavour name correctly maps onto a kernel
subarch name. Currently only mips and sparc are using this
facility, and both of them should be fine. Typical usage:
build_subarch := yes
Note that the value of this variable is ignored.
build_makeflags
This variable may contain the make flags settings for the This variable may contain the make flags settings for the
make-kpkg invocation in the 'build' target. Currently it is make-kpkg invocation in the 'build' target. Currently it is
only used by amd64, where it should be set to something like only used by amd64, where it should be set to something like
arch_makeflags = 'CC=amd64-linux-gcc V=1" build_makeflags := 'CC=amd64-linux-gcc V=1'
added_patches The value of the variable must be properly quoted.
Setting this variable to non-empty value will cause an option
--added_patches to be added to the make-kpkg call in 'build'
target, followed by the contents of this variable. Currently
hppa is using it and it looks like ia64 have used it before.
arch_with_subarch
Setting this variable to non-empty value will cause an option
--subarch to be added to make-kpkg call in 'build' target,
followed by the flavour for which the kernel is built. NOTE
that the contents of this variable are completely ignored,
any non-empty value indicates that --subarch option should
be added. In general, if you wish to add subarch support for
your architecture, you should contact kernel-package maintainer
to ensure that the flavour name correctly maps onto a kernel
subarch name. Currently only mips and sparc are using this
facility, and both of them should be fine.

View File

@ -2,6 +2,3 @@
# Variables # Variables
# #
include_common_config = no include_common_config = no
added_patches = blah
arch_with_subarch = yes
arch_makeflags = 'CC=gcc-2.95'

184
debian/rules vendored
View File

@ -1,101 +1,155 @@
#!/usr/bin/make -f #!/usr/bin/make -f
# #
version = 2.6.11 # Required variables
abiname = 1 #
ktver = 2 version := 2.6.11
kbuildver = 2.6-3 abiname := 1
ktver := 2
kbuildver := 2.6-3
# #
# Generally nothing needs to be modified below this line # Generally nothing needs to be modified below this line
# #
debver = $(version)-$(abiname) debver := $(version)-$(abiname)
debnum = -$(abiname) uver := $(subst .,_,$(version))
appvan = --append_to_version $(debnum) debnum := -$(abiname)
bpkg = kernel-build-$(debver) bpkg := kernel-build-$(debver)
kdir = kernel-source-$(version) kdir := kernel-source-$(version)
kbpkg = kernel-kbuild-$(kbuildver) kbpkg := kernel-kbuild-$(kbuildver)
kpatch = /usr/src/kernel-patches/all/$(version)/apply/debian kpatch := /usr/src/kernel-patches/all/$(version)/apply/debian
DEBIAN_SRCTOP = $(CURDIR)/$(kdir) export DEBIAN_SRCTOP := $(CURDIR)/$(kdir)
DEBIAN_UPSTREAM_VERSION = $(version) export DEBIAN_UPSTREAM_VERSION := $(version)
ifeq (,$(DEB_HOST_ARCH)) ifeq (,$(DEB_HOST_ARCH))
DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH) DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
endif endif
#
# The CROSS variable is only used on sparc to call
# the correct 'strip' binary on the kernel-image.
# Not sure whether we really need it.
#
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
CROSS = $(DEB_HOST_ARCH)-linux- CROSS := $(DEB_HOST_ARCH)-linux-
endif endif
karch = $(DEB_HOST_ARCH) karch := $(DEB_HOST_ARCH)
controls = $(wildcard arch/*/control.in) controls := $(wildcard arch/*/control.in)
configs = $(notdir $(wildcard arch/$(karch)/config.*)) configs := $(notdir $(wildcard arch/$(karch)/config.*))
ifndef flavours ifndef flavours
flavours = $(filter-out common, $(patsubst config.%,%,$(configs))) flavours := $(filter-out common, $(patsubst config.%,%,$(configs)))
endif endif
-include arch/$(karch)/Makefile.inc -include arch/$(karch)/Makefile.inc
#
ifndef header_dirs # Here we construct the command lines for different make-kpkg
header_dirs = $(karch) # calls (build, kernel-image, kernel-headers) based on the values
# of variables defined so far and provided by the architecture
# in Makefile.inc. Note that $$i in these expressions is going to
# become a reference to the shell variable $i, which is expected
# to have the current flavour. This is slightly evil, but saves
# a lot of grief.
#
kpkg_headers_cmd := HEADER_CLEAN_HOOK='$(CURDIR)/header-install' make-kpkg
kpkg_headers_cmd += --append-to-version $(debnum)
kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-$$i
ifdef added_patches
kpkg_headers_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches))
kpkg_build_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches))
endif
ifdef build_subarch
kpkg_build_cmd += --subarch $$i
endif
ifdef headers_subarch
kpkg_headers_cmd += --subarch $(headers_subarch)
endif
ifdef build_makeflags
kpkg_build_cmd := MAKEFLAGS=$(build_makeflags) $(kpkg_build_cmd)
endif
kpkg_image_cmd := $(kpkg_build_cmd) --initrd kernel_image
kpkg_build_cmd += build
kpkg_headers_cmd += kernel-headers
ifndef headers_dirs
headers_dirs = $(karch)
endif endif
# #
# Unresolved issues: # Problems:
# Where does the default config comes from? # * What to do with default config?
# TODO:
# * Check that make oldconfig does not actually
# change the config file. If it does, something
# is wrong (missing/extra options, etc).
# #
unpack: unpack-stamp unpack: unpack-stamp
unpack-stamp: $(kdir) $(configs) header-install.out unpack-stamp: $(kdir) $(configs) header-install
for i in $(flavours); do \ for i in $(flavours); do \
cp -al $(kdir) build-$$i; \ cp -al $(kdir) build-$$i; \
cp config.$$i build-$$i/.config; \ cp config.$$i build-$$i/.config; \
make -C build-$$i ARCH=$(karch) oldconfig; \ make -C build-$$i ARCH=$(karch) oldconfig; \
done done
# cp default $(kdir)/.config
ln -s $$(command -v touch) bin/touch.orig ln -s $$(command -v touch) bin/touch.orig
touch unpack-stamp touch unpack-stamp
# #
# Subarch usage: # Problems:
# Currently only mips and sparc are calling make-kpkg # * m68k,mips have no-op build targets
# with --subarch. mips is just using the names of the # * sparc strips parts of the kernel after building
# flavours, while for sparc it is more complicated. # otherwise it is too big for silo to boot.
# After looking at /usr/share/kernel-package/rules, I # TODO:
# believe that everything will work correctly in sparc # * Implement optional stripping of the kernel
# if use flavour as an argument to subarch. # (for sparc).
# # * Check that it is really ok to call --subarch
# Unresolved issues: # with the name of the flavour. For mips which
# m68k,mips have no-op build targets # is another --subarch user it should be fine.
# How to handle subarch (mips, sparc)?
# What's the deal with sparc trying to strip
# the kernel and copy System.map?
# #
build: build-stamp build: build-stamp
build-stamp: unpack-stamp build-stamp: unpack-stamp
dh_testdir dh_testdir
PATH=$$PWD/bin:$$PATH; \ PATH=$$PWD/bin:$$PATH; \
for i in $(flavours); do \ for i in $(flavours); do \
cd build-$$i; \ cd build-$$i; \
OPTS="--append_to_version $(debnum)-$$i"; \ $(kpkg_build_cmd); \
if [ -n '$(added_patches)' ]; then \ cd ..; \
OPTS="$${OPTS} --added_patches $(added_patches)"; \
fi; \
if [ -n '$(arch_with_subarch)' ]; then \
OPTS="$${OPTS} --subarch $$i"; \
fi; \
MAKEFLAGS='$(arch_makeflags)' make-kpkg $${OPTS}; \
cd ..; \
done done
touch build-stamp touch build-stamp
clean: clean:
rm -f *-stamp header-install.out config.* rm -f *-stamp header-install config.*
rm -rf $(kdir) build-* install-* bin/touch.orig rm -rf $(kdir) build-* install-* bin/touch.orig
dh_clean dh_clean
header-install.out: header-install binary-indep: build
sed -e 's/@kbpkg@/$(kbpkg)/g' \ #
-e 's/@karch@/$(karch)/g' \ # Problems:
-e 's/@header_dirs@/$(header_dirs)/g' \ # * sparc prepends the 'kernel-image' make-kpkg call
header-install > header-install.out # by 'sparc32' and 'sparc64', depending on the flavour.
chmod u+x header-install.out # Need to figure out the role of these binaries.
#
binary-arch: build
dh_testdir
dh_clean -k
dh_installdirs
cd $(kdir); $(kpkg_headers_cmd)
mv $(kdir)/debian/files debian
for i in $(flavours); do \
cp -al build-$$i install-$$i; \
cd install-$$i; \
$(kpkg_image_cmd); \
cd ..; \
cat install-$$i/debian/files >> debian/files \
rm -rf install-$$i
done
mv *.deb ..
binary: binary-indep binary-arch
header-install: header-install.in
sed -e 's/@kbpkg@/$(kbpkg)/g' \
-e 's/@karch@/$(karch)/g' \
-e 's/@headers_dirs@/$(headers_dirs)/g' \
header-install.in > header-install
chmod u+x header-install
# #
# Generates the kernel config file for a subarch by merging # Generates the kernel config file for a subarch by merging
# the arch-independent config file (arch/config.common), # the arch-independent config file (arch/config.common),
@ -123,7 +177,7 @@ config.%:
cat $${include} > $@ cat $${include} > $@
@echo " done." @echo " done."
# #
# Prepare debian/control by cat'ing together all the # Prepares debian/control by cat'ing together all the
# control files, substituting variables, removing all # control files, substituting variables, removing all
# empty lines and inserting a newline before every # empty lines and inserting a newline before every
# line starting with 'Package:' # line starting with 'Package:'