Skip to content

Commit

Permalink
Add support for loongarch64
Browse files Browse the repository at this point in the history
This Fixes OSInside#2684
  • Loading branch information
glaubitz committed Dec 2, 2024
1 parent 2e95503 commit 1d02e16
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kiwi/bootloader/config/grub2.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def post_init(self, custom_args):
if arch == 'x86_64':
# grub2 support for bios and efi systems
self.arch = arch
elif arch == 'loongarch64':
# grub2 support for efi systems
self.arch = arch
elif arch.startswith('ppc64'):
# grub2 support for ofw and opal systems
self.arch = arch
Expand Down
4 changes: 4 additions & 0 deletions kiwi/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,7 @@ def get_firmware_types():
'armv7hl': ['efi', 'uefi'],
'armv7l': ['efi', 'uefi'],
'armv8l': ['efi', 'uefi'],
'loongarch64': ['efi', 'uefi'],
'ppc': ['ofw'],
'ppc64': ['ofw', 'opal'],
'ppc64le': ['ofw', 'opal'],
Expand All @@ -1331,6 +1332,7 @@ def get_default_firmware(arch):
'i586': 'bios',
'i686': 'bios',
'ix86': 'bios',
'loongarch64': 'efi',
'ppc': 'ofw',
'ppc64': 'ofw',
'ppc64le': 'ofw',
Expand Down Expand Up @@ -1401,6 +1403,7 @@ def get_efi_module_directory_name(arch):
'armv6l': 'arm-efi',
'armv7l': 'arm-efi',
'armv8l': 'arm-efi',
'loongarch64': 'loongarch64-efi',
'riscv64': 'riscv64-efi'
}
if arch in default_module_directory_names:
Expand Down Expand Up @@ -1437,6 +1440,7 @@ def get_efi_image_name(arch):
'armv6l': 'bootarm.efi',
'armv7l': 'bootarm.efi',
'armv8l': 'bootarm.efi',
'loongarch64': 'bootloongarch64.efi',
'riscv64': 'bootriscv64.efi'
}
if arch in default_efi_image_names:
Expand Down
7 changes: 7 additions & 0 deletions test/unit/bootloader/config/grub2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ def test_post_init_ix86_platform(self):
bootloader = BootLoaderConfigGrub2(xml_state, 'root_dir')
assert bootloader.arch == 'ix86'

def test_post_init_loongarch64_platform(self):
Defaults.set_platform_name('loongarch64')
xml_state = MagicMock()
xml_state.build_type.get_firmware = Mock(
return_value=None
)

def test_post_init_ppc_platform(self):
Defaults.set_platform_name('ppc64')
xml_state = MagicMock()
Expand Down

0 comments on commit 1d02e16

Please sign in to comment.