Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions nixos/modules/system/boot/kernel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ in
ln -s ${config.system.build.initialRamdiskSecretAppender}/bin/append-initrd-secrets $out

ln -s ${config.hardware.firmware}/lib/firmware $out/firmware

${lib.optionalString (
config.hardware.deviceTree.enable
&& config.hardware.deviceTree.package != null
&& config.hardware.deviceTree.name != null)
# "ln -s ${config.boot.kernelPackages.package}/dtbs/${config.hardware.deviceTree.name} $out/dtb"
"ln -s ${config.hardware.deviceTree.package}/${config.hardware.deviceTree.name} $out/dtb"
}
'';

# Implement consoleLogLevel both in early boot and using sysctl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,29 @@ def write_entry(profile: str | None,
sort_key=bootspec.sortKey,
default=current
).write(sorted_first)

devicetree = None
dtb_link = f"{system_dir(profile, generation, specialisation)}/dtb"
if os.path.exists(dtb_link):
dtb_path = os.path.realpath(dtb_link)
if os.path.exists(dtb_path):
devicetree = copy_from_file(dtb_path)

with open(tmp_path, 'w') as f:
f.write(BOOT_ENTRY.format(title=title,
sort_key=bootspec.sortKey,
generation=generation,
kernel=kernel,
initrd=initrd,
kernel_params=kernel_params,
description=f"{bootspec.label}, built on {build_date}"))
if machine_id is not None:
f.write("machine-id %s\n" % machine_id)
if devicetree is not None:
f.write("devicetree %s\n" % devicetree)
f.flush()
os.fsync(f.fileno())
os.rename(tmp_path, entry_file)

def get_generations(profile: str | None = None) -> list[SystemIdentifier]:
gen_list = run(
Expand Down