Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zcu102 hello example build with SEL4CP_CONFIG=release fails #35

Open
alain-lclark opened this issue Jun 22, 2023 · 4 comments
Open

zcu102 hello example build with SEL4CP_CONFIG=release fails #35

alain-lclark opened this issue Jun 22, 2023 · 4 comments
Assignees

Comments

@alain-lclark
Copy link

I'm trying to build the zcu102 hello example with SEL4CP_CONFIG set to "release" but it fails with the error message:

Traceback (most recent call last):
  File "runpy", line 197, in _run_module_as_main
  File "runpy", line 87, in _run_code
  File "sel4coreplat.__main__", line 1781, in <module>
  File "sel4coreplat.__main__", line 1632, in main
  File "sel4coreplat.__main__", line 674, in build_system
  File "sel4coreplat.sel4", line 819, in emulate_kernel_boot_partial
  File "sel4coreplat.sel4", line 791, in _kernel_partial_boot
  File "sel4coreplat.sel4", line 718, in _kernel_device_addrs
  File "sel4coreplat.elf", line 442, in find_symbol
KeyError: 'No symbol named kernel_device_frames found'

I can build a "debug" binary w/o any issue.

I'm using Nataliya Korovkina's docker file. I'm using the latest sel4cp sources (commit 192c223).

The command I'm using:

PATH=$PATH:/usr/local/musl/aarch64/bin:/usr/local/gcc-x86_64-aarch64-none-elf/bin make BUILD_DIR=./release SEL4CP_SDK=/host/sandbox/tmp/sel4cp/release/sel4cp-sdk-1.2.6 SEL4CP_BOARD=zcu102 SEL4CP_CONFIG=release

The output prior to the error message:

aarch64-none-elf-gcc -c -mcpu=cortex-a53 -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall  -Wno-unused-function -Werror -I/host/sandbox/tmp/sel4cp/release/sel4cp-sdk-1.2.6/board/zcu102/release/include hello.c -o release/hello.o
aarch64-none-elf-ld -L/host/sandbox/tmp/sel4cp/release/sel4cp-sdk-1.2.6/board/zcu102/release/lib release/hello.o -lsel4cp -Tsel4cp.ld -o release/hello.elf
/host/sandbox/tmp/sel4cp/release/sel4cp-sdk-1.2.6/bin/sel4cp hello.system --search-path ./release --board zcu102 --config release -o ./release/loader.img -r ./release/report.txt

I'm getting a similar error message for other platforms (e.g., Odroid-C2).

@Ivan-Velickovic
Copy link
Collaborator

Hi Alain, I've recently discovered this issue as well. What's happening is that the seL4CP tool uses the kernel_device_frames array in the kernel ELF to know which device untypeds are not available to the user. Now what's happening with a release build of the kernel is that the compiler is doing optimisations and has decided to instead remove the array all together and I assume inline the accesses. This means that the symbol is gone by the time seL4CP reads the final kernel ELF.

So, how do we fix this? Fortunately there is instead a configuration file outputted by the kernel that contains the same data essentially and we can instead read from this instead of inspecting the kernel ELF. I'm waiting for seL4/seL4#1061 to go through first, and then should be able to make a PR here with the fix.

@Ivan-Velickovic
Copy link
Collaborator

I'm going to be on leave soon for a couple weeks and so if you need an urgent solution, this one line change to the kernel will also work: Ivan-Velickovic/seL4@4542369.

@alain-lclark
Copy link
Author

Hi Ivan. It's not urgent. Just wanted to log the error. For now, I'm happy with debug builds. Thanks for the quick reply.

@Ivan-Velickovic
Copy link
Collaborator

No worries, thanks for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants