From 24bdb23d31f780ab75b2f64ac755b21fc61b80a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 Oct 2023 13:59:29 +0000 Subject: [PATCH 1/3] Revert "Revert "Fix owner group ids"" This reverts commit 8fde693ba9208a49dad353b3b874061127f2b7b1. --- pkgs/bundle-image/builder.sh | 1 + pkgs/bundle-image/default.nix | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/bundle-image/builder.sh b/pkgs/bundle-image/builder.sh index 1e816416..212b8596 100644 --- a/pkgs/bundle-image/builder.sh +++ b/pkgs/bundle-image/builder.sh @@ -69,6 +69,7 @@ echo "copying to image..." cptofs -p \ -t ext4 \ -i "$diskImage" \ + --owner 11000 --group 11000 \ "$root"/* / || (echo >&2 "ERROR: cptofs failed. diskSize might be too small for closure."; exit 1) diff --git a/pkgs/bundle-image/default.nix b/pkgs/bundle-image/default.nix index a2347e94..6bd9a8e8 100644 --- a/pkgs/bundle-image/default.nix +++ b/pkgs/bundle-image/default.nix @@ -11,15 +11,21 @@ , jq , upgrade-maps , active-modules -, +, fetchFromGitHub }: let - label = "nixmodules-${revstring}"; - registry = ../../modules.json; - + # wating for upstream to include our patch: https://github.com/lkl/linux/pull/532 + lkl' = lkl.overrideAttrs (oldAttrs: { + src = fetchFromGitHub { + owner = "numtide"; + repo = "linux-lkl"; + rev = "7a337bf313c82713f33f7b2e3c0b8847857a78b6"; + sha256 = "sha256-MfOprw5n7kFOzu5Sl2hVG7+/Q22nKgCWGMO6HYN+SvU="; + }; + }); in derivation { @@ -34,7 +40,7 @@ derivation { PATH = lib.makeBinPath [ coreutils findutils - lkl + lkl' e2fsprogs jq ]; From 21ce082d83f1cfb37896b6c664992dff555c957f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 Oct 2023 14:04:53 +0000 Subject: [PATCH 2/3] update lkl to a version that also properly umounts In the other version we had the issue that umount wouldn't sync the journal correctly (maybe because of some other regression in lkl) This is now fixed by mounting the filesystem read-only prior to umounting --- pkgs/bundle-image/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/bundle-image/default.nix b/pkgs/bundle-image/default.nix index 6bd9a8e8..81f3270b 100644 --- a/pkgs/bundle-image/default.nix +++ b/pkgs/bundle-image/default.nix @@ -17,13 +17,13 @@ let label = "nixmodules-${revstring}"; registry = ../../modules.json; - # wating for upstream to include our patch: https://github.com/lkl/linux/pull/532 + # wating for upstream to include our patch: https://github.com/lkl/linux/pull/532 and https://github.com/lkl/linux/pull/534 lkl' = lkl.overrideAttrs (oldAttrs: { src = fetchFromGitHub { owner = "numtide"; repo = "linux-lkl"; - rev = "7a337bf313c82713f33f7b2e3c0b8847857a78b6"; - sha256 = "sha256-MfOprw5n7kFOzu5Sl2hVG7+/Q22nKgCWGMO6HYN+SvU="; + rev = "2cbcbd26044f72e47740588cfa21bf0e7b698262"; + sha256 = "sha256-i7uc69bF84kkS7MahpgJ2EnWZLNah+Ees2oRGMzIee0="; }; }); in From 5cfc3ca70759cb2db28f762733f7e29c305f63ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 11 Oct 2023 14:26:46 +0000 Subject: [PATCH 3/3] bundle-image: avoiding copying the image by writing it directly in the nix store --- pkgs/bundle-image/builder.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/bundle-image/builder.sh b/pkgs/bundle-image/builder.sh index 212b8596..ebed7b05 100644 --- a/pkgs/bundle-image/builder.sh +++ b/pkgs/bundle-image/builder.sh @@ -33,7 +33,7 @@ cp "${env["upgrade-maps"]}/recommend-upgrade.json" $root/etc/nixmodules/recommen cp "${env["active-modules"]}" $root/etc/nixmodules/active-modules.json cp -a --reflink=auto "${env[registry]}" "$root/etc/nixmodules/modules.json" -diskImage=disk.raw +diskImage=$out/disk.raw # Compute required space in filesystem blocks diskUsage=$(find . ! -type d -print0 | du --files0-from=- --apparent-size --block-size "${env[blockSize]}" | cut -f1 | sum_lines) @@ -72,6 +72,3 @@ cptofs -p \ --owner 11000 --group 11000 \ "$root"/* / || (echo >&2 "ERROR: cptofs failed. diskSize might be too small for closure."; exit 1) - -echo "moving image to out..." -mv "$diskImage" "$out/disk.raw"