kernkonzept / manifest

The main L4Re manifest to checkout the L4Re operating system.
GNU General Public License v2.0
19 stars 5 forks source link

Running L4Re on AMD64 Not Working #22

Closed georglauterbach closed 1 year ago

georglauterbach commented 1 year ago

This is another weird one (after #21). When the built finally succeeded, I wanted to try out the hello world example on AMD64. But it would not boot! The SeaBIOS would show: Booting from ROM.., but nothing more.

I again began a search (going down a rabbit hole). I checked the bootstrap binary, as this was the first binary loaded. The 32bit versions worked fine, booted nicely, everything was working well on 32bit, but I want 64bit! So I compared the two bootstrap binaries, checked multiboot, tried different qemu versions, ...

In the end, the issue seems to be related to the start address in the ELF. The custom linker script for the bootstrap binary puts the text segment at 0x10000000. This seemed very high to me, especially considering that we start in 32bit mode in the BIOS. I removed a 0 (i.e. made it 0x1000000), and voila, all is well, were booting fine.

Is this seriously a valid fix? If so, why do I have to apply it? Is no one else using L4Re on AMD64?

I will provide a PR for this later, if we agree that this is a valid fix. And we should probably find the root cause, because to me, it was just a feeling that the address is too high, but I haven't done any calculations yet.

icedieler commented 1 year ago

This also looks strange to me. We are booting L4Re on AMD64 with qemu on a daily basis. In issue #21 you mentioned you are using some kind of VM. May this be also related? Could you please attach the output of make report here?

How are you trying to start the hello example? With make qemu E=hello?

jermar commented 1 year ago

@georglauterbach, can you make sure you have something like -m 512 in your QEMU command line. This symptom could be caused by an absence of this option.

georglauterbach commented 1 year ago

How are you trying to start the hello example? With make qemu E=hello?

The command I am using reads V=1 make qemu E=hello MODULE_SEARCH_PATH="${PWD}/../fiasco" QEMU_OPTIONS="-nographic".


@georglauterbach, can you make sure you have something like -m 512 in your QEMU command line. This symptom could be caused by an absence of this option.

Adding this to QEMU_OPTIONS solved the issue - nice! Didn't think QEMU would only provide 128M of initial main memory. The trip down linker-script-lane was interesting though.

Thank you guys a lot!

icedieler commented 1 year ago

Glad that it works now.

Just two additional notes from my side. The way you use QEMU_OPTIONS here clears and overrides all options the build system may have already set. So, a better approach would be to use a custom Makeconf.boot file. You can e.g. copy the existing example from l4/conf/Makeconf.boot.example to l4/conf and then add your necessary options to e.g. the QEMU_OPTIONS-amd64 variable.