Hello James,

I applied the patch you provided and tried the steps you mentioned. I am using omap2plus_defconfig, but the make deb-pkg fails with the following error:

dpkg-gencontrol: error: current host architecture 'armel' does not appear in package's architecture list ()
make[1]: *** [deb-pkg] Error 255
make: *** [deb-pkg] Error 2

Any idea of why this could be ?

Thanks and Regards,
Deepti.

On Wed, Jun 15, 2011 at 1:44 AM, James Westby <james.westby@linaro.org> wrote:
Hi,

I just tried .39 and there's no OMAP4, so the headers install if I use
the omap2plus_defconfig.

I was then able to get deb-pkg to work after a fix to allow
cross-building the package.

This seems to produce something reasonable for us to use, but it may be
more robust to use the defconfigs with the PackageYourOwnKernel
solution.

Thanks,

James

P.S. here's the hacky change to support cross build deb-pkg

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index f6cbc3d..ea33db3 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -12,6 +12,43 @@

 set -e

+# Attempt to find the correct Debian architecture
+forcearch=""
+debarch=""
+case "$UTS_MACHINE" in
+i386|ia64|alpha)
+    debarch="$UTS_MACHINE" ;;
+x86_64)
+    debarch=amd64 ;;
+sparc*)
+    debarch=sparc ;;
+s390*)
+    debarch=s390 ;;
+ppc*)
+    debarch=powerpc ;;
+parisc*)
+    debarch=hppa ;;
+mips*)
+    debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;;
+arm*)
+    debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;;
+*)
+    echo "" >&2
+    echo "** ** **  WARNING  ** ** **" >&2
+    echo "" >&2
+    echo "Your architecture doesn't have it's equivalent" >&2
+    echo "Debian userspace architecture defined!" >&2
+    echo "Falling back to using your current userspace instead!" >&2
+    echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
+    echo "" >&2
+esac
+if [ -z "$KBUILD_DEBARCH" ] ; then
+    debarch="$KBUILD_DEBARCH"
+fi
+if [ -n "$debarch" ] ; then
+    forcearch="-DArchitecture=$debarch"
+fi
+
 create_package() {
       local pname="$1" pdir="$2"

@@ -25,42 +62,6 @@ create_package() {
       chown -R root:root "$pdir"
       chmod -R go-w "$pdir"

-       # Attempt to find the correct Debian architecture
-       local forcearch="" debarch=""
-       case "$UTS_MACHINE" in
-       i386|ia64|alpha)
-               debarch="$UTS_MACHINE" ;;
-       x86_64)
-               debarch=amd64 ;;
-       sparc*)
-               debarch=sparc ;;
-       s390*)
-               debarch=s390 ;;
-       ppc*)
-               debarch=powerpc ;;
-       parisc*)
-               debarch=hppa ;;
-       mips*)
-               debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;;
-       arm*)
-               debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;;
-       *)
-               echo "" >&2
-               echo "** ** **  WARNING  ** ** **" >&2
-               echo "" >&2
-               echo "Your architecture doesn't have it's equivalent" >&2
-               echo "Debian userspace architecture defined!" >&2
-               echo "Falling back to using your current userspace instead!" >&2
-               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
-
       # Create the package
       dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
       dpkg --build "$pdir" ..
@@ -246,15 +247,14 @@ mkdir -p "$destdir"
 (cd $srctree; tar -c -f - -T /tmp/files$$) | (cd $destdir; tar -xf -)
 (cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
 rm -f /tmp/files$$ /tmp/objfiles$$
-arch=$(dpkg --print-architecture)

 cat <<EOF >> debian/control

 Package: $kernel_headers_packagename
 Provides: linux-headers, linux-headers-2.6
-Architecture: $arch
-Description: Linux kernel headers for $KERNELRELEASE on $arch
- This package provides kernel header files for $KERNELRELEASE on $arch
+Architecture: $debarch
+Description: Linux kernel headers for $KERNELRELEASE on $debarch
+ This package provides kernel header files for $KERNELRELEASE on $debarch
 .
 This is useful for people who need to build external modules
 EOF


On Mon, 13 Jun 2011 21:14:09 -0400, James Westby <james.westby@linaro.org> wrote:
> On Mon, 13 Jun 2011 15:31:21 -0600, Matt Waddel <matt.waddel@canonical.com> wrote:
> > AIUI, the config errors you listed need to be fixed by going through
> > the kernel configuration and enabling or disabling these options as
> > requested. So in the first example from the failure log you sent:
> >
> > check-config: FAIL: value CONFIG_DEVKMEM n
> >
> > means CONFIG_DEVKMEM is disabled when it should be enabled. So using
> > "fdr editconfigs" you need to find and change that configuration option.
> >
> > When I tried this on Friday I had to run this step a few times because
> > of kernel dependencies.  The process is outlined in these sections:
> >
> > Update Your Kernel Config
> > Fix-up Your Kernel Config
> > Bypass Remaining Config Errors
>
> This doesn't really work for us as we need to do this daily in an
> automated fashion.
>
> Is there a way to use the defconfigs for this kernel build?
>
> To look in to another way I had heard of, "make deb" (which turned out
> to be "make deb-pkg"), I just tried this:
>
> sudo apt-get install gcc-arm-linux-gnueabi
> git clone git://git.linaro.org/kernel/linux-linaro-2.6.38.git
> cd linux-linaro-2.6.38/
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap4_defconfig
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- deb-pkg
>
> which then dies with
>
>   INSTALL include/asm (32 files)
>   CHECK   include/asm-generic (34 files)
>   CHECK   include/drm (14 files)
> /tmp/linux-linaro-2.6.38/usr/include/drm/drm_mode.h:85: found __[us]{8,16,32,64} type without #include <linux/types.h>
> /tmp/linux-linaro-2.6.38/usr/include/drm/i915_drm.h:120: found __[us]{8,16,32,64} type without #include <linux/types.h>
> /tmp/linux-linaro-2.6.38/usr/include/drm/mga_drm.h:260: found __[us]{8,16,32,64} type without #include <linux/types.h>
> /tmp/linux-linaro-2.6.38/usr/include/drm/radeon_drm.h:758: found __[us]{8,16,32,64} type without #include <linux/types.h>
> /tmp/linux-linaro-2.6.38/usr/include/drm/via_drm.h:117: found __[us]{8,16,32,64} type without #include <linux/types.h>
>   CHECK   include/linux/byteorder (2 files)
>   CHECK   include/linux/caif (2 files)
>   CHECK   include/linux/can (4 files)
>   CHECK   include/linux/dvb (8 files)
>   CHECK   include/linux/hdlc (1 files)
>   CHECK   include/linux/isdn (1 files)
>   CHECK   include/linux/netfilter (64 files)
>   CHECK   include/linux/netfilter_arp (2 files)
>   CHECK   include/linux/netfilter_bridge (18 files)
>   CHECK   include/linux/netfilter_ipv4 (14 files)
>   CHECK   include/linux/netfilter_ipv6 (11 files)
>   CHECK   include/linux/nfsd (6 files)
>   CHECK   include/linux/raid (2 files)
>   CHECK   include/linux/spi (1 files)
>   CHECK   include/linux/sunrpc (1 files)
>   CHECK   include/linux/tc_act (7 files)
>   CHECK   include/linux/tc_ematch (4 files)
>   CHECK   include/linux/usb (9 files)
>   CHECK   include/linux/wimax (1 files)
>   CHECK   include/linux (360 files)
> /tmp/linux-linaro-2.6.38/usr/include/linux/kernel.h:58: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:23: included file 'linux/module.h' is not exported
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:46: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:47: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:52: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:54: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:56: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:60: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/omap_gpu.h:64: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/quota.h:175: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/sdla.h:116: userspace cannot reference function or variable defined in the kernel
> /tmp/linux-linaro-2.6.38/usr/include/linux/soundcard.h:1054: userspace cannot reference function or variable defined in the kernel
> make[4]: *** [/tmp/linux-linaro-2.6.38/usr/include/linux/.check] Error 123
> make[3]: *** [linux] Error 2
> make[2]: *** [headers_check] Error 2
> make[1]: *** [deb-pkg] Error 2
> make: *** [deb-pkg] Error 2
>
> What's the fix for that?
>
> Thanks,
>
> James