Re: [PATCH] kbuild, deb-pkg: fix Architecture field when cross compiling

Asbjørn Sloth Tønnesen
2010-11-04T12:29:28Z

On 11/04/2010 05:58 AM, Sam Ravnborg wrote:
> On Thu, Nov 04, 2010 at 03:44:04AM +0000, Asbjoern Sloth Toennesen wrote:
>> [...]
>> + # Attempt to find the correct Debian architecture
>> + local forcearch="" debarch=""
>> + case "$ARCH" in
>> + i386|ia64)
>> + debarch="$ARCH" ;;
>> + x86_64)
>> + debarch="amd64" ;;
>
> On the commandline I can say ARCH=x86 - will it do the right thing then?

No, not if you are cross compiling since ARCH=x86 isn't specific to
either, we would have to look at the config. In that case it is better
to do something like:

x86|i386|x86_64)
debarch=$(grep -q CONFIG_64BIT=y .config &&
echo amd64 || echo i386) ;;

>> + *)
>> + grep -q CONFIG_ARM=y .config &&
>> + debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el)
>> + esac
>
> sparc may be know as sparc32, sparc64 and sparc these days.
> I recall that at least in the past debian supported sparc.

I only included the major Debian architectures in my patch since, I
don't know enough about all the smaller architectures and there config
dependencies. I have however added mips as it seemed straight forward.

AFAICT there are some problems surrounding sparc, since sparc in debian
uses 64-bit kernels, 32-bit userland, and the new sparc64 port uses
64-kernels and 64-bit userland, so we have no way of knowing if the
64-bit sparc kernel should have the Architecture field set to sparc or
sparc64.

For now I will just set it to sparc, as that is a release candidate for
squeeze, where sparc64 isn't nearly that far along.

sparc*)
debarch=sparc ;;
mips)
debarch=mips$(grep -q CPU_LITTLE_ENDIAN && echo el) ;;

I will sum these up in a new revision of the patch, when I get an ack
from Michal or a Debian kernel team member.