From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id AB1F660393 for ; Tue, 1 Feb 2022 23:03:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A7CEF52BF for ; Tue, 1 Feb 2022 23:03:49 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id D96C452A0 for ; Tue, 1 Feb 2022 23:03:47 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B2BCC4567D for ; Tue, 1 Feb 2022 23:03:47 +0100 (CET) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Tue, 1 Feb 2022 23:03:30 +0100 Message-Id: <20220201220331.3491615-5-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220201220331.3491615-1-s.ivanov@proxmox.com> References: <20220201220331.3491615-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.104 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [RFC pve-kernel-meta 4/5] proxmox-boot: use grub for UEFI boot X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2022 22:03:49 -0000 originally systemd-boot was chosen for UEFI installs because of it's less invasive and economical configuration (add a few short files, instead of having update-grub run through /dev a few times identifying potentially interesting devices) However with the change to proxmox-boot-tool and also handling non-uefi installations we can deal with grub installed on an ESP anyways. This changeset changes proxmox-boot-tool to use grub for both boot-modes, unifying the experience (e.g. not needing to check the boot mode in order to set kernel commandline arguments) Signed-off-by: Stoiko Ivanov --- bin/proxmox-boot-tool | 23 ++++++++--------------- proxmox-boot/zz-proxmox-boot | 15 --------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool index 5397694..d8caa6b 100755 --- a/bin/proxmox-boot-tool +++ b/bin/proxmox-boot-tool @@ -150,26 +150,19 @@ init_bootloader() { echo "Mounting '$part' on '$esp_mp'." mount -t vfat "$part" "$esp_mp" - echo "Installing systemd-boot.." - mkdir -p "$esp_mp/$PMX_ESP_DIR" - bootctl_args="--path ${esp_mp}" + echo "Installing grub x86_64 target.." + grub_common_args="--boot-directory ${esp_mp} --no-floppy --bootloader-id=proxmox" + grub_efi_args="$grub_common_args --target=x86_64-efi --efi-directory=$esp_mp" if [ ! -d /sys/firmware/efi ]; then - bootctl_args="${bootctl_args} --no-variables" + grub_efi_args="$grub_efi_args --no-nvram" fi - bootctl ${bootctl_args} install - echo "Configuring systemd-boot.." - echo "timeout 3" > "$esp_mp/$PMX_LOADER_CONF.tmp" - echo "default proxmox-*" >> "$esp_mp/$PMX_LOADER_CONF.tmp" - mv "$esp_mp/$PMX_LOADER_CONF.tmp" "$esp_mp/$PMX_LOADER_CONF" + grub-install.real ${grub_efi_args} "/dev/$PKNAME" echo "Installing grub i386-pc target.." - grub-install.real \ - --boot-directory $esp_mp \ - --target i386-pc \ - --no-floppy \ - --bootloader-id='proxmox' \ - "/dev/$PKNAME" + grub_legacy_args="$grub_common_args --target=i386-pc" + grub-install.real ${grub_legacy_args} "/dev/$PKNAME" + echo "Unmounting '$part'." umount "$part" diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot index 5609af2..60948ac 100755 --- a/proxmox-boot/zz-proxmox-boot +++ b/proxmox-boot/zz-proxmox-boot @@ -75,10 +75,6 @@ update_esp_func() { { warn "creation of mountpoint ${mountpoint} failed - skipping"; return; } mount "${path}" "${mountpoint}" || \ { warn "mount of ${path} failed - skipping"; return; } - if [ ! -f "${mountpoint}/$PMX_LOADER_CONF" ]; then - warn "${path} contains no loader.conf - skipping" - return - fi if [ ! -d "${mountpoint}/grub" ]; then warn "${path} contains no grub directory - skipping" return @@ -89,7 +85,6 @@ update_esp_func() { if [ -e "${PINNED_KERNEL_CONF}" ]; then pinned_kernel=$(get_first_line "${PINNED_KERNEL_CONF}") fi - set_systemd_boot_default "${mountpoint}" "${pinned_kernel}" set_grub_default "${pinned_kernel}" remove_old_kernels "${mountpoint}" mount --bind "${mountpoint}" "/boot" @@ -123,15 +118,6 @@ copy_and_config_kernels() { warn " Copying kernel and creating boot-entry for ${kver}" cp --preserve=timestamps "${linux_image}" "${esp}/" cp --preserve=timestamps "${initrd}" "${esp}/" - - # create loader entry - cat > "${esp}/loader/entries/proxmox-${kver}.conf" <<- EOF - title ${LOADER_TITLE} - version ${kver} - options ${CMDLINE} - linux /vmlinuz-${kver} - initrd /initrd.img-${kver} - EOF done } @@ -146,7 +132,6 @@ remove_old_kernels() { warn " Removing old version ${kver}" rm -rf "${esp}/vmlinuz-${kver}" rm -rf "${esp}/initrd.img-${kver}" - rm -f "${esp}/loader/entries/proxmox-${kver}.conf" done } -- 2.30.2