[Letux-kernel] X1600 / LX16

H. Nikolaus Schaller hns at goldelico.com
Tue Feb 6 09:28:19 CET 2024


Hi all,


> Am 05.02.2024 um 22:46 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi all,
> thanks to the work by Paul we can partially boot a letux-6.8-rc3 kernel
> on the X1600 / LX16.
> 
> I have rebased the code to v6.8-rc3 and here is the latest kernel:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-x1600-v2
> 
> As you can see it is just 4 patches ahead of letux-current to make it partially boot.
> 
> The first patch (prevent disabling the TCU) is probably not even needed.
> The second one seems to need polishing to be activated only on the X1600.
> The thrid one is something I have analysed a little (see below).
> The fourth one needs analysis because it not really disables UART nodes but takes the default ones.
> 
> Now about the cmdline parsing failure. It happens in fw_getenv().
> 
> It is not possible to printk() here (because it is too early), but with the old work-x1600
> branch and it's ll_printk() hack I was able to debug a little:
> 
> char *fw_getenv(char *envname)
> {
> char *result = NULL;
> 
> ll_printk("%s: %px\n", __func__, _fw_envp);
> if (_fw_envp) ll_printk("%s: %px\n", __func__, fw_envp(0));
> 
> if (_fw_envp != NULL && fw_envp(0) != NULL) {
> /*
> * Return a pointer to the given environment variable.
> * YAMON uses "name", "value" pairs, while U-Boot uses
> * "name=value".
> */
> int i, yamon, index = 0;
> 
> yamon = (strchr(fw_envp(index), '=') == NULL);
> 
> results in this boot log:
> 
> setup_arch: after paging_init
> setup_arch: after memblock_dump_all
> setup_rng_seed: start
> fw_getenv: a1f64440
> fw_getenv: 333d6d65
> === here the processor hangs ===
> 
> Hangs most likely in strchr().
> 
> The string is said to start at 0x333d6d65 - but it looks more like
> being some string itself and not a pointer to a string.
> 
> So most likely _fw_envp is a dangling pointer and not what it should be.
> 
> Most likely it should be set up here:
> 
> https://elixir.bootlin.com/linux/v6.8-rc3/source/arch/mips/kernel/head.S#L106
> and
> https://elixir.bootlin.com/linux/v6.8-rc3/source/arch/mips/fw/lib/cmdline.c#L37
> 
> Something to analyse further. Maybe by comparing code with the working
> letux-5.10.y-lx16 kernel.

Well, there is no diff between 5.10.y and 6.8-rc3 in arch/mips/fw/lib/cmdline.c
or arch/mips/kernel/head.S

So I added some more ll_printk() and it appears as if the _fw_argv processing is ok,
but someone overwrites some pointers of the _fw_envp so that scanning for env strings
fails.

The values overwriting the pointers look like ASCII characters "3=me" and "0 at M2".

Next I'll check values at the beginning of the initialization,right after kernel_entry
in start_kernel. Maybe it is possible to "bisect" the code location where these pointers
are overwritten.

BR,
Nikolaus



More information about the Letux-kernel mailing list