From ff0a4904d18b88e6f5c62824446fb656d1530528 Mon Sep 17 00:00:00 2001 From: "Brent, Bohan Yang" <8384161+bohanyang@users.noreply.github.com> Date: Sat, 1 Oct 2022 21:03:18 +0900 Subject: [PATCH] Force lowmem (fixes #45) (#66) * Add --force-lowmem * Fix --- README.md | 1 + debi.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 1f8c94c..75ffc7e 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ Otherwise, you can run this command to revert all changes made by the script: * `--firmware` Load additional [non-free firmwares](https://wiki.debian.org/Firmware#Firmware_during_the_installation) * `--no-force-efi-extra-removable` [See](https://wiki.debian.org/UEFI#Force_grub-efi_installation_to_the_removable_media_path) * `--grub-timeout 5` How many seconds the GRUB menu shows before entering the installer + * `--force-lowmem ` Valid values: 0, 1, 2. Force [low memory level](https://salsa.debian.org/installer-team/lowmem). Useful if your machine has memory less than 500M where level 2 is set (see issue #45). `--force-lowmem 1` may solve it. * `--dry-run` Print generated preseed and GRUB entry without downloading the installer and actually saving them ### Presets diff --git a/debi.sh b/debi.sh index eca1b45..f6cfceb 100755 --- a/debi.sh +++ b/debi.sh @@ -228,6 +228,7 @@ install_recommends=true install='ca-certificates libpam-systemd' upgrade= kernel_params= +force_lowmem= bbr=false ssh_port= hold=false @@ -348,6 +349,11 @@ while [ $# -gt 0 ]; do --no-part|--no-disk-partitioning) disk_partitioning=false ;; + --force-lowmem) + [ "$2" != 0 ] && [ "$2" != 1 ] && [ "$2" != 2 ] && err 'Low memory level can only be 0, 1 or 2' + force_lowmem=$2 + shift + ;; --disk) disk=$2 shift @@ -822,6 +828,8 @@ installer_directory=$(grub2-mkrelpath "$mkrelpath" 2> /dev/null) || { kernel_params="$kernel_params lowmem/low=1" +[ -n "$force_lowmem" ] && kernel_params="$kernel_params lowmem=+$force_lowmem" + initrd="$installer_directory/initrd.gz" [ "$firmware" = true ] && initrd="$initrd $installer_directory/firmware.cpio.gz"