rem firmware dir

This commit is contained in:
Andrew Kidd 2024-12-31 13:12:57 +00:00
parent 5242e479ef
commit 6b896975ef
3 changed files with 13 additions and 28 deletions

View file

@ -37,19 +37,19 @@
populate-kernel = populate-kernel =
if cfg.uboot.enable if cfg.uboot.enable
then '' then ''
cp ${cfg.uboot.package}/u-boot.bin firmware/u-boot-rpi-arm64.bin cp ${cfg.uboot.package}/u-boot.bin ./u-boot-rpi-arm64.bin
'' ''
else '' else ''
cp "${kernel}" firmware/kernel.img cp "${kernel}" ./kernel.img
cp "${initrd}" firmware/initrd cp "${initrd}" ./initrd
cp "${kernel-params}" firmware/cmdline.txt cp "${kernel-params}" ./cmdline.txt
''; '';
in in
{ {
populateFirmwareCommands = '' populateFirmwareCommands = ''
${populate-kernel} ${populate-kernel}
cp -r ${pkgs.raspberrypifw}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} firmware cp -r ${pkgs.raspberrypifw}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} ./
cp ${config.hardware.raspberry-pi.config-output} firmware/config.txt cp ${config.hardware.raspberry-pi.config-output} ./config.txt
''; '';
populateRootCommands = populateRootCommands =
if cfg.uboot.enable if cfg.uboot.enable

View file

@ -1,8 +1,6 @@
# Builds an ext4 image containing a populated /nix/store with the closure # Builds a directory containing a populated /nix/store with the closure
# of store paths passed in the storePaths parameter, in addition to the # of store paths passed in the storePaths parameter, in addition to the
# contents of a directory that can be populated with commands. The # contents of a directory that can be populated with commands.
# generated image is sized to only fit its contents, with the expectation
# that a script resizes the filesystem at boot time.
{ {
pkgs, pkgs,
lib, lib,

View file

@ -78,11 +78,11 @@ in
populateFirmwareCommands = mkOption { populateFirmwareCommands = mkOption {
example = example =
literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''"; literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin ./ ''";
description = '' description = ''
Shell commands to populate the ./firmware directory. Shell commands to populate the ./ directory.
All files in that directory are copied to the All files in that directory are copied to the
/boot/firmware partition on the Netboot image. tftp files on the Netboot image.
''; '';
}; };
@ -96,16 +96,6 @@ in
populate the ./files/boot (/boot) directory. populate the ./files/boot (/boot) directory.
''; '';
}; };
postBuildCommands = mkOption {
example = literalExpression
"'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''";
default = "";
description = ''
Shell commands to run after the image is built.
Can be used for boards requiring to dd u-boot SPL before actual partitions.
'';
};
}; };
config = { config = {
@ -131,13 +121,10 @@ in
mkdir -p $rootfs mkdir -p $rootfs
cp -r ${rootfsImage} $rootfs cp -r ${rootfsImage} $rootfs
# Populate the files intended for /boot/firmware # Populate the files intended for tftp
mkdir -p firmware
${config.netImage.populateFirmwareCommands} ${config.netImage.populateFirmwareCommands}
mkdir -p $bootfs mkdir -p $bootfs
cp -r firmware $bootfs cp -r . $bootfs
${config.netImage.postBuildCommands}
''; '';
}) })
{ }; { };