laforge has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/33774 )
Change subject: scripts/kernel-test: adjust to usr-merge ......................................................................
scripts/kernel-test: adjust to usr-merge
In debian bookworm, the /usr merge has been implemented:
/bin → /usr/bin /sbin → /usr/sbin /lib → /usr/lib /lib64 → /usr/lib64
The initramfs filesystem layout is derived from the paths of the binaries and libraries in the full system. Create the same symlinks and adjust initrd_add_bin so it does not trip over the symlinks.
I've also considered to change all input for initrd_add_bin to point at the /usr/… paths. But this is not possible, for example ldd/lddtree will point at libraries in /lib and /lib64, and this gets passed to initrd_add_bin.
Without this patch, the init script and all binaries called from it cannot be executed.
Related: OS#6057 Related: https://wiki.debian.org/UsrMerge Change-Id: I975d3af0fa88869688673936a08189de800fba29 --- M scripts/kernel-test/initrd-build.sh 1 file changed, 49 insertions(+), 3 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/scripts/kernel-test/initrd-build.sh b/scripts/kernel-test/initrd-build.sh index cce4de8..6c17ffa 100755 --- a/scripts/kernel-test/initrd-build.sh +++ b/scripts/kernel-test/initrd-build.sh @@ -1,9 +1,22 @@ #!/bin/sh -ex
-# Add one or more files to the initramfs, with parent directories +# Add one or more files to the initramfs, with parent directories. +# usr-merge: resolve symlinks for /lib -> /usr/lib etc. so "cp --parents" does +# not fail with "cp: cannot make directory '/tmp/initrd/lib': File exists" # $@: path to files initrd_add_file() { - cp -a --parents "$@" /tmp/initrd + local i + + for i in "$@"; do + case "$i" in + /bin/*|/sbin/*|/lib/*|/lib64/*) + cp -a --parents "$@" /tmp/initrd/usr + ;; + *) + cp -a --parents "$@" /tmp/initrd + ;; + esac + done }
# Add kernel module files with dependencies @@ -82,10 +95,13 @@ mkdir -p /tmp/initrd cd /tmp/initrd
+for dir in bin sbin lib lib64; do + ln -s usr/"$dir" "$dir" +done + mkdir -p \ dev/net \ proc \ - sbin \ sys \ tmp \ usr/bin \