Package: kernel-package
Version: 9.001
Severity: normal
Tags: patch

Hello,

make-kpkg fails to build kernel 2.6.16.11 (kernel.org mainstream
sources).  I'm running a (mainly) sarge system; hardware is a 2001
"dual USB" Apple iBook.

It looks like powermac kernels need to be built with ARCH=powerpc
since kernel 2.6.16:

  
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a7fdd90bc43e3e9cb08bc1b13650024d419b89e5

whereas make-kpkg selects ARCH=ppc.  Also, the kernel Makefile builds
a 'zImage' when ARCH=powerpc, not 'vmlinux'.

With the attached patch I was able to successfully build a running
2.6.16.11 kernel.

Regards,
Riccardo Murri


-- System Information:
Debian Release: stable
  APT prefers stable
  APT policy: (600, 'stable'), (500, 'testing')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.11
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages kernel-package depends on:
ii  dpkg                          1.10.28    Package maintenance system for Deb
ii  dpkg-dev                      1.10.28    Package building tools for Debian
ii  gcc [c-compiler]              4:3.3.5-3  The GNU C compiler
ii  gcc-3.3 [c-compiler]          1:3.3.5-13 The GNU C compiler
ii  make                          3.80-9     The GNU version of the "make" util
ii  perl                          5.8.7-3    Larry Wall's Practical Extraction 

Versions of packages kernel-package recommends:
ii  bzip2                       1.0.2-7      high-quality block-sorting file co
ii  libc6-dev [libc-dev]        2.3.2.ds1-22 GNU C Library: Development Librari

-- no debconf information
--- rules.orig  2006-04-28 02:16:49.000000000 +0200
+++ rules       2006-04-29 20:54:16.000000000 +0200
@@ -221,6 +221,15 @@
   endif
 endif
 
+# Lexically-comparable kernel version string.
+# Used to detect changes in the build process (e.g., PowerMac architecture
+# changed to 'powermac' in 2.6.16).  Assumes no build process changes occur
+# *within* sublevels, and that two decimal digits are enough for each
+# version/patchlevel/sublevel.
+comparable_version = $(shell echo $(VERSION) $(PATCHLEVEL) $(SUBLEVEL) \
+                        | tr . ' '                                    \
+                        | xargs printf '%02d%02d%02d')
+
 
 
 HAVE_NEW_MODLIB =$(shell grep -E '\(INSTALL_MOD_PATH\)' Makefile 2>/dev/null )
@@ -364,12 +373,12 @@
   endif
 
   ifeq (,$(findstring $(KPKG_SUBARCH),apus prpmc chrp mbx pmac prep Amiga APUs 
CHRP MBX PReP chrp-rs6k nubus ))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=$(GUESS_SUBARCH)
   endif
 
-  KERNEL_ARCH:=ppc
-
   ifneq (,$(findstring $(KPKG_SUBARCH),APUs apus Amiga))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=apus
     loader := NoLoader
     kimage := vmapus.gz
@@ -384,6 +393,7 @@
   endif
 
   ifneq (,$(findstring $(KPKG_SUBARCH),chrp-rs6k))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=chrp-rs6k
     loaderdep=quik
     loader=quik
@@ -400,6 +410,7 @@
   endif
 
   ifneq (,$(findstring $(KPKG_SUBARCH),CHRP chrp))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=chrp
     loaderdep=quik
     loader=quik
@@ -416,6 +427,7 @@
   endif
 
   ifneq (,$(findstring $(KPKG_SUBARCH),PRPMC prpmc))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=prpmc
     loader := NoLoader
     kimage := zImage
@@ -427,6 +439,7 @@
   endif
 
   ifneq (,$(findstring $(KPKG_SUBARCH),MBX mbx))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=mbx
     loader := NoLoader
     kimage := zImage
@@ -458,18 +471,34 @@
       loaderdep=yaboot
       loader=yaboot
     endif
-    kimagesrc = vmlinux
-    kimage := vmlinux
-    kimagedest = $(INT_IMAGE_DESTDIR)/vmlinux-$(version)
     HAVE_COFF_IMAGE = YES
-    coffsrc = $(shell if [ -d arch/$(KERNEL_ARCH)/coffboot ]; then \
-         echo arch/$(KERNEL_ARCH)/coffboot/$(kimage).coff ; else \
-         echo arch/$(KERNEL_ARCH)/boot/images/$(kimage).coff ; fi)
-    coffdest=$(INT_IMAGE_DESTDIR)/vmlinux.coff-$(version)
+    # build architecture for powermac changed with 2.6.16
+    # (see 
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a7fdd90bc43e3e9cb08bc1b13650024d419b89e5
 )
+    ifneq (,$(shell test $(comparable_version) -ge 020616 && echo post-2.6.16))
+      # now powermac kernels build with 'powerpc' arch...
+      KERNEL_ARCH:=powerpc
+      # ...and the image name switched to zImage/bzImage...
+      kimagesrc = arch/$(KERNEL_ARCH)/boot/$(target)
+      kimage := $(target)
+      kimagedest = $(INT_IMAGE_DESTDIR)/vmlinux-$(version)
+      coffsrc = $(kimagesrc).coff
+      coffdest=$(INT_IMAGE_DESTDIR)/vmlinux.coff-$(version)
+    else
+      # older kernels build with 'ppc' arch
+      KERNEL_ARCH:=ppc
+      kimagesrc = vmlinux
+      kimage := vmlinux
+      kimagedest = $(INT_IMAGE_DESTDIR)/vmlinux-$(version)
+      coffsrc = $(shell if [ -d arch/$(KERNEL_ARCH)/coffboot ]; then \
+          echo arch/$(KERNEL_ARCH)/coffboot/$(kimage).coff ; else \
+          echo arch/$(KERNEL_ARCH)/boot/images/$(kimage).coff ; fi)
+      coffdest=$(INT_IMAGE_DESTDIR)/vmlinux.coff-$(version)
+    endif
     DEBCONFIG = $(CONFDIR)/config.pmac
   endif
 
   ifneq (,$(findstring $(KPKG_SUBARCH),PReP prep))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH:=prep
     loader := NoLoader
     kimage := zImage
@@ -484,6 +513,7 @@
   endif
 
   ifneq (,$(findstring $(KPKG_SUBARCH), NuBuS nubus))
+    KERNEL_ARCH:=ppc
     KPKG_SUBARCH := nubus
     target := zImage
     loader= NoLoader

Reply via email to