[yocto] SRCREV issue with linux-yocto-custom do_validate_branches()
Mills, Clayton
cmills at tycoint.com
Fri Apr 17 03:12:46 PDT 2015
Hi All,
I'm having a little trouble with do_validate_branches() inherited by my linux-yocto-custom.
I'm building the 3.14.28 kernel with ltsi kernel patch set applied, so was trying to set this up with a custom linux recipe in my bsp.
Pointing to a branch in my own git repo that has the patch set pre-applied.
I've got a clone of dizzy. Which I used yocto-bsp create to start my bsp layer.
But the process stops in do_validate_branches() with the following error log:
--------------------------------------------------------------------------------
DEBUG: Executing shell function do_validate_branches
usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
or: git cat-file (--batch|--batch-check) < <list_of_objects>
<type> can be one of: blob, tree, commit, tag
-t show object type
-s show object size
-e exit with zero when there's no error
-p pretty-print object's content
--textconv for blob objects, run textconv on object's content
--batch[=<format>] show info and content of objects fed from the standard input
--batch-check[=<format>]
show info about objects fed from the standard input
ERROR: is not a valid commit ID.
ERROR: The kernel source tree may be out of sync
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_validate_branches (log file is located at /opt/git/poky/build/tmp/work/mylayer-poky-linux-gnueabi/linux-yocto-custom/3.14.28+gitAUTOINC+7035c2a67d-r0/temp/log.do_validate_branches.56991)
--------------------------------------------------------------------------------
The do_validate_branches() code from kernel-yocto.bbclass is as follows...
--------------------------------------------------------------------------------
# Ensure that the branches (BSP and meta) are on the locations specified by
# their SRCREV values. If they are NOT on the right commits, the branches
# are corrected to the proper commit.
do_validate_branches() {
set +e
cd ${S}
export KMETA=${KMETA}
machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}"
machine_srcrev="${SRCREV_machine}"
# if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to
# check and we can exit early
if [ "${machine_srcrev}" = "AUTOINC" ]; then
bbnote "SRCREV validation is not required for AUTOREV"
elif [ "${machine_srcrev}" = "" ] && [ "${SRCREV}" != "AUTOINC" ]; then
# SRCREV_machine_<MACHINE> was not set. This means that a custom recipe
# that doesn't use the SRCREV_FORMAT "machine_meta" is being built. In
# this case, we need to reset to the give SRCREV before heading to patching
bbnote "custom recipe is being built, forcing SRCREV to ${SRCREV}"
force_srcrev="${SRCREV}"
else
git cat-file -t ${machine_srcrev} > /dev/null
if [ $? -ne 0 ]; then
bberror "${machine_srcrev} is not a valid commit ID."
bbfatal "The kernel source tree may be out of sync"
fi
force_srcrev=${machine_srcrev}
fi
## KMETA branch validation.
target_meta_head="${SRCREV_meta}"
if [ "${target_meta_head}" = "AUTOINC" ] || [ "${target_meta_head}" = "" ]; then
bbnote "SRCREV validation skipped for AUTOREV or empty meta branch"
else
meta_head=`git show-ref -s --heads ${KMETA}`
git cat-file -t ${target_meta_head} > /dev/null
if [ $? -ne 0 ]; then
bberror "${target_meta_head} is not a valid commit ID"
bbfatal "The kernel source tree may be out of sync"
fi
if [ "$meta_head" != "$target_meta_head" ]; then
bbnote "Setting branch ${KMETA} to ${target_meta_head}"
git branch -m ${KMETA} ${KMETA}-orig
git checkout -q -b ${KMETA} ${target_meta_head}
if [ $? -ne 0 ];then
bbfatal "Could not checkout ${KMETA} branch from known hash ${target_meta_head}"
fi
fi
fi
git checkout -q -f ${machine_branch}
if [ -n "${force_srcrev}" ]; then
# see if the branch we are about to patch has been properly reset to the defined
# SRCREV .. if not, we reset it.
branch_head=`git rev-parse HEAD`
if [ "${force_srcrev}" != "${branch_head}" ]; then
current_branch=`git rev-parse --abbrev-ref HEAD`
git branch "$current_branch-orig"
git reset --hard ${force_srcrev}
fi
fi
}
--------------------------------------------------------------------------------
It seems like the problem is...
git cat-file -t ${machine_srcrev}
But ${machine_srcrev} is an empty string when it gets to it.
My linux-yocto-custom.bb in my bsp is as follows...
--------------------------------------------------------------------------------
inherit kernel
require recipes-kernel/linux/linux-yocto.inc
SRC_URI = "git://joe_blogs@gitmaster/linux-stable.git;protocol=ssh;bareclone=1;branch=${KBRANCH}"
SRC_URI += "file://mylayer.scc \
file://mylayer.cfg \
file://mylayer-user-config.cfg \
file://mylayer-user-patches.scc \
"
KBRANCH = "v3.14.28-ltsi"
LINUX_VERSION ?= "3.14.28"
LINUX_VERSION_EXTENSION ?= "-ltsi"
SRCREV="${AUTOREV}"
PR = "r0"
PV = "${LINUX_VERSION}+git${SRCPV}"
COMPATIBLE_MACHINE_mymach = "mymach"
# prepend to do_configure()
# makes a link from the defconfig that is going to be used by
# kernel_do_configure() to the defconfig we have set up in kernel souce
do_configure_prepend () {
ln -sf "${WORKDIR}/linux-stable/arch/arm/configs/myconfig_defconfig" "${WORKDIR}/defconfig"
}
--------------------------------------------------------------------------------
My thoughts are that ${machine_srcrev}, should be ${SRCREV_machine}, which should be "AUTOINC".
Rather than the empty string it is evaluating as.
Because of the SRCREV="${AUTOREV}" line in my bsp layer linux-yocto-custom.bb.
Replacing a line in the kernel-yocto.bbclass as follows... (please excuse my self-created pseudo-diff, I'm in a rush)
- machine_srcrev="${SRCREV_machine}"
+ machine_srcrev="${@ get_machine_branch(d, "${SRCREV}" )}"
Seems make it resolve as "AUTOINC" and fix the problem.
But I would have thought that ${SRCREV_machine} should be resolving as my machine branch ${SRCREV} anyway.
So really this change shouldn't have done anything.
So I guess what I'm wondering is, what am I missing about how and where "${SRCREV_machine}" is set and how it resolves?
Any help or comments would be appreciated.
Cheers,
Clayton Mills
________________________________
This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.
More information about the yocto
mailing list