diff options
| author | Ross Burton <ross.burton@arm.com> | 2025-02-27 15:35:34 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-05 21:26:54 +0000 |
| commit | 77415816bc51abbbb37dcc2a0546d9b33ccd665a (patch) | |
| tree | 918742c04f2a1240c2102f57671fcb33b34d86cf /meta/recipes-extended/ltp | |
| parent | 274827980cf33c8901c8e3cee2d7775525fa2295 (diff) | |
| download | poky-77415816bc51abbbb37dcc2a0546d9b33ccd665a.tar.gz | |
ltp: don't use host objcopy
The kernel/kvm test uses the host objcopy when building a payload, but
the host objcopy might not know how to deal with target binaries:
CC testcases/kernel/kvm/lib_host.o
objcopy: Unable to recognise the format of the input file `kvm_svm03-payload.elf'
make[3]: *** [ltp/testcases/kernel/kvm/Makefile:67: kvm_svm03-payload.o] Error 1
Solve this by using the host-prefixed objcopy binary.
(From OE-Core rev: 74818f79bd9a206f77ae3d26b19657116fd956cc)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/ltp')
| -rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-kernel-kvm-don-t-hardcode-objcopy.patch | 69 | ||||
| -rw-r--r-- | meta/recipes-extended/ltp/ltp_20250130.bb | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-kernel-kvm-don-t-hardcode-objcopy.patch b/meta/recipes-extended/ltp/ltp/0001-kernel-kvm-don-t-hardcode-objcopy.patch new file mode 100644 index 0000000000..256c8eaa34 --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0001-kernel-kvm-don-t-hardcode-objcopy.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | From 0a42a8ee0ae8c6f1e603c1836b7c9c7fab0ca3a8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ross Burton <ross.burton@arm.com> | ||
| 3 | Date: Thu, 27 Feb 2025 12:38:50 +0000 | ||
| 4 | Subject: [PATCH] kernel/kvm: don't hardcode objcopy | ||
| 5 | |||
| 6 | testcases/kernel/kvm uses objcopy to contruct a payload binary, but in | ||
| 7 | cross builds the host objcopy may not know how to handle target | ||
| 8 | binaries: | ||
| 9 | |||
| 10 | CC testcases/kernel/kvm/lib_host.o | ||
| 11 | objcopy: Unable to recognise the format of the input file `kvm_svm03-payload.elf' | ||
| 12 | make[3]: *** [ltp/testcases/kernel/kvm/Makefile:67: kvm_svm03-payload.o] Error 1 | ||
| 13 | |||
| 14 | This is trivially fixed by searching for an objcopy tool (so | ||
| 15 | host-prefixed in cross builds) and using that instead. | ||
| 16 | |||
| 17 | Upstream-Status: Backport [a3942c0a5f9b4463e8320e80cd8522a2e008bfd2] | ||
| 18 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
| 19 | --- | ||
| 20 | configure.ac | 1 + | ||
| 21 | include/mk/config.mk.in | 1 + | ||
| 22 | testcases/kernel/kvm/Makefile | 4 ++-- | ||
| 23 | 3 files changed, 4 insertions(+), 2 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/configure.ac b/configure.ac | ||
| 26 | index 344b2ae2c..0f2b6f332 100644 | ||
| 27 | --- a/configure.ac | ||
| 28 | +++ b/configure.ac | ||
| 29 | @@ -30,6 +30,7 @@ AC_PROG_RANLIB | ||
| 30 | AC_DEFUN([AC_PROG_STRIP], [AC_CHECK_TOOL(STRIP, strip, :)]) | ||
| 31 | AC_PROG_STRIP | ||
| 32 | AC_PROG_YACC | ||
| 33 | +AC_CHECK_TOOL([OBJCOPY], [objcopy], [:]) | ||
| 34 | |||
| 35 | m4_ifndef([PKG_CHECK_EXISTS], | ||
| 36 | [m4_fatal([must install pkg-config or pkgconfig and pkg.m4 macro (usual dependency), see INSTALL])]) | ||
| 37 | diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in | ||
| 38 | index 2b7c8a071..4c3da304f 100644 | ||
| 39 | --- a/include/mk/config.mk.in | ||
| 40 | +++ b/include/mk/config.mk.in | ||
| 41 | @@ -11,6 +11,7 @@ AR := @AR@ | ||
| 42 | CC := @CC@ | ||
| 43 | LEX := @LEX@ | ||
| 44 | RANLIB := @RANLIB@ | ||
| 45 | +OBJCOPY := @OBJCOPY@ | ||
| 46 | STRIP := @STRIP@ | ||
| 47 | YACC := @YACC@ | ||
| 48 | |||
| 49 | diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile | ||
| 50 | index 07bdd9705..e93528a33 100644 | ||
| 51 | --- a/testcases/kernel/kvm/Makefile | ||
| 52 | +++ b/testcases/kernel/kvm/Makefile | ||
| 53 | @@ -60,11 +60,11 @@ include $(top_srcdir)/include/mk/generic_leaf_target.mk | ||
| 54 | %-payload.o: %.c lib_guest.o $(ARCH_OBJ) | ||
| 55 | ifdef VERBOSE | ||
| 56 | $(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) | ||
| 57 | - objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin | ||
| 58 | + $(OBJCOPY) -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin | ||
| 59 | $(KVM_LD) -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin | ||
| 60 | else | ||
| 61 | @$(CC) $(GUEST_CPPFLAGS) $(GUEST_CFLAGS) $(GUEST_LDFLAGS) -o $*-payload.elf $^ $(GUEST_LDLIBS) | ||
| 62 | - @objcopy -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin | ||
| 63 | + @$(OBJCOPY) -O binary -j .init.boot -j .text -j .data -j .init -j .preinit_array -j .init_array --gap-fill=0 $*-payload.elf $*-payload.bin | ||
| 64 | @$(KVM_LD) -z noexecstack -r -T $(abs_srcdir)/linker/payload.lds --oformat=$(BIN_FORMAT) -o $@ $*-payload.bin | ||
| 65 | @echo KVM_CC $(target_rel_dir)$@ | ||
| 66 | endif | ||
| 67 | -- | ||
| 68 | 2.43.0 | ||
| 69 | |||
diff --git a/meta/recipes-extended/ltp/ltp_20250130.bb b/meta/recipes-extended/ltp/ltp_20250130.bb index 96e402a79b..690224e6d7 100644 --- a/meta/recipes-extended/ltp/ltp_20250130.bb +++ b/meta/recipes-extended/ltp/ltp_20250130.bb | |||
| @@ -29,6 +29,7 @@ SRCREV = "a7c31dff7edc089a32e990765e12952cc4d7666a" | |||
| 29 | SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \ | 29 | SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \ |
| 30 | file://0001-Remove-OOM-tests-from-runtest-mm.patch \ | 30 | file://0001-Remove-OOM-tests-from-runtest-mm.patch \ |
| 31 | file://0001-Add-__clear_cache-declaration-for-clang.patch \ | 31 | file://0001-Add-__clear_cache-declaration-for-clang.patch \ |
| 32 | file://0001-kernel-kvm-don-t-hardcode-objcopy.patch \ | ||
| 32 | " | 33 | " |
| 33 | 34 | ||
| 34 | S = "${WORKDIR}/git" | 35 | S = "${WORKDIR}/git" |
