From 87ed712e0ea101846e33a2f2c04e16987a069675 Mon Sep 17 00:00:00 2001 From: Zelan Zou Date: Wed, 10 Apr 2024 14:55:17 +0900 Subject: [PATCH] xen: Update xen_4.18.imx.bb to commit 9befb6e Integrate xen for i.MX95 on Q2 release [YOCIMX-7596] Signed-off-by: Zelan Zou --- meta-imx-bsp/conf/layer.conf | 1 + .../conf/machine/imx95-19x19-lpddr5-evk.conf | 1 + .../conf/machine/include/imx95-evk.inc | 2 +- meta-imx-sdk/conf/layer.conf | 4 + .../recipes-extended/xen/xen-common.inc | 6 + .../recipes-extended/xen/xen-hypervisor.inc | 115 ++++++++++++++++++ .../xen/xen-tools_4.18.imx.bb | 17 +++ .../recipes-extended/xen/xen_4.18.imx.bb | 16 +++ 8 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-common.inc create mode 100644 meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-hypervisor.inc create mode 100644 meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-tools_4.18.imx.bb create mode 100644 meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen_4.18.imx.bb diff --git a/meta-imx-bsp/conf/layer.conf b/meta-imx-bsp/conf/layer.conf index 895dece4ef..803cdf7efe 100644 --- a/meta-imx-bsp/conf/layer.conf +++ b/meta-imx-bsp/conf/layer.conf @@ -157,6 +157,7 @@ OPTEE_BOOT_IMAGE:mx8-nxp-bsp ?= "tee.bin" IMAGE_INSTALL:append = " \ ${@bb.utils.contains('COMBINED_FEATURES', 'jailhouse', 'jailhouse', '', d)} \ ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'packagegroup-fsl-optee-imx', '', d)} \ + ${@bb.utils.contains('COMBINED_FEATURES', 'xen', 'xen xen-tools', '', d)} \ " # To add a new array override for a specific upstream machine, set the diff --git a/meta-imx-bsp/conf/machine/imx95-19x19-lpddr5-evk.conf b/meta-imx-bsp/conf/machine/imx95-19x19-lpddr5-evk.conf index e4cc657471..85db8013ad 100644 --- a/meta-imx-bsp/conf/machine/imx95-19x19-lpddr5-evk.conf +++ b/meta-imx-bsp/conf/machine/imx95-19x19-lpddr5-evk.conf @@ -52,4 +52,5 @@ IMAGE_BOOT_FILES:append = " \ imx95-19x19-evk_m7_TCM_netc_share_sm.bin \ imx95-19x19-evk_m7_TCM_rpmsg_lite_pingpong_rtos_linux_remote_sm.bin \ imx95-19x19-evk_m7_TCM_rpmsg_lite_str_echo_rtos.bin \ + ${@bb.utils.contains('COMBINED_FEATURES', 'xen', 'xen', '', d)} \ " diff --git a/meta-imx-bsp/conf/machine/include/imx95-evk.inc b/meta-imx-bsp/conf/machine/include/imx95-evk.inc index f7ec748487..091d67d7c1 100644 --- a/meta-imx-bsp/conf/machine/include/imx95-evk.inc +++ b/meta-imx-bsp/conf/machine/include/imx95-evk.inc @@ -2,7 +2,7 @@ require conf/machine/include/imx-base.inc require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc MACHINE_FEATURES += "pci wifi bluetooth optee" -MACHINE_FEATURES:append:use-nxp-bsp = " nxpwifi-all-pcie nxpwifi-all-sdio jailhouse dpdk" +MACHINE_FEATURES:append:use-nxp-bsp = " nxpwifi-all-pcie nxpwifi-all-sdio jailhouse dpdk xen" KERNEL_DEVICETREE = " \ freescale/${KERNEL_DEVICETREE_BASENAME}.dtb \ diff --git a/meta-imx-sdk/conf/layer.conf b/meta-imx-sdk/conf/layer.conf index 551f160a77..7173413169 100644 --- a/meta-imx-sdk/conf/layer.conf +++ b/meta-imx-sdk/conf/layer.conf @@ -22,6 +22,10 @@ BBFILES_DYNAMIC += " \ \ qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/*/*/*.bb \ qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/*/*/*.bbappend \ + \ + virtualization-layer:${LAYERDIR}/dynamic-layers/virtualization-layer/*/*/*.bb \ + virtualization-layer:${LAYERDIR}/dynamic-layers/virtualization-layer/*/*/*.bbappend \ + virtualization-layer:${LAYERDIR}/dynamic-layers/virtualization-layer/*/*/*.inc \ " BBMASK += " \ diff --git a/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-common.inc b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-common.inc new file mode 100644 index 0000000000..105db8d346 --- /dev/null +++ b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-common.inc @@ -0,0 +1,6 @@ +SRCBRANCH = "imx_4.18.y" +XEN_SRC ?= "git://github.com/nxp-imx/imx-xen.git;protocol=https" +SRC_URI = " ${XEN_SRC};branch=${SRCBRANCH}" +SRCREV = "9befb6e131450f0a379d95fde585f07e52d3eac4" +XEN_REL = "4.18.imx" +PV = "${XEN_REL}+stable" diff --git a/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-hypervisor.inc b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-hypervisor.inc new file mode 100644 index 0000000000..262960b7a3 --- /dev/null +++ b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-hypervisor.inc @@ -0,0 +1,115 @@ +SUMMARY = "Xen hypervisor" +DESCRIPTION = "The Xen hypervisor" + +# This recipe is for just the Xen hypervisor. +# Separate recipes are used to build Xen and its components: +# this allows for varying the target architecture or toolchain used +# to build the different components. eg. 32-bit tools and a 64-bit hypervisor. + +# The Xen hypervisor has a narrower compatible platform range than the Xen tools +COMPATIBLE_HOST = '(x86_64.*).*-linux|aarch64.*-linux|arm-.*-linux-gnueabi' + +inherit deploy python3native cml1 + +PACKAGES = " \ + ${PN} \ + ${PN}-dbg \ + ${PN}-efi \ + " + +FILES:${PN} = " \ + /boot/xen-* \ + /boot/xen \ + /boot/xen-*.gz \ + /boot/xen.gz \ + /boot/xen-syms-* \ + " + +FILES:${PN}-dbg += "${libdir}/debug/*" + +FILES:${PN}-efi = " \ + /boot/xen.efi \ + ${exec_prefix}/lib64/efi/xen* \ + " + +do_configure() { + do_configure_common + + # Handle the config fragments + cfgs="${@' '.join(find_cfgs(d))}" + if [ -n "${cfgs}" ]; then + # If .config is not present generate one in order + # to use the merge_config.sh + if [ ! -f "${S}/xen/.config" ] ; then + oe_runmake -C ${S}/xen defconfig + fi + ${S}/xen/tools/kconfig/merge_config.sh -m -O \ + ${S}/xen ${S}/xen/.config "${cfgs}" + fi +} + +# The hypervisor binary for arm must not be built with the hard floating point +# ABI. Override CC and CPP when invoking make so that they do not contain +# TUNE_CCARGS. +EXTRA_OEMAKE:arm += "CC='${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS} \ + ${CC_REPRODUCIBLE_OPTIONS}' \ + CPP='${CCACHE}${HOST_PREFIX}gcc -E ${TOOLCHAIN_OPTIONS} \ + ${CC_REPRODUCIBLE_OPTIONS}'" + +do_compile() { + oe_runmake xen PYTHON="${PYTHON}" \ + EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" +} + +do_install() { + oe_runmake DESTDIR="${D}" install-xen +} +# The do_install also ships files in /boot and /usr/lib64 +SYSROOT_DIRS += "/boot ${exec_prefix}/lib64" + +do_deploy() { + install -d ${DEPLOYDIR} + + if [ -f ${B}/xen/xen ]; then + install -m 0644 ${B}/xen/xen ${DEPLOYDIR}/xen + fi + + if [ -f ${B}/xen/xen.gz ]; then + install -m 0644 ${B}/xen/xen.gz ${DEPLOYDIR}/xen.gz + fi + + if [ -f ${B}/xen/xen.efi ]; then + install -m 0644 ${B}/xen/xen.efi ${DEPLOYDIR}/xen.efi + fi +} +# Scheduling the do_deploy task: +# - deploy copies files from ${B} that are written during do_compile so must +# at least run afer that task has completed +# - the hypervisor binaries may be included in the image filesystem, so we +# must ensure that the binaries deployed match what is staged in the sysroot: +# so do deploy must run after do_populate_sysroot -- which is always after +# do_compile, so that handles 'after do_compile' too +# - add the task before do_build to ensure that deployment has completed when +# the recipe build done stamp is written +addtask deploy after do_populate_sysroot before do_build +# To ensure that a deployed hypervisor has matching tools, add a dependency to +# make sure that the tools have built and been staged: +do_deploy[depends] += "xen-tools:do_populate_sysroot" +# Also ensure anything that the tools recipe needs to deploy, such as a +# XSM policy file, has been deployed first: +do_deploy[depends] += "xen-tools:do_deploy" + +# Enable use of menuconfig directly from bitbake and also within the devshell +do_devshell[depends] += "ncurses-native:do_populate_sysroot" + +# Pass the native library path for kconfig build when running the do_menuconfig +# task +CROSS_CURSES_LIB += "-L${STAGING_LIBDIR_NATIVE}" + +# Specify the root dir of the .config file for do_menuconfig and do_diffconfig +# tasks +KCONFIG_CONFIG_ROOTDIR = "${S}/xen" + +# Xen is setting all CC flags on its own. Make sure that they are not modified +# for aarch64, e.g. with architecture-specific optimizations. +TUNE_CCARGS:aarch64="" diff --git a/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-tools_4.18.imx.bb b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-tools_4.18.imx.bb new file mode 100644 index 0000000000..90e57ce1a1 --- /dev/null +++ b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen-tools_4.18.imx.bb @@ -0,0 +1,17 @@ +# Copyright 2024 NXP +HOMEPAGE = "http://xen.org" +LICENSE = "GPL-2.0-only" +SECTION = "console/tools" +LIC_FILES_CHKSUM ?= "file://COPYING;md5=d1a1e216f80b6d8da95fec897d0dbec9" + +S = "${WORKDIR}/git" + +DEFAULT_PREFERENCE ??= "-1" +DEPENDS:apennd = "qemu" +require recipes-extended/xen/xen.inc +require recipes-extended/xen/xen-tools.inc +require xen-common.inc + +FILES:${PN}:append = " \ + ${sysconfdir}/xen/imx95.conf \ +" diff --git a/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen_4.18.imx.bb b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen_4.18.imx.bb new file mode 100644 index 0000000000..cd617d35fa --- /dev/null +++ b/meta-imx-sdk/dynamic-layers/virtualization-layer/recipes-extended/xen/xen_4.18.imx.bb @@ -0,0 +1,16 @@ +# Copyright 2024 NXP +HOMEPAGE = "http://xen.org" +LICENSE = "GPL-2.0-only" +SECTION = "console/tools" +LIC_FILES_CHKSUM ?= "file://COPYING;md5=d1a1e216f80b6d8da95fec897d0dbec9" + +require recipes-extended/xen/xen.inc +require xen-hypervisor.inc +require xen-common.inc + +DEPENDS:apennd = "qemu" + +S = "${WORKDIR}/git" + +DEFAULT_PREFERENCE ??= "-1" +COMPATIBLE_MACHINE = "(mx95-nxp-bsp)"