3
0
Fork 0
forked from mirrors/nixpkgs

sd-image: Switch /boot to the ext4 partition

This commit is contained in:
Samuel Dionne-Riel 2019-06-01 21:14:05 -04:00
parent a0aff40f65
commit 53884e1b94
4 changed files with 25 additions and 5 deletions

View file

@ -46,7 +46,10 @@ in
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
cp ${pkgs.ubootRaspberryPi3_64bit}/u-boot.bin firmware/u-boot-rpi3.bin
cp ${configTxt} firmware/config.txt
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
'';
populateRootCommands = ''
mkdir -p ./files/boot
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
'';
};
}

View file

@ -50,7 +50,10 @@ in
cp ${pkgs.ubootRaspberryPi2}/u-boot.bin firmware/u-boot-rpi2.bin
cp ${pkgs.ubootRaspberryPi3_32bit}/u-boot.bin firmware/u-boot-rpi3.bin
cp ${configTxt} firmware/config.txt
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
'';
populateRootCommands = ''
mkdir -p ./files/boot
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
'';
};
}

View file

@ -39,7 +39,10 @@ in
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
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./firmware
'';
populateRootCommands = ''
mkdir -p ./files/boot
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
'';
};
}

View file

@ -14,6 +14,7 @@ with lib;
let
rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix ({
inherit (config.sdImage) storePaths;
populateImageCommands = config.sdImage.populateRootCommands;
volumeLabel = "NIXOS_SD";
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
uuid = config.sdImage.rootPartitionUUID;
@ -77,6 +78,16 @@ in
/boot/firmware partition on the SD image.
'';
};
populateRootCommands = mkOption {
example = literalExample "''\${extlinux-conf-builder} -t 3 -c \${config.system.build.toplevel} -d ./files/boot''";
description = ''
Shell commands to populate the ./files directory.
All files in that directory are copied to the
root (/) partition on the SD image. Use this to
populate the ./files/boot (/boot) directory.
'';
};
};
config = {
@ -117,8 +128,8 @@ in
label: dos
label-id: ${config.sdImage.firmwarePartitionID}
start=8M, size=$firmwareSizeBlocks, type=b, bootable
start=${toString (8 + config.sdImage.firmwareSize)}M, type=83
start=8M, size=$firmwareSizeBlocks, type=b
start=${toString (8 + config.sdImage.firmwareSize)}M, type=83, bootable
EOF
# Copy the rootfs into the SD image