All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: ARCH in builddeb
@ 2009-09-14  5:25 Wei Chong Tan
  2009-09-14 21:01 ` Frans Pop
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Chong Tan @ 2009-09-14  5:25 UTC (permalink / raw)
  To: sam, max, elendil, linux-kernel

Hello,

I was using "make ARCH=i386 deb-pkg" in the kernel on a 64bit machine
and found out that the .deb package created was _amd64.deb.
Consequently, I modify the builddeb script to take into account the
ARCH environment variable.

Thanks,
Tan Wei Chong.

>From 477c02443f0fb5a8e39d607197720fec21cecc8b Mon Sep 17 00:00:00 2001
From: Tan, Wei Chong <weichong78@gmail.com>
Date: Mon, 14 Sep 2009 12:56:55 +0800
Subject: [PATCH] update builddeb script to allow ARCH customization
Signed-off-by: Tan, Wei Chong <weichong78@gmail.com>

---
 scripts/package/builddeb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 8b357b0..cdb017f 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -24,7 +24,11 @@ create_package() {
 	chmod -R go-w "$pdir"

 	# Create the package
-	dpkg-gencontrol -isp -p$pname -P"$pdir"
+	if [ "$ARCH" = "" ] ; then
+		dpkg-gencontrol -isp -p$pname -P"$pdir"
+	else
+		dpkg-gencontrol -DArchitecture=$ARCH -isp -p$pname -P"$pdir"
+	fi
 	dpkg --build "$pdir" ..
 }

-- 
1.6.0.4

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

* Re: PATCH: ARCH in builddeb
  2009-09-14  5:25 PATCH: ARCH in builddeb Wei Chong Tan
@ 2009-09-14 21:01 ` Frans Pop
  2009-09-16 14:19   ` Frans Pop
  0 siblings, 1 reply; 11+ messages in thread
From: Frans Pop @ 2009-09-14 21:01 UTC (permalink / raw)
  To: Wei Chong Tan; +Cc: sam, max, linux-kernel

On Monday 14 September 2009, Wei Chong Tan wrote:
> I was using "make ARCH=i386 deb-pkg" in the kernel on a 64bit machine
> and found out that the .deb package created was _amd64.deb.
> Consequently, I modify the builddeb script to take into account the
> ARCH environment variable.

Thanks for the patch. I'd like to give it some testing though as I fear it 
may break one other use case that currently somehow does work correctly.

If I cross-compile for arm with EABI set in the config, the script 
currently correctly generates an armel package (probably through 
dpkg-cross).

Possibly your change would override that and change it to arm. I don't know 
for sure it will go wrong, but it does need testing. I'll let you know.

Cheers,
FJP

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

* Re: PATCH: ARCH in builddeb
  2009-09-14 21:01 ` Frans Pop
@ 2009-09-16 14:19   ` Frans Pop
  2009-09-17  0:12     ` Wei Chong Tan
  0 siblings, 1 reply; 11+ messages in thread
From: Frans Pop @ 2009-09-16 14:19 UTC (permalink / raw)
  To: Wei Chong Tan; +Cc: sam, max, linux-kernel

On Monday 14 September 2009, Frans Pop wrote:
> On Monday 14 September 2009, Wei Chong Tan wrote:
> > I was using "make ARCH=i386 deb-pkg" in the kernel on a 64bit machine
> > and found out that the .deb package created was _amd64.deb.
> > Consequently, I modify the builddeb script to take into account the
> > ARCH environment variable.
>
> Thanks for the patch. I'd like to give it some testing though as I fear
> it may break one other use case that currently somehow does work
> correctly.
>
> If I cross-compile for arm with EABI set in the config, the script
> currently correctly generates an armel package (probably through
> dpkg-cross).
>
> Possibly your change would override that and change it to arm. I don't
> know for sure it will go wrong, but it does need testing. I'll let you
> know.

Yes, it is as I feared. Your patch results in an "arm" package when I do a 
cross-build for "armel" (for which I must of course set ARCH to "arm" as 
armel is not a valid Linux architecture).

I agree that being able to build i386 on amd64 is a valuable option and I 
have actually run into that issue myself (and solved it by building in an 
i386 chroot).

A possible solution could be to check that CROSS_COMPILE is *not* set, but 
I'm not sure if that would be the correct solution. Input from others on 
this would be welcome.

Cheers,
FJP

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

* Re: PATCH: ARCH in builddeb
  2009-09-16 14:19   ` Frans Pop
@ 2009-09-17  0:12     ` Wei Chong Tan
  2009-09-18  3:10       ` Wei Chong Tan
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Chong Tan @ 2009-09-17  0:12 UTC (permalink / raw)
  To: Frans Pop; +Cc: sam, max, linux-kernel

> Yes, it is as I feared. Your patch results in an "arm" package when I do a
> cross-build for "armel" (for which I must of course set ARCH to "arm" as
> armel is not a valid Linux architecture).
> A possible solution could be to check that CROSS_COMPILE is *not* set, but
> I'm not sure if that would be the correct solution. Input from others on
> this would be welcome.

Thanks Frans for the help,
I will try to check CROSS_COMPILE and see in addition to other alternatives.

Regards,
Wei Chong.

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

* Re: PATCH: ARCH in builddeb
  2009-09-17  0:12     ` Wei Chong Tan
@ 2009-09-18  3:10       ` Wei Chong Tan
  2009-09-20 13:09         ` Frans Pop
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Chong Tan @ 2009-09-18  3:10 UTC (permalink / raw)
  To: Frans Pop; +Cc: sam, max, linux-kernel

Hi Frans,

How about this? Hopefully this would work for all arch supported.

Regards,
Tan, Wei Chong.

Subject: [PATCH] update builddeb script to allow ARCH customization
Signed-off-by: Tan, Wei Chong <weichong78@gmail.com>
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 8b357b0..96c3ae9 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -24,7 +24,12 @@ create_package() {
 	chmod -R go-w "$pdir"

 	# Create the package
-	dpkg-gencontrol -isp -p$pname -P"$pdir"
+	if [ -n $ARCH ]
+	then
+		dpkg-architecture -a$ARCH -c "dpkg-gencontrol -isp -p$pname -P\"$pdir\""
+	else
+		dpkg-gencontrol -isp -p$pname -P"$pdir"
+	fi
 	dpkg --build "$pdir" ..
 }

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

* Re: PATCH: ARCH in builddeb
  2009-09-18  3:10       ` Wei Chong Tan
@ 2009-09-20 13:09         ` Frans Pop
  2009-09-22  0:38           ` Frans Pop
  2009-09-22 14:43           ` Wei Chong Tan
  0 siblings, 2 replies; 11+ messages in thread
From: Frans Pop @ 2009-09-20 13:09 UTC (permalink / raw)
  To: Wei Chong Tan; +Cc: sam, max, linux-kernel

On Friday 18 September 2009, Wei Chong Tan wrote:
> How about this? Hopefully this would work for all arch supported.

That still given me an arm instead of an armel package.

I get the following from the deb-pkg target:
dpkg-architecture: warning: Specified GNU system type arm-linux-gnu does
not match gcc system type arm-linux-gnueabi.
dpkg-deb: building package `linux-image-2.6.31' in `../linux-image-2.6.31_6481.gc7572df_arm.deb'.

So, somehow dpkg is able to do the right thing based on what is set for gcc
(I expect from the CROSS_COMPILE option), but not if that gets overruled as
both your patches seem to be doing.

Cheers,
FJP

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

* Re: PATCH: ARCH in builddeb
  2009-09-20 13:09         ` Frans Pop
@ 2009-09-22  0:38           ` Frans Pop
  2009-09-22 14:38             ` Frans Pop
  2009-09-22 14:43           ` Wei Chong Tan
  1 sibling, 1 reply; 11+ messages in thread
From: Frans Pop @ 2009-09-22  0:38 UTC (permalink / raw)
  To: Wei Chong Tan; +Cc: sam, max, linux-kernel

On Sunday 20 September 2009, Frans Pop wrote:
> So, somehow dpkg is able to do the right thing based on what is set for
> gcc (I expect from the CROSS_COMPILE option), but not if that gets
> overruled as both your patches seem to be doing.

Actually, I think the correct way to build a linux kernel for i386 on an 
amd64 [1] system is to use 'linux32 make deb-pkg' [2]. With that no 
changes to the kernel build system should be needed at all, and I think 
with that you even should not need to set the ARCH variable.

It should also be possible to build a 64-bit kernel for i386 on amd64 that 
way using 'linux32 make ARCH=x86_64 deb-pkg'.

Untested, but AFAIK that should work. Sorry for not mentioning it earlier, 
but it's a command I've never really used myself and I keep forgetting 
about it :-/

Cheers,
FJP

[1] amd64 as in the Debian architecture, which also covers Intel 64-bit
[2] linux32 is in until-linux package and thus guaranteed to be available

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

* Re: PATCH: ARCH in builddeb
  2009-09-22  0:38           ` Frans Pop
@ 2009-09-22 14:38             ` Frans Pop
  0 siblings, 0 replies; 11+ messages in thread
From: Frans Pop @ 2009-09-22 14:38 UTC (permalink / raw)
  To: Wei Chong Tan; +Cc: sam, max, linux-kernel

On Tuesday 22 September 2009, Frans Pop wrote:
> On Sunday 20 September 2009, Frans Pop wrote:
> > So, somehow dpkg is able to do the right thing based on what is set
> > for gcc (I expect from the CROSS_COMPILE option), but not if that gets
> > overruled as both your patches seem to be doing.
>
> Actually, I think the correct way to build a linux kernel for i386 on an
> amd64 [1] system is to use 'linux32 make deb-pkg' [2]. With that no
> changes to the kernel build system should be needed at all, and I think
> with that you even should not need to set the ARCH variable.

I've tried it now and unfortunately this does not work either.
It works perfectly for the kernel build itself, but has no effect on the 
package that is created, so you still get an amd64 package.

:-(

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

* Re: PATCH: ARCH in builddeb
  2009-09-20 13:09         ` Frans Pop
  2009-09-22  0:38           ` Frans Pop
@ 2009-09-22 14:43           ` Wei Chong Tan
  2009-09-22 16:53             ` Frans Pop
  1 sibling, 1 reply; 11+ messages in thread
From: Wei Chong Tan @ 2009-09-22 14:43 UTC (permalink / raw)
  To: Frans Pop; +Cc: sam, max, linux-kernel

Hi Frans,

> That still given me an arm instead of an armel package.
>
> I get the following from the deb-pkg target:
> dpkg-architecture: warning: Specified GNU system type arm-linux-gnu does
> not match gcc system type arm-linux-gnueabi.
> dpkg-deb: building package `linux-image-2.6.31' in `../linux-image-2.6.31_6481.gc7572df_arm.deb'.
>

dpkg-architecture seems to set a bunch of build-time environment
variable, could it be there one is not set by default for arm vs
armel?

Regards,
Wei Chong.

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

* Re: PATCH: ARCH in builddeb
  2009-09-22 14:43           ` Wei Chong Tan
@ 2009-09-22 16:53             ` Frans Pop
  2009-09-22 23:07               ` Wei Chong Tan
  0 siblings, 1 reply; 11+ messages in thread
From: Frans Pop @ 2009-09-22 16:53 UTC (permalink / raw)
  To: Wei Chong Tan; +Cc: sam, max, linux-kernel

On Tuesday 22 September 2009, Wei Chong Tan wrote:
> > That still given me an arm instead of an armel package.
>
> dpkg-architecture seems to set a bunch of build-time environment
> variable, could it be there one is not set by default for arm vs
> armel?

dpkg-gencontrol, if left alone, seems to understand about cross-compiling 
*and* understand the difference between compiling for arm and armel, while 
dpkg-architecture seems to ignore that. But I really don't know enough 
about either to be able to say what the exact problem is or what the 
correct solution is here.

All I can tell you is that when I cross-compile for armel (on a Debian 
amd64/Lenny host system) with very simply the following set in the 
environment, it all magically works correctly:
   export ARCH=arm
   export CROSS_COMPILE=arm-linux-gnueabi-

I don't think we should lose correct automatic detection for the sake of 
fixing your use case.

I would suggest asking for advice on the debian-devel mailing list or, 
maybe even better, from the dpkg maintainers.

Cheers,
FJP

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

* Re: PATCH: ARCH in builddeb
  2009-09-22 16:53             ` Frans Pop
@ 2009-09-22 23:07               ` Wei Chong Tan
  0 siblings, 0 replies; 11+ messages in thread
From: Wei Chong Tan @ 2009-09-22 23:07 UTC (permalink / raw)
  To: Frans Pop; +Cc: sam, max, linux-kernel

Hi Frans,

> I don't think we should lose correct automatic detection for the sake of
> fixing your use case.
>
I agree, it is actually not such a big deal for my case.  I just
thought that if it can be fix once and for all, correctly for all
architecture and build, then it would make others (including myself)
less confused when first attempt it.

> I would suggest asking for advice on the debian-devel mailing list or,
> maybe even better, from the dpkg maintainers.
>
Let me try to ask around debian-devel then.

Regards,
Wei Chong.

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

end of thread, other threads:[~2009-09-22 23:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-14  5:25 PATCH: ARCH in builddeb Wei Chong Tan
2009-09-14 21:01 ` Frans Pop
2009-09-16 14:19   ` Frans Pop
2009-09-17  0:12     ` Wei Chong Tan
2009-09-18  3:10       ` Wei Chong Tan
2009-09-20 13:09         ` Frans Pop
2009-09-22  0:38           ` Frans Pop
2009-09-22 14:38             ` Frans Pop
2009-09-22 14:43           ` Wei Chong Tan
2009-09-22 16:53             ` Frans Pop
2009-09-22 23:07               ` Wei Chong Tan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.