Merge pull request #90119 from samueldr/feature/rpi4-fixups
Fix some pitfalls from the Raspberry Pi 4 specific sd image
This commit is contained in:
commit
f203b8b277
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
sdImage = {
|
sdImage = {
|
||||||
firmwareSize = 128;
|
firmwareSize = 128;
|
||||||
|
firmwarePartitionName = "NIXOS_BOOT";
|
||||||
# This is a hack to avoid replicating config.txt from boot.loader.raspberryPi
|
# This is a hack to avoid replicating config.txt from boot.loader.raspberryPi
|
||||||
populateFirmwareCommands =
|
populateFirmwareCommands =
|
||||||
"${config.system.build.installBootLoader} ${config.system.build.toplevel} -d ./firmware";
|
"${config.system.build.installBootLoader} ${config.system.build.toplevel} -d ./firmware";
|
||||||
@ -25,6 +26,12 @@
|
|||||||
populateRootCommands = "";
|
populateRootCommands = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot/firmware" = {
|
||||||
|
# This effectively "renames" the loaOf entry set in sd-image.nix
|
||||||
|
mountPoint = "/boot";
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
# the installation media is also the installation target,
|
# the installation media is also the installation target,
|
||||||
# so we don't want to provide the installation configuration.nix.
|
# so we don't want to provide the installation configuration.nix.
|
||||||
installer.cloneConfig = false;
|
installer.cloneConfig = false;
|
||||||
|
@ -63,6 +63,14 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
firmwarePartitionName = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "FIRMWARE";
|
||||||
|
description = ''
|
||||||
|
Name of the filesystem which holds the boot firmware.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
rootPartitionUUID = mkOption {
|
rootPartitionUUID = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
@ -114,7 +122,7 @@ in
|
|||||||
config = {
|
config = {
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/boot/firmware" = {
|
"/boot/firmware" = {
|
||||||
device = "/dev/disk/by-label/FIRMWARE";
|
device = "/dev/disk/by-label/${config.sdImage.firmwarePartitionName}";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
# Alternatively, this could be removed from the configuration.
|
# Alternatively, this could be removed from the configuration.
|
||||||
# The filesystem is not needed at runtime, it could be treated
|
# The filesystem is not needed at runtime, it could be treated
|
||||||
@ -178,7 +186,7 @@ in
|
|||||||
# Create a FAT32 /boot/firmware partition of suitable size into firmware_part.img
|
# Create a FAT32 /boot/firmware partition of suitable size into firmware_part.img
|
||||||
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
|
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
|
||||||
truncate -s $((SECTORS * 512)) firmware_part.img
|
truncate -s $((SECTORS * 512)) firmware_part.img
|
||||||
faketime "1970-01-01 00:00:00" mkfs.vfat -i ${config.sdImage.firmwarePartitionID} -n FIRMWARE firmware_part.img
|
faketime "1970-01-01 00:00:00" mkfs.vfat -i ${config.sdImage.firmwarePartitionID} -n ${config.sdImage.firmwarePartitionName} firmware_part.img
|
||||||
|
|
||||||
# Populate the files intended for /boot/firmware
|
# Populate the files intended for /boot/firmware
|
||||||
mkdir firmware
|
mkdir firmware
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#! @bash@/bin/sh -e
|
#! @bash@/bin/sh
|
||||||
|
|
||||||
|
# This can end up being called disregarding the shebang.
|
||||||
|
set -e
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user