2011-05-04 06:00:12

by Nuno Subtil

[permalink] [raw]
Subject: [PATCH 1/1] deb-pkg: fix cross-compile build

When generating the header package, scripts/package/builddeb was inferring the
target architecture by looking at the output of dpkg --print-architecture. This
allows KBUILD_DEBARCH to override that.

Signed-off-by: Nuno Subtil <[email protected]>
---
scripts/package/builddeb | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index f6cbc3d..9372145 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -246,7 +246,12 @@ 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)
+
+if [ -n "$KBUILD_DEBARCH" ] ; then
+ arch="$KBUILD_DEBARCH"
+else
+ arch=$(dpkg --print-architecture)
+fi

cat <<EOF >> debian/control

--
1.7.4.4

Please Cc me on any replies related to this patch.

Thanks,
Nuno


2011-05-04 20:48:10

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH 1/1] deb-pkg: fix cross-compile build

Adding Maks to CC.

On Tue, May 03, 2011 at 10:59:10PM -0700, Nuno Subtil wrote:
> When generating the header package, scripts/package/builddeb was inferring the
> target architecture by looking at the output of dpkg --print-architecture. This
> allows KBUILD_DEBARCH to override that.
>
> Signed-off-by: Nuno Subtil <[email protected]>
> ---
> scripts/package/builddeb | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index f6cbc3d..9372145 100644
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -246,7 +246,12 @@ 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)
> +
> +if [ -n "$KBUILD_DEBARCH" ] ; then
> + arch="$KBUILD_DEBARCH"
> +else
> + arch=$(dpkg --print-architecture)
> +fi
>
> cat <<EOF >> debian/control
>
> --
> 1.7.4.4
>
> Please Cc me on any replies related to this patch.
>
> Thanks,
> Nuno
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2011-05-05 09:07:30

by maximilian attems

[permalink] [raw]
Subject: Re: [PATCH 1/1] deb-pkg: fix cross-compile build

On Wed, May 04, 2011 at 10:48:07PM +0200, Michal Marek wrote:
> Adding Maks to CC.

thanks, this one looks, good please disguard the other patch.

> On Tue, May 03, 2011 at 10:59:10PM -0700, Nuno Subtil wrote:
> > When generating the header package, scripts/package/builddeb was inferring the
> > target architecture by looking at the output of dpkg --print-architecture. This
> > allows KBUILD_DEBARCH to override that.
> >
> > Signed-off-by: Nuno Subtil <[email protected]>
Acked-by: maximilian attems <[email protected]>

2011-05-05 16:03:45

by Robert Gordon

[permalink] [raw]
Subject: Re: [PATCH 1/1] deb-pkg: fix cross-compile build

On 05/05/2011 02:07 AM, maximilian attems wrote:
> On Wed, May 04, 2011 at 10:48:07PM +0200, Michal Marek wrote:
>> Adding Maks to CC.
> thanks, this one looks, good please disguard the other patch.
>
>> On Tue, May 03, 2011 at 10:59:10PM -0700, Nuno Subtil wrote:
>>> When generating the header package, scripts/package/builddeb was inferring the
>>> target architecture by looking at the output of dpkg --print-architecture. This
>>> allows KBUILD_DEBARCH to override that.
>>>
>>> Signed-off-by: Nuno Subtil <[email protected]>
> Acked-by: maximilian attems <[email protected]>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Greetings,

Compile breaks when using the following command:
fakeroot make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- deb-pkg

With 'set -x' in scripts/package/builddeb, the relevant output is:
+ '[' -n '' ']'
++ dpkg --print-architecture
+ arch=i386
This indicates that KBUILD_DEBARCH is not set.

The debian/control file is written with the following section:
Package: linux-headers-2.6.39-rc5+
Provides: linux-headers, linux-headers-2.6
Architecture: i386
Description: Linux kernel headers for 2.6.39-rc5+ on i386
This package provides kernel header files for 2.6.39-rc5+ on i386

This produces the following error output:
+ forcearch=-DArchitecture=armel
+ dpkg-gencontrol -isp -DArchitecture=armel
-plinux-headers-2.6.39-rc5+ -P/opt/kernel-linus/linux-2.6/debian/hdrtmp
dpkg-gencontrol: error: current host architecture 'armel' does not
appear in package's architecture list (i386)

Regards,
Robert

2011-05-05 17:10:53

by Nuno Subtil

[permalink] [raw]
Subject: Re: [PATCH 1/1] deb-pkg: fix cross-compile build

This patch is not meant to fix that case, only the case where
KBUILD_DEBARCH is used.

KBUILD_DEBARCH seems to be meant to be used as an override for what
Debian wants to see as the target architecture. Arguably, the right
thing to do here might be to do the same arch detection sequence
that's done in create_package(), which looks at UTS_MACHINE first and
the KBUILD_DEBARCH override after that (though I'm not entirely sure).

This patch only adds the KBUILD_DEBARCH override, but that is still
better than the current situation. I can easily get the rest in later
if needed.

Nuno

On Thu, May 5, 2011 at 08:42, Robert Gordon
<[email protected]> wrote:
> On 05/05/2011 02:07 AM, maximilian attems wrote:
>> On Wed, May 04, 2011 at 10:48:07PM +0200, Michal Marek wrote:
>>> Adding Maks to CC.
>> thanks, this one looks, good please disguard the other patch.
>>
>>> On Tue, May 03, 2011 at 10:59:10PM -0700, Nuno Subtil wrote:
>>>> When generating the header package, scripts/package/builddeb was inferring the
>>>> target architecture by looking at the output of dpkg --print-architecture. This
>>>> allows KBUILD_DEBARCH to override that.
>>>>
>>>> Signed-off-by: Nuno Subtil <[email protected]>
>> Acked-by: maximilian attems <[email protected]>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
>> the body of a message to [email protected]
>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> Greetings,
>
> Compile breaks when using the following command:
> ? ?fakeroot make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- deb-pkg
>
> With 'set -x' in scripts/package/builddeb, the relevant output is:
> ? ?+ '[' -n '' ']'
> ? ?++ dpkg --print-architecture
> ? ?+ arch=i386
> This indicates that KBUILD_DEBARCH is not set.
>
> The debian/control file is written with the following section:
> ? ?Package: linux-headers-2.6.39-rc5+
> ? ?Provides: linux-headers, linux-headers-2.6
> ? ?Architecture: i386
> ? ?Description: Linux kernel headers for 2.6.39-rc5+ on i386
> ? ? This package provides kernel header files for 2.6.39-rc5+ on i386
>
> This produces the following error output:
> ? ?+ forcearch=-DArchitecture=armel
> ? ?+ dpkg-gencontrol -isp -DArchitecture=armel
> -plinux-headers-2.6.39-rc5+ -P/opt/kernel-linus/linux-2.6/debian/hdrtmp
> ? ?dpkg-gencontrol: error: current host architecture 'armel' does not
> appear in package's architecture list (i386)
>
> Regards,
> Robert
>
>

2011-05-05 18:34:20

by Robert Gordon

[permalink] [raw]
Subject: Re: [PATCH 1/1] deb-pkg: fix cross-compile build

On 5/5/11 11:23 AM, Robert Gordon wrote:
> On 5/5/11 10:10 AM, Nuno Subtil wrote:
>> This patch is not meant to fix that case, only the case where
>> KBUILD_DEBARCH is used.
>>
>> KBUILD_DEBARCH seems to be meant to be used as an override for what
>> Debian wants to see as the target architecture. Arguably, the right
>> thing to do here might be to do the same arch detection sequence
>> that's done in create_package(), which looks at UTS_MACHINE first and
>> the KBUILD_DEBARCH override after that (though I'm not entirely sure).
>>
>> This patch only adds the KBUILD_DEBARCH override, but that is still
>> better than the current situation. I can easily get the rest in later
>> if needed.
>>
>> Nuno
>>
>> On Thu, May 5, 2011 at 08:42, Robert Gordon
>> <[email protected]> wrote:
>>> On 05/05/2011 02:07 AM, maximilian attems wrote:
>>>> On Wed, May 04, 2011 at 10:48:07PM +0200, Michal Marek wrote:
>>>>> Adding Maks to CC.
>>>> thanks, this one looks, good please disguard the other patch.
>>>>
>>>>> On Tue, May 03, 2011 at 10:59:10PM -0700, Nuno Subtil wrote:
>>>>>> When generating the header package, scripts/package/builddeb was
>>>>>> inferring the
>>>>>> target architecture by looking at the output of dpkg
>>>>>> --print-architecture. This
>>>>>> allows KBUILD_DEBARCH to override that.
>>>>>>
>>>>>> Signed-off-by: Nuno Subtil<[email protected]>
>>>> Acked-by: maximilian attems<[email protected]>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe
>>>> linux-kbuild" in
>>>> the body of a message to [email protected]
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>> Greetings,
>>>
>>> Compile breaks when using the following command:
>>> fakeroot make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- deb-pkg
>>>
>>> With 'set -x' in scripts/package/builddeb, the relevant output is:
>>> + '[' -n '' ']'
>>> ++ dpkg --print-architecture
>>> + arch=i386
>>> This indicates that KBUILD_DEBARCH is not set.
>>>
>>> The debian/control file is written with the following section:
>>> Package: linux-headers-2.6.39-rc5+
>>> Provides: linux-headers, linux-headers-2.6
>>> Architecture: i386
>>> Description: Linux kernel headers for 2.6.39-rc5+ on i386
>>> This package provides kernel header files for 2.6.39-rc5+ on i386
>>>
>>> This produces the following error output:
>>> + forcearch=-DArchitecture=armel
>>> + dpkg-gencontrol -isp -DArchitecture=armel
>>> -plinux-headers-2.6.39-rc5+ -P/opt/kernel-linus/linux-2.6/debian/hdrtmp
>>> dpkg-gencontrol: error: current host architecture 'armel' does not
>>> appear in package's architecture list (i386)
>>>
>>> Regards,
>>> Robert
>>>
>>>
> Nuno,
> Thanks for the response. I am very new at this process, but I am trying
> to learn. Yesterday, I submitted a patch that was intended to address
> the same issue that you have addressed. I did what you are suggesting by
> mimicking what is done in create_package(), but leaving i386/x86_64
> untouched. Here is the subject of the patch I sent:
>
> [PATCH] kbuild, deb-pkg: set host machine $arch correctly when
> cross-compiling or not
>
> Please advise if I should resend.
>
> Regards,
> Robert
>
> -- *
> *
>

Apologies, resending because messages were rejected by the mailing lists
(probably due to html) - Robert

--