[PATCH styhead 3/5] arm-systemready/linux-distros: Implement unattended Debian

Musa Antike <[email protected]>
Newsgroups org.yoctoproject.lists.meta-arm
Message-ID <[email protected]>
- Implement unattended installation for Debian
- Upgrade Debian version to 12.8.0

Signed-off-by: Musa Antike <[email protected]>
---
 .../arm-systemready-linux-distros-debian.bb   | 35 +++++++--
 .../unattended-boot-conf/Debian/preseed.cfg   | 75 +++++++++++++++++++
 2 files changed, 105 insertions(+), 5 deletions(-)
 create mode 100755 meta-arm-systemready/recipes-test/arm-systemready-linux-distros/files/unattended-boot-conf/Debian/preseed.cfg

diff --git a/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/arm-systemready-linux-distros-debian.bb b/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/arm-systemready-linux-distros-debian.bb
index 8dbb75c3..5e5ebc31 100644
--- a/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/arm-systemready-linux-distros-debian.bb
+++ b/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/arm-systemready-linux-distros-debian.bb
@@ -98,8 +98,33 @@ file://${COMMON_LICENSE_DIR}/OPL-1.0;md5=acdf1e4398bd93dc137e271c50316324 \
 file://${COMMON_LICENSE_DIR}/PD;md5=b3597d12946881e13cb3b548d1173851 \
 "
 
-PV = "12.4.0"
-# netinst, DVD-1
-ISO_TYPE = "netinst"
-SRC_URI = "https://cdimage.debian.org/mirror/cdimage/archive/${PV}/arm64/iso-cd/debian-${PV}-arm64-${ISO_TYPE}.iso;unpack=0;downloadfilename=${ISO_IMAGE_NAME}.iso"
-SRC_URI[sha256sum] = "d32d2c63350a932dc0d9d45665985b41413f9e01efc0eacbea981d435f553d3d"
+PV = "12.8.0"
+SRC_URI = "\
+    https://cdimage.debian.org/debian-cd/12.8.0/arm64/iso-dvd/debian-12.8.0-arm64-DVD-1.iso;unpack=0;downloadfilename=${ISO_IMAGE_NAME}.iso;name=debian_iso_image \
+    file://unattended-boot-conf/Debian/preseed.cfg \
+    "
+SRC_URI[debian_iso_image.sha256sum] = "8891fe48bb5a58ae54176eaa6440059bf852044d6b9ae77219e78f9ef8d65149"
+
+ISO_LABEL = "${@oe.utils.vartrue("DISTRO_UNATTENDED_INST_TESTS", "debian-12.8.0-arm64-1", "", d)}"
+BOOT_CATALOG = "${@oe.utils.vartrue("DISTRO_UNATTENDED_INST_TESTS", "boot.catalog", "", d)}"
+BOOT_IMAGE = "${@oe.utils.vartrue("DISTRO_UNATTENDED_INST_TESTS", "EFI/boot/bootaa64.efi", "", d)}"
+EFI_IMAGE = "${@oe.utils.vartrue("DISTRO_UNATTENDED_INST_TESTS", "boot/grub/efi.img", "", d)}"
+
+modifyiso() {
+    UNATTENDED_CONF_DIR="${UNPACKDIR}/unattended-boot-conf/Debian"
+
+    # Append the preseed.cfg file to the initrd
+    gunzip ${EXTRACTED_ISO_TEMP_DIR}/install.a64/initrd.gz
+    (cd ${UNATTENDED_CONF_DIR} && echo preseed.cfg | cpio -H newc -o -A -F ${EXTRACTED_ISO_TEMP_DIR}/install.a64/initrd)
+    gzip ${EXTRACTED_ISO_TEMP_DIR}/install.a64/initrd
+
+    #GRUB
+    # Disable timeout
+    sed -i '/^insmod gzio/ a set timeout=0' ${EXTRACTED_ISO_TEMP_DIR}/boot/grub/grub.cfg
+
+    # Update default menu entry to select automated install
+    sed -i '/^set timeout/ a set default="2>5"' ${EXTRACTED_ISO_TEMP_DIR}/boot/grub/grub.cfg
+
+    # Update kernel boot parameters to enable more text based console output
+    sed -i 's|linux    /install.a64/vmlinuz  auto=true priority=critical --- quiet|linux    /install.a64/vmlinuz auto=true priority=critical DEBIAN_FRONTEND=text --- nomodeset|g' ${EXTRACTED_ISO_TEMP_DIR}/boot/grub/grub.cfg
+}
diff --git a/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/files/unattended-boot-conf/Debian/preseed.cfg b/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/files/unattended-boot-conf/Debian/preseed.cfg
new file mode 100755
index 00000000..47a38c2b
--- /dev/null
+++ b/meta-arm-systemready/recipes-test/arm-systemready-linux-distros/files/unattended-boot-conf/Debian/preseed.cfg
@@ -0,0 +1,75 @@
+# Preconfiguration file for Debian unattended installation
+
+# Enable auto mode
+d-i auto-install/enable boolean true
+d-i debconf/priority select critical
+
+# Set language, country and locale
+d-i debian-installer/language string en
+d-i debian-installer/country string GB
+d-i debian-installer/locale string en_GB.UTF-8
+d-i keyboard-configuration/xkb-keymap select us
+
+# Set clock and timezone
+d-i clock-setup/utc boolean true
+d-i time/zone select Europe/London
+
+# Skip installing recommended packages
+d-i base-installer/install-recommends boolean false
+
+# Set user and password
+d-i passwd/root-login boolean false
+d-i passwd/user-fullname string user
+d-i passwd/username string user
+d-i passwd/user-password password unsafe
+d-i passwd/user-password-again password unsafe
+
+# Disable CD-ROM and set mirror
+d-i apt-setup/cdrom/set-first boolean false
+d-i mirror/country string manual NO
+d-i mirror/http/proxy string
+
+# Disable mirror selection
+d-i apt-setup/no_mirror boolean true
+d-i popularity-contest/participate boolean false
+
+# Skip package selection and upgrades
+d-i pkgsel/run_tasksel boolean false
+d-i pkgsel/upgrade select none
+
+# Ensure the 'dbus' package is installed
+d-i pkgsel/include string dbus
+
+# Set host and domain names
+d-i netcfg/get_hostname string debtest
+d-i netcfg/get_domain string unassigned-domain
+
+# Partitioning
+d-i partman-auto/disk string /dev/vda
+d-i partman-auto/init_automatically_partition select Guided - use entire disk
+d-i partman-auto/choose_recipe select All files in one partition (recommended for new users)
+d-i partman-auto/method string regular
+d-i partman/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+# Install GRUB bootloader
+d-i grub-installer/only_debian boolean true
+d-i grub-installer/bootdev string /dev/vda
+d-i grub-installer/bootloader-id string debian
+d-i grub-installer/efi-directory string /boot/efi
+
+# Handle errors automatically
+d-i debian-installer/exit-on-error boolean true
+
+# Late command to install GRUB and finalize boot setup
+d-i preseed/late_command string \
+    mount /dev/vda1 /target/boot/efi || true; \
+    in-target mkdir -p /boot/efi/EFI/boot || true; \
+    in-target grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=debian --removable || true; \
+    in-target update-grub || true; \
+    umount /target/boot/efi || true
+
+# Reboot after installation
+d-i finish-install/reboot_in_progress note
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.