summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-yocto.bbclass
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2011-12-16 12:01:46 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-06 12:11:32 +0000
commit6fc0bfdb0ffd2eae1bb8219bc8534fad85b9cfb3 (patch)
tree807214ec1fb32dc2c9304183b98bd70ae399934f /meta/classes/kernel-yocto.bbclass
parenta27ebcab80448d712c5ecec91b1f95c6de297de0 (diff)
downloadpoky-6fc0bfdb0ffd2eae1bb8219bc8534fad85b9cfb3.tar.gz
linux-yocto: use src_patches for out of tree kernel feature support
To support larger out of tree kernel features and enhanced patching schemes, this changeset modifies the linux-yocto patching routines to call the recently factored out 'src_patches' routine. Using the returned list of local URIs for all valid patches, the logic can then determine whether or not patches can be used in place, or need to be migrated and have re-usable kernel features created. The results are then fed to the existing infrastructure to be applied and commited to the tree. (From OE-Core rev: dca97bbdbfc88c91287e74eb6a3974277f1028b7) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel-yocto.bbclass')
-rw-r--r--meta/classes/kernel-yocto.bbclass67
1 files changed, 65 insertions, 2 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index f78caaf23c..1b73e6edbf 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -1,5 +1,15 @@
1S = "${WORKDIR}/linux" 1S = "${WORKDIR}/linux"
2 2
3
4def find_patches(d):
5 patches=src_patches(d)
6 patch_list=[]
7 for p in patches:
8 _, _, local, _, _, _ = bb.decodeurl(p)
9 patch_list.append(local)
10
11 return patch_list
12
3do_patch() { 13do_patch() {
4 cd ${S} 14 cd ${S}
5 if [ -f ${WORKDIR}/defconfig ]; then 15 if [ -f ${WORKDIR}/defconfig ]; then
@@ -31,14 +41,67 @@ do_patch() {
31 exit 1 41 exit 1
32 fi 42 fi
33 43
34 # updates or generates the target description 44 patches="${@" ".join(find_patches(d))}"
45
46 # This loops through all patches, and looks for directories that do
47 # not already have feature descriptions. If a directory doesn't have
48 # a feature description, we switch to the ${WORKDIR} variant of the
49 # feature (so we can write to it) and generate a feature for those
50 # patches. The generated feature will respect the patch order.
51 #
52 # By leaving source patch directories that already have .scc files
53 # as-is it means that a SRC_URI can only contain a .scc file, and all
54 # patches that the .scc references will be picked up, without having
55 # to be repeated on the SRC_URI line .. which is more intutive
56 set +e
57 patch_dirs=
58 for p in ${patches}; do
59 pdir=`dirname ${p}`
60 pname=`basename ${p}`
61 scc=`find ${pdir} -maxdepth 1 -name '*.scc'`
62 if [ -z "${scc}" ]; then
63 # there is no scc file. We need to switch to someplace that we know
64 # we can create content (the workdir)
65 workdir_subdir=`echo ${pdir} | sed "s%^.*/${PN}%%" | sed 's%^/%%'`
66 suggested_dir="${WORKDIR}/${workdir_subdir}"
67 echo ${gen_feature_dirs} | grep -q ${suggested_dir}
68 if [ $? -ne 0 ]; then
69 gen_feature_dirs="${gen_feature_dirs} ${suggested_dir}"
70 fi
71 # we call the file *.scc_tmp, so the test above will continue to find
72 # that patches from a common subdirectory don't have a scc file and
73 # they'll be placed in order, into this file. We'll rename it later.
74 echo "patch ${pname}" >> ${suggested_dir}/gen_${workdir_subdir}_desc.scc_tmp
75 else
76 suggested_dir="${pdir}"
77 fi
78 echo ${patch_dirs} | grep -q ${suggested_dir}
79 if [ $? -ne 0 ]; then
80 patch_dirs="${patch_dirs} ${suggested_dir}"
81 fi
82 done
83
84 # go through the patch directories and look for any scc feature files
85 # that were constructed above. If one is found, rename it to ".scc" so
86 # the kernel patching can see it.
87 for pdir in ${patch_dirs}; do
88 scc=`find ${pdir} -maxdepth 1 -name '*.scc_tmp'`
89 if [ -n "${scc}" ]; then
90 new_scc=`echo ${scc} | sed 's/_tmp//'`
91 mv -f ${scc} ${new_scc}
92 fi
93 done
94
95 # add any explicitly referenced features onto the end of the feature
96 # list that is passed to the kernel build scripts.
35 if [ -n "${KERNEL_FEATURES}" ]; then 97 if [ -n "${KERNEL_FEATURES}" ]; then
36 for feat in ${KERNEL_FEATURES}; do 98 for feat in ${KERNEL_FEATURES}; do
37 addon_features="$addon_features --feature $feat" 99 addon_features="$addon_features --feature $feat"
38 done 100 done
39 fi 101 fi
102 # updates or generates the target description
40 updateme --branch ${kbranch} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \ 103 updateme --branch ${kbranch} -DKDESC=${KMACHINE}:${LINUX_KERNEL_TYPE} \
41 ${addon_features} ${ARCH} ${KMACHINE} ${WORKDIR} 104 ${addon_features} ${ARCH} ${KMACHINE} ${patch_dirs}
42 if [ $? -ne 0 ]; then 105 if [ $? -ne 0 ]; then
43 echo "ERROR. Could not update ${kbranch}" 106 echo "ERROR. Could not update ${kbranch}"
44 exit 1 107 exit 1