summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/kernel-yocto.bbclass30
1 files changed, 26 insertions, 4 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index aabca789cf..ce125b4cfb 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -1,6 +1,8 @@
1S = "${WORKDIR}/linux" 1S = "${WORKDIR}/linux"
2 2
3 3
4# returns local (absolute) path names for all valid patches in the
5# src_uri
4def find_patches(d): 6def find_patches(d):
5 patches=src_patches(d) 7 patches=src_patches(d)
6 patch_list=[] 8 patch_list=[]
@@ -10,6 +12,7 @@ def find_patches(d):
10 12
11 return patch_list 13 return patch_list
12 14
15# returns all the elements from the src uri that are .scc files
13def find_sccs(d): 16def find_sccs(d):
14 sources=src_patches(d, True) 17 sources=src_patches(d, True)
15 sources_list=[] 18 sources_list=[]
@@ -20,6 +23,22 @@ def find_sccs(d):
20 23
21 return sources_list 24 return sources_list
22 25
26# this is different from find_patches, in that it returns a colon separated
27# list of <patches>:<subdir> instead of just a list of patches
28def find_urls(d):
29 patches=src_patches(d)
30 fetch = bb.fetch2.Fetch([], d)
31 patch_list=[]
32 for p in patches:
33 _, _, local, _, _, _ = bb.decodeurl(p)
34 for url in fetch.urls:
35 urldata = fetch.ud[url]
36 if urldata.localpath == local:
37 patch_list.append(local+':'+urldata.path)
38
39 return patch_list
40
41
23do_patch() { 42do_patch() {
24 cd ${S} 43 cd ${S}
25 if [ -f ${WORKDIR}/defconfig ]; then 44 if [ -f ${WORKDIR}/defconfig ]; then
@@ -51,8 +70,8 @@ do_patch() {
51 exit 1 70 exit 1
52 fi 71 fi
53 72
54 patches="${@" ".join(find_patches(d))}"
55 sccs="${@" ".join(find_sccs(d))}" 73 sccs="${@" ".join(find_sccs(d))}"
74 patches_and_dirs="${@" ".join(find_urls(d))}"
56 75
57 # This loops through all patches, and looks for directories that do 76 # This loops through all patches, and looks for directories that do
58 # not already have feature descriptions. If a directory doesn't have 77 # not already have feature descriptions. If a directory doesn't have
@@ -66,14 +85,16 @@ do_patch() {
66 # to be repeated on the SRC_URI line .. which is more intutive 85 # to be repeated on the SRC_URI line .. which is more intutive
67 set +e 86 set +e
68 patch_dirs= 87 patch_dirs=
69 for p in ${patches}; do 88 for pp in ${patches_and_dirs}; do
89 p=`echo $pp | cut -f1 -d:`
90 wp=`echo $pp | cut -f2 -d:`
70 pdir=`dirname ${p}` 91 pdir=`dirname ${p}`
71 pname=`basename ${p}` 92 pname=`basename ${p}`
72 scc=`find ${pdir} -maxdepth 1 -name '*.scc'` 93 scc=`find ${pdir} -maxdepth 1 -name '*.scc'`
73 if [ -z "${scc}" ]; then 94 if [ -z "${scc}" ]; then
74 # there is no scc file. We need to switch to someplace that we know 95 # there is no scc file. We need to switch to someplace that we know
75 # we can create content (the workdir) 96 # we can create content (the workdir)
76 workdir_subdir=`echo ${pdir} | sed "s%^.*/${PN}%%" | sed 's%^/%%'` 97 workdir_subdir=`dirname ${wp}`
77 suggested_dir="${WORKDIR}/${workdir_subdir}" 98 suggested_dir="${WORKDIR}/${workdir_subdir}"
78 echo ${gen_feature_dirs} | grep -q ${suggested_dir} 99 echo ${gen_feature_dirs} | grep -q ${suggested_dir}
79 if [ $? -ne 0 ]; then 100 if [ $? -ne 0 ]; then
@@ -82,7 +103,8 @@ do_patch() {
82 # we call the file *.scc_tmp, so the test above will continue to find 103 # we call the file *.scc_tmp, so the test above will continue to find
83 # that patches from a common subdirectory don't have a scc file and 104 # that patches from a common subdirectory don't have a scc file and
84 # they'll be placed in order, into this file. We'll rename it later. 105 # they'll be placed in order, into this file. We'll rename it later.
85 echo "patch ${pname}" >> ${suggested_dir}/gen_${workdir_subdir}_desc.scc_tmp 106 gen_feature_name="gen_`echo ${workdir_subdir} | sed 's%/%%g'`_desc.scc_tmp"
107 echo "patch ${pname}" >> ${WORKDIR}/${workdir_subdir}/${gen_feature_name}
86 else 108 else
87 suggested_dir="${pdir}" 109 suggested_dir="${pdir}"
88 fi 110 fi