make config.hardware.dts.src nullable
This is for QEMU where we won't have to provide a dtb because the device tree is built by the platform according the (emulated) hardware present. Maybe in future there will be other hardware devices where we don't need to provide a dtb.
This commit is contained in:
parent
03b17fa3ed
commit
4229b42d82
2 changed files with 15 additions and 8 deletions
|
@ -16,8 +16,14 @@ in {
|
||||||
hardware = {
|
hardware = {
|
||||||
dts = {
|
dts = {
|
||||||
src = mkOption {
|
src = mkOption {
|
||||||
type = types.path;
|
type = types.nullOr types.path;
|
||||||
description = "Path to the device tree source (usually from OpenWrt)";
|
description = ''
|
||||||
|
If the device requires an external device tree to be loaded
|
||||||
|
alongside the kernel, this is the path to the device tree source
|
||||||
|
(we usually get these from OpenWrt). This value may be null if the
|
||||||
|
platform creates the device tree - currently this is the case
|
||||||
|
only for QEMU.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
includes = mkOption {
|
includes = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
|
|
|
@ -9,6 +9,7 @@ let
|
||||||
cfg = config.boot.loader.extlinux;
|
cfg = config.boot.loader.extlinux;
|
||||||
o = config.system.outputs;
|
o = config.system.outputs;
|
||||||
cmdline = concatStringsSep " " config.boot.commandLine;
|
cmdline = concatStringsSep " " config.boot.commandLine;
|
||||||
|
wantsDtb = config.hardware.dts ? src && config.hardware.dts.src != null;
|
||||||
in {
|
in {
|
||||||
options.system.outputs.extlinux = mkOption {
|
options.system.outputs.extlinux = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
@ -20,18 +21,18 @@ in {
|
||||||
system.outputs.extlinux = pkgs.runCommand "extlinux" {} ''
|
system.outputs.extlinux = pkgs.runCommand "extlinux" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
# cp {o.dtb} dtb
|
${if wantsDtb then "cp ${o.dtb} dtb" else "true"}
|
||||||
cp ${o.initramfs} initramfs
|
cp ${o.initramfs} initramfs
|
||||||
gzip -9f < ${o.kernel} > kernel.gz
|
cp ${o.zimage} kernel
|
||||||
mkdir extlinux
|
mkdir extlinux
|
||||||
cat > extlinux/extlinux.conf << _EOF
|
cat > extlinux/extlinux.conf << _EOF
|
||||||
menu title Liminix
|
menu title Liminix
|
||||||
timeout 100
|
timeout 100
|
||||||
label Liminix
|
label Liminix
|
||||||
kernel /boot/kernel.gz
|
kernel /boot/kernel
|
||||||
initrd /boot/initramfs
|
# initrd /boot/initramfs
|
||||||
append ${cmdline}
|
append ${cmdline} root=/dev/vda1
|
||||||
# fdt /boot/dtb
|
${if wantsDtb then "fdt /boot/dtb" else ""}
|
||||||
_EOF
|
_EOF
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue