Skip to contentSkip to conversation

powerpc: comvert relocs_check to a shell script using grep

PATCH Superseded Stephen Rothwell 2 participants 3 messages Mar 13, 2015 PowerPC

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc: comvert relocs_check to a shell script using grep

This runs a bit faster and removes another use of perl from the kernel build.

---

v2: address ShellCheck comments from Michael

 arch/powerpc/Makefile        |  4 +--
 arch/powerpc/relocs_check.pl | 66 --------------------------------------------
 arch/powerpc/relocs_check.sh | 59 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 68 deletions(-)
 delete mode 100755 arch/powerpc/relocs_check.pl
 create mode 100755 arch/powerpc/relocs_check.sh
arch/powerpc/Makefile +2 -2
index 132d9c681d6a..1e868023b2c3 100644
@@ -248,10 +248,10 @@ boot := arch/$(ARCH)/boot
 
 ifeq ($(CONFIG_RELOCATABLE),y)
 quiet_cmd_relocs_check = CALL    $<
-      cmd_relocs_check = perl $< "$(OBJDUMP)" "$(obj)/vmlinux"
+      cmd_relocs_check = $(CONFIG_SHELL) $< "$(OBJDUMP)" "$(obj)/vmlinux"
 
 PHONY += relocs_check
-relocs_check: arch/powerpc/relocs_check.pl vmlinux
+relocs_check: arch/powerpc/relocs_check.sh vmlinux
 	$(call cmd,relocs_check)
 
 zImage: relocs_check
arch/powerpc/relocs_check.pl deleted +0 -66

66 lines not on this page · raw message

arch/powerpc/relocs_check.sh new file +59 -0

59 lines not on this page · raw message

Signature · 5 lines
2.1.4

-- 
Cheers,
Stephen Rothwell                    [email protected]
#1 lore raw

RnJvbTogU3RlcGhlbiBSb3Rod2VsbA0KPiBUaGlzIHJ1bnMgYSBiaXQgZmFzdGVyIGFuZCByZW1v dmVzIGFub3RoZXIgdXNlIG9mIHBlcmwgZnJvbQ0KPiB0aGUga2VybmVsIGJ1aWxkLg0KLi4uDQo+ IGRpZmYgLS1naXQgYS9hcmNoL3Bvd2VycGMvcmVsb2NzX2NoZWNrLnNoIGIvYXJjaC9wb3dlcnBj L3JlbG9jc19jaGVjay5zaA0KPiBuZXcgZmlsZSBtb2RlIDEwMDc1NQ0KPiBpbmRleCAwMDAwMDAw MDAwMDAuLjE4MmVhZTljYzQwZA0KPiAtLS0gL2Rldi9udWxsDQo+ICsrKyBiL2FyY2gvcG93ZXJw Yy9yZWxvY3NfY2hlY2suc2gNCj4gQEAgLTAsMCArMSw1OSBAQA0KPiArIyEvYmluL3NoDQouLi4N Cj4gK2lmIFsgJHsjKn0gLWx0IDIgXTsgdGhlbg0KPiArCWVjaG8gIiQwIFtwYXRoIHRvIG9iamR1 bXBdIFtwYXRoIHRvIHZtbGludXhdIiAxPiYyDQo+ICsJZXhpdCAxDQo+ICtmaQ0KPiArDQo+ICsj IEhhdmUgS2J1aWxkIHN1cHBseSB0aGUgcGF0aCB0byBvYmpkdW1wIHNvIHdlIGhhbmRsZSBjcm9z cyBjb21waWxhdGlvbi4NCj4gK29iamR1bXA9IiQxIg0KPiArdm1saW51eD0iJDIiDQoNCkknbSBu b3QgMTAwJSBzdXJlIG9mIHRoZSByZXF1aXJlbWVudHMgb24gL2Jpbi9zaCBmb3Iga2VybmVsIGJ1 aWxkcy4NCkJ1dCAkeyMqfSBpcyBwcm9iYWJseSBub3QgY29tcGxldGVseSBwb3J0YWJsZSAoYW5k IG1heSBub3QgYmUgc2FmZQ0KaWYgdGhlcmUgYXJlIGVtYmVkZGVkIHNwYWNlcyBpbiB0aGUgYXJn dW1lbnRzKS4NCg0KTWlnaHQgYmUgYmV0dGVyIHRvIGNoZWNrOg0KCWlmIFsgLXogIiRvYmpkdW1w IiAtbyAteiAiJHZtbGludXgiIF0NCmluc3RlYWQuDQoNCk9yIGV2ZW46DQoJaWYgWyAhIC14ICIk b2JqZHVtcCIgLW8gISAtciAiJHZtbGludXgiIF0NCg0KCURhdmlkDQoNCg==

#2 lore raw

Hi David,

Quoted 13 lines · On Fri, 13 Mar 2015 14:18:10 +0000 David Laight <[email protected]> wrote:

From: Stephen Rothwell

Quoted 2 lines

This runs a bit faster and removes another use of perl from the kernel build.

...

Quoted 7 lines
arch/powerpc/relocs_check.sh new file +1 -0
new file mode 100755
index 000000000000..182eae9cc40d
@@ -0,0 +1,59 @@
+#!/bin/sh

...

Quoted 12 lines

arch/powerpc/relocs_check.sh line 23

Quoted 8 lines
arch/powerpc/relocs_check.sh new file +8 -0
+if [ ${#*} -lt 2 ]; then
+	echo "$0 [path to objdump] [path to vmlinux]" 1>&2
+	exit 1
+fi
+
+# Have Kbuild supply the path to objdump so we handle cross compilation.
+objdump="$1"
+vmlinux="$2"

I'm not 100% sure of the requirements on /bin/sh for kernel builds. But ${#*} is probably not completely portable (and may not be safe if there are embedded spaces in the arguments).

Oops, that is just wrong :-( ${#*} is undefined in Posix but is the same as $# in bash. It needs to be just $#.

Quoted 6 lines

Might be better to check:

	if [ -z "$objdump" -o -z "$vmlinux" ]

instead.

Or even:

	if [ ! -x "$objdump" -o ! -r "$vmlinux" ]

That last is a good idea as well.

I will do another version.

Thanks for catching that.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]