diff options
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/kernel-yocto.bbclass | 67 |
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 @@ | |||
| 1 | S = "${WORKDIR}/linux" | 1 | S = "${WORKDIR}/linux" |
| 2 | 2 | ||
| 3 | |||
| 4 | def 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 | |||
| 3 | do_patch() { | 13 | do_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 |
