keystone-enclave / keystone-sdk

SDK for Keystone Enclave - ABI/SBI libraries and sample apps
Other
44 stars 22 forks source link

Keystone for bare metal #4

Closed DurandA closed 5 years ago

DurandA commented 5 years ago

When reading RISC-V Summit slides, I got the impression that Keystone was not built for a specific OS as long as it provides SBI to the Security Monitor.

However, I noticed in the documentation that I should also compile linux as part of the riscv-gnu-toolchain. If I fail to do so, compiling the SDK fails due to a missing header part of glibc:

riscv64-unknown-linux-gnu-gcc -Iinclude -c src/tiny-malloc.c -o src/tiny-malloc.o
In file included from /opt/riscv/sysroot/usr/include/features.h:447,
                 from /opt/riscv/sysroot/usr/include/bits/libc-header-start.h:33,
                 from /opt/riscv/sysroot/usr/include/stdint.h:26,
                 from /opt/riscv/lib/gcc/riscv64-unknown-linux-gnu/8.2.0/include/stdint.h:9,
                 from include/string.h:4,
                 from src/tiny-malloc.c:60:
/opt/riscv/sysroot/usr/include/gnu/stubs.h:23:11: fatal error: gnu/stubs-lp64d.h: No such file or directory

Can you clarify the situation if the current SDK is made purposely for Linux as host OS?

dkohlbre commented 5 years ago

Hi, the plan is absolutely to have Keystone be as host-OS and build OS agnostic as possible. (Host-OS being the OS that runs on the RISC-V platform, build-OS being the OS that you compile your apps/runtimes/etc on)

Currently the driver that talks to the SBI is Linux-only, but that is because we've got experience with stable Linux on RISC-V platforms. That said, the rest of the setup (toolchain, SDK parts, etc) we intend to be as build-OS/host-OS independent as we can.

It looks like the issue you are having is a build-time dependency, it shouldn't affect runtime. We've only been testing builds on Linux as well, since its been our default development setup.Thanks for pointing out we have a dep there.

What OS are you doing the build on, and what OS are you hoping to run as the host-OS on the RISC-V platform? Hopefully we can figure out an easy way to make this more portable.

DurandA commented 5 years ago

Thank you for the clarification.

I don't have specific requirements. I discovered this project and wanted to run the demo in QEMU out of curiosity. It made me wonder if this project is suitable for embedded/constrained environments.