[Nix-dev] Cross Compiling for Raspberry PI

Alexander Foremny alexanderforemny at gmail.com
Mon Jul 23 18:51:25 CEST 2012


Hello,

I am currently trying to cross compile some packages for the Raspberry
PI. In my private Nixpkgs repository I created the file
raspberrypi.nix. The relevant parts of that file follow.

> import ./default.nix {
> crossSystem = {
>   platform = {
>     kernelBaseConfig = "bcmrpi_defconfig";
>     kernelHeadersBaseConfig = "bcmrpi_defconfig";
>   };
> config.packageOverrides = pkgs: {
>   linux_3_5 = pkgs.linux_3_5.override {
>     kernelPatches = [ pkgs.kernelPatches.raspberrypi_defconfig ];
>   };
> };
> }

I created a raspberry_defconfig patch which adds the file
bcmrpi_defconfig to the Linux kernel's source tree. Now I'd like to
try building kernel-headers for the Raspberry PI, thus I ran.

> $ nix-build -A linux_3_5.hostDrv raspberrypi.nix --dry-run
> these derivations will be built:
>   /nix/store/31vqzwfyqw52y0s1jy57i1fwx9clcjfh-gcc-4.6.3-arm-unknown-linux-stage-static.drv
> ...
>   /nix/store/pxlbdi3sxfisi7z0q9pxgbavjhy2k49v-linux-headers-3.5.drv

Actually building it starts with building
gcc-4.6.3-arm-unknown-linux-stage-static, but fails with the error,
that the file bcmrpi_defconfig is not present.

> ...
> ***
> *** Can't find default configuration "arch/arm/configs/bcmrpi_defconfig"!
> ***
> make[1]: *** [bcmrpi_defconfig] Error 1
> checking for arm-unknown-linux-nm... make: *** [bcmrpi_defconfig] Error 2
> builder for `/nix/store/pxlbdi3sxfisi7z0q9pxgbavjhy2k49v-linux-headers-3.5.drv' failed with exit code 2

I am guessing that gcc needs the kernel headers and since
crossSystem.platform.kernelHeadersBaseConfig is set to
bcmrpi_defconfig, gcc needs this file. Is this correct?

Would it be a solution, to use a different kernelHeadersBaseConfig
setting? Would it be a solution, to patch gcc's Nix expression?

Regards,
Alexander Foremny


More information about the nix-dev mailing list