Skip to contentSkip to conversation

kernel.bbclass: fix the bug of checking the existing sections in do_strip()

PATCH New Kevin Hao 1 participant 1 message Sep 30, 2015

lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH 1/1 kernel.bbclass: fix the bug of checking the existing sections in do_strip()

Ross reported the following waring when building edgerouter BSP:
WARNING: Section not found: .comment

The reason is that the testing of the existing sections in do_strip() returned the wrong value. Please see the following code in do_strip():

                for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do {
                        if [ "$headers" != *"$str"* ]; then
                                bbwarn "Section not found: $str";
                        fi

                        "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT}
                }; done

The "*" doesn't have special meaning in the if string test, so it will return true even the $str is a substring of $headers. Fix this issue by replacing it with "! (echo "$headers" | grep -q "^$str$")".

---
 meta/classes/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel.bbclass +1 -1
index dfbdfd2..5e8b6cf 100644
@@ -413,7 +413,7 @@ do_strip() {
 			  gawk '{print $1}'`
 
 		for str in ${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}; do {
-			if [ "$headers" != *"$str"* ]; then
+			if ! (echo "$headers" | grep -q "^$str$"); then
 				bbwarn "Section not found: $str";
 			fi
 
Signature · 1 line
2.0.1