Skip to contentSkip to conversation

Xtensa qemu nommu defconfig not working

Buildroot Thomas Petazzoni via buildroot 2 participants 5 messages Nov 25, 2022 – Dec 27, 2022

lore
Share & tools
lore
#0 lore raw

Hello,

The configs/qemu_xtensa_lx60_nommu_defconfig builds correctly, but fails to boot under Qemu:

[    1.158675] Freeing unused kernel image (initmem) memory: 460K
[    1.159475] This architecture does not have kernel memory protection.
[    1.160806] Run /init as init process
[    1.186746] binfmt_flat: reloc outside program 0x24c80100 (0 - 0x6e430/0x56a20), killing init!
[    1.190881] Failed to execute /init (error -8)
[    1.191529] Run /sbin/init as init process
[    1.204778] binfmt_flat: reloc outside program 0x24c80100 (0 - 0x6e430/0x56a20), killing init!
[    1.206216] Starting init: /sbin/init exists but couldn't execute it (error -8)
[    1.207229] Run /etc/init as init process
[    1.209332] Run /bin/init as init process
[    1.210517] Run /bin/sh as init process
[    1.220290] binfmt_flat: reloc outside program 0x24c80100 (0 - 0x6e430/0x56a20), killing sh!
[    1.221658] Starting init: /bin/sh exists but couldn't execute it (error -8)
[    1.223403] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[    1.226218] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---

There were some changes in elf2flt:

9dd179d43ffe9be98035f921a0db2bf051b632fb package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64 95402089c314fbc03b934f5fcf9c29db043d758c package/elf2flt: remove broken patch b07210b272c6e8810b038190cf5c1fd1f7b48397 package/gcc: remove BR2_GCC_ENABLE_LTO 9db5eb258cf492567bac33a33cb606f14045639d package/elf2flt: Remove Config.in.host 3e50b5fe2632a3081fd3f6574a5e9525fa897fdb package/elf2flt: update AUTORECONF comment 32f93b0ef2c602dfa1f5b243ba865d5b16e2fa33 package/elf2flt: update RISC-V 64-bits support 65d78dcfeb8b2eafaebe2d0c3c8c42e7e85f46ac package/elf2flt: update to version 2021.08 6d49446ebdbd32c1b4591c0aa8cacb189a69e318 package/elf2flt: add RISC-V 64-bits support

However, in commit 9dd179d43ffe9be98035f921a0db2bf051b632fb, Niklas said about the qemu_xtensa_lx60_nommu_defconfig configuration: "xtensa crashes when loading init, the same behavior as when reverting the bad upstream elf2flt commit completely."

Max, do you think you could have a look at what is happening?

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Thomas,

Quoted 9 lines · Thomas Petazzoni

The configs/qemu_xtensa_lx60_nommu_defconfig builds correctly, but fails to boot under Qemu:

[    1.158675] Freeing unused kernel image (initmem) memory: 460K
[    1.159475] This architecture does not have kernel memory protection.
[    1.160806] Run /init as init process
[    1.186746] binfmt_flat: reloc outside program 0x24c80100 (0 - 0x6e430/0x56a20), killing init!

Max, do you think you could have a look at what is happening?

AFAICS the following commit in the elf2flt
https://github.com/uclinux-dev/elf2flt/commit/5e08f19683163584f23b953e570749964758c439

disabled address endianness fixup for addresses in the text segment for xtensa which results in the observed failure. I haven't checked, but from the code it looks like not only the xtensa may be affected.
I can confirm that reverting that change fixes xtensa nommu boot.

Signature · 6 lines
Thanks.
-- Max
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 9 lines · On Mon, 28 Nov 2022 03:54:19 -0800 Max Filippov <[email protected]> wrote:
Quoted 1 line

Max, do you think you could have a look at what is happening?

AFAICS the following commit in the elf2flt
https://github.com/uclinux-dev/elf2flt/commit/5e08f19683163584f23b953e570749964758c439

disabled address endianness fixup for addresses in the text segment for xtensa which results in the observed failure. I haven't checked, but from the code it looks like not only the xtensa may be affected.
I can confirm that reverting that change fixes xtensa nommu boot.

Thanks for the investigation. How do we move forward from this? I must say I never went into the details of elf2flt, so I'm not sure how to fix this myself.

Should we report a bug to upstream elf2flt (which are generally never looked at), or is someone volunteering to provide a fix for this?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 2 lines · Thomas Petazzoni

Should we report a bug to upstream elf2flt (which are generally never looked at), or is someone volunteering to provide a fix for this?

I'll check what other architectures are affected and will make a fix.

Also starting with linux-6.1 nommu xtensa will support static PIE ELF, which is in every way better than bFLT. Will it be acceptable to add static PIE ELF as an executable file format for nommu configurations in the buildroot?

Signature · 6 lines
Thanks.
-- Max
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Hello Max,

Quoted 4 lines · On Mon, 28 Nov 2022 05:37:25 -0800 Max Filippov <[email protected]> wrote:

Also starting with linux-6.1 nommu xtensa will support static PIE ELF, which is in every way better than bFLT. Will it be acceptable to add static PIE ELF as an executable file format for nommu configurations in the buildroot?

Yes, that would definitely be acceptable and even useful.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot