[Letux-kernel] LX20 prototype is booting

H. Nikolaus Schaller hns at goldelico.com
Tue May 6 09:32:04 CEST 2025



> Am 06.05.2025 um 07:58 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi Paul,
> 
>> Am 06.05.2025 um 01:02 schrieb Paul Boddie <paul at boddie.org.uk>:
>> 
>> On 2025-05-05 22:27, H. Nikolaus Schaller wrote:
>>> For the exec() problem I could now trace it down to arch_check_elf() in arch/mips/kernel/elf.c
>>> And specifically:
>>> https://elixir.bootlin.com/linux/v6.1.28/source/arch/mips/kernel/elf.c#L166
>> 
>> That is some verbose code, but highly readable, I suppose.
>> 
>>> But I have no idea why. And why only for x2000 and not x1600.
>>> Values are:
>>> [    0.017085] arch_check_elf elf32=1
>>> [    0.017085] arch_check_elf flags=10001007
>>> which means that EF_MIPS_NAN2008 (=0x00000400) is not set in the flags.
>>> And mips_use_nan_legacy is not set at all.
>>> So either the header is not read properly (alignment issue?) or the mips_use_nan_legacy
>>> should be set... Which may be correct that it is not set. Then we have a problem.
> 
> I checked the header on some ARM Linux.
> 
> root at letux:~# readelf -a /media/sdb/rootfs/sbin/init
> ELF Header:
>  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
>  Class:                             ELF32
>  Data:                              2's complement, little endian
>  Version:                           1 (current)
>  OS/ABI:                            UNIX - System V
>  ABI Version:                       0
>  Type:                              EXEC (Executable file)
>  Machine:                           MIPS R3000
>  Version:                           0x1
>  Entry point address:               0x401d10
>  Start of program headers:          52 (bytes into file)
>  Start of section headers:          39480 (bytes into file)
>  Flags:                             0x10001007, noreorder, pic, cpic, o32, mips2
>  Size of this header:               52 (bytes)
>  Size of program headers:           32 (bytes)
>  Number of program headers:         11
>  Size of section headers:           40 (bytes)
>  Number of section headers:         31
>  Section header string table index: 30
> 
> ...
> 
> The "Flags" appear to be correct as the x2000 arch_check_elf() is finding them.
> 
> So we are missing the mips_use_nan_legacy flag.
> 
>> Now, I did read something recently, maybe related to GCC or perhaps Debian, about older XBurst implementations not supporting the appropriate MIPS floating-point semantics. This may have complicated the situation for MIPS32 in Debian, leading to its relegation to only getting support from a third party in future releases.
> 
> Well, that should indeed influence future development.
> But here I am using good old Jessie which is working fine on all other Ingenic
> MIPS devices.
> 
> Therefore I think we have some bug in architecture setup. Maybe the x2000 is not
> set up as compatible for R3000, o32, mips2?

Well,
choosing MACH_X2000 selects MIPS_O32_FP64_SUPPORT which is said to be experimental and needs
userspace support:

https://elixir.bootlin.com/linux/v6.1.28/source/arch/mips/Kconfig#L2993

Unfortunately, disabling that doesn't change. So we can likely disable it anyways...

And changing SYS_HAS_CPU_MIPS32_R5 to SYS_HAS_CPU_MIPS32_R2 (like done for all other ingenic chips)
makes the kernel hang. Acording to current analyses inside cpu_probe() somewhere after this line:

https://elixir.bootlin.com/linux/v6.1.28/source/arch/mips/kernel/cpu-probe.c#L1891

Any ideas on this?

BR,
Nikolaus

NOTE 1: git diff v6.1.28 sudomaker-6.1.28 arch/mips/kernel/cpu-probe.c is not empty!

NOTE 2: I think I should rebase sudomaker-6.1.20 on top ov v6.1.28 so that not all
upstream changes are blamed to Reimu NotMoe because of this patch copying some upstream
kernel as a root commit and not basing on: https://git.goldelico.com/?p=letux-kernel.git;a=commit;h=65bb0cc96d54a664d48980379609c2f81d1aed3a


More information about the Letux-kernel mailing list