diff options
| -rw-r--r-- | meta/classes/kernel-yocto.bbclass | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass index 69620f0a42..4f912bff2f 100644 --- a/meta/classes/kernel-yocto.bbclass +++ b/meta/classes/kernel-yocto.bbclass | |||
| @@ -72,6 +72,10 @@ do_patch() { | |||
| 72 | 72 | ||
| 73 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" | 73 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" |
| 74 | machine_srcrev="${SRCREV_machine}" | 74 | machine_srcrev="${SRCREV_machine}" |
| 75 | if [ -z "${machine_srcrev}" ]; then | ||
| 76 | # fallback to SRCREV if a non machine_meta tree is being built | ||
| 77 | machine_srcrev="${SRCREV}" | ||
| 78 | fi | ||
| 75 | 79 | ||
| 76 | # if we have a defined/set meta branch we should not be generating | 80 | # if we have a defined/set meta branch we should not be generating |
| 77 | # any meta data. The passed branch has what we need. | 81 | # any meta data. The passed branch has what we need. |
| @@ -119,17 +123,6 @@ do_patch() { | |||
| 119 | exit 1 | 123 | exit 1 |
| 120 | fi | 124 | fi |
| 121 | 125 | ||
| 122 | # see if the branch we are about to patch has been properly reset to the defined | ||
| 123 | # SRCREV .. if not, we reset it. | ||
| 124 | branch_head=`git rev-parse HEAD` | ||
| 125 | if [ "${machine_srcrev}" != "AUTOINC" ]; then | ||
| 126 | if [ "${machine_srcrev}" != "${branch_head}" ]; then | ||
| 127 | current_branch=`git rev-parse --abbrev-ref HEAD` | ||
| 128 | git branch "$current_branch-orig" | ||
| 129 | git reset --hard ${machine_srcrev} | ||
| 130 | fi | ||
| 131 | fi | ||
| 132 | |||
| 133 | # executes and modifies the source tree as required | 126 | # executes and modifies the source tree as required |
| 134 | patchme ${KMACHINE} | 127 | patchme ${KMACHINE} |
| 135 | if [ $? -ne 0 ]; then | 128 | if [ $? -ne 0 ]; then |
| @@ -299,17 +292,16 @@ do_validate_branches() { | |||
| 299 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" | 292 | machine_branch="${@ get_machine_branch(d, "${KBRANCH}" )}" |
| 300 | machine_srcrev="${SRCREV_machine}" | 293 | machine_srcrev="${SRCREV_machine}" |
| 301 | 294 | ||
| 302 | # if the machine branch doesn't exist, lets build master | ||
| 303 | git show-ref --quiet --verify -- "refs/heads/${machine_branch}" | ||
| 304 | if [ $? -eq 1 ]; then | ||
| 305 | machine_branch = "master" | ||
| 306 | fi | ||
| 307 | |||
| 308 | # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to | 295 | # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to |
| 309 | # check and we can exit early | 296 | # check and we can exit early |
| 310 | if [ "${machine_srcrev}" = "AUTOINC" ] || [ "${machine_srcrev}" = "INVALID" ] || | 297 | if [ "${machine_srcrev}" = "AUTOINC" ]; then |
| 311 | [ "${machine_srcrev}" = "" ]; then | ||
| 312 | bbnote "INFO: SRCREV validation is not required for AUTOREV or empty/invalid settings, returning" | 298 | bbnote "INFO: SRCREV validation is not required for AUTOREV or empty/invalid settings, returning" |
| 299 | elif [ "${machine_srcrev}" = "" ] && [ "${SRCREV}" != "AUTOINC" ]; then | ||
| 300 | # SRCREV_machine_<MACHINE> was not set. This means that a custom recipe | ||
| 301 | # that doesn't use the SRCREV_FORMAT "machine_meta" is being built. In | ||
| 302 | # this case, we need to reset to the give SRCREV before heading to patching | ||
| 303 | bbnote "INFO: custom recipe is being built, forcing SRCREV to ${SRCREV}" | ||
| 304 | force_srcrev="${SRCREV}" | ||
| 313 | else | 305 | else |
| 314 | git cat-file -t ${machine_srcrev} > /dev/null | 306 | git cat-file -t ${machine_srcrev} > /dev/null |
| 315 | if [ if $? -ne 0 ]; then | 307 | if [ if $? -ne 0 ]; then |
| @@ -317,10 +309,10 @@ do_validate_branches() { | |||
| 317 | echo "The kernel source tree may be out of sync" | 309 | echo "The kernel source tree may be out of sync" |
| 318 | exit 1 | 310 | exit 1 |
| 319 | fi | 311 | fi |
| 312 | force_srcrev=${machine_srcrev} | ||
| 320 | fi | 313 | fi |
| 321 | 314 | ||
| 322 | ## KMETA branch validation. | 315 | ## KMETA branch validation. |
| 323 | ## We do validation if the meta branch exists, and AUTOREV hasn't been set | ||
| 324 | target_meta_head="${SRCREV_meta}" | 316 | target_meta_head="${SRCREV_meta}" |
| 325 | if [ "${target_meta_head}" = "AUTOINC" ] || [ "${target_meta_head}" = "" ]; then | 317 | if [ "${target_meta_head}" = "AUTOINC" ] || [ "${target_meta_head}" = "" ]; then |
| 326 | bbnote "INFO: SRCREV validation skipped for AUTOREV or empty meta branch" | 318 | bbnote "INFO: SRCREV validation skipped for AUTOREV or empty meta branch" |
| @@ -345,6 +337,16 @@ do_validate_branches() { | |||
| 345 | fi | 337 | fi |
| 346 | 338 | ||
| 347 | git checkout -q -f ${machine_branch} | 339 | git checkout -q -f ${machine_branch} |
| 340 | if [ -n "${force_srcrev}" ]; then | ||
| 341 | # see if the branch we are about to patch has been properly reset to the defined | ||
| 342 | # SRCREV .. if not, we reset it. | ||
| 343 | branch_head=`git rev-parse HEAD` | ||
| 344 | if [ "${force_srcrev}" != "${branch_head}" ]; then | ||
| 345 | current_branch=`git rev-parse --abbrev-ref HEAD` | ||
| 346 | git branch "$current_branch-orig" | ||
| 347 | git reset --hard ${force_srcrev} | ||
| 348 | fi | ||
| 349 | fi | ||
| 348 | } | 350 | } |
| 349 | 351 | ||
| 350 | # Many scripts want to look in arch/$arch/boot for the bootable | 352 | # Many scripts want to look in arch/$arch/boot for the bootable |
