Package: kernel-package
Version: 12.036+nmu3
Tags: patch

I am rather new to the arm architecture and currently trying to
get a couple of things working on a Raspberry Pi.  Building
kernel packages natively on a 700MHz single-core ARMv6 cpu takes
ages, so I have been looking into possibilities for
cross-building kernel packages from faster architectures. 
According to the make-kpkg manpage, the following command

  $ make-kpkg --arch armhf --cross_compile arm-rpi-linux-gnueabi- \
    --revision 20131002 --append_to_version -rpi --initrd \
    --us --uc --rootcmd fakeroot kernel_image

should build an armhf kernel package on an amd64 host with an
arm-rpi-linux-gnueabi-crosstoolchain installed. With
kernel-package 12.036+nmu3 this fails with

  debian/ruleset/misc/checks.mk:36: *** Error. I do not know
  where the kernel image goes to [kimagedest undefined] The usual
  case for this is that I could not determine which arch or
  subarch this machine belongs to.  Please specify a subarch, and
  try again..  Stop.

It looks like there are just a few definitions for armhf missing,
which are only used in the case of cross-building - native builds
work fine.  With the attached patch, cross-building kernel
packages for armhf works for me, i.e. it results in working
kernel-image packages for the Raspberry Pi.  I had asked on
debian-arm whether anybody sees issues with the patch, but have
received no reply.

Regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.
diff -Nur kernel-package-12.036+nmu3/kernel/ruleset/arches/armhf.mk kernel-package-12.036+nmu3.patched/kernel/ruleset/arches/armhf.mk
--- kernel-package-12.036+nmu3/kernel/ruleset/arches/armhf.mk	1970-01-01 01:00:00.000000000 +0100
+++ kernel-package-12.036+nmu3.patched/kernel/ruleset/arches/armhf.mk	2013-10-02 22:02:47.000000000 +0200
@@ -0,0 +1,34 @@
+######################### -*- Mode: Makefile-Gmake -*- ########################
+## armhf.mk --- 
+## 
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+###############################################################################
+
+### ARMHF
+ifeq ($(strip $(architecture)),armhf)
+  kimage := vmlinuz
+  target = zImage
+  NEED_DIRECT_GZIP_IMAGE=NO
+  kimagesrc = arch/$(KERNEL_ARCH)/boot/zImage
+  kimagedest = $(INT_IMAGE_DESTDIR)/vmlinuz-$(KERNELRELEASE)
+  DEBCONFIG = $(CONFDIR)/config.armhf
+  kelfimagesrc = vmlinux
+  kelfimagedest = $(INT_IMAGE_DESTDIR)/vmlinux-$(KERNELRELEASE)
+endif
+
+#Local variables:
+#mode: makefile
+#End:
diff -Nur kernel-package-12.036+nmu3/kernel/ruleset/architecture.mk kernel-package-12.036+nmu3.patched/kernel/ruleset/architecture.mk
--- kernel-package-12.036+nmu3/kernel/ruleset/architecture.mk	2012-03-04 02:22:23.000000000 +0100
+++ kernel-package-12.036+nmu3.patched/kernel/ruleset/architecture.mk	2013-10-02 22:01:08.000000000 +0200
@@ -59,6 +59,10 @@
 ifeq ($(strip $(architecture)),armeb)
 include $(DEBDIR)/ruleset/arches/armeb.mk
 endif
+ifeq ($(strip $(architecture)),armhf)
+include $(DEBDIR)/ruleset/arches/armhf.mk
+endif
+
 
 ##### PowerPC and PowerPC architecture 
 ifneq ($(strip $(filter ppc powerpc ppc64 powerpc64,$(architecture))),)
diff -Nur kernel-package-12.036+nmu3/kernel/ruleset/misc/kernel_arch.mk kernel-package-12.036+nmu3.patched/kernel/ruleset/misc/kernel_arch.mk
--- kernel-package-12.036+nmu3/kernel/ruleset/misc/kernel_arch.mk	2012-03-04 02:39:27.000000000 +0100
+++ kernel-package-12.036+nmu3.patched/kernel/ruleset/misc/kernel_arch.mk	2013-10-02 21:55:54.000000000 +0200
@@ -56,6 +56,10 @@
   KERNEL_ARCH := arm
 endif
 
+ifeq ($(strip $(architecture)),armhf)
+  KERNEL_ARCH := arm
+endif
+
 ifeq ($(strip $(architecture)),hppa)
   KERNEL_ARCH := parisc
 endif

Reply via email to