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

Re: Using sbuild with qemu-user-static - was: Re: TODO list for Debian/Linux m68k



Hi,

Le 15/11/2015 19:08, John Paul Adrian Glaubitz a écrit :
> Hi!
> 
> On 11/12/2015 03:34 PM, Laurent Vivier wrote:
>> For the qemu-m68k part, I've tried to merge it after the qemu-2.4
>> release, but there have been some comments and I have to rewrite a major
>> part of the instruction translator. I need to find some time...
> 
> Today realized that this can be extremely useful for building packages
> for m68k and other slower/older architectures.
> 
> I was playing around with combining chroot with qemu [1] and tried to
> cross-build packages with sbuild which turned out to be successful.
> 
> I made a test setup for armel as follows:
> 
> $ apt-get install sbuild qemu-user-static binfmt-support
> $ cd /srv/chroots
> $ debootstrap --no-check-gpg --variant=buildd --foreign --arch=armel
> unstable sid-armel-sbuild ftp://ftp.debian.org/debian
> $ sbuild-update --keygen
> $ cat /etc/schroot/chroot.d/sid-armel-sbuild
> [sid-armel-sbuild]
> description=Debian sid chroot for armel
> type=directory
> directory=/srv/chroots/sid-armel-sbuild
> #groups=Debian,guest,d-i
> #profile=dsa
> #aliases=sid
> groups=root,sbuild,glaubitz,buildd
> root-groups=root,sbuild,glaubitz,buildd
> #command-prefix=
> #source-root-users=glaubitz,sbuild,buildd
> #run-setup-scripts=true
> #run-exec-scripts=true
> $ adduser glaubitz sbuild
> $ cp -av /usr/bin/qemu-arm-static /srv/chroots/sid-armel-sbuild/usr/bin
> $ chroot sid-armel-sid
> $ ./debootstrap/debootstrap --second-stage

In GitHub repo (https://github.com/vivier/qemu-m68k), on branch
680x0-v2.4.0, you can find a LXC script to create debian container:

https://raw.githubusercontent.com/vivier/qemu-m68k/680x0-v2.4.0/scripts/lxc-cross-debian

You must copy it to /usr/share/lxc/templates

There is also a script to create different kind of containers with it:

https://raw.githubusercontent.com/vivier/qemu-m68k/680x0-v2.4.0/scripts/debian-create-lxc.sh

you can do something like:

debian-create-lxc.sh raspberrypi

to create a container compatible with raspberrypi.

There is a script to configure binfmt:

https://raw.githubusercontent.com/vivier/qemu-m68k/680x0-v2.4.0/scripts/qemu-binfmt-conf.sh

After that, you can convert a container into a qemu image:

https://raw.githubusercontent.com/vivier/qemu-m68k/680x0-v2.4.0/scripts/lxc-img

> After that, I could cross-build xbill for armel under my normal user
> with:
> 
> # sbuild --source --arch=armel --arch-all -d sid xbill_2.1-8.dsc
> 
> This can be done analogously for sh4 with the exceptions that libmpfr4
> and libgomp10 need to be installed manually here as they are available
> in the unreleased suite only which debootstrap doesn't support.
> Furthermore, qemu-sh4 doesn't implement syscall 186 [2] and segfaults
> on an amd64 host [3] but I assume these issues should be fixable. With
> the help of workaround, I am now cross-building using this setup for
> sh4.
> 
> Unless I have overlooked anything, this sbuild configuration should work
> without any issues with the buildd package and hence can be used to
> set up a very fast buildd :). Thus, it might be a very good alternative
> to Aranym once Laurent's patches have been merged with qemu upstream.
> 
> Adrian
> 
>> [1] https://wiki.debian.org/QEMU
>> [2] https://bugs.launchpad.net/qemu/+bug/1516408
>> [3] https://bugs.launchpad.net/ubuntu/+source/qemu-linaro/+bug/1254824
> 
Thanks.

When you find a bug, or want a feature, in qemu-linux-user don't
hesitate to send it to me :)

Laurent


Reply to: