Skip to contentSkip to conversation

kbuild: explicitly run mksysmap as sed script from link-vmlinux.sh

PATCH In review Richard Acayan 3 participants 3 messages Jun 5, 2024 – Jun 6, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kbuild: explicitly run mksysmap as sed script from link-vmlinux.sh

In commit b18b047002b7 ("kbuild: change scripts/mksysmap into sed script"), the mksysmap script was transformed into a sed script, made directly executable with "#!/bin/sed -f". Apparently, the path to sed is different on NixOS.

The shebang can't use the env command, otherwise the "sed -f" command would be treated as a single argument. This can be solved with the -S flag, but that is a GNU extension. Explicitly use sed instead of relying on the executable shebang to fix NixOS builds without breaking build environments using Busybox.

Fixes b18b047002b7 ("kbuild: change scripts/mksysmap into sed script")
---
 scripts/link-vmlinux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/link-vmlinux.sh +1 -1
index 46ce5d04dbeb..518c70b8db50 100755
@@ -193,7 +193,7 @@ kallsyms_step()
 mksysmap()
 {
 	info NM ${2}
-	${NM} -n "${1}" | "${srctree}/scripts/mksysmap" > "${2}"
+	${NM} -n "${1}" | sed -f "${srctree}/scripts/mksysmap" > "${2}"
 }
 
 sorttable()
Signature · 1 line
2.45.2
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Richard Acayan

In commit b18b047002b7 ("kbuild: change scripts/mksysmap into sed script"), the mksysmap script was transformed into a sed script, made directly executable with "#!/bin/sed -f". Apparently, the path to sed is different on NixOS.

Quoted 8 lines

The shebang can't use the env command, otherwise the "sed -f" command would be treated as a single argument. This can be solved with the -S flag, but that is a GNU extension. Explicitly use sed instead of relying on the executable shebang to fix NixOS builds without breaking build environments using Busybox.

Fixes b18b047002b7 ("kbuild: change scripts/mksysmap into sed script")
Quoted 20 lines
---
 scripts/link-vmlinux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/link-vmlinux.sh +1 -1
index 46ce5d04dbeb..518c70b8db50 100755
@@ -193,7 +193,7 @@ kallsyms_step()
 mksysmap()
 {
 	info NM ${2}
-	${NM} -n "${1}" | "${srctree}/scripts/mksysmap" > "${2}"
+	${NM} -n "${1}" | sed -f "${srctree}/scripts/mksysmap" > "${2}"
 }
 
 sorttable()
Signature · 1 line
2.45.2
#2 lore raw
In reply to Richard Acayan
Quoted 12 lines · Richard Acayan

In commit b18b047002b7 ("kbuild: change scripts/mksysmap into sed script"), the mksysmap script was transformed into a sed script, made directly executable with "#!/bin/sed -f". Apparently, the path to sed is different on NixOS.

The shebang can't use the env command, otherwise the "sed -f" command would be treated as a single argument. This can be solved with the -S flag, but that is a GNU extension. Explicitly use sed instead of relying on the executable shebang to fix NixOS builds without breaking build environments using Busybox.

Quoted 3 lines
Fixes b18b047002b7 ("kbuild: change scripts/mksysmap into sed script")

---

Applied with Kent's Reported-by.

Thanks!

Quoted 20 lines
 scripts/link-vmlinux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/link-vmlinux.sh +1 -2
index 46ce5d04dbeb..518c70b8db50 100755
@@ -193,7 +193,7 @@ kallsyms_step()
 mksysmap()
 {
        info NM ${2}
-       ${NM} -n "${1}" | "${srctree}/scripts/mksysmap" > "${2}"
+       ${NM} -n "${1}" | sed -f "${srctree}/scripts/mksysmap" > "${2}"
 }
 
 sorttable()
--

2.45.2

Signature · 2 lines
Best Regards
Masahiro Yamada