Skip to contentSkip to conversation

contrib: fix out-of-tree build with jerry-rig.sh

PATCH In review Benedikt Morbach 2 participants 4 messages May 10, 2017 – May 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 contrib: fix out-of-tree build with jerry-rig.sh

this makes the build system put the objects in ${O}/net/wireguard
instead of ${O}/../../../../../../../../../../../../../../../../../../../../../..${WG}/ (where ${WG} is the full path to wireguard/src), allowing out-of-tree kernel builds to work with WireGuard jerry-rigged in.

---
 contrib/kernel-tree/jerry-rig.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
contrib/kernel-tree/jerry-rig.sh +3 -2
index 3d4139a..afc1d9d 100755
@@ -8,5 +8,6 @@ if [[ ! -e $K/net/Kconfig ]]; then
 	exit 1
 fi
 
-sed -i "/^if INET\$/a source \"$WG/Kconfig\"" "$K/net/Kconfig"
-echo "obj-y += ../../../../../../../../../../../../../../../../../../../../../..$WG/" >> "$K/net/Makefile"
+ln -sfT "../../../../../../../../../../../../../../../../../../../../../..$WG/" "$K/net/wireguard"
+sed -i "/^if INET\$/a source \"net/wireguard/Kconfig\"" "$K/net/Kconfig"
+echo "obj-y += wireguard/" >> "$K/net/Makefile"
Signature · 1 line
2.12.2
#1 lore raw

Hey,

Interesting patch. Is the idea here that using a symlink fixes some issue with just putting all the ../../../../.. stuff in the file directly? If so, what was the problem exactly? I use the existing jerry-rig.sh thing successfully, so I'm wondering under what circumstances it breaks.

Thanks,
Jason

#2 lore raw

Hi Jason,

I started doing out-of-tree kernel builds with "make KBUILD_OUTPUT=/foo". While it does work, it puts wireguards .o files in /foo/net/../../../..../wireguard/src, which isn't exactly what I expected/intended. By changing the path in the Makefile the .o files end up in /foo/net/wireguard.

Thanks
Benedikt