[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] polystrap-binfmt for preparing the build host



Hi,

2011/6/29 Johannes Schauer <j.schauer@email.de>:
> Hi,
>
> On Tue, Jun 28, 2011 at 11:42:49PM +0200, Hector Oron wrote:
>> 2011/6/28 Yann Dirson <dirson@debian.org>:
>> > As can be seen in your script, the use of binfmt support is not
>> > without problems.
>> >
>> > +        case $ARCH in
>> > +                alpha|amd64|arm|armeb|i386|m68k|mips|mipsel\
>> > +               |powerpc|ppc64|sh4|sh4eb|sparc|sparc64)
>> > +                       BINFMT_ARCH=$ARCH ;;
>> > +                armel)         BINFMT_ARCH=arm ;;
>> > +                lpia)          BINFMT_ARCH=i386 ;; # not yet verified FIXME
>> > +                *) echo "unknown architecture: $ARCH"; exit 1;;
>> > +        esac
>> >
>> > The most prominent problem IMHO is that it requires a system-wide
>> > setting, and that in turn ties a qemu arch name to a particular
>> > distro/ABI version.
>> May I suggest the use of `dpkg-architecture` environment variables?
> dpkg-architecture will print the architecture of the host or check for
> architecture equality. how would I abuse it to convert a debian
> architecture $ARCH to a cpu architecture $BINFMT_ARCH that exists as a
> "qemu-${BINFMT_ARCH}-static" binary?

Just a proof of concept....

$ ./PoC.sh
I: Set dpkg-architecture cross architecture: armel
I: configure --build=x86_64-linux-gnu --host=arm-linux-gnueabi
I: Debian armel maps to GNU arm architecture
I: Unset dpkg-architecture cross architecture
I: For further instructions: man dpkg-architecture

$ cat PoC.sh
#! /bin/sh

ARCH=armel

echo "I: Set dpkg-architecture cross architecture: ${ARCH}"
eval $(dpkg-architecture -a${ARCH} -s 2> /dev/null)

DEB_BUILD_GNU_TYPE=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_ARCH_CPU=$(dpkg-architecture -qDEB_HOST_ARCH_CPU)

echo "I: configure --build=${DEB_BUILD_GNU_TYPE} --host=${DEB_HOST_GNU_TYPE}"
echo "I: Debian ${ARCH} maps to GNU ${DEB_HOST_ARCH_CPU} architecture"

echo "I: Unset dpkg-architecture cross architecture"
eval $(dpkg-architecture -u 2> /dev/null)

echo "I: For further instructions: man dpkg-architecture"
exit 0



-- 
 Héctor Orón  -.. . -... .. .- -.   -.. . ...- . .-.. --- .--. . .-.

<free spam>
-- Would you like to make a donation for Debian Conference?
   ** http://debconf11.debconf.org/payments.xhtml **
</free spam>


Reply to: