Hi,
while booting Genode directly on Linux I encountered the problem that Linux requires to call `/init` in the initramfs. Unfortunately Genode requires to call `core` which loads `init` so renaming core to init isn't enough.
I renamed init to init2 core to init and called it with "label=init2" which works at first (core finds all ROM sessions) but then segfaults with "init2[45]: segfault at 7f11c473b128 ip 00007f11c4645f40 sp 00007ffc1c8c15f8 error 4 in ld.lib.so[7f11c45c5000+95000]" and the warning "Warning: blocking canceled in entrypoint constructor".
This warning was addressed on Linux before in [0] and fixed in ad2859b6b9dae96c48329eebc0a73527ba4deb9b. I have already included this patch.
To boot Genode on Linux with this behaviour, checkout [1] and change "KERNEL_RUN_OPT(linux) := --include power_on/linux --include log/linux" to "KERNEL_RUN_OPT(linux) := $(QEMU_RUN_OPT)" in your etc/build.conf (with linux as kernel ofc).
Beside renaming I also tried to make the ROM session chdir into a sub directory or to prepend this directory to the binary name. Neither of made Genode correctly find the binaries. I have to say that Linux is not booting into a real fs but is using a initramfs which consists of a cpio archive.
What would be the way to go to either rename the binaries to a Linux compatible scheme or to change the library search to find its binaries in a cpio archive (both options should be changeable at build time to still use the current linux)?
Regards, Johannes
[0]: https://github.com/genodelabs/genode/issues/2521 [1]: https://github.com/jklmnn/genode/commit/ef4becffcfc4bfc4079ff411872023b0362f...
Hi again,
I fixed the file naming and I don't need to rename the files anymore (I forgot to prepend the correct directory in the cpio archive). With the cpio initramfs I chdir into /genode from the ROM session and correctly find the libraries. Yet the segfault and warning I described in the last mail still appear.
To reproduce the problem with the current state, check out [1]. The build configuration is the same as in the last mail.
Regards, Johannes
[1]: https://github.com/jklmnn/genode/commit/2c899063f2bad1318bbde88f2472e017fc72...
On 10/24/17 11:27, Johannes Kliemann wrote:
Hi,
while booting Genode directly on Linux I encountered the problem that Linux requires to call `/init` in the initramfs. Unfortunately Genode requires to call `core` which loads `init` so renaming core to init isn't enough.
I renamed init to init2 core to init and called it with "label=init2" which works at first (core finds all ROM sessions) but then segfaults with "init2[45]: segfault at 7f11c473b128 ip 00007f11c4645f40 sp 00007ffc1c8c15f8 error 4 in ld.lib.so[7f11c45c5000+95000]" and the warning "Warning: blocking canceled in entrypoint constructor".
This warning was addressed on Linux before in [0] and fixed in ad2859b6b9dae96c48329eebc0a73527ba4deb9b. I have already included this patch.
To boot Genode on Linux with this behaviour, checkout [1] and change "KERNEL_RUN_OPT(linux) := --include power_on/linux --include log/linux" to "KERNEL_RUN_OPT(linux) := $(QEMU_RUN_OPT)" in your etc/build.conf (with linux as kernel ofc).
Beside renaming I also tried to make the ROM session chdir into a sub directory or to prepend this directory to the binary name. Neither of made Genode correctly find the binaries. I have to say that Linux is not booting into a real fs but is using a initramfs which consists of a cpio archive.
What would be the way to go to either rename the binaries to a Linux compatible scheme or to change the library search to find its binaries in a cpio archive (both options should be changeable at build time to still use the current linux)?
Regards, Johannes
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Also, you could use the kernel command line, e.g. "init=/genode/core".
On Tue, Oct 24, 2017 at 10:20 AM, Johannes Kliemann < Johannes.Kliemann@...250...> wrote:
Hi again,
I fixed the file naming and I don't need to rename the files anymore (I forgot to prepend the correct directory in the cpio archive). With the cpio initramfs I chdir into /genode from the ROM session and correctly find the libraries. Yet the segfault and warning I described in the last mail still appear.
To reproduce the problem with the current state, check out [1]. The build configuration is the same as in the last mail.
Regards, Johannes
e88f2472e017fc72be34
On 10/24/17 11:27, Johannes Kliemann wrote:
Hi,
while booting Genode directly on Linux I encountered the problem that Linux requires to call `/init` in the initramfs. Unfortunately Genode requires to call `core` which loads `init` so renaming core to init isn't enough.
I renamed init to init2 core to init and called it with "label=init2" which works at first (core finds all ROM sessions) but then segfaults with "init2[45]: segfault at 7f11c473b128 ip 00007f11c4645f40 sp 00007ffc1c8c15f8 error 4 in ld.lib.so[7f11c45c5000+95000]" and the warning "Warning: blocking canceled in entrypoint constructor".
This warning was addressed on Linux before in [0] and fixed in ad2859b6b9dae96c48329eebc0a73527ba4deb9b. I have already included this patch.
To boot Genode on Linux with this behaviour, checkout [1] and change "KERNEL_RUN_OPT(linux) := --include power_on/linux --include log/linux" to "KERNEL_RUN_OPT(linux) := $(QEMU_RUN_OPT)" in your etc/build.conf (with linux as kernel ofc).
Beside renaming I also tried to make the ROM session chdir into a sub directory or to prepend this directory to the binary name. Neither of made Genode correctly find the binaries. I have to say that Linux is not booting into a real fs but is using a initramfs which consists of a cpio archive.
What would be the way to go to either rename the binaries to a Linux compatible scheme or to change the library search to find its binaries in a cpio archive (both options should be changeable at build time to still use the current linux)?
Regards, Johannes
f411872023b0362f346c
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hi,
thanks for that info, but I think there's a misunderstanding. The kernel command line "init=" is only evaluated if the kernel boots without initrd or initramfs. Initramfs does always need /init (such as an initrd always needs /linuxrc) [1]. This is only relevant to the init system used after the root fs is mounted. This is supported by man 7 bootparam which says
'init=...' This sets the initial command to be executed by the kernel. If this is not set, or cannot be found, the kernel will try /sbin/init, then /etc/init, then /bin/init, then /bin/sh and panic if all of this fails.
I have also tested this behavior by running Genode on Linux with init=/genode/core which still resulted in the kernel loading /init from the initramfs.
Sorry for the slight off topic. If I have any mistakes in my thoughts please correct me.
Regards, Johannes
[1]: https://wiki.debian.org/initramfs
On 10/24/17 18:59, Nobody III wrote:
Also, you could use the kernel command line, e.g. "init=/genode/core".
On Tue, Oct 24, 2017 at 10:20 AM, Johannes Kliemann <Johannes.Kliemann@...250... mailto:Johannes.Kliemann@...250...> wrote:
Hi again, I fixed the file naming and I don't need to rename the files anymore (I forgot to prepend the correct directory in the cpio archive). With the cpio initramfs I chdir into /genode from the ROM session and correctly find the libraries. Yet the segfault and warning I described in the last mail still appear. To reproduce the problem with the current state, check out [1]. The build configuration is the same as in the last mail. Regards, Johannes [1]: https://github.com/jklmnn/genode/commit/2c899063f2bad1318bbde88f2472e017fc72be34 <https://github.com/jklmnn/genode/commit/2c899063f2bad1318bbde88f2472e017fc72be34> On 10/24/17 11:27, Johannes Kliemann wrote: Hi, while booting Genode directly on Linux I encountered the problem that Linux requires to call `/init` in the initramfs. Unfortunately Genode requires to call `core` which loads `init` so renaming core to init isn't enough. I renamed init to init2 core to init and called it with "label=init2" which works at first (core finds all ROM sessions) but then segfaults with "init2[45]: segfault at 7f11c473b128 ip 00007f11c4645f40 sp 00007ffc1c8c15f8 error 4 in ld.lib.so <http://ld.lib.so>[7f11c45c5000+95000]" and the warning "Warning: blocking canceled in entrypoint constructor". This warning was addressed on Linux before in [0] and fixed in ad2859b6b9dae96c48329eebc0a73527ba4deb9b. I have already included this patch. To boot Genode on Linux with this behaviour, checkout [1] and change "KERNEL_RUN_OPT(linux) := --include power_on/linux --include log/linux" to "KERNEL_RUN_OPT(linux) := $(QEMU_RUN_OPT)" in your etc/build.conf (with linux as kernel ofc). Beside renaming I also tried to make the ROM session chdir into a sub directory or to prepend this directory to the binary name. Neither of made Genode correctly find the binaries. I have to say that Linux is not booting into a real fs but is using a initramfs which consists of a cpio archive. What would be the way to go to either rename the binaries to a Linux compatible scheme or to change the library search to find its binaries in a cpio archive (both options should be changeable at build time to still use the current linux)? Regards, Johannes [0]: https://github.com/genodelabs/genode/issues/2521 <https://github.com/genodelabs/genode/issues/2521> [1]: https://github.com/jklmnn/genode/commit/ef4becffcfc4bfc4079ff411872023b0362f346c <https://github.com/jklmnn/genode/commit/ef4becffcfc4bfc4079ff411872023b0362f346c> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net <mailto:genode-main@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/genode-main <https://lists.sourceforge.net/lists/listinfo/genode-main> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net <mailto:genode-main@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/genode-main <https://lists.sourceforge.net/lists/listinfo/genode-main>
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hi Johannes,
for bootstrapping core, I'd create a custom (statically compiled) program that merely performs a 'chdir /genode' followed by 'execve '/genode/core'. This keeps core clean of the bootstrapping magic. This bootstrapping program can be called '/init' whereas everything Genode-related resides as '/genode/'.
I have no good idea about the segfault though. It definitely happens in init, not core because the fault occurs in 'ld.lib.so', which is not used by core. You may inspect the debug version of the ld.lib.so binary (using 'objdump -lSd debug/ld-linux.lib.so') at the faulting ip. The offset from the start of 'ld-linux.lib.so' can be calculated by subtracting the load address of ld.lib.so (as reported by the kernel) from the ip of the fault.
Cheers Norman
Hi Norman,
using a separate init to chdir also made the segfault disappear and I can now successfully run the timer test on Linux [1].
Regards, Johannes
[1]: https://github.com/jklmnn/genode/commit/5cee03703b78018ab42398a3245f8bb148ca...
On 10/25/17 11:39, Norman Feske wrote:
Hi Johannes,
for bootstrapping core, I'd create a custom (statically compiled) program that merely performs a 'chdir /genode' followed by 'execve '/genode/core'. This keeps core clean of the bootstrapping magic. This bootstrapping program can be called '/init' whereas everything Genode-related resides as '/genode/'.
I have no good idea about the segfault though. It definitely happens in init, not core because the fault occurs in 'ld.lib.so', which is not used by core. You may inspect the debug version of the ld.lib.so binary (using 'objdump -lSd debug/ld-linux.lib.so') at the faulting ip. The offset from the start of 'ld-linux.lib.so' can be calculated by subtracting the load address of ld.lib.so (as reported by the kernel) from the ip of the fault.
Cheers Norman
Hi Norman,
just a follow up question: instead of putting a prebuilt binary of init into the repo I want to build it from source. Yet I haven't found out how to tell the build system to build it with completely custom options preferably via the target.mk. I tried to set CFLAGS and LDFLAGS there but the build system still does it's own linking which makes the binary segfaulting if executed on the host. Is there a way to do this or do I need to build it externally?
Regards, Johannes
Am 26.10.2017 um 13:39 schrieb Johannes Kliemann:
Hi Norman,
using a separate init to chdir also made the segfault disappear and I can now successfully run the timer test on Linux [1].
Regards, Johannes
On 10/25/17 11:39, Norman Feske wrote:
Hi Johannes,
for bootstrapping core, I'd create a custom (statically compiled) program that merely performs a 'chdir /genode' followed by 'execve '/genode/core'. This keeps core clean of the bootstrapping magic. This bootstrapping program can be called '/init' whereas everything Genode-related resides as '/genode/'.
I have no good idea about the segfault though. It definitely happens in init, not core because the fault occurs in 'ld.lib.so', which is not used by core. You may inspect the debug version of the ld.lib.so binary (using 'objdump -lSd debug/ld-linux.lib.so') at the faulting ip. The offset from the start of 'ld-linux.lib.so' can be calculated by subtracting the load address of ld.lib.so (as reported by the kernel) from the ip of the fault.
Cheers Norman
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Hello Johannes,
I don't know exactly the compilation dependencies of your init binary and how it should be built. But, you may have a look into
repos/base-linux/src/test/lx_hybrid_ctors/target.mk
which generates a libtestlib.so shared object for testing on base-linux. The target.mk just adds a special target which the original TARGET depends on, but it handles the compilation and linking manually.
Hope this helps
Thanks, that's exactly what I needed.
Am 01.11.2017 um 15:40 schrieb Christian Helmuth:
Hello Johannes,
I don't know exactly the compilation dependencies of your init binary and how it should be built. But, you may have a look into
repos/base-linux/src/test/lx_hybrid_ctors/target.mk
which generates a libtestlib.so shared object for testing on base-linux. The target.mk just adds a special target which the original TARGET depends on, but it handles the compilation and linking manually.
Hope this helps