Skip to content
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

device-model fixes #260

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pycheribuild/projects/cross/cheribsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2224,6 +2224,15 @@ def process(self):
target_manager.add_target_alias("cheribsd-x86_64", "cheribsd-amd64", deprecated=True)


class BuildCheriBsdDeviceModel(BuildCHERIBSD):
target = "cheribsd-device-model"
repository = GitRepository("https://github.com/CTSRD-CHERI/cheribsd.git",
default_branch="device-model-riscv")
default_extra_make_options = []
supported_architectures = [CompilationTargets.CHERIBSD_RISCV_PURECAP]
hide_options_from_help = True


class BuildDrmKMod(CrossCompileProject):
target = "drm-kmod"
repository = GitRepository("https://github.com/freebsd/drm-kmod", default_branch="master", force_branch=True)
Expand Down
15 changes: 7 additions & 8 deletions pycheribuild/projects/cross/device-model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
# SUCH DAMAGE.
#

from .crosscompileproject import CheriConfig
from .crosscompileproject import CompilationTargets, CrossCompileAutotoolsProject, DefaultInstallDir, GitRepository


Expand All @@ -51,10 +50,10 @@ def install(self, **kwargs):
self.install_file(self.build_dir / "obj/device-model-riscv.bin",
self.real_install_root_dir / "device-model-riscv.bin")

def __init__(self, config: CheriConfig):
super().__init__(config)
cc = self.config.cheri_sdk_bindir / "clang"
objcopy = self.config.cheri_sdk_bindir / "objcopy"
self.make_args.env_vars = {"CC": str(cc),
"AS": str(cc),
"OBJCOPY": str(objcopy)}
def setup(self):
super().setup()
self.CC = self.sdk_bindir / "clang"
objcopy = self.sdk_bindir / "llvm-objcopy"
self.make_args.env_vars.update({"CC": str(self.CC),
"AS": str(self.CC),
"OBJCOPY": str(objcopy)})
9 changes: 8 additions & 1 deletion pycheribuild/projects/disk_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
import typing
from pathlib import Path

from .cross.cheribsd import (BuildCHERIBSD, BuildFreeBSD, BuildFreeBSDWithDefaultOptions)
from .cross.cheribsd import (BuildCHERIBSD, BuildCheriBsdDeviceModel, BuildFreeBSD,
BuildFreeBSDWithDefaultOptions)
from .cross.gdb import (BuildGDB, BuildKGDB)
from .project import (AutotoolsProject, CheriConfig, ComputedDefaultValue, CPUArchitecture, CrossCompileTarget,
DefaultInstallDir, GitRepository, MakeCommandKind, SimpleProject)
Expand Down Expand Up @@ -1425,6 +1426,12 @@ class BuildFreeBSDWithDefaultOptionsDiskImage(BuildFreeBSDImage):
hide_options_from_help = True


class BuildCheriBSDDeviceModelDiskImage(BuildCheriBSDDiskImage):
target = "disk-image-cheribsd-device-model"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CheriBSD is a bit special in that if no OS is mentioned it's implied to be CheriBSD, so disk-image targets don't mention it; i.e. this should just be disk-image-device-model (which then also matches what your run target is).

_source_class = BuildCheriBsdDeviceModel
hide_options_from_help = True


# Backwards compatibility:
target_manager.add_target_alias("disk-image-purecap", "disk-image-mips64-purecap", deprecated=True)
target_manager.add_target_alias("disk-image-minimal-purecap", "disk-image-minimal-mips64-purecap", deprecated=True)
Expand Down
6 changes: 1 addition & 5 deletions pycheribuild/projects/run_qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,18 +649,14 @@ def process(self):


class LaunchDmQEMU(LaunchCheriBSD):
target = "run-dm"
target = "run-device-model"
forward_ssh_port = False
_enable_smbfs_support = False
_add_virtio_rng = False

def __init__(self, config: CheriConfig):
super().__init__(config)
self.qemu_user_networking = False

def process(self):
super().process()


class LaunchFreeRTOSQEMU(LaunchQEMUBase):
target = "run-freertos"
Expand Down