Meta: Download and use the Raspberry Pi 3 devicetree for running in qemu

This commit is contained in:
Sönke Holz 2024-08-17 17:24:31 +02:00 committed by Nico Weber
parent c990c85d52
commit 77a44df92b
4 changed files with 21 additions and 3 deletions

View file

@ -195,6 +195,7 @@ option(BUILD_EVERYTHING "Build all optional components" ON)
include(utils)
include(flac_spec_tests)
include(download_raspberry_pi_3_dtb)
serenity_component(
Tests

View file

@ -0,0 +1,10 @@
include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake)
if (ENABLE_RASPBERRY_PI_3_DTB_DOWNLOAD)
set(RASPBERRY_PI_3_DTB_SHA256 "39c4e2725dd2090e9b6573a746a7b3237693269e7fc915918f907764044910b7")
set(RASPBERRY_PI_3_DTB_FILE bcm2710-rpi-3-b.dtb)
set(RASPBERRY_PI_3_DTB_URL "https://github.com/raspberrypi/firmware/raw/1.20240529/boot/${RASPBERRY_PI_3_DTB_FILE}")
set(RASPBERRY_PI_3_DTB_DOWNLOAD_PATH "${SERENITY_CACHE_DIR}/${RASPBERRY_PI_3_DTB_FILE}")
download_file("${RASPBERRY_PI_3_DTB_URL}" "${RASPBERRY_PI_3_DTB_DOWNLOAD_PATH}" SHA256 "${RASPBERRY_PI_3_DTB_SHA256}")
endif()

View file

@ -7,6 +7,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/common_options.cmake NO_POLICY_SCOPE)
serenity_option(ENABLE_PCI_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pci.ids database at build time")
serenity_option(ENABLE_USB_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the usb.ids database at build time")
serenity_option(ENABLE_PNP_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pnp.ids database at build time")
serenity_option(ENABLE_RASPBERRY_PI_3_DTB_DOWNLOAD ON CACHE BOOL "Enable download of the Raspberry Pi 3 devicetree blob at build time")
serenity_option(ENABLE_KERNEL_ADDRESS_SANITIZER OFF CACHE BOOL "Enable kernel address sanitizer testing in gcc/clang")
serenity_option(ENABLE_KERNEL_COVERAGE_COLLECTION OFF CACHE BOOL "Enable KCOV and kernel coverage instrumentation in gcc/clang")
serenity_option(ENABLE_KERNEL_COVERAGE_COLLECTION_DEBUG OFF CACHE BOOL "Enable KCOV and kernel coverage instrumentation debugging")

View file

@ -23,6 +23,8 @@ import shlex
QEMU_MINIMUM_REQUIRED_MAJOR_VERSION = 6
QEMU_MINIMUM_REQUIRED_MINOR_VERSION = 2
BUILD_DIRECTORY = Path(environ.get("SERENITY_BUILD_DIR") or Path.cwd())
class RunError(Exception):
pass
@ -715,7 +717,12 @@ def set_up_machine_devices(config: Configuration):
# FIXME: Windows QEMU crashes when we set the same display as usual here.
config.display_backend = None
config.audio_devices = []
config.extra_arguments.extend(["-serial", "stdio"])
config.extra_arguments.extend(
[
"-serial", "stdio",
"-dtb", str(BUILD_DIRECTORY.parent / "caches" / "bcm2710-rpi-3-b.dtb")
]
)
config.qemu_cpu = None
return
@ -898,8 +905,7 @@ def configure_and_run():
arguments = assemble_arguments(config)
build_directory = environ.get("SERENITY_BUILD_DIR", ".")
os.chdir(build_directory)
os.chdir(BUILD_DIRECTORY)
with TapController(config.machine_type):
run(arguments)