From 6b896975ef733a88f532f3cde4d27913b2f6e5ef Mon Sep 17 00:00:00 2001 From: Andrew Kidd Date: Tue, 31 Dec 2024 13:12:57 +0000 Subject: [PATCH] rem firmware dir --- net-image/default.nix | 12 ++++++------ net-image/make-root-fs.nix | 6 ++---- net-image/net-image.nix | 23 +++++------------------ 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/net-image/default.nix b/net-image/default.nix index ef196d9..cacfcb1 100644 --- a/net-image/default.nix +++ b/net-image/default.nix @@ -37,19 +37,19 @@ populate-kernel = if cfg.uboot.enable 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 '' - cp "${kernel}" firmware/kernel.img - cp "${initrd}" firmware/initrd - cp "${kernel-params}" firmware/cmdline.txt + cp "${kernel}" ./kernel.img + cp "${initrd}" ./initrd + cp "${kernel-params}" ./cmdline.txt ''; in { populateFirmwareCommands = '' ${populate-kernel} - cp -r ${pkgs.raspberrypifw}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} firmware - cp ${config.hardware.raspberry-pi.config-output} firmware/config.txt + cp -r ${pkgs.raspberrypifw}/share/raspberrypi/boot/{start*.elf,*.dtb,bootcode.bin,fixup*.dat,overlays} ./ + cp ${config.hardware.raspberry-pi.config-output} ./config.txt ''; populateRootCommands = if cfg.uboot.enable diff --git a/net-image/make-root-fs.nix b/net-image/make-root-fs.nix index 34d30c8..e1471b4 100644 --- a/net-image/make-root-fs.nix +++ b/net-image/make-root-fs.nix @@ -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 -# contents of a directory that can be populated with commands. The -# generated image is sized to only fit its contents, with the expectation -# that a script resizes the filesystem at boot time. +# contents of a directory that can be populated with commands. { pkgs, lib, diff --git a/net-image/net-image.nix b/net-image/net-image.nix index 17ab9d6..7be6e59 100644 --- a/net-image/net-image.nix +++ b/net-image/net-image.nix @@ -78,11 +78,11 @@ in populateFirmwareCommands = mkOption { example = - literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''"; + literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin ./ ''"; description = '' - Shell commands to populate the ./firmware directory. + Shell commands to populate the ./ directory. 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. ''; }; - - 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 = { @@ -131,13 +121,10 @@ in mkdir -p $rootfs cp -r ${rootfsImage} $rootfs - # Populate the files intended for /boot/firmware - mkdir -p firmware + # Populate the files intended for tftp ${config.netImage.populateFirmwareCommands} mkdir -p $bootfs - cp -r firmware $bootfs - - ${config.netImage.postBuildCommands} + cp -r . $bootfs ''; }) { };