From 7d5a370ffe8e93d259fcb8734d073a1ae7ab4720 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?=
 <lukasz.zemczak@canonical.com>
Date: Mon, 22 Jan 2024 16:46:37 +0100
Subject: [PATCH 1/2] Add a largemem subarch that ships a 64k kernel variant by
 default.

---
 live-build/auto/config                                   | 9 +++++++++
 .../ubuntu-server/hooks/03-kernel-metapkg.chroot_early   | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/live-build/auto/config b/live-build/auto/config
index 8ef56701..58990208 100755
--- a/live-build/auto/config
+++ b/live-build/auto/config
@@ -867,6 +867,9 @@ case $PROJECT in
 						# However, for RISC-V we only offer one kernel
 						variants='ga'
 						;;
+					arm64+largemem)
+						variants='ga-64k hwe-64k'
+						;;
 					*)
 						variants='ga hwe'
 						;;
@@ -879,6 +882,12 @@ case $PROJECT in
 					elif [ "$variant" = "hwe" ]; then
 						kernel_metapkg=linux-generic-hwe-$(lsb_release -sr)
 						flavor=generic-hwe
+					elif [ "$variant" = "ga-64k" ]; then
+						kernel_metapkg=linux-generic-64k
+						flavor=generic-64k
+					elif [ "$variant" = "hwe-64k" ]; then
+						kernel_metapkg=linux-generic-64k-hwe-$(lsb_release -sr)
+						flavor=generic-64k-hwe
 					elif [ "$variant" = "intel" ]; then
 						kernel_metapkg=linux-intel-iotg
 						flavor=intel-iotg
diff --git a/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early b/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early
index 4acbe473..177ce8c1 100755
--- a/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early
+++ b/live-build/ubuntu-server/hooks/03-kernel-metapkg.chroot_early
@@ -8,6 +8,10 @@ case $PASS in
             kernel_metapkg=linux-generic
         elif [ "$flavor" = "generic-hwe" ]; then
             kernel_metapkg=linux-generic-hwe-$(lsb_release -sr)
+        elif [ "$flavor" = "generic-64k" ]; then
+            kernel_metapkg=linux-generic-64k
+        elif [ "$flavor" = "generic-64k-hwe" ]; then
+            kernel_metapkg=linux-generic-64k-hwe-$(lsb_release -sr)
         elif [ "$flavor" = "intel-iotg" ]; then
             kernel_metapkg=linux-intel-iotg
         elif [ "$flavor" = "nvidia-tegra" ]; then

From e8f7935ffae9f2c3c10dd2719d6938c34693ac69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?=
 <lukasz.zemczak@canonical.com>
Date: Mon, 22 Jan 2024 16:54:24 +0100
Subject: [PATCH 2/2] Add changelog.

---
 debian/changelog | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1655a3db..3eccb3cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+livecd-rootfs (2.765.37) UNRELEASED; urgency=medium
+
+  * Add a largemem subarch for ubuntu-server that ships a 64k kernel variant
+    by default (LP: #2050209)
+
+ -- Ɓukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>  Mon, 22 Jan 2024 16:46:49 +0100
+
 livecd-rootfs (2.765.36) jammy; urgency=medium
 
   * Use correct /etc/ssh/sshd_config.d/ filename so cloud-init overrides