diff --git a/meta-openeuler/recipes-core/images/openeuler-image.bb b/meta-openeuler/recipes-core/images/openeuler-image.bb index cf6ebebf5889e4fe8be187a85f1bc0b0659729f9..5ab642ee1d6f19478909f4c0daa4793759946814 100644 --- a/meta-openeuler/recipes-core/images/openeuler-image.bb +++ b/meta-openeuler/recipes-core/images/openeuler-image.bb @@ -46,7 +46,7 @@ RPMROOTFSDEPENDS = "" #IMAGE_ROOTFS_SIZE ?= "8192" #IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "", d)}" -OUTPUT_DIR = "${TOPDIR}/output" +OUTPUT_DIR = "${TOPDIR}/output/${DATETIME}" #No kernel-abiversion file found, cannot run depmod, aborting USE_DEPMOD = "0" @@ -57,6 +57,7 @@ kernel \ busybox \ os-base \ glibc \ +os-release \ " IMAGE_INSTALL_normal = " \ diff --git a/meta-openeuler/recipes-core/os-release/os-release.bbappend b/meta-openeuler/recipes-core/os-release/os-release.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..4aea1c31fc67d2811dbc697a02865aefa648bee0 --- /dev/null +++ b/meta-openeuler/recipes-core/os-release/os-release.bbappend @@ -0,0 +1,5 @@ +do_install_append () { + if [ "${DATETIME}" ]; then + echo ${DATETIME} > ${D}${sysconfdir}/os-revision + fi +} diff --git a/scripts/compile.sh b/scripts/compile.sh index 3c2bec0b573e4f89e1a0b4044811a5144a202bd4..1e72f691cc3f4270200cb9ed6c7bbe2b56a3cc21 100644 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -38,13 +38,13 @@ get_build_info() exit 1 fi -# show help message if no arguments + # show help message if no arguments if [ $# -eq 0 ]; then usage fi -# get the src dir which contains all src code packages, include yocto repos, linux kernel -# busybox etc.. + # get the src dir which contains all src code packages, include yocto repos, linux kernel + # busybox etc.. SRC_DIR="$(cd $(dirname "${BASH_SOURCE[0]}")/../../;pwd)" [[ -z "${BUILD_DIR}" ]] && BUILD_DIR="${SRC_DIR}/build" @@ -62,37 +62,44 @@ get_build_info() # this function sets up the yocto build environment set_env() { -# as tools like ldconfig will be used, add /usr/sbin in $PATH + # as tools like ldconfig will be used, add /usr/sbin in $PATH export PATH="/usr/sbin/:$PATH" -# set the TEMPLATECONF of yocto, make build dir and init the yocto build -# environment + # set the TEMPLATECONF of yocto, make build dir and init the yocto build + # environment TEMPLATECONF="${SRC_DIR}/yocto-meta-openeuler/meta-openeuler/conf" mkdir -p "${BUILD_DIR}" source "${SRC_DIR}"/yocto-poky/oe-init-build-env "${BUILD_DIR}" set +x -# after oe-init-build-env, will be in ${BUILD_DIR} -# set the MACHINE variable in local.conf through sed cmd + # 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 -# set the OPENUERL_SP_DIR variable + # set the OPENUERL_SP_DIR variable sed -i "s|^OPENEULER_SP_DIR .*|OPENEULER_SP_DIR = \"${SRC_DIR}\"|g" conf/local.conf -# set the OPENEULER_TOOLCHAIN_DIR_xxx variable + # set the OPENEULER_TOOLCHAIN_DIR_xxx variable if [[ -n ${TOOLCHAIN_DIR} ]];then sed -i "s|^${OPENEULER_TOOLCHAIN_DIR}.*|${OPENEULER_TOOLCHAIN_DIR} = \"${TOOLCHAIN_DIR}\"|g" conf/local.conf fi -# if raspberrypi is selected, add the layer of meta-raspberry pi + # if raspberrypi is selected, add the layer of meta-raspberry pi if echo "$MACHINE" | grep -q "^raspberrypi";then grep "meta-raspberrypi" conf/bblayers.conf |grep -qv "^[[:space:]]*#" || sed -i "/\/meta-openeuler /a \ "${SRC_DIR}"/yocto-meta-openeuler/bsp/meta-raspberrypi \\\\" conf/bblayers.conf fi -# set the correct automake command and add it into HOSTTOOLS - AUTOMAKE_V=$(ls /usr/bin/automake-1.* |awk -F "/" '{print $4}') -# if automake-1.* is not in HOSTOOLS, append it - grep -q "HOSTTOOLS .*$AUTOMAKE_V" conf/local.conf || echo "HOSTTOOLS += \"$AUTOMAKE_V\"" >> conf/local.conf - + # set the correct automake command and add it into HOSTTOOLS + # if automake-1.* is not in HOSTOOLS, append it + local automake_v=$(ls /usr/bin/automake-1.* |awk -F "/" '{print $4}') + grep -q "HOSTTOOLS .*$automake_v" conf/local.conf || echo "HOSTTOOLS += \"$automake_v\"" >> conf/local.conf + + # set DATETIME in conf/local.conf + # you can set DATETIME from environment variable or get time by date + # not reset DATETIME when rebuilt in the same directory + if [[ -z "${DATETIME}" ]];then + DATETIME="$(date +%Y%m%d%H%M%S)" + fi + grep -q "DATETIME" conf/local.conf || echo "DATETIME = \"${DATETIME}\"" >> conf/local.conf } main()