remove boot-scr output, merge into tftpboot
(1) it creates two things (script and dtb); (2) it's a bit pointless without the tftpboot output it depends on
This commit is contained in:
parent
c7b2733bea
commit
44a0cf364b
1 changed files with 11 additions and 26 deletions
|
@ -35,22 +35,18 @@ in {
|
||||||
It uses the Linux `phram <https://github.com/torvalds/linux/blob/master/drivers/mtd/devices/phram.c>`_ driver to emulate a flash device using a segment of physical RAM.
|
It uses the Linux `phram <https://github.com/torvalds/linux/blob/master/drivers/mtd/devices/phram.c>`_ driver to emulate a flash device using a segment of physical RAM.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
boot-scr = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
internal = true;
|
|
||||||
description = ''
|
|
||||||
U-Boot commands to load and boot a kernel and rootfs over TFTP.
|
|
||||||
Copy-paste into the device boot monitor
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
boot.ramdisk.enable = true;
|
boot.ramdisk.enable = true;
|
||||||
|
|
||||||
system.outputs = rec {
|
system.outputs = rec {
|
||||||
tftpboot =
|
tftpboot =
|
||||||
let o = config.system.outputs; in
|
let
|
||||||
pkgs.runCommand "tftpboot" {} ''
|
inherit (pkgs.lib.trivial) toHexString;
|
||||||
|
o = config.system.outputs;
|
||||||
|
cmdline = concatStringsSep " " config.boot.commandLine;
|
||||||
|
in
|
||||||
|
pkgs.runCommand "tftpboot" { nativeBuildInputs = [ pkgs.pkgsBuildBuild.dtc ]; } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
ln -s ${o.rootfs} rootfs
|
ln -s ${o.rootfs} rootfs
|
||||||
|
@ -58,17 +54,6 @@ in {
|
||||||
ln -s ${o.manifest} manifest
|
ln -s ${o.manifest} manifest
|
||||||
ln -s ${o.kernel.headers} build
|
ln -s ${o.kernel.headers} build
|
||||||
ln -s ${o.uimage} uimage
|
ln -s ${o.uimage} uimage
|
||||||
ln -s ${o.boot-scr}/dtb dtb
|
|
||||||
ln -s ${o.boot-scr}/script boot.scr
|
|
||||||
'';
|
|
||||||
|
|
||||||
boot-scr =
|
|
||||||
let
|
|
||||||
inherit (pkgs.lib.trivial) toHexString;
|
|
||||||
o = config.system.outputs;
|
|
||||||
cmdline = concatStringsSep " " config.boot.commandLine;
|
|
||||||
in
|
|
||||||
pkgs.buildPackages.runCommand "boot-scr" { nativeBuildInputs = [ pkgs.pkgsBuildBuild.dtc ]; } ''
|
|
||||||
uimageSize=$(($(stat -L -c %s ${o.uimage}) + 0x1000 &(~0xfff)))
|
uimageSize=$(($(stat -L -c %s ${o.uimage}) + 0x1000 &(~0xfff)))
|
||||||
rootfsStart=$(printf %x $((${toString cfg.loadAddress} + 0x100000 + $uimageSize &(~0xfffff) )))
|
rootfsStart=$(printf %x $((${toString cfg.loadAddress} + 0x100000 + $uimageSize &(~0xfffff) )))
|
||||||
rootfsBytes=$(($(stat -L -c %s ${o.rootfs}) + 0x100000 &(~0xfffff)))
|
rootfsBytes=$(($(stat -L -c %s ${o.rootfs}) + 0x100000 &(~0xfffff)))
|
||||||
|
@ -78,7 +63,6 @@ in {
|
||||||
|
|
||||||
dtbStart=$(printf %x $((${toString cfg.loadAddress} + $rootfsBytes + 0x100000 + $uimageSize )))
|
dtbStart=$(printf %x $((${toString cfg.loadAddress} + $rootfsBytes + 0x100000 + $uimageSize )))
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
cat ${o.dtb} > $out/dtb
|
cat ${o.dtb} > $out/dtb
|
||||||
address_cells=$(fdtget $out/dtb / '#address-cells')
|
address_cells=$(fdtget $out/dtb / '#address-cells')
|
||||||
size_cells=$(fdtget $out/dtb / '#size-cells')
|
size_cells=$(fdtget $out/dtb / '#size-cells')
|
||||||
|
@ -94,7 +78,7 @@ in {
|
||||||
# dtc -I dtb -O dts -o /dev/stdout $out/dtb | grep -A10 reserved-mem ; exit 1
|
# dtc -I dtb -O dts -o /dev/stdout $out/dtb | grep -A10 reserved-mem ; exit 1
|
||||||
dtbBytes=$(($(stat -L -c %s $out/dtb) + 0x1000 &(~0xfff)))
|
dtbBytes=$(($(stat -L -c %s $out/dtb) + 0x1000 &(~0xfff)))
|
||||||
|
|
||||||
cat > $out/script << EOF
|
cat > $out/boot.scr << EOF
|
||||||
setenv serverip ${cfg.serverip}
|
setenv serverip ${cfg.serverip}
|
||||||
setenv ipaddr ${cfg.ipaddr}
|
setenv ipaddr ${cfg.ipaddr}
|
||||||
setenv bootargs 'liminix ${cmdline} $cmd'
|
setenv bootargs 'liminix ${cmdline} $cmd'
|
||||||
|
@ -102,6 +86,7 @@ in {
|
||||||
bootm 0x${lib.toHexString cfg.loadAddress} - 0x$dtbStart
|
bootm 0x${lib.toHexString cfg.loadAddress} - 0x$dtbStart
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue