How do I reduce the size of the seL4 executable?
![](https://secure.gravatar.com/avatar/d9524503ff7b0732167b3207fe1f757e.jpg?s=120&d=mm&r=g)
Hello, I'm trying to compile a simple 'hello world' sel4 program for the polarfire (riscv) and I want the executable to be as small as possible. According to the FAQ (https://docs.sel4.systems/projects/sel4/frequently-asked-questions.html) the single core kernel can compile to a <200kb executable but in my testing, I always end up with an image of approx 2MB. I worked with this (https://github.com/mskordal/SeL4-hello-world) example project and changed main.c to work with seL4_DebugPutChar instead of printf. Besides that, I added opensbi to the tools folder and slightly modified line 32 of projects/hello/CMakeList.txt to target_link_libraries(hello sel4 sel4_autoconf sel4runtime sel4platsupport). After running ../init-build.sh -DPLATFORM=polarfire and ninja, I end up with an executable of about 2MB. I'm guessing musllibc, util_libs and sel4_libs contribute to the size, but if I change my cmakelist file to try to get rid of them the build will fail. I was hoping since my hello world only uses sel4 APIs I could compile it without musllibc, util_libs and sel4_libs but I haven't been able to figure out how. Any help or tips would be greatly appreciated. Kind Regards, Liam
participants (1)
-
liam.vervecken@gmail.com