Skip to content

Commit

Permalink
generic-extlinux-compatible: allow loading a subset of dtbs to /boot
Browse files Browse the repository at this point in the history
  • Loading branch information
illegalprime committed May 3, 2019
1 parent 118faa3 commit f737bb0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let

timeoutStr = if blCfg.timeout == null then "-1" else toString blCfg.timeout;

makeBuilder = pkgs: pkgs.callPackage ./extlinux-conf-builder.nix { };
makeBuilder = pkgs: pkgs.callPackage ./extlinux-conf-builder.nix { dtbs = cfg.dtbs; };
builder = makeBuilder pkgs;
nativeBuilder = makeBuilder pkgs.buildPackages;
in
Expand All @@ -28,6 +28,15 @@ in
'';
};

dtbs = mkOption {
default = [];
type = types.listOf types.string;
description = ''
which DTBs to install to the boot partition,
if the list is empty the script will copy over all DTBs.
'';
};

configurationLimit = mkOption {
default = 20;
example = 10;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{ substituteAll, bash, coreutils, gnused, gnugrep }:
{ substituteAll, bash, coreutils, gnused, gnugrep
, dtbs }:

substituteAll {
src = ./extlinux-conf-builder.sh;
isExecutable = true;
path = [coreutils gnused gnugrep];
inherit bash;
inherit bash dtbs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@ copyToKernelsDir() {
# kernels or initrd if this script is ever interrupted.
if ! test -e $dst; then
local dstTmp=$dst.tmp.$$
cp -r $src $dstTmp
shift 1
if [[ ${1:-} ]]; then
for f in "$@"; do
local dir="$(dirname "$f")"
mkdir -p "$dstTmp/$dir"
cp "$src/$f" "$dstTmp/$dir/"
done
else
cp -r $src $dstTmp
fi
mv $dstTmp $dst
fi
filesCopied[$dst]=1
Expand All @@ -75,10 +84,10 @@ addEntry() {

copyToKernelsDir "$path/kernel"; kernel=$result
copyToKernelsDir "$path/initrd"; initrd=$result
# XXX UGLY: maybe the system config should have a top-level "dtbs" entry?

dtbDir=$(readlink -m "$path/kernel/../dtbs")
if [ -d "$dtbDir" ]; then
copyToKernelsDir "$dtbDir"; dtbs=$result
copyToKernelsDir "$dtbDir" @dtbs@; dtbs=$result
fi

timestampEpoch=$(stat -L -c '%Z' $path)
Expand Down

0 comments on commit f737bb0

Please sign in to comment.