[PATCH v2 17/21] bootm: Create a function to run through the bootm states

Tom Rini trini at konsulko.com
Thu Dec 14 18:51:50 CET 2023


On Thu, Dec 14, 2023 at 09:50:26AM -0700, Simon Glass wrote:

> In quite a few places, the bootm command is used to handle a boot. We
> want these to be done without needing CONFIG_CMDLINE, so add a new
> bootm_run() function to handle this.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
[snip]
> +int bootm_run(struct bootm_info *bmi)
> +{
> +	int states;
> +
> +	bmi->cmd_name = "bootm";
> +	states = BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD |
> +		BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS |
> +		BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
> +		BOOTM_STATE_OS_GO;
> +	if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
> +		states |= BOOTM_STATE_RAMDISK;
> +	if (IS_ENABLED(CONFIG_MEASURED_BOOT))
> +		states |= BOOTM_STATE_MEASURE;
> +	if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS))
> +		states |= BOOTM_STATE_OS_CMDLINE;
> +
> +	return bootm_run_states(bmi, states);
> +}

Looking at this, and then boot[zi]_run, I think we should either always set
BOOTM_STATE_MEASURE (it's a nop without CONFIG_MEASURED_BOOT) or always
IS_ENABLED check it before setting. I think we both would prefer the
former? And I really do wonder how much it would hurt or not to just
have boot_run() or something which takes the name as a param and handles
the few "bootm"-only flags.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231214/e31f274f/attachment.sig>


More information about the U-Boot mailing list