Skip to contentSkip to conversation

cni: cherry pick fixes from master

PATCH Applied [email protected] 2 participants 5 messages Dec 11, 2023 – Dec 14, 2023

lore
Share & tools
lore
#0 lore raw

cover cni: cherry pick fixes from master

From: Ming Liu <[email protected]>

We observed some library relocating issues on cni recipe, cherry pick some fixes from master.

Bruce Ashfield (1):
cni: reproducible builds: pass -trimpath

Changqing Li (1):
cni: clean dir ${B}/plugins before do_compile

Chen Qi (1):
cni: fix textrel QA issue

 recipes-networking/cni/cni_git.bb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 cni: reproducible builds: pass -trimpath

From: Bruce Ashfield <[email protected]>

---
 recipes-networking/cni/cni_git.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
recipes-networking/cni/cni_git.bb +3 -3
index cac62ae1..fd9115ab 100644
@@ -39,10 +39,10 @@ do_compile() {
 	export GO111MODULE=off
 
 	cd ${B}/src/github.com/containernetworking/cni/libcni
-	${GO} build
+	${GO} build -trimpath
 
 	cd ${B}/src/github.com/containernetworking/cni/cnitool
-	${GO} build
+	${GO} build -trimpath
 
 	cd ${B}/src/github.com/containernetworking/plugins
 	PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls -d plugins/main/* | grep -v windows)"
@@ -50,7 +50,7 @@ do_compile() {
 	for p in $PLUGINS; do
 	    plugin="$(basename "$p")"
 	    echo "building: $p"
-	    ${GO} build -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
+	    ${GO} build -trimpath -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
 	done
 }
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/3 cni: fix textrel QA issue

In reply to [email protected]

From: Chen Qi <[email protected]>

When building cni, we get textrel QA issue like below:

cni: ELF binary /usr/libexec/cni/macvlan has relocations in .text

The problem could be solved by adding '-buildmode=pie' to ${GO}.

In go.bbclass, this flag is added to GOBUILDFLAGS conditionally, that is, if the arch is not mips nor riscv32, this '-buildmode=pie' is added to GOBUILDFLAGS. So make use of that.

---
 recipes-networking/cni/cni_git.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
recipes-networking/cni/cni_git.bb +3 -3
index fd9115ab..854c7a04 100644
@@ -39,10 +39,10 @@ do_compile() {
 	export GO111MODULE=off
 
 	cd ${B}/src/github.com/containernetworking/cni/libcni
-	${GO} build -trimpath
+	${GO} build ${GOBUILDFLAGS}
 
 	cd ${B}/src/github.com/containernetworking/cni/cnitool
-	${GO} build -trimpath
+	${GO} build ${GOBUILDFLAGS}
 
 	cd ${B}/src/github.com/containernetworking/plugins
 	PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls -d plugins/main/* | grep -v windows)"
@@ -50,7 +50,7 @@ do_compile() {
 	for p in $PLUGINS; do
 	    plugin="$(basename "$p")"
 	    echo "building: $p"
-	    ${GO} build -trimpath -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
+	    ${GO} build ${GOBUILDFLAGS} -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
 	done
 }
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/3 cni: clean dir ${B}/plugins before do_compile

In reply to [email protected]

From: Changqing Li <[email protected]>

Clean dir ${B}/plugins before do_compile to avoid cni generated binaries like /usr/libexec/cni/bridge has wrong dynamic linker path and reports error like: /usr/libexec/cni/bridge: no such file or directory".

Reproduce steps:
1. bitbake cni
2. enable usrmerge feature in local.conf
3. bitbake cni

After step 2, GOBUILDFLAGS changed,
"-I /lib64/ld-linux-aarch64.so.1" -> "/usr/lib/ld-linux-aarch64.so.1"

But "go build" seems only check if the cached packagefile changed, since all not changed, the dynamic linker still use the old one, maybe go build should improve this.

Clean dir ${B}/plugins to trigger rebuild of the binaries here.

---
 recipes-networking/cni/cni_git.bb | 2 ++
 1 file changed, 2 insertions(+)
recipes-networking/cni/cni_git.bb +2 -0
index 854c7a04..f84e8a43 100644
@@ -54,6 +54,8 @@ do_compile() {
 	done
 }
 
+do_compile[cleandirs] = "${B}/plugins"
+
 do_install() {
     localbindir="${libexecdir}/cni/"
 
Signature · 1 line
2.34.1
#4 lore raw
In reply to [email protected]

In message: [meta-virtualization] [kirkstone] [PATCH 0/3] cni: cherry pick fixes from master

Quoted 5 lines · on 11/12/2023 Ming Liu wrote:

From: Ming Liu <[email protected]>

We observed some library relocating issues on cni recipe, cherry pick some fixes from master.

Quoted 8 lines

Bruce Ashfield (1):
cni: reproducible builds: pass -trimpath

Changqing Li (1):
cni: clean dir ${B}/plugins before do_compile

Chen Qi (1):
cni: fix textrel QA issue

merged to kirkstone.

Bruce

Quoted 17 lines
 recipes-networking/cni/cni_git.bb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8491): https://lists.yoctoproject.org/g/meta-virtualization/message/8491
Mute This Topic: https://lists.yoctoproject.org/mt/103105934/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-