Skip to content

Instantly share code, notes, and snippets.

@andoriyu
Created March 4, 2021 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andoriyu/1faa2d0a91845c231c5dae94f6c0ebaf to your computer and use it in GitHub Desktop.
Save andoriyu/1faa2d0a91845c231c5dae94f6c0ebaf to your computer and use it in GitHub Desktop.
hardware.deviceTree.filter = "bcm2708-rpi-zero*.dtb";
hardware.deviceTree.overlays = [{
name = "dwc2";
dtboFile = "${pkgs.device-tree_rpi.overlays}/dwc2.dtbo";
} # <<< Doesn't work
{
name = "hifiberry-dac";
dtboFile = "${pkgs.device-tree_rpi.overlays}/hifiberry-dac.dtbo";
} # <<< works
];
sdImage = {
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
[pi0]
kernel=u-boot-rpi0.bin
[pi1]
kernel=u-boot-rpi1.bin
'';
in ''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
cp ${pkgs.ubootRaspberryPiZero}/u-boot.bin firmware/u-boot-rpi0.bin
cp ${pkgs.ubootRaspberryPi}/u-boot.bin firmware/u-boot-rpi1.bin
cp ${configTxt} firmware/config.txt
'';
populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
};
these derivations will be built:
/nix/store/127kpw4sflvmpfpl715wdd4pqpr4pm57-device-tree-overlays.drv
/nix/store/73g1rv9d91l6mk70snwjfy5nffs6n7q1-nixos-system-igor-rpizero-21.05pre-git.drv
/nix/store/kmyzwxqcc5armwinwh7fvggkv3mm3xaj-closure-info.drv
/nix/store/zpq0mya5z1i3a2yc47shfk34iirxp6ip-ext4-fs.img.zst-armv6l-unknown-linux-gnueabihf.drv
/nix/store/khvwy09m4nyjlgzcv10v27ygv0vwx7kw-nixos-sd-image-21.05pre-git-armv6l-linux.img-armv6l-unknown-linux-gnueabihf.drv
building '/nix/store/127kpw4sflvmpfpl715wdd4pqpr4pm57-device-tree-overlays.drv'...
'./bcm2708-rpi-zero-w.dtb' -> '/nix/store/xr5g7cy14kakdcc8k8ljkbkdlk32awb5-device-tree-overlays/./bcm2708-rpi-zero-w.dtb'
'./bcm2708-rpi-zero.dtb' -> '/nix/store/xr5g7cy14kakdcc8k8ljkbkdlk32awb5-device-tree-overlays/./bcm2708-rpi-zero.dtb'
Applying overlay dwc2 to bcm2708-rpi-zero-w.dtb
Failed to apply '/nix/store/jq3cr9l1gj6gisb60wddab6x83gg0rb6-raspberrypi-firmware-1.20201201/share/raspberrypi/boot/overlays/dwc2.dtbo': FDT_ERR_NOTFOUND
builder for '/nix/store/127kpw4sflvmpfpl715wdd4pqpr4pm57-device-tree-overlays.drv' failed with exit code 1
cannot build derivation '/nix/store/73g1rv9d91l6mk70snwjfy5nffs6n7q1-nixos-system-igor-rpizero-21.05pre-git.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/kmyzwxqcc5armwinwh7fvggkv3mm3xaj-closure-info.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/zpq0mya5z1i3a2yc47shfk34iirxp6ip-ext4-fs.img.zst-armv6l-unknown-linux-gnueabihf.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/khvwy09m4nyjlgzcv10v27ygv0vwx7kw-nixos-sd-image-21.05pre-git-armv6l-linux.img-armv6l-unknown-linux-gnueabihf.drv': 1 dependencies couldn't be built
error: build of '/nix/store/khvwy09m4nyjlgzcv10v27ygv0vwx7kw-nixos-sd-image-21.05pre-git-armv6l-linux.img-armv6l-unknown-linux-gnueabihf.drv' failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment