-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce bsd-user-qemu and run-{shell,user}-riscv64-purecap targets. #264
base: main
Are you sure you want to change the base?
Changes from all commits
b23da30
6ef2b08
94ff254
8c67455
3bb34a6
efe4075
6a3da25
b664350
8505ecb
be4fd63
ddfd600
d466115
553bf45
c6d823e
cd8b16e
7427478
48dc528
d4c322e
1590f85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ class BuildQEMUBase(AutotoolsProject): | |
can_build_with_asan = True | ||
default_targets: str = "some-invalid-target" | ||
default_build_type = BuildType.RELEASE | ||
default_use_smbd = True | ||
lto_by_default = True | ||
use_smbd: bool | ||
smbd_path: Optional[Path] | ||
|
@@ -78,7 +79,7 @@ def _build_type_basic_compiler_flags(self): | |
@classmethod | ||
def setup_config_options(cls, **kwargs): | ||
super().setup_config_options(**kwargs) | ||
cls.use_smbd = cls.add_bool_option("use-smbd", show_help=False, default=True, | ||
cls.use_smbd = cls.add_bool_option("use-smbd", show_help=False, default=cls.default_use_smbd, | ||
help="Don't require SMB support when building QEMU (warning: most --test " | ||
"targets will fail without smbd support)") | ||
|
||
|
@@ -394,3 +395,38 @@ def install(self, **kwargs): | |
*self.config.morello_sdk_dir.rglob("share/icons/**/qemu.png"), | ||
*self.config.morello_sdk_dir.rglob("share/icons/**/qemu.bmp"), | ||
*self.config.morello_sdk_dir.rglob("share/icons/**/qemu.svg")) | ||
|
||
|
||
class BuildBsdUserQEMU(BuildQEMUBase): | ||
repository = GitRepository("https://github.com/CTSRD-CHERI/qemu.git", | ||
default_branch="qemu-cheri-bsd-user", | ||
force_branch=True) | ||
native_install_dir = DefaultInstallDir.BSD_USER_SDK | ||
default_targets = "aarch64-bsd-user,morello-bsd-user,riscv64-bsd-user,riscv64cheri-bsd-user" | ||
default_use_smbd = False | ||
target = "bsd-user-qemu" | ||
hide_options_from_help = True | ||
|
||
@classmethod | ||
def qemu_cheri_binary(cls, caller: SimpleProject, xtarget: CrossCompileTarget = None, absolute_path=True): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is going to need to be a separate method as otherwise we won't be able to have a single target that builds both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we're going to be able to build both a system mode and a user mode with a single Would we want to build system modes with |
||
if xtarget is None: | ||
xtarget = caller.get_crosscompile_target() | ||
if xtarget.is_riscv(include_purecap=True): | ||
binary_name = "qemu-riscv64cheri" | ||
else: | ||
raise ValueError("Invalid xtarget" + str(xtarget)) | ||
if absolute_path: | ||
return caller.config.bsd_user_qemu_bindir / os.getenv("QEMU_BSD_USER_PATH", binary_name) | ||
else: | ||
return binary_name | ||
|
||
def setup(self): | ||
super().setup() | ||
# Disable capstone disassembler unsupporting CHERI instructions. | ||
self.configure_args.append("--disable-capstone") | ||
# Disable RVFI-DDI unsupported in the user mode. | ||
self.configure_args.append("--disable-rvfi-dii") | ||
# Enable to build BSD user mode targets. | ||
self.configure_args.append("--enable-bsd-user") | ||
# Build a static binary that can be easily included in a guest jail. | ||
self.configure_args.append("--static") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need a whole new enum for this, just copy upstream-qemu's approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BuildUpstreamQEMU's way is quite complex. Wouldn't be it easier to maintain a separate enum for this?
Instead, we could add a comment the enum should be removed once the BSD user mode is merged to
qemu-cheri
(which can take quite a while).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this install anything other than the qemu-user binaries? If not we could reuse the same installation directory?