From 3851698d35e355c2a4d2758ecc9cc9636e669588 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 13 Feb 2024 18:16:17 +0000 Subject: [PATCH] fix tftpboot compressed rootfs --- modules/outputs/tftpboot.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/outputs/tftpboot.nix b/modules/outputs/tftpboot.nix index 36d96ff..00674f2 100644 --- a/modules/outputs/tftpboot.nix +++ b/modules/outputs/tftpboot.nix @@ -80,14 +80,6 @@ in { ln -s ${image} image ln -s ${o.kernel} vmlinux # handy for gdb - ${if cfg.compressRoot - then '' - lzma -z9cv ${o.rootfs} > rootfs.lz - rootfsLzStart=$(($imageStart + $imageSize)) - rootfsLzSize=$(binsize rootfs.lz) - '' - else "ln -s ${o.rootfs} rootfs" - } cat ${o.dtb} > dtb address_cells=$(fdtget dtb / '#address-cells') size_cells=$(fdtget dtb / '#size-cells') @@ -103,6 +95,14 @@ in { dtbSize=$(binsize ./dtb ) imageStart=$(($dtbStart + $dtbSize)) + ${if cfg.compressRoot + then '' + lzma -z9cv ${o.rootfs} > rootfs.lz + rootfsLzStart=$(($imageStart + $imageSize)) + rootfsLzSize=$(binsize rootfs.lz) + '' + else "ln -s ${o.rootfs} rootfs" + } cmd="liminix ${cmdline} mtdparts=phram0:''${rootfsSize}(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsSize},${toString config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0"; fdtput -t s dtb /chosen bootargs "$cmd"