kbuild, deb-pkg: support overriding userland architecture
Asbjoern Sloth Toennesen [Sun, 12 Dec 2010 17:39:40 +0000 (17:39 +0000)]
Usefull if building for sparc64 userland, because the
sparc and sparc64 userlands use the same 64-bit kernel,
making it impossible to always select the correct userland
architecture for the resulting debian package.

Might also be usefull, if you want a i386 userland with a amd64 kernel.

Example usage:
make KBUILD_DEBARCH=i386 deb-pkg

LKML-reference: <alpine.DEB.2.02.1011051437500.13287@aurora.sdinet.de>
Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.biz>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: maximilian attems <max@stro.at>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Documentation/kbuild/kbuild.txt
scripts/package/builddeb

index 634c625..b146eb8 100644 (file)
@@ -51,6 +51,14 @@ Specify the output directory when building the kernel.
 The output directory can also be specificed using "O=...".
 Setting "O=..." takes precedence over KBUILD_OUTPUT.
 
+KBUILD_DEBARCH
+--------------------------------------------------
+For the deb-pkg target, allows overriding the normal heuristics deployed by
+deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
+the UTS_MACHINE variable, and on some architectures also the kernel config.
+The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
+architecture.
+
 ARCH
 --------------------------------------------------
 Set ARCH to the architecture to be built.
index 5d6be3f..ffe2419 100644 (file)
@@ -54,6 +54,9 @@ create_package() {
                echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
                echo "" >&2
        esac
+       if [ -n "$KBUILD_DEBARCH" ] ; then
+               debarch="$KBUILD_DEBARCH"
+       fi
        if [ -n "$debarch" ] ; then
                forcearch="-DArchitecture=$debarch"
        fi