From a10409266e8b5fd84843a8e6e74a3bd1ff01d3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bernhard.rosenkraenzer.ext@huawei.com> Date: Fri, 12 Aug 2022 20:29:25 +0200 Subject: [PATCH] openharmony: Support qemuarm-efi, qemuarm64-efi and raspberrypi4-64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for qemuarm-efi, qemuarm64-efi and raspberrypi4-64 target machines, and create some symlinks to work with Oniro's filesystem layout (read-only / and writable partitions under /run/mount) Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com> --- .../openharmony/openharmony-standard_3.0.bb | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb index fc84d2dc..c1b06d3c 100644 --- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb +++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb @@ -71,9 +71,29 @@ inherit python3native gn_base ptest B = "${S}/out/ohos-arm-release" -COMPATIBLE_MACHINE = "qemuarm" - -OHOS_DEVICE_CPU_ARCH = "arm" +COMPATIBLE_MACHINE = "(qemuarm|qemuarm-efi|qemuarm64-efi|raspberrypi4-64)" + +def get_ohos_arch(d): + arch = get_musl_loader_arch(d) + if arch.startswith("aarch64"): + return "arm64" + elif arch.startswith("arm"): + return "arm" + return arch + +def get_ohos_libdir(d): + if get_ohos_arch(d).endswith("64"): + return "lib64" + else: + return "lib" + +def get_ohos_libdirs(d): + if get_ohos_arch(d).endswith("64"): + return "/system/lib64 /system/lib" + else: + return "/system/lib" + +OHOS_DEVICE_CPU_ARCH = "${@get_ohos_arch(d)}" OHOS_DEVICE_NAME = "qemuarm" OHOS_DEVICE_COMPANY = "oniro" OHOS_PRODUCT_NAME = "yocto-ohos-${OHOS_DEVICE_NAME}" @@ -157,10 +177,14 @@ do_install () { # then setup /system/lib and /system/bin symlinks to avoid breaking use of # hard-coded paths. mkdir -p ${D}/system ${D}${libdir} ${D}${bindir} - cp -r ${OHOS_PACKAGE_OUT_DIR}/system/lib/* ${D}${libdir}/ + cp -r ${OHOS_PACKAGE_OUT_DIR}/system/${@get_ohos_libdir(d)}/* ${D}${libdir}/ install -m 755 -t ${D}${bindir}/ ${OHOS_PACKAGE_OUT_DIR}/system/bin/* - ln -sfT ..${libdir} ${D}/system/lib + ln -sfT ..${libdir} ${D}/system/${@get_ohos_libdir(d)} ln -sfT ..${bindir} ${D}/system/bin + # FIXME this is not really the right thing to do, but OpenHarmony hardcodes + # /system/lib in some places and uses /system/lib64 in a few others. + # For now, this fix is sufficient. + [ "${@get_ohos_libdir(d)}" != "lib" ] && ln -s ${@get_ohos_libdir(d)} ${D}/system/lib # system ability configurations mkdir -p ${D}${libdir}/openharmony/profile @@ -180,6 +204,10 @@ do_install () { # Avoid file-conflict on /usr/bin/udevadm with //third_party/eudev and udev # recipe rm ${D}${bindir}/udevadm + + # OpenHarmony needs a writable /data, which doesn't exist in the normal + # Oniro filesystem layout - but appdata is a good match + ln -s /run/mount/appdata ${D}/data } PACKAGES =+ "${PN}-configs ${PN}-fonts" @@ -204,10 +232,12 @@ FILES:${PN}:remove = "${libdir}/${BPN}/*" FILES:${PN}-configs = "${sysconfdir}" FILES:${PN}-fonts = "${datadir}/fonts" -FILES:${PN} += "/system/bin /system/lib /system/profile" +FILES:${PN} += "/system/bin ${@get_ohos_libdirs(d)} /system/profile" FILES:${PN}-configs += "/system/etc" FILES:${PN}-fonts += "/system/fonts" +FILES:${PN} += "/data" + generate_build_config_json_file() { mkdir -p "${OHOS_PRELOADER_BUILD_CONFIG_DIR}" -- GitLab