Re: Creating debs using a cross-build environment?

Svante Signell <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Organization Hemma
Message-ID <[email protected]>
On Thu, 2012-02-23 at 14:42 +0100, Hector Oron wrote:
> Hello,
> 
> 2012/2/23 Svante Signell <[email protected]>:
> > On Thu, 2012-02-23 at 13:00 +0100, Hector Oron wrote:
> >> 2012/2/23 Jonathan Nieder <[email protected]>:
> 
> >> Most underlying mechanisms assume Linux kernel, AFAICT, none has
> >> attempted to change those to use another kernel, but that might be
> >> possible changing Linux kernel headers by some other kernel headers.
> 
> > I've looked at this web page (and several other guides and web pages).
> > The Debian web page does not help much in creating a cross compiler for
> > another kernel than GNU/Linux. These steps I already have done and
> > written down for the GNU/Hurd OS. Anybody interested?
> 
> Just for fun, I'd be curious to see.

I'll send to the list soon. There are still some workarounds to solve in
a better way. Maybe you can help here, it's mainly about giving the
correct options to various configure scripts.

> > My questions and aims are:
> > Assuming the cross and target build environment is available, as above.
> >
> > BUILD=x86_64-linux-gnu
> > TARGET=i486-gnu
> > TOOLS=/somewhere/cross_tools
> > SYSROOT=/somewhere/target_tools
> 
> Note: While it is possible to build SYSROOT cross-tools, it is not in
> Debian cross defaults.

OK, it that even a possibility in the future?

> > Current method:
> > ===============
> > apt-get source package
> > mkdir build-package
> > cd build-package
> > ../package/configure --build=$BUILD --host=$HOST (+ other options)
> > make all
> > make install
> > No .deb package is created, all headers, libraries and executables are
> > directly installed in $SYSROOT.
> 
> Not sure, what you mean? What is 'package'? Are you trying to populate $SYSROOT?
> You might be able to do that from binary packages, using debootstrap
> or multistrap.

If I succeed with a cross build, it would be nice to get a .deb package
to copy to the target box and dpkg -i there! Populating sysroot is not
important, except for creating files to install on the target box if deb
creation is not possible. To me debootstrap and multistrap are creating
a (target) base system for use in a chroot. That wouldn't work cross-OS
would it, at least without copying the files to the target and reboot
into the target?

> > With cross-build dpkg-support:
> > ==============================
> > Set up where the cross tools and target headers, libraries and
> > executables are located.
> > cd package
> > DEB_BUILD_GNU_TYPE=$BUILD DEB_HOST_GNU_TYPE=$TARGET dpkg-buildpackage -b
> > That will create .debs to be installed on the target box or in $SYSROOT.
> 
> Actually, not all packages support cross compilation, you might need
> to check, proper way would be by setting -a$ARCH flag. So,
>   dpkg-buildpackage -b -ahurd-i386 (+extra flags)

Haven't tried yet. How is the cross-build environment found by
dpkg-buildpackage?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.