Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # remove tasks that modify the source tree in case externalsrc is inherited |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 2 | SRCTREECOVEREDTASKS += "do_validate_branches do_kernel_configcheck do_kernel_checkout do_fetch do_unpack do_patch" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 3 | PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe" |
| 4 | PATCH_GIT_USER_NAME ?= "OpenEmbedded" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 6 | # The distro or local.conf should set this, but if nobody cares... |
| 7 | LINUX_KERNEL_TYPE ??= "standard" |
| 8 | |
| 9 | # KMETA ?= "" |
| 10 | KBRANCH ?= "master" |
| 11 | KMACHINE ?= "${MACHINE}" |
| 12 | SRCREV_FORMAT ?= "meta_machine" |
| 13 | |
| 14 | # LEVELS: |
| 15 | # 0: no reporting |
| 16 | # 1: report options that are specified, but not in the final config |
| 17 | # 2: report options that are not hardware related, but set by a BSP |
| 18 | KCONF_AUDIT_LEVEL ?= "1" |
| 19 | KCONF_BSP_AUDIT_LEVEL ?= "0" |
| 20 | KMETA_AUDIT ?= "yes" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 21 | KMETA_AUDIT_WERROR ?= "" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | # returns local (absolute) path names for all valid patches in the |
| 24 | # src_uri |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 25 | def find_patches(d,subdir): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | patches = src_patches(d) |
| 27 | patch_list=[] |
| 28 | for p in patches: |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | _, _, local, _, _, parm = bb.fetch.decodeurl(p) |
| 30 | # if patchdir has been passed, we won't be able to apply it so skip |
| 31 | # the patch for now, and special processing happens later |
| 32 | patchdir = '' |
| 33 | if "patchdir" in parm: |
| 34 | patchdir = parm["patchdir"] |
| 35 | if subdir: |
| 36 | if subdir == patchdir: |
| 37 | patch_list.append(local) |
| 38 | else: |
| 39 | patch_list.append(local) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | |
| 41 | return patch_list |
| 42 | |
| 43 | # returns all the elements from the src uri that are .scc files |
| 44 | def find_sccs(d): |
| 45 | sources=src_patches(d, True) |
| 46 | sources_list=[] |
| 47 | for s in sources: |
| 48 | base, ext = os.path.splitext(os.path.basename(s)) |
| 49 | if ext and ext in [".scc", ".cfg"]: |
| 50 | sources_list.append(s) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 51 | elif base and 'defconfig' in base: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | sources_list.append(s) |
| 53 | |
| 54 | return sources_list |
| 55 | |
| 56 | # check the SRC_URI for "kmeta" type'd git repositories. Return the name of |
| 57 | # the repository as it will be found in WORKDIR |
| 58 | def find_kernel_feature_dirs(d): |
| 59 | feature_dirs=[] |
| 60 | fetch = bb.fetch2.Fetch([], d) |
| 61 | for url in fetch.urls: |
| 62 | urldata = fetch.ud[url] |
| 63 | parm = urldata.parm |
| 64 | type="" |
| 65 | if "type" in parm: |
| 66 | type = parm["type"] |
| 67 | if "destsuffix" in parm: |
| 68 | destdir = parm["destsuffix"] |
| 69 | if type == "kmeta": |
| 70 | feature_dirs.append(destdir) |
| 71 | |
| 72 | return feature_dirs |
| 73 | |
| 74 | # find the master/machine source branch. In the same way that the fetcher proceses |
| 75 | # git repositories in the SRC_URI we take the first repo found, first branch. |
| 76 | def get_machine_branch(d, default): |
| 77 | fetch = bb.fetch2.Fetch([], d) |
| 78 | for url in fetch.urls: |
| 79 | urldata = fetch.ud[url] |
| 80 | parm = urldata.parm |
| 81 | if "branch" in parm: |
| 82 | branches = urldata.parm.get("branch").split(',') |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 83 | btype = urldata.parm.get("type") |
| 84 | if btype != "kmeta": |
| 85 | return branches[0] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 86 | |
| 87 | return default |
| 88 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 89 | # returns a list of all directories that are on FILESEXTRAPATHS (and |
| 90 | # hence available to the build) that contain .scc or .cfg files |
| 91 | def get_dirs_with_fragments(d): |
| 92 | extrapaths = [] |
| 93 | extrafiles = [] |
| 94 | extrapathsvalue = (d.getVar("FILESEXTRAPATHS") or "") |
| 95 | # Remove default flag which was used for checking |
| 96 | extrapathsvalue = extrapathsvalue.replace("__default:", "") |
| 97 | extrapaths = extrapathsvalue.split(":") |
| 98 | for path in extrapaths: |
| 99 | if path + ":True" not in extrafiles: |
| 100 | extrafiles.append(path + ":" + str(os.path.exists(path))) |
| 101 | |
| 102 | return " ".join(extrafiles) |
| 103 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | do_kernel_metadata() { |
| 105 | set +e |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 106 | |
| 107 | if [ -n "$1" ]; then |
| 108 | mode="$1" |
| 109 | else |
| 110 | mode="patch" |
| 111 | fi |
| 112 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 113 | cd ${S} |
| 114 | export KMETA=${KMETA} |
| 115 | |
| 116 | # if kernel tools are available in-tree, they are preferred |
| 117 | # and are placed on the path before any external tools. Unless |
| 118 | # the external tools flag is set, in that case we do nothing. |
| 119 | if [ -f "${S}/scripts/util/configme" ]; then |
| 120 | if [ -z "${EXTERNAL_KERNEL_TOOLS}" ]; then |
| 121 | PATH=${S}/scripts/util:${PATH} |
| 122 | fi |
| 123 | fi |
| 124 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 125 | # In a similar manner to the kernel itself: |
| 126 | # |
| 127 | # defconfig: $(obj)/conf |
| 128 | # ifeq ($(KBUILD_DEFCONFIG),) |
| 129 | # $< --defconfig $(Kconfig) |
| 130 | # else |
| 131 | # @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" |
| 132 | # $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) |
| 133 | # endif |
| 134 | # |
| 135 | # If a defconfig is specified via the KBUILD_DEFCONFIG variable, we copy it |
| 136 | # from the source tree, into a common location and normalized "defconfig" name, |
| 137 | # where the rest of the process will include and incoroporate it into the build |
| 138 | # |
| 139 | # If the fetcher has already placed a defconfig in WORKDIR (from the SRC_URI), |
| 140 | # we don't overwrite it, but instead warn the user that SRC_URI defconfigs take |
| 141 | # precendence. |
| 142 | # |
| 143 | if [ -n "${KBUILD_DEFCONFIG}" ]; then |
| 144 | if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then |
| 145 | if [ -f "${WORKDIR}/defconfig" ]; then |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 146 | # If the two defconfig's are different, warn that we overwrote the |
| 147 | # one already placed in WORKDIR |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 148 | cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" |
| 149 | if [ $? -ne 0 ]; then |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 150 | bbdebug 1 "detected SRC_URI or unpatched defconfig in WORKDIR. ${KBUILD_DEFCONFIG} copied over it" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 151 | fi |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 152 | cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 153 | else |
| 154 | cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 155 | fi |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 156 | in_tree_defconfig="${WORKDIR}/defconfig" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 157 | else |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 158 | bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree (${S}/arch/${ARCH}/configs/)" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 159 | fi |
| 160 | fi |
| 161 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 162 | if [ "$mode" = "patch" ]; then |
| 163 | # was anyone trying to patch the kernel meta data ?, we need to do |
| 164 | # this here, since the scc commands migrate the .cfg fragments to the |
| 165 | # kernel source tree, where they'll be used later. |
| 166 | check_git_config |
| 167 | patches="${@" ".join(find_patches(d,'kernel-meta'))}" |
| 168 | for p in $patches; do |
| 169 | ( |
| 170 | cd ${WORKDIR}/kernel-meta |
| 171 | git am -s $p |
| 172 | ) |
| 173 | done |
| 174 | fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 175 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 176 | sccs_from_src_uri="${@" ".join(find_sccs(d))}" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 177 | patches="${@" ".join(find_patches(d,''))}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 178 | feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}" |
| 179 | |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 180 | # a quick check to make sure we don't have duplicate defconfigs If |
| 181 | # there's a defconfig in the SRC_URI, did we also have one from the |
| 182 | # KBUILD_DEFCONFIG processing above ? |
| 183 | src_uri_defconfig=$(echo $sccs_from_src_uri | awk '(match($0, "defconfig") != 0) { print $0 }' RS=' ') |
| 184 | # drop and defconfig's from the src_uri variable, we captured it just above here if it existed |
| 185 | sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '(match($0, "defconfig") == 0) { print $0 }' RS=' ') |
| 186 | |
| 187 | if [ -n "$in_tree_defconfig" ]; then |
| 188 | sccs_defconfig=$in_tree_defconfig |
| 189 | if [ -n "$src_uri_defconfig" ]; then |
| 190 | bbwarn "[NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI defconfig" |
| 191 | fi |
| 192 | else |
| 193 | # if we didn't have an in-tree one, make our defconfig the one |
| 194 | # from the src_uri. Note: there may not have been one from the |
| 195 | # src_uri, so this can be an empty variable. |
| 196 | sccs_defconfig=$src_uri_defconfig |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 197 | fi |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 198 | sccs="$sccs_from_src_uri" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 199 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 200 | # check for feature directories/repos/branches that were part of the |
| 201 | # SRC_URI. If they were supplied, we convert them into include directives |
| 202 | # for the update part of the process |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 203 | for f in ${feat_dirs}; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 204 | if [ -d "${WORKDIR}/$f/meta" ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 205 | includes="$includes -I${WORKDIR}/$f/kernel-meta" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 206 | elif [ -d "${WORKDIR}/../oe-local-files/$f" ]; then |
| 207 | includes="$includes -I${WORKDIR}/../oe-local-files/$f" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 208 | elif [ -d "${WORKDIR}/$f" ]; then |
| 209 | includes="$includes -I${WORKDIR}/$f" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 210 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 211 | done |
| 212 | for s in ${sccs} ${patches}; do |
| 213 | sdir=$(dirname $s) |
| 214 | includes="$includes -I${sdir}" |
| 215 | # if a SRC_URI passed patch or .scc has a subdir of "kernel-meta", |
| 216 | # then we add it to the search path |
| 217 | if [ -d "${sdir}/kernel-meta" ]; then |
| 218 | includes="$includes -I${sdir}/kernel-meta" |
| 219 | fi |
| 220 | done |
| 221 | |
| 222 | # expand kernel features into their full path equivalents |
| 223 | bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE}) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 224 | if [ -z "$bsp_definition" ]; then |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 225 | if [ -z "$sccs_defconfig" ]; then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 226 | bbfatal_log "Could not locate BSP definition for ${KMACHINE}/${LINUX_KERNEL_TYPE} and no defconfig was provided" |
| 227 | fi |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 228 | else |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 229 | # if the bsp definition has "define KMETA_EXTERNAL_BSP t", |
| 230 | # then we need to set a flag that will instruct the next |
| 231 | # steps to use the BSP as both configuration and patches. |
| 232 | grep -q KMETA_EXTERNAL_BSP $bsp_definition |
| 233 | if [ $? -eq 0 ]; then |
| 234 | KMETA_EXTERNAL_BSPS="t" |
| 235 | fi |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 236 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 237 | meta_dir=$(kgit --meta) |
| 238 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 239 | KERNEL_FEATURES_FINAL="" |
| 240 | if [ -n "${KERNEL_FEATURES}" ]; then |
| 241 | for feature in ${KERNEL_FEATURES}; do |
| 242 | feature_found=f |
| 243 | for d in $includes; do |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 244 | path_to_check=$(echo $d | sed 's/^-I//') |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 245 | if [ "$feature_found" = "f" ] && [ -e "$path_to_check/$feature" ]; then |
| 246 | feature_found=t |
| 247 | fi |
| 248 | done |
| 249 | if [ "$feature_found" = "f" ]; then |
| 250 | if [ -n "${KERNEL_DANGLING_FEATURES_WARN_ONLY}" ]; then |
| 251 | bbwarn "Feature '$feature' not found, but KERNEL_DANGLING_FEATURES_WARN_ONLY is set" |
| 252 | bbwarn "This may cause runtime issues, dropping feature and allowing configuration to continue" |
| 253 | else |
| 254 | bberror "Feature '$feature' not found, this will cause configuration failures." |
| 255 | bberror "Check the SRC_URI for meta-data repositories or directories that may be missing" |
| 256 | bbfatal_log "Set KERNEL_DANGLING_FEATURES_WARN_ONLY to ignore this issue" |
| 257 | fi |
| 258 | else |
| 259 | KERNEL_FEATURES_FINAL="$KERNEL_FEATURES_FINAL $feature" |
| 260 | fi |
| 261 | done |
| 262 | fi |
| 263 | |
| 264 | if [ "$mode" = "config" ]; then |
| 265 | # run1: pull all the configuration fragments, no matter where they come from |
| 266 | elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" |
| 267 | if [ -n "${elements}" ]; then |
| 268 | echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition |
| 269 | scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL |
| 270 | if [ $? -ne 0 ]; then |
| 271 | bbfatal_log "Could not generate configuration queue for ${KMACHINE}." |
| 272 | fi |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 273 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 274 | fi |
| 275 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 276 | # if KMETA_EXTERNAL_BSPS has been set, or it has been detected from |
| 277 | # the bsp definition, then we inject the bsp_definition into the |
| 278 | # patch phase below. we'll piggy back on the sccs variable. |
| 279 | if [ -n "${KMETA_EXTERNAL_BSPS}" ]; then |
| 280 | sccs="${bsp_definition} ${sccs}" |
| 281 | fi |
| 282 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 283 | if [ "$mode" = "patch" ]; then |
| 284 | # run2: only generate patches for elements that have been passed on the SRC_URI |
| 285 | elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" |
| 286 | if [ -n "${elements}" ]; then |
| 287 | scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL |
| 288 | if [ $? -ne 0 ]; then |
| 289 | bbfatal_log "Could not generate configuration queue for ${KMACHINE}." |
| 290 | fi |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 291 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 292 | fi |
| 293 | } |
| 294 | |
| 295 | do_patch() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 296 | set +e |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 297 | cd ${S} |
| 298 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 299 | check_git_config |
| 300 | meta_dir=$(kgit --meta) |
| 301 | (cd ${meta_dir}; ln -sf patch.queue series) |
| 302 | if [ -f "${meta_dir}/series" ]; then |
| 303 | kgit-s2q --gen -v --patches .kernel-meta/ |
| 304 | if [ $? -ne 0 ]; then |
| 305 | bberror "Could not apply patches for ${KMACHINE}." |
| 306 | bbfatal_log "Patch failures can be resolved in the linux source directory ${S})" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 307 | fi |
| 308 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 309 | |
| 310 | if [ -f "${meta_dir}/merge.queue" ]; then |
| 311 | # we need to merge all these branches |
| 312 | for b in $(cat ${meta_dir}/merge.queue); do |
| 313 | git show-ref --verify --quiet refs/heads/${b} |
| 314 | if [ $? -eq 0 ]; then |
| 315 | bbnote "Merging branch ${b}" |
| 316 | git merge -q --no-ff -m "Merge branch ${b}" ${b} |
| 317 | else |
| 318 | bbfatal "branch ${b} does not exist, cannot merge" |
| 319 | fi |
| 320 | done |
| 321 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 322 | } |
| 323 | |
| 324 | do_kernel_checkout() { |
| 325 | set +e |
| 326 | |
| 327 | source_dir=`echo ${S} | sed 's%/$%%'` |
| 328 | source_workdir="${WORKDIR}/git" |
| 329 | if [ -d "${WORKDIR}/git/" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 330 | # case: git repository |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 331 | # if S is WORKDIR/git, then we shouldn't be moving or deleting the tree. |
| 332 | if [ "${source_dir}" != "${source_workdir}" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 333 | if [ -d "${source_workdir}/.git" ]; then |
| 334 | # regular git repository with .git |
| 335 | rm -rf ${S} |
| 336 | mv ${WORKDIR}/git ${S} |
| 337 | else |
| 338 | # create source for bare cloned git repository |
| 339 | git clone ${WORKDIR}/git ${S} |
| 340 | rm -rf ${WORKDIR}/git |
| 341 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 342 | fi |
| 343 | cd ${S} |
| 344 | else |
| 345 | # case: we have no git repository at all. |
| 346 | # To support low bandwidth options for building the kernel, we'll just |
| 347 | # convert the tree to a git repo and let the rest of the process work unchanged |
| 348 | |
| 349 | # if ${S} hasn't been set to the proper subdirectory a default of "linux" is |
| 350 | # used, but we can't initialize that empty directory. So check it and throw a |
| 351 | # clear error |
| 352 | |
| 353 | cd ${S} |
| 354 | if [ ! -f "Makefile" ]; then |
| 355 | bberror "S is not set to the linux source directory. Check " |
| 356 | bbfatal "the recipe and set S to the proper extracted subdirectory" |
| 357 | fi |
| 358 | rm -f .gitignore |
| 359 | git init |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 360 | check_git_config |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 361 | git add . |
| 362 | git commit -q -m "baseline commit: creating repo for ${PN}-${PV}" |
| 363 | git clean -d -f |
| 364 | fi |
| 365 | |
| 366 | # convert any remote branches to local tracking ones |
| 367 | for i in `git branch -a --no-color | grep remotes | grep -v HEAD`; do |
| 368 | b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`; |
| 369 | git show-ref --quiet --verify -- "refs/heads/$b" |
| 370 | if [ $? -ne 0 ]; then |
| 371 | git branch $b $i > /dev/null |
| 372 | fi |
| 373 | done |
| 374 | |
| 375 | # Create a working tree copy of the kernel by checking out a branch |
| 376 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" |
| 377 | |
| 378 | # checkout and clobber any unimportant files |
| 379 | git checkout -f ${machine_branch} |
| 380 | } |
| 381 | do_kernel_checkout[dirs] = "${S}" |
| 382 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 383 | addtask kernel_checkout before do_kernel_metadata after do_symlink_kernsrc |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 384 | addtask kernel_metadata after do_validate_branches do_unpack before do_patch |
| 385 | do_kernel_metadata[depends] = "kern-tools-native:do_populate_sysroot" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 386 | do_kernel_metadata[file-checksums] = " ${@get_dirs_with_fragments(d)}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 387 | do_validate_branches[depends] = "kern-tools-native:do_populate_sysroot" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 388 | |
William A. Kennington III | 47649fa | 2018-06-28 12:34:29 -0700 | [diff] [blame] | 389 | do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot" |
| 390 | do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}gcc:do_populate_sysroot" |
| 391 | do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 392 | do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 393 | do_kernel_configme[dirs] += "${S} ${B}" |
| 394 | do_kernel_configme() { |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 395 | do_kernel_metadata config |
| 396 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 397 | # translate the kconfig_mode into something that merge_config.sh |
| 398 | # understands |
| 399 | case ${KCONFIG_MODE} in |
| 400 | *allnoconfig) |
| 401 | config_flags="-n" |
| 402 | ;; |
| 403 | *alldefconfig) |
| 404 | config_flags="" |
| 405 | ;; |
| 406 | *) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 407 | if [ -f ${WORKDIR}/defconfig ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 408 | config_flags="-n" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 409 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 410 | ;; |
| 411 | esac |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 412 | |
| 413 | cd ${S} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 414 | |
| 415 | meta_dir=$(kgit --meta) |
| 416 | configs="$(scc --configs -o ${meta_dir})" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 417 | if [ $? -ne 0 ]; then |
| 418 | bberror "${configs}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 419 | bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)" |
| 420 | fi |
| 421 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 422 | CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1 |
| 423 | if [ $? -ne 0 -o ! -f ${B}/.config ]; then |
| 424 | bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}" |
| 425 | if [ ${KCONF_AUDIT_LEVEL} -gt 1 ]; then |
| 426 | bbfatal_log "`cat ${meta_dir}/cfg/merge_config_build.log`" |
| 427 | else |
| 428 | bbfatal_log "Details can be found at: ${S}/${meta_dir}/cfg/merge_config_build.log" |
| 429 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 430 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 431 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 432 | if [ ! -z "${LINUX_VERSION_EXTENSION}" ]; then |
| 433 | echo "# Global settings from linux recipe" >> ${B}/.config |
| 434 | echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config |
| 435 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | addtask kernel_configme before do_configure after do_patch |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 439 | addtask config_analysis |
| 440 | |
| 441 | do_config_analysis[depends] = "virtual/kernel:do_configure" |
| 442 | do_config_analysis[depends] += "kern-tools-native:do_populate_sysroot" |
| 443 | |
| 444 | CONFIG_AUDIT_FILE ?= "${WORKDIR}/config-audit.txt" |
| 445 | CONFIG_ANALYSIS_FILE ?= "${WORKDIR}/config-analysis.txt" |
| 446 | |
| 447 | python do_config_analysis() { |
| 448 | import re, string, sys, subprocess |
| 449 | |
| 450 | s = d.getVar('S') |
| 451 | |
| 452 | env = os.environ.copy() |
| 453 | env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/") |
| 454 | env['LD'] = d.getVar('KERNEL_LD') |
| 455 | env['CC'] = d.getVar('KERNEL_CC') |
| 456 | env['ARCH'] = d.getVar('ARCH') |
| 457 | env['srctree'] = s |
| 458 | |
| 459 | # read specific symbols from the kernel recipe or from local.conf |
| 460 | # i.e.: CONFIG_ANALYSIS_pn-linux-yocto-dev = 'NF_CONNTRACK LOCALVERSION' |
| 461 | config = d.getVar( 'CONFIG_ANALYSIS' ) |
| 462 | if not config: |
| 463 | config = [ "" ] |
| 464 | else: |
| 465 | config = config.split() |
| 466 | |
| 467 | for c in config: |
| 468 | for action in ["analysis","audit"]: |
| 469 | if action == "analysis": |
| 470 | try: |
| 471 | analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--blame', c], cwd=s, env=env ).decode('utf-8') |
| 472 | except subprocess.CalledProcessError as e: |
| 473 | bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) |
| 474 | |
| 475 | outfile = d.getVar( 'CONFIG_ANALYSIS_FILE' ) |
| 476 | |
| 477 | if action == "audit": |
| 478 | try: |
| 479 | analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--summary', '--extended', '--sanity', c], cwd=s, env=env ).decode('utf-8') |
| 480 | except subprocess.CalledProcessError as e: |
| 481 | bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) |
| 482 | |
| 483 | outfile = d.getVar( 'CONFIG_AUDIT_FILE' ) |
| 484 | |
| 485 | if c: |
| 486 | outdir = os.path.dirname( outfile ) |
| 487 | outname = os.path.basename( outfile ) |
| 488 | outfile = outdir + '/'+ c + '-' + outname |
| 489 | |
| 490 | if config and os.path.isfile(outfile): |
| 491 | os.remove(outfile) |
| 492 | |
| 493 | with open(outfile, 'w+') as f: |
| 494 | f.write( analysis ) |
| 495 | |
| 496 | bb.warn( "Configuration {} executed, see: {} for details".format(action,outfile )) |
| 497 | if c: |
| 498 | bb.warn( analysis ) |
| 499 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 500 | |
| 501 | python do_kernel_configcheck() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 502 | import re, string, sys, subprocess |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 503 | |
| 504 | # if KMETA isn't set globally by a recipe using this routine, we need to |
| 505 | # set the default to 'meta'. Otherwise, kconf_check is not passed a valid |
| 506 | # meta-series for processing |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 507 | kmeta = d.getVar("KMETA") or "meta" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 508 | if not os.path.exists(kmeta): |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 509 | kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 510 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 511 | s = d.getVar('S') |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 512 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 513 | env = os.environ.copy() |
| 514 | env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/") |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 515 | env['LD'] = d.getVar('KERNEL_LD') |
| 516 | env['CC'] = d.getVar('KERNEL_CC') |
| 517 | env['ARCH'] = d.getVar('ARCH') |
| 518 | env['srctree'] = s |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 519 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 520 | try: |
| 521 | configs = subprocess.check_output(['scc', '--configs', '-o', s + '/.kernel-meta'], env=env).decode('utf-8') |
| 522 | except subprocess.CalledProcessError as e: |
| 523 | bb.fatal( "Cannot gather config fragments for audit: %s" % e.output.decode("utf-8") ) |
| 524 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 525 | config_check_visibility = int(d.getVar("KCONF_AUDIT_LEVEL") or 0) |
| 526 | bsp_check_visibility = int(d.getVar("KCONF_BSP_AUDIT_LEVEL") or 0) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 527 | kmeta_audit_werror = d.getVar("KMETA_AUDIT_WERROR") or "" |
| 528 | warnings_detected = False |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 529 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 530 | # if config check visibility is "1", that's the lowest level of audit. So |
| 531 | # we add the --classify option to the run, since classification will |
| 532 | # streamline the output to only report options that could be boot issues, |
| 533 | # or are otherwise required for proper operation. |
| 534 | extra_params = "" |
| 535 | if config_check_visibility == 1: |
| 536 | extra_params = "--classify" |
| 537 | |
| 538 | # category #1: mismatches |
| 539 | try: |
| 540 | analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--mismatches', extra_params], cwd=s, env=env ).decode('utf-8') |
| 541 | except subprocess.CalledProcessError as e: |
| 542 | bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) |
| 543 | |
| 544 | if analysis: |
| 545 | outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta ) |
| 546 | if os.path.isfile(outfile): |
| 547 | os.remove(outfile) |
| 548 | with open(outfile, 'w+') as f: |
| 549 | f.write( analysis ) |
| 550 | |
| 551 | if config_check_visibility and os.stat(outfile).st_size > 0: |
| 552 | with open (outfile, "r") as myfile: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 553 | results = myfile.read() |
| 554 | bb.warn( "[kernel config]: specified values did not make it into the kernel's final configuration:\n\n%s" % results) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 555 | warnings_detected = True |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 556 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 557 | # category #2: invalid fragment elements |
| 558 | extra_params = "" |
| 559 | if bsp_check_visibility > 1: |
| 560 | extra_params = "--strict" |
| 561 | try: |
| 562 | analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--invalid', extra_params], cwd=s, env=env ).decode('utf-8') |
| 563 | except subprocess.CalledProcessError as e: |
| 564 | bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 565 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 566 | if analysis: |
| 567 | outfile = "{}/{}/cfg/invalid.txt".format(s,kmeta) |
| 568 | if os.path.isfile(outfile): |
| 569 | os.remove(outfile) |
| 570 | with open(outfile, 'w+') as f: |
| 571 | f.write( analysis ) |
| 572 | |
| 573 | if bsp_check_visibility and os.stat(outfile).st_size > 0: |
| 574 | with open (outfile, "r") as myfile: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 575 | results = myfile.read() |
| 576 | bb.warn( "[kernel config]: This BSP contains fragments with warnings:\n\n%s" % results) |
| 577 | warnings_detected = True |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 578 | |
| 579 | # category #3: redefined options (this is pretty verbose and is debug only) |
| 580 | try: |
| 581 | analysis = subprocess.check_output(['symbol_why.py', '--dotconfig', '{}'.format( d.getVar('B') + '/.config' ), '--sanity'], cwd=s, env=env ).decode('utf-8') |
| 582 | except subprocess.CalledProcessError as e: |
| 583 | bb.fatal( "config analysis failed: %s" % e.output.decode('utf-8')) |
| 584 | |
| 585 | if analysis: |
| 586 | outfile = "{}/{}/cfg/redefinition.txt".format(s,kmeta) |
| 587 | if os.path.isfile(outfile): |
| 588 | os.remove(outfile) |
| 589 | with open(outfile, 'w+') as f: |
| 590 | f.write( analysis ) |
| 591 | |
| 592 | # if the audit level is greater than two, we report if a fragment has overriden |
| 593 | # a value from a base fragment. This is really only used for new kernel introduction |
| 594 | if bsp_check_visibility > 2 and os.stat(outfile).st_size > 0: |
| 595 | with open (outfile, "r") as myfile: |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 596 | results = myfile.read() |
| 597 | bb.warn( "[kernel config]: This BSP has configuration options defined in more than one config, with differing values:\n\n%s" % results) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 598 | warnings_detected = True |
| 599 | |
| 600 | if warnings_detected and kmeta_audit_werror: |
| 601 | bb.fatal( "configuration warnings detected, werror is set, promoting to fatal" ) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 602 | } |
| 603 | |
| 604 | # Ensure that the branches (BSP and meta) are on the locations specified by |
| 605 | # their SRCREV values. If they are NOT on the right commits, the branches |
| 606 | # are corrected to the proper commit. |
| 607 | do_validate_branches() { |
| 608 | set +e |
| 609 | cd ${S} |
| 610 | |
| 611 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" |
| 612 | machine_srcrev="${SRCREV_machine}" |
| 613 | |
| 614 | # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to |
| 615 | # check and we can exit early |
| 616 | if [ "${machine_srcrev}" = "AUTOINC" ]; then |
| 617 | bbnote "SRCREV validation is not required for AUTOREV" |
| 618 | elif [ "${machine_srcrev}" = "" ]; then |
| 619 | if [ "${SRCREV}" != "AUTOINC" ] && [ "${SRCREV}" != "INVALID" ]; then |
| 620 | # SRCREV_machine_<MACHINE> was not set. This means that a custom recipe |
| 621 | # that doesn't use the SRCREV_FORMAT "machine_meta" is being built. In |
| 622 | # this case, we need to reset to the give SRCREV before heading to patching |
| 623 | bbnote "custom recipe is being built, forcing SRCREV to ${SRCREV}" |
| 624 | force_srcrev="${SRCREV}" |
| 625 | fi |
| 626 | else |
| 627 | git cat-file -t ${machine_srcrev} > /dev/null |
| 628 | if [ $? -ne 0 ]; then |
| 629 | bberror "${machine_srcrev} is not a valid commit ID." |
| 630 | bbfatal_log "The kernel source tree may be out of sync" |
| 631 | fi |
| 632 | force_srcrev=${machine_srcrev} |
| 633 | fi |
| 634 | |
| 635 | git checkout -q -f ${machine_branch} |
| 636 | if [ -n "${force_srcrev}" ]; then |
| 637 | # see if the branch we are about to patch has been properly reset to the defined |
| 638 | # SRCREV .. if not, we reset it. |
| 639 | branch_head=`git rev-parse HEAD` |
| 640 | if [ "${force_srcrev}" != "${branch_head}" ]; then |
| 641 | current_branch=`git rev-parse --abbrev-ref HEAD` |
| 642 | git branch "$current_branch-orig" |
| 643 | git reset --hard ${force_srcrev} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 644 | # We've checked out HEAD, make sure we cleanup kgit-s2q fence post check |
| 645 | # so the patches are applied as expected otherwise no patching |
| 646 | # would be done in some corner cases. |
| 647 | kgit-s2q --clean |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 648 | fi |
| 649 | fi |
| 650 | } |
| 651 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 652 | OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT" |
| 653 | KBUILD_OUTPUT = "${B}" |
| 654 | |
| 655 | python () { |
| 656 | # If diffconfig is available, ensure it runs after kernel_configme |
| 657 | if 'do_diffconfig' in d: |
| 658 | bb.build.addtask('do_diffconfig', None, 'do_kernel_configme', d) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 659 | |
| 660 | externalsrc = d.getVar('EXTERNALSRC') |
| 661 | if externalsrc: |
| 662 | # If we deltask do_patch, do_kernel_configme is left without |
| 663 | # dependencies and runs too early |
| 664 | d.setVarFlag('do_kernel_configme', 'deps', (d.getVarFlag('do_kernel_configme', 'deps', False) or []) + ['do_unpack']) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 665 | } |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 666 | |
| 667 | # extra tasks |
| 668 | addtask kernel_version_sanity_check after do_kernel_metadata do_kernel_checkout before do_compile |
| 669 | addtask validate_branches before do_patch after do_kernel_checkout |
| 670 | addtask kernel_configcheck after do_configure before do_compile |