[U-Boot] An anomaly in image booting code

Simon Glass sjg at chromium.org
Fri Aug 5 17:11:25 CEST 2016


Hi Andy,

On 5 August 2016 at 08:27, Champ, Andy <andycham at amazon.co.uk> wrote:
> In common/bootm.c there's a function do_bootm_states. Among other things this sets the global variable images->states to the supplied states. If those states include the flag BOOTM_START it then calls a function bootm_start, which then memset-s the whole of state to zero before setting the flag BOOTM_STATE_START.
>
> This code has been there for a few years now, so it obviously doesn't break anything major - but what is it supposed to do?
> --
> Andy Champ

Yes I refactoring things a while back to try to reduce duplication and
make it easier to understand. It could use another pass. It was added
in commit 49c3a861 bootm: Add subcommands).

I suspect that the ->state member is supposed to be used by
arch-specific code that wants to know what states have already been
passed through. But I don't know as there are no comments. The only
user seems to be arch/mips/lib/bootm.c.

I can think of a few options:
1. Remove it, and fix up mips
2. Comment it in the image.h header file (as to what it means and what
it is for), and assign it after the BOOTM_START case

Regards,
Simon


More information about the U-Boot mailing list