summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMathew McBride <matt@traverse.com.au>2023-12-11 16:15:34 +1100
committerMathew McBride <matt@traverse.com.au>2023-12-18 15:02:34 +1100
commit37bd574c4e1f49b03f985c4293513ff7107ae82f (patch)
tree90f3dfd233bb183624713c096cc90a709b726832 /python
parent7036c761e74bcd48e3ba714dec4545208ee0e313 (diff)
downloadvyos-1x-37bd574c4e1f49b03f985c4293513ff7107ae82f.tar.gz
vyos-1x-37bd574c4e1f49b03f985c4293513ff7107ae82f.zip
T5828: fix grub installation on arm64-efi machines
Since the migration of GRUB handling to vyos-1x, the grub install sequence has hardcoded references to x86. Change the GRUB sequence so it can work on arm64 as well.
Diffstat (limited to 'python')
-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 2692aaea1..763ccf983 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
@@ -57,16 +59,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: