diff --git a/meta-openeuler/conf/local.conf.sample b/meta-openeuler/conf/local.conf.sample index 365d342530fa806d1837cc12a7178fa3415e7646..2903a3fa4e0da4ebab0c467dfa126fd470f455a6 100644 --- a/meta-openeuler/conf/local.conf.sample +++ b/meta-openeuler/conf/local.conf.sample @@ -352,3 +352,7 @@ OPENEULER_SP_DIR = "/usr1/openeuler/src/" # openeuler_gcc_arm32le" OPENEULER_TOOLCHAIN_DIR_aarch64 = "/usr1/openeuler/gcc/openeuler_gcc_arm64le" OPENEULER_TOOLCHAIN_DIR_arm = "/usr1/openeuler/gcc/openeuler_gcc_arm32le" + +# default openeuler platform +OPENEULER_PLATFORM = "aarch64-std" +MACHINEOVERRIDES =. "${OPENEULER_PLATFORM}:" diff --git a/meta-openeuler/recipes-kernel/linux/linux-openeuler.bb b/meta-openeuler/recipes-kernel/linux/linux-openeuler.bb index c96fa978367000284c27aeb9c3c0bd3dcf07137a..ad1d01c0e302b45814de82ac678b72c1c84938ec 100644 --- a/meta-openeuler/recipes-kernel/linux/linux-openeuler.bb +++ b/meta-openeuler/recipes-kernel/linux/linux-openeuler.bb @@ -8,9 +8,16 @@ inherit kernel SRC_URI = "file://kernel-5.10 \ file://yocto-embedded-tools/config/${ARCH}/defconfig-kernel \ " +# add patches only for aarch64 SRC_URI_append_aarch64 += " \ file://yocto-embedded-tools/patches/${ARCH}/0001-arm64-add-zImage-support-for-arm64.patch \ " + +# add patches for OPENEULER_PLATFROM such as aarch64-pro +#SRC_URI_append_aarch64-pro += " \ +# file://yocto-embedded-tools/patches/${ARCH}/xxx \ +#" + S = "${WORKDIR}/kernel-5.10" LINUX_VERSION ?= "5.10" diff --git a/scripts/compile.sh b/scripts/compile.sh index 1e72f691cc3f4270200cb9ed6c7bbe2b56a3cc21..e4deab167de5f59ad3e553e023a6c45e5b6615a0 100644 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -3,19 +3,21 @@ usage() { - echo "Tip: . $(basename "${BASH_SOURCE[0]}") [BUILD_DIR] [TOOLCHAIN_DIR]" - echo " Supportted machine:" - echo " qemu-aarch64 (default)" - echo " qemu-arm" + echo "Tip: . $(basename "${BASH_SOURCE[0]}") [BUILD_DIR] [TOOLCHAIN_DIR]" + echo " Supportted PLATFORM:" + echo " aarch64-std (default)" + echo " aarch64-pro" + echo " arm-std" echo " raspberrypi4-64" echo " Build dir: /build (defaut)" echo " External toolchain dir(absoulte path):" echo " /usr1/openeuler/gcc/openeuler_gcc_arm64le (default)" + return 1 } get_build_info() { - MACHINE="$1" + PLATFORM="$1" BUILD_DIR="$2" TOOLCHAIN_DIR="$3" OPENEULER_TOOLCHAIN_DIR="OPENEULER_TOOLCHAIN_DIR_aarch64" @@ -28,19 +30,18 @@ get_build_info() THIS_SCRIPT="$(pwd)/compile.sh" if [ ! -e "$THIS_SCRIPT" ]; then echo "Error: $THIS_SCRIPT doesn't exist!" - exit 1 + return 1 fi fi if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'" >&2 - usage - exit 1 + usage || return 1 fi # show help message if no arguments if [ $# -eq 0 ]; then - usage + usage || return 1 fi # get the src dir which contains all src code packages, include yocto repos, linux kernel @@ -48,14 +49,37 @@ get_build_info() SRC_DIR="$(cd $(dirname "${BASH_SOURCE[0]}")/../../;pwd)" [[ -z "${BUILD_DIR}" ]] && BUILD_DIR="${SRC_DIR}/build" + # set MACHINE and bitbake option + BITBAKE_OPT="openeuler-image" + case $PLATFORM in + "raspberrypi4-64") + MACHINE="raspberrypi4-64" + ;; + "aarch64-std") + MACHINE="qemu-aarch64" + BITBAKE_OPT="openeuler-image openeuler-image-tiny" + ;; + "aarch64-pro") + MACHINE="qemu-aarch64" + ;; + "arm-std") + MACHINE="qemu-arm" + ;; + *) + echo "unknown platform, use aarch64-std as default" + PLATFORM="aarch64-std" + MACHINE="qemu-aarch64" + esac + + # set toolchain path case $MACHINE in "qemu-aarch64" | "raspberrypi4-64") OPENEULER_TOOLCHAIN_DIR="OPENEULER_TOOLCHAIN_DIR_aarch64";; "qemu-arm") OPENEULER_TOOLCHAIN_DIR="OPENEULER_TOOLCHAIN_DIR_arm";; *) - echo "unknown machine, use qemu-aarch64 as default" - MACHINE="qemu-aarch64";; + echo "unknown machine" + usage || return 1 esac } @@ -74,7 +98,8 @@ set_env() # after oe-init-build-env, will be in ${BUILD_DIR} # set the MACHINE variable in local.conf through sed cmd - sed -i "s|^MACHINE.*|MACHINE = \"${MACHINE}\"|g" conf/local.conf + sed -i "s|^MACHINE .*|MACHINE = \"${MACHINE}\"|g" conf/local.conf + sed -i "s|^OPENEULER_PLATFORM .*|OPENEULER_PLATFORM = \"${PLATFORM}\"|g" conf/local.conf # set the OPENUERL_SP_DIR variable sed -i "s|^OPENEULER_SP_DIR .*|OPENEULER_SP_DIR = \"${SRC_DIR}\"|g" conf/local.conf @@ -104,9 +129,9 @@ set_env() main() { - get_build_info $@ + get_build_info "$@" || return 1 set_env - echo -e "Tip: You can now run 'bitbake openeuler-image'.\n" + echo -e "Tip: You can now run 'bitbake ${BITBAKE_OPT}'.\n" } -main $@ +main "$@"