From 0523369959a0858f2b3e017e10ffa2b4de428c8c Mon Sep 17 00:00:00 2001 From: Martin Borg Date: Mon, 4 Dec 2017 11:40:35 +0100 Subject: spp: only return files that match KMACHINE and KTYPE The search utility of spp was incorrect and was returning files that matched only a defined ktype. This leads to the system potentially building the wrong BSP, and not being able to report an error. We fix the search to only return files that match both ktype and kmachine, as well as return 0/1 for success/fail in the search. Patch backported from yocto-kernel-tools master branch: http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/commit/?id=0571411cc033c11df7827508dd786876ce2f8c83 Signed-off-by: Martin Borg Signed-off-by: Adrian Dudau --- ...eturn-files-that-match-KMACHINE-and-KTYPE.patch | 85 ++++++++++++++++++++++ .../kern-tools/kern-tools-native_git.bbappend | 3 + 2 files changed, 88 insertions(+) create mode 100644 recipes-kernel/kern-tools/kern-tools-native-git/0001-spp-only-return-files-that-match-KMACHINE-and-KTYPE.patch create mode 100644 recipes-kernel/kern-tools/kern-tools-native_git.bbappend (limited to 'recipes-kernel') diff --git a/recipes-kernel/kern-tools/kern-tools-native-git/0001-spp-only-return-files-that-match-KMACHINE-and-KTYPE.patch b/recipes-kernel/kern-tools/kern-tools-native-git/0001-spp-only-return-files-that-match-KMACHINE-and-KTYPE.patch new file mode 100644 index 0000000..980dba2 --- /dev/null +++ b/recipes-kernel/kern-tools/kern-tools-native-git/0001-spp-only-return-files-that-match-KMACHINE-and-KTYPE.patch @@ -0,0 +1,85 @@ +From da7a349f731714b4a7ee98974e1d0979308b4abb Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Tue, 15 Aug 2017 16:56:45 -0400 +Subject: [PATCH] spp: only return files that match KMACHINE and KTYPE + +The search utility of spp was incorrect and was returning files +that matched only a defined ktype. + +This leads to the system potentially building the wrong BSP, and +not being able to report an error. + +We fix the search to only return files that match both ktype and +kmachine, as well as return 0/1 for success/fail in the search. + +Signed-off-by: Bruce Ashfield +--- + tools/spp | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/git/tools/spp b/git/tools/spp +index 4345a0d..7155166 100755 +--- a/git/tools/spp ++++ b/git/tools/spp +@@ -178,7 +178,7 @@ search_includes_for_defines() + done + + if [ -n "${verbose}" ]; then +- echo "checking $scc ($score)" >&2 ++ >&2 echo "checking $scc ($score)" >&2 + fi + + if [ $score -gt $max_score ]; then +@@ -189,11 +189,17 @@ search_includes_for_defines() + fi + done + +- # return the first target found (among equals) +- rstring="$(echo $found_scc | cut -f2 -d' ')" ++ if [ -n "${verbose}" ]; then ++ >&2 echo "score: $max_score" ++ fi + +- # .. and add the score +- echo "$rstring:$max_score" ++ if [ $max_score -gt 0 ]; then ++ # return the first target found (among equals) ++ rstring="$(echo $found_scc | cut -f2 -d' ')" ++ ++ # .. and add the score ++ echo "$rstring:$max_score" ++ fi + } + + search_include_paths() +@@ -306,7 +312,7 @@ if [ -n "${do_find}" ]; then + fi + + # are we looking for a machine/kernel match ? +- if [ -n"${KMACHINE}" ] && [ -n "${KTYPE}" ]; then ++ if [ -n "${KMACHINE}" ] && [ -n "${KTYPE}" ]; then + found=$(search_includes_for_defines ${KMACHINE}) + found_file=$(echo $found | cut -d: -f1) + found_score=$(echo $found | cut -d: -f2) +@@ -317,11 +323,17 @@ if [ -n "${do_find}" ]; then + found=$(search_includes_for_defines ${KMACHINE}:${KTYPE}) + found_file2=$(echo $found | cut -d: -f1) + found_score2=$(echo $found | cut -d: -f2) ++ + if [ "${found_score2}" == "2" ]; then + found_file=${found_file2} + found_score=${found_score2} + fi +- echo "${found_file}" ++ ++ if [ -n "${found_file}" ]; then ++ echo "${found_file}" ++ else ++ exit 1 ++ fi + fi + + # or are we looking for a file in particular ? +-- +2.7.4 + diff --git a/recipes-kernel/kern-tools/kern-tools-native_git.bbappend b/recipes-kernel/kern-tools/kern-tools-native_git.bbappend new file mode 100644 index 0000000..748d52b --- /dev/null +++ b/recipes-kernel/kern-tools/kern-tools-native_git.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-git:" + +SRC_URI += "file://0001-spp-only-return-files-that-match-KMACHINE-and-KTYPE.patch" -- cgit v1.2.3-54-g00ecf