Skip to content

Commit e160c25

Browse files
committed
cheribsd-mfs-root-kernel: Support Morello FPGA configs
1 parent 718d08c commit e160c25

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

pycheribuild/projects/cross/cheribsd.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ class ConfigPlatform(Enum):
9898
FVP = "fvp"
9999
GFE = "gfe"
100100
AWS = "aws-f1"
101+
MORELLO_FPGA = "morello-fpga"
101102

102103
@classmethod
103104
def fpga_platforms(cls) -> "set[ConfigPlatform]":
104-
return {cls.GFE, cls.AWS}
105+
return {cls.GFE, cls.AWS, cls.MORELLO_FPGA}
105106

106107

107108
class CheriBSDConfig:
@@ -290,6 +291,7 @@ class AArch64KernelConfigFactory(KernelConfigFactory):
290291
platform_name_map: "dict[ConfigPlatform, Optional[str]]" = {
291292
ConfigPlatform.QEMU: "GENERIC",
292293
ConfigPlatform.FVP: "GENERIC",
294+
ConfigPlatform.MORELLO_FPGA: "MORELLO-FPGA",
293295
}
294296

295297
def get_kabi_name(self, kernel_abi) -> Optional[str]:
@@ -306,9 +308,28 @@ def get_available_kabis(self) -> "list[KernelABI]":
306308
abis = super().get_available_kabis()
307309
return [*abis, KernelABI.PURECAP_BENCHMARK]
308310

311+
def get_flag_names(
312+
self,
313+
platforms: "set[ConfigPlatform]",
314+
kernel_abi: KernelABI,
315+
default=False,
316+
nocaprevoke=False,
317+
mfsroot=False,
318+
debug=False,
319+
benchmark=False,
320+
fuzzing=False,
321+
fett=False,
322+
):
323+
if ConfigPlatform.MORELLO_FPGA in platforms:
324+
# Suppress mfsroot flag as it is implied for Morello FPGA configurations
325+
mfsroot = False
326+
return super().get_flag_names(
327+
platforms, kernel_abi, mfsroot=mfsroot, fuzzing=fuzzing, benchmark=benchmark, default=default, nocaprevoke=nocaprevoke
328+
)
329+
309330
def make_all(self) -> "list[CheriBSDConfig]":
310331
configs = []
311-
# Generate QEMU/FVP kernels
332+
# Generate QEMU/FVP/FPGA kernels
312333
for kernel_abi in self.get_available_kabis():
313334
configs.append(self.make_config({ConfigPlatform.QEMU, ConfigPlatform.FVP}, kernel_abi, default=True))
314335
configs.append(
@@ -317,6 +338,9 @@ def make_all(self) -> "list[CheriBSDConfig]":
317338
configs.append(
318339
self.make_config({ConfigPlatform.QEMU, ConfigPlatform.FVP}, kernel_abi, default=True, mfsroot=True)
319340
)
341+
configs.append(
342+
self.make_config({ConfigPlatform.MORELLO_FPGA}, kernel_abi, default=True, mfsroot=True)
343+
)
320344
# Caprevoke kernels
321345
for kernel_abi in self.get_available_kabis():
322346
configs.append(
@@ -1857,7 +1881,11 @@ def setup_config_options(cls, kernel_only_target=False, install_directory_help=N
18571881
use_upstream_llvm=False,
18581882
kernel_only_target=kernel_only_target,
18591883
)
1860-
fpga_targets = CompilationTargets.ALL_CHERIBSD_RISCV_TARGETS
1884+
fpga_targets = (
1885+
*CompilationTargets.ALL_CHERIBSD_RISCV_TARGETS,
1886+
CompilationTargets.CHERIBSD_AARCH64,
1887+
*CompilationTargets.ALL_CHERIBSD_MORELLO_TARGETS
1888+
)
18611889
cls.build_fpga_kernels = cls.add_bool_option(
18621890
"build-fpga-kernels",
18631891
show_help=True,

0 commit comments

Comments
 (0)