diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2d3ed64dd7d65c0ca66ad7d5241c963685271da..35873c74fa81214a91440c2c3a0f1c08419f00fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,6 +52,8 @@ variables: # to push to git.ostc-eu.org first, and wait for the bitbake-builder image to # be pushed to the registry before starting a pipeline on gitlab.eclipse.org. BITBAKE_BUILDER: "registry.ostc-eu.org/ostc/pre-integration/meta-openharmony/bitbake-builder" + # And same for openharmony-builder + OPENHARMONY_BUILDER: "registry.ostc-eu.org/ostc/pre-integration/meta-openharmony/openharmony-builder" stages: - container @@ -160,6 +162,7 @@ stages: cache: key: bitbake-cache paths: + - build/downloads/uninative - build/mirror - build/cache - build/tmp*/cache @@ -190,11 +193,11 @@ fetch: - for DISTRO in oniro-openharmony-linux ; do for OPENHARMONY_VERSION in 3.0 3.1 ; do for MACHINE in qemuarma7 ; do - for RECIPE in oniro-openharmony-bundle openharmony-standard-image openharmony-standard-image-tests ; do + RECIPES="oniro-openharmony-bundle openharmony-standard-image openharmony-standard-image-tests" ; echo Fetching DISTRO=$DISTRO OPENHARMONY_VERSION=$OPENHARMONY_VERSION MACHINE=$MACHINE RECIPE=$RECIPE ; sed -r "s/^OPENHARMONY_VERSION.*/OPENHARMONY_VERSION = \"${OPENHARMONY_VERSION}\"/" -i conf/auto.conf ; - bitbake $RECIPE --runall=fetch ; - done ; done ; done ; done + time bitbake $RECIPES --runall=fetch ; + done ; done ; done after_script: # Copy all regular files from downloads dir (except *.done files) to # mirror dirs. Note, file is first copied to a temporary file (in same @@ -274,8 +277,10 @@ build: - build/tmp-*/deploy/sdk expire_in: 1 month -# Build OpenHarmony images using normal CI runners -test: +# Build and execute OpenHarmony test image. +# +# This will execute all included ptest test suites. +ptest: stage: test needs: - job: build @@ -319,6 +324,110 @@ build_ch: MANIFEST_FILE: manifests/gitee/ci.xml SOURCE_MIRROR_URL: $SOURCE_MIRROR_URL_CH +# URL and filename for tarball containing entire OpenHarmony OS codebase +.openharmony_tarball: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH + when: manual + # We don't really want these jobs to fail, but we don't want to block + # pipeline and dependent jobs either + allow_failure: true + before_script: + - if [ "${OPENHARMONY_VERSION}" = "3.0" ]; then + TARBALL_URL="https://repo.huaweicloud.com/harmonyos/os/3.0/code-v3.0-LTS.tar.gz"; + elif [ "${OPENHARMONY_VERSION}" = "3.0.1" ]; then + TARBALL_URL="https://repo.huaweicloud.com/harmonyos/os/3.0.1/code-v3.0.1-LTS.tar.gz"; + elif [ "${OPENHARMONY_VERSION}" = "3.0.2" ]; then + TARBALL_URL="https://repo.huaweicloud.com/harmonyos/os/3.0.2/code-v3.0.2-LTS.tar.gz"; + elif [ "${OPENHARMONY_VERSION}" = "3.0.3" ]; then + TARBALL_URL="https://repo.huaweicloud.com/harmonyos/os/3.0.3/code-v3.0.3-LTS.tar.gz"; + elif [ "${OPENHARMONY_VERSION}" = "3.1" ]; then + TARBALL_URL="https://repo.huaweicloud.com/harmonyos/os/3.1-Release/code-v3.1-Release.tar.gz"; + elif [ "${OPENHARMONY_VERSION}" = "3.1.1" ]; then + TARBALL_URL="https://repo.huaweicloud.com/harmonyos/os/3.1.1/code-v3.1.1-Release.tar.gz"; + else + echo "OPENHARMONY_VERSION=${OPENHARMONY_VERSION} is not supported"; + exit 1; + fi + - TARBALL_FILE=$(basename $TARBALL_URL) + - mkdir -p downloads + # Use runner persistent storage if available + - if [ -n "$CI_ONIRO_RUNNER_PERSISTENT_STORAGE" ] ; then + TARBALL_FILE="$CI_ONIRO_RUNNER_PERSISTENT_STORAGE/$TARBALL_FILE" ; + touch downloads/.dummy_file ; + else + TARBALL_FILE="downloads/$TARBALL_FILE" ; + fi ; + echo "Using $TARBALL_FILE" + +# Fetch OpenHarmony OS codebase. +# +# This is for use in ohos test jobs. +ohos_fetch: + stage: fetch + image: + name: $OPENHARMONY_BUILDER:$OPENHARMONY_CONTAINER_VERSION + extends: .openharmony_tarball + parallel: + matrix: + - OPENHARMONY_VERSION: ["3.0", "3.1"] + script: + # Integrity check of cached tarball + - if [ -f "${TARBALL_FILE}.sha256" -a -f "${TARBALL_FILE}" ] ; then + read tarball_sha256 _ <<<$(sha256sum "${TARBALL_FILE}") ; + read expected_sha256 _ < "${TARBALL_FILE}.sha256" ; + if [ "$tarball_sha256" = "$expected_sha256" ] ; then + echo "Using cached ${TARBALL_FILE}" ; + exit 0 ; + else + echo "Deleting bad ${TARBALL_FILE}" ; + rm -f "${TARBALL_FILE}" "${TARBALL_FILE}.sha256" ; + fi ; + elif [ -f "${TARBALL_FILE}.sha256" ] ; then + echo "Deleting ${TARBALL_FILE}.sha256" ; + rm -f "${TARBALL_FILE}.sha256" ; + fi + - pushd $(dirname $TARBALL_FILE) + # Download tarball (should continue if partial download is found + - wget --progress=dot:giga "${TARBALL_URL}" --timestamping --no-if-modified-since + # Download sha256 signature + - wget "${TARBALL_URL}.sha256" --timestamping --no-if-modified-since + - popd + - read tarball_sha256 _ <<<$(sha256sum "${TARBALL_FILE}") ; + - read expected_sha256 _ < "${TARBALL_FILE}.sha256" ; + - if [ "$tarball_sha256" != "$expected_sha256" ] ; then + echo "Deleting bad ${TARBALL_FILE}" ; + rm -f "${TARBALL_FILE}" "${TARBALL_FILE}.sha256" ; + exit 1 ; + fi + artifacts: + paths: + - downloads + expire_in: 1 month + +# Test prebuilts images against OpenHarmony OS codebase +ohos: + stage: test + needs: + - job: ohos_fetch + artifacts: true + - job: build + artifacts: true + parallel: + matrix: + - OPENHARMONY_VERSION: ["3.0", "3.1"] + PREBUILT_IMAGE: [oniro-openharmony-toolchain, oniro-openharmony-bundle] + image: + name: $OPENHARMONY_BUILDER:$OPENHARMONY_CONTAINER_VERSION + extends: .openharmony_tarball + script: + - tar xfz $TARBALL_FILE + - cd $(basename $TARBALL_FILE .tar.gz)/OpenHarmony + - ../../build/tmp-*/deploy/sdk/${PREBUILT_IMAGE}-${OPENHARMONY_VERSION}-*.sh -y -d oniro + - ./oniro/setup.sh + - ./build.sh --product-name Hi3516DV300 + # Job for triggering a prune of the sstate-cache mirror in runner persistent # storage. This should be done periodically, but as I believe it removes a # bit too much, not too often. And a complete rebuild is done also, to refill diff --git a/.gitlab-ci/container.yml b/.gitlab-ci/container.yml index e7dc3f5cec54272acbc0f66dfe6912ee7fd4bea8..99d76e8f5efa1a16a79577eaca0ec6f1d7cbb25d 100644 --- a/.gitlab-ci/container.yml +++ b/.gitlab-ci/container.yml @@ -15,6 +15,7 @@ variables: BITBAKE_CONTAINER_VERSION: "0.6" + OPENHARMONY_CONTAINER_VERSION: "0.1" .kaniko: stage: container @@ -83,3 +84,21 @@ bitbake-toolbox: needs: - job: bitbake-builder artifacts: false + +openharmony-builder: + extends: .kaniko + variables: + CONTAINER_NAME: openharmony-builder + CONTAINER_VERSION: $OPENHARMONY_CONTAINER_VERSION + +openharmony-toolbox: + extends: .kaniko + variables: + CONTAINER_NAME: openharmony-toolbox + CONTAINER_VERSION: $OPENHARMONY_CONTAINER_VERSION + CONTAINER_PATH: openharmony-builder + CONTAINER_DOCKERFILE: Dockerfile.toolbox + CONTAINER_FROM: openharmony-builder + needs: + - job: openharmony-builder + artifacts: false diff --git a/.gitlab-ci/container/openharmony-builder/.gitconfig b/.gitlab-ci/container/openharmony-builder/.gitconfig new file mode 100644 index 0000000000000000000000000000000000000000..82716b8acd9cbfc9af687601f184c2cc414a15ec --- /dev/null +++ b/.gitlab-ci/container/openharmony-builder/.gitconfig @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2021 Huawei Inc. +# SPDX-License-Identifier: Apache-2.0 + +[user] + name = OSTC Builder + email = ostc-builder@example.org diff --git a/.gitlab-ci/container/openharmony-builder/Dockerfile b/.gitlab-ci/container/openharmony-builder/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b3606cebd9d00692179ab5d9e6eac110cb59ac82 --- /dev/null +++ b/.gitlab-ci/container/openharmony-builder/Dockerfile @@ -0,0 +1,108 @@ +# Copyright 2021 Huawei Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +# This builds a container image for use in building OpenHarmony images, +# following the build system specification in +# https://repo.huaweicloud.com/harmonyos/os/2.0/tool_chain/Standard_System.md + +FROM ubuntu:18.04 + +ARG DEBIAN_FRONTEND="noninteractive" + +RUN apt-get update -qq \ + && apt-get install -qq -y \ + bash locales \ + apt-utils vim software-properties-common openssh-server iputils-ping \ + curl net-tools bsdmainutils kmod bc rsync gawk ssh ccache zip python-dev \ + make m4 gcc-multilib ca-certificates-java unzip python3-yaml perl \ + openssl libssl1.1 gnupg xsltproc x11proto-core-dev tcl python3-crypto \ + python-crypto libxml2-utils libxml2-dev libx11-dev libssl-dev \ + libgl1-mesa-dev lib32z1-dev lib32ncurses5-dev g++-multilib flex bison \ + doxygen git subversion tofrodos pigz expect python3-xlrd python-xlrd \ + git-core gperf build-essential zlib1g-dev libc6-dev-i386 lib32z-dev \ + openjdk-8-jdk \ + ruby cpio \ + && apt-get clean && rm -rf /var/lib/apt/lists/* +RUN locale-gen + +# Let's just have /bin/sh as bash +RUN echo "dash dash/sh boolean false" | debconf-set-selections \ + && dpkg-reconfigure dash + +# For some reason for containers built using kaniko ping errors with: +# `permission denied` for user other than root. Even running container in +# privileged mode doesn't help for non-root user. Most probably it is related +# to this issue: https://github.com/GoogleContainerTools/kaniko/issues/1851 +# ping is required by Yocto testing machinery and therefore temporarily setting +# suid to get it working +RUN chmod u+s $(command -v ping) + +RUN apt-get update -qq \ + && apt-get install -qq -y python3.8 python3-pip \ + && apt-get clean && rm -rf /var/lib/apt/lists/* +RUN update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2 \ + && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 3 \ + && update-alternatives --install /usr/bin/python python /usr/bin/python3.8 4 \ + && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2 \ + && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 +RUN pip3 install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple setuptools \ + && pip3 install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple kconfiglib \ + && pip3 install --trusted-host mirrors.aliyun.com -i http://mirrors.aliyun.com/pypi/simple pycryptodome \ + && pip3 install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple ecdsa \ + && python3 -m pip install ohos-build==0.4.6 + +RUN mkdir -p /opt/harmonyos +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz \ + && tar xf /opt/harmonyos/llvm.tar.gz -C /opt/harmonyos \ + && rm /opt/harmonyos/llvm.tar.gz +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar \ + && tar xf /opt/harmonyos/hc-gen-0.65-linux.tar -C /opt/harmonyos \ + && rm /opt/harmonyos/hc-gen-0.65-linux.tar +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz \ + && tar xf /opt/harmonyos/gcc_riscv32-linux-7.3.0.tar.gz -C /opt/harmonyos \ + && rm /opt/harmonyos/gcc_riscv32-linux-7.3.0.tar.gz +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar \ + && tar xf /opt/harmonyos/ninja.1.9.0.tar -C /opt/harmonyos \ + && rm /opt/harmonyos/ninja.1.9.0.tar +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz \ + && tar xf /opt/harmonyos/gn-linux-x86-1717.tar.gz -C /opt/harmonyos \ + && rm /opt/harmonyos/gn-linux-x86-1717.tar.gz +RUN wget -q -P /opt/harmonyos https://mirrors.huaweicloud.com/nodejs/v12.20.0/node-v12.20.0-linux-x64.tar.gz \ + && tar xf /opt/harmonyos/node-v12.20.0-linux-x64.tar.gz -C /opt/harmonyos \ + && rm /opt/harmonyos/node-v12.20.0-linux-x64.tar.gz +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar +RUN wget -q -P /opt/harmonyos https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar + +RUN sed -i '$aexport PATH=/opt/harmonyos/llvm/bin:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/opt/harmonyos/hc-gen:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/opt/harmonyos/gcc_riscv32/bin:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/opt/harmonyos/ninja:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/opt/harmonyos/node-v12.20.0-linux-x64/bin:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/opt/harmonyos:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/root/.local/bin:$PATH' /root/.bashrc \ + && export PATH=/opt/harmonyos/llvm/bin:$PATH \ + && export PATH=/opt/harmonyos/hc-gen:$PATH \ + && export PATH=/opt/harmonyos/gcc_riscv32/bin:$PATH \ + && export PATH=/opt/harmonyos/ninja:$PATH \ + && export PATH=/opt/harmonyos/node-v12.20.0-linux-x64/bin:$PATH \ + && export PATH=/opt/harmonyos:$PATH \ + && export PATH=/root/.local/bin:$PATH \ + && npm install -g @ohos/hpm-cli --registry https://mirrors.huaweicloud.com/repository/npm/ + +RUN useradd --create-home --uid 1000 --shell /usr/bin/bash builder +COPY --chown=builder:builder .gitconfig /home/builder/.gitconfig +USER builder +WORKDIR /home/builder diff --git a/.gitlab-ci/container/openharmony-builder/Dockerfile.toolbox b/.gitlab-ci/container/openharmony-builder/Dockerfile.toolbox new file mode 100644 index 0000000000000000000000000000000000000000..28c69530a8d02caba5de0e974377c7b0b25d8172 --- /dev/null +++ b/.gitlab-ci/container/openharmony-builder/Dockerfile.toolbox @@ -0,0 +1,43 @@ +# Copyright 2020 Huawei Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +FROM openharmony-builder + +# Revert setup with builder user account +USER root +WORKDIR / +RUN userdel -r builder + +# Install packages needed by Toolbox +ARG DEBIAN_FRONTEND="noninteractive" +RUN apt-get update -qq \ + && apt-get install -qq -y \ + bash sudo libcap2-bin locales \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Use UTF-8 locale +RUN echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections \ + && echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections \ + && sed -i 's/^# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ + && dpkg-reconfigure locales +ENV LANG=en_US.UTF-8 + +# Allow password-less sudo +RUN echo '%sudo ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/toolbox + +LABEL com.github.containers.toolbox="true" \ + com.github.debarshiray.toolbox="true" diff --git a/.gitlab-ci/container/openharmony-builder/README.md b/.gitlab-ci/container/openharmony-builder/README.md new file mode 100644 index 0000000000000000000000000000000000000000..26e3964596ff1648ba3f25d2975d2df27d371de6 --- /dev/null +++ b/.gitlab-ci/container/openharmony-builder/README.md @@ -0,0 +1,12 @@ +<!-- +SPDX-FileCopyrightText: 2021 Huawei Inc. +SPDX-License-Identifier: Apache-2.0 +--> + +# OpenHarmony build container + +This container is intended for use in building OpenHarmony images, +following the build system specification in +https://repo.huaweicloud.com/harmonyos/os/2.0/tool_chain/Standard_System.md + +The default user is called builder, making usage of bitbake easier. diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.1/hdi-gen-compiler.patch b/recipes-openharmony/openharmony/openharmony-standard-3.1/hdi-gen-compiler.patch new file mode 100644 index 0000000000000000000000000000000000000000..0e96f15cdb9ff58cebcad32dbf8e6c8178c56f5d --- /dev/null +++ b/recipes-openharmony/openharmony/openharmony-standard-3.1/hdi-gen-compiler.patch @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //drivers/framework git repository of OpenHarmony 3.1 codebase. + +Build hdi-gen with Yocto native toolchain. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Inappropriate + +diff --git a/tools/hdi-gen/Makefile b/tools/hdi-gen/Makefile +index 033c257575dc..99e0d0ca7a0a 100644 +--- a/tools/hdi-gen/Makefile ++++ b/tools/hdi-gen/Makefile +@@ -27,9 +28,9 @@ endif + + all: + $(Q) echo start build $(TARGET) ... +- $(Q) $(MAKE) -f $(MAKE_FILE_NAME) ++ $(Q) $(MAKE) CXX=${BUILD_CXX} -f $(MAKE_FILE_NAME) + + clean: + $(Q) $(MAKE) -f $(MAKE_FILE_NAME) clean diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.1.bb b/recipes-openharmony/openharmony/openharmony-standard_3.1.bb index e40bc841a7eb6a578e9719640b7e616ba2392945..37335ccaffea3dd26dbdee6e8160a0e2d6b9bda0 100644 --- a/recipes-openharmony/openharmony/openharmony-standard_3.1.bb +++ b/recipes-openharmony/openharmony/openharmony-standard_3.1.bb @@ -48,6 +48,7 @@ SRC_URI += "file://graphic_config.patch;patchdir=${S}/foundation/graphic/standar SRC_URI += "file://camera_hal.patch;patchdir=${S}/drivers/peripheral" SRC_URI += "file://ace-js2bundle_node-path.patch;patchdir=${S}/developtools/ace-js2bundle" SRC_URI += "file://hc-gen-compiler.patch;patchdir=${S}/drivers/framework" +SRC_URI += "file://hdi-gen-compiler.patch;patchdir=${S}/drivers/framework" SRC_URI += "file://build_node-path.patch;patchdir=${S}/build" SRC_URI += "file://build_hapsigner-tool.patch;patchdir=${S}/build" SRC_URI += "file://build_packing-tool-path.patch;patchdir=${S}/build" diff --git a/recipes-openharmony/prebuilts/README.md b/recipes-openharmony/prebuilts/README.md index 18b3d8a67fdf0463f53ba4f3f0b0d5da5942d3c8..c0ac3dcf52c7c6e95b2caa8fd5992e0d4805621f 100644 --- a/recipes-openharmony/prebuilts/README.md +++ b/recipes-openharmony/prebuilts/README.md @@ -31,10 +31,10 @@ and entire git repositories! To install the `oniro-openharmony-bundle` to a clean OpenHarmony 3.0-LTS repository, you should do something like this: - tar xfz $DOWNLOADS/code-v3.0-LTS.tar.gz - cd code-v3.0-LTS/OpenHarmony - $DOWNLOADS/oniro-openharmony-bundle-cortexa7-neon-vfpv4-3.0.sh -y -d oniro - ./oniro/setup.should + tar xfz $DOWNLOADS/code-v3.1-Release.tar.gz + cd code-v3.1-Relase/OpenHarmony + $DOWNLOADS/oniro-openharmony-bundle-3.1-cortexa7-neon-vfpv4-1.99.99.sh -y -d oniro + ./oniro/setup.sh After this, you can use normal OpenHarmony build system procedures to build as usual. To build image for HiSilicon Hi3516DV300 (taurus) board: diff --git a/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc b/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc index 8f3e07603f80107b1aed1a67b7b87daa0c2ef838..e9883c246f8902395d031fdbb7b7fd18bf90af17 100644 --- a/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc +++ b/recipes-openharmony/prebuilts/oniro-openharmony-toolchain-integration-3.1.inc @@ -15,3 +15,4 @@ SRC_URI += "file://patches/foundation_graphic_standard.patch;apply=no;subdir=src SRC_URI += "file://patches/productdefine_common.patch;apply=no;subdir=src" SRC_URI += "file://patches/third_party_libevdev.patch;apply=no;subdir=src" SRC_URI += "file://patches/third_party_libusb.patch;apply=no;subdir=src" +SRC_URI += "file://patches/third_party_e2fsprogs-backports-to-3.1.patch;apply=no;subdir=src" diff --git a/recipes-openharmony/prebuilts/oniro-openharmony-toolchain.bb b/recipes-openharmony/prebuilts/oniro-openharmony-toolchain.bb index 6e90005cf51d0cdf961b0c8dfbe7aab29824dbd0..04780b7f311bbf0862d4ece3faa61a1282de4cfb 100644 --- a/recipes-openharmony/prebuilts/oniro-openharmony-toolchain.bb +++ b/recipes-openharmony/prebuilts/oniro-openharmony-toolchain.bb @@ -15,7 +15,7 @@ folders before building." inherit populate_sdk -TOOLCHAIN_OUTPUTNAME = "${PN}-${TUNE_PKGARCH}-${SDK_VERSION}" +TOOLCHAIN_OUTPUTNAME = "${PN}-${OPENHARMONY_VERSION}-${TUNE_PKGARCH}-${SDK_VERSION}" SDK_VERSION ?= "${DISTRO_VERSION}" TOOLCHAIN_HOST_TASK += "nativesdk-oniro-openharmony-toolchain-integration" diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch index ddf7e486d792c141ffd79a8cfc9ad22e0359c15b..81a6f13b02db6e951d07b1c0a92606622994a5f5 100644 --- a/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/drivers_framework.patch @@ -63,16 +63,3 @@ index 6497fab81da3..66495ef184e0 100644 { int i; struct HdfDriverEntry *driverEntry = NULL; -diff --git a/drivers/framework/tools/hdi-gen/Makefile b/drivers/framework/tools/hdi-gen/Makefile -index 033c257575dc..99e0d0ca7a0a 100644 ---- a/drivers/framework/tools/hdi-gen/Makefile -+++ b/drivers/framework/tools/hdi-gen/Makefile -@@ -27,9 +28,9 @@ endif - - all: - $(Q) echo start build $(TARGET) ... -- $(Q) $(MAKE) -f $(MAKE_FILE_NAME) -+ $(Q) $(MAKE) CXX=${BUILD_CXX} -f $(MAKE_FILE_NAME) - - clean: - $(Q) $(MAKE) -f $(MAKE_FILE_NAME) clean diff --git a/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_e2fsprogs-backports-to-3.1.patch b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_e2fsprogs-backports-to-3.1.patch new file mode 100644 index 0000000000000000000000000000000000000000..cb41b4e5bd142d05eade448d8672967d9bdfae90 --- /dev/null +++ b/recipes-openharmony/prebuilts/openharmony-3.1/patches/third_party_e2fsprogs-backports-to-3.1.patch @@ -0,0 +1,78 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Backport of fixes included in OpenHarmony-v3.1.1 release + +f1f1a3471fdf - Fix CodeCheck warning. +00663d8aab61 - static_cast size_t to int +97aa5de11e0d - Pass parameter p by reference. +6758af0c0da8 - Fix the crash problem caused by overflow in GetDacConfig. + +Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com> +Upstream-Status: Backport + +diff --git a/third_party/e2fsprogs/contrib/android/dac_config.cpp b/third_party/e2fsprogs/contrib/android/dac_config.cpp +index 422e0d52280f..1c76dfd7e7d1 100644 +--- a/third_party/e2fsprogs/contrib/android/dac_config.cpp ++++ b/third_party/e2fsprogs/contrib/android/dac_config.cpp +@@ -35,14 +35,14 @@ struct DacConfig { + string path; + + DacConfig() : uid(0), gid(0), mode(0), capabilities(0), path("") {} +- DacConfig(unsigned int m, unsigned int u, unsigned int g, uint64_t c, string p) : ++ DacConfig(unsigned int m, unsigned int u, unsigned int g, uint64_t c, const string &p) : + uid(u), + gid(g), + mode(m), + capabilities(c), + path(p) {} + +- void SetDefault(unsigned int m, unsigned int u, unsigned int g, uint64_t c, string p) ++ void SetDefault(unsigned int m, unsigned int u, unsigned int g, uint64_t c, const string &p) + { + this->uid = u; + this->gid = g; +@@ -198,33 +198,28 @@ extern "C" { + return 0; + } + +- void GetDacConfig(const char* path, int dir, char* targetOutPath, ++ void GetDacConfig(const char* path, int dir, char*, + unsigned* uid, unsigned* gid, unsigned* mode, + uint64_t* capabilities) + { +- if (path && path[0] == '/') { +- path++; +- } +- +- (void)targetOutPath; +- string str = path; +- string str2; ++ string str = (path != nullptr && *path == '/') ? path + 1 : path; + DacConfig dacConfig(00755, 0, 0, 0, ""); + + if (dir == 0) { + dacConfig.SetDefault(00644, 0, 0, 0, ""); + } + +- if (g_configMap.count(str)) { +- dacConfig = g_configMap[str]; ++ auto it = g_configMap.find(str); ++ if (it != g_configMap.end()) { ++ dacConfig = it->second; + } else if (dir == 0 && !str.empty()) { +- for (auto i = str.size() - 1; i >= 0; i--) { ++ for (int i = static_cast<int>(str.size()) - 1; i >= 0; i--) { + if (str[i] == '/') { + break; + } else { +- str2 = str.substr(0, i) + "*"; +- if (g_configMap.count(str2)) { +- dacConfig = g_configMap[str2]; ++ it = g_configMap.find(str.substr(0, i) + "*"); ++ if (it != g_configMap.end()) { ++ dacConfig = it->second; + break; + } + }