[Letux-kernel] X1600 / LX16 support - here: fw_getenv() issue

H. Nikolaus Schaller hns at goldelico.com
Wed Feb 7 15:44:39 CET 2024



> Am 07.02.2024 um 15:09 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> U-Boot 2013.07-00324-g0ecd9f212b-dirty (Jul 15 2023 - 15:02:47)
> https://git.goldelico.com/?p=letux-uboot.git;a=shortlog;h=refs/heads/ingenic-x1600
> 
> We obviously have to patch this U-Boot.
> 
> I'll look into that next.

It seems to be a hack-mix between 2016.11 (used for GTA04 and others) and some
rewound files from 2013.07.

It is difficult to understand what bootm is doing. But here is a first attempt...

do_bootm() is called first
it runs through different do_bootm_states() [common/cmd_bootm.c]

One final state after processing command line options, loading files, relocating etc.
is to really boot the selected OS: boot_selected_os() [common/cmd_bootm.c]

This goes to do_bootm_linux() [arch/mips/lib/bootm.c] which is architecture specific.
It calls boot_jump_linux() for mips.

This prints the "Starting kernel..." report.

And then calls theKernel(linux_argc, linux_argv, linux_env, 0);

This is where the linux_env pointer/array should be passed.

Now comes the interesting thing. This linux_env is set up by
linux_params_init() by appending the environment variables to the end of
the used reserved memory for linux_argv (rounded up to 16 bytes boundary).

The environment itself is filled in boot_prep_linux() with

memsize=...
initrd_start=...
initrd_size=...
flash_start=...
flash_size=...
ether=...
eth1addr=...

These are the variables available to fw_getenv() by this U-Boot version.

So here is something going wrong that linux_env[0], [1] etc. arrives damaged
in the kernel.

I think adding print statements to this code could show if and why a
bad linux_env is passed to the kernel.

BR,
Nikolaus


PS: the bootm command seems to support the FIT format :)



More information about the Letux-kernel mailing list