[Buildroot] selftests/sgx

Peter Seiderer ps.report at gmx.net
Tue May 17 20:48:09 UTC 2022


Hello Jarkko,

On Tue, 17 May 2022 20:06:51 +0300, Jarkko Sakkinen <jarkko.sakkinen at iki.fi> wrote:

> On Sun, 2022-05-08 at 23:38 +0200, Peter Seiderer wrote:
> > Hello Jarkko,
> > 
> > On Sat, 07 May 2022 23:03:57 +0300, Jarkko Sakkinen <jarkko.sakkinen at iki.fi> wrote:
> >   
> > > Hi,
> > > 
> > > When specifying "BR2_PACKAGE_LINUX_TOOLS_SELFTESTS=y", for some reason
> > > tools/testing/selftests/sgx/ build results, i.e. "sgx:test_sgx", does
> > > not get included to the rootfs image, nor is it listed in 
> > > kselftest-list.txt.
> > > 
> > > If I manually compile and install selftests, it does get included. Any
> > > ideas what could be wrong?  
> > 
> > For which architecture do you (cross) compile (what is your target architecture)?
> > 
> > According to e.g. [1]:
> > 
> > [...]
> >   7 CAN_BUILD_X86_64 := $(shell ../x86/check_cc.sh $(CC) \
> >   8   
> > [...]
> >  19 TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx
> >  20 
> >  21 ifeq ($(CAN_BUILD_X86_64), 1)
> >  22 all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf
> >  23 endif
> > [...]  
> 
> Hi,
> 
> My config is contained fully here:
> 
> https://github.com/jarkkojs/buildroot-sgx/blob/master/configs/sgx_x86_64_defconfig
> 
> And my kernel config is here:
> 
> https://github.com/jarkkojs/buildroot-sgx/blob/master/board/sgx/x86_64/linux.config
> 
> I.e. can be built with "make sgx_x86_64_defconfig && make".
> 

The original error message from linux-5.17.7/tools/testing/selftests/sgx is
(Note: no global failure in linux-tools/selftests in case one or more of the
test case compiles fail):

  .../host/bin/x86_64-buildroot-linux-gnu-gcc -Wall -Werror -g -I../../../../tools/include -fPIC -z noexecstack -c sigstruct.c -o .../build/linux-5.17.7/tools/testing/selftests/kselftest/sgx/sigstruct.o
  sigstruct.c:15:10: fatal error: openssl/err.h: No such file or directory
     15 | #include <openssl/err.h>
        |          ^~~~~~~~~~~~~~~
  compilation terminated.

You need to enable 'BR2_PACKAGE_OPENSSL' in your defconfig and apply
the following buildroot patch:

--- a/package/linux-tools/linux-tool-selftests.mk.in
+++ b/package/linux-tools/linux-tool-selftests.mk.in
@@ -18,6 +18,10 @@ endif
 
 SELFTESTS_DEPENDENCIES = libcap-ng popt
 
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+SELFTESTS_DEPENDENCIES += openssl
+endif
+
 SELFTESTS_MAKE_FLAGS = \
        $(LINUX_MAKE_FLAGS) \
        ARCH=$(SELFTESTS_ARCH)


Regards,
Peter


> > test_sgx is only compiled for x86_64 (and/or CAN_BUILD_X86_64 is true)...
> > 
> > Regards,
> > Peter  
> 
> BR, Jarkko
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot




More information about the buildroot mailing list