[Nix-dev] Cross Compile Environment with Package Management into Staging Area

Darcy Watkins DWatkins at tranzeo.com
Tue Mar 11 19:26:30 CET 2008


Hello,

At present, I use Buildroot to generate a cross compile toolchain and
root file system.  Due to some missing/broken pieces related to my
target architecture, I then have to build the kernel, U-boot and a few
other packages in an outer environment, but using the toolchain
generated by Buildroot.  Finally, I assemble my root file system by
merging the rootfs from Buildroot with my extra items.

For development and experimental purposes, the root file system for the
target is often NFS mounted or loaded up as a ramdisk image.  When it
comes to product development, we often use read-only cramfs root file
system images with NV data in a database stored in an alternate file
system (e.g. jffs2).  These are partitions in flash memory devices.
What this means is we have to do all the package management for the
target devices prior to generating firmware filesystem binary images.
This is probably not that different from generating a bootable "live"
CD-ROM (or flash drive) image except that it is all cross compiled.

I would like to experiment with package management using NIX, but I
think my case compares / contrasts as follows:

1.  The cross compile toolchains could build and install on my build
machine per the usual NIX approach provided that I can ensure that each
cross compile architecture (and variant that results in a new toolchain)
gets its own hash.  These all run on my build machine.  This could allow
me to build for multiple target architectures with each toolchain nicely
segregated to not mess each other up.

2.  In a team environment, the NIX provision to have a server hand out
prebuilt installable toolchain binaries would be of benefit.

3.  The cross compiled packages intended for use on embedded target
systems can be pre-built, but installation must be deferred since the
binaries will be installed into staging areas prior to generating
firmware root filesystem binary images.  This is a bit different from
how NIX installs on the build machine (and is not the same as how some
use ipkg to install packages on target machines).  I think that NIX
could manage this but would need expressions specific to this approach.

4.  It would be nice if the hash scheme used by NIX allows variations of
cross compiled packages to exist side by side differentiated based on
target architecture and config settings.  This would imply that if I
built multiple projects, or even just firmware image variants, the build
process would benefit from reusing binaries.  I could even push some of
these to server for team use.

I'd appreciate some comments / suggestion from any who considered or
have experimented with this.  I have found some notes related to cross
compiling.  Has anyone taken this further yet, or proposed collaboration
with Buildroot or OpenEmbedded project teams?

Regards,

Darcy






More information about the nix-dev mailing list