summaryrefslogtreecommitdiff
path: root/python/vyos/system/grub.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-02-09 09:01:43 +0000
committerGitHub <noreply@github.com>2024-02-09 09:01:43 +0000
commit094e1eeb90961e82ff5f0d3c116eb791c0f3731f (patch)
treed8c560f147fc9b601265474db95107c871ba4f10 /python/vyos/system/grub.py
parent535d28871b76d2421030fc775e4e8b834bf3ecb0 (diff)
parent5aa56c5cc4524f7cd57f1979726b82e6537090f6 (diff)
downloadvyos-1x-094e1eeb90961e82ff5f0d3c116eb791c0f3731f.tar.gz
vyos-1x-094e1eeb90961e82ff5f0d3c116eb791c0f3731f.zip
Merge pull request #2974 from vyos/mergify/bp/sagitta/pr-2643
T5828: fix grub installation on arm64-efi machines (backport #2643)
Diffstat (limited to 'python/vyos/system/grub.py')
-rw-r--r--python/vyos/system/grub.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py
index 4e133c5fc..2e8b20972 100644
--- a/python/vyos/system/grub.py
+++ b/python/vyos/system/grub.py
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+import platform
+
from pathlib import Path
from re import MULTILINE, compile as re_compile
from typing import Union
@@ -61,16 +63,22 @@ def install(drive_path: str, boot_dir: str, efi_dir: str, id: str = 'VyOS') -> N
boot_dir (str): a path to '/boot' directory
efi_dir (str): a path to '/boot/efi' directory
"""
- commands: list[str] = [
- f'grub-install --no-floppy --target=i386-pc --boot-directory={boot_dir} \
- {drive_path} --force',
- f'grub-install --no-floppy --recheck --target=x86_64-efi \
+
+ efi_installation_arch = "x86_64"
+ if platform.machine() == "aarch64":
+ efi_installation_arch = "arm64"
+ elif platform.machine() == "x86_64":
+ cmd(
+ f'grub-install --no-floppy --target=i386-pc \
+ --boot-directory={boot_dir} {drive_path} --force'
+ )
+
+ cmd(
+ f'grub-install --no-floppy --recheck --target={efi_installation_arch}-efi \
--force-extra-removable --boot-directory={boot_dir} \
--efi-directory={efi_dir} --bootloader-id="{id}" \
--no-uefi-secure-boot'
- ]
- for command in commands:
- cmd(command)
+ )
def gen_version_uuid(version_name: str) -> str: