diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/classes/kernel-yocto.bbclass')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/kernel-yocto.bbclass | 152 |
1 files changed, 67 insertions, 85 deletions
diff --git a/import-layers/yocto-poky/meta/classes/kernel-yocto.bbclass b/import-layers/yocto-poky/meta/classes/kernel-yocto.bbclass index f86b3ef011..6160a29ecb 100644 --- a/import-layers/yocto-poky/meta/classes/kernel-yocto.bbclass +++ b/import-layers/yocto-poky/meta/classes/kernel-yocto.bbclass @@ -1,5 +1,7 @@ # remove tasks that modify the source tree in case externalsrc is inherited -SRCTREECOVEREDTASKS += "do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_shared_workdir do_fetch do_unpack do_patch" +SRCTREECOVEREDTASKS += "do_kernel_configme do_validate_branches do_kernel_configcheck do_kernel_checkout do_fetch do_unpack do_patch" +PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe" +PATCH_GIT_USER_NAME ?= "OpenEmbedded" # returns local (absolute) path names for all valid patches in the # src_uri @@ -119,72 +121,54 @@ do_kernel_metadata() { patches="${@" ".join(find_patches(d))}" feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}" - # add any explicitly referenced features onto the end of the feature - # list that is passed to the kernel build scripts. - if [ -n "${KERNEL_FEATURES}" ]; then - for feat in ${KERNEL_FEATURES}; do - addon_features="$addon_features --feature $feat" - done - fi - # check for feature directories/repos/branches that were part of the # SRC_URI. If they were supplied, we convert them into include directives # for the update part of the process - if [ -n "${feat_dirs}" ]; then - for f in ${feat_dirs}; do + for f in ${feat_dirs}; do if [ -d "${WORKDIR}/$f/meta" ]; then - includes="$includes -I${WORKDIR}/$f/meta" - elif [ -d "${WORKDIR}/$f" ]; then - includes="$includes -I${WORKDIR}/$f" + includes="$includes -I${WORKDIR}/$f/kernel-meta" + elif [ -d "${WORKDIR}/$f" ]; then + includes="$includes -I${WORKDIR}/$f" fi - done + done + for s in ${sccs} ${patches}; do + sdir=$(dirname $s) + includes="$includes -I${sdir}" + # if a SRC_URI passed patch or .scc has a subdir of "kernel-meta", + # then we add it to the search path + if [ -d "${sdir}/kernel-meta" ]; then + includes="$includes -I${sdir}/kernel-meta" + fi + done + + # expand kernel features into their full path equivalents + bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE}) + meta_dir=$(kgit --meta) + + # run1: pull all the configuration fragments, no matter where they come from + elements="`echo -n ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}`" + if [ -n "${elements}" ]; then + scc --force -o ${S}/${meta_dir}:cfg,meta ${includes} ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES} fi - # updates or generates the target description - updateme ${updateme_flags} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \ - ${includes} ${addon_features} ${ARCH} ${KMACHINE} ${sccs} ${patches} - if [ $? -ne 0 ]; then - bbfatal_log "Could not update ${machine_branch}" + # run2: only generate patches for elements that have been passed on the SRC_URI + elements="`echo -n ${sccs} ${patches} ${KERNEL_FEATURES}`" + if [ -n "${elements}" ]; then + scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} ${KERNEL_FEATURES} fi } do_patch() { cd ${S} - # executes and modifies the source tree as required - patchme ${KMACHINE} - if [ $? -ne 0 ]; then - bberror "Could not apply patches for ${KMACHINE}." - bbfatal_log "Patch failures can be resolved in the linux source directory ${S})" - fi - - # check to see if the specified SRCREV is reachable from the final branch. - # if it wasn't something wrong has happened, and we should error. - machine_srcrev="${SRCREV_machine}" - if [ -z "${machine_srcrev}" ]; then - # fallback to SRCREV if a non machine_meta tree is being built - machine_srcrev="${SRCREV}" - # if SRCREV cannot be reached something is wrong. - if [ -z "${machine_srcrev}" ]; then - bbfatal "Neither SRCREV_machine or SRCREV was specified!" - fi - fi - - current_branch=`git rev-parse --abbrev-ref HEAD` - machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" - if [ "${current_branch}" != "${machine_branch}" ]; then - bbwarn "After meta data application, the kernel tree branch is ${current_branch}. The" - bbwarn "SRC_URI specified branch ${machine_branch}. The branch will be forced to ${machine_branch}," - bbwarn "but this means the board meta data (.scc files) do not match the SRC_URI specification." - bbwarn "The meta data and branch ${machine_branch} should be inspected to ensure the proper" - bbwarn "kernel is being built." - git checkout -f ${machine_branch} - fi - - if [ "${machine_srcrev}" != "AUTOINC" ]; then - if ! [ "$(git rev-parse --verify ${machine_srcrev}~0)" = "$(git merge-base ${machine_srcrev} HEAD)" ]; then - bberror "SRCREV ${machine_srcrev} was specified, but is not reachable" - bbfatal "Check the BSP description for incorrect branch selection, or other errors." + check_git_config + meta_dir=$(kgit --meta) + (cd ${meta_dir}; ln -sf patch.queue series) + if [ -f "${meta_dir}/series" ]; then + kgit-s2q --gen -v --patches .kernel-meta/ + if [ $? -ne 0 ]; then + bberror "Could not apply patches for ${KMACHINE}." + bbfatal_log "Patch failures can be resolved in the linux source directory ${S})" fi fi } @@ -253,26 +237,37 @@ do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot" do_kernel_configme[dirs] += "${S} ${B}" do_kernel_configme() { - bbnote "kernel configme" - export KMETA=${KMETA} + set +e - if [ -n "${KCONFIG_MODE}" ]; then - configmeflags=${KCONFIG_MODE} - else - # If a defconfig was passed, use =n as the baseline, which is achieved - # via --allnoconfig + # translate the kconfig_mode into something that merge_config.sh + # understands + case ${KCONFIG_MODE} in + *allnoconfig) + config_flags="-n" + ;; + *alldefconfig) + config_flags="" + ;; + *) if [ -f ${WORKDIR}/defconfig ]; then - configmeflags="--allnoconfig" + config_flags="-n" fi - fi + ;; + esac cd ${S} - PATH=${PATH}:${S}/scripts/util - configme ${configmeflags} --reconfig --output ${B} ${LINUX_KERNEL_TYPE} ${KMACHINE} + + meta_dir=$(kgit --meta) + configs="$(scc --configs -o ${meta_dir})" + if [ -z "${configs}" ]; then + bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)" + fi + + CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1 if [ $? -ne 0 ]; then bbfatal_log "Could not configure ${KMACHINE}-${LINUX_KERNEL_TYPE}" fi - + echo "# Global settings from linux recipe" >> ${B}/.config echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config } @@ -290,36 +285,23 @@ python do_kernel_configcheck() { kmeta = "." + kmeta pathprefix = "export PATH=%s:%s; " % (d.getVar('PATH', True), "${S}/scripts/util/") - cmd = d.expand("cd ${S}; kconf_check -config %s/meta-series ${S} ${B}" % kmeta) + + cmd = d.expand("scc --configs -o ${S}/.kernel-meta") + ret, configs = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd)) + + cmd = d.expand("cd ${S}; kconf_check --report -o ${S}/%s/cfg/ ${B}/.config ${S} %s" % (kmeta,configs)) ret, result = oe.utils.getstatusoutput("%s%s" % (pathprefix, cmd)) config_check_visibility = int(d.getVar( "KCONF_AUDIT_LEVEL", True ) or 0) bsp_check_visibility = int(d.getVar( "KCONF_BSP_AUDIT_LEVEL", True ) or 0) # if config check visibility is non-zero, report dropped configuration values - mismatch_file = "${S}/" + kmeta + "/" + "mismatch.cfg" + mismatch_file = d.expand("${S}/%s/cfg/mismatch.txt" % kmeta) if os.path.exists(mismatch_file): if config_check_visibility: with open (mismatch_file, "r") as myfile: results = myfile.read() bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results) - - # if config check visibility is level 2 or higher, report non-hardware options - nonhw_file = "${S}/" + kmeta + "/" + "nonhw_report.cfg" - if os.path.exists(nonhw_file): - if config_check_visibility > 1: - with open (nonhw_file, "r") as myfile: - results = myfile.read() - bb.warn( "[kernel config]: BSP specified non-hw configuration:\n\n%s" % results) - - bsp_desc = "${S}/" + kmeta + "/" + "top_tgt" - if os.path.exists(bsp_desc) and bsp_check_visibility > 1: - with open (bsp_desc, "r") as myfile: - bsp_tgt = myfile.read() - m = re.match("^(.*)scratch.obj(.*)$", bsp_tgt) - if not m is None: - bb.warn( "[kernel]: An auto generated BSP description was used, this normally indicates a misconfiguration.\n" + - "Check that your machine (%s) has an associated kernel description." % "${MACHINE}" ) } # Ensure that the branches (BSP and meta) are on the locations specified by |