Compare commits
5 Commits
ac8b971cc0
...
b52133a28b
Author | SHA1 | Date | |
---|---|---|---|
b52133a28b | |||
44caefcd3b | |||
6e6b8790eb | |||
2e5a8a572e | |||
464d046b5a |
9
NEWS
9
NEWS
@ -132,4 +132,13 @@ and then run the generated `install.sh` script
|
|||||||
|
|
||||||
result/install.sh root@192.168.8.1
|
result/install.sh root@192.168.8.1
|
||||||
|
|
||||||
|
2024-12-16
|
||||||
|
|
||||||
|
Config options changed: if you had set config.hardware.dts.includes
|
||||||
|
(maybe in an out-of-tree device port) to specify the search paths
|
||||||
|
in which dtc finds include files, you will need to change this to
|
||||||
|
hardware.dts.includePaths.
|
||||||
|
|
||||||
|
The "new" hardware.dts.includes option is now for dtsi files which
|
||||||
|
should be merged into the device tree.
|
||||||
|
|
||||||
|
29
THOUGHTS.txt
29
THOUGHTS.txt
@ -6539,3 +6539,32 @@ using a Makefile
|
|||||||
|
|
||||||
idea 2: when a configuration contains levitate, something similar
|
idea 2: when a configuration contains levitate, something similar
|
||||||
but necessarily more "manual" to do the analogous thing
|
but necessarily more "manual" to do the analogous thing
|
||||||
|
|
||||||
|
|
||||||
|
Sun Dec 15 18:55:55 GMT 2024
|
||||||
|
|
||||||
|
Where we left off with this, rotuer was crashing randomly or failing
|
||||||
|
to boot every time we tried to add log shipping, which is not very
|
||||||
|
ideal. I started doing something with logging to /dev/pmsg0
|
||||||
|
(CONFIG_PSTORE_PMSG) but I think (there seems not to be anything
|
||||||
|
written down :-( ) that the gl-ar750 kernel needs it added to kconfig and device tree
|
||||||
|
|
||||||
|
https://wiki.postmarketos.org/wiki/User:Knuxify/Enabling_pstore_and_ramoops
|
||||||
|
|
||||||
|
we could add a new hardware.dts.dtsi = [] option so that any module
|
||||||
|
could add a new chunk of dts. (Ideally we'd call it `includes`
|
||||||
|
but that conflicts with the existing use of `includes` to specify
|
||||||
|
search path. Maybe rename?)
|
||||||
|
|
||||||
|
would we ever use it except in a hardware device definition?
|
||||||
|
(Or user config?) I guess if we were consistent with names
|
||||||
|
then we could set up nodes in the device file with status="disabled"
|
||||||
|
and enable them in the module, except that dt doesn't consistently
|
||||||
|
use status and in fact there isn't one for reserved-memory
|
||||||
|
|
||||||
|
we could use global config to enable pstore_msg and check it in
|
||||||
|
the device module to enable the needed hw support
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
00PA727 00PA735
|
||||||
|
@ -197,7 +197,7 @@
|
|||||||
rootDevice = "ubi0:liminix";
|
rootDevice = "ubi0:liminix";
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts";
|
src = "${openwrt.src}/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${openwrt.src}/target/linux/mediatek/dts"
|
"${openwrt.src}/target/linux/mediatek/dts"
|
||||||
"${config.system.outputs.kernel.modulesupport}/arch/arm64/boot/dts/mediatek/"
|
"${config.system.outputs.kernel.modulesupport}/arch/arm64/boot/dts/mediatek/"
|
||||||
];
|
];
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
rootDevice = "/dev/mtdblock5";
|
rootDevice = "/dev/mtdblock5";
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
src = "${openwrt.src}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${openwrt.src}/target/linux/ath79/dts"
|
"${openwrt.src}/target/linux/ath79/dts"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
|
src = "${openwrt.src}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${openwrt.src}/target/linux/ramips/dts"
|
"${openwrt.src}/target/linux/ramips/dts"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
src = "${openwrt.src}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${openwrt.src}/target/linux/ramips/dts"
|
"${openwrt.src}/target/linux/ramips/dts"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
# *correct* but it does at least boot
|
# *correct* but it does at least boot
|
||||||
dts = lib.mkForce {
|
dts = lib.mkForce {
|
||||||
src = "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/mti/malta.dts";
|
src = "${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/mti/malta.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/"
|
"${config.system.outputs.kernel.modulesupport}/arch/mips/boot/dts/"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -410,7 +410,7 @@
|
|||||||
rootDevice = "/dev/mtdblock3";
|
rootDevice = "/dev/mtdblock3";
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts";
|
src = "${openwrt.src}/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${openwrt.src}/target/linux/ramips/dts"
|
"${openwrt.src}/target/linux/ramips/dts"
|
||||||
"${config.system.outputs.kernel.modulesupport}/arch/arm64/boot/dts/mediatek/"
|
"${config.system.outputs.kernel.modulesupport}/arch/arm64/boot/dts/mediatek/"
|
||||||
];
|
];
|
||||||
|
@ -348,7 +348,7 @@
|
|||||||
|
|
||||||
dts = {
|
dts = {
|
||||||
src = "${config.system.outputs.kernel.modulesupport}/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts";
|
src = "${config.system.outputs.kernel.modulesupport}/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts";
|
||||||
includes = [
|
includePaths = [
|
||||||
"${config.system.outputs.kernel.modulesupport}/arch/arm/boot/dts/marvell/"
|
"${config.system.outputs.kernel.modulesupport}/arch/arm/boot/dts/marvell/"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
# Actually, this is not what we want.
|
# Actually, this is not what we want.
|
||||||
# This DTS is insufficient.
|
# This DTS is insufficient.
|
||||||
src = ./mt7621_zyxel_nwa50ax.dtsi;
|
src = ./mt7621_zyxel_nwa50ax.dtsi;
|
||||||
includes = [
|
includePaths = [
|
||||||
# Here's one weird trick to make `ubi` detection
|
# Here's one weird trick to make `ubi` detection
|
||||||
# out of the box.
|
# out of the box.
|
||||||
# We will write ubi on /dev/firmware_a:rootfs location
|
# We will write ubi on /dev/firmware_a:rootfs location
|
||||||
|
@ -24,11 +24,16 @@ in
|
|||||||
only for QEMU.
|
only for QEMU.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
includes = mkOption {
|
includePaths = mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of directories to search for DTS includes (.dtsi files)";
|
description = "List of directories to search for DTS includes (.dtsi files)";
|
||||||
type = types.listOf types.path;
|
type = types.listOf types.path;
|
||||||
};
|
};
|
||||||
|
includes = mkOption {
|
||||||
|
default = [ ];
|
||||||
|
description = "\"dtsi\" fragments to include in the generated device tree";
|
||||||
|
type = types.listOf types.path;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
defaultOutput = mkOption {
|
defaultOutput = mkOption {
|
||||||
description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"mtdimage\" or \"vmroot\"";
|
description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"mtdimage\" or \"vmroot\"";
|
||||||
|
@ -104,8 +104,8 @@ in
|
|||||||
system.outputs = rec {
|
system.outputs = rec {
|
||||||
dtb = liminix.builders.dtb {
|
dtb = liminix.builders.dtb {
|
||||||
inherit (config.boot) commandLine;
|
inherit (config.boot) commandLine;
|
||||||
dts = config.hardware.dts.src;
|
dts = config.hardware.dts.includes ++ [config.hardware.dts.src];
|
||||||
includes = config.hardware.dts.includes ++ [
|
includes = config.hardware.dts.includePaths ++ [
|
||||||
"${o.kernel.headers}/include"
|
"${o.kernel.headers}/include"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -84,6 +84,8 @@
|
|||||||
(false err) (expect (string.match err "path traversal"))))]
|
(false err) (expect (string.match err "path traversal"))))]
|
||||||
(expect= (append-path "/tmp" "hello") "/tmp/hello")
|
(expect= (append-path "/tmp" "hello") "/tmp/hello")
|
||||||
(expect= (append-path "/tmp/" "hello") "/tmp/hello")
|
(expect= (append-path "/tmp/" "hello") "/tmp/hello")
|
||||||
|
(expect= (append-path "/tmp/" "///hello") "/tmp/hello")
|
||||||
|
(expect= (append-path "/tmp/" "///hello/../fish") "/tmp/fish")
|
||||||
(traps "/tmp/" "../hello")
|
(traps "/tmp/" "../hello")
|
||||||
(expect= (append-path "/tmp/" "hello/../goodbye") "/tmp/goodbye")
|
(expect= (append-path "/tmp/" "hello/../goodbye") "/tmp/goodbye")
|
||||||
(traps "/tmp/" "hello/../../goodbye"))
|
(traps "/tmp/" "hello/../../goodbye"))
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
stdenv
|
stdenv
|
||||||
, dtc
|
, dtc
|
||||||
, lib
|
, lib
|
||||||
|
, runCommand
|
||||||
|
, writeText
|
||||||
}:
|
}:
|
||||||
{ dts
|
{ dts
|
||||||
, includes
|
, includes
|
||||||
@ -10,14 +12,20 @@
|
|||||||
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
||||||
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
||||||
cmdline = lib.concatStringsSep " " commandLine;
|
cmdline = lib.concatStringsSep " " commandLine;
|
||||||
|
chosen = writeText "chosen.dtsi" "/{ chosen { bootargs = ${builtins.toJSON cmdline}; }; };";
|
||||||
|
combined = writeText "combined-dts-fragments"
|
||||||
|
(lib.concatStrings
|
||||||
|
(builtins.map
|
||||||
|
(f: "#include \"${f}\"\n")
|
||||||
|
(dts ++ [ chosen ])));
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "dtb";
|
name = "dtb";
|
||||||
phases = [ "buildPhase" ];
|
phases = [ "buildPhase" ];
|
||||||
nativeBuildInputs = [ dtc ];
|
nativeBuildInputs = [ dtc ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${dts}
|
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${combined}
|
||||||
echo '/{ chosen { bootargs = ${builtins.toJSON cmdline}; }; };' >> dtb.tmp
|
|
||||||
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
||||||
|
# dtc -I dtb -O dts $out
|
||||||
test -e $out
|
test -e $out
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,18 @@
|
|||||||
|
|
||||||
(print (.. "TFTP serving from " options.base-directory))
|
(print (.. "TFTP serving from " options.base-directory))
|
||||||
|
|
||||||
(fn merge-pathname [directory filename]
|
;; this is a copy of anoia append-path
|
||||||
(if (directory:match "/$")
|
(fn merge-pathname [dirname filename]
|
||||||
(.. directory filename)
|
(let [base (or (string.match dirname "(.*)/$") dirname)
|
||||||
(.. directory "/" filename)))
|
result []]
|
||||||
|
(each [component (string.gmatch filename "([^/]+)")]
|
||||||
|
(if (and (= component "..") (> (# result) 0))
|
||||||
|
(table.remove result)
|
||||||
|
(= component "..")
|
||||||
|
(error "path traversal attempt")
|
||||||
|
true
|
||||||
|
(table.insert result component)))
|
||||||
|
(.. base "/" (table.concat result "/"))))
|
||||||
|
|
||||||
(->
|
(->
|
||||||
(tftp:listen
|
(tftp:listen
|
||||||
|
Loading…
Reference in New Issue
Block a user