patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Yureka <yuka@yuka.dev>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH] use statically linked cryptsetup in initramfs
Date: Wed, 16 Feb 2022 00:10:56 +0000	[thread overview]
Message-ID: <20220216001056.w4b3mnpoe5czhueb@eve> (raw)
In-Reply-To: <20211212141114.3238230-1-yuka@yuka.dev>

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

On Sun, Dec 12, 2021 at 03:11:14PM +0100, Yureka wrote:
> ---
>  host/initramfs/default.nix | 31 +++++++++++++++++++++++++++----
>  1 file changed, 27 insertions(+), 4 deletions(-)

Just a note to say, I didn't apply this particular patch because you'd
already fixed it in Nixpkgs by the time I saw it, but I have now (finally)
integrated static cryptsetup in Spectrum, and it's working and it made
the initramfs much smaller and faster to build.  Thanks so much for the
work you put into it!

> diff --git a/host/initramfs/default.nix b/host/initramfs/default.nix
> index ba6ede2..91e598f 100644
> --- a/host/initramfs/default.nix
> +++ b/host/initramfs/default.nix
> @@ -2,15 +2,38 @@
>
>  { lib, stdenv, runCommand, writeReferencesToFile, pkgsStatic
>  , busybox, cpio, cryptsetup, linux, lvm2
> +, fetchpatch
>  }:
>
> -let
> -  cryptsetup' = cryptsetup;
> -in
>  let
>    inherit (lib) cleanSource cleanSourceWith concatMapStringsSep;
>
> -  cryptsetup = cryptsetup'.override { lvm2 = lvm2.override { udev = null; }; };
> +  # https://github.com/NixOS/nixpkgs/pull/148948
> +  cryptsetup = (pkgsStatic.cryptsetup.override {
> +    lvm2 = (pkgsStatic.lvm2.override {
> +      udev = null;
> +    }).overrideAttrs (old: {
> +      patches = (old.patches or []) ++ [
> +        (fetchpatch {
> +          url = "https://raw.githubusercontent.com/NixOS/nixpkgs/bf8b0d818a6c5fa65f318603756762af492c1a0c/pkgs/os-specific/linux/lvm2/no-shared.diff";
> +          sha256 = "sha256-t67Osvcn92R7q9V+KDW+SyJDmajzVbnTPONlokcBU9U=";
> +        })
> +      ];
> +      configureFlags = old.configureFlags ++ [ "--enable-static_link" ];
> +      makeFlags = old.makeFlags ++ [ "libdm.device-mapper" ];
> +      installPhase = ''
> +        install -D -t $out/lib libdm/ioctl/libdevmapper.a
> +        make -C libdm install_include
> +        make -C libdm install_pkgconfig
> +      '';
> +      outputs = [ "out" ];
> +    });
> +  }).overrideAttrs (old: {
> +    NIX_LDFLAGS = "";
> +    configureFlags = old.configureFlags ++ [
> +      "--enable-static-cryptsetup"
> +    ];
> +  });
>
>    packages = [
>      cryptsetup pkgsStatic.mdevd pkgsStatic.execline
> --
> 2.34.0
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-02-16  0:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 14:11 Yureka
2022-02-16  0:10 ` Alyssa Ross [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220216001056.w4b3mnpoe5czhueb@eve \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    --cc=yuka@yuka.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).