22title : " Enable LUKS2 and Argon2 Support for Packages"
33weight : 332
44vars :
5- patches_base_url : " res/collections/gentoo-config-luks2-grub-systemd"
65 memregion_patch : " 4500-grub-2.06-runtime-memregion-alloc.patch"
76 argon2_patch_206 : " 5000-grub-2.06-luks2-argon2-v4.patch"
87 argon2_patch_212 : " grub-2.12-luks2-argon2-v4.patch"
98 aur_patch : " 9500-grub-AUR-improved-luks2.patch"
9+ lastmod : 2023-12-24
1010---
1111
1212Because the LUKS partition uses LUKS2 and Argon2id, support for these LUKS
@@ -44,8 +44,10 @@ need some patches for LUKS2 with Argon2id support.
4444
4545### GRUB 2.12
4646
47- GRUB 2.12 only needs one patch [ ` {{< param vars.argon2_patch_212 >}} ` ] ({{<
48- patchesBaseURL.inline >}}{{- relURL .Page.Params.vars.patches_base_url -}}
47+ GRUB 2.12 only needs one patch [ ` {{< param vars.argon2_patch_212 >}} ` ] (
48+ {{< patchesBaseURL.inline >}}
49+ {{- partial "static-path.html" (dict
50+ "page" (index .Page.Ancestors.Reverse 2) "type" "res") -}}
4951{{< /patchesBaseURL.inline >}}/{{< param vars.argon2_patch_212 >}}) to get
5052support for LUKS2 with Argon2. This patch was originally [ submitted to the
5153grub-devel mailing list] [ grub-devel-argon2-v4 ] and targeted GRUB 2.06; I ported
@@ -65,16 +67,20 @@ To apply this patch to Gentoo's GRUB package -- `sys-boot/grub`, add it as a
6567applied to all Gentoo revisions of GRUB 2.12 (` -r1 ` , ` -r2 ` , etc.). The
6668following commands may be used to do this:
6769
68- {{< commands.inline >}}
69- {{ $content := `# mkdir -p /etc/portage/patches/sys-boot/grub-2.12
70- # cd /etc/portage/patches/sys-boot/grub-2.12
71- ` }}
72- {{- $patches := slice
73- .Page.Params.vars.argon2_patch_212
74- }}
70+ {{< commands.inline "2.12" "argon2_patch_212" >}}
71+ {{- $grubVer := .Get 0 }}
72+ {{- $patches := split (.Get 1) " " }}
73+ {{- $patches = apply $patches "printf" "vars.%s" "." }}
74+ {{- $patches = apply $patches "page.Param" "." }}
75+
76+ {{ $content := print
77+ "# mkdir -p /etc/portage/patches/sys-boot/grub-" $grubVer | println }}
78+ {{ $content := print $content
79+ "# cd /etc/portage/patches/sys-boot/grub-" $grubVer | println }}
80+ {{- $baseURL := partial "static-path.html" (dict
81+ "page" (index .Page.Ancestors.Reverse 2) "type" "res" "abs" true) }}
7582{{- range $patches }}
76- {{- $url := printf "%s/%s" $.Page.Params.vars.patches_base_url . | absURL }}
77- {{- $content = print $content "# curl -O " $url | println }}
83+ {{- $content = print $content "# curl -O " $baseURL "/" . | println }}
7884{{- end }}
7985{{- highlight $content "console" }}
8086{{< /commands.inline >}}
@@ -141,21 +147,7 @@ arbitrary.
141147Similar to the case of GRUB 2.12, add these patches as Portage user patches to
142148` /etc/portage/patches/sys-boot/grub-2.06 ` :
143149
144- {{< commands.inline >}}
145- {{ $content := `# mkdir -p /etc/portage/patches/sys-boot/grub-2.06
146- # cd /etc/portage/patches/sys-boot/grub-2.06
147- ` }}
148- {{- $patches := slice
149- .Page.Params.vars.memregion_patch
150- .Page.Params.vars.argon2_patch_206
151- .Page.Params.vars.aur_patch
152- }}
153- {{- range $patches }}
154- {{- $url := printf "%s/%s" $.Page.Params.vars.patches_base_url . | absURL }}
155- {{- $content = print $content "# curl -O " $url | println }}
156- {{- end }}
157- {{- highlight $content "console" }}
158- {{< /commands.inline >}}
150+ {{< commands.inline "2.06" "memregion_patch argon2_patch_206 aur_patch" />}}
159151
160152Then, add the required environment variables to
161153` /etc/portage/env/sys-boot/grub-2.06 ` :
0 commit comments