From 47246531b950efe96c3a9732ca89bddf9ac2fc81 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Sat, 15 Feb 2025 21:52:35 +0800 Subject: [PATCH 01/30] oebuild: remove reduplicative VIRTUAL-RUNTIME_dev_manager VIRTUAL-RUNTIME_dev_manager will be set init-manager-xxx.inc. so the set of INIT_MANAGER will cause the set of VIRTUAL-RUNTIME_dev_manager no need to repeat it. Signed-off-by: Wayne Ren --- .oebuild/features/busybox.yaml | 1 - .oebuild/features/obmc.yaml | 1 - .oebuild/features/systemd.yaml | 1 - .oebuild/samples/aarch64/rpi4_jailhouse_hmi_img.yaml | 1 - meta-openeuler/conf/distro/openeuler.conf | 1 - 5 files changed, 5 deletions(-) diff --git a/.oebuild/features/busybox.yaml b/.oebuild/features/busybox.yaml index 51c3430909f..17c32e197af 100644 --- a/.oebuild/features/busybox.yaml +++ b/.oebuild/features/busybox.yaml @@ -2,4 +2,3 @@ type: feature local_conf: | INIT_MANAGER = "mdev-busybox" - VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" diff --git a/.oebuild/features/obmc.yaml b/.oebuild/features/obmc.yaml index 158d95bf324..c8335f012c0 100644 --- a/.oebuild/features/obmc.yaml +++ b/.oebuild/features/obmc.yaml @@ -8,7 +8,6 @@ layers: local_conf: | DISTRO_FEATURES:append = " obmc " INIT_MANAGER = "systemd" - VIRTUAL-RUNTIME_dev_manager = "systemd" ROOT_HOME = "/home/root" repos: diff --git a/.oebuild/features/systemd.yaml b/.oebuild/features/systemd.yaml index f260f5c03a8..664a6b5a9b9 100644 --- a/.oebuild/features/systemd.yaml +++ b/.oebuild/features/systemd.yaml @@ -2,4 +2,3 @@ type: feature local_conf: | INIT_MANAGER = "systemd" - VIRTUAL-RUNTIME_dev_manager = "systemd" diff --git a/.oebuild/samples/aarch64/rpi4_jailhouse_hmi_img.yaml b/.oebuild/samples/aarch64/rpi4_jailhouse_hmi_img.yaml index a4974d4cd25..4ff78e24650 100644 --- a/.oebuild/samples/aarch64/rpi4_jailhouse_hmi_img.yaml +++ b/.oebuild/samples/aarch64/rpi4_jailhouse_hmi_img.yaml @@ -17,7 +17,6 @@ local_conf: |+ GLIBC_GENERATE_LOCALES:append = "en_US.UTF-8 zh_CN.UTF-8 " INIT_MANAGER = "systemd" - VIRTUAL-RUNTIME_dev_manager = "systemd" MCS_FEATURES ?= "jailhouse" DISTRO_FEATURES:append = " mcs" diff --git a/meta-openeuler/conf/distro/openeuler.conf b/meta-openeuler/conf/distro/openeuler.conf index 9a2b6831cd4..1da67e6ceba 100644 --- a/meta-openeuler/conf/distro/openeuler.conf +++ b/meta-openeuler/conf/distro/openeuler.conf @@ -14,7 +14,6 @@ TARGET_VENDOR = "-openeuler" ## runtime/rootfs related configurations # define default init and device manager INIT_MANAGER ?= "mdev-busybox" -VIRTUAL-RUNTIME_dev_manager ?= "busybox-mdev" # pam package is used for authentication OPENEULER_DEFAULT_DISTRO_FEATURES = "pam" # define root home, default /home/root -- Gitee From 8460940d281eac10a8c6a3fde870cb118037e374 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Wed, 19 Feb 2025 09:10:55 +0800 Subject: [PATCH 02/30] image-live: call install-efi.sh in systemd * In the past, install-efi.sh only supported sysvinit, while the current image-live uses the same init manager(sysvinit or systemd) as the big image to be installed. Add a systemd service to support systemd init. Signed-off-by: hanzongcheng --- .../images/openeuler-image-live.bb | 8 +++- .../files/init-install-efi-openeuler.sh | 4 +- .../initrdscripts/files/install-efi@.service | 19 ++++++++++ .../initramfs-module-install-efi_1.0.bbappend | 38 ++++++++++++++++++- 4 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 meta-openeuler/recipes-core/initrdscripts/files/install-efi@.service diff --git a/meta-openeuler/recipes-core/images/openeuler-image-live.bb b/meta-openeuler/recipes-core/images/openeuler-image-live.bb index fa3de0f647d..5de3a4d6980 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-live.bb +++ b/meta-openeuler/recipes-core/images/openeuler-image-live.bb @@ -21,7 +21,6 @@ IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" # directly call install-efi.sh after initialization set_permissions_from_rootfs:append() { - # if sysvinit is used, modify inittab to call install-efi.sh if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then cd "${IMAGE_ROOTFS}" @@ -31,7 +30,12 @@ set_permissions_from_rootfs:append() { cd - fi - # todo: call install-efi.sh in systemd + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + # Mask getty.target for the live image. We'll use tty device in install-efi.sh. + cd "${IMAGE_ROOTFS}" + ln -sf /dev/null ./etc/systemd/system/getty.target + cd - + fi } require openeuler-image-common.inc diff --git a/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh b/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh index e29b508f274..aa954a3d65c 100644 --- a/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh +++ b/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh # # Copyright (c) 2012, Intel Corporation. # All rights reserved. @@ -6,6 +6,8 @@ # install.sh # +set +e +trap 'echo "Caught Ctrl+C, exiting..."; exit 1' SIGINT PATH=/sbin:/bin:/usr/sbin:/usr/bin # wait for the kernel module to finish diff --git a/meta-openeuler/recipes-core/initrdscripts/files/install-efi@.service b/meta-openeuler/recipes-core/initrdscripts/files/install-efi@.service new file mode 100644 index 00000000000..3fd2deb2dfd --- /dev/null +++ b/meta-openeuler/recipes-core/initrdscripts/files/install-efi@.service @@ -0,0 +1,19 @@ +[Unit] +Description=Run openEuler Embedded Iso Installer on %I +After=sysinit.target plymouth-start.service +Before=getty.target +Conflicts=getty.target + +[Service] +Type=simple +ExecStart=/init.d/install-efi.sh +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +TimeoutSec=0 +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/meta-openeuler/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend b/meta-openeuler/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend index a1d7310963b..f9e762fc621 100644 --- a/meta-openeuler/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend +++ b/meta-openeuler/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bbappend @@ -2,10 +2,44 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files/:" -SRC_URI += "file://init-install-efi-openeuler.sh" +SRC_URI += "file://init-install-efi-openeuler.sh \ + file://install-efi@.service \ +" + +inherit systemd + +SERIAL_CONSOLES ?= "115200;ttyS0" RDEPENDS:${PN}:remove = "initramfs-framework-base" do_install:append() { - install -m 0755 ${WORKDIR}/init-install-efi-openeuler.sh ${D}/init.d/install-efi.sh + install -m 0755 ${WORKDIR}/init-install-efi-openeuler.sh ${D}/init.d/install-efi.sh + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + # deal with systemd unit files + install -d ${D}${systemd_system_unitdir} + install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants/ + install -m 0644 ${WORKDIR}/install-efi@.service ${D}${systemd_system_unitdir} + + ln -sf ${systemd_system_unitdir}/install-efi@.service \ + ${D}${sysconfdir}/systemd/system/multi-user.target.wants/install-efi@tty1.service + + if [ ! -z "${SERIAL_CONSOLES}" ] ; then + tmp="${SERIAL_CONSOLES}" + for entry in $tmp ; do + ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` + # enable the service + ln -sf ${systemd_system_unitdir}/install-efi@.service \ + ${D}${sysconfdir}/systemd/system/multi-user.target.wants/install-efi@$ttydev.service + done + fi + fi } + +FILES:${PN} = " \ + /init.d/install-efi.sh \ + ${systemd_system_unitdir}/install-efi@.service \ + ${sysconfdir} \ +" + +SYSTEMD_SERVICE = "install-efi@.service" -- Gitee From a8d1d3f8fa440d72b09ff82add1fdd994e1f57e4 Mon Sep 17 00:00:00 2001 From: Slim6882 Date: Sun, 23 Feb 2025 07:54:10 +0800 Subject: [PATCH 03/30] kp920: change kernel image compression format to fix a compile error The Kunpeng 920 embedded version does not support zImage, so we remove the zImage patch in its yocto recipe Signed-off-by: Slim6882 --- bsp/meta-kunpeng/conf/machine/kp920.conf | 2 +- bsp/meta-kunpeng/recipes-kernel/linux/linux-kp920.inc | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bsp/meta-kunpeng/conf/machine/kp920.conf b/bsp/meta-kunpeng/conf/machine/kp920.conf index 1267172d345..4d997954401 100644 --- a/bsp/meta-kunpeng/conf/machine/kp920.conf +++ b/bsp/meta-kunpeng/conf/machine/kp920.conf @@ -11,7 +11,7 @@ MULTILIBS = "" ROOTFS_PACKAGE_ARCH = "aarch64" # set IMAGETYPE and dtb -KERNEL_IMAGETYPE = "zImage" +KERNEL_IMAGETYPE = "Image" # choose dtb file KERNEL_DEVICETREE = "" ENABLE_UART = "1" diff --git a/bsp/meta-kunpeng/recipes-kernel/linux/linux-kp920.inc b/bsp/meta-kunpeng/recipes-kernel/linux/linux-kp920.inc index 99e90208738..a29c33e95ab 100644 --- a/bsp/meta-kunpeng/recipes-kernel/linux/linux-kp920.inc +++ b/bsp/meta-kunpeng/recipes-kernel/linux/linux-kp920.inc @@ -1,6 +1,14 @@ # add recipes-kernel path to find patch and defconfig FILESEXTRAPATHS:append := "${THISDIR}/files/:" +SRC_URI:remove:aarch64 = " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6', ' \ + file://patches/${ARCH}/0001-kernel6.6-arm64-add-zImage-support-for-arm64.patch \ + ', ' \ + file://patches/${ARCH}/0001-arm64-add-zImage-support-for-arm64.patch \ + ', d)} \ +" + CONFIGVERSION="${@bb.utils.contains('DISTRO_FEATURES', 'kernel6', 'kernel6-', '', d)}" OPENEULER_KERNEL_CONFIG = "file://${CONFIGVERSION}config/kp920/defconfig" -- Gitee From 1a9b50ba308f7cb0ae5e9edb8ba73113c51d2286 Mon Sep 17 00:00:00 2001 From: Slim6882 Date: Sun, 23 Feb 2025 08:12:39 +0800 Subject: [PATCH 04/30] openeuler: add openssl-bin to support SM2/SM3 yocto adds support for openssl-bin in the compilation to support SM2/SM3 Signed-off-by: Slim6882 --- meta-openeuler/recipes-connectivity/openssl/openssl_%.bbappend | 2 ++ meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb | 1 + 2 files changed, 3 insertions(+) diff --git a/meta-openeuler/recipes-connectivity/openssl/openssl_%.bbappend b/meta-openeuler/recipes-connectivity/openssl/openssl_%.bbappend index 2274ecce543..4553407467f 100644 --- a/meta-openeuler/recipes-connectivity/openssl/openssl_%.bbappend +++ b/meta-openeuler/recipes-connectivity/openssl/openssl_%.bbappend @@ -10,6 +10,8 @@ SRC_URI:remove = "file://CVE-2023-0464.patch \ file://0001-Configure-do-not-tweak-mips-cflags.patch \ " +EXTRA_OECONF:append = " enable-sm2 enable-sm4" + # patches in openEuler SRC_URI:prepend = "file://${BP}.tar.gz \ file://openssl-3.0-build.patch \ diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb index bf3e2e9f7ba..db744790931 100644 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb @@ -59,6 +59,7 @@ xz \ expect \ sysfsutils \ elfutils \ +openssl-bin \ " RDEPENDS:packagegroup-base-libs = " \ -- Gitee From f37d67a0110eb7d0684bde76837bce5b144a3c57 Mon Sep 17 00:00:00 2001 From: lixinyu Date: Tue, 25 Feb 2025 10:47:06 +0800 Subject: [PATCH 05/30] cross: downgrade the glibc to 2.28 * alter base sdk container version to 20.03 for building cross-gcc with glibc-2.28 Signed-off-by: lixinyu --- .oebuild/dockerfile/openeuler-sdk/Dockerfile | 8 +++++--- .oebuild/dockerfile/openeuler-sdk/Dockerfile_CI | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.oebuild/dockerfile/openeuler-sdk/Dockerfile b/.oebuild/dockerfile/openeuler-sdk/Dockerfile index 93a8e7b6e0b..e2530e90fbc 100644 --- a/.oebuild/dockerfile/openeuler-sdk/Dockerfile +++ b/.oebuild/dockerfile/openeuler-sdk/Dockerfile @@ -1,7 +1,7 @@ # base image -FROM openeuler/openeuler:21.09 +FROM hub.oepkgs.net/openeuler/openeuler:20.03 -RUN sed -i 's/repo.openeuler.org/archives.openeuler\.openatom\.cn/g' /etc/yum.repos.d/openEuler.repo +# RUN sed -i 's/repo.openeuler.org/archives.openeuler\.openatom\.cn/g' /etc/yum.repos.d/openEuler.repo # yum install RUN set -eux; \ @@ -12,7 +12,9 @@ autoconf automake m4 bison bc libtool gettext-devel createrepo_c net-tools \ wget sudo hostname rpcgen texinfo meson dosfstools mtools libmpc-devel \ gmp-devel ninja-build numactl-devel make python python3 python3-pip screen \ iproute help2man gdisk libstdc++-static diffstat lzip python3-devel rsync \ -xz-lzma-compat xz unzip gcc g++ vim hwdata libxslt perl-XML-Parser umoci skopeo +xz-lzma-compat xz unzip gcc gcc-c++ vim hwdata libxslt perl-XML-Parser umoci skopeo + +RUN yum clean packages ARG user=openeuler ARG group=openeuler diff --git a/.oebuild/dockerfile/openeuler-sdk/Dockerfile_CI b/.oebuild/dockerfile/openeuler-sdk/Dockerfile_CI index ac375d818ac..72521c3106e 100644 --- a/.oebuild/dockerfile/openeuler-sdk/Dockerfile_CI +++ b/.oebuild/dockerfile/openeuler-sdk/Dockerfile_CI @@ -37,9 +37,9 @@ RUN echo "PATH=$PATH:/home/${user}/.local/bin" >> ${HOME}/.bashrc \ && echo "export PATH" >> ${HOME}/.bashrc RUN set -eux; \ -pip install PyYaml python-git requests python-jenkins paramiko json2table \ +pip3 install PyYaml python-git requests python-jenkins paramiko json2table \ gitlint sphinx_tabs sphinx_multiversion sphinx-rtd-theme Sphinx==5.1.1 \ -oebuild pyyaml pygit gitpython -i https://pypi.tuna.tsinghua.edu.cn/simple +pyyaml pygit gitpython -i https://pypi.tuna.tsinghua.edu.cn/simple VOLUME /home/${user}/.jenkins VOLUME ${AGENT_WORKDIR} -- Gitee From 982d1caed4f5f598214442b8db6190c07acdacb2 Mon Sep 17 00:00:00 2001 From: lixinyu Date: Tue, 25 Feb 2025 18:51:45 +0800 Subject: [PATCH 06/30] riscv: remove kexec_tools from packagegroup * the kexec_tools not support riscv64 arch Signed-off-by: lixinyu --- .../recipes-core/packagegroups/packagegroup-base.bb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb index db744790931..58e64104605 100644 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb @@ -62,6 +62,13 @@ elfutils \ openssl-bin \ " +# riscv64 arch is not support kexec-tools, view yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.23.bb +# and check COMPATIBLE_HOST param +RDEPENDS:packagegroup-base-utils:remove:riscv64 = "\ + kexec-tools \ +" + + RDEPENDS:packagegroup-base-libs = " \ json-c \ libcap-bin \ -- Gitee From 6d163a1a220cc4d83ca699bf0db864e29d7db1ad Mon Sep 17 00:00:00 2001 From: Slim6882 Date: Sun, 23 Feb 2025 09:59:56 +0800 Subject: [PATCH 07/30] openjpeg2: add openjpeg2 support Added bb recipe for openjpeg2 Signed-off-by: Slim6882 --- .oebuild/manifest.yaml | 3 +++ .../openjpeg2/openjpeg_%.bbappend | 17 +++++++++++++++++ .../packagegroups/packagegroup-hmi.bb | 1 + 3 files changed, 21 insertions(+) create mode 100644 meta-openeuler/dynamic-layers/openembedded-layer/recipes-graphics/openjpeg2/openjpeg_%.bbappend diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index d605db36bfb..6c4284aeb5d 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -1251,6 +1251,9 @@ manifest_list: opencv: remote_url: https://gitee.com/src-openeuler/opencv.git version: fc708b2571cce5e56554567b6e502fc6687170f7 + openjpeg2: + remote_url: https://gitee.com/src-openeuler/openjpeg2.git + version: 35be87bca96a8312d112b7624f695af7d2d5e3bb openssh: remote_url: https://gitee.com/src-openeuler/openssh.git version: 7bf431dcb12a2cdac5194b214c6fe54618da71c0 diff --git a/meta-openeuler/dynamic-layers/openembedded-layer/recipes-graphics/openjpeg2/openjpeg_%.bbappend b/meta-openeuler/dynamic-layers/openembedded-layer/recipes-graphics/openjpeg2/openjpeg_%.bbappend new file mode 100644 index 00000000000..cdd47e88cac --- /dev/null +++ b/meta-openeuler/dynamic-layers/openembedded-layer/recipes-graphics/openjpeg2/openjpeg_%.bbappend @@ -0,0 +1,17 @@ +# main bb: yocto-meta-openembedded/meta-oe/recipes-graphics/openjpeg/openjpeg_%.bb + +OPENEULER_LOCAL_NAME = "openjpeg2" + +PV = "2.5.0" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=c648878b4840d7babaade1303e7f108c" + +SRC_URI = " \ + file://${BP}.tar.gz \ + file://backport-CVE-2023-39328.patch \ + file://backport-CVE-2021-3575.patch \ + file://backport-CVE-2024-56826.patch \ + file://backport-CVE-2024-56827.patch \ +" + +S = "${WORKDIR}/${BP}" diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb index 5788d4159a2..f2ddf85eae4 100644 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb @@ -16,4 +16,5 @@ adwaita-icon-theme \ ttf-wqy-zenhei \ firefox-bin \ labwc \ +openjpeg \ " -- Gitee From ee9685fc6797a858bd8da70b7340d02c82b695ff Mon Sep 17 00:00:00 2001 From: lixinyu Date: Wed, 26 Feb 2025 10:50:34 +0800 Subject: [PATCH 08/30] cross-tools: downgrade glibc version to 2.28 * downgrade glibc to version 2.28 to ensure compatibility with lower-version runtime environments. Signed-off-by: lixinyu --- .oebuild/cross-tools/release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.oebuild/cross-tools/release.yaml b/.oebuild/cross-tools/release.yaml index 3b6b3b6acfd..5a756c5d111 100644 --- a/.oebuild/cross-tools/release.yaml +++ b/.oebuild/cross-tools/release.yaml @@ -1,9 +1,9 @@ -tag_name: toolchains-v0.1.5 -name: openEuler Embedded Toolchains V0.1.5 -body: 1.此发行版为对应toolchains V0.1.5版本。 +tag_name: toolchains-v0.1.6 +name: openEuler Embedded Toolchains V0.1.6 +body: 1.此发行版为对应toolchains V0.1.6版本。 2.请下载所有的gz结尾的压缩包及merge_data.sh文件,对应名称的压缩包即为对应构建工具链。 3.请给merge_data.sh文件可执行权限,并执行即可得到对应的工具链文件夹。 - 4.更新内容:x86-64交叉编译链打开libgomp开关 + 4.更新内容:降低glibc版本到2.28以兼容低版本运行环境 target_commitish: master owner: openeuler repo: yocto-meta-openeuler \ No newline at end of file -- Gitee From 7e28bcd2ed044927d16baf2d432101732f22a83a Mon Sep 17 00:00:00 2001 From: fanglinxu Date: Mon, 24 Feb 2025 20:50:19 +0800 Subject: [PATCH 09/30] kp920: add ethercat-igh support * add generic driver support for igh * add kp920 image framework * ethercat-igh 1.5.2 only support kernel-5.10, should upgrade later. Signed-off-by: fanglinxu --- bsp/meta-kunpeng/recipes-core/images/bsp-kp920.inc | 4 ++++ bsp/meta-kunpeng/recipes-core/images/image-kp920.inc | 12 ++++++++++++ .../images/openeuler-image-tiny.bbappend | 1 + .../recipes-core/images/openeuler-image.bbappend | 1 + .../recipes-support/ethercat/ethercat-igh_1.5.2.bb | 2 +- 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 bsp/meta-kunpeng/recipes-core/images/bsp-kp920.inc create mode 100644 bsp/meta-kunpeng/recipes-core/images/image-kp920.inc create mode 100644 bsp/meta-kunpeng/recipes-core/images/openeuler-image-tiny.bbappend create mode 100644 bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend diff --git a/bsp/meta-kunpeng/recipes-core/images/bsp-kp920.inc b/bsp/meta-kunpeng/recipes-core/images/bsp-kp920.inc new file mode 100644 index 00000000000..0150b47d1c4 --- /dev/null +++ b/bsp/meta-kunpeng/recipes-core/images/bsp-kp920.inc @@ -0,0 +1,4 @@ +# add bsp depends here, should use for all images(tiny, standard, etc) + +IMAGE_INSTALL:append = " \ +" diff --git a/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc b/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc new file mode 100644 index 00000000000..19aab21b1f6 --- /dev/null +++ b/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc @@ -0,0 +1,12 @@ +# This file should be included in openeuler-image.bbappend, openeuler-image-ros.bbappend, etc. +# diff from ${MACHINE}.inc, it should not be included in live image + +require recipes-core/images/bsp-${MACHINE}.inc + +# all app and tools +IMAGE_INSTALL += " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6', ' \ + ', ' \ + ethercat-igh \ + ', d)} \ +" diff --git a/bsp/meta-kunpeng/recipes-core/images/openeuler-image-tiny.bbappend b/bsp/meta-kunpeng/recipes-core/images/openeuler-image-tiny.bbappend new file mode 100644 index 00000000000..6645f24e865 --- /dev/null +++ b/bsp/meta-kunpeng/recipes-core/images/openeuler-image-tiny.bbappend @@ -0,0 +1 @@ +require recipes-core/images/bsp-${MACHINE}.inc diff --git a/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend b/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend new file mode 100644 index 00000000000..dac2e55b882 --- /dev/null +++ b/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend @@ -0,0 +1 @@ +require recipes-core/images/image-${MACHINE}.inc diff --git a/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb b/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb index 371c3515bba..7856763aad6 100644 --- a/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb +++ b/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb @@ -10,7 +10,7 @@ SRC_URI = " file://ethercat-e1000e-5.10.tar.gz;subdir=${BP};striplevel=1 \ file://0002-avoid-ssize_t.patch \ " -PACKAGECONFIG ??= "e1000e" +PACKAGECONFIG ??= "e1000e generic" PACKAGECONFIG[generic] = "--enable-generic,--disable-generic," PACKAGECONFIG[8139too] = "--enable-8139too,--disable-8139too," -- Gitee From 1abc6caf15ba5edc39ddd479c69ec430400a8eeb Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Thu, 27 Feb 2025 15:04:52 +0800 Subject: [PATCH 10/30] ethercat-igh: update to 1.6.3 * Currently, version 1.5.2 is on src-openEuler/master branch. However, this version does not support kernel 6.6, so we use version 1.6.3 from oee_archive for now. Signed-off-by: hanzongcheng --- .oebuild/manifest.yaml | 2 +- ...cat-igh_1.5.2.bb => ethercat-igh_1.6.3.bb} | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) rename meta-openeuler/recipes-support/ethercat/{ethercat-igh_1.5.2.bb => ethercat-igh_1.6.3.bb} (76%) diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index 6c4284aeb5d..049dfe755bd 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -1241,7 +1241,7 @@ manifest_list: version: ca9aa00180423b548369a7485bbca641581cc1ab oee_archive: remote_url: https://gitee.com/openeuler/oee_archive.git - version: 590fc58dde5ea174ec687850d46732b032aaa6c3 + version: 634b7d9e5c5b549e2ec0e1249cd267446fc6f73d ompl: remote_url: https://gitee.com/src-openeuler/ompl.git version: 42759f06c9a8d712a5ba86f1f3b22a569ec81232 diff --git a/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb b/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.6.3.bb similarity index 76% rename from meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb rename to meta-openeuler/recipes-support/ethercat/ethercat-igh_1.6.3.bb index 7856763aad6..3e818bd0b53 100644 --- a/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.5.2.bb +++ b/meta-openeuler/recipes-support/ethercat/ethercat-igh_1.6.3.bb @@ -4,13 +4,19 @@ LICENSE = "GPL-2.0-only & LGPL-2.1-only" LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" SECTION = "net" +# Currently, version 1.5.2 is on src-openEuler/master branch. +# However, this version does not support kernel 6.6, so we use +# version 1.6.3 from oee_archive for now. +inherit oee-archive +OEE_ARCHIVE_SUB_DIR = "igh-ethercat" -SRC_URI = " file://ethercat-e1000e-5.10.tar.gz;subdir=${BP};striplevel=1 \ - file://0001-ethercat-Fix-ethercat-tool-compilation.patch \ - file://0002-avoid-ssize_t.patch \ - " +SRC_URI = " \ + file://ethercat-${PV}.tar.bz2 \ +" -PACKAGECONFIG ??= "e1000e generic" +S = "${WORKDIR}/ethercat-${PV}" + +PACKAGECONFIG ??= "generic" PACKAGECONFIG[generic] = "--enable-generic,--disable-generic," PACKAGECONFIG[8139too] = "--enable-8139too,--disable-8139too," @@ -46,4 +52,7 @@ do_install:append() { oe_runmake distclean } -FILES:${PN} += "${nonarch_base_libdir}/modules/${KERNEL_VERSION}" +FILES:${PN} += " \ +${nonarch_base_libdir}/modules/${KERNEL_VERSION} \ +/usr/share \ +" -- Gitee From 24b5349471d3e0a9ea0095f21047306ced7cb229 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Thu, 27 Feb 2025 15:38:21 +0800 Subject: [PATCH 11/30] kp920: add some packages * Add some packages support to kp920: ethercat-igh, libmodbus, openjpeg, opencv. Signed-off-by: hanzongcheng --- bsp/meta-kunpeng/recipes-core/images/image-kp920.inc | 6 +++--- .../recipes-core/packagegroups/packagegroup-hmi.bb | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc b/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc index 19aab21b1f6..926da8e76a7 100644 --- a/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc +++ b/bsp/meta-kunpeng/recipes-core/images/image-kp920.inc @@ -5,8 +5,8 @@ require recipes-core/images/bsp-${MACHINE}.inc # all app and tools IMAGE_INSTALL += " \ - ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6', ' \ - ', ' \ ethercat-igh \ - ', d)} \ + libmodbus \ + openjpeg \ + opencv \ " diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb index f2ddf85eae4..5788d4159a2 100644 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-hmi.bb @@ -16,5 +16,4 @@ adwaita-icon-theme \ ttf-wqy-zenhei \ firefox-bin \ labwc \ -openjpeg \ " -- Gitee From 0ea17c2405304fd9096bcb6cee8c7dbc53d2496f Mon Sep 17 00:00:00 2001 From: Wanming Hu Date: Sat, 1 Mar 2025 20:58:50 +0800 Subject: [PATCH 12/30] xen: support xen on kp920 * support building xen on kp920 * support xen menu in kp920 grub * enable acpi in xen Signed-off-by: Wanming Hu --- .oebuild/features/xen.yaml | 2 +- .../images/openeuler-image-mcs.bbappend | 1 + .../images/openeuler-image.bbappend | 1 + .../recipes-core/images/xen-image.inc | 24 +++++++++++++++++++ .../files/init-install-efi-openeuler.sh | 2 +- meta-openeuler/recipes-mcs/xen/files/xen.cfg | 2 ++ .../recipes-mcs/xen/xen-openeuler.inc | 1 + 7 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 bsp/meta-kunpeng/recipes-core/images/openeuler-image-mcs.bbappend create mode 100644 bsp/meta-kunpeng/recipes-core/images/xen-image.inc create mode 100644 meta-openeuler/recipes-mcs/xen/files/xen.cfg diff --git a/.oebuild/features/xen.yaml b/.oebuild/features/xen.yaml index 548089db5fc..e5da81ea1a9 100644 --- a/.oebuild/features/xen.yaml +++ b/.oebuild/features/xen.yaml @@ -1,6 +1,6 @@ type: feature -support: qemu-aarch64|raspberrypi4-64 +support: qemu-aarch64|raspberrypi4-64|kp920 local_conf: | DISTRO_FEATURES:append = " xen" diff --git a/bsp/meta-kunpeng/recipes-core/images/openeuler-image-mcs.bbappend b/bsp/meta-kunpeng/recipes-core/images/openeuler-image-mcs.bbappend new file mode 100644 index 00000000000..373b3ae148b --- /dev/null +++ b/bsp/meta-kunpeng/recipes-core/images/openeuler-image-mcs.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen-image.inc', '', d)} diff --git a/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend b/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend index dac2e55b882..9788d5c9a35 100644 --- a/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend +++ b/bsp/meta-kunpeng/recipes-core/images/openeuler-image.bbappend @@ -1 +1,2 @@ require recipes-core/images/image-${MACHINE}.inc +require ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen-image.inc', '', d)} diff --git a/bsp/meta-kunpeng/recipes-core/images/xen-image.inc b/bsp/meta-kunpeng/recipes-core/images/xen-image.inc new file mode 100644 index 00000000000..7005ed40d91 --- /dev/null +++ b/bsp/meta-kunpeng/recipes-core/images/xen-image.inc @@ -0,0 +1,24 @@ +# install xen.cfg via grub-efi.bbclass +python build_efi_cfg:append() { + XEN_GRUB_CFG = """ + menuentry 'xen'{ + xen_hypervisor /xen-kp920 dom0_mem=1024M + xen_module /Image earlyprintk earlycon=pl011,0x94080000 root=/dev/sda2 console=ttyAMA0,115200n8 rw rootwait + } + """ + + try: + cfgfile = open(cfile, 'a') + except OSError: + bb.fatal('Unable to open %s' % cfile) + + cfgfile.write(XEN_GRUB_CFG) + cfgfile.close() +} + +# install xen +populate_live:append() { + if [ -e ${DEPLOY_DIR_IMAGE}/xen-${MACHINE} ]; then + install -m 0644 ${DEPLOY_DIR_IMAGE}/xen-${MACHINE} $1/ + fi +} diff --git a/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh b/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh index aa954a3d65c..4d46111f17e 100644 --- a/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh +++ b/meta-openeuler/recipes-core/initrdscripts/files/init-install-efi-openeuler.sh @@ -402,7 +402,7 @@ fi # Copy kernel artifacts. To add more artifacts just add to types # For now just support kernel types already being used by something in OE-core -for types in bzImage zImage vmlinux vmlinuz fitImage; do +for types in bzImage zImage Image vmlinux vmlinuz fitImage xen; do for kernel in `find /run/media/${TARGET_CDROM_NAME}/ -iname $types*`; do cp $kernel /boot done diff --git a/meta-openeuler/recipes-mcs/xen/files/xen.cfg b/meta-openeuler/recipes-mcs/xen/files/xen.cfg new file mode 100644 index 00000000000..26dd4bd2155 --- /dev/null +++ b/meta-openeuler/recipes-mcs/xen/files/xen.cfg @@ -0,0 +1,2 @@ +CONFIG_UNSUPPORTED=y +CONFIG_ACPI=y diff --git a/meta-openeuler/recipes-mcs/xen/xen-openeuler.inc b/meta-openeuler/recipes-mcs/xen/xen-openeuler.inc index 254c3f7183e..ea63d187477 100644 --- a/meta-openeuler/recipes-mcs/xen/xen-openeuler.inc +++ b/meta-openeuler/recipes-mcs/xen/xen-openeuler.inc @@ -4,6 +4,7 @@ PV = "4.18.2" OPENEULER_LOCAL_NAME = "xen" SRC_URI = " \ file://RELEASE-${PV}.tar.gz \ + file://xen.cfg \ " # xen-tools also uses the xen source pkg, so specify "xen" instead of "BPN". -- Gitee From 2a3804f64dce84bb47eea4c3b6fe54b8e32d724e Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Mon, 3 Mar 2025 14:30:38 +0800 Subject: [PATCH 13/30] qemu-system-native: fix the issue of qemu-system-native * QB_SYSTEM_NAME in openeuler_hosttools doesn't work, as QB_SYSTEM_NAME is set latter, so directly add qemu-system-xxx which is supported * qemu depends on qemu-system-native Signed-off-by: Wayne Ren --- meta-openeuler/conf/distro/include/openeuler_hosttools.inc | 6 +++--- meta-openeuler/conf/machine/include/qemu.inc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meta-openeuler/conf/distro/include/openeuler_hosttools.inc b/meta-openeuler/conf/distro/include/openeuler_hosttools.inc index 04cb7c5b907..fcbe823ada3 100644 --- a/meta-openeuler/conf/distro/include/openeuler_hosttools.inc +++ b/meta-openeuler/conf/distro/include/openeuler_hosttools.inc @@ -81,10 +81,10 @@ HOSTTOOLS_NONFATAL += "rsync" # the following are used to remove dependency ## tools required possibly required by linux-libc-hearders ASSUME_PROVIDED += "unifdef-native rsync-native" -## prebuilt qemu is used (gobject-introspection), so no qemu-native and nativesdk-qemuwrapper-cross -ASSUME_PROVIDED += "qemu-native rsync-native nativesdk-qemuwrapper-cross" +## prebuilt qemu is used (gobject-introspection), so no qemu-native, qemu-system-native nativesdk-qemuwrapper-cross +ASSUME_PROVIDED += "qemu-native qemu-system-native rsync-native nativesdk-qemuwrapper-cross" HOSTTOOLS_NONFATAL += "qemu-aarch64 qemu-arm qemu-i386 qemu-ppc qemu-ppc64 qemu-pr-helper qemu-riscv32 qemu-riscv64 generic-x86_64 qemu-x86_64" -HOSTTOOLS_NONFATAL += "${QB_SYSTEM_NAME}" +HOSTTOOLS_NONFATAL += "qemu-system-aarch64 qemu-system-arm qemu-system-i386 qemu-system-riscv64 qemu-system-x86_64" ## dwarfsrcfiles-native is used in package.bbclass, it needs elfutil ## \todo remove dwarfsrcfiles-native after elfutil is added into nativesdk ASSUME_PROVIDED += "dwarfsrcfiles-native" diff --git a/meta-openeuler/conf/machine/include/qemu.inc b/meta-openeuler/conf/machine/include/qemu.inc index ca13f314c71..2530051c2ec 100644 --- a/meta-openeuler/conf/machine/include/qemu.inc +++ b/meta-openeuler/conf/machine/include/qemu.inc @@ -6,4 +6,4 @@ MACHINEOVERRIDES =. "qemuall:" # support runqemu function IMAGE_CLASSES += "qemuboot" -EXTRA_IMAGEDEPENDS += "qemu-helper-native:do_addto_recipe_sysroot" +EXTRA_IMAGEDEPENDS += "qemu-system-native qemu-helper-native:do_addto_recipe_sysroot" -- Gitee From e0aa6093566871352866fe22d0f866442c71e8d8 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Mon, 3 Mar 2025 14:33:58 +0800 Subject: [PATCH 14/30] rust-demo: replace cargo with cargo_bin rust-demos is built with prebuilt rust toolchain, so use cargo_bin to replace cargo after changes in cargo_bin.bbclass Signed-off-by: Wayne Ren --- meta-openeuler/recipes-extended/rust-demo/rust-demo_0.1.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-openeuler/recipes-extended/rust-demo/rust-demo_0.1.bb b/meta-openeuler/recipes-extended/rust-demo/rust-demo_0.1.bb index 1f1bdbfb0f2..8c8dea121c3 100644 --- a/meta-openeuler/recipes-extended/rust-demo/rust-demo_0.1.bb +++ b/meta-openeuler/recipes-extended/rust-demo/rust-demo_0.1.bb @@ -1,4 +1,4 @@ -inherit cargo +inherit cargo_bin SUMMARY = "Rust simple demo" DESCRIPTION = "A demo using openeuler Rust toolchain" LICENSE = "MIT" -- Gitee From 34d0e11ed72af1374e002dd8db51a7bbc4de1734 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Mon, 3 Mar 2025 13:49:40 +0800 Subject: [PATCH 15/30] meta-openeuler: replace cargo with cargo_bin * librsvg and lib-shim are built with prebuilt rust toolchain, so use cargo_bin to replace cargo after changes in cargo_bin.bbclass Signed-off-by: hanzongcheng --- meta-openeuler/recipes-core/isulad/lib-shim-v2_0.0.1.bb | 2 +- meta-openeuler/recipes-gnome/librsvg/librsvg_%.bbappend | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/meta-openeuler/recipes-core/isulad/lib-shim-v2_0.0.1.bb b/meta-openeuler/recipes-core/isulad/lib-shim-v2_0.0.1.bb index bf77a0fe0c5..772924f5fba 100644 --- a/meta-openeuler/recipes-core/isulad/lib-shim-v2_0.0.1.bb +++ b/meta-openeuler/recipes-core/isulad/lib-shim-v2_0.0.1.bb @@ -1,4 +1,4 @@ -inherit cargo +inherit cargo_bin SUMMARY = "lib-shim-v2 is shim v2 ttrpc client which is called by iSulad." DESCRIPTION = "Based on Rust programming language, as a shim v2 ttrpc client, it is called by iSulad." HOMEPAGE = "https://gitee.com/openeuler/lib-shim-v2" diff --git a/meta-openeuler/recipes-gnome/librsvg/librsvg_%.bbappend b/meta-openeuler/recipes-gnome/librsvg/librsvg_%.bbappend index 2d537fce7ec..01935154759 100644 --- a/meta-openeuler/recipes-gnome/librsvg/librsvg_%.bbappend +++ b/meta-openeuler/recipes-gnome/librsvg/librsvg_%.bbappend @@ -5,10 +5,10 @@ OPENEULER_LOCAL_NAME = "librsvg2" # remove cargo_common rust cargo-update-recipe-crates, use openeuler's cargo.bbclass -inherit cargo gnomebase pixbufcache gobject-introspection vala gi-docgen +inherit cargo_bin gnomebase pixbufcache gobject-introspection vala gi-docgen # prevent being overwritten by autotools from gnomebase -do_configure[postfuncs] += "cargo_do_configure" +do_configure[postfuncs] += "cargo_bin_do_configure" # fix err target generated by autotools from gnomebase export RUST_TARGET -- Gitee From 3886a756b4c5f998309800f264a2c5f0b0250477 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Mon, 3 Mar 2025 14:00:24 +0800 Subject: [PATCH 16/30] mcs: update mcs version * Add communication service "rpmsg-umt" See also: https://gitee.com/openeuler/mcs/pulls/130 Signed-off-by: hanzongcheng --- .oebuild/manifest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index 049dfe755bd..a68c5cf4ac7 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -1115,7 +1115,7 @@ manifest_list: version: 80744f17a0ec0300e9bc4e140c35120460a05a8a mcs: remote_url: https://gitee.com/openeuler/mcs.git - version: 696e84564e1c0466598f83568a1d141990643bb4 + version: 94867989a10f14e4883105a2cf8c27f43e29c93b mcs-x86: remote_url: https://gitee.com/openeuler/mcs.git version: b3fbf6cccc7b2cbe1acdf836bba5aa7b76974499 -- Gitee From fcf42aea578adc9c7b2caa12ea9468015b92e4b5 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Mon, 3 Mar 2025 15:14:33 +0800 Subject: [PATCH 17/30] kp920: add compile.yaml samples * Add kp920-industry-*.yaml for the KP920 image building. Signed-off-by: hanzongcheng --- .../aarch64/kp920-industry-kernel6.yaml | 47 +++++++++++++++++++ .oebuild/samples/aarch64/kp920-industry.yaml | 43 +++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .oebuild/samples/aarch64/kp920-industry-kernel6.yaml create mode 100644 .oebuild/samples/aarch64/kp920-industry.yaml diff --git a/.oebuild/samples/aarch64/kp920-industry-kernel6.yaml b/.oebuild/samples/aarch64/kp920-industry-kernel6.yaml new file mode 100644 index 00000000000..1299aba44c0 --- /dev/null +++ b/.oebuild/samples/aarch64/kp920-industry-kernel6.yaml @@ -0,0 +1,47 @@ +# Features: systemd, hmi, kernel6, xen, mcs, isulad +build_in: docker +machine: kp920 +toolchain_type: EXTERNAL_TOOLCHAIN:aarch64 +no_layer: false +repos: +- yocto-poky +- yocto-meta-openembedded +- yocto-meta-qt5 +- Jailhouse +local_conf: |+ + MCS_FEATURES ?= "openamp" + DISTRO_FEATURES:append = " mcs" + RPI_USE_UEFI:raspberrypi4-64 = "1" + + DISTRO_FEATURES:append = " xen" + + DISTRO_FEATURES:append = " isulad " + + DISTRO_FEATURES:append = " kernel6 " + PREFERRED_VERSION_linux-openeuler ?= "6.6%" + PREFERRED_VERSION_linux-openeuler-rt ?= "6.6%" + + DISTRO_FEATURES:append = " hmi " + DISTRO_FEATURES:append = " opengl" + OPENEULER_DEFAULT_DISTRO_FEATURES:append = " x11" + DISTRO_FEATURES:append = " wayland" + IMAGE_FEATURES:append = " weston" + GLIBC_GENERATE_LOCALES:append = "en_US.UTF-8 zh_CN.UTF-8 " + + INIT_MANAGER = "systemd" + +layers: +- yocto-meta-openeuler/bsp/meta-kunpeng +- yocto-meta-openembedded/meta-oe +- yocto-meta-qt5 +- yocto-meta-openeuler/rtos/meta-openeuler-rtos +docker_param: + image: swr.cn-north-4.myhuaweicloud.com/openeuler-embedded/openeuler-container:latest + parameters: -itd --network host + volumns: + - /dev/net/tun:/dev/net/tun + command: bash + +bitbake_cmds: +- bitbake openeuler-image +- bitbake openeuler-image -c do_populate_sdk diff --git a/.oebuild/samples/aarch64/kp920-industry.yaml b/.oebuild/samples/aarch64/kp920-industry.yaml new file mode 100644 index 00000000000..268b23a9ce7 --- /dev/null +++ b/.oebuild/samples/aarch64/kp920-industry.yaml @@ -0,0 +1,43 @@ +# Features: systemd, hmi, xen, mcs, isulad +build_in: docker +machine: kp920 +toolchain_type: EXTERNAL_TOOLCHAIN:aarch64 +no_layer: false +repos: +- yocto-poky +- yocto-meta-openembedded +- yocto-meta-qt5 +- Jailhouse +local_conf: |+ + MCS_FEATURES ?= "openamp" + DISTRO_FEATURES:append = " mcs" + RPI_USE_UEFI:raspberrypi4-64 = "1" + + DISTRO_FEATURES:append = " xen" + + DISTRO_FEATURES:append = " isulad " + + DISTRO_FEATURES:append = " hmi " + DISTRO_FEATURES:append = " opengl" + OPENEULER_DEFAULT_DISTRO_FEATURES:append = " x11" + DISTRO_FEATURES:append = " wayland" + IMAGE_FEATURES:append = " weston" + GLIBC_GENERATE_LOCALES:append = "en_US.UTF-8 zh_CN.UTF-8 " + + INIT_MANAGER = "systemd" + +layers: +- yocto-meta-openeuler/bsp/meta-kunpeng +- yocto-meta-openembedded/meta-oe +- yocto-meta-qt5 +- yocto-meta-openeuler/rtos/meta-openeuler-rtos +docker_param: + image: swr.cn-north-4.myhuaweicloud.com/openeuler-embedded/openeuler-container:latest + parameters: -itd --network host + volumns: + - /dev/net/tun:/dev/net/tun + command: bash + +bitbake_cmds: +- bitbake openeuler-image +- bitbake openeuler-image -c do_populate_sdk -- Gitee From ecf6da0d9856aa8d78dcf9510eaeb399b52cc6de Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Tue, 4 Mar 2025 00:17:37 +0800 Subject: [PATCH 18/30] cargo: allow native builds * Fix the following issues: nothing PROVIDES 'cargo-bin-native'. Signed-off-by: hanzongcheng --- meta-openeuler/recipes-devtools/rust/cargo-bin-cross.inc | 6 +++++- meta-openeuler/recipes-devtools/rust/rustc-bin-cross.inc | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meta-openeuler/recipes-devtools/rust/cargo-bin-cross.inc b/meta-openeuler/recipes-devtools/rust/cargo-bin-cross.inc index 36e99c023f0..7741043f5af 100644 --- a/meta-openeuler/recipes-devtools/rust/cargo-bin-cross.inc +++ b/meta-openeuler/recipes-devtools/rust/cargo-bin-cross.inc @@ -21,10 +21,14 @@ inherit cross inherit cargo_bin # prevent loop dependency -DEPENDS:remove = "cargo-bin-cross-${TARGET_ARCH}" +DEPENDS:remove = "\ + ${@ "cargo-bin-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') != "${BUILD_ARCH}" else "cargo-bin-native" } \ +" PN = "cargo-bin-cross-${TARGET_ARCH}" +PROVIDES += "cargo-bin-native" + CARGO_HOST_TARGET = "${@rust_target(d, 'HOST')}" SYSROOT_DIRS_NATIVE += "${prefix}" diff --git a/meta-openeuler/recipes-devtools/rust/rustc-bin-cross.inc b/meta-openeuler/recipes-devtools/rust/rustc-bin-cross.inc index 54a6ac97fdb..0b1b18df14c 100644 --- a/meta-openeuler/recipes-devtools/rust/rustc-bin-cross.inc +++ b/meta-openeuler/recipes-devtools/rust/rustc-bin-cross.inc @@ -20,11 +20,14 @@ SECTION = "devel" inherit cross inherit cargo_bin -# prevent loop dependency -DEPENDS:remove = "cargo-bin-cross-${TARGET_ARCH}" +PN:class-native = "rustc-bin-native-${BUILD_ARCH}" + +DEPENDS:remove = "\ + ${@ "cargo-bin-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') != "${BUILD_ARCH}" else "cargo-bin-native" } \ +" # Required to link binaries -DEPENDS += "gcc-cross-${TARGET_ARCH}" +DEPENDS += "${@ "gcc-cross-${TARGET_ARCH}" if d.getVar('TARGET_ARCH') == "X86_64" else "" }" PN = "rustc-bin-cross-${TARGET_ARCH}" -- Gitee From ed56527274c72fd7c4efecf7942cceafdb976ba8 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Sun, 9 Mar 2025 15:07:55 +0800 Subject: [PATCH 19/30] zephyr: refactor the integration of zephyr * update zephyr to v3.7.1 latest lts * support zephyr build from openeuler's git repo * refactor zephyr mcs's part, jailhouse and openamp are tested in qemu-aarch64 * to use zephyr in mcs, append 'zephyr' in MCS_FEATURES, e.g., MCS_FEATURES = " openamp zephyr" or MCS_FEATURES = " jailhouse zephyr" Signed-off-by: Wayne Ren --- .oebuild/manifest.yaml | 5 +- .../images/openeuler-image-mcs.bb | 5 + .../recipes-mcs/mcs-linux/mcsctl.bb | 2 +- rtos/meta-zephyr/classes/zephyr.bbclass | 10 +- .../zephyr-toolchain-aarch64.bb | 32 + ...d-dependencies-required-by-benchmark.patch | 180 -- .../files/libmetal_fix_configure_error.patch | 13 - .../files/zephyr_openeuler_mcs.patch | 1610 +++++++++-------- .../zephyr-kernel/zephyr-image.bb | 28 +- .../zephyr-kernel/zephyr-image.inc | 8 +- .../zephyr-kernel/zephyr-kernel-common.inc | 11 +- .../zephyr-kernel/zephyr-kernel-src.inc | 10 +- .../zephyr-toolchain-cross-compile.inc | 8 +- 13 files changed, 925 insertions(+), 997 deletions(-) create mode 100644 rtos/meta-zephyr/recipes-devtools/zephyr_toolchain/zephyr-toolchain-aarch64.bb delete mode 100644 rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/benchmark/0001-zehpyr-add-dependencies-required-by-benchmark.patch delete mode 100644 rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/libmetal_fix_configure_error.patch diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index a68c5cf4ac7..5688596ccaa 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -1115,7 +1115,7 @@ manifest_list: version: 80744f17a0ec0300e9bc4e140c35120460a05a8a mcs: remote_url: https://gitee.com/openeuler/mcs.git - version: 94867989a10f14e4883105a2cf8c27f43e29c93b + version: 5cb49156276be04d54a77a630b8600dcc122fdba mcs-x86: remote_url: https://gitee.com/openeuler/mcs.git version: b3fbf6cccc7b2cbe1acdf836bba5aa7b76974499 @@ -2217,3 +2217,6 @@ manifest_list: python3-asn1crypto: remote_url: https://gitee.com/src-openeuler/python-asn1crypto.git version: 59c9fa5ffb80473812a0174c8ab671ac83090505 + zephyrproject: + remote_url: https://gitee.com/src-openeuler/zephyr.git + version: b113436397901e554c7a5d3f0dc08b54e681eb46 diff --git a/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb b/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb index b961b464f25..83c03185c6e 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb +++ b/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb @@ -40,5 +40,10 @@ python () { d.setVar('QB_DTB_LINK', d.getVar('IMAGE_LINK_NAME') + ".qemuboot.dtb") elif 'jailhouse' in mcs_features: d.setVar('QB_MACHINE', '-machine virt,gic-version=3,virtualization=on,its=off') + d.setVar('QB_MEM', '-m 2048') + d.setVar('QB_OPT_APPEND','') + d.setVar('QB_RNG','') + d.setVar('QB_GRAPHICS','') + d.setVar('QB_NETWORK_DEVICE', "-device virtio-net-device,netdev=net0,mac=@MAC@") d.setVar('QB_KERNEL_CMDLINE_APPEND', 'mem=750M') } diff --git a/meta-openeuler/recipes-mcs/mcs-linux/mcsctl.bb b/meta-openeuler/recipes-mcs/mcs-linux/mcsctl.bb index 57e6d045419..8d302243051 100644 --- a/meta-openeuler/recipes-mcs/mcs-linux/mcsctl.bb +++ b/meta-openeuler/recipes-mcs/mcs-linux/mcsctl.bb @@ -35,7 +35,7 @@ do_install:append () { # install rtos firmware install -d ${D}/lib/firmware - cp ${S}/rtos/arm64/${RTOS_IMGS}*.elf ${D}/lib/firmware/ + cp ${S}/rtos/arm64/*.elf ${D}/lib/firmware/ } FILES:${PN} += "/usr/bin/mica" diff --git a/rtos/meta-zephyr/classes/zephyr.bbclass b/rtos/meta-zephyr/classes/zephyr.bbclass index 68f454d71c2..41b78eff95e 100644 --- a/rtos/meta-zephyr/classes/zephyr.bbclass +++ b/rtos/meta-zephyr/classes/zephyr.bbclass @@ -29,14 +29,6 @@ TOOLCHAIN_OPTIONS = "" # qemuboot writes into IMGDEPLOYDIR, force to write to DEPLOY_DIR_IMAGE IMGDEPLOYDIR = "${DEPLOY_DIR_IMAGE}" -python () { - # Translate MACHINE into Zephyr BOARD - # Zephyr BOARD is basically our MACHINE, except we must use "-" instead of "_" - board = d.getVar('ZEPHYR_BOARD', True) - board = board.replace('-', '_') - d.setVar('BOARD',board) -} - python do_menuconfig() { os.chdir(d.getVar('B', True)) configdir = d.getVar('B', True) @@ -67,5 +59,5 @@ addtask menuconfig after do_configure python do_devshell:prepend () { # Most likely we need to manually edit prj.conf... - os.chdir(d.getVar('ZEPHYR_SRC_DIR', True)) + os.chdir(d.getVar('ZEPHYR_APP_DIR', True)) } diff --git a/rtos/meta-zephyr/recipes-devtools/zephyr_toolchain/zephyr-toolchain-aarch64.bb b/rtos/meta-zephyr/recipes-devtools/zephyr_toolchain/zephyr-toolchain-aarch64.bb new file mode 100644 index 00000000000..e71702521bf --- /dev/null +++ b/rtos/meta-zephyr/recipes-devtools/zephyr_toolchain/zephyr-toolchain-aarch64.bb @@ -0,0 +1,32 @@ +SUMMARY = "Zephyr toolchain for aarch64" +DESCRIPTION = "Official aarch64 toolchain built using crosstool-ng, distributed by the \ +Zephyr project" +COMPATIBLE_HOST = "x86_64.*-linux" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +INHIBIT_DEFAULT_DEPS = "1" + +OPENEULER_LOCAL_NAME = "zephyrproject" + +PV = "0.17.0" + +SDK_NAME = "${BUILD_ARCH}" +SRC_URI = "file://toolchain_${PV}/toolchain_linux-x86_64_aarch64-zephyr-elf.tar.xz" + +S = "${WORKDIR}/aarch64-zephyr-elf" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +ZEPHYR_SDK_DIR = "${prefix}" + +do_install() { + install -d ${D}${prefix} + cp -r ${S}/* ${D}${ZEPHYR_SDK_DIR} +} + +SYSROOT_DIRS += "${ZEPHYR_SDK_DIR}" +INHIBIT_SYSROOT_STRIP = "1" +BBCLASSEXTEND = "native" diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/benchmark/0001-zehpyr-add-dependencies-required-by-benchmark.patch b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/benchmark/0001-zehpyr-add-dependencies-required-by-benchmark.patch deleted file mode 100644 index a1182c5648e..00000000000 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/benchmark/0001-zehpyr-add-dependencies-required-by-benchmark.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 282c3c77015f1e95ef52312b970f8aed8c2a81ee Mon Sep 17 00:00:00 2001 -From: Pengfei Deng <1652695505@qq.com> -Date: Thu, 19 Oct 2023 18:29:22 +0800 -Subject: [PATCH] zehpyr: add dependencies required by benchmark - -add relevant code to adapt benchmark related tests. - -Signed-off-by: dengpengfei <1652695505@qq.com> - -diff --git a/subsys/ipc/rpmsg_service/CMakeLists.txt b/subsys/ipc/rpmsg_service/CMakeLists.txt -index cde10cdd..09d8442e 100644 ---- a/subsys/ipc/rpmsg_service/CMakeLists.txt -+++ b/subsys/ipc/rpmsg_service/CMakeLists.txt -@@ -3,3 +3,4 @@ - zephyr_sources(rpmsg_backend.c) - zephyr_sources(rpmsg_service.c) - zephyr_sources(rpmsg_rpc_service.c) -+zephyr_sources(rpmsg_test_service.c) -\ No newline at end of file -diff --git a/subsys/ipc/rpmsg_service/rpmsg_test_service.c b/subsys/ipc/rpmsg_service/rpmsg_test_service.c -new file mode 100644 -index 00000000..e4210185 ---- /dev/null -+++ b/subsys/ipc/rpmsg_service/rpmsg_test_service.c -@@ -0,0 +1,86 @@ -+#include "rpmsg_test_service.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define LOG_MODULE_NAME rpmsg_rpc_service -+LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_RPMSG_SERVICE_LOG_LEVEL); -+ -+static int pty_ping_ep_id, rpc_ping_id, rpc_long_ping_id; -+ -+static int benchmark_rpc_ping_cb(struct rpmsg_endpoint *ept, void *data, size_t len, -+ uint32_t src, void *priv) -+{ -+ int ret; -+ struct _payload *msg = (struct _payload *)data; -+ -+ for (int i = 0; i < 4; i++) -+ if (msg->data[i] != 2023) -+ return 1; -+ ret = rpmsg_service_send(rpc_ping_id, data, len); -+ -+ return 0; -+} -+ -+static int benchmark_rpc_long_ping_cb(struct rpmsg_endpoint *ept, void *data, size_t len, -+ uint32_t src, void *priv) -+{ -+ int ret; -+ struct _large_msg *msg = (struct _large_msg *)data; -+ -+ for (int i = 0; i < 59; i++) -+ if (msg->data[i] != 2023) -+ return 1; -+ ret = rpmsg_service_send(rpc_long_ping_id, data, len); -+ return 0; -+} -+ -+static int pty_ping_cb(struct rpmsg_endpoint *ept, void *data, size_t len, -+ uint32_t src, void *priv) -+{ -+ int ret; -+ ret = rpmsg_service_send(pty_ping_ep_id, (char *)data, len); -+ if (ret < 0) { -+ LOG_ERR("rpmsh send error\n"); -+ } -+ return 0; -+} -+ -+int benchmark_rpc_service_init() -+{ -+ int ret; -+ -+ ret = rpmsg_service_register_endpoint(BENCHMARK_RPC_PING, benchmark_rpc_ping_cb, NULL, &rpc_ping_id); -+ if (ret >= 0) { -+ rpc_ping_id = ret; -+ } else { -+ return ret; -+ } -+ -+ ret = rpmsg_service_register_endpoint(BENCHMARK_RPC_LONG_PING, benchmark_rpc_long_ping_cb, NULL, &rpc_long_ping_id); -+ if (ret >= 0) { -+ rpc_long_ping_id = ret; -+ return 0; -+ } else { -+ return ret; -+ } -+} -+ -+int pty_ping_service_init() -+{ -+ int ret; -+ ret = rpmsg_service_register_endpoint(BENCHMARK_PTY_PING, pty_ping_cb, NULL, -+ &pty_ping_ep_id); -+ if (ret >= 0) { -+ pty_ping_ep_id = ret; -+ return 0; -+ } else { -+ return ret; -+ } -+} -+SYS_INIT(benchmark_rpc_service_init, POST_KERNEL, CONFIG_RPMSG_SERVICE_EP_REG_PRIORITY); -+SYS_INIT(pty_ping_service_init, POST_KERNEL, CONFIG_RPMSG_SERVICE_EP_REG_PRIORITY); -\ No newline at end of file -diff --git a/subsys/ipc/rpmsg_service/rpmsg_test_service.h b/subsys/ipc/rpmsg_service/rpmsg_test_service.h -new file mode 100644 -index 00000000..3c17b40e ---- /dev/null -+++ b/subsys/ipc/rpmsg_service/rpmsg_test_service.h -@@ -0,0 +1,59 @@ -+#ifndef ZEPHYR_SUBSYS_IPC_RPMSG_TEST_SERVICE_H -+#define ZEPHYR_SUBSYS_IPC_RPMSG_TEST_SERVICE_H -+ -+#include -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#define BENCHMARK_RPC_PING "rpc-ping" -+#define BENCHMARK_RPC_LONG_PING "rpc-long-ping" -+#define BENCHMARK_PTY_PING "pty-ping" -+ -+/* RPMSG_BUFFER_SIZE = 512 -+ * sizeof(struct rpmsg_hdr) = 16 -+ * RPMSG_BUFFER_SIZE - sizeof(struct rpmsg_hdr) - 4 = 492 -+ * Aligning to 64 bits -> 488UL -+ */ -+#define MAX_BUF_LEN 488UL -+#define RPC_ID_LEN sizeof(uint32_t) -+/* -+ * rpc service call back -+ */ -+typedef int (*rpmsg_rpc_cb_t)(void *params, size_t len); -+ -+struct rpmsg_rpc_service { -+ uint32_t id; -+ rpmsg_rpc_cb_t cb_function; -+}; -+ -+struct _large_msg -+{ -+ unsigned long flag; -+ unsigned long data[]; -+}; -+ -+struct _payload{ -+ unsigned long num; -+ unsigned long size; -+ unsigned long data[]; -+}; -+ -+struct rpmsg_rpc_data { -+ uint32_t id; /* rpc id */ -+ unsigned char params[MAX_BUF_LEN]; -+} __packed; -+ -+struct rpmsg_rpc_instance { -+ unsigned int ep_id; /* endpoint id */ -+ const struct rpmsg_rpc_service *services; /* service table */ -+ unsigned int n_services; /* number of services */ -+}; -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* ZEPHYR_SUBSYS_IPC_RPMSG_RPC_SERVICE_H */ --- -2.35.3 - diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/libmetal_fix_configure_error.patch b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/libmetal_fix_configure_error.patch deleted file mode 100644 index b0fcad2b2db..00000000000 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/libmetal_fix_configure_error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/libmetal/cmake/syscheck.cmake b/libmetal/cmake/syscheck.cmake -index 032a849..303a0e8 100644 ---- a/libmetal/cmake/syscheck.cmake -+++ b/libmetal/cmake/syscheck.cmake -@@ -1,7 +1,7 @@ - # use "Generic" as CMAKE_SYSTEM_NAME - - if (WITH_ZEPHYR) -- set (CMAKE_SYSTEM_NAME "Generic" CACHE STRING "") -+ set (CMAKE_SYSTEM_NAME "Generic") - string (TOLOWER "Zephyr" PROJECT_SYSTEM) - string (TOUPPER "Zephyr" PROJECT_SYSTEM_UPPER) - if (NOT WITH_ZEPHYR_LIB) diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/zephyr_openeuler_mcs.patch b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/zephyr_openeuler_mcs.patch index b8371013104..1f7ed290a1a 100644 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/zephyr_openeuler_mcs.patch +++ b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/files/zephyr_openeuler_mcs.patch @@ -1,64 +1,35 @@ -diff --git a/arch/arm64/core/Kconfig b/arch/arm64/core/Kconfig -index 968454634f..2e23271ad3 100644 ---- a/arch/arm64/core/Kconfig -+++ b/arch/arm64/core/Kconfig -@@ -257,6 +257,9 @@ config ARM64_PA_BITS_40 - config ARM64_PA_BITS_42 - bool "42-bit" - -+config ARM64_PA_BITS_44 -+ bool "44-bit" -+ - config ARM64_PA_BITS_48 - bool "48-bit" - endchoice -@@ -267,6 +270,7 @@ config ARM64_PA_BITS - default 36 if ARM64_PA_BITS_36 - default 40 if ARM64_PA_BITS_40 - default 42 if ARM64_PA_BITS_42 -+ default 44 if ARM64_PA_BITS_44 - default 48 if ARM64_PA_BITS_48 - - config MAX_XLAT_TABLES -diff --git a/arch/arm64/core/cache.c b/arch/arm64/core/cache.c -index d5aefaf3a9..19d905cc3e 100644 ---- a/arch/arm64/core/cache.c -+++ b/arch/arm64/core/cache.c -@@ -214,5 +214,11 @@ int arch_icache_range(void *addr, size_t size, int op) - - int arch_icache_all(int op) - { -- return -ENOTSUP; -+ /* invalidate all instruction cache */ -+ __asm__ volatile ("ic iallu" ::: "memory"); -+ -+ dsb(); -+ isb(); -+ -+ return 0; - } -diff --git a/boards/arm64/qemu_cortex_a53/Kconfig.defconfig b/boards/arm64/qemu_cortex_a53/Kconfig.defconfig -index cbe833f42f..0c43eb2eac 100644 ---- a/boards/arm64/qemu_cortex_a53/Kconfig.defconfig -+++ b/boards/arm64/qemu_cortex_a53/Kconfig.defconfig -@@ -9,4 +9,11 @@ config BUILD_OUTPUT_BIN - config BOARD - default "qemu_cortex_a53" +diff --git a/boards/qemu/cortex_a53/Kconfig.defconfig b/boards/qemu/cortex_a53/Kconfig.defconfig +index 70fe11c6d73..c0b78c1f0b8 100644 +--- a/boards/qemu/cortex_a53/Kconfig.defconfig ++++ b/boards/qemu/cortex_a53/Kconfig.defconfig +@@ -42,5 +42,11 @@ config QEMU_ICOUNT_SLEEP + default y + endif # QEMU_ICOUNT +if IPM + +config IPM_GIC_SGI + default y + +endif # IPM -+ + endif # BOARD_QEMU_CORTEX_A53 -diff --git a/boards/arm64/qemu_cortex_a53/qemu_cortex_a53_remote.dts b/boards/arm64/qemu_cortex_a53/qemu_cortex_a53_remote.dts +diff --git a/boards/qemu/cortex_a53/board.yml b/boards/qemu/cortex_a53/board.yml +index ab04f6ac8f1..89303f59086 100644 +--- a/boards/qemu/cortex_a53/board.yml ++++ b/boards/qemu/cortex_a53/board.yml +@@ -6,3 +6,5 @@ board: + variants: + - name: smp + - name: xip ++ - name: remote ++ - name: ivshmem +diff --git a/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_ivshmem.dts b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_ivshmem.dts new file mode 100644 -index 0000000000..b73939dd43 +index 00000000000..fbbd693f495 --- /dev/null -+++ b/boards/arm64/qemu_cortex_a53/qemu_cortex_a53_remote.dts -@@ -0,0 +1,65 @@ ++++ b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_ivshmem.dts +@@ -0,0 +1,93 @@ +/* + * Copyright (c) 2019 Carlo Caione + * @@ -68,6 +39,7 @@ index 0000000000..b73939dd43 + +/dts-v1/; +#include ++#include + +/ { + model = "QEMU Cortex-A53"; @@ -82,19 +54,10 @@ index 0000000000..b73939dd43 + chosen { + zephyr,sram = &sram1; + /* uart0 is used for debug, which also may be used by Linux */ -+ zephyr,console = &uart_rpmsg0; ++ zephyr,console = &uart0; + zephyr,shell-uart = &uart_rpmsg0; + zephyr,flash = &flash0; -+ /* -+ * shared memory reserved for the inter-processor communication -+ */ -+ zephyr,ipc_shm = &ipc_shm0; -+ zephyr,ipc = &ipm_gic_sgi0; -+ }; -+ -+ ipm_gic_sgi0: ipm{ -+ compatible = "arm,gic-sgi"; -+ label = "gic_sgi0"; ++ zephyr,pcie-controller = &pcie_jailhouse; + }; + + uart_rpmsg0: ep0 { @@ -112,26 +75,60 @@ index 0000000000..b73939dd43 + + soc { + -+ ipc_shm0: memory@70000000 { -+ compatible = "mmio-sram"; -+ reg = <0 0x70000000 0 0x30000>; -+ }; -+ + sram1: memory@7a000000 { + compatible = "mmio-sram"; + reg = <0x0 0x7a000000 0x0 DT_SIZE_M(10)>; + }; + ++ pcie_jailhouse: pcie@8e00000 { ++ compatible = "pci-host-ecam-generic"; ++ device_type = "pci"; ++ reg = <0x00 0x08e00000 0x00 0x100000>; ++ #size-cells = <0x02>; ++ #address-cells = <0x03>; ++ ranges = <0x02000000 0x00 0x10000000 0x0 0x10000000 0x00 0x10000>; ++ #interrupt-cells = <0x01>; ++ interrupt-map-mask = <0x00 0x00 0x00 0x07>; ++ interrupt-map = < ++ 0x00 0x00 0x00 1 &gic 0 0 GIC_SPI 108 IRQ_TYPE_EDGE IRQ_DEFAULT_PRIORITY ++ 0x00 0x00 0x00 2 &gic 0 0 GIC_SPI 109 IRQ_TYPE_EDGE IRQ_DEFAULT_PRIORITY ++ 0x00 0x00 0x00 3 &gic 0 0 GIC_SPI 110 IRQ_TYPE_EDGE IRQ_DEFAULT_PRIORITY ++ 0x00 0x00 0x00 4 &gic 0 0 GIC_SPI 111 IRQ_TYPE_EDGE IRQ_DEFAULT_PRIORITY>; ++ bus-range = <0x00 0x00>; ++ }; ++ ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++ current-speed = <115200>; ++}; ++ ++&pcie { ++ status = "disabled"; ++}; ++ ++&pcie_jailhouse { ++ ivshmem0: ivshmem@0 { ++ compatible = "qemu,ivshmem"; ++ ivshmem-v2; ++ vendor-id = <0x110A>; /* Siemens */ ++ device-id = <0x4106>; /* IVSHMEM */ ++ class-rev = <0xFF400100>; /* PCI_CLASS_OTHERS | IVSHMEM_PROTO_RPMSG */ ++ class-rev-mask = <0xFFFFFF00>; /* PCI_CLASS_MASK | IVSHMEM_PROTO_MASK */ ++ interrupt-parent = <&pcie_jailhouse>; ++ interrupts = <1 2 3 4>; ++ reg = <0x00 0x00 0x00 0x00 0x01>; ++ status = "okay"; + }; +}; -diff --git a/boards/arm64/qemu_cortex_a53/qemu_cortex_a53_remote_defconfig b/boards/arm64/qemu_cortex_a53/qemu_cortex_a53_remote_defconfig +diff --git a/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_ivshmem_defconfig b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_ivshmem_defconfig new file mode 100644 -index 0000000000..1f42894d44 +index 00000000000..646bc473caa --- /dev/null -+++ b/boards/arm64/qemu_cortex_a53/qemu_cortex_a53_remote_defconfig -@@ -0,0 +1,39 @@ -+CONFIG_SOC_QEMU_CORTEX_A53=y -+CONFIG_BOARD_QEMU_CORTEX_A53=y ++++ b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_ivshmem_defconfig +@@ -0,0 +1,68 @@ +CONFIG_ARM_ARCH_TIMER=y +CONFIG_QEMU_ICOUNT=n + @@ -144,10 +141,9 @@ index 0000000000..1f42894d44 +# Enable console +CONFIG_CONSOLE=y +# no early console, because uart_rpmsg is used -+CONFIG_BOOT_BANNER=n -+CONFIG_EARLY_CONSOLE=n ++CONFIG_EARLY_CONSOLE=y +CONFIG_UART_CONSOLE=y -+CONFIG_PRINTK=n ++CONFIG_PRINTK=y + +# to use remote, must be in Non-Secure world +CONFIG_ARMV8_A_NS=y @@ -156,10 +152,7 @@ index 0000000000..1f42894d44 +CONFIG_UART_RPMSG=y +CONFIG_UART_INTERRUPT_DRIVEN=y + -+# support psci ops -+CONFIG_PM_CPU_OPS=y +CONFIG_OPENAMP=y -+CONFIG_IPM=y +CONFIG_RPMSG_SERVICE_MODE_REMOTE=y +CONFIG_OPENAMP_MASTER=n +CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=8 @@ -169,85 +162,73 @@ index 0000000000..1f42894d44 +CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=60 +# the tx ring buffer size is the same of bufffer of rpmsg_virtio buffer +CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=512 -diff --git a/boards/arm64/rpi4_cortex_a72/Kconfig.board b/boards/arm64/rpi4_cortex_a72/Kconfig.board -new file mode 100644 -index 0000000000..cb4c7b7e89 ---- /dev/null -+++ b/boards/arm64/rpi4_cortex_a72/Kconfig.board -@@ -0,0 +1,7 @@ -+# Copyright (c) 2022 openEuler Embedded -+# SPDX-License-Identifier: Apache-2.0 -+ -+config BOARD_RPI4_CORTEX_A72 -+ bool "Raspberry Pi 4B" -+ depends on SOC_RPI4_CORTEX_A72 -+ select ARM64 -diff --git a/boards/arm64/rpi4_cortex_a72/Kconfig.defconfig b/boards/arm64/rpi4_cortex_a72/Kconfig.defconfig -new file mode 100644 -index 0000000000..7b426d0162 ---- /dev/null -+++ b/boards/arm64/rpi4_cortex_a72/Kconfig.defconfig -@@ -0,0 +1,19 @@ -+# Copyright (c) 2022 openEuler Embedded -+# SPDX-License-Identifier: Apache-2.0 -+ -+if BOARD_RPI4_CORTEX_A72 -+ -+config BUILD_OUTPUT_BIN -+ default y -+ -+config BOARD -+ default "rpi4_cortex_a72" -+ -+if IPM -+ -+config IPM_GIC_SGI -+ default y + -+endif # IPM -+ -+endif # BOARD_RPI4_CORTEX_A72 -diff --git a/boards/arm64/rpi4_cortex_a72/board.cmake b/boards/arm64/rpi4_cortex_a72/board.cmake -new file mode 100644 -index 0000000000..5471723b68 ---- /dev/null -+++ b/boards/arm64/rpi4_cortex_a72/board.cmake -@@ -0,0 +1,5 @@ -+# Copyright (c) 2022 openEuler Embedded -+# SPDX-License-Identifier: Apache-2.0 -+ -+board_runner_args(openocd "--use-elf" "--config=${BOARD_DIR}/support/rpi4_cortex_a72.cfg") -+include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) -diff --git a/boards/arm64/rpi4_cortex_a72/rpi4_cortex_a72.dts b/boards/arm64/rpi4_cortex_a72/rpi4_cortex_a72.dts ++# no IPM as we use virtualization ++CONFIG_IPM=n ++ ++CONFIG_PCIE=y ++CONFIG_POLL=y ++CONFIG_PCIE_CONTROLLER=y ++CONFIG_PCIE_ECAM=y ++CONFIG_KERNEL_VM_SIZE=0x80000000 ++ ++# Hungry PCI requires phys addresses with more than 32 bits ++CONFIG_ARM64_VA_BITS_40=y ++CONFIG_ARM64_PA_BITS_40=y ++ ++CONFIG_VIRTUALIZATION=y ++CONFIG_IVSHMEM=y ++CONFIG_IVSHMEM_V2=y ++CONFIG_IVSHMEM_DOORBELL=y ++CONFIG_DYNAMIC_INTERRUPTS=y ++# the correct init order: ++# serial->pci controler-> ++# ->pci scan->pci device(ivshmem_init) ++# ->virtio->rpmsg endpoint ++CONFIG_SERIAL_INIT_PRIORITY=41 ++CONFIG_CONSOLE_INIT_PRIORITY=42 ++CONFIG_PCIE_INIT_PRIORITY=43 ++CONFIG_KERNEL_INIT_PRIORITY_DEVICE=41 ++ ++CONFIG_KERNEL_DIRECT_MAP=y ++CONFIG_LOG=y ++CONFIG_LOG_BACKEND_UART=y ++# comment out the following for debug ++#CONFIG_LOG_MODE_IMMEDIATE=y ++#CONFIG_LOG_DEFAULT_LEVEL=4 ++#CONFIG_LOG_PRINTK=n +diff --git a/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_remote.dts b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_remote.dts new file mode 100644 -index 0000000000..11bcee24dc +index 00000000000..dd5b3acc2c9 --- /dev/null -+++ b/boards/arm64/rpi4_cortex_a72/rpi4_cortex_a72.dts -@@ -0,0 +1,62 @@ ++++ b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_remote.dts +@@ -0,0 +1,69 @@ +/* -+ * Copyright (c) 2022 openEuler Embedded ++ * Copyright (c) 2019 Carlo Caione + * + * SPDX-License-Identifier: Apache-2.0 + * + */ + +/dts-v1/; -+#include ++#include + +/ { -+ model = "Raspberry Pi4 B Cortex A72"; -+ compatible = "rpi4,arm-cortex-a72"; ++ model = "QEMU Cortex-A53"; ++ compatible = "qemu,arm-cortex-a53"; + + psci { + compatible = "arm,psci-0.2"; -+ method = "smc"; ++ method = "hvc"; + label = "PSCI"; + }; + + chosen { + zephyr,sram = &sram1; -+ zephyr,console = &uart_rpmsg0; -+ zephyr,shell-uart = &uart_rpmsg1; ++ /* uart0 is used for debug, which also may be used by Linux */ ++ zephyr,console = &uart0; ++ zephyr,shell-uart = &uart_rpmsg0; ++ zephyr,flash = &flash0; + /* + * shared memory reserved for the inter-processor communication + */ @@ -263,20 +244,20 @@ index 0000000000..11bcee24dc + uart_rpmsg0: ep0 { + status = "okay"; + compatible = "zephyr,rpmsg-uart"; -+ ep-name = "console"; ++ /* the rpmsg-tty driver requires ep-name should be rpmsg-tty* */ ++ ep-name = "rpmsg-tty"; + }; + + uart_rpmsg1: ep1 { + status = "okay"; + compatible = "zephyr,rpmsg-uart"; -+ ep-name = "uart"; ++ ep-name = "rpmsg-tty1"; + }; + + soc { -+ + ipc_shm0: memory@70000000 { + compatible = "mmio-sram"; -+ reg = <0 0x70000000 0 0x30000>; ++ reg = <0 0x70000000 0 0x100000>; + }; + + sram1: memory@7a000000 { @@ -286,16 +267,17 @@ index 0000000000..11bcee24dc + + }; +}; -diff --git a/boards/arm64/rpi4_cortex_a72/rpi4_cortex_a72_defconfig b/boards/arm64/rpi4_cortex_a72/rpi4_cortex_a72_defconfig ++ ++&uart0 { ++ status = "okay"; ++ current-speed = <115200>; ++}; +diff --git a/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_remote_defconfig b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_remote_defconfig new file mode 100644 -index 0000000000..a1517f6a02 +index 00000000000..91cd83af6e1 --- /dev/null -+++ b/boards/arm64/rpi4_cortex_a72/rpi4_cortex_a72_defconfig -@@ -0,0 +1,39 @@ -+CONFIG_SOC_RPI4_CORTEX_A72=y -+CONFIG_BOARD_RPI4_CORTEX_A72=y -+CONFIG_ARM64_VA_BITS_48=y -+CONFIG_ARM64_PA_BITS_44=y ++++ b/boards/qemu/cortex_a53/qemu_cortex_a53_qemu_cortex_a53_remote_defconfig +@@ -0,0 +1,37 @@ +CONFIG_ARM_ARCH_TIMER=y +CONFIG_QEMU_ICOUNT=n + @@ -304,14 +286,14 @@ index 0000000000..a1517f6a02 + +# Enable UART driver +CONFIG_SERIAL=y -+CONFIG_PRINTK=y + +# Enable console +CONFIG_CONSOLE=y -+CONFIG_UART_CONSOLE=y -+ -+# no boot banner ++# no early console, because uart_rpmsg is used +CONFIG_BOOT_BANNER=n ++CONFIG_EARLY_CONSOLE=n ++CONFIG_UART_CONSOLE=y ++CONFIG_PRINTK=n + +# to use remote, must be in Non-Secure world +CONFIG_ARMV8_A_NS=y @@ -326,68 +308,20 @@ index 0000000000..a1517f6a02 +CONFIG_IPM=y +CONFIG_RPMSG_SERVICE_MODE_REMOTE=y +CONFIG_OPENAMP_MASTER=n ++CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF=8 ++CONFIG_OPENAMP_RSC_TABLE=y +CONFIG_HEAP_MEM_POOL_SIZE=4096 +# shell must be initialized after uart_rpmsg +CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=60 +# the tx ring buffer size is the same of bufffer of rpmsg_virtio buffer +CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=512 -diff --git a/boards/arm64/rpi4_cortex_a72/support/rpi4_cortex_a72.cfg b/boards/arm64/rpi4_cortex_a72/support/rpi4_cortex_a72.cfg -new file mode 100644 -index 0000000000..aca8d9643e ---- /dev/null -+++ b/boards/arm64/rpi4_cortex_a72/support/rpi4_cortex_a72.cfg -@@ -0,0 +1,44 @@ -+source [find interface/jlink.cfg] -+ -+set _CHIPNAME bcm2711 -+set _DAP_TAPID 0x4ba00477 -+ -+adapter_khz 1000 -+ -+transport select jtag -+reset_config trst_and_srst -+ -+telnet_port 4444 -+ -+# create tap -+jtag newtap auto0 tap -irlen 4 -expected-id $_DAP_TAPID -+ -+# create dap -+dap create auto0.dap -chain-position auto0.tap -+ -+set CTIBASE {0x80420000 0x80520000 0x80620000 0x80720000} -+set DBGBASE {0x80410000 0x80510000 0x80610000 0x80710000} -+ -+set _cores 4 -+ -+set _TARGETNAME $_CHIPNAME.a72 -+set _CTINAME $_CHIPNAME.cti -+set _smp_command "" -+ -+for {set _core 0} {$_core < $_cores} { incr _core} { -+ cti create $_CTINAME.$_core -dap auto0.dap -ap-num 0 -ctibase [lindex $CTIBASE $_core] -+ -+ set _command "target create ${_TARGETNAME}.$_core aarch64 \ -+ -dap auto0.dap -dbgbase [lindex $DBGBASE $_core] \ -+ -coreid $_core -cti $_CTINAME.$_core" -+ if {$_core != 0} { -+ set _smp_command "$_smp_command $_TARGETNAME.$_core" -+ } else { -+ set _smp_command "target smp $_TARGETNAME.$_core" -+ } -+ -+ eval $_command -+} -+ -+# eval $_smp_command -+targets $_TARGETNAME.0 diff --git a/drivers/interrupt_controller/intc_gic.c b/drivers/interrupt_controller/intc_gic.c -index 129b395c55..81b7643401 100644 +index 862d389f816..72160937a8e 100644 --- a/drivers/interrupt_controller/intc_gic.c +++ b/drivers/interrupt_controller/intc_gic.c -@@ -230,7 +230,10 @@ int arm_gic_init(const struct device *unused) - ARG_UNUSED(unused); - +@@ -275,7 +275,10 @@ static void gic_cpu_init(void) + int arm_gic_init(const struct device *dev) + { /* Init of Distributor interface registers */ - gic_dist_init(); + /* openamp client does not init the global part of GIC */ @@ -398,14 +332,15 @@ index 129b395c55..81b7643401 100644 /* Init CPU interface registers */ gic_cpu_init(); diff --git a/drivers/interrupt_controller/intc_gicv3.c b/drivers/interrupt_controller/intc_gicv3.c -index e19d409abb..363a7fa9ee 100644 +index e3c25c4d8b8..64cf4e952f2 100644 --- a/drivers/interrupt_controller/intc_gicv3.c +++ b/drivers/interrupt_controller/intc_gicv3.c -@@ -553,7 +553,10 @@ int arm_gic_init(const struct device *unused) - { - ARG_UNUSED(unused); +@@ -600,7 +600,11 @@ static void __arm_gic_init(void) + int arm_gic_init(const struct device *dev) + { - gicv3_dist_init(); ++ +/* openamp client does not init the global part of GIC */ + if (!IS_ENABLED(CONFIG_OPENAMP_SLAVE)) { + gicv3_dist_init(); @@ -414,23 +349,23 @@ index e19d409abb..363a7fa9ee 100644 __arm_gic_init(); diff --git a/drivers/ipm/CMakeLists.txt b/drivers/ipm/CMakeLists.txt -index cee766242d..9bf300c88f 100644 +index cc79cce4f83..e15aeed5013 100644 --- a/drivers/ipm/CMakeLists.txt +++ b/drivers/ipm/CMakeLists.txt -@@ -12,4 +12,6 @@ zephyr_library_sources_ifdef(CONFIG_IPM_CAVS_IDC ipm_cavs_idc.c) - zephyr_library_sources_ifdef(CONFIG_IPM_STM32_HSEM ipm_stm32_hsem.c) - zephyr_library_sources_ifdef(CONFIG_IPM_CAVS_HOST ipm_cavs_host.c) +@@ -15,5 +15,6 @@ zephyr_library_sources_ifdef(CONFIG_IPM_SEDI ipm_sedi.c) + zephyr_library_sources_ifdef(CONFIG_IPM_IVSHMEM ipm_ivshmem.c) zephyr_library_sources_ifdef(CONFIG_ESP32_SOFT_IPM ipm_esp32.c) + zephyr_library_sources_ifdef(CONFIG_XLNX_IPI ipm_xlnx_ipi.c) +zephyr_library_sources_ifdef(CONFIG_IPM_GIC_SGI ipm_gic_sgi.c) -+ + zephyr_library_sources_ifdef(CONFIG_USERSPACE ipm_handlers.c) diff --git a/drivers/ipm/Kconfig b/drivers/ipm/Kconfig -index 13e99323b1..13831f31c8 100644 +index 81c64202427..dd881e461f8 100644 --- a/drivers/ipm/Kconfig +++ b/drivers/ipm/Kconfig -@@ -39,6 +39,24 @@ source "drivers/ipm/Kconfig.imx" - source "drivers/ipm/Kconfig.stm32" - source "drivers/ipm/Kconfig.intel_adsp" +@@ -63,6 +63,24 @@ source "drivers/ipm/Kconfig.ivshmem" + source "drivers/ipm/Kconfig.sedi" + +config IPM_GIC_SGI + bool "ARM GIC SGI driver" @@ -455,10 +390,10 @@ index 13e99323b1..13831f31c8 100644 source "subsys/logging/Kconfig.template.log_config" diff --git a/drivers/ipm/ipm_gic_sgi.c b/drivers/ipm/ipm_gic_sgi.c new file mode 100644 -index 0000000000..67dc4fa2f6 +index 00000000000..bb7b5d6662d --- /dev/null +++ b/drivers/ipm/ipm_gic_sgi.c -@@ -0,0 +1,143 @@ +@@ -0,0 +1,149 @@ +/* + * Copyright (c) 2022 openEuler + * @@ -473,6 +408,9 @@ index 0000000000..67dc4fa2f6 +#include +#include + ++#include ++LOG_MODULE_REGISTER(ipm_gic_sgi, CONFIG_IPM_LOG_LEVEL); ++ + +/* Device config structure */ +struct ipm_gic_sgi_device_config { @@ -494,6 +432,8 @@ index 0000000000..67dc4fa2f6 + const uint64_t mpidr = GET_MPIDR(); + const struct ipm_gic_sgi_device_config *config = d->config; + ++ LOG_DBG("gic_sig_send:id:%x, data:%p, size:%d", id, data, size); ++ + if (!IS_ENABLED(CONFIG_OPENAMP_SLAVE)) { + /* + * Send SGI to all cores except itself, this is for test as host does not know @@ -503,7 +443,7 @@ index 0000000000..67dc4fa2f6 + gic_raise_sgi(config->intno, mpidr, SGIR_TGT_MASK & ~(1 << MPIDR_TO_CORE(mpidr))); + } else { + /* Send SGI only to core 0 (master core) for client side to -+ * avoid uncessary ipi interrupts ++ * avoid unnecessary ipi interrupts + */ + gic_raise_sgi(config->intno, mpidr, 0x1); + } @@ -601,33 +541,36 @@ index 0000000000..67dc4fa2f6 + DEVICE_DT_INST_GET(0), + 0); + irq_enable(CONFIG_IPM_GIC_SGI_INTNO); ++ LOG_INF("gic sgi int config"); +} diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt -index 8fac82f7a8..874902e89f 100644 +index 9ac2f22920d..b7444d8a716 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt -@@ -50,6 +50,7 @@ zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC uart_hvc_xen.c) - zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC_CONSOLEIO uart_hvc_xen_consoleio.c) - zephyr_library_sources_ifdef(CONFIG_UART_PIPE uart_pipe.c) - zephyr_library_sources_ifdef(CONFIG_UART_SMARTBOND uart_smartbond.c) +@@ -68,6 +68,7 @@ zephyr_library_sources_ifdef(CONFIG_UART_HOSTLINK uart_hostlink.c) + zephyr_library_sources_ifdef(CONFIG_UART_EMUL uart_emul.c) + zephyr_library_sources_ifdef(CONFIG_UART_NUMAKER uart_numaker.c) + zephyr_library_sources_ifdef(CONFIG_UART_EFINIX_SAPPIHIRE uart_efinix_sapphire.c) +zephyr_library_sources_ifdef(CONFIG_UART_RPMSG uart_rpmsg.c) - - zephyr_library_sources_ifdef(CONFIG_USERSPACE uart_handlers.c) - + zephyr_library_sources_ifdef(CONFIG_UART_SEDI uart_sedi.c) + zephyr_library_sources_ifdef(CONFIG_UART_MAX32 uart_max32.c) + zephyr_library_sources_ifdef(CONFIG_UART_BCM2711_MU uart_bcm2711.c) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig -index 5cb2d10f0c..9ef5c1349b 100644 +index faa150237c5..38bd3026cfc 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig -@@ -201,5 +201,6 @@ source "drivers/serial/Kconfig.neorv32" - source "drivers/serial/Kconfig.xen" +@@ -244,6 +244,8 @@ rsource "Kconfig.xen" + + rsource "Kconfig.ifx_cat1" - source "drivers/serial/Kconfig.smartbond" -+source "drivers/serial/Kconfig.rpmsg_uart" ++rsource "Kconfig.rpmsg_uart" ++ + rsource "Kconfig.smartbond" - endif # SERIAL + rsource "Kconfig.nxp_s32" diff --git a/drivers/serial/Kconfig.rpmsg_uart b/drivers/serial/Kconfig.rpmsg_uart new file mode 100644 -index 0000000000..a1e4535146 +index 00000000000..a1e45351462 --- /dev/null +++ b/drivers/serial/Kconfig.rpmsg_uart @@ -0,0 +1,30 @@ @@ -663,7 +606,7 @@ index 0000000000..a1e4535146 +endif # UART_RPMSG diff --git a/drivers/serial/uart_rpmsg.c b/drivers/serial/uart_rpmsg.c new file mode 100644 -index 0000000000..6e2f278f3d +index 00000000000..e38c101ae20 --- /dev/null +++ b/drivers/serial/uart_rpmsg.c @@ -0,0 +1,310 @@ @@ -743,7 +686,7 @@ index 0000000000..6e2f278f3d + wrote = ring_buf_put(&uart_data->rb, data, len); + + if (wrote < len) { -+ LOG_INF("ring buf is full, data overrun\n"); ++ LOG_INF("ring buf is full, data overrun"); + /* ring buf is full, disable rx? */ + } + @@ -943,7 +886,7 @@ index 0000000000..6e2f278f3d + NULL, data); + + if (status < 0) { -+ LOG_INF("RPMSG UART initialized error\n"); ++ LOG_INF("RPMSG UART initialized error"); + return status; + } + @@ -958,7 +901,7 @@ index 0000000000..6e2f278f3d + +#endif + -+ LOG_INF("IPC UART initialized successfully\n"); ++ LOG_INF("IPC UART initialized successfully"); + + return 0; +} @@ -977,70 +920,108 @@ index 0000000000..6e2f278f3d + &uart_rpmsg_api); + +DT_INST_FOREACH_STATUS_OKAY(UART_RPMSG_INIT) -diff --git a/dts/arm64/broadcom/rpi4-a72.dtsi b/dts/arm64/broadcom/rpi4-a72.dtsi -new file mode 100644 -index 0000000000..e336f9ea74 ---- /dev/null -+++ b/dts/arm64/broadcom/rpi4-a72.dtsi -@@ -0,0 +1,55 @@ -+/* -+ * Copyright (c) 2022 openEule Embedded -+ * -+ * SPDX-License-Identifier: Apache-2.0 -+ */ -+ -+ #include -+ #include -+ #include -+ -+ / { -+ #address-cells = <2>; -+ #size-cells = <2>; -+ -+ cpus { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ cpu@0 { -+ device_type = "cpu"; -+ compatible = "arm,cortex-a72"; -+ reg = <0>; -+ }; -+ }; -+ -+ timer { -+ compatible = "arm,armv8-timer"; -+ interrupt-parent = <&gic>; -+ interrupts = , -+ , -+ , -+ ; -+ }; -+ -+ soc { -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges; -+ -+ interrupt-parent = <&gic>; -+ -+ gic: interrupt-controller@ff841000 { -+ compatible = "arm,gic"; -+ reg = <0x00 0xFF841000 0x00 0x1000>, -+ <0x00 0xFF842000 0x00 0x2000>; -+ interrupt-controller; -+ #interrupt-cells = <4>; -+ status = "okay"; -+ }; -+ }; -+ }; +diff --git a/drivers/virtualization/virt_ivshmem.c b/drivers/virtualization/virt_ivshmem.c +index bce1dd4c428..da188e0f8f6 100644 +--- a/drivers/virtualization/virt_ivshmem.c ++++ b/drivers/virtualization/virt_ivshmem.c +@@ -214,26 +214,27 @@ static bool ivshmem_configure(const struct device *dev) + /* State table R/O */ + cap_pos = vendor_cap + IVSHMEM_CFG_STATE_TAB_SZ / 4; + size_t state_table_size = pcie_conf_read(data->pcie->bdf, cap_pos); +- LOG_INF("State table size 0x%zX", state_table_size); + if (state_table_size < sizeof(uint32_t) * data->max_peers) { + LOG_ERR("Invalid state table size %zu", state_table_size); + return false; + } + k_mem_map_phys_bare((uint8_t **)&data->state_table_shmem, + shmem_phys_addr, state_table_size, +- K_MEM_CACHE_WB | K_MEM_PERM_USER); +- ++ K_MEM_CACHE_WB | K_MEM_PERM_USER | K_MEM_DIRECT_MAP); ++ LOG_INF("State table size 0x%zX at 0x%lX (mapped to 0x%lX)", ++ state_table_size, shmem_phys_addr, data->state_table_shmem); + /* R/W section (optional) */ + cap_pos = vendor_cap + IVSHMEM_CFG_RW_SECTION_SZ / 4; + data->rw_section_size = pcie_conf_read_u64(data->pcie->bdf, cap_pos); + size_t rw_section_offset = state_table_size; +- LOG_INF("RW section size 0x%zX", data->rw_section_size); + if (data->rw_section_size > 0) { + k_mem_map_phys_bare((uint8_t **)&data->rw_section_shmem, + shmem_phys_addr + rw_section_offset, + data->rw_section_size, +- K_MEM_CACHE_WB | K_MEM_PERM_RW | K_MEM_PERM_USER); ++ K_MEM_CACHE_WB | K_MEM_PERM_RW | K_MEM_PERM_USER | K_MEM_DIRECT_MAP); + } ++ LOG_INF("RW section size 0x%zX at 0x%lX (mapped to 0x%lX)", ++ data->rw_section_size, shmem_phys_addr + rw_section_offset, data->rw_section_shmem); + + /* Output sections */ + cap_pos = vendor_cap + IVSHMEM_CFG_OUTPUT_SECTION_SZ / 4; +@@ -250,8 +251,12 @@ static bool ivshmem_configure(const struct device *dev) + if (i == regs->id) { + flags |= K_MEM_PERM_RW; + } +- k_mem_map_phys_bare((uint8_t **)&data->output_section_shmem[i], +- phys_addr, data->output_section_size, flags); ++ if (data->output_section_size > 0) { ++ k_mem_map_phys_bare((uint8_t **)&data->output_section_shmem[i], ++ phys_addr, data->output_section_size, flags); ++ LOG_INF("Output section at 0x%lX (mapped to 0x%lX)", ++ phys_addr, data->output_section_shmem[i]); ++ } + } + + data->size = output_section_offset + +@@ -276,7 +281,7 @@ static bool ivshmem_configure(const struct device *dev) + + k_mem_map_phys_bare((uint8_t **)&data->shmem, + shmem_phys_addr, data->size, +- K_MEM_CACHE_WB | K_MEM_PERM_RW | K_MEM_PERM_USER); ++ K_MEM_CACHE_WB | K_MEM_PERM_RW | K_MEM_PERM_USER | K_MEM_DIRECT_MAP); + } + + if (msi_x_bar_present) { +diff --git a/dts/arm64/qemu/qemu-virt-a53.dtsi b/dts/arm64/qemu/qemu-virt-a53.dtsi +index cb96eba2874..d1f86148eed 100644 +--- a/dts/arm64/qemu/qemu-virt-a53.dtsi ++++ b/dts/arm64/qemu/qemu-virt-a53.dtsi +@@ -7,8 +7,8 @@ + /* + * Derived from DTS extracted with: + * +- * qemu-system-aarch64 -machine virt -cpu cortex-a53 -nographic +- * -machine dumpdtb=virt.dtb ++ * qemu-system-aarch64 -machine virt,gic-version=host,accel=kvm ++ * -cpu cortex-a53 -nographic -machine dumpdtb=virt.dtb + * + * dtc -I dtb -O dts virt.dtb + */ +@@ -28,13 +28,13 @@ + + cpu@0 { + device_type = "cpu"; +- compatible = "arm,cortex-a53"; ++ compatible = "arm,cortex-virt"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; +- compatible = "arm,cortex-a53"; ++ compatible = "arm,cortex-virt"; + reg = <1>; + }; + }; +@@ -151,4 +151,4 @@ + bus-range = <0x00 0xff>; + }; + }; +-}; ++}; +\ No newline at end of file diff --git a/dts/bindings/ipm/arm,gic-sgi.yaml b/dts/bindings/ipm/arm,gic-sgi.yaml new file mode 100644 -index 0000000000..282a4207d4 +index 00000000000..282a4207d47 --- /dev/null +++ b/dts/bindings/ipm/arm,gic-sgi.yaml @@ -0,0 +1,9 @@ @@ -1055,7 +1036,7 @@ index 0000000000..282a4207d4 + diff --git a/dts/bindings/serial/zephy,rpmsg-uart.yaml b/dts/bindings/serial/zephy,rpmsg-uart.yaml new file mode 100644 -index 0000000000..a961661887 +index 00000000000..a9616618872 --- /dev/null +++ b/dts/bindings/serial/zephy,rpmsg-uart.yaml @@ -0,0 +1,14 @@ @@ -1073,8 +1054,27 @@ index 0000000000..a961661887 + type: string + required: true + description: the endpoint name of uart-rpmsg device +diff --git a/include/zephyr/arch/arm64/cache.h b/include/zephyr/arch/arm64/cache.h +index cddd901ba02..d8e2cb51b5a 100644 +--- a/include/zephyr/arch/arm64/cache.h ++++ b/include/zephyr/arch/arm64/cache.h +@@ -190,7 +190,13 @@ static ALWAYS_INLINE size_t arch_icache_line_size_get(void) + + static ALWAYS_INLINE int arch_icache_flush_all(void) + { +- return -ENOTSUP; ++ /* invalidate all instruction cache */ ++ __asm__ volatile ("ic iallu" ::: "memory"); ++ ++ z_barrier_dsync_fence_full(); ++ z_barrier_isync_fence_full(); ++ ++ return 0; + } + + static ALWAYS_INLINE int arch_icache_invd_all(void) diff --git a/include/zephyr/ipc/rpmsg_service.h b/include/zephyr/ipc/rpmsg_service.h -index e599c8deac..b1047d3cab 100644 +index e599c8deac4..b1047d3cab5 100644 --- a/include/zephyr/ipc/rpmsg_service.h +++ b/include/zephyr/ipc/rpmsg_service.h @@ -32,13 +32,18 @@ extern "C" { @@ -1106,412 +1106,144 @@ index e599c8deac..b1047d3cab 100644 /** * @} */ -diff --git a/samples/subsys/ipc/openamp/CMakeLists.txt b/samples/subsys/ipc/openamp/CMakeLists.txt -index daf99d8abe..8380389027 100644 ---- a/samples/subsys/ipc/openamp/CMakeLists.txt -+++ b/samples/subsys/ipc/openamp/CMakeLists.txt -@@ -16,6 +16,9 @@ elseif("${BOARD}" STREQUAL "mps2_an521") - set(BOARD_REMOTE "mps2_an521_remote") - elseif("${BOARD}" STREQUAL "v2m_musca_b1") - set(BOARD_REMOTE "v2m_musca_b1_ns") -+elseif("${BOARD}" STREQUAL "qemu_cortex_a53") -+ set(QEMU_EXTRA_FLAGS "-m;1G;-serial;pty;-smp;2;-device;loader,file=${REMOTE_ZEPHYR_DIR}/zephyr.elf,cpu-num=1") -+ set(BOARD_REMOTE "qemu_cortex_a53") - else() - message(FATAL_ERROR "${BOARD} was not supported for this sample") - endif() -diff --git a/samples/subsys/ipc/openamp/README.rst b/samples/subsys/ipc/openamp/README.rst -index 429d47bc8d..830023cddc 100644 ---- a/samples/subsys/ipc/openamp/README.rst -+++ b/samples/subsys/ipc/openamp/README.rst -@@ -42,6 +42,14 @@ Building the application for v2m_musca_b1 - :board: v2m_musca_b1 - :goals: debug +diff --git a/lib/open-amp/resource_table.c b/lib/open-amp/resource_table.c +index a857c3ca05f..fb10f664652 100644 +--- a/lib/open-amp/resource_table.c ++++ b/lib/open-amp/resource_table.c +@@ -39,7 +39,7 @@ static struct fw_resource_table __resource resource_table = { + .num = RSC_TABLE_NUM_ENTRY, + }, + .offset = { +- ++ offsetof(struct fw_resource_table, ept_table), + #if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) + offsetof(struct fw_resource_table, vdev), + #endif +@@ -49,10 +49,15 @@ static struct fw_resource_table __resource resource_table = { + #endif + }, -+Building the application for qemu_cortex_a53 -+*********************************************** -+ -+.. zephyr-app-commands:: -+ :zephyr-app: samples/subsys/ipc/openamp -+ :board: qemu_cortex_a53 -+ :goals: run ++ .ept_table = { ++ .type = RSC_VENDOR_EPT_TABLE, ++ .num_of_epts = 0, ++ }, + - Open a serial terminal (minicom, putty, etc.) and connect the board with the - following settings: + #if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) + /* Virtio device entry */ + .vdev = { +- RSC_VDEV, VIRTIO_ID_RPMSG, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0, ++ RSC_VDEV, VIRTIO_ID_RPMSG, 2, RPMSG_IPU_C0_FEATURES, 0, 0, 0, + VRING_COUNT, {0, 0}, + }, -diff --git a/samples/subsys/ipc/openamp/boards/qemu_cortex_a53.conf b/samples/subsys/ipc/openamp/boards/qemu_cortex_a53.conf -new file mode 100644 -index 0000000000..3aa80f31f4 ---- /dev/null -+++ b/samples/subsys/ipc/openamp/boards/qemu_cortex_a53.conf -@@ -0,0 +1,2 @@ -+CONFIG_PM_CPU_OPS=y -+CONFIG_ARMV8_A_NS=y -diff --git a/samples/subsys/ipc/openamp/boards/qemu_cortex_a53.overlay b/samples/subsys/ipc/openamp/boards/qemu_cortex_a53.overlay -new file mode 100644 -index 0000000000..ff1f5c7dfb ---- /dev/null -+++ b/samples/subsys/ipc/openamp/boards/qemu_cortex_a53.overlay -@@ -0,0 +1,6 @@ -+/* -+ * Copyright (c) 2022 openEuler Embedded -+ * -+ * SPDX-License-Identifier: Apache-2.0 -+ */ -+#include "qemu_cortex_a53_overlay.dtsi" -diff --git a/samples/subsys/ipc/openamp/boards/qemu_cortex_a53_overlay.dtsi b/samples/subsys/ipc/openamp/boards/qemu_cortex_a53_overlay.dtsi -new file mode 100644 -index 0000000000..85e1b47198 ---- /dev/null -+++ b/samples/subsys/ipc/openamp/boards/qemu_cortex_a53_overlay.dtsi -@@ -0,0 +1,32 @@ -+/* -+ * Copyright (c) 2022 openEuler Embedded -+ * -+ * SPDX-License-Identifier: Apache-2.0 -+ */ -+ -+/ { -+ chosen { -+ /* -+ * shared memory reserved for the inter-processor communication -+ */ -+ zephyr,ipc_shm = &ipc_shm0; -+ zephyr,ipc = &ipm_gic_sgi0; -+ }; -+ -+ ipm_gic_sgi0: ipm{ -+ compatible = "arm,gic-sgi"; -+ }; +diff --git a/lib/open-amp/resource_table.h b/lib/open-amp/resource_table.h +index dc577fafa7e..5bfedada2b0 100644 +--- a/lib/open-amp/resource_table.h ++++ b/lib/open-amp/resource_table.h +@@ -7,6 +7,7 @@ + #ifndef RESOURCE_TABLE_H__ + #define RESOURCE_TABLE_H__ + ++#include + #include + #include + +@@ -28,9 +29,12 @@ extern "C" { + #define VRING_BUFF_ADDRESS -1 /* allocated by Master processor */ + #define VRING_ALIGNMENT 16 /* fixed to match with Linux constraint */ + ++#define RSC_VENDOR_EPT_TABLE 128 /* List of bound endpoints */ + -+ soc { -+ /* reserve 3 MB for inter-processor communication */ -+ ipc_shm0: memory@70000000 { -+ compatible = "mmio-sram"; -+ reg = <0 0x70000000 0 0x30000>; -+ }; -+ /* memory used by openamp client */ -+ sram1: memory@7a000000 { -+ compatible = "mmio-sram"; -+ reg = <0x0 0x7a000000 0x0 DT_SIZE_M(10)>; -+ }; -+ }; -+}; -diff --git a/samples/subsys/ipc/openamp/remote/CMakeLists.txt b/samples/subsys/ipc/openamp/remote/CMakeLists.txt -index b5cc53b48f..ee29ffa2cb 100644 ---- a/samples/subsys/ipc/openamp/remote/CMakeLists.txt -+++ b/samples/subsys/ipc/openamp/remote/CMakeLists.txt -@@ -8,12 +8,18 @@ cmake_minimum_required(VERSION 3.20.0) - if(("${BOARD}" STREQUAL "lpcxpresso54114_m0") - OR "${BOARD}" STREQUAL "lpcxpresso55s69_cpu1" - OR "${BOARD}" STREQUAL "mps2_an521_remote" -- OR "${BOARD}" STREQUAL "v2m_musca_b1_ns") -+ OR "${BOARD}" STREQUAL "v2m_musca_b1_ns" -+ OR "${BOARD}" STREQUAL "qemu_cortex_a53") - message(STATUS "${BOARD} compiles as remote in this sample") - else() - message(FATAL_ERROR "${BOARD} was not supported for this sample") - endif() + #endif + + enum rsc_table_entries { ++ RSC_TABLE_EPT_TABLE_ENTRY, + #if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) + RSC_TABLE_VDEV_ENTRY, + #endif +@@ -40,10 +44,27 @@ enum rsc_table_entries { + RSC_TABLE_NUM_ENTRY + }; -+if("${BOARD}" STREQUAL "qemu_cortex_a53") -+ set(CONF_FILE "prj_qemu_cortex_a53.conf") -+ set(DTC_OVERLAY_FILE CACHE STRING "boards/qemu_cortex_a53.overlay" FORCE) ++METAL_PACKED_BEGIN ++struct ept_info { ++ char name[RPMSG_NAME_SIZE]; ++ uint32_t addr; ++ uint32_t dest_addr; ++} METAL_PACKED_END; ++ ++#define MAX_NUM_OF_EPTS 64 ++ ++METAL_PACKED_BEGIN ++struct fw_rsc_ept { ++ uint32_t type; ++ uint32_t num_of_epts; ++ struct ept_info endpoints[MAX_NUM_OF_EPTS]; ++} METAL_PACKED_END; ++ + struct fw_resource_table { + struct resource_table hdr; + uint32_t offset[RSC_TABLE_NUM_ENTRY]; + ++ struct fw_rsc_ept ept_table; + #if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) + struct fw_rsc_vdev vdev; + struct fw_rsc_vdev_vring vring0; +diff --git a/soc/arm/qemu_cortex_a53/CMakeLists.txt b/soc/arm/qemu_cortex_a53/CMakeLists.txt +index 35d88056740..18a38dd2016 100644 +--- a/soc/arm/qemu_cortex_a53/CMakeLists.txt ++++ b/soc/arm/qemu_cortex_a53/CMakeLists.txt +@@ -3,6 +3,7 @@ + + zephyr_library_sources_ifdef(CONFIG_ARM_MMU mmu_regions.c) + +-zephyr_include_directories(.) +- + set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm64/scripts/linker.ld CACHE INTERNAL "") ++if(CONFIG_OPENAMP_RSC_TABLE) ++zephyr_linker_sources(DATA_SECTIONS rsc_table_linker.ld) +endif() -+ - find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) - project(openamp_remote) +diff --git a/soc/arm/qemu_cortex_a53/mmu_regions.c b/soc/arm/qemu_cortex_a53/mmu_regions.c +index b5d1205775f..afd584c56a1 100644 +--- a/soc/arm/qemu_cortex_a53/mmu_regions.c ++++ b/soc/arm/qemu_cortex_a53/mmu_regions.c +@@ -19,6 +19,12 @@ static const struct arm_mmu_region mmu_regions[] = { + DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1), + DT_REG_SIZE_BY_IDX(DT_INST(0, arm_gic), 1), + MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), ++#if defined(CONFIG_OPENAMP) && !defined(CONFIG_IVSHMEM) ++ MMU_REGION_FLAT_ENTRY("IPC_SHM", ++ DT_REG_ADDR(DT_NODELABEL(ipc_shm0)), ++ DT_REG_SIZE(DT_NODELABEL(ipc_shm0)), ++ MT_NORMAL | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), ++#endif + }; -diff --git a/samples/subsys/ipc/openamp/remote/boards/qemu_cortex_a53.overlay b/samples/subsys/ipc/openamp/remote/boards/qemu_cortex_a53.overlay + const struct arm_mmu_config mmu_config = { +diff --git a/soc/arm/qemu_cortex_a53/rsc_table_linker.ld b/soc/arm/qemu_cortex_a53/rsc_table_linker.ld new file mode 100644 -index 0000000000..47e6d47f58 +index 00000000000..665093337f9 --- /dev/null -+++ b/samples/subsys/ipc/openamp/remote/boards/qemu_cortex_a53.overlay -@@ -0,0 +1,18 @@ ++++ b/soc/arm/qemu_cortex_a53/rsc_table_linker.ld +@@ -0,0 +1,13 @@ +/* -+ * Copyright (c) 2022 openEuler Embedded ++ * Copyright (c) 2023, openEuler Embedded + * + * SPDX-License-Identifier: Apache-2.0 + */ + -+#include "../../boards/qemu_cortex_a53_overlay.dtsi" -+ -+/ { -+ chosen { -+ zephyr,sram = &sram1; -+ }; -+ -+}; -+ -+&uart0 { -+ status = "disabled"; -+}; -diff --git a/samples/subsys/ipc/openamp/remote/prj_qemu_cortex_a53.conf b/samples/subsys/ipc/openamp/remote/prj_qemu_cortex_a53.conf -new file mode 100644 -index 0000000000..895e31280b ---- /dev/null -+++ b/samples/subsys/ipc/openamp/remote/prj_qemu_cortex_a53.conf -@@ -0,0 +1,18 @@ -+CONFIG_BOOT_BANNER=n -+CONFIG_STDOUT_CONSOLE=n -+CONFIG_PRINTK=n -+CONFIG_IPM=y -+CONFIG_HEAP_MEM_POOL_SIZE=4096 -+CONFIG_OPENAMP=y -+CONFIG_OPENAMP_MASTER=n -+CONFIG_ARMV8_A_NS=y -+# Disable UART driver -+CONFIG_SERIAL=n -+ -+# Disable console -+CONFIG_CONSOLE=n -+CONFIG_UART_CONSOLE=n -+ -+# Disable serial port -+CONFIG_UART_PL011=n -+CONFIG_UART_INTERRUPT_DRIVEN=n -diff --git a/samples/subsys/ipc/openamp/remote/src/main.c b/samples/subsys/ipc/openamp/remote/src/main.c -index 06124069f4..06ed2bd894 100644 ---- a/samples/subsys/ipc/openamp/remote/src/main.c -+++ b/samples/subsys/ipc/openamp/remote/src/main.c -@@ -19,6 +19,13 @@ - - #include "common.h" - -+/* -+ * 32 bit: -1 == 0xffffffff -+ * 64 bit: -1 == 0xffffffffffffffff -+ */ -+#define DEFAULT_PAGE_SHIFT (-1UL) -+#define DEFAULT_PAGE_MASK (-1UL) -+ - #define APP_TASK_STACK_SIZE (1024) - K_THREAD_STACK_DEFINE(thread_stack, APP_TASK_STACK_SIZE); - static struct k_thread thread_data; -@@ -36,8 +43,8 @@ static struct metal_device shm_device = { - .virt = (void *) SHM_START_ADDR, - .physmap = shm_physmap, - .size = SHM_SIZE, -- .page_shift = 0xffffffff, -- .page_mask = 0xffffffff, -+ .page_shift = DEFAULT_PAGE_SHIFT, -+ .page_mask = DEFAULT_PAGE_MASK, - .mem_flags = 0, - .ops = { NULL }, - }, -diff --git a/samples/subsys/ipc/openamp/sample.yaml b/samples/subsys/ipc/openamp/sample.yaml -index df871bca0d..0921aa2b7f 100644 ---- a/samples/subsys/ipc/openamp/sample.yaml -+++ b/samples/subsys/ipc/openamp/sample.yaml -@@ -4,7 +4,7 @@ sample: - name: OpenAMP example integration - tests: - sample.ipc.openamp: -- platform_allow: lpcxpresso54114_m4 lpcxpresso55s69_cpu0 mps2_an521 v2m_musca_b1 -+ platform_allow: lpcxpresso54114_m4 lpcxpresso55s69_cpu0 mps2_an521 v2m_musca_b1 qemu_cortex_a53 - tags: ipm - harness: console - harness_config: -diff --git a/samples/subsys/ipc/openamp/src/main.c b/samples/subsys/ipc/openamp/src/main.c -index bdbfc17bb4..181d2b151f 100644 ---- a/samples/subsys/ipc/openamp/src/main.c -+++ b/samples/subsys/ipc/openamp/src/main.c -@@ -20,6 +20,17 @@ - - #include "common.h" - -+#if defined(CONFIG_SOC_QEMU_CORTEX_A53) -+#include -+#endif -+ -+/* -+ * 32 bit: -1 == 0xffffffff -+ * 64 bit: -1 == 0xffffffffffffffff -+ */ -+#define DEFAULT_PAGE_SHIFT (-1UL) -+#define DEFAULT_PAGE_MASK (-1UL) -+ - #define APP_TASK_STACK_SIZE (1024) - K_THREAD_STACK_DEFINE(thread_stack, APP_TASK_STACK_SIZE); - static struct k_thread thread_data; -@@ -37,8 +48,8 @@ static struct metal_device shm_device = { - .virt = (void *) SHM_START_ADDR, - .physmap = shm_physmap, - .size = SHM_SIZE, -- .page_shift = 0xffffffff, -- .page_mask = 0xffffffff, -+ .page_shift = DEFAULT_PAGE_SHIFT, -+ .page_mask = DEFAULT_PAGE_MASK, - .mem_flags = 0, - .ops = { NULL }, - }, -@@ -292,6 +303,12 @@ void main(void) - defined(CONFIG_SOC_V2M_MUSCA_B1) - wakeup_cpu1(); - k_msleep(500); -+#elif defined(CONFIG_SOC_QEMU_CORTEX_A53) -+ /* start the secondary cpu by psci in qemu*/ -+ if (pm_cpu_on(1, DT_REG_ADDR(DT_NODELABEL(sram1)))) { -+ printk("Failed to boot secondary CPU core\n"); -+ return; -+ } - #endif /* #if defined(CONFIG_SOC_MPS2_AN521) */ - } - -diff --git a/soc/arm64/qemu_cortex_a53/CMakeLists.txt b/soc/arm64/qemu_cortex_a53/CMakeLists.txt -index fd39809a83..52eba76c8f 100644 ---- a/soc/arm64/qemu_cortex_a53/CMakeLists.txt -+++ b/soc/arm64/qemu_cortex_a53/CMakeLists.txt -@@ -2,3 +2,8 @@ - # SPDX-License-Identifier: Apache-2.0 - - zephyr_library_sources_ifdef(CONFIG_ARM_MMU mmu_regions.c) -+ -+if(CONFIG_OPENAMP_RSC_TABLE) -+ zephyr_linker_section(NAME .resource_table GROUP ROM_REGION NOINPUT) -+ zephyr_linker_section_configure(SECTION .resource_table KEEP INPUT ".resource_table*") -+endif() -diff --git a/soc/arm64/qemu_cortex_a53/linker.ld b/soc/arm64/qemu_cortex_a53/linker.ld -index 9b7be757e1..9ea9975f75 100644 ---- a/soc/arm64/qemu_cortex_a53/linker.ld -+++ b/soc/arm64/qemu_cortex_a53/linker.ld -@@ -6,3 +6,14 @@ - */ - - #include -+ -+ -+SECTIONS -+ { -+#ifdef CONFIG_OPENAMP_RSC_TABLE -+ SECTION_PROLOGUE(.resource_table,, SUBALIGN(4)) ++ SECTION_PROLOGUE(.resource_table,, SUBALIGN(4)) + { -+ KEEP(*(.resource_table*)) ++ _resource_table_start = .; ++ KEEP(*(.resource_table*)) ++ _resource_table_end = .; + } GROUP_LINK_IN(ROMABLE_REGION) -+#endif -+ } -diff --git a/soc/arm64/qemu_cortex_a53/mmu_regions.c b/soc/arm64/qemu_cortex_a53/mmu_regions.c -index b5d1205775..3d162c3e73 100644 ---- a/soc/arm64/qemu_cortex_a53/mmu_regions.c -+++ b/soc/arm64/qemu_cortex_a53/mmu_regions.c -@@ -19,6 +19,13 @@ static const struct arm_mmu_region mmu_regions[] = { - DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1), - DT_REG_SIZE_BY_IDX(DT_INST(0, arm_gic), 1), - MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), -+ -+#if defined(CONFIG_OPENAMP) -+ MMU_REGION_FLAT_ENTRY("IPC_SHM", -+ DT_REG_ADDR(DT_NODELABEL(ipc_shm0)), -+ DT_REG_SIZE(DT_NODELABEL(ipc_shm0)), -+ MT_NORMAL | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), -+#endif - }; - - const struct arm_mmu_config mmu_config = { -diff --git a/soc/arm64/rpi4_cortex_a72/CMakeLists.txt b/soc/arm64/rpi4_cortex_a72/CMakeLists.txt -new file mode 100644 -index 0000000000..42356c2508 ---- /dev/null -+++ b/soc/arm64/rpi4_cortex_a72/CMakeLists.txt -@@ -0,0 +1,4 @@ -+# Copyright (c) 2022 openEuler Embedded -+# SPDX-License-Identifier: Apache-2.0 -+ -+zephyr_library_sources_ifdef(CONFIG_ARM_MMU mmu_regions.c) -diff --git a/soc/arm64/rpi4_cortex_a72/Kconfig.defconfig b/soc/arm64/rpi4_cortex_a72/Kconfig.defconfig -new file mode 100644 -index 0000000000..e27f454829 ---- /dev/null -+++ b/soc/arm64/rpi4_cortex_a72/Kconfig.defconfig -@@ -0,0 +1,17 @@ -+# Copyright (c) 2022 openEuler Embedded -+# SPDX-License-Identifier: Apache-2.0 -+ -+if SOC_RPI4_CORTEX_A72 -+ -+config SOC -+ default "rpi4_cortex_a72" -+ -+config NUM_IRQS -+ # must be >= the highest interrupt number used -+ # - include the UART interrupts -+ default 100 -+ -+config SYS_CLOCK_HW_CYCLES_PER_SEC -+ default 54000000 -+ -+endif # SOC_RPI4_CORTEX_A72 -diff --git a/soc/arm64/rpi4_cortex_a72/Kconfig.soc b/soc/arm64/rpi4_cortex_a72/Kconfig.soc -new file mode 100644 -index 0000000000..6ce979d3b8 ---- /dev/null -+++ b/soc/arm64/rpi4_cortex_a72/Kconfig.soc -@@ -0,0 +1,8 @@ -+# Copyright (c) 2022 openEuler Embedded -+# SPDX-License-Identifier: Apache-2.0 -+ -+config SOC_RPI4_CORTEX_A72 -+ bool "Raspberry Pi 4 (cortex-a72)" -+ select ARM64 -+ select CPU_CORTEX_A72 -+ select GIC_V2 -diff --git a/soc/arm64/rpi4_cortex_a72/linker.ld b/soc/arm64/rpi4_cortex_a72/linker.ld -new file mode 100644 -index 0000000000..499492ed89 ---- /dev/null -+++ b/soc/arm64/rpi4_cortex_a72/linker.ld -@@ -0,0 +1,8 @@ -+/* -+ * Copyright (c) 2022 openEuler Embedded -+ * -+ * SPDX-License-Identifier: Apache-2.0 -+ * -+ */ -+ -+#include -diff --git a/soc/arm64/rpi4_cortex_a72/mmu_regions.c b/soc/arm64/rpi4_cortex_a72/mmu_regions.c -new file mode 100644 -index 0000000000..25ec334558 ---- /dev/null -+++ b/soc/arm64/rpi4_cortex_a72/mmu_regions.c -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (c) 2022 openEuler Embedded -+ * -+ * SPDX-License-Identifier: Apache-2.0 -+ */ -+#include -+#include -+#include -+ -+static const struct arm_mmu_region mmu_regions[] = { -+ -+ MMU_REGION_FLAT_ENTRY("GIC", -+ DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 0), -+ DT_REG_SIZE_BY_IDX(DT_INST(0, arm_gic), 0), -+ MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), -+ -+ MMU_REGION_FLAT_ENTRY("GIC", -+ DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1), -+ DT_REG_SIZE_BY_IDX(DT_INST(0, arm_gic), 1), -+ MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), -+ -+#if defined(CONFIG_OPENAMP) -+ MMU_REGION_FLAT_ENTRY("IPC_SHM", -+ DT_REG_ADDR(DT_NODELABEL(ipc_shm0)), -+ DT_REG_SIZE(DT_NODELABEL(ipc_shm0)), -+ MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_DEFAULT_SECURE_STATE), -+#endif -+}; -+ -+const struct arm_mmu_config mmu_config = { -+ .num_regions = ARRAY_SIZE(mmu_regions), -+ .mmu_regions = mmu_regions, -+}; ++ _resource_tables_size = _resource_table_end - _resource_table_start; diff --git a/subsys/ipc/rpmsg_service/CMakeLists.txt b/subsys/ipc/rpmsg_service/CMakeLists.txt -index 357a2bc6c3..cbfdd5f5e1 100644 +index 357a2bc6c3f..b63b11be8f0 100644 --- a/subsys/ipc/rpmsg_service/CMakeLists.txt +++ b/subsys/ipc/rpmsg_service/CMakeLists.txt -@@ -1,4 +1,14 @@ +@@ -1,4 +1,19 @@ # SPDX-License-Identifier: Apache-2.0 +if(CONFIG_OPENAMP_RSC_TABLE) @@ -1520,17 +1252,30 @@ index 357a2bc6c3..cbfdd5f5e1 100644 +# and rpmsg buffers. The METAL_MAX_DEVICE_REGIONS has to be redefined to add a +# second region for the resource table. +zephyr_compile_definitions(METAL_MAX_DEVICE_REGIONS=2) ++if(CONFIG_IVSHMEM_DOORBELL) ++# if IVSHMEM is enabled, use IVSHMEM specific implementation ++zephyr_sources(rpmsg_backend_rsc_table_ivshmem.c) ++else() +zephyr_sources(rpmsg_backend_rsc_table.c) ++endif() +else() zephyr_sources(rpmsg_backend.c) +endif() zephyr_sources(rpmsg_service.c) +zephyr_sources(rpmsg_rpc_service.c) diff --git a/subsys/ipc/rpmsg_service/Kconfig b/subsys/ipc/rpmsg_service/Kconfig -index 17d75b3745..ecfc8ea0a0 100644 +index 17d75b37452..7ea7d964d64 100644 --- a/subsys/ipc/rpmsg_service/Kconfig +++ b/subsys/ipc/rpmsg_service/Kconfig -@@ -46,7 +46,7 @@ endchoice +@@ -23,7 +23,6 @@ config RPMSG_SERVICE_DUAL_IPM_SUPPORT + + menuconfig RPMSG_SERVICE + bool "RPMsg service for multiple users" +- select IPM + select OPENAMP + help + Enables support for a service that can be shared by multiple +@@ -46,7 +45,7 @@ endchoice config RPMSG_SERVICE_NUM_ENDPOINTS int "Max number of registered endpoints" @@ -1540,10 +1285,10 @@ index 17d75b3745..ecfc8ea0a0 100644 Maximal number of endpoints that can be registered for given RPMsg service. diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.c b/subsys/ipc/rpmsg_service/rpmsg_backend.c -index 431fd093be..c3d6efd82a 100644 +index b3f428e011c..fe1212de906 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.c +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.c -@@ -59,6 +59,13 @@ static const struct device *const ipm_handle = +@@ -60,6 +60,13 @@ static const struct device *const ipm_handle = DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc)); #endif @@ -1557,7 +1302,7 @@ index 431fd093be..c3d6efd82a 100644 static metal_phys_addr_t shm_physmap[] = { SHM_START_ADDR }; static struct metal_device shm_device = { .name = SHM_DEVICE_NAME, -@@ -69,8 +76,8 @@ static struct metal_device shm_device = { +@@ -70,8 +77,8 @@ static struct metal_device shm_device = { .virt = (void *) SHM_START_ADDR, .physmap = shm_physmap, .size = SHM_SIZE, @@ -1569,7 +1314,7 @@ index 431fd093be..c3d6efd82a 100644 .ops = { NULL }, }, diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.h b/subsys/ipc/rpmsg_service/rpmsg_backend.h -index a74e46b852..1851178902 100644 +index a74e46b8520..a9f874a0392 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.h +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.h @@ -13,15 +13,22 @@ @@ -1596,7 +1341,7 @@ index a74e46b852..1851178902 100644 /* * @brief Initialize RPMsg backend -@@ -35,7 +42,11 @@ extern "C" { +@@ -35,7 +42,13 @@ extern "C" { * @retval 0 Initialization successful * @retval <0 Initialization error reported by OpenAMP */ @@ -1605,15 +1350,17 @@ index a74e46b852..1851178902 100644 +#else int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev); +#endif ++ ++extern struct rpmsg_virtio_device rvdev; #ifdef __cplusplus } diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend_rsc_table.c b/subsys/ipc/rpmsg_service/rpmsg_backend_rsc_table.c new file mode 100644 -index 0000000000..26f97a5c57 +index 00000000000..e2d817e3185 --- /dev/null +++ b/subsys/ipc/rpmsg_service/rpmsg_backend_rsc_table.c -@@ -0,0 +1,236 @@ +@@ -0,0 +1,318 @@ +/* + * Copyright (c) 2023, openEuler Embedded + * @@ -1625,10 +1372,13 @@ index 0000000000..26f97a5c57 +#include +#include +#include ++#include ++#include +#include + +#include +#include ++#include +#include + +#define LOG_MODULE_NAME rpmsg_backend @@ -1646,6 +1396,14 @@ index 0000000000..26f97a5c57 +#endif + + ++/* use resource tables's reserved[0] to carry some extra information ++ * the following IDs come from PSCI definition ++ */ ++#define CPU_OFF_FUNCID 0x84000002 ++#define CPU_SUSPEND_FUNCID 0xc4000001 ++#define CPU_ON_FUNCID 0xC4000003 ++#define SYSTEM_RESET 0x84000009 ++ +#define IPM_WORK_QUEUE_STACK_SIZE CONFIG_RPMSG_SERVICE_WORK_QUEUE_STACK_SIZE +#define IPM_WORK_QUEUE_PRIORITY K_HIGHEST_APPLICATION_THREAD_PRIO + @@ -1678,7 +1436,8 @@ index 0000000000..26f97a5c57 +}; + +static struct virtio_device *cur_vdev; -+static struct k_work ipm_work; ++static struct k_work ipm_work_vring_rx; ++static struct k_work ipm_work_cpu_off; + +static int virtio_notify(void *priv, uint32_t id) +{ @@ -1695,27 +1454,101 @@ index 0000000000..26f97a5c57 + return status; +} + -+ -+static void ipm_callback_process(struct k_work *work) ++static void ipm_work_handle_vring_rx(struct k_work *work) +{ + /* as remote device, VRING1_ID is for RX (from host to devive)*/ + rproc_virtio_notified(cur_vdev, VRING1_ID); +} + ++static void ipm_work_handle_cpu_off(struct k_work *work) ++{ ++ LOG_DBG("zephyr: cpu off"); ++ /* before cpu_off, some clean ops need to be done: ++ * - turn off tasks, device, etc. ++ * - clear cache, memory etc. ++ */ ++ cache_data_invd_all(); ++ cache_instr_invd_all(); ++ ++ /* \todo: extra work to notify other tasks that cpu is going to ++ turn off ++ */ ++ ++ /* from arm64 supporting psci, call pm_cpu_off to turn off */ ++ pm_cpu_off(); ++} ++ ++static void reset_vq(void) ++{ ++ if (rvdev.svq != NULL) { ++ /* ++ * For svq: ++ * vq_free_cnt: Set to vq_nentries, all descriptors in the svq are available. ++ * vq_queued_cnt: Set to 0, no descriptors waiting to be processed in the svq. ++ * vq_desc_head_idx: Set to 0, the next available descriptor is at the beginning ++ * of the descriptor table. ++ * vq_available_idx: Set to 0, No descriptors have been added to the available ring. ++ * vq_used_cons_idx: No descriptors have been added to the used ring. ++ * vq_ring.avail->idx and vq_ring.used->idx will be set at host. ++ */ ++ rvdev.svq->vq_free_cnt = rvdev.svq->vq_nentries; ++ rvdev.svq->vq_queued_cnt = 0; ++ rvdev.svq->vq_desc_head_idx = 0; ++ rvdev.svq->vq_available_idx = 0; ++ rvdev.svq->vq_used_cons_idx = 0; ++ } ++ ++ if (rvdev.rvq != NULL) { ++ /* ++ * For rvq: ++ * Because host resets its tx vq, on the remote side, ++ * it also needs to reset the rx rq. ++ */ ++ rvdev.rvq->vq_available_idx = 0; ++ rvdev.rvq->vq_used_cons_idx = 0; ++ rvdev.rvq->vq_ring.used->idx = 0; ++ rvdev.rvq->vq_ring.avail->idx = 0; ++ metal_cache_flush(&(rvdev.rvq->vq_ring.used->idx), ++ sizeof(rvdev.rvq->vq_ring.used->idx)); ++ metal_cache_flush(&(rvdev.rvq->vq_ring.avail->idx), ++ sizeof(rvdev.rvq->vq_ring.avail->idx)); ++ } ++} ++ +static void ipm_callback(const struct device *dev, -+ void *context, uint32_t id, -+ volatile void *data) ++ void *context, uint32_t id, ++ volatile void *data) +{ ++ struct fw_resource_table *rsc; ++ uint32_t status; ++ ++ rsc = (struct fw_resource_table *)context; ++ metal_cache_invalidate(rsc->hdr.reserved, sizeof(rsc->hdr.reserved)); ++ status = rsc->hdr.reserved[0]; ++ + (void)dev; + + LOG_DBG("Got callback of id %u", id); -+ /* TODO: Separate workqueue is needed only -+ * for serialization master (app core) -+ * -+ * Use sysworkq to optimize memory footprint -+ * for serialization slave (net core) -+ */ -+ k_work_submit_to_queue(&ipm_work_q, &ipm_work); ++ ++ /* use resource table's reserved bits for extra work */ ++ if (status == 0) ++ return; ++ ++ LOG_DBG("rsc reserved[0]:%x", status); ++ ++ if (status == CPU_OFF_FUNCID) { ++ /* cpu off work */ ++ k_work_submit_to_queue(&ipm_work_q, &ipm_work_cpu_off); ++ } else if (status == CPU_ON_FUNCID || status == 0) { ++ /* normal work */ ++ k_work_submit_to_queue(&ipm_work_q, &ipm_work_vring_rx); ++ } else if (status == SYSTEM_RESET) { ++ /* attach work: reset virtqueue */ ++ reset_vq(); ++ /* clear reserved[0] after the reset work is completed */ ++ rsc->hdr.reserved[0] = 0; ++ metal_cache_flush(rsc->hdr.reserved, sizeof(rsc->hdr.reserved)); ++ } +} + +struct virtio_device * @@ -1768,14 +1601,49 @@ index 0000000000..26f97a5c57 +int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device **vdev) +{ + void *rsc_table; -+ struct fw_resource_table *rsc; + struct metal_io_region *rsc_io; + int rsc_size; + int32_t err; + struct metal_init_params metal_params = METAL_INIT_DEFAULTS; + struct metal_device *device; -+ + ++ /* Libmetal setup */ ++ err = metal_init(&metal_params); ++ if (err) { ++ LOG_ERR("metal_init: failed - error code %d", err); ++ return err; ++ } ++ ++ err = metal_register_generic_device(&shm_device); ++ if (err) { ++ LOG_ERR("Couldn't register shared memory device: %d", err); ++ return err; ++ } ++ ++ err = metal_device_open("generic", SHM_DEVICE_NAME, &device); ++ if (err) { ++ LOG_ERR("metal_device_open failed: %d", err); ++ return err; ++ } ++ ++ metal_io_init(&device->regions[0], (void *)SHM_START_ADDR, &shm_physmap, ++ SHM_SIZE, -1, 0, NULL); ++ ++ /* shared mem io should be return to the caller */ ++ *io = metal_device_io_region(device, 0); ++ if (!*io) { ++ LOG_ERR("metal_device_io_region failed to get region"); ++ return err; ++ } ++ ++ rsc_table_get((struct fw_resource_table **)&rsc_table, &rsc_size); ++ metal_io_init(&device->regions[1], rsc_table, ++ (metal_phys_addr_t *)rsc_table, rsc_size, -1, 0, NULL); ++ rsc_io = metal_device_io_region(device, 1); ++ if (!rsc_io) { ++ LOG_ERR("Failed to get rsc_io region"); ++ return -1; ++ } + + /* IPM setup */ + @@ -1786,14 +1654,15 @@ index 0000000000..26f97a5c57 + k_thread_name_set(&ipm_work_q.thread, "ipm_work_q"); + + /* Setup IPM workqueue item */ -+ k_work_init(&ipm_work, ipm_callback_process); ++ k_work_init(&ipm_work_vring_rx, ipm_work_handle_vring_rx); ++ k_work_init(&ipm_work_cpu_off, ipm_work_handle_cpu_off); + + if (!device_is_ready(ipm_handle)) { + LOG_ERR("IPM device is not ready"); + return -ENODEV; + } + -+ ipm_register_callback(ipm_handle, ipm_callback, NULL); ++ ipm_register_callback(ipm_handle, ipm_callback, rsc_table); + + err = ipm_set_enabled(ipm_handle, 1); + if (err != 0) { @@ -1801,6 +1670,211 @@ index 0000000000..26f97a5c57 + return err; + } + ++ /* virtio device setup */ ++ *vdev = platform_create_vdev(rsc_table, rsc_io); ++ ++ if (*vdev == NULL) { ++ return -1; ++ } ++ ++ return 0; ++} +diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend_rsc_table_ivshmem.c b/subsys/ipc/rpmsg_service/rpmsg_backend_rsc_table_ivshmem.c +new file mode 100644 +index 00000000000..799e6502aba +--- /dev/null ++++ b/subsys/ipc/rpmsg_service/rpmsg_backend_rsc_table_ivshmem.c +@@ -0,0 +1,253 @@ ++/* ++ * Copyright (c) 2023, openEuler Embedded ++ * ++ * SPDX-License-Identifier: Apache-2.0 ++ */ ++ ++#include "rpmsg_backend.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define LOG_MODULE_NAME rpmsg_backend ++LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_RPMSG_SERVICE_LOG_LEVEL); ++ ++/* Configuration defines */ ++#define MASTER IS_ENABLED(CONFIG_RPMSG_SERVICE_MODE_MASTER) ++ ++#if IS_ENABLED(CONFIG_RPMSG_SERVICE_MODE_MASTER) ++#error "resource table implementation is only for device" ++#endif ++ ++ ++#define IVSHMEM_EVENT_POLL_STACK_SIZE 8192 ++#define IVSHMEM_EVENT_POLL_PRIO K_HIGHEST_APPLICATION_THREAD_PRIO ++ ++/* End of configuration defines */ ++ ++K_THREAD_STACK_DEFINE(ivshmem_event_poll_stack, IVSHMEM_EVENT_POLL_STACK_SIZE); ++static struct k_thread ivshmem_event_poll_thread; ++ ++static const struct device *ivshmem_dev = ++ DEVICE_DT_GET(DT_NODELABEL(ivshmem0)); ++ ++static struct metal_device shm_device = { ++ .name = SHM_DEVICE_NAME, ++ .num_regions = 2, ++ .regions = { ++ /* shared memory io, only the addr in [share mem start + share mem size] ++ * can be accessed and guaranteed by metal_io_read/write ++ */ ++ {.virt = NULL}, ++ /* resource table io, only the addr in [resource table start + table size] ++ * can be accessed and guaranteed by metal_io_read/write ++ */ ++ {.virt = NULL}, ++ }, ++ .node = { NULL }, ++ .irq_num = 0, ++ .irq_info = NULL ++}; ++ ++static struct virtio_device *cur_vdev; ++ ++static int virtio_notify(void *priv, uint32_t id) ++{ ++ ARG_UNUSED(priv); ++ int status; ++ uint16_t peer_dest_id = ivshmem_get_id(ivshmem_dev); ++ ++ peer_dest_id -= 1; ++ ++ status = ivshmem_int_peer(ivshmem_dev, peer_dest_id, 0); ++ ++ if (status != 0) { ++ LOG_ERR("ivshmem_int_peer failed to notify: %d", status); ++ return status; ++ } ++ ++ return status; ++} ++ ++struct virtio_device * ++platform_create_vdev(void *rsc_table, struct metal_io_region *rsc_io) ++{ ++ struct fw_rsc_vdev_vring *vring_rsc; ++ struct virtio_device *vdev; ++ int ret; ++ ++ vdev = rproc_virtio_create_vdev(VIRTIO_DEV_DEVICE, VDEV_ID, ++ rsc_table_to_vdev(rsc_table), ++ rsc_io, NULL, virtio_notify, NULL); ++ ++ if (!vdev) { ++ LOG_ERR("failed to create vdev"); ++ return NULL; ++ } ++ ++ /* wait master rpmsg init completion */ ++ rproc_virtio_wait_remote_ready(vdev); ++ ++ vring_rsc = rsc_table_get_vring0(rsc_table); ++ LOG_DBG("vring_rsc info: num:%d, da:0x%x", vring_rsc->num, vring_rsc->da); ++ ret = rproc_virtio_init_vring(vdev, 0, vring_rsc->notifyid, ++ (void *)(uintptr_t)vring_rsc->da, rsc_io, ++ vring_rsc->num, vring_rsc->align); ++ if (ret) { ++ LOG_ERR("failed to init vring 0"); ++ goto failed; ++ } ++ ++ vring_rsc = rsc_table_get_vring1(rsc_table); ++ ret = rproc_virtio_init_vring(vdev, 1, vring_rsc->notifyid, ++ (void *)(uintptr_t)vring_rsc->da, rsc_io, ++ vring_rsc->num, vring_rsc->align); ++ if (ret) { ++ LOG_ERR("failed to init vring 1"); ++ goto failed; ++ } ++ ++ cur_vdev = vdev; ++ return vdev; ++ ++failed: ++ rproc_virtio_remove_vdev(vdev); ++ ++ return NULL; ++} ++ ++static void ivshmem_event_poll_thread_entry(void *arg1, void *arg2, void *arg3) ++{ ++ ARG_UNUSED(arg1); ++ ARG_UNUSED(arg2); ++ ARG_UNUSED(arg3); ++ ++ /* k_poll was signaled or not */ ++ unsigned int poll_signaled; ++ /* vector received */ ++ int ivshmem_vector_rx; ++ int ret; ++ ++ struct k_poll_signal sig; ++ ++ struct k_poll_event events[] = { ++ K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, ++ K_POLL_MODE_NOTIFY_ONLY, ++ &sig), ++ }; ++ ++ k_poll_signal_init(&sig); ++ ++ ret = ivshmem_register_handler(ivshmem_dev, &sig, 0); ++ ++ if (ret < 0) { ++ LOG_ERR("registering handlers must be supported: %d\n", ret); ++ k_panic(); ++ } ++ ++ while (1) { ++ LOG_DBG("%s: waiting interrupt from remote peers...\n", __func__); ++ ret = k_poll(events, ARRAY_SIZE(events), K_FOREVER); ++ ++ k_poll_signal_check(&sig, &poll_signaled, &ivshmem_vector_rx); ++ /* get ready for next signal */ ++ k_poll_signal_reset(&sig); ++ ++ /* as remote device, VRING1_ID is for RX (from host to device)*/ ++ rproc_virtio_notified(cur_vdev, VRING1_ID); ++ } ++} ++ ++int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device **vdev) ++{ ++ uintptr_t rsc_table; ++ struct metal_io_region *rsc_io; ++ int rsc_size; ++ int32_t err; ++ struct metal_init_params metal_params = METAL_INIT_DEFAULTS; ++ struct metal_device *device; ++ size_t shmem_size; ++ uintptr_t shmem_phy_addr; ++ static metal_phys_addr_t shm_physmap; ++ ++ k_thread_create(&ivshmem_event_poll_thread, ++ ivshmem_event_poll_stack, ++ IVSHMEM_EVENT_POLL_STACK_SIZE, ++ (k_thread_entry_t)ivshmem_event_poll_thread_entry, ++ NULL, NULL, NULL, IVSHMEM_EVENT_POLL_PRIO, 0, K_NO_WAIT); ++ ++ /* get ivshmem info, shmem is already mapped in virt_ivshmem. c*/ ++ shmem_size = ivshmem_get_rw_mem_section(ivshmem_dev, &shmem_phy_addr); ++ ++ LOG_INF("ivshmem addr is 0x%lX, size is 0x%lX", shmem_phy_addr, shmem_size); ++ + /* Libmetal setup */ + err = metal_init(&metal_params); + if (err) { @@ -1820,20 +1894,19 @@ index 0000000000..26f97a5c57 + return err; + } + -+ metal_io_init(&device->regions[0], (void *)SHM_START_ADDR, &shm_physmap, -+ SHM_SIZE, -1, 0, NULL); -+ -+ /* shared mem io should be return to the caller */ -+ *io = metal_device_io_region(device, 0); -+ if (!*io) { -+ LOG_ERR("metal_device_io_region failed to get region"); -+ return err; -+ } ++ /* part1 resource table ++ * here resource table will be parsed by the other side and ++ * copied to the 1st page of ivshmem read&write section. ++ * we call rst_table_get to get the correct size and init meta ++ * io region ++ * ++ */ ++ rsc_table_get((struct fw_resource_table **)&rsc_table, &rsc_size); ++ rsc_table = shmem_phy_addr; + -+ rsc_table_get(&rsc_table, &rsc_size); -+ rsc = (struct fw_resource_table *)rsc_table; ++ LOG_DBG("rsc_table phys addr is %lx", (uintptr_t)rsc_table); + -+ metal_io_init(&device->regions[1], rsc_table, ++ metal_io_init(&device->regions[1], (void *)rsc_table, + (metal_phys_addr_t *)rsc_table, rsc_size, -1, 0, NULL); + rsc_io = metal_device_io_region(device, 1); + if (!rsc_io) { @@ -1841,22 +1914,36 @@ index 0000000000..26f97a5c57 + return -1; + } + ++ /* part 2: shared mem used for virtio, skip rsc table */ ++ shm_physmap = rsc_table + CONFIG_MMU_PAGE_SIZE; ++ metal_io_init(&device->regions[0], (void *)(shm_physmap), &shm_physmap, ++ shmem_size - CONFIG_MMU_PAGE_SIZE , -1, 0, NULL); ++ ++ /* shared mem io should be return to the caller */ ++ *io = metal_device_io_region(device, 0); ++ if (!*io) { ++ LOG_ERR("metal_device_io_region failed to get region"); ++ return err; ++ } ++ + /* virtio device setup */ -+ *vdev = platform_create_vdev(rsc_table, rsc_io); ++ *vdev = platform_create_vdev((void *)rsc_table, rsc_io); + + if (*vdev == NULL) { + return -1; + } + ++ /* enable ivshmem device interrupt */ ++ ivshmem_enable_interrupts(ivshmem_dev, true); ++ + return 0; +} -\ No newline at end of file diff --git a/subsys/ipc/rpmsg_service/rpmsg_rpc_service.c b/subsys/ipc/rpmsg_service/rpmsg_rpc_service.c new file mode 100644 -index 0000000000..c4e7769f17 +index 00000000000..635921f0e35 --- /dev/null +++ b/subsys/ipc/rpmsg_service/rpmsg_rpc_service.c -@@ -0,0 +1,150 @@ +@@ -0,0 +1,148 @@ +/* + * Copyright (c) 2022, openEuler Embedded + * @@ -1870,7 +1957,7 @@ index 0000000000..c4e7769f17 +#include +#include +#include -+#include ++#include +#include + +#define LOG_MODULE_NAME rpmsg_rpc_service @@ -1915,10 +2002,10 @@ index 0000000000..c4e7769f17 + + if (service) { + if (service->cb_function(data, len) < 0) { -+ LOG_ERR("call back %d error\n", id); ++ LOG_ERR("call back %d error", id); + } + } else { -+ LOG_ERR("no service found\n"); ++ LOG_ERR("no service found"); + } + + return 0; @@ -1979,11 +2066,11 @@ index 0000000000..c4e7769f17 + * - turn off tasks, device, etc. + * - clear cache, memory etc. + */ -+ cache_data_all(K_CACHE_WB_INVD); -+ cache_instr_all(K_CACHE_INVD); ++ sys_cache_data_flush_all(); ++ sys_cache_instr_flush_all(); + + /* from arm64 supporting psci, call pm_cpu_off to turn off */ -+ pm_cpu_off(); ++ //pm_cpu_off(); + + return 0; +} @@ -1993,13 +2080,11 @@ index 0000000000..c4e7769f17 + {RPMSG_SYS_SERVICE_POWER_OFF, sys_service_power_off_cb} +}; + -+static int rpmsg_sys_service_init(const struct device *dev) ++static int rpmsg_sys_service_init(void) +{ -+ (void)dev; -+ + unsigned int n_services = sizeof(sys_service_table) / sizeof(struct rpmsg_rpc_service); + -+ LOG_INF("number of services: %d\n", n_services); ++ LOG_INF("number of services: %d", n_services); + + rpmsg_rpc_service_init(&sys_service_inst, sys_service_table, n_services); + @@ -2009,7 +2094,7 @@ index 0000000000..c4e7769f17 +SYS_INIT(rpmsg_sys_service_init, POST_KERNEL, CONFIG_RPMSG_SERVICE_EP_REG_PRIORITY); diff --git a/subsys/ipc/rpmsg_service/rpmsg_rpc_service.h b/subsys/ipc/rpmsg_service/rpmsg_rpc_service.h new file mode 100644 -index 0000000000..e6c4b0a105 +index 00000000000..e6c4b0a1050 --- /dev/null +++ b/subsys/ipc/rpmsg_service/rpmsg_rpc_service.h @@ -0,0 +1,60 @@ @@ -2074,10 +2159,10 @@ index 0000000000..e6c4b0a105 + +#endif /* ZEPHYR_SUBSYS_IPC_RPMSG_RPC_SERVICE_H */ diff --git a/subsys/ipc/rpmsg_service/rpmsg_service.c b/subsys/ipc/rpmsg_service/rpmsg_service.c -index e82c7a6be7..da51f70e96 100644 +index 616bfb86ebd..470f9e644ec 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_service.c +++ b/subsys/ipc/rpmsg_service/rpmsg_service.c -@@ -20,7 +20,11 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_RPMSG_SERVICE_LOG_LEVEL); +@@ -20,8 +20,12 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_RPMSG_SERVICE_LOG_LEVEL); #define MASTER IS_ENABLED(CONFIG_RPMSG_SERVICE_MODE_MASTER) @@ -2085,10 +2170,12 @@ index e82c7a6be7..da51f70e96 100644 +static struct virtio_device *vdev; +#else static struct virtio_device vdev; +-static struct rpmsg_virtio_device rvdev; +#endif - static struct rpmsg_virtio_device rvdev; ++struct rpmsg_virtio_device rvdev; static struct metal_io_region *io; static bool ep_crt_started; + @@ -29,16 +33,30 @@ static bool ep_crt_started; static struct rpmsg_virtio_shm_pool shpool; #endif @@ -2122,7 +2209,7 @@ index e82c7a6be7..da51f70e96 100644 } #if MASTER -@@ -88,12 +106,15 @@ static int rpmsg_service_init(const struct device *dev) +@@ -86,12 +104,15 @@ static int rpmsg_service_init(void) LOG_ERR("RPMsg backend init failed with error %d", err); return err; } @@ -2139,7 +2226,7 @@ index e82c7a6be7..da51f70e96 100644 #endif if (err) { -@@ -131,7 +152,8 @@ static int rpmsg_service_init(const struct device *dev) +@@ -129,7 +150,8 @@ static int rpmsg_service_init(void) return 0; } @@ -2149,7 +2236,7 @@ index e82c7a6be7..da51f70e96 100644 { if (ep_crt_started) { return -EINPROGRESS; -@@ -141,7 +163,8 @@ int rpmsg_service_register_endpoint(const char *name, rpmsg_ept_cb cb) +@@ -139,7 +161,8 @@ int rpmsg_service_register_endpoint(const char *name, rpmsg_ept_cb cb) if (!endpoints[i].name) { endpoints[i].name = name; endpoints[i].cb = cb; @@ -2159,7 +2246,7 @@ index e82c7a6be7..da51f70e96 100644 return i; } } -@@ -156,6 +179,11 @@ bool rpmsg_service_endpoint_is_bound(int endpoint_id) +@@ -154,6 +177,11 @@ bool rpmsg_service_endpoint_is_bound(int endpoint_id) return endpoints[endpoint_id].bound; } @@ -2171,20 +2258,3 @@ index e82c7a6be7..da51f70e96 100644 int rpmsg_service_send(int endpoint_id, const void *data, size_t len) { return rpmsg_send(&endpoints[endpoint_id].ep, data, len); -diff --git a/west.yml b/west.yml -index e006f43aa9..cdcef2cea5 100644 ---- a/west.yml -+++ b/west.yml -@@ -133,12 +133,6 @@ manifest: - path: modules/hal/stm32 - groups: - - hal -- - name: hal_telink -- revision: 38573af589173259801ae6c2b34b7d4c9e626746 -- path: modules/hal/telink -- submodules: true -- groups: -- - hal - - name: hal_ti - revision: 000b944a788b6005d7776198e1348f5c8a657259 - path: modules/hal/ti diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.bb b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.bb index 08217c4c289..fe0946cb072 100644 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.bb +++ b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.bb @@ -1,21 +1,31 @@ SUMMARY = "The Zephyr OS image" DESCRIPTION = "This recipe is a bridge to build zephyr image in openEuler Embedded" -OPENEULER_FETCH = "disable" - # currently compatible machines COMPATIBLE_MACHINE = "qemu-aarch64|raspberrypi4-64" -# the target zephyr board, currently two boards supported in openEuler Embedded -# - qemu_cortex_a53, which matches qemu-aarch64 of openEuler Embedded -# - rpi_cortex_a72, which matches raspberry pi 4 B of openEuler Embedded -ZEPHYR_BOARD:qemu-aarch64 = "qemu_cortex_a53_remote" -ZEPHYR_BOARD:raspberrypi4-64 = "rpi4_cortex_a72" - # common part to build zephyr image include zephyr-image.inc PV = "${ZEPHYR_VERSION}" # the default zephyr application -ZEPHYR_SRC_DIR ?= "${ZEPHYR_BASE}/samples/subsys/shell/devmem_load" +ZEPHYR_APP_DIR ?= "${ZEPHYR_BASE}/samples/subsys/shell/devmem_load" + +python () { + machine = d.getVar('MACHINE').split() + mcs_features = d.getVar('MCS_FEATURES').split() + + # qemu-aarch64 related handling + if 'qemu-aarch64' in machine: + if 'openamp' in mcs_features: + d.setVar('ZEPHYR_BOARD', 'qemu_cortex_a53/qemu_cortex_a53/remote') + elif 'jailhouse' in mcs_features: + d.setVar('ZEPHYR_BOARD', 'qemu_cortex_a53/qemu_cortex_a53/ivshmem') + elif 'raspberrypi4-64' in machine: + if 'openamp' in mcs_features: + d.setVar('ZEPHYR_BOARD', 'rpi_4b/rpi_4b/remote') + elif 'jailhouse' in mcs_features: + d.setVar('ZEPHYR_BOARD', 'rpi_4b/rpi_4b/ivshmem') + +} diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.inc b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.inc index e49f0a1dacc..1adc21f36c8 100644 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.inc +++ b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-image.inc @@ -2,7 +2,7 @@ require zephyr-kernel-src.inc require zephyr-kernel-common.inc inherit deploy -OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}" +OECMAKE_SOURCEPATH = "${ZEPHYR_APP_DIR}" # according Linux side's rule, e.g. remote proc, zephyr # image should be in /lib/firmware @@ -15,12 +15,12 @@ do_install() { if [ -f ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ] then - install -D ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ${D}/${ZEPHYR_INSTALL_DIR}/${PN}.bin + install -D ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ${D}/${ZEPHYR_INSTALL_DIR} fi if [ -f ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ] then - install -D ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ${D}/${ZEPHYR_INSTALL_DIR}/${PN}.efi + install -D ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ${D}/${ZEPHYR_INSTALL_DIR} fi } FILES:${PN} = "${ZEPHYR_INSTALL_DIR}" @@ -28,6 +28,6 @@ INSANE_SKIP += "ldflags buildpaths" SYSROOT_DIRS += "${ZEPHYR_INSTALL_DIR}" do_deploy() { - cp ${D}/${ZEPHYR_INSTALL_DIR}/${PN}.* ${DEPLOYDIR}/ + cp ${D}/${ZEPHYR_INSTALL_DIR}/zephyr* ${DEPLOYDIR}/ } addtask deploy after do_install diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc index b532dbbb280..5c0a2c4c260 100644 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +++ b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc @@ -11,14 +11,17 @@ ZEPHYR_MAKE_BIN_OUTPUT = "zephyr.bin" ZEPHYR_MAKE_EFI_OUTPUT = "zephyr.efi" # default use ninja as compile backend +# "-DCMAKE_TOOLCHAIN_FILE= " is a trick to bypass toolchain file for linux application +# as zephyr is not linux application EXTRA_OECMAKE = "\ + -DCMAKE_TOOLCHAIN_FILE= \ -DZEPHYR_BASE=${ZEPHYR_BASE} \ - -DBOARD=${BOARD} \ + -DBOARD=${ZEPHYR_BOARD} \ -DZEPHYR_MODULES=${ZEPHYR_MODULES} \ -DBUILD_VERSION=${ZEPHYR_VERSION} \ " -export ZEPHYR_BASE="${S}/zephyr" +export ZEPHYR_BASE="${S}/zephyr-${ZEPHYR_VERSION}" DEPENDS += "gperf-native" @@ -33,8 +36,8 @@ python () { d.delVar('LDFLAGS') } -OE_TERMINAL_EXPORTS += "BOARD" -OE_TERMINAL_EXPORTS += "ZEPHYR_SRC_DIR" +OE_TERMINAL_EXPORTS += "ZEPHYR_BOARD" +OE_TERMINAL_EXPORTS += "ZEPHYR_APP_DIR" OE_TERMINAL_EXPORTS += "ZEPHYR_BASE" do_configure:prepend() { diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc index 74813bc6476..cb1ccb86cb7 100644 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc +++ b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-kernel-src.inc @@ -1,5 +1,5 @@ LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://zephyr/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" +LIC_FILES_CHKSUM = "file://zephyr-${ZEPHYR_VERSION}/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" CVE_PRODUCT = "zephyr" @@ -11,12 +11,12 @@ OPENEULER_LOCAL_NAME = "zephyrproject" # the dir holds all the zephyr project related source codes, e.g. # zephyr kernel, zephyr modules, tools ZEPHYR_PROJECT_DIR ?= "zephyr_project" -ZEPHYR_VERSION ?="3.2.0" +ZEPHYR_VERSION ?="3.7.1" SRC_URI = "\ - file://zephyr_project_v${ZEPHYR_VERSION}.tar.gz;subdir=zephyr_project \ - file://zephyr_openeuler_mcs.patch;patchdir=zephyr \ - file://libmetal_fix_configure_error.patch;patchdir=modules/hal/libmetal \ + file://lts3-zephyr-${ZEPHYR_VERSION}.tar.gz;subdir=zephyr_project \ + file://lts3-zephyr-modules-${ZEPHYR_VERSION}.tar.gz;subdir=zephyr_project \ + file://zephyr_openeuler_mcs.patch;patchdir=zephyr-${ZEPHYR_VERSION} \ " # This file might be included from other places (like other layers) and not diff --git a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-toolchain-cross-compile.inc b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-toolchain-cross-compile.inc index dc87fdda499..e7f564c0c63 100644 --- a/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-toolchain-cross-compile.inc +++ b/rtos/meta-zephyr/recipes-kernel/zephyr-kernel/zephyr-toolchain-cross-compile.inc @@ -1,8 +1,11 @@ # Additional definitions to use the cross-compile toolchain + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS += "zephyr-toolchain-${TARGET_ARCH}-native" ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}" # use the openeuler embedded's pre-built external toolchain -CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}" +CROSS_COMPILE:aarch64 = "${STAGING_DIR_NATIVE}${bindir_native}/aarch64-zephyr-elf-" EXTRA_OECMAKE:append = " \ -DZEPHYR_GCC_VARIANT=${ZEPHYR_GCC_VARIANT} \ @@ -11,3 +14,6 @@ EXTRA_OECMAKE:append = " \ OE_TERMINAL_EXPORTS += "CROSS_COMPILE" OE_TERMINAL_EXPORTS += "ZEPHYR_GCC_VARIANT" + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" -- Gitee From 42203dc0ece54143947875f4b80f53d725fd4d32 Mon Sep 17 00:00:00 2001 From: zhang-wenyu1 Date: Tue, 11 Mar 2025 14:49:43 +0800 Subject: [PATCH 20/30] net-tools: modify net-tools_%.bbappend to fix bug 1. modify net-tools_%.bbappend to fix bug Signed-off-by: zhang_wenyu --- meta-openeuler/recipes-extended/net-tools/net-tools_%.bbappend | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta-openeuler/recipes-extended/net-tools/net-tools_%.bbappend b/meta-openeuler/recipes-extended/net-tools/net-tools_%.bbappend index ee3ae358e0e..5954d652f28 100644 --- a/meta-openeuler/recipes-extended/net-tools/net-tools_%.bbappend +++ b/meta-openeuler/recipes-extended/net-tools/net-tools_%.bbappend @@ -1,5 +1,7 @@ # main bb file: yocto-poky/meta/recipes-extended/net-tools/net-tools_2.10.bb +DEPENDS += "libselinux bluez5" + PV = "2.10" S = "${WORKDIR}/${BP}" -- Gitee From 0c53e4b8551e9bd2134ba30395dd18a5f6b5741f Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Wed, 5 Mar 2025 13:14:26 +0800 Subject: [PATCH 21/30] docs: Add documentation for xen and rpmsg-umt * Add usage docs for xen and rpmsg-umt Signed-off-by: hanzongcheng --- docs/source/features/index.rst | 3 +- docs/source/features/mica/services/index.rst | 1 + docs/source/features/mica/services/umt.rst | 71 ++++++++++++++++++++ docs/source/features/xen.rst | 66 ++++++++++++++++++ 4 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 docs/source/features/mica/services/umt.rst create mode 100644 docs/source/features/xen.rst diff --git a/docs/source/features/index.rst b/docs/source/features/index.rst index c5a380be30e..28c65564bb0 100644 --- a/docs/source/features/index.rst +++ b/docs/source/features/index.rst @@ -18,8 +18,9 @@ qt5_wayland.rst armnn.rst clang_llvm.rst - jailhouse.rst openbmc.rst container/index.rst kernelversions.rst software_package_description.rst + jailhouse.rst + xen.rst diff --git a/docs/source/features/mica/services/index.rst b/docs/source/features/mica/services/index.rst index 7d75140baaa..29361f0dfb9 100644 --- a/docs/source/features/mica/services/index.rst +++ b/docs/source/features/mica/services/index.rst @@ -6,3 +6,4 @@ debug.rst rpc.rst + umt.rst diff --git a/docs/source/features/mica/services/umt.rst b/docs/source/features/mica/services/umt.rst new file mode 100644 index 00000000000..180b1b3881a --- /dev/null +++ b/docs/source/features/mica/services/umt.rst @@ -0,0 +1,71 @@ +用户消息传递服务 +################ + +简介 +---- + +在多 OS 混合部署场景下,Linux 与实时操作系统(RTOS)通过 RPMsg 协议进行跨核通信。默认配置下,RPMsg 使用 512 字节固定大小的消息缓冲区进行数据传输。当传输较大数据时,会触发以下问题: + +- 需要将数据分片为多个512字节的消息包 +- 每个消息包的传输都会产生IPI(处理器间中断) +- 频繁的IPI导致系统吞吐量下降和通信延迟增加 + +因此,当前 MICA 提供了 rpmsg-umt (user message transfer)服务,实现了高效通信服务: + +1. 预先分配物理连续的共享内存区域 +2. 用户数据写入到共享内存区域 +3. 通过 RPMsg 单次传输共享内存的元数据(起始地址+大小) + +对比如下: + +传统方式: +[Data] -> RPMsg Buffer -> IPI -> RPMsg Buffer -> [Data] + +rpmsg-umt: +[Data] -> Shared Memory -> (IPI + Metadata) -> Shared Memory -> [Data] + +使用方法 +-------- + +rpmsg-umt 提供了以下接口进行数据发送: + + .. code-block:: c + + /** + * @brief 发送数据到指定实例的RTOS并等待接收返回结果。 + * + * 该函数用于将数据发送到指定实例的RTOS(实时操作系统),并等待接收返回结果。 + * + * @param data 指向要发送的数据内容的指针。调用者应确保该缓冲区包含正确的数据内容。 + * @param data_len 要发送的数据长度。调用者应提供实际要发送的数据长度。 + * @param target_instance 要发送的目标实例ID, uniproton 启动配置文件中"InstanceID"值。 + * 注: 当前不支持多实例,target_instance赋值为0;支持多实例以后修改成具体实例号 + * @param rcv_data 指向接收数据缓冲区的指针。调用者应确保缓冲区已分配足够的内存来存储接收到的数据。 + * @param rcv_data_len 指向接收数据长度的指针。调用者应提供一个整型变量的地址,用于存储接收到的数据长度。 + * + * @return int 返回值表示函数执行结果。 + * - 0 表示成功发送数据并接收返回结果。 + * - -1 表示发送失败。 + */ + int send_data_to_rtos_and_wait_rcv(void *data, int data_len, int target_instance, void *rcv_data, int *rcv_data_len); + +Linux 端示例可以参考 `send-data.c `_ 。 + +RTOS 端实现可以参考 UniProton `PR454 `_,`PR457 `_ 。 + +性能指标 +-------- + +测试环境: + +- KunPeng 920 +- openEuler Embedded 25.03 +- UniProton + +测试结果: + +======== ================ + 数据量 rpmsg-umt耗时 +======== ================ + 1MB 5.14ms +======== ================ diff --git a/docs/source/features/xen.rst b/docs/source/features/xen.rst new file mode 100644 index 00000000000..2a5c7c7fce8 --- /dev/null +++ b/docs/source/features/xen.rst @@ -0,0 +1,66 @@ +嵌入式实时虚拟机XEN +################### + +总体介绍 +======== + +Xen 是开源的 Type-1 型虚拟机管理器(HyperVisor),属于 Linux 基金会 `Xen Project `_ 的重要部分。 + +Xen 包含以下核心组件: + +- Xen Core:Xen 的虚拟化层,负责CPU 调度、内存分配、中断处理等 +- 特权域(Dom0):唯一拥有硬件驱动访问权的管理虚拟机,负责创建和管理其他虚拟机(DomU) +- 一个或多个用户域(DomU):各种用户/应用程序域。这些域运行用户应用程序和操作系统 + +____ + +Xen 构建指导 +============ + +使用 oebuild 构建 +------------------------- + + 目前已经在 yocto-meta-openeuler 中实现了对 QEMU-ARM64、KP920 的支持。 + + 1. 根据 :ref:`mcs镜像构建指导 `,使用 oebuild 初始化编译环境。 + + 2. 进入oebuild工作目录,创建编译配置文件 ``compile.yaml`` : + + .. code-block:: console + + # 构建 qemu-aarch64 镜像,包含mcs和xen特性,此处构建目录名为 build_xen + oebuild generate -p qemu-aarch64 -f mcs -f xen -d qemu-xen + + # 或者,构建 KP920 镜像,包含mcs和xen特性,此处构建目录名为 build_xen + oebuild generate -p kp920 -f mcs -f xen -d kp920-xen + + 3. 进入 ``build_xen`` 目录使用oebuild容器构建: + + .. code-block:: console + + oebuild bitbake + # 进入容器后 + bitbake openeuler-image + + 4. 构建完成后,在 output 目录下有对应的部署件:KP920提供iso镜像,QEMU提供zImage和initrd。 + +____ + +Xen 使用指导 +================== + + 1. 构建完成后使用 ``runqemu`` 启动 QEMU,或者是在 KP920 上正常安装 ISO 镜像,之后默认会通过 qemu 参数或 grub 配置完成 Xen 和 Dom0 的引导。 + + 2. 之后,可以通过以下 config 配置,并执行 ``xl create xen-linux.cfg`` 启动 Linux DomU: + + .. code-block:: console + + $ cat xen-linux.cfg + name = "domU" + memory = 512 + vcpus = 1 + kernel = "Image" + ramdisk = "rootfs.cpio.gz" + extra = "console=hvc0 root=/dev/xvda rw" + + 如果需要退出 DomU 的 shell,可以通过 ``ctrl + ]`` 组合键切换回 Dom0,通过 ``xl console domU`` 可以重新进入。 -- Gitee From b25cb90448761b37242ef2fdb5ae7cf0c60aaa66 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Tue, 11 Mar 2025 17:07:41 +0800 Subject: [PATCH 22/30] packagegroup-network: wifi and bluetooth are not used ${PN}-wifi and ${PN}-bluetooth are not used anywhere. so remove related codes Signed-off-by: Wayne Ren --- .../packagegroups/packagegroup-network.bb | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-network.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-network.bb index 75ab1f6177f..a7adee66f81 100644 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-network.bb +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-network.bb @@ -1,4 +1,4 @@ -SUMMARY = "network packagegroup" +SUMMARY = "openeuler embedded network functions packagegroup" PR = "r1" inherit packagegroup @@ -24,18 +24,3 @@ dhcp-server-config \ dhcp-omshell \ dhcp-relay \ " - -RDEPENDS:${PN}-wifi = " \ -wpa-supplicant \ -" - -RDEPENDS:${PN}-bluetooth = " \ -bluez5 \ -" - -# The bluez used by image running on raspberrypi should use the -# raspberrypi distro. -python () { - if d.getVar('MACHINE') == 'raspberrypi4-64': - d.appendVar("RDEPENDS:"+d.getVar('PN')+"-bluetooth", " bluez-firmware-rpidistro") -} -- Gitee From 2d71b6b585b57990389e407132584c19c3a2c788 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Tue, 11 Mar 2025 17:20:45 +0800 Subject: [PATCH 23/30] packagegroup: refactor base and core-base-utils * use yocto's packagegroup-base and packagegroup-base-utils as base as yocto considers more cases * openeuler does append based on yocto's packagegroup * add core-full-cmdline into openeuler-image-common.inc * use packagegroup-base-extended to replace packagegroup-base Signed-off-by: Wayne Ren --- meta-openeuler/conf/distro/openeuler.conf | 2 + .../images/openeuler-image-common.inc | 3 +- .../packagegroups/packagegroup-base.bb | 106 ------------------ .../packagegroups/packagegroup-base.bbappend | 3 + .../packagegroup-core-base-utils.bb | 23 ---- .../packagegroup-core-base-utils.bbappend | 103 +++++++++++++++++ 6 files changed, 110 insertions(+), 130 deletions(-) delete mode 100644 meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb create mode 100644 meta-openeuler/recipes-core/packagegroups/packagegroup-base.bbappend delete mode 100644 meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bb create mode 100644 meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend diff --git a/meta-openeuler/conf/distro/openeuler.conf b/meta-openeuler/conf/distro/openeuler.conf index 1da67e6ceba..7e77d1cf66e 100644 --- a/meta-openeuler/conf/distro/openeuler.conf +++ b/meta-openeuler/conf/distro/openeuler.conf @@ -47,6 +47,8 @@ PREFERRED_PROVIDER_at-spi2-atk ?= "at-spi2-core" PREFERRED_PROVIDER_at-spi2-atk-native ?= "at-spi2-core-native" PREFERRED_PROVIDER_nativesdk-at-spi2-atk ?= "nativesdk-at-spi2-core" +VIRTUAL-RUNTIME_syslog ?= "rsyslog" + ## build related configurations # setting SOURCE_DATE_EPOCH for reproducible build SOURCE_DATE_EPOCH = "${@get_openeuler_epoch(d)}" diff --git a/meta-openeuler/recipes-core/images/openeuler-image-common.inc b/meta-openeuler/recipes-core/images/openeuler-image-common.inc index 32542a60273..b5beef09e69 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-common.inc +++ b/meta-openeuler/recipes-core/images/openeuler-image-common.inc @@ -3,10 +3,11 @@ IMAGE_INSTALL = " \ packagegroup-core-boot \ packagegroup-core-base-utils \ packagegroup-core-tools-debug \ -packagegroup-base \ +packagegroup-base-extended \ packagegroup-openssh \ packagegroup-network \ packagegroup-kernel-modules \ +packagegroup-core-full-cmdline \ " # no extra language settings diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb deleted file mode 100644 index 58e64104605..00000000000 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bb +++ /dev/null @@ -1,106 +0,0 @@ -SUMMARY = "image base utils" -PR = "r1" - -# -# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH -# -PACKAGE_ARCH = "${MACHINE_ARCH}" - -inherit packagegroup - -# PACKAGES is "${PN}" by default -# if you want to add new groups by RDEPENDS:xx, you show add new group to PACKAGES -# split packagegroup-base to packagegroup-base-utils and packagegroup-base-libs -# packagegroup-base-utils means which package contains binary file for user using. -# packagegroup-base-libs means which package contains library and conf files only. -PACKAGES = "${PN} ${PN}-utils ${PN}-libs" - -RDEPENDS:packagegroup-base-utils = " \ -acl \ -attr \ -cifs-utils \ -cronie \ -curl \ -dosfstools \ -e2fsprogs \ -e2fsprogs-tune2fs \ -ethtool \ -expat \ -grep \ -gzip \ -bzip2 \ -iproute2-ip \ -iptables \ -kexec-tools \ -kmod \ -less \ -logrotate \ -lvm2 \ -pciutils \ -policycoreutils \ -policycoreutils-fixfiles \ -policycoreutils-hll \ -policycoreutils-loadpolicy \ -policycoreutils-semodule \ -policycoreutils-sestatus \ -policycoreutils-setfiles \ -nlopt \ -procps \ -pstree \ -quota \ -rsyslog \ -sed \ -shadow-base \ -squashfs-tools \ -tzdata-core \ -util-linux-su \ -util-linux-libfdisk \ -xz \ -expect \ -sysfsutils \ -elfutils \ -openssl-bin \ -" - -# riscv64 arch is not support kexec-tools, view yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.23.bb -# and check COMPATIBLE_HOST param -RDEPENDS:packagegroup-base-utils:remove:riscv64 = "\ - kexec-tools \ -" - - -RDEPENDS:packagegroup-base-libs = " \ -json-c \ -libcap-bin \ -libcap-ng-bin \ -libmodbus \ -libnl-cli \ -libnl-xfrm \ -libpcap \ -libpwquality \ -libselinux-bin \ -libsepol-bin \ -libxml2-utils \ -ncurses \ -ncurses-libform \ -ncurses-libmenu \ -ncurses-libpanel \ -ncurses-terminfo \ -ncurses-terminfo-base \ -libusb1 \ -glib-2.0 \ -libbfd \ -" - -RDEPENDS:packagegroup-base = " \ -packagegroup-base-utils \ -packagegroup-base-libs \ -packagegroup-entropy-daemon \ -" - -# for x86-64 arch, add some industrial protocol packages -RDEPENDS:packagegroup-base-utils:append:x86-64 = " \ - ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6', '', 'ethercat-igh', d)} \ - intel-cmt-cat \ - linuxptp \ -" diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bbappend b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bbappend new file mode 100644 index 00000000000..5e27cd671e1 --- /dev/null +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-base.bbappend @@ -0,0 +1,3 @@ +RDEPENDS:packagegroup-base:append = " \ + packagegroup-entropy-daemon \ +" diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bb deleted file mode 100644 index 9fe0e655d5b..00000000000 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bb +++ /dev/null @@ -1,23 +0,0 @@ -DESCRIPTION = "packages to provide base utils" - -# -# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH -# -PACKAGE_ARCH = "${MACHINE_ARCH}" - -inherit packagegroup - -PACKAGES = "${PN}" - -RDEPENDS:${PN} = "\ -audit \ -auditd \ -audispd-plugins \ -cracklib \ -libpwquality \ -libpam \ -packagegroup-pam-plugins \ -shadow \ -shadow-securetty \ -bash \ -" diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend b/meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend new file mode 100644 index 00000000000..3b5979dbaff --- /dev/null +++ b/meta-openeuler/recipes-core/packagegroups/packagegroup-core-base-utils.bbappend @@ -0,0 +1,103 @@ +# +# \todo: add comments why the following RPEPENDS are required +# * openeuler uses bind-dhclient to replace bind-utils +# * inetutils-xxx are not used +# * debian related tools are not used: debianutils-run-parts dpkg-start-stop +# * kea is not used +# * audit, auditd, audispd-plugins are fore secure reasons. +# kexec-tools for kernel core dump +# +RDEPENDS:${PN} = "\ + base-passwd \ + bash \ + bzip2 \ + coreutils \ + cpio \ + dhcpcd \ + diffutils \ + e2fsprogs \ + file \ + findutils \ + gawk \ + grep \ + gzip \ + ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "", "ifupdown", d)} \ + iproute2 \ + ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "kbd", "", d)} \ + kmod \ + less \ + ncurses-tools \ + net-tools \ + parted \ + patch \ + procps \ + psmisc \ + sed \ + shadow-base \ + tar \ + time \ + unzip \ + util-linux \ + ${VIRTUAL-RUNTIME_vim} \ + wget \ + which \ + xz \ + audit \ + auditd \ + audispd-plugins \ + cracklib \ + libpwquality \ + libpam \ + packagegroup-pam-plugins \ + kexec-tools \ + openssl-bin \ + cifs-utils \ + curl \ + e2fsprogs-tune2fs \ + expat \ + lvm2 \ + policycoreutils \ + policycoreutils-fixfiles \ + policycoreutils-hll \ + policycoreutils-loadpolicy \ + policycoreutils-semodule \ + policycoreutils-sestatus \ + policycoreutils-setfiles \ + nlopt \ + pstree \ + quota \ + squashfs-tools \ + tzdata-core \ + util-linux-su \ + util-linux-libfdisk \ + expect \ + sysfsutils \ + elfutils \ + json-c \ + libcap-bin \ + libcap-ng-bin \ + libnl-cli \ + libnl-xfrm \ + libpcap \ + libpwquality \ + libselinux-bin \ + libsepol-bin \ + libxml2-utils \ + libusb1 \ + glib-2.0 \ + libbfd \ +" + +# riscv64 arch is not support kexec-tools, view yocto-poky/meta/recipes-kernel/kexec/kexec-tools_2.0.23.bb +# and check COMPATIBLE_HOST param +RDEPENDS:${PN}:remove:riscv64 = "\ + kexec-tools \ +" + + +# for x86-64 arch, add some industrial protocol packages +RDEPENDS:${PN}:append:x86-64 = " \ + ethercat-igh \ + intel-cmt-cat \ + linuxptp \ +" -- Gitee From b24decfba98a9559fca81d6cc747dc86ce7154ca Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Wed, 12 Mar 2025 10:40:54 +0800 Subject: [PATCH 24/30] openeuler-image-tiny: use PACKAGE_INSTALL to replace IMAGE_INSTALL PACKAGE_INSTALL is the final var to control what is installed in rootfs. for tiny image, better to use PACKAGE_INSTALL Signed-off-by: Wayne Ren --- meta-openeuler/recipes-core/images/openeuler-image-tiny.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta-openeuler/recipes-core/images/openeuler-image-tiny.bb b/meta-openeuler/recipes-core/images/openeuler-image-tiny.bb index 46089e6a46f..590f3c12a19 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-tiny.bb +++ b/meta-openeuler/recipes-core/images/openeuler-image-tiny.bb @@ -9,9 +9,9 @@ require openeuler-image-common.inc # not build sdk deltask populate_sdk -# tiny image overwrite this variable, or IMAGE_INSTALL was standard packages in openeuler-image-common.inc file -IMAGE_INSTALL = " \ -packagegroup-core-boot \ +# PACKAGE_INSTALL is the final var to control what is installed in rootfs +PACKAGE_INSTALL = " \ + packagegroup-core-boot \ " # make install or nologin when using busybox-inittab -- Gitee From 88f12b3c713ad3add84a8aa61f53e074dd57da05 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Wed, 12 Mar 2025 10:43:21 +0800 Subject: [PATCH 25/30] packagegroup-openssh: remove packagegroup-openssh * poky's packagegroup-core-ssh-openssh did the same thing * use IMAGE_FEATURES to control the introduction of packagegroup-core-ssh-openssh, see core-image.bbclass Signed-off-by: Wayne Ren --- .../images/openeuler-container-os.bb | 1 - .../images/openeuler-image-common.inc | 3 +-- .../recipes-core/images/openeuler-image-mcs.bb | 1 - .../recipes-core/images/openeuler-image-obmc.bb | 1 - .../packagegroups/packagegroup-openssh.bb | 16 ---------------- 5 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 meta-openeuler/recipes-core/packagegroups/packagegroup-openssh.bb diff --git a/meta-openeuler/recipes-core/images/openeuler-container-os.bb b/meta-openeuler/recipes-core/images/openeuler-container-os.bb index 01bcefda6da..5c7465c260c 100644 --- a/meta-openeuler/recipes-core/images/openeuler-container-os.bb +++ b/meta-openeuler/recipes-core/images/openeuler-container-os.bb @@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES = "isulad" IMAGE_INSTALL = " \ packagegroup-core-boot \ packagegroup-kernel-modules \ -packagegroup-openssh \ ${@bb.utils.contains("DISTRO_FEATURES", "kubeedge isulad", "packagegroup-kubeedge", "", d)} \ packagegroup-isulad \ packagegroup-container-images \ diff --git a/meta-openeuler/recipes-core/images/openeuler-image-common.inc b/meta-openeuler/recipes-core/images/openeuler-image-common.inc index b5beef09e69..b4a5e7e0758 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-common.inc +++ b/meta-openeuler/recipes-core/images/openeuler-image-common.inc @@ -4,7 +4,6 @@ packagegroup-core-boot \ packagegroup-core-base-utils \ packagegroup-core-tools-debug \ packagegroup-base-extended \ -packagegroup-openssh \ packagegroup-network \ packagegroup-kernel-modules \ packagegroup-core-full-cmdline \ @@ -27,7 +26,7 @@ OPENEUELR_IMAGE_USERS ?= " \ # by default, allow root login and empty password from ssh # because of the configuration of OPENEUELR_IMAGE_USERS # root password will be required to reset at first login -OPENEULER_IMAGE_FEATURES ?= "allow-root-login allow-empty-password" +OPENEULER_IMAGE_FEATURES ?= "allow-root-login allow-empty-password ssh-server-openssh" IMAGE_FEATURES:append = " ${OPENEULER_IMAGE_FEATURES}" # image-level user and user group configuration diff --git a/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb b/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb index 83c03185c6e..4c63d343488 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb +++ b/meta-openeuler/recipes-core/images/openeuler-image-mcs.bb @@ -20,7 +20,6 @@ IMAGE_FEATURES:remove = "weston" IMAGE_INSTALL = " \ packagegroup-core-boot \ packagegroup-kernel-modules \ -packagegroup-openssh \ packagegroup-mcs \ " diff --git a/meta-openeuler/recipes-core/images/openeuler-image-obmc.bb b/meta-openeuler/recipes-core/images/openeuler-image-obmc.bb index 338c6ef9833..2e307fa9b57 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image-obmc.bb +++ b/meta-openeuler/recipes-core/images/openeuler-image-obmc.bb @@ -13,7 +13,6 @@ IMAGE_INSTALL = " \ packagegroup-core-boot \ packagegroup-base \ packagegroup-pam-plugins \ -packagegroup-openssh \ " # packages added to rootfs and target sdk diff --git a/meta-openeuler/recipes-core/packagegroups/packagegroup-openssh.bb b/meta-openeuler/recipes-core/packagegroups/packagegroup-openssh.bb deleted file mode 100644 index 65dff6c18de..00000000000 --- a/meta-openeuler/recipes-core/packagegroups/packagegroup-openssh.bb +++ /dev/null @@ -1,16 +0,0 @@ -SUMMARY = "OpenSSH SSH client/server" -PR = "r1" - -inherit packagegroup - -PACKAGES = "${PN}" - -RDEPENDS:${PN} = " \ -openssh-ssh \ -openssh-sshd \ -openssh-scp \ -openssh-keygen \ -openssh-misc \ -openssh-sftp \ -openssh-sftp-server \ -" -- Gitee From a7621117ea7d27833d803b9ee6b0658fb691daa8 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Wed, 12 Mar 2025 16:45:38 +0800 Subject: [PATCH 26/30] kernel6: update to openEuler 6.6.0-79.0.0 * Update kernel version to openEuler 6.6.0-79.0.0(Branch 24.03-LTS-SP1) * Revert some kernel commits to avoid bugs. See also: https://gitee.com/src-openeuler/kernel/issues/IBITRP Signed-off-by: hanzongcheng --- .oebuild/manifest.yaml | 4 +- ...rt-mm-s-rss-stats-to-use-atomic-mode.patch | 160 ++++++++++++++++++ ...unter-introduce-atomic-mode-for-perc.patch | 157 +++++++++++++++++ .../linux/linux-openeuler-rt.bb | 7 + 4 files changed, 326 insertions(+), 2 deletions(-) create mode 100644 meta-openeuler/recipes-kernel/linux/files/patches/rt/0001-Revert-mm-convert-mm-s-rss-stats-to-use-atomic-mode.patch create mode 100644 meta-openeuler/recipes-kernel/linux/files/patches/rt/0002-Revert-percpu_counter-introduce-atomic-mode-for-perc.patch diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index 5688596ccaa..65d41a77a0c 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -692,7 +692,7 @@ manifest_list: version: b88a0de017d1685cc7e2c623d6ccccde546d8405 kernel-6.6: remote_url: https://gitee.com/openeuler/kernel.git - version: 4da472bba5924d1d422b595ae7497935ee678de0 + version: 1c55f6bfe09f0d2a0cda7221acd6588597f86b18 keyboard-handler: remote_url: https://gitee.com/src-openeuler/keyboard_handler.git version: 9e23d217271f05919ca26d3e6677dac075c3ab1e @@ -1907,7 +1907,7 @@ manifest_list: version: df4bedc9b7a3ae34a31276342a0a7bdd6196d24d src-kernel-6.6: remote_url: https://gitee.com/src-openeuler/kernel.git - version: dc6a8d5811cf90ddfd98d8d1cc0b1bb40c927943 + version: f575fef8c7887537f74f38f9b6f1b19d040236cf src-kernel-6.6-tag-phytium: remote_url: https://gitee.com/src-openeuler/kernel.git version: dc6a8d5811cf90ddfd98d8d1cc0b1bb40c927943 diff --git a/meta-openeuler/recipes-kernel/linux/files/patches/rt/0001-Revert-mm-convert-mm-s-rss-stats-to-use-atomic-mode.patch b/meta-openeuler/recipes-kernel/linux/files/patches/rt/0001-Revert-mm-convert-mm-s-rss-stats-to-use-atomic-mode.patch new file mode 100644 index 00000000000..20e0964fb75 --- /dev/null +++ b/meta-openeuler/recipes-kernel/linux/files/patches/rt/0001-Revert-mm-convert-mm-s-rss-stats-to-use-atomic-mode.patch @@ -0,0 +1,160 @@ +From 0499beb597907174e77b6740a9bf00fdbf1ba0bf Mon Sep 17 00:00:00 2001 +From: hanzongcheng +Date: Thu, 6 Mar 2025 16:41:49 +0800 +Subject: [PATCH 1/2] Revert "mm: convert mm's rss stats to use atomic mode" + +This reverts commit c333c44449530463d06fb3feb9e50959aed06061. + +diff --git a/include/linux/mm.h b/include/linux/mm.h +index 2e6ef9532fc3..552154963c35 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -2630,66 +2630,30 @@ static inline bool get_user_page_fast_only(unsigned long addr, + */ + static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) + { +- struct percpu_counter *fbc = &mm->rss_stat[member]; +- +- if (percpu_counter_initialized(fbc)) +- return percpu_counter_read_positive(fbc); +- +- return percpu_counter_atomic_read(fbc); ++ return percpu_counter_read_positive(&mm->rss_stat[member]); + } + + void mm_trace_rss_stat(struct mm_struct *mm, int member); + + static inline void add_mm_counter(struct mm_struct *mm, int member, long value) + { +- struct percpu_counter *fbc = &mm->rss_stat[member]; +- +- if (percpu_counter_initialized(fbc)) +- percpu_counter_add(fbc, value); +- else +- percpu_counter_atomic_add(fbc, value); ++ percpu_counter_add(&mm->rss_stat[member], value); + + mm_trace_rss_stat(mm, member); + } + + static inline void inc_mm_counter(struct mm_struct *mm, int member) + { +- add_mm_counter(mm, member, 1); +-} +- +-static inline void dec_mm_counter(struct mm_struct *mm, int member) +-{ +- add_mm_counter(mm, member, -1); +-} +- +-static inline s64 mm_counter_sum(struct mm_struct *mm, int member) +-{ +- struct percpu_counter *fbc = &mm->rss_stat[member]; ++ percpu_counter_inc(&mm->rss_stat[member]); + +- if (percpu_counter_initialized(fbc)) +- return percpu_counter_sum(fbc); +- +- return percpu_counter_atomic_read(fbc); +-} +- +-static inline s64 mm_counter_sum_positive(struct mm_struct *mm, int member) +-{ +- struct percpu_counter *fbc = &mm->rss_stat[member]; +- +- if (percpu_counter_initialized(fbc)) +- return percpu_counter_sum_positive(fbc); +- +- return percpu_counter_atomic_read(fbc); ++ mm_trace_rss_stat(mm, member); + } + +-static inline int mm_counter_switch_to_pcpu(struct mm_struct *mm) ++static inline void dec_mm_counter(struct mm_struct *mm, int member) + { +- return percpu_counter_switch_to_pcpu_many(mm->rss_stat, NR_MM_COUNTERS); +-} ++ percpu_counter_dec(&mm->rss_stat[member]); + +-static inline void mm_counter_destroy(struct mm_struct *mm) +-{ +- percpu_counter_destroy_many(mm->rss_stat, NR_MM_COUNTERS); ++ mm_trace_rss_stat(mm, member); + } + + /* Optimized variant when folio is already known not to be anon */ +diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h +index a4e40ae6a8c8..6e62cc64cd92 100644 +--- a/include/trace/events/kmem.h ++++ b/include/trace/events/kmem.h +@@ -399,8 +399,8 @@ TRACE_EVENT(rss_stat, + __entry->mm_id = mm_ptr_to_hash(mm); + __entry->curr = !!(current->mm == mm); + __entry->member = member; +- __entry->size = (mm_counter_sum_positive(mm, member) +- << PAGE_SHIFT); ++ __entry->size = (percpu_counter_sum_positive(&mm->rss_stat[member]) ++ << PAGE_SHIFT); + ), + + TP_printk("mm_id=%u curr=%d type=%s size=%ldB", +diff --git a/kernel/fork.c b/kernel/fork.c +index f30b24c68442..e709419299c6 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -858,7 +858,7 @@ static void check_mm(struct mm_struct *mm) + "Please make sure 'struct resident_page_types[]' is updated as well"); + + for (i = 0; i < NR_MM_COUNTERS; i++) { +- long x = mm_counter_sum(mm, i); ++ long x = percpu_counter_sum(&mm->rss_stat[i]); + + if (unlikely(x)) + pr_alert("BUG: Bad rss-counter state mm:%p type:%s val:%ld\n", +@@ -959,7 +959,7 @@ void __mmdrop(struct mm_struct *mm) + put_user_ns(mm->user_ns); + mm_pasid_drop(mm); + mm_destroy_cid(mm); +- mm_counter_destroy(mm); ++ percpu_counter_destroy_many(mm->rss_stat, NR_MM_COUNTERS); + + free_mm(mm); + } +@@ -1371,11 +1371,17 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, + if (mm_alloc_cid(mm)) + goto fail_cid; + ++ if (percpu_counter_init_many(mm->rss_stat, 0, GFP_KERNEL_ACCOUNT, ++ NR_MM_COUNTERS)) ++ goto fail_pcpu; ++ + sp_init_mm(mm); + mm->user_ns = get_user_ns(user_ns); + lru_gen_init_mm(mm); + return mm; + ++fail_pcpu: ++ mm_destroy_cid(mm); + fail_cid: + destroy_context(mm); + fail_nocontext: +@@ -1791,16 +1797,6 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) + if (!oldmm) + return 0; + +- /* +- * For single-thread processes, rss_stat is in atomic mode, which +- * reduces the memory consumption and performance regression caused by +- * using percpu. For multiple-thread processes, rss_stat is switched to +- * the percpu mode to reduce the error margin. +- */ +- if (clone_flags & CLONE_THREAD) +- if (mm_counter_switch_to_pcpu(oldmm)) +- return -ENOMEM; +- + if (clone_flags & CLONE_VM) { + mmget(oldmm); + mm = oldmm; +-- +2.34.1 + diff --git a/meta-openeuler/recipes-kernel/linux/files/patches/rt/0002-Revert-percpu_counter-introduce-atomic-mode-for-perc.patch b/meta-openeuler/recipes-kernel/linux/files/patches/rt/0002-Revert-percpu_counter-introduce-atomic-mode-for-perc.patch new file mode 100644 index 00000000000..b9daa5edf02 --- /dev/null +++ b/meta-openeuler/recipes-kernel/linux/files/patches/rt/0002-Revert-percpu_counter-introduce-atomic-mode-for-perc.patch @@ -0,0 +1,157 @@ +From cde9fbe05f93632ff7ae372530529748299f3ce4 Mon Sep 17 00:00:00 2001 +From: hanzongcheng +Date: Thu, 6 Mar 2025 16:44:38 +0800 +Subject: [PATCH 2/2] Revert "percpu_counter: introduce atomic mode for + percpu_counter" + +This reverts commit 69381c36f1ac06079e7a27999503d6b1ceb10c09. + +diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h +index c50716df9fa3..8cb7c071bd5c 100644 +--- a/include/linux/percpu_counter.h ++++ b/include/linux/percpu_counter.h +@@ -21,18 +21,7 @@ + + struct percpu_counter { + raw_spinlock_t lock; +- /* +- * Depending on whether counters is NULL, we can support two modes, +- * atomic mode using count_atomic and perpcu mode using count. +- * The single-thread processes should use atomic mode to reduce the +- * memory consumption and performance regression. +- * The multiple-thread processes should use percpu mode to reduce the +- * error margin. +- */ +- union { +- s64 count; +- atomic64_t count_atomic; +- }; ++ s64 count; + #ifdef CONFIG_HOTPLUG_CPU + struct list_head list; /* All percpu_counters are on a list */ + #endif +@@ -43,14 +32,14 @@ extern int percpu_counter_batch; + + int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount, + gfp_t gfp, u32 nr_counters, +- struct lock_class_key *key, bool switch_mode); ++ struct lock_class_key *key); + + #define percpu_counter_init_many(fbc, value, gfp, nr_counters) \ + ({ \ + static struct lock_class_key __key; \ + \ + __percpu_counter_init_many(fbc, value, gfp, nr_counters,\ +- &__key, false); \ ++ &__key); \ + }) + + +@@ -141,20 +130,6 @@ static inline bool percpu_counter_initialized(struct percpu_counter *fbc) + return (fbc->counters != NULL); + } + +-static inline s64 percpu_counter_atomic_read(struct percpu_counter *fbc) +-{ +- return atomic64_read(&fbc->count_atomic); +-} +- +-static inline void percpu_counter_atomic_add(struct percpu_counter *fbc, +- s64 amount) +-{ +- atomic64_add(amount, &fbc->count_atomic); +-} +- +-int percpu_counter_switch_to_pcpu_many(struct percpu_counter *fbc, +- u32 nr_counters); +- + #else /* !CONFIG_SMP */ + + struct percpu_counter { +@@ -278,23 +253,6 @@ static inline bool percpu_counter_initialized(struct percpu_counter *fbc) + static inline void percpu_counter_sync(struct percpu_counter *fbc) + { + } +- +-static inline s64 percpu_counter_atomic_read(struct percpu_counter *fbc) +-{ +- return fbc->count; +-} +- +-static inline void percpu_counter_atomic_add(struct percpu_counter *fbc, +- s64 amount) +-{ +- percpu_counter_add(fbc, amount); +-} +- +-static inline int percpu_counter_switch_to_pcpu_many(struct percpu_counter *fbc, +- u32 nr_counters) +-{ +- return 0; +-} + #endif /* CONFIG_SMP */ + + static inline void percpu_counter_inc(struct percpu_counter *fbc) +diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c +index fb30d739f4b5..58a3392f471b 100644 +--- a/lib/percpu_counter.c ++++ b/lib/percpu_counter.c +@@ -153,7 +153,7 @@ EXPORT_SYMBOL(__percpu_counter_sum); + + int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount, + gfp_t gfp, u32 nr_counters, +- struct lock_class_key *key, bool switch_mode) ++ struct lock_class_key *key) + { + unsigned long flags __maybe_unused; + size_t counter_size; +@@ -174,8 +174,7 @@ int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount, + #ifdef CONFIG_HOTPLUG_CPU + INIT_LIST_HEAD(&fbc[i].list); + #endif +- if (likely(!switch_mode)) +- fbc[i].count = amount; ++ fbc[i].count = amount; + fbc[i].counters = (void *)counters + (i * counter_size); + + debug_percpu_counter_activate(&fbc[i]); +@@ -332,36 +331,6 @@ bool __percpu_counter_limited_add(struct percpu_counter *fbc, + return good; + } + +-/* +- * percpu_counter_switch_to_pcpu_many: Converts struct percpu_counters from +- * atomic mode to percpu mode. +- * +- * Return: 0 if percpu_counter is already in atomic mode or successfully +- * switched to atomic mode; -ENOMEM if perpcu memory allocation fails, +- * perpcu_counter is still in atomic mode. +- */ +-int percpu_counter_switch_to_pcpu_many(struct percpu_counter *fbc, +- u32 nr_counters) +-{ +- static struct lock_class_key __key; +- unsigned long flags; +- bool ret = 0; +- +- if (percpu_counter_initialized(fbc)) +- return 0; +- +- preempt_disable(); +- local_irq_save(flags); +- if (likely(!percpu_counter_initialized(fbc))) +- ret = __percpu_counter_init_many(fbc, 0, +- GFP_ATOMIC|__GFP_NOWARN|__GFP_ZERO, +- nr_counters, &__key, true); +- local_irq_restore(flags); +- preempt_enable(); +- +- return ret; +-} +- + static int __init percpu_counter_startup(void) + { + int ret; +-- +2.34.1 + diff --git a/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb b/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb index 64dce8b29a8..7c666ae2922 100644 --- a/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb +++ b/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb @@ -20,6 +20,13 @@ SRC_URI:append:x86-64 = " \ ', d)} \ " +SRC_URI:append = " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'kernel6', ' \ + file://patches/rt/0001-Revert-mm-convert-mm-s-rss-stats-to-use-atomic-mode.patch \ + file://patches/rt/0002-Revert-percpu_counter-introduce-atomic-mode-for-perc.patch \ + ', '', d)} \ +" + COMPATIBLE_MACHINE = "qemu-aarch64|generic-x86-64" ## Preempt-RT -- Gitee From 3d64e2bb65d7c9f65dfca1ea6c8f2537552a4f98 Mon Sep 17 00:00:00 2001 From: hanzongcheng Date: Wed, 12 Mar 2025 18:15:40 +0800 Subject: [PATCH 27/30] kp920: add rt.cfg to improve real-time performance * add rt.cfg for kp920 to improve real-time performance. Signed-off-by: hanzongcheng --- .../linux/files/cfg-fragments/rt.cfg | 27 +++++++++++++++++++ .../linux/linux-openeuler-rt.bbappend | 2 ++ .../linux/linux-openeuler-rt.bb | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 bsp/meta-kunpeng/recipes-kernel/linux/files/cfg-fragments/rt.cfg diff --git a/bsp/meta-kunpeng/recipes-kernel/linux/files/cfg-fragments/rt.cfg b/bsp/meta-kunpeng/recipes-kernel/linux/files/cfg-fragments/rt.cfg new file mode 100644 index 00000000000..96710daef4a --- /dev/null +++ b/bsp/meta-kunpeng/recipes-kernel/linux/files/cfg-fragments/rt.cfg @@ -0,0 +1,27 @@ +# +# Modify some kernel configs to improve real-time performance +# +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_FULL=y +CONFIG_HZ_1000=y +CONFIG_CPU_ISOLATION=y +# CONFIG_PCIEASPM is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y + +# CONFIG_ARM64_NMI is not set +# CONFIG_IPI_AS_NMI is not set + +# +# CGROUP +# +# CONFIG_QOS_SCHED_MULTILEVEL is not set +# CONFIG_QOS_SCHED_DYNAMIC_AFFINITY is not set +# CONFIG_QOS_SCHED_SMART_GRID is not set + +# +# Memory Management +# +# CONFIG_NUMA_BALANCING is not set +# CONFIG_KSM is not set +# CONFIG_TRANSPARENT_HUGEPAGE is not set diff --git a/bsp/meta-kunpeng/recipes-kernel/linux/linux-openeuler-rt.bbappend b/bsp/meta-kunpeng/recipes-kernel/linux/linux-openeuler-rt.bbappend index b09bcc7227d..11192036a94 100644 --- a/bsp/meta-kunpeng/recipes-kernel/linux/linux-openeuler-rt.bbappend +++ b/bsp/meta-kunpeng/recipes-kernel/linux/linux-openeuler-rt.bbappend @@ -1 +1,3 @@ require recipes-kernel/linux/linux-kp920.inc + +SRC_URI += "file://cfg-fragments/rt.cfg" diff --git a/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb b/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb index 7c666ae2922..16e33cf532c 100644 --- a/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb +++ b/meta-openeuler/recipes-kernel/linux/linux-openeuler-rt.bb @@ -30,4 +30,4 @@ SRC_URI:append = " \ COMPATIBLE_MACHINE = "qemu-aarch64|generic-x86-64" ## Preempt-RT -KERNEL_FEATURES:append = "features/preempt-rt/preempt-rt.scc" +KERNEL_FEATURES:append = " features/preempt-rt/preempt-rt.scc" -- Gitee From 4c5ab0080e0cbd36126a7ae23aa66d8d17067c1a Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Sat, 15 Mar 2025 14:49:21 +0800 Subject: [PATCH 28/30] kernel-module: kernel-module-overlay is for container kernel-module-overlay is required for container feature, like isuald. make it conditional to avoid errors when kernel-module-overlay does not exsit. Signed-off-by: Wayne Ren --- .../conf/machine/include/kernel-modules-conf/common.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-openeuler/conf/machine/include/kernel-modules-conf/common.inc b/meta-openeuler/conf/machine/include/kernel-modules-conf/common.inc index 93535b18ae2..f6dc5bc212f 100644 --- a/meta-openeuler/conf/machine/include/kernel-modules-conf/common.inc +++ b/meta-openeuler/conf/machine/include/kernel-modules-conf/common.inc @@ -1,5 +1,5 @@ INSTALLMODULES = " \ -kernel-module-overlay \ +${@bb.utils.contains('DISTRO_FEATURES', 'isulad', 'kernel-module-overlay', '', d)} \ kernel-module-8021q \ kernel-module-ext2 \ kernel-module-inet-diag \ -- Gitee From c7809de5c6f3e62a3da62a57d313e08eea8058b3 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Sat, 15 Mar 2025 14:52:30 +0800 Subject: [PATCH 29/30] openeuler: prepare to override kernel-module-split bbclass prepare to override kernel-module-split bbclass of yocto-poky Signed-off-by: Wayne Ren --- .../classes/kernel-module-split.bbclass | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 meta-openeuler/classes/kernel-module-split.bbclass diff --git a/meta-openeuler/classes/kernel-module-split.bbclass b/meta-openeuler/classes/kernel-module-split.bbclass new file mode 100644 index 00000000000..a29c294810e --- /dev/null +++ b/meta-openeuler/classes/kernel-module-split.bbclass @@ -0,0 +1,191 @@ +pkg_postinst:modules () { +if [ -z "$D" ]; then + depmod -a ${KERNEL_VERSION} +else + # image.bbclass will call depmodwrapper after everything is installed, + # no need to do it here as well + : +fi +} + +pkg_postrm:modules () { +if [ -z "$D" ]; then + depmod -a ${KERNEL_VERSION} +else + depmodwrapper -a -b $D ${KERNEL_VERSION} +fi +} + +autoload_postinst_fragment() { +if [ x"$D" = "x" ]; then + modprobe %s || true +fi +} + +PACKAGE_WRITE_DEPS += "kmod-native depmodwrapper-cross" + +do_install:append() { + install -d ${D}${sysconfdir}/modules-load.d/ ${D}${sysconfdir}/modprobe.d/ +} + +KERNEL_SPLIT_MODULES ?= "1" +PACKAGESPLITFUNCS:prepend = "split_kernel_module_packages " + +KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-modules" + +KERNEL_MODULE_PACKAGE_PREFIX ?= "" +KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}" +KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1" + +python split_kernel_module_packages () { + import re + + modinfoexp = re.compile("([^=]+)=(.*)") + + def extract_modinfo(file): + import tempfile, subprocess + tempfile.tempdir = d.getVar("WORKDIR") + compressed = re.match( r'.*\.(gz|xz|zst)$', file) + tf = tempfile.mkstemp() + tmpfile = tf[1] + if compressed: + tmpkofile = tmpfile + ".ko" + if compressed.group(1) == 'gz': + cmd = "gunzip -dc %s > %s" % (file, tmpkofile) + subprocess.check_call(cmd, shell=True) + elif compressed.group(1) == 'xz': + cmd = "xz -dc %s > %s" % (file, tmpkofile) + subprocess.check_call(cmd, shell=True) + elif compressed.group(1) == 'zst': + cmd = "zstd -dc %s > %s" % (file, tmpkofile) + subprocess.check_call(cmd, shell=True) + else: + msg = "Cannot decompress '%s'" % file + raise msg + cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", tmpkofile, tmpfile) + else: + cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile) + subprocess.check_call(cmd, shell=True) + # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'ö') + f = open(tmpfile, errors='replace') + l = f.read().split("\000") + f.close() + os.close(tf[0]) + os.unlink(tmpfile) + if compressed: + os.unlink(tmpkofile) + vals = {} + for i in l: + m = modinfoexp.match(i) + if not m: + continue + vals[m.group(1)] = m.group(2) + return vals + + def frob_metadata(file, pkg, pattern, format, basename): + vals = extract_modinfo(file) + + dvar = d.getVar('PKGD') + + # If autoloading is requested, output /etc/modules-load.d/.conf and append + # appropriate modprobe commands to the postinst + autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split() + autoload = d.getVar('module_autoload_%s' % basename) + if autoload and autoload == basename: + bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename) + if autoload and basename not in autoloadlist: + bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename)) + if basename in autoloadlist: + name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename) + f = open(name, 'w') + if autoload: + for m in autoload.split(): + f.write('%s\n' % m) + else: + f.write('%s\n' % basename) + f.close() + postinst = d.getVar('pkg_postinst:%s' % pkg) + if not postinst: + bb.fatal("pkg_postinst:%s not defined" % pkg) + postinst += d.getVar('autoload_postinst_fragment') % (autoload or basename) + d.setVar('pkg_postinst:%s' % pkg, postinst) + + # Write out any modconf fragment + modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split() + modconf = d.getVar('module_conf_%s' % basename) + if modconf and basename in modconflist: + name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) + f = open(name, 'w') + f.write("%s\n" % modconf) + f.close() + elif modconf: + bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename)) + + files = d.getVar('FILES:%s' % pkg) + files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) + d.setVar('FILES:%s' % pkg, files) + + conffiles = d.getVar('CONFFILES:%s' % pkg) + conffiles = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (conffiles, basename, basename) + d.setVar('CONFFILES:%s' % pkg, conffiles) + + if "description" in vals: + old_desc = d.getVar('DESCRIPTION:' + pkg) or "" + d.setVar('DESCRIPTION:' + pkg, old_desc + "; " + vals["description"]) + + rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "") + modinfo_deps = [] + if "depends" in vals and vals["depends"] != "": + for dep in vals["depends"].split(","): + on = legitimize_package_name(dep) + dependency_pkg = format % on + modinfo_deps.append(dependency_pkg) + for dep in modinfo_deps: + if not dep in rdepends: + rdepends[dep] = [] + d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False)) + + # Avoid automatic -dev recommendations for modules ending with -dev. + d.setVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs', 1) + + # Provide virtual package without postfix + providevirt = d.getVar('KERNEL_MODULE_PROVIDE_VIRTUAL') + if providevirt == "1": + postfix = format.split('%s')[1] + d.setVar('RPROVIDES:' + pkg, pkg.replace(postfix, '')) + + kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" + kernel_version = d.getVar("KERNEL_VERSION") + + metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE') + splitmods = d.getVar('KERNEL_SPLIT_MODULES') + postinst = d.getVar('pkg_postinst:modules') + postrm = d.getVar('pkg_postrm:modules') + + if splitmods != '1': + etcdir = d.getVar('sysconfdir') + d.appendVar('FILES:' + metapkg, '%s/modules-load.d/ %s/modprobe.d/ %s/modules/' % (etcdir, etcdir, d.getVar("nonarch_base_libdir"))) + d.appendVar('pkg_postinst:%s' % metapkg, postinst) + d.prependVar('pkg_postrm:%s' % metapkg, postrm); + return + + module_regex = r'^(.*)\.k?o(?:\.(gz|xz|zst))?$' + + module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX') + module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') + module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix + + modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version)) + if modules: + d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules)) + + # If modules-load.d and modprobe.d are empty at this point, remove them to + # avoid warnings. removedirs only raises an OSError if an empty + # directory cannot be removed. + dvar = d.getVar('PKGD') + for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]: + if len(os.listdir(dir)) == 0: + os.rmdir(dir) +} + +do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()))}' -- Gitee From a453dfc5e8b56ceed1ad612322ee6f15345e4c32 Mon Sep 17 00:00:00 2001 From: Wayne Ren Date: Sat, 15 Mar 2025 14:54:30 +0800 Subject: [PATCH 30/30] kernel-module-split: use a better way for KERNEL_MODULE_AUTOLOAD * delete the related codes in linux-openeuler.inc * do the same thing kernel-module-split.bbclass through a better way * make it distro wide, not only for linux-openeuler Signed-off-by: Wayne Ren --- .../classes/kernel-module-split.bbclass | 5 ++- .../recipes-kernel/linux/linux-openeuler.inc | 36 ------------------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/meta-openeuler/classes/kernel-module-split.bbclass b/meta-openeuler/classes/kernel-module-split.bbclass index a29c294810e..7fa1ad39026 100644 --- a/meta-openeuler/classes/kernel-module-split.bbclass +++ b/meta-openeuler/classes/kernel-module-split.bbclass @@ -95,7 +95,10 @@ python split_kernel_module_packages () { bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename) if autoload and basename not in autoloadlist: bb.warn("module_autoload_%s is defined but '%s' isn't included in KERNEL_MODULE_AUTOLOAD, please add it there" % (basename, basename)) - if basename in autoloadlist: + # KERNEL_MODULE_AUTOLOAD contains kernel-module-xxx, xxx module will be autoloaded + postfix = format.split('%s')[1] + autoloadpkg = pkg.replace(postfix, '') + if basename in autoloadlist or autoloadpkg in autoloadlist: name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename) f = open(name, 'w') if autoload: diff --git a/meta-openeuler/recipes-kernel/linux/linux-openeuler.inc b/meta-openeuler/recipes-kernel/linux/linux-openeuler.inc index e3817d988e7..0bbcd6cf7e8 100644 --- a/meta-openeuler/recipes-kernel/linux/linux-openeuler.inc +++ b/meta-openeuler/recipes-kernel/linux/linux-openeuler.inc @@ -163,39 +163,3 @@ do_deploy:append() { pkg_postinst_${KERNEL_PACKAGE_NAME}-base () { : } - -# KERNEL_MODULE_AUTOLOAD need ko_basename to work, -# we make automatic conversion from pkgname to ko_basename -# then we can use pkgname in KERNEL_MODULE_AUTOLOAD -# reference 1: split_kernel_module_packages: yocto-poky/meta/classes/kernel-module-split.bbclass -# reference 2: do_split_packages: yocto-poky/meta/classes/package.bbclass -split_kernel_module_packages:prepend () { - def update_module_loadlist (): - module_regex = r'^(.*)\.k?o(?:\.[xg]z)?$' - kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" - module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX') - module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') - module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix - root = '${nonarch_base_libdir}/modules' - dvar = d.getVar('PKGD') - root = d.expand(root) - objs = [] - for walkroot, dirs, files in os.walk(dvar + root): - for file in files: - relpath = os.path.join(walkroot, file).replace(dvar + root + '/', '', 1) - if relpath: - objs.append(relpath) - for o in sorted(objs): - import re, stat - m = re.match(module_regex, os.path.basename(o)) - if not m: - continue - basename = m.group(1) - on = legitimize_package_name(basename) - pkg = module_pattern % on - if pkg in (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split(): - old_list = d.getVar("KERNEL_MODULE_AUTOLOAD") - d.setVar("KERNEL_MODULE_AUTOLOAD", "%s %s" % (old_list, basename)) - - update_module_loadlist() -} -- Gitee