linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builddeb: remove unneeded explicit Architecture
@ 2012-08-14 10:44 Tzafrir Cohen
  2012-08-31 13:50 ` Michal Marek
  0 siblings, 1 reply; 12+ messages in thread
From: Tzafrir Cohen @ 2012-08-14 10:44 UTC (permalink / raw)
  To: Linux Kbuild; +Cc: Linux Kernel, Tzafrir Cohen

Architecture was set explicitly in debian/control for one of the three
packages (linux-libc-dev) but not for the other two. When cross-building
it gives me an error:

  dpkg-gencontrol: error: current host architecture 'armhf' does not
  appear in package's architecture list (amd64)

Also note that if used, dpkg --print-architecture should have been
replaced with dpkg-architecture.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
---
 scripts/package/builddeb |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb8650..d9c71a6 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -252,13 +252,12 @@ mkdir -p "$destdir"
 (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
 ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
 rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-arch=$(dpkg --print-architecture)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
 Provides: linux-headers, linux-headers-2.6
-Architecture: $arch
+Architecture: any
 Description: Linux kernel headers for $KERNELRELEASE on $arch
  This package provides kernel header files for $KERNELRELEASE on $arch
  .
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-08-14 10:44 [PATCH] builddeb: remove unneeded explicit Architecture Tzafrir Cohen
@ 2012-08-31 13:50 ` Michal Marek
  2012-09-05 13:05   ` Tzafrir Cohen
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Marek @ 2012-08-31 13:50 UTC (permalink / raw)
  To: Tzafrir Cohen; +Cc: Linux Kbuild, Linux Kernel

Adding Max to CC.

On 14.8.2012 12:44, Tzafrir Cohen wrote:
> Architecture was set explicitly in debian/control for one of the three
> packages (linux-libc-dev) but not for the other two. When cross-building
> it gives me an error:
> 
>   dpkg-gencontrol: error: current host architecture 'armhf' does not
>   appear in package's architecture list (amd64)
> 
> Also note that if used, dpkg --print-architecture should have been
> replaced with dpkg-architecture.
> 
> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
> ---
>  scripts/package/builddeb |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index acb8650..d9c71a6 100644
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -252,13 +252,12 @@ mkdir -p "$destdir"
>  (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
>  ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
>  rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
> -arch=$(dpkg --print-architecture)
>  
>  cat <<EOF >> debian/control
>  
>  Package: $kernel_headers_packagename
>  Provides: linux-headers, linux-headers-2.6
> -Architecture: $arch
> +Architecture: any
>  Description: Linux kernel headers for $KERNELRELEASE on $arch
>   This package provides kernel header files for $KERNELRELEASE on $arch
>   .

As the package contains files from arch/$SRCARCH/include, I doubt that
this is a valid change.

Michal

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-08-31 13:50 ` Michal Marek
@ 2012-09-05 13:05   ` Tzafrir Cohen
  2012-09-05 13:26     ` Michal Marek
  0 siblings, 1 reply; 12+ messages in thread
From: Tzafrir Cohen @ 2012-09-05 13:05 UTC (permalink / raw)
  To: Michal Marek; +Cc: Linux Kbuild, Linux Kernel

Hi,

Thanks for your reply,

On Fri, Aug 31, 2012 at 03:50:10PM +0200, Michal Marek wrote:
> Adding Max to CC.
> 
> On 14.8.2012 12:44, Tzafrir Cohen wrote:
> > Architecture was set explicitly in debian/control for one of the three
> > packages (linux-libc-dev) but not for the other two. When cross-building
> > it gives me an error:
> > 
> >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> >   appear in package's architecture list (amd64)
> > 
> > Also note that if used, dpkg --print-architecture should have been
> > replaced with dpkg-architecture.
> > 
> > Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
> > ---
> >  scripts/package/builddeb |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> > index acb8650..d9c71a6 100644
> > --- a/scripts/package/builddeb
> > +++ b/scripts/package/builddeb
> > @@ -252,13 +252,12 @@ mkdir -p "$destdir"
> >  (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
> >  ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
> >  rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
> > -arch=$(dpkg --print-architecture)
> >  
> >  cat <<EOF >> debian/control
> >  
> >  Package: $kernel_headers_packagename
> >  Provides: linux-headers, linux-headers-2.6
> > -Architecture: $arch
> > +Architecture: any
> >  Description: Linux kernel headers for $KERNELRELEASE on $arch
> >   This package provides kernel header files for $KERNELRELEASE on $arch
> >   .
> 
> As the package contains files from arch/$SRCARCH/include, I doubt that
> this is a valid change.

But you optionally force the Architecture later on in build_package.
"Arhcitecture: any" in the source package states that the binary package
will be the one stated by the build system.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com
+972-50-7952406           mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com  iax:guest@local.xorcom.com/tzafrir

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-05 13:05   ` Tzafrir Cohen
@ 2012-09-05 13:26     ` Michal Marek
  2012-09-05 15:14       ` maximilian attems
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Marek @ 2012-09-05 13:26 UTC (permalink / raw)
  To: Tzafrir Cohen; +Cc: Linux Kbuild, Linux Kernel, maximilian attems

On 5.9.2012 15:05, Tzafrir Cohen wrote:
> Hi,
> 
> Thanks for your reply,
> 
> On Fri, Aug 31, 2012 at 03:50:10PM +0200, Michal Marek wrote:
>> Adding Max to CC.
>>
>> On 14.8.2012 12:44, Tzafrir Cohen wrote:
>>> Architecture was set explicitly in debian/control for one of the three
>>> packages (linux-libc-dev) but not for the other two. When cross-building
>>> it gives me an error:
>>>
>>>   dpkg-gencontrol: error: current host architecture 'armhf' does not
>>>   appear in package's architecture list (amd64)
>>>
>>> Also note that if used, dpkg --print-architecture should have been
>>> replaced with dpkg-architecture.
>>>
>>> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
>>> ---
>>>  scripts/package/builddeb |    3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
>>> index acb8650..d9c71a6 100644
>>> --- a/scripts/package/builddeb
>>> +++ b/scripts/package/builddeb
>>> @@ -252,13 +252,12 @@ mkdir -p "$destdir"
>>>  (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
>>>  ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
>>>  rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
>>> -arch=$(dpkg --print-architecture)
>>>  
>>>  cat <<EOF >> debian/control
>>>  
>>>  Package: $kernel_headers_packagename
>>>  Provides: linux-headers, linux-headers-2.6
>>> -Architecture: $arch
>>> +Architecture: any
>>>  Description: Linux kernel headers for $KERNELRELEASE on $arch
>>>   This package provides kernel header files for $KERNELRELEASE on $arch
>>>   .
>>
>> As the package contains files from arch/$SRCARCH/include, I doubt that
>> this is a valid change.
> 
> But you optionally force the Architecture later on in build_package.
> "Arhcitecture: any" in the source package states that the binary package
> will be the one stated by the build system.

Ah, OK. I don't know much about Debian packaging in fact. Max, could you
have a look? The original thread is here:
http://lkml.org/lkml/2012/8/14/133. I meant to add you to CC before,
but apparently I forgot.

Michal


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-05 13:26     ` Michal Marek
@ 2012-09-05 15:14       ` maximilian attems
  2012-09-05 16:40         ` Tzafrir Cohen
  0 siblings, 1 reply; 12+ messages in thread
From: maximilian attems @ 2012-09-05 15:14 UTC (permalink / raw)
  To: Michal Marek; +Cc: Tzafrir Cohen, Linux Kbuild, Linux Kernel

On Wed, 05 Sep 2012, Michal Marek wrote:

> On 5.9.2012 15:05, Tzafrir Cohen wrote:
> > Hi,
> > 
> > Thanks for your reply,
> > 
> > On Fri, Aug 31, 2012 at 03:50:10PM +0200, Michal Marek wrote:
> >> Adding Max to CC.
> >>
> >> On 14.8.2012 12:44, Tzafrir Cohen wrote:
> >>> Architecture was set explicitly in debian/control for one of the three
> >>> packages (linux-libc-dev) but not for the other two. When cross-building
> >>> it gives me an error:
> >>>
> >>>   dpkg-gencontrol: error: current host architecture 'armhf' does not
> >>>   appear in package's architecture list (amd64)
> >>>
> >>> Also note that if used, dpkg --print-architecture should have been
> >>> replaced with dpkg-architecture.
> >>>
> >>> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
> >>> ---
> >>>  scripts/package/builddeb |    3 +--
> >>>  1 file changed, 1 insertion(+), 2 deletions(-)
> >>>
> >>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> >>> index acb8650..d9c71a6 100644
> >>> --- a/scripts/package/builddeb
> >>> +++ b/scripts/package/builddeb
> >>> @@ -252,13 +252,12 @@ mkdir -p "$destdir"
> >>>  (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
> >>>  ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
> >>>  rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
> >>> -arch=$(dpkg --print-architecture)
> >>>  
> >>>  cat <<EOF >> debian/control
> >>>  
> >>>  Package: $kernel_headers_packagename
> >>>  Provides: linux-headers, linux-headers-2.6
> >>> -Architecture: $arch
> >>> +Architecture: any
> >>>  Description: Linux kernel headers for $KERNELRELEASE on $arch
> >>>   This package provides kernel header files for $KERNELRELEASE on $arch
> >>>   .
> >>
> >> As the package contains files from arch/$SRCARCH/include, I doubt that
> >> this is a valid change.
> > 
> > But you optionally force the Architecture later on in build_package.
> > "Arhcitecture: any" in the source package states that the binary package
> > will be the one stated by the build system.
> 
> Ah, OK. I don't know much about Debian packaging in fact. Max, could you
> have a look? The original thread is here:
> http://lkml.org/lkml/2012/8/14/133. I meant to add you to CC before,
> but apparently I forgot.

yes indeed it is an invalid change.
Cross building shouldn't need it, what did you exactly try?

-- 
maks

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-05 15:14       ` maximilian attems
@ 2012-09-05 16:40         ` Tzafrir Cohen
  2012-09-05 20:26           ` maximilian attems
  0 siblings, 1 reply; 12+ messages in thread
From: Tzafrir Cohen @ 2012-09-05 16:40 UTC (permalink / raw)
  To: maximilian attems; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Wed, Sep 05, 2012 at 05:14:22PM +0200, maximilian attems wrote:
> On Wed, 05 Sep 2012, Michal Marek wrote:
> 
> > On 5.9.2012 15:05, Tzafrir Cohen wrote:
> > > Hi,
> > > 
> > > Thanks for your reply,
> > > 
> > > On Fri, Aug 31, 2012 at 03:50:10PM +0200, Michal Marek wrote:
> > >> Adding Max to CC.
> > >>
> > >> On 14.8.2012 12:44, Tzafrir Cohen wrote:
> > >>> Architecture was set explicitly in debian/control for one of the three
> > >>> packages (linux-libc-dev) but not for the other two. When cross-building
> > >>> it gives me an error:
> > >>>
> > >>>   dpkg-gencontrol: error: current host architecture 'armhf' does not
> > >>>   appear in package's architecture list (amd64)
> > >>>
> > >>> Also note that if used, dpkg --print-architecture should have been
> > >>> replaced with dpkg-architecture.
> > >>>
> > >>> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
> > >>> ---
> > >>>  scripts/package/builddeb |    3 +--
> > >>>  1 file changed, 1 insertion(+), 2 deletions(-)
> > >>>
> > >>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> > >>> index acb8650..d9c71a6 100644
> > >>> --- a/scripts/package/builddeb
> > >>> +++ b/scripts/package/builddeb
> > >>> @@ -252,13 +252,12 @@ mkdir -p "$destdir"
> > >>>  (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
> > >>>  ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
> > >>>  rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
> > >>> -arch=$(dpkg --print-architecture)
> > >>>  
> > >>>  cat <<EOF >> debian/control
> > >>>  
> > >>>  Package: $kernel_headers_packagename
> > >>>  Provides: linux-headers, linux-headers-2.6
> > >>> -Architecture: $arch
> > >>> +Architecture: any
> > >>>  Description: Linux kernel headers for $KERNELRELEASE on $arch
> > >>>   This package provides kernel header files for $KERNELRELEASE on $arch
> > >>>   .
> > >>
> > >> As the package contains files from arch/$SRCARCH/include, I doubt that
> > >> this is a valid change.
> > > 
> > > But you optionally force the Architecture later on in build_package.
> > > "Arhcitecture: any" in the source package states that the binary package
> > > will be the one stated by the build system.
> > 
> > Ah, OK. I don't know much about Debian packaging in fact. Max, could you
> > have a look? The original thread is here:
> > http://lkml.org/lkml/2012/8/14/133. I meant to add you to CC before,
> > but apparently I forgot.
>
> yes indeed it is an invalid change.
> Cross building shouldn't need it, what did you exactly try?

$ grep CROSS_COMPILE .config
CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"

Command:

  KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg

Error I get:

  dpkg-gencontrol: error: current host architecture 'armhf' does not
  appear in package's architecture list (amd64)

It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
really tell if I want armel or armhf (If I built the same kernel for a
Squeeze system I would have been forced to use armel).

After I apply the patch, I can build the packages with no problem. The
generated linux-libc-dev file has "Architecture: armhf".


Below is debian/control at the time the error message was generated:

Source: linux-upstream
Section: kernel
Priority: optional
Maintainer: Tzafrir Cohen <tzafrir@debian.org>
Standards-Version: 3.8.4
Homepage: http://www.kernel.org/

Package: linux-image-3.6.0-rc4-cm-t3730+
Provides: linux-image, linux-image-2.6, linux-modules-3.6.0-rc4-cm-t3730+
Suggests: linux-firmware-image
Architecture: any
Description: Linux kernel, version 3.6.0-rc4-cm-t3730+
 This package contains the Linux kernel, modules and corresponding other
 files, version: 3.6.0-rc4-cm-t3730+.

Package: linux-headers-3.6.0-rc4-cm-t3730+
Provides: linux-headers, linux-headers-2.6
Architecture: amd64
Description: Linux kernel headers for 3.6.0-rc4-cm-t3730+ on amd64
 This package provides kernel header files for 3.6.0-rc4-cm-t3730+ on amd64
 .
 This is useful for people who need to build external modules

Package: linux-libc-dev
Section: devel
Provides: linux-kernel-headers
Architecture: any
Description: Linux support headers for userspace development
 This package provides userspaces headers from the Linux kernel.  These headers
 are used by the installed headers for GNU glibc and other system libraries.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com
+972-50-7952406           mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com  iax:guest@local.xorcom.com/tzafrir

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-05 16:40         ` Tzafrir Cohen
@ 2012-09-05 20:26           ` maximilian attems
  2012-09-06 14:00             ` maximilian attems
  0 siblings, 1 reply; 12+ messages in thread
From: maximilian attems @ 2012-09-05 20:26 UTC (permalink / raw)
  To: Tzafrir Cohen; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Wed, Sep 05, 2012 at 07:40:09PM +0300, Tzafrir Cohen wrote:
> On Wed, Sep 05, 2012 at 05:14:22PM +0200, maximilian attems wrote:
> > On Wed, 05 Sep 2012, Michal Marek wrote:
> > 
> > > On 5.9.2012 15:05, Tzafrir Cohen wrote:
> > > > Hi,
> > > > 
> > > > Thanks for your reply,
> > > > 
> > > > On Fri, Aug 31, 2012 at 03:50:10PM +0200, Michal Marek wrote:
> > > >> Adding Max to CC.
> > > >>
> > > >> On 14.8.2012 12:44, Tzafrir Cohen wrote:
> > > >>> Architecture was set explicitly in debian/control for one of the three
> > > >>> packages (linux-libc-dev) but not for the other two. When cross-building
> > > >>> it gives me an error:
> > > >>>
> > > >>>   dpkg-gencontrol: error: current host architecture 'armhf' does not
> > > >>>   appear in package's architecture list (amd64)
> > > >>>
> > > >>> Also note that if used, dpkg --print-architecture should have been
> > > >>> replaced with dpkg-architecture.
> > > >>>
> > > >>> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
> > > >>> ---
> > > >>>  scripts/package/builddeb |    3 +--
> > > >>>  1 file changed, 1 insertion(+), 2 deletions(-)
> > > >>>
> > > >>> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> > > >>> index acb8650..d9c71a6 100644
> > > >>> --- a/scripts/package/builddeb
> > > >>> +++ b/scripts/package/builddeb
> > > >>> @@ -252,13 +252,12 @@ mkdir -p "$destdir"
> > > >>>  (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
> > > >>>  ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
> > > >>>  rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
> > > >>> -arch=$(dpkg --print-architecture)
> > > >>>  
> > > >>>  cat <<EOF >> debian/control
> > > >>>  
> > > >>>  Package: $kernel_headers_packagename
> > > >>>  Provides: linux-headers, linux-headers-2.6
> > > >>> -Architecture: $arch
> > > >>> +Architecture: any
> > > >>>  Description: Linux kernel headers for $KERNELRELEASE on $arch
> > > >>>   This package provides kernel header files for $KERNELRELEASE on $arch
> > > >>>   .
> > > >>
> > > >> As the package contains files from arch/$SRCARCH/include, I doubt that
> > > >> this is a valid change.
> > > > 
> > > > But you optionally force the Architecture later on in build_package.
> > > > "Arhcitecture: any" in the source package states that the binary package
> > > > will be the one stated by the build system.
> > > 
> > > Ah, OK. I don't know much about Debian packaging in fact. Max, could you
> > > have a look? The original thread is here:
> > > http://lkml.org/lkml/2012/8/14/133. I meant to add you to CC before,
> > > but apparently I forgot.
> >
> > yes indeed it is an invalid change.
> > Cross building shouldn't need it, what did you exactly try?
> 
> $ grep CROSS_COMPILE .config
> CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
> 
> Command:
> 
>   KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> 
> Error I get:
> 
>   dpkg-gencontrol: error: current host architecture 'armhf' does not
>   appear in package's architecture list (amd64)
> 
> It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
> really tell if I want armel or armhf (If I built the same kernel for a
> Squeeze system I would have been forced to use armel).

well, obviously the dpkg call in
 -arch=$(dpkg --print-architecture)
is wrong please fix that.

thanks.

-- 
maks

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-05 20:26           ` maximilian attems
@ 2012-09-06 14:00             ` maximilian attems
  2012-09-06 14:04               ` maximilian attems
  0 siblings, 1 reply; 12+ messages in thread
From: maximilian attems @ 2012-09-06 14:00 UTC (permalink / raw)
  To: Tzafrir Cohen; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Wed, Sep 05, 2012 at 08:26:05PM +0000, maximilian attems wrote:
> On Wed, Sep 05, 2012 at 07:40:09PM +0300, Tzafrir Cohen wrote:
> > 
> > $ grep CROSS_COMPILE .config
> > CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
> > 
> > Command:
> > 
> >   KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> > 
> > Error I get:
> > 
> >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> >   appear in package's architecture list (amd64)
> > 
> > It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
> > really tell if I want armel or armhf (If I built the same kernel for a
> > Squeeze system I would have been forced to use armel).
> 
> well, obviously the dpkg call in
>  -arch=$(dpkg --print-architecture)
> is wrong please fix that.
> 

care to test belows:


>From e12defa4ad57cdb34c14031f1dddd04db6df8962 Mon Sep 17 00:00:00 2001
From: maximilian attems <max@stro.at>
Date: Thu, 6 Sep 2012 15:22:02 +0200
Subject: [PATCH] deb-pkg: Simplify architecture matching for cross building

No point in invoking dpkg to get the archticture of the host
we build on. Instead directly use the logic implemented
in create_package(). No need anymore to override arch.

While at it fix the linux images to be for the specific
built arch.

Signed-off-by: maximilian attems <max@stro.at>
---
 scripts/package/builddeb |   82 ++++++++++++++++++++++------------------------
 1 file changed, 39 insertions(+), 43 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb8650..07792d6 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -14,6 +14,7 @@ set -e
 
 create_package() {
 	local pname="$1" pdir="$2"
+	local forcearch=""
 
 	cp debian/copyright "$pdir/usr/share/doc/$pname/"
 	cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
@@ -25,44 +26,8 @@ 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-gencontrol -p$pname -P"$pdir"
 	dpkg --build "$pdir" ..
 }
 
@@ -83,6 +48,38 @@ fwpackagename=linux-firmware-image
 kernel_headers_packagename=linux-headers-$version
 libc_headers_packagename=linux-libc-dev
 
+# Attempt to find the correct Debian architecture
+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 [ "$ARCH" = "um" ] ; then
 	packagename=user-mode-linux-$version
 fi
@@ -234,8 +231,8 @@ else
 Package: $packagename
 Provides: linux-image, linux-image-2.6, linux-modules-$version
 Suggests: $fwpackagename
-Architecture: any
-Description: Linux kernel, version $version
+Architecture: $debarch
+Description: Linux kernel, version $version on $debarch
  This package contains the Linux kernel, modules and corresponding other
  files, version: $version.
 EOF
@@ -252,15 +249,14 @@ mkdir -p "$destdir"
 (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
 ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
 rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-arch=$(dpkg --print-architecture)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
+Architecture: $debarch
 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
+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
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-06 14:00             ` maximilian attems
@ 2012-09-06 14:04               ` maximilian attems
  2012-09-06 16:21                 ` Tzafrir Cohen
  0 siblings, 1 reply; 12+ messages in thread
From: maximilian attems @ 2012-09-06 14:04 UTC (permalink / raw)
  To: Tzafrir Cohen; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Thu, Sep 06, 2012 at 02:00:04PM +0000, maximilian attems wrote:
> On Wed, Sep 05, 2012 at 08:26:05PM +0000, maximilian attems wrote:
> > On Wed, Sep 05, 2012 at 07:40:09PM +0300, Tzafrir Cohen wrote:
> > > 
> > > $ grep CROSS_COMPILE .config
> > > CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
> > > 
> > > Command:
> > > 
> > >   KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> > > 
> > > Error I get:
> > > 
> > >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> > >   appear in package's architecture list (amd64)
> > > 
> > > It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
> > > really tell if I want armel or armhf (If I built the same kernel for a
> > > Squeeze system I would have been forced to use armel).
> > 
> > well, obviously the dpkg call in
> >  -arch=$(dpkg --print-architecture)
> > is wrong please fix that.
> > 
> 
> care to test belows:
> 

without a useless snippet about the lost forcearch v2:

>From f78afbe0b7fa7c49656f4ed1cf404e915f3c325b Mon Sep 17 00:00:00 2001
From: maximilian attems <max@stro.at>
Date: Thu, 6 Sep 2012 15:22:02 +0200
Subject: [PATCH v2] deb-pkg: Simplify architecture matching for cross building

No point in invoking dpkg to get the archticture of the host
we build on. Instead directly use the logic implemented
in create_package(). No need anymore to override arch.

While at it fix the linux images to be for the specific
built arch.

Signed-off-by: maximilian attems <max@stro.at>
---
 scripts/package/builddeb |   81 ++++++++++++++++++++++------------------------
 1 file changed, 38 insertions(+), 43 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index acb8650..a5f197b 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,44 +25,8 @@ 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-gencontrol -p$pname -P"$pdir"
 	dpkg --build "$pdir" ..
 }
 
@@ -83,6 +47,38 @@ fwpackagename=linux-firmware-image
 kernel_headers_packagename=linux-headers-$version
 libc_headers_packagename=linux-libc-dev
 
+# Attempt to find the correct Debian architecture
+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 [ "$ARCH" = "um" ] ; then
 	packagename=user-mode-linux-$version
 fi
@@ -234,8 +230,8 @@ else
 Package: $packagename
 Provides: linux-image, linux-image-2.6, linux-modules-$version
 Suggests: $fwpackagename
-Architecture: any
-Description: Linux kernel, version $version
+Architecture: $debarch
+Description: Linux kernel, version $version on $debarch
  This package contains the Linux kernel, modules and corresponding other
  files, version: $version.
 EOF
@@ -252,15 +248,14 @@ mkdir -p "$destdir"
 (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
 ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build"
 rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
-arch=$(dpkg --print-architecture)
 
 cat <<EOF >> debian/control
 
 Package: $kernel_headers_packagename
+Architecture: $debarch
 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
+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
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-06 14:04               ` maximilian attems
@ 2012-09-06 16:21                 ` Tzafrir Cohen
  2012-09-07  0:02                   ` maximilian attems
  0 siblings, 1 reply; 12+ messages in thread
From: Tzafrir Cohen @ 2012-09-06 16:21 UTC (permalink / raw)
  To: maximilian attems; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Thu, Sep 06, 2012 at 02:04:16PM +0000, maximilian attems wrote:
> On Thu, Sep 06, 2012 at 02:00:04PM +0000, maximilian attems wrote:
> > On Wed, Sep 05, 2012 at 08:26:05PM +0000, maximilian attems wrote:
> > > On Wed, Sep 05, 2012 at 07:40:09PM +0300, Tzafrir Cohen wrote:
> > > > 
> > > > $ grep CROSS_COMPILE .config
> > > > CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-"
> > > > 
> > > > Command:
> > > > 
> > > >   KBUILD_DEBARCH=armhf make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> > > > 
> > > > Error I get:
> > > > 
> > > >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> > > >   appear in package's architecture list (amd64)
> > > > 
> > > > It seems I have to use KBUILD_DEBARCH, as the kernel build system can't
> > > > really tell if I want armel or armhf (If I built the same kernel for a
> > > > Squeeze system I would have been forced to use armel).
> > > 
> > > well, obviously the dpkg call in
> > >  -arch=$(dpkg --print-architecture)
> > > is wrong please fix that.
> > > 
> > 
> > care to test belows:
> > 
> 
> without a useless snippet about the lost forcearch v2:
> 
> >From f78afbe0b7fa7c49656f4ed1cf404e915f3c325b Mon Sep 17 00:00:00 2001
> From: maximilian attems <max@stro.at>
> Date: Thu, 6 Sep 2012 15:22:02 +0200
> Subject: [PATCH v2] deb-pkg: Simplify architecture matching for cross building
> 
> No point in invoking dpkg to get the archticture of the host
> we build on. Instead directly use the logic implemented
> in create_package(). No need anymore to override arch.

Works for the case I presented. I still have one bad case:

Now I remove the explicit setting of KBUILD_DEBRCH:

  $ rm -rf debian
  $ make ARCH=arm KBUILD_IMAGE=uImage deb-pkg

  ...

  dpkg-gencontrol: error: current host architecture 'armhf' does not
  appear in package's architecture list (armel)

My host architecture is amd64. This is actually the build architecture.
dpkg-gencontrol uses Dpkg::Arch::get_host_arch().

  $ perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
  amd64

  $ CC=/usr/bin/arm-linux-gnueabi-gcc  perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
  armel
  
  $ CC=/usr/bin/arm-linux-gnueabihf-gcc  perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
  armhf

  $ DEB_HOST_ARCH=whatever perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
  whatever

Is it OK to use that perl one-liner as the default instead of the
architecture guessing case?

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com
+972-50-7952406           mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com  iax:guest@local.xorcom.com/tzafrir

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-06 16:21                 ` Tzafrir Cohen
@ 2012-09-07  0:02                   ` maximilian attems
  2012-09-09 11:54                     ` Tzafrir Cohen
  0 siblings, 1 reply; 12+ messages in thread
From: maximilian attems @ 2012-09-07  0:02 UTC (permalink / raw)
  To: Tzafrir Cohen; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Thu, 06 Sep 2012, Tzafrir Cohen wrote:
>
> Works for the case I presented.

Michal please care to queue previous v2 patch with
Tested-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
to kope with that cross building regression since
the linux headers got added to deb-pkg target.

> Now I remove the explicit setting of KBUILD_DEBRCH:

and here lies the error.
 
>   $ rm -rf debian
>   $ make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> 
>   ...
> 
>   dpkg-gencontrol: error: current host architecture 'armhf' does not
>   appear in package's architecture list (armel)
> 
> My host architecture is amd64. This is actually the build architecture.
> dpkg-gencontrol uses Dpkg::Arch::get_host_arch().
> 
>   $ perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
>   amd64
> 
>   $ CC=/usr/bin/arm-linux-gnueabi-gcc  perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
>   armel
>   
>   $ CC=/usr/bin/arm-linux-gnueabihf-gcc  perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
>   armhf
> 
>   $ DEB_HOST_ARCH=whatever perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
>   whatever
> 
> Is it OK to use that perl one-liner as the default instead of the
> architecture guessing case?

In any case that would be a follow up, but I'm not fond of that perl/dpkg
magic plus supporting DEB_ variables. I think for linux it is preferable
to have it based on UTS_MACHINE. Thus I think your testcases aren't valid,
and also you neglected the following one:
make KBUILD_DEBARCH=i386 deb-pkg # i386 userland with amd64 linux

Best.

-- 
maks

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] builddeb: remove unneeded explicit Architecture
  2012-09-07  0:02                   ` maximilian attems
@ 2012-09-09 11:54                     ` Tzafrir Cohen
  0 siblings, 0 replies; 12+ messages in thread
From: Tzafrir Cohen @ 2012-09-09 11:54 UTC (permalink / raw)
  To: maximilian attems; +Cc: Michal Marek, Linux Kbuild, Linux Kernel

On Fri, Sep 07, 2012 at 02:02:09AM +0200, maximilian attems wrote:
> On Thu, 06 Sep 2012, Tzafrir Cohen wrote:
> >
> > Works for the case I presented.
> 
> Michal please care to queue previous v2 patch with
> Tested-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
> to kope with that cross building regression since
> the linux headers got added to deb-pkg target.
> 
> > Now I remove the explicit setting of KBUILD_DEBRCH:
> 
> and here lies the error.
>  
> >   $ rm -rf debian
> >   $ make ARCH=arm KBUILD_IMAGE=uImage deb-pkg
> > 
> >   ...
> > 
> >   dpkg-gencontrol: error: current host architecture 'armhf' does not
> >   appear in package's architecture list (armel)
> > 
> > My host architecture is amd64. This is actually the build architecture.
> > dpkg-gencontrol uses Dpkg::Arch::get_host_arch().
> > 
> >   $ perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
> >   amd64
> > 
> >   $ CC=/usr/bi/narm-linux-gnueabi-gcc  perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
> >   armel
> >   
> >   $ CC=/usr/bin/arm-linux-gnueabihf-gcc  perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
> >   armhf
> > 
> >   $ DEB_HOST_ARCH=whatever perl -MDpkg::Arch -e 'print Dpkg::Arch::get_host_arch()."\n"'
> >   whatever
> > 
> > Is it OK to use that perl one-liner as the default instead of the
> > architecture guessing case?
> 
> In any case that would be a follow up, but I'm not fond of that perl/dpkg
> magic plus supporting DEB_ variables. 

This magic is lifted from current dpkg-gencontrol. Is there any better
way to get it?

> I think for linux it is preferable
> to have it based on UTS_MACHINE. Thus I think your testcases aren't valid,

Well, my current build script is:

  #!/bin/sh
  # YOu need to have one of the following unremmed to avoid a
  # dpkg-gencontrol error:
  export KBUILD_DEBARCH=armhf # Unrem this for armhf
  #export DEB_HOST_ARCH=armel # Or this for armel
  exec make ARCH=arm KBUILD_IMAGE=uImage deb-pkg "$@"

Clearly on my build toolchain I must set DEB_HOST_ARCH in some cases. So
DEB_ variables are already in there. Without it it will give me an error
for trying to build 

> and also you neglected the following one:
> make KBUILD_DEBARCH=i386 deb-pkg # i386 userland with amd64 linux

I'm not sure I follow. If the packagees are to be installed on a i386
system, they are all to be considered i386, right? The linux-image
package as well. The same as
http://packages.debian.org/sid/linux-image-amd64 (the i386 variant).

Setting KBUILD_DEBARCH does not change the building of the files in any
way. It only changes the package's metadata.

Maybe set DEB_HOST_ARCH from KBUILD_DEBARCH if the latter was set?

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen@xorcom.com
+972-50-7952406           mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com  iax:guest@local.xorcom.com/tzafrir

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-09-09 11:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 10:44 [PATCH] builddeb: remove unneeded explicit Architecture Tzafrir Cohen
2012-08-31 13:50 ` Michal Marek
2012-09-05 13:05   ` Tzafrir Cohen
2012-09-05 13:26     ` Michal Marek
2012-09-05 15:14       ` maximilian attems
2012-09-05 16:40         ` Tzafrir Cohen
2012-09-05 20:26           ` maximilian attems
2012-09-06 14:00             ` maximilian attems
2012-09-06 14:04               ` maximilian attems
2012-09-06 16:21                 ` Tzafrir Cohen
2012-09-07  0:02                   ` maximilian attems
2012-09-09 11:54                     ` Tzafrir Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).