* [PATCH v2] arch/x86/lib: implement cmdline configuration property
@ 2026-04-03 14:28 Guillaume Ranquet
2026-04-10 22:19 ` Simon Glass
2026-04-11 11:25 ` Heinrich Schuchardt
0 siblings, 2 replies; 7+ messages in thread
From: Guillaume Ranquet @ 2026-04-03 14:28 UTC (permalink / raw)
To: u-boot
Cc: Simon Glass, Bin Meng, Tom Rini, Jeremy Compostella, Peng Fan,
Yao Zi, Patrice Chotard, Quentin Schulz, Marek Vasut,
James Hilliard, Heinrich Schuchardt, Frank Wunderlich,
Mayuresh Chitale, Neil Armstrong, Shiji Yang, Jonas Karlman,
Wolfgang Wallner, Guillaume Ranquet
Implement the cmdline configuration property as described in the spec
[1]
[1]: https://fitspec.osfw.foundation/#id10
Signed-off-by: Guillaume Ranquet <granquet@missingno.tech>
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://lore.kernel.org/r/20260401-cmdline-v1-1-c56577f82960@missingno.tech
---
arch/x86/include/asm/zimage.h | 2 +-
arch/x86/lib/bootm.c | 10 +++++++++-
arch/x86/lib/zimage.c | 6 +++---
boot/image-fit.c | 30 +++++++++++++++++++++++++++++-
include/image.h | 3 +++
5 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
index 8b5426051701c8266395afd9232eb1ff30d38304..ee0114a227a2b067a3a3126d7d80ab0cc89cea6e 100644
--- a/arch/x86/include/asm/zimage.h
+++ b/arch/x86/include/asm/zimage.h
@@ -132,7 +132,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
* Return: 0 (always)
*/
int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
- ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force);
/**
* zboot_start() - Prepare to boot a zimage
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index cde4fbf35574a267b856a668659ece7e0a36367f..e029cc1ff18bd53eb873c0e56fd9d3b0a331b4c2 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -61,6 +61,7 @@ int arch_fixup_memory_node(void *blob)
static int boot_prep_linux(struct bootm_headers *images)
{
char *cmd_line_dest = NULL;
+ const char *cmd_line_override = NULL;
struct legacy_img_hdr *hdr;
int is_zimage = 0;
void *data = NULL;
@@ -99,6 +100,13 @@ static int boot_prep_linux(struct bootm_headers *images)
puts("Can't get image data/size!\n");
goto error;
}
+
+ ret = fit_image_get_cmdline(images->fit_hdr_os,
+ images->fit_noffset_cfg,
+ &cmd_line_override);
+ if (ret)
+ debug("unable to retrieve cmdline for zimage\n");
+
is_zimage = 1;
#endif
}
@@ -125,7 +133,7 @@ static int boot_prep_linux(struct bootm_headers *images)
printf("Setup at %#08lx\n", images->ep);
ret = setup_zimage((void *)images->ep, cmd_line_dest,
0, images->rd_start,
- images->rd_end - images->rd_start, 0);
+ images->rd_end - images->rd_start, cmd_line_override);
if (ret) {
printf("## Setting up boot parameters failed ...\n");
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index a5f2231aa523356de93368338b5fd249b8abad6e..af7ee8dbcf3e8f402cb0c76767b8a587f205ad5d 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -276,7 +276,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
}
int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
- ulong initrd_addr, ulong initrd_size, ulong cmdline_force)
+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force)
{
struct setup_header *hdr = &setup_base->hdr;
int bootproto = get_boot_protocol(hdr, false);
@@ -333,7 +333,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
/* build command line at COMMAND_LINE_OFFSET */
if (cmdline_force)
- strcpy(cmd_line, (char *)cmdline_force);
+ strcpy(cmd_line, cmdline_force);
else
build_command_line(cmd_line, auto_boot);
if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
@@ -404,7 +404,7 @@ int zboot_setup(void)
ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
0, state.initrd_addr, state.initrd_size,
- (ulong)state.cmdline);
+ state.cmdline);
if (ret)
return -EINVAL;
diff --git a/boot/image-fit.c b/boot/image-fit.c
index e7c7212195f4a291e26ed6d3440a1b42274dacab..1790af4a8e5a9c7d11f7dee5f67226071f8f057e 100644
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -1096,6 +1096,32 @@ int fit_image_get_data(const void *fit, int noffset, const void **data,
return ret;
}
+/**
+ * fit_image_get_cmdline - get image configuration command line
+ * @fit: pointer to the FIT format image header
+ * @cfg_noffset: configuration node offset
+ * @cmdline: double pointer to char, will hold pointer to the cmdline
+ *
+ * fit_image_get_cmdline() gets the cmdline from the configuration node.
+ * If the property is found its data start address is returned to the caller.
+ *
+ * returns:
+ * 0, on success
+ * -1, on failure
+ */
+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline)
+{
+ int len;
+
+ *cmdline = (const char *)fdt_getprop(fit, noffset, FIT_CMDLINE_PROP, &len);
+ if (!*cmdline) {
+ fit_get_debug(fit, noffset, FIT_CMDLINE_PROP, len);
+ return -1;
+ }
+
+ return 0;
+}
+
/**
* fit_image_hash_get_algo - get hash algorithm name
* @fit: pointer to the FIT format image header
@@ -2136,8 +2162,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
printf(" Using '%s' configuration\n", fit_base_uname_config);
/* Remember this config */
- if (image_type == IH_TYPE_KERNEL)
+ if (image_type == IH_TYPE_KERNEL) {
images->fit_uname_cfg = fit_base_uname_config;
+ images->fit_noffset_cfg = cfg_noffset;
+ }
if (FIT_IMAGE_ENABLE_VERIFY && images->verify) {
puts(" Verifying Hash Integrity ... ");
diff --git a/include/image.h b/include/image.h
index 34efac6056dd29307df359dce21e4f94d5fcbf2d..9916e67168e3a4f5412fc26d318af32047c239e2 100644
--- a/include/image.h
+++ b/include/image.h
@@ -365,6 +365,7 @@ struct bootm_headers {
* format, even for SPL, this extra data size seems worth it.
*/
const char *fit_uname_cfg; /* configuration node unit name */
+ int fit_noffset_cfg; /* configuration node offset */
void *fit_hdr_os; /* os FIT image header */
const char *fit_uname_os; /* os subimage node unit name */
@@ -1108,6 +1109,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
#define FIT_TFA_BL31_PROP "tfa-bl31"
#define FIT_TEE_PROP "tee"
#define FIT_COMPAT_PROP "compatible"
+#define FIT_CMDLINE_PROP "cmdline"
#define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
@@ -1259,6 +1261,7 @@ int fit_get_data_node(const void *fit, const char *image_uname,
int fit_get_data_conf_prop(const void *fit, const char *prop_name,
const void **data, size_t *size);
+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline);
int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo);
int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
int *value_len);
---
base-commit: 98cf83d81617f489d7ff7bf78d33e693e2799254
change-id: 20260401-cmdline-ab954a4e8828
Best regards,
--
Guillaume Ranquet <granquet@missingno.tech>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] arch/x86/lib: implement cmdline configuration property
2026-04-03 14:28 [PATCH v2] arch/x86/lib: implement cmdline configuration property Guillaume Ranquet
@ 2026-04-10 22:19 ` Simon Glass
2026-04-11 11:25 ` Heinrich Schuchardt
1 sibling, 0 replies; 7+ messages in thread
From: Simon Glass @ 2026-04-10 22:19 UTC (permalink / raw)
To: ranquet.guillaume
Cc: u-boot, Simon Glass, Bin Meng, Tom Rini, Jeremy Compostella,
Peng Fan, Yao Zi, Patrice Chotard, Quentin Schulz, Marek Vasut,
James Hilliard, Heinrich Schuchardt, Frank Wunderlich,
Mayuresh Chitale, Neil Armstrong, Shiji Yang, Jonas Karlman,
Wolfgang Wallner, Guillaume Ranquet
On 2026-04-03T14:28:23, Guillaume Ranquet <ranquet.guillaume@gmail.com> wrote:
> arch/x86/lib: implement cmdline configuration property
>
> Implement the cmdline configuration property as described in the spec
> [1]
>
> [1]: https://fitspec.osfw.foundation/#id10
>
> Signed-off-by: Guillaume Ranquet <granquet@missingno.tech>
>
> arch/x86/include/asm/zimage.h | 2 +-
> arch/x86/lib/bootm.c | 10 +++++++++-
> arch/x86/lib/zimage.c | 6 +++---
> boot/image-fit.c | 30 +++++++++++++++++++++++++++++-
> include/image.h | 3 +++
> 5 files changed, 45 insertions(+), 6 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
(we are going to have to sort out some tests for all this at some point)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] arch/x86/lib: implement cmdline configuration property
2026-04-03 14:28 [PATCH v2] arch/x86/lib: implement cmdline configuration property Guillaume Ranquet
2026-04-10 22:19 ` Simon Glass
@ 2026-04-11 11:25 ` Heinrich Schuchardt
2026-04-12 11:37 ` Simon Glass
1 sibling, 1 reply; 7+ messages in thread
From: Heinrich Schuchardt @ 2026-04-11 11:25 UTC (permalink / raw)
To: Guillaume Ranquet, u-boot
Cc: Simon Glass, Bin Meng, Tom Rini, Jeremy Compostella, Peng Fan,
Yao Zi, Patrice Chotard, Quentin Schulz, Marek Vasut,
James Hilliard, Frank Wunderlich, Mayuresh Chitale,
Neil Armstrong, Shiji Yang, Jonas Karlman, Wolfgang Wallner,
Guillaume Ranquet
Am 3. April 2026 16:28:23 MESZ schrieb Guillaume Ranquet <ranquet.guillaume@gmail.com>:
>Implement the cmdline configuration property as described in the spec
>[1]
I can't see in the spec that the command line property is x86 specific. Why would you try to implement it in arch/x86?
Best regards
Heirich
>
>[1]: https://fitspec.osfw.foundation/#id10
>
>Signed-off-by: Guillaume Ranquet <granquet@missingno.tech>
>---
>Changes in v2:
>- EDITME: describe what is new in this series revision.
>- EDITME: use bulletpoints and terse descriptions.
>- Link to v1: https://lore.kernel.org/r/20260401-cmdline-v1-1-c56577f82960@missingno.tech
>---
> arch/x86/include/asm/zimage.h | 2 +-
> arch/x86/lib/bootm.c | 10 +++++++++-
> arch/x86/lib/zimage.c | 6 +++---
> boot/image-fit.c | 30 +++++++++++++++++++++++++++++-
> include/image.h | 3 +++
> 5 files changed, 45 insertions(+), 6 deletions(-)
>
>diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
>index 8b5426051701c8266395afd9232eb1ff30d38304..ee0114a227a2b067a3a3126d7d80ab0cc89cea6e 100644
>--- a/arch/x86/include/asm/zimage.h
>+++ b/arch/x86/include/asm/zimage.h
>@@ -132,7 +132,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
> * Return: 0 (always)
> */
> int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>- ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
>+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force);
>
> /**
> * zboot_start() - Prepare to boot a zimage
>diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
>index cde4fbf35574a267b856a668659ece7e0a36367f..e029cc1ff18bd53eb873c0e56fd9d3b0a331b4c2 100644
>--- a/arch/x86/lib/bootm.c
>+++ b/arch/x86/lib/bootm.c
>@@ -61,6 +61,7 @@ int arch_fixup_memory_node(void *blob)
> static int boot_prep_linux(struct bootm_headers *images)
> {
> char *cmd_line_dest = NULL;
>+ const char *cmd_line_override = NULL;
> struct legacy_img_hdr *hdr;
> int is_zimage = 0;
> void *data = NULL;
>@@ -99,6 +100,13 @@ static int boot_prep_linux(struct bootm_headers *images)
> puts("Can't get image data/size!\n");
> goto error;
> }
>+
>+ ret = fit_image_get_cmdline(images->fit_hdr_os,
>+ images->fit_noffset_cfg,
>+ &cmd_line_override);
>+ if (ret)
>+ debug("unable to retrieve cmdline for zimage\n");
>+
> is_zimage = 1;
> #endif
> }
>@@ -125,7 +133,7 @@ static int boot_prep_linux(struct bootm_headers *images)
> printf("Setup at %#08lx\n", images->ep);
> ret = setup_zimage((void *)images->ep, cmd_line_dest,
> 0, images->rd_start,
>- images->rd_end - images->rd_start, 0);
>+ images->rd_end - images->rd_start, cmd_line_override);
>
> if (ret) {
> printf("## Setting up boot parameters failed ...\n");
>diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
>index a5f2231aa523356de93368338b5fd249b8abad6e..af7ee8dbcf3e8f402cb0c76767b8a587f205ad5d 100644
>--- a/arch/x86/lib/zimage.c
>+++ b/arch/x86/lib/zimage.c
>@@ -276,7 +276,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
> }
>
> int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>- ulong initrd_addr, ulong initrd_size, ulong cmdline_force)
>+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force)
> {
> struct setup_header *hdr = &setup_base->hdr;
> int bootproto = get_boot_protocol(hdr, false);
>@@ -333,7 +333,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>
> /* build command line at COMMAND_LINE_OFFSET */
> if (cmdline_force)
>- strcpy(cmd_line, (char *)cmdline_force);
>+ strcpy(cmd_line, cmdline_force);
> else
> build_command_line(cmd_line, auto_boot);
> if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
>@@ -404,7 +404,7 @@ int zboot_setup(void)
>
> ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
> 0, state.initrd_addr, state.initrd_size,
>- (ulong)state.cmdline);
>+ state.cmdline);
> if (ret)
> return -EINVAL;
>
>diff --git a/boot/image-fit.c b/boot/image-fit.c
>index e7c7212195f4a291e26ed6d3440a1b42274dacab..1790af4a8e5a9c7d11f7dee5f67226071f8f057e 100644
>--- a/boot/image-fit.c
>+++ b/boot/image-fit.c
>@@ -1096,6 +1096,32 @@ int fit_image_get_data(const void *fit, int noffset, const void **data,
> return ret;
> }
>
>+/**
>+ * fit_image_get_cmdline - get image configuration command line
>+ * @fit: pointer to the FIT format image header
>+ * @cfg_noffset: configuration node offset
>+ * @cmdline: double pointer to char, will hold pointer to the cmdline
>+ *
>+ * fit_image_get_cmdline() gets the cmdline from the configuration node.
>+ * If the property is found its data start address is returned to the caller.
>+ *
>+ * returns:
>+ * 0, on success
>+ * -1, on failure
>+ */
>+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline)
>+{
>+ int len;
>+
>+ *cmdline = (const char *)fdt_getprop(fit, noffset, FIT_CMDLINE_PROP, &len);
>+ if (!*cmdline) {
>+ fit_get_debug(fit, noffset, FIT_CMDLINE_PROP, len);
>+ return -1;
>+ }
>+
>+ return 0;
>+}
>+
> /**
> * fit_image_hash_get_algo - get hash algorithm name
> * @fit: pointer to the FIT format image header
>@@ -2136,8 +2162,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
> fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
> printf(" Using '%s' configuration\n", fit_base_uname_config);
> /* Remember this config */
>- if (image_type == IH_TYPE_KERNEL)
>+ if (image_type == IH_TYPE_KERNEL) {
> images->fit_uname_cfg = fit_base_uname_config;
>+ images->fit_noffset_cfg = cfg_noffset;
>+ }
>
> if (FIT_IMAGE_ENABLE_VERIFY && images->verify) {
> puts(" Verifying Hash Integrity ... ");
>diff --git a/include/image.h b/include/image.h
>index 34efac6056dd29307df359dce21e4f94d5fcbf2d..9916e67168e3a4f5412fc26d318af32047c239e2 100644
>--- a/include/image.h
>+++ b/include/image.h
>@@ -365,6 +365,7 @@ struct bootm_headers {
> * format, even for SPL, this extra data size seems worth it.
> */
> const char *fit_uname_cfg; /* configuration node unit name */
>+ int fit_noffset_cfg; /* configuration node offset */
>
> void *fit_hdr_os; /* os FIT image header */
> const char *fit_uname_os; /* os subimage node unit name */
>@@ -1108,6 +1109,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
> #define FIT_TFA_BL31_PROP "tfa-bl31"
> #define FIT_TEE_PROP "tee"
> #define FIT_COMPAT_PROP "compatible"
>+#define FIT_CMDLINE_PROP "cmdline"
>
> #define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
>
>@@ -1259,6 +1261,7 @@ int fit_get_data_node(const void *fit, const char *image_uname,
> int fit_get_data_conf_prop(const void *fit, const char *prop_name,
> const void **data, size_t *size);
>
>+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline);
> int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo);
> int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
> int *value_len);
>
>---
>base-commit: 98cf83d81617f489d7ff7bf78d33e693e2799254
>change-id: 20260401-cmdline-ab954a4e8828
>
>Best regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] arch/x86/lib: implement cmdline configuration property
2026-04-11 11:25 ` Heinrich Schuchardt
@ 2026-04-12 11:37 ` Simon Glass
2026-04-13 10:48 ` Guillaume Ranquet
0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2026-04-12 11:37 UTC (permalink / raw)
To: Heinrich Schuchardt
Cc: Guillaume Ranquet, u-boot, Bin Meng, Tom Rini, Jeremy Compostella,
Peng Fan, Yao Zi, Patrice Chotard, Quentin Schulz, Marek Vasut,
James Hilliard, Frank Wunderlich, Mayuresh Chitale,
Neil Armstrong, Shiji Yang, Jonas Karlman, Wolfgang Wallner,
Guillaume Ranquet
Hi,
On Sat, 11 Apr 2026 at 05:25, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Am 3. April 2026 16:28:23 MESZ schrieb Guillaume Ranquet <ranquet.guillaume@gmail.com>:
> >Implement the cmdline configuration property as described in the spec
> >[1]
>
>
> I can't see in the spec that the command line property is x86 specific. Why would you try to implement it in arch/x86?
>
This is a little tricky though. It could perhaps be handled in
bootm_process_cmdline_env() by setting bootargs. Both legacy bootm and
bootstd (via the on_bootargs callback) would then pick it up without
any arch-specific code. But I haven't tried it. Commands like
'bootflow cmdline set' need to continue to operate as now.
Regards,
Simon
> Best regards
>
> Heirich
>
> >
> >[1]: https://fitspec.osfw.foundation/#id10
> >
> >Signed-off-by: Guillaume Ranquet <granquet@missingno.tech>
> >---
> >Changes in v2:
> >- EDITME: describe what is new in this series revision.
> >- EDITME: use bulletpoints and terse descriptions.
> >- Link to v1: https://lore.kernel.org/r/20260401-cmdline-v1-1-c56577f82960@missingno.tech
> >---
> > arch/x86/include/asm/zimage.h | 2 +-
> > arch/x86/lib/bootm.c | 10 +++++++++-
> > arch/x86/lib/zimage.c | 6 +++---
> > boot/image-fit.c | 30 +++++++++++++++++++++++++++++-
> > include/image.h | 3 +++
> > 5 files changed, 45 insertions(+), 6 deletions(-)
> >
> >diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
> >index 8b5426051701c8266395afd9232eb1ff30d38304..ee0114a227a2b067a3a3126d7d80ab0cc89cea6e 100644
> >--- a/arch/x86/include/asm/zimage.h
> >+++ b/arch/x86/include/asm/zimage.h
> >@@ -132,7 +132,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
> > * Return: 0 (always)
> > */
> > int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
> >- ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
> >+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force);
> >
> > /**
> > * zboot_start() - Prepare to boot a zimage
> >diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
> >index cde4fbf35574a267b856a668659ece7e0a36367f..e029cc1ff18bd53eb873c0e56fd9d3b0a331b4c2 100644
> >--- a/arch/x86/lib/bootm.c
> >+++ b/arch/x86/lib/bootm.c
> >@@ -61,6 +61,7 @@ int arch_fixup_memory_node(void *blob)
> > static int boot_prep_linux(struct bootm_headers *images)
> > {
> > char *cmd_line_dest = NULL;
> >+ const char *cmd_line_override = NULL;
> > struct legacy_img_hdr *hdr;
> > int is_zimage = 0;
> > void *data = NULL;
> >@@ -99,6 +100,13 @@ static int boot_prep_linux(struct bootm_headers *images)
> > puts("Can't get image data/size!\n");
> > goto error;
> > }
> >+
> >+ ret = fit_image_get_cmdline(images->fit_hdr_os,
> >+ images->fit_noffset_cfg,
> >+ &cmd_line_override);
> >+ if (ret)
> >+ debug("unable to retrieve cmdline for zimage\n");
> >+
> > is_zimage = 1;
> > #endif
> > }
> >@@ -125,7 +133,7 @@ static int boot_prep_linux(struct bootm_headers *images)
> > printf("Setup at %#08lx\n", images->ep);
> > ret = setup_zimage((void *)images->ep, cmd_line_dest,
> > 0, images->rd_start,
> >- images->rd_end - images->rd_start, 0);
> >+ images->rd_end - images->rd_start, cmd_line_override);
> >
> > if (ret) {
> > printf("## Setting up boot parameters failed ...\n");
> >diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
> >index a5f2231aa523356de93368338b5fd249b8abad6e..af7ee8dbcf3e8f402cb0c76767b8a587f205ad5d 100644
> >--- a/arch/x86/lib/zimage.c
> >+++ b/arch/x86/lib/zimage.c
> >@@ -276,7 +276,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
> > }
> >
> > int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
> >- ulong initrd_addr, ulong initrd_size, ulong cmdline_force)
> >+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force)
> > {
> > struct setup_header *hdr = &setup_base->hdr;
> > int bootproto = get_boot_protocol(hdr, false);
> >@@ -333,7 +333,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
> >
> > /* build command line at COMMAND_LINE_OFFSET */
> > if (cmdline_force)
> >- strcpy(cmd_line, (char *)cmdline_force);
> >+ strcpy(cmd_line, cmdline_force);
> > else
> > build_command_line(cmd_line, auto_boot);
> > if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
> >@@ -404,7 +404,7 @@ int zboot_setup(void)
> >
> > ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
> > 0, state.initrd_addr, state.initrd_size,
> >- (ulong)state.cmdline);
> >+ state.cmdline);
> > if (ret)
> > return -EINVAL;
> >
> >diff --git a/boot/image-fit.c b/boot/image-fit.c
> >index e7c7212195f4a291e26ed6d3440a1b42274dacab..1790af4a8e5a9c7d11f7dee5f67226071f8f057e 100644
> >--- a/boot/image-fit.c
> >+++ b/boot/image-fit.c
> >@@ -1096,6 +1096,32 @@ int fit_image_get_data(const void *fit, int noffset, const void **data,
> > return ret;
> > }
> >
> >+/**
> >+ * fit_image_get_cmdline - get image configuration command line
> >+ * @fit: pointer to the FIT format image header
> >+ * @cfg_noffset: configuration node offset
> >+ * @cmdline: double pointer to char, will hold pointer to the cmdline
> >+ *
> >+ * fit_image_get_cmdline() gets the cmdline from the configuration node.
> >+ * If the property is found its data start address is returned to the caller.
> >+ *
> >+ * returns:
> >+ * 0, on success
> >+ * -1, on failure
> >+ */
> >+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline)
> >+{
> >+ int len;
> >+
> >+ *cmdline = (const char *)fdt_getprop(fit, noffset, FIT_CMDLINE_PROP, &len);
> >+ if (!*cmdline) {
> >+ fit_get_debug(fit, noffset, FIT_CMDLINE_PROP, len);
> >+ return -1;
> >+ }
> >+
> >+ return 0;
> >+}
> >+
> > /**
> > * fit_image_hash_get_algo - get hash algorithm name
> > * @fit: pointer to the FIT format image header
> >@@ -2136,8 +2162,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
> > fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
> > printf(" Using '%s' configuration\n", fit_base_uname_config);
> > /* Remember this config */
> >- if (image_type == IH_TYPE_KERNEL)
> >+ if (image_type == IH_TYPE_KERNEL) {
> > images->fit_uname_cfg = fit_base_uname_config;
> >+ images->fit_noffset_cfg = cfg_noffset;
> >+ }
> >
> > if (FIT_IMAGE_ENABLE_VERIFY && images->verify) {
> > puts(" Verifying Hash Integrity ... ");
> >diff --git a/include/image.h b/include/image.h
> >index 34efac6056dd29307df359dce21e4f94d5fcbf2d..9916e67168e3a4f5412fc26d318af32047c239e2 100644
> >--- a/include/image.h
> >+++ b/include/image.h
> >@@ -365,6 +365,7 @@ struct bootm_headers {
> > * format, even for SPL, this extra data size seems worth it.
> > */
> > const char *fit_uname_cfg; /* configuration node unit name */
> >+ int fit_noffset_cfg; /* configuration node offset */
> >
> > void *fit_hdr_os; /* os FIT image header */
> > const char *fit_uname_os; /* os subimage node unit name */
> >@@ -1108,6 +1109,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
> > #define FIT_TFA_BL31_PROP "tfa-bl31"
> > #define FIT_TEE_PROP "tee"
> > #define FIT_COMPAT_PROP "compatible"
> >+#define FIT_CMDLINE_PROP "cmdline"
> >
> > #define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
> >
> >@@ -1259,6 +1261,7 @@ int fit_get_data_node(const void *fit, const char *image_uname,
> > int fit_get_data_conf_prop(const void *fit, const char *prop_name,
> > const void **data, size_t *size);
> >
> >+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline);
> > int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo);
> > int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
> > int *value_len);
> >
> >---
> >base-commit: 98cf83d81617f489d7ff7bf78d33e693e2799254
> >change-id: 20260401-cmdline-ab954a4e8828
> >
> >Best regards,
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] arch/x86/lib: implement cmdline configuration property
2026-04-12 11:37 ` Simon Glass
@ 2026-04-13 10:48 ` Guillaume Ranquet
2026-04-13 13:35 ` Simon Glass
0 siblings, 1 reply; 7+ messages in thread
From: Guillaume Ranquet @ 2026-04-13 10:48 UTC (permalink / raw)
To: Simon Glass, Heinrich Schuchardt
Cc: Guillaume Ranquet, u-boot, Bin Meng, Tom Rini, Jeremy Compostella,
Peng Fan, Yao Zi, Patrice Chotard, Quentin Schulz, Marek Vasut,
James Hilliard, Frank Wunderlich, Mayuresh Chitale,
Neil Armstrong, Shiji Yang, Jonas Karlman, Wolfgang Wallner,
Guillaume Ranquet
On Sun, 12 Apr 2026 13:37, Simon Glass <sjg@chromium.org> wrote:
>Hi,
>
>On Sat, 11 Apr 2026 at 05:25, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>
>> Am 3. April 2026 16:28:23 MESZ schrieb Guillaume Ranquet <ranquet.guillaume@gmail.com>:
>> >Implement the cmdline configuration property as described in the spec
>> >[1]
>>
>>
>> I can't see in the spec that the command line property is x86 specific. Why would you try to implement it in arch/x86?
>>
>
>This is a little tricky though. It could perhaps be handled in
>bootm_process_cmdline_env() by setting bootargs. Both legacy bootm and
>bootstd (via the on_bootargs callback) would then pick it up without
>any arch-specific code. But I haven't tried it. Commands like
>'bootflow cmdline set' need to continue to operate as now.
>
>Regards,
>Simon
>
Indeed, I've looked at implementing this in a generic way but it
requires a bit of massaging to get things working.
I was also under the impression that no one in their right mind would
use the command line property if they had access to a device tree?
Tell me if you think I should propose a generic implementation?
Thx,
Guillaume.
>> Best regards
>>
>> Heirich
>>
>> >
>> >[1]: https://fitspec.osfw.foundation/#id10
>> >
>> >Signed-off-by: Guillaume Ranquet <granquet@missingno.tech>
>> >---
>> >Changes in v2:
>> >- EDITME: describe what is new in this series revision.
>> >- EDITME: use bulletpoints and terse descriptions.
>> >- Link to v1: https://lore.kernel.org/r/20260401-cmdline-v1-1-c56577f82960@missingno.tech
>> >---
>> > arch/x86/include/asm/zimage.h | 2 +-
>> > arch/x86/lib/bootm.c | 10 +++++++++-
>> > arch/x86/lib/zimage.c | 6 +++---
>> > boot/image-fit.c | 30 +++++++++++++++++++++++++++++-
>> > include/image.h | 3 +++
>> > 5 files changed, 45 insertions(+), 6 deletions(-)
>> >
>> >diff --git a/arch/x86/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
>> >index 8b5426051701c8266395afd9232eb1ff30d38304..ee0114a227a2b067a3a3126d7d80ab0cc89cea6e 100644
>> >--- a/arch/x86/include/asm/zimage.h
>> >+++ b/arch/x86/include/asm/zimage.h
>> >@@ -132,7 +132,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
>> > * Return: 0 (always)
>> > */
>> > int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>> >- ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
>> >+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force);
>> >
>> > /**
>> > * zboot_start() - Prepare to boot a zimage
>> >diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
>> >index cde4fbf35574a267b856a668659ece7e0a36367f..e029cc1ff18bd53eb873c0e56fd9d3b0a331b4c2 100644
>> >--- a/arch/x86/lib/bootm.c
>> >+++ b/arch/x86/lib/bootm.c
>> >@@ -61,6 +61,7 @@ int arch_fixup_memory_node(void *blob)
>> > static int boot_prep_linux(struct bootm_headers *images)
>> > {
>> > char *cmd_line_dest = NULL;
>> >+ const char *cmd_line_override = NULL;
>> > struct legacy_img_hdr *hdr;
>> > int is_zimage = 0;
>> > void *data = NULL;
>> >@@ -99,6 +100,13 @@ static int boot_prep_linux(struct bootm_headers *images)
>> > puts("Can't get image data/size!\n");
>> > goto error;
>> > }
>> >+
>> >+ ret = fit_image_get_cmdline(images->fit_hdr_os,
>> >+ images->fit_noffset_cfg,
>> >+ &cmd_line_override);
>> >+ if (ret)
>> >+ debug("unable to retrieve cmdline for zimage\n");
>> >+
>> > is_zimage = 1;
>> > #endif
>> > }
>> >@@ -125,7 +133,7 @@ static int boot_prep_linux(struct bootm_headers *images)
>> > printf("Setup at %#08lx\n", images->ep);
>> > ret = setup_zimage((void *)images->ep, cmd_line_dest,
>> > 0, images->rd_start,
>> >- images->rd_end - images->rd_start, 0);
>> >+ images->rd_end - images->rd_start, cmd_line_override);
>> >
>> > if (ret) {
>> > printf("## Setting up boot parameters failed ...\n");
>> >diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
>> >index a5f2231aa523356de93368338b5fd249b8abad6e..af7ee8dbcf3e8f402cb0c76767b8a587f205ad5d 100644
>> >--- a/arch/x86/lib/zimage.c
>> >+++ b/arch/x86/lib/zimage.c
>> >@@ -276,7 +276,7 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
>> > }
>> >
>> > int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>> >- ulong initrd_addr, ulong initrd_size, ulong cmdline_force)
>> >+ ulong initrd_addr, ulong initrd_size, const char *cmdline_force)
>> > {
>> > struct setup_header *hdr = &setup_base->hdr;
>> > int bootproto = get_boot_protocol(hdr, false);
>> >@@ -333,7 +333,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
>> >
>> > /* build command line at COMMAND_LINE_OFFSET */
>> > if (cmdline_force)
>> >- strcpy(cmd_line, (char *)cmdline_force);
>> >+ strcpy(cmd_line, cmdline_force);
>> > else
>> > build_command_line(cmd_line, auto_boot);
>> > if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
>> >@@ -404,7 +404,7 @@ int zboot_setup(void)
>> >
>> > ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
>> > 0, state.initrd_addr, state.initrd_size,
>> >- (ulong)state.cmdline);
>> >+ state.cmdline);
>> > if (ret)
>> > return -EINVAL;
>> >
>> >diff --git a/boot/image-fit.c b/boot/image-fit.c
>> >index e7c7212195f4a291e26ed6d3440a1b42274dacab..1790af4a8e5a9c7d11f7dee5f67226071f8f057e 100644
>> >--- a/boot/image-fit.c
>> >+++ b/boot/image-fit.c
>> >@@ -1096,6 +1096,32 @@ int fit_image_get_data(const void *fit, int noffset, const void **data,
>> > return ret;
>> > }
>> >
>> >+/**
>> >+ * fit_image_get_cmdline - get image configuration command line
>> >+ * @fit: pointer to the FIT format image header
>> >+ * @cfg_noffset: configuration node offset
>> >+ * @cmdline: double pointer to char, will hold pointer to the cmdline
>> >+ *
>> >+ * fit_image_get_cmdline() gets the cmdline from the configuration node.
>> >+ * If the property is found its data start address is returned to the caller.
>> >+ *
>> >+ * returns:
>> >+ * 0, on success
>> >+ * -1, on failure
>> >+ */
>> >+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline)
>> >+{
>> >+ int len;
>> >+
>> >+ *cmdline = (const char *)fdt_getprop(fit, noffset, FIT_CMDLINE_PROP, &len);
>> >+ if (!*cmdline) {
>> >+ fit_get_debug(fit, noffset, FIT_CMDLINE_PROP, len);
>> >+ return -1;
>> >+ }
>> >+
>> >+ return 0;
>> >+}
>> >+
>> > /**
>> > * fit_image_hash_get_algo - get hash algorithm name
>> > * @fit: pointer to the FIT format image header
>> >@@ -2136,8 +2162,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
>> > fit_base_uname_config = fdt_get_name(fit, cfg_noffset, NULL);
>> > printf(" Using '%s' configuration\n", fit_base_uname_config);
>> > /* Remember this config */
>> >- if (image_type == IH_TYPE_KERNEL)
>> >+ if (image_type == IH_TYPE_KERNEL) {
>> > images->fit_uname_cfg = fit_base_uname_config;
>> >+ images->fit_noffset_cfg = cfg_noffset;
>> >+ }
>> >
>> > if (FIT_IMAGE_ENABLE_VERIFY && images->verify) {
>> > puts(" Verifying Hash Integrity ... ");
>> >diff --git a/include/image.h b/include/image.h
>> >index 34efac6056dd29307df359dce21e4f94d5fcbf2d..9916e67168e3a4f5412fc26d318af32047c239e2 100644
>> >--- a/include/image.h
>> >+++ b/include/image.h
>> >@@ -365,6 +365,7 @@ struct bootm_headers {
>> > * format, even for SPL, this extra data size seems worth it.
>> > */
>> > const char *fit_uname_cfg; /* configuration node unit name */
>> >+ int fit_noffset_cfg; /* configuration node offset */
>> >
>> > void *fit_hdr_os; /* os FIT image header */
>> > const char *fit_uname_os; /* os subimage node unit name */
>> >@@ -1108,6 +1109,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
>> > #define FIT_TFA_BL31_PROP "tfa-bl31"
>> > #define FIT_TEE_PROP "tee"
>> > #define FIT_COMPAT_PROP "compatible"
>> >+#define FIT_CMDLINE_PROP "cmdline"
>> >
>> > #define FIT_MAX_HASH_LEN HASH_MAX_DIGEST_SIZE
>> >
>> >@@ -1259,6 +1261,7 @@ int fit_get_data_node(const void *fit, const char *image_uname,
>> > int fit_get_data_conf_prop(const void *fit, const char *prop_name,
>> > const void **data, size_t *size);
>> >
>> >+int fit_image_get_cmdline(const void *fit, int noffset, const char **cmdline);
>> > int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo);
>> > int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,
>> > int *value_len);
>> >
>> >---
>> >base-commit: 98cf83d81617f489d7ff7bf78d33e693e2799254
>> >change-id: 20260401-cmdline-ab954a4e8828
>> >
>> >Best regards,
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] arch/x86/lib: implement cmdline configuration property
2026-04-13 10:48 ` Guillaume Ranquet
@ 2026-04-13 13:35 ` Simon Glass
2026-06-25 23:20 ` ranquet guillaume
0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2026-04-13 13:35 UTC (permalink / raw)
To: Guillaume Ranquet
Cc: Heinrich Schuchardt, u-boot, Bin Meng, Tom Rini,
Jeremy Compostella, Peng Fan, Yao Zi, Patrice Chotard,
Quentin Schulz, Marek Vasut, James Hilliard, Frank Wunderlich,
Mayuresh Chitale, Neil Armstrong, Shiji Yang, Jonas Karlman,
Wolfgang Wallner, Guillaume Ranquet
Hi Guillaume,
On Mon, 13 Apr 2026 at 04:48, Guillaume Ranquet
<ranquet.guillaume@gmail.com> wrote:
>
> On Sun, 12 Apr 2026 13:37, Simon Glass <sjg@chromium.org> wrote:
> >Hi,
> >
> >On Sat, 11 Apr 2026 at 05:25, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >>
> >> Am 3. April 2026 16:28:23 MESZ schrieb Guillaume Ranquet <ranquet.guillaume@gmail.com>:
> >> >Implement the cmdline configuration property as described in the spec
> >> >[1]
> >>
> >>
> >> I can't see in the spec that the command line property is x86 specific. Why would you try to implement it in arch/x86?
> >>
> >
> >This is a little tricky though. It could perhaps be handled in
> >bootm_process_cmdline_env() by setting bootargs. Both legacy bootm and
> >bootstd (via the on_bootargs callback) would then pick it up without
> >any arch-specific code. But I haven't tried it. Commands like
> >'bootflow cmdline set' need to continue to operate as now.
> >
> >Regards,
> >Simon
> >
>
> Indeed, I've looked at implementing this in a generic way but it
> requires a bit of massaging to get things working.
>
> I was also under the impression that no one in their right mind would
> use the command line property if they had access to a device tree?
>
> Tell me if you think I should propose a generic implementation?
I'm happy with what you have for now, so I'll leave this to Heinrich.
Regards,
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] arch/x86/lib: implement cmdline configuration property
2026-04-13 13:35 ` Simon Glass
@ 2026-06-25 23:20 ` ranquet guillaume
0 siblings, 0 replies; 7+ messages in thread
From: ranquet guillaume @ 2026-06-25 23:20 UTC (permalink / raw)
To: Simon Glass
Cc: Heinrich Schuchardt, u-boot, Bin Meng, Tom Rini,
Jeremy Compostella, Peng Fan, Yao Zi, Patrice Chotard,
Quentin Schulz, Marek Vasut, James Hilliard, Frank Wunderlich,
Mayuresh Chitale, Neil Armstrong, Shiji Yang, Jonas Karlman,
Wolfgang Wallner, Guillaume Ranquet
On Mon, Apr 13, 2026 at 3:36 PM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Guillaume,
>
> On Mon, 13 Apr 2026 at 04:48, Guillaume Ranquet
> <ranquet.guillaume@gmail.com> wrote:
> >
> > On Sun, 12 Apr 2026 13:37, Simon Glass <sjg@chromium.org> wrote:
> > >Hi,
> > >
> > >On Sat, 11 Apr 2026 at 05:25, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > >>
> > >> Am 3. April 2026 16:28:23 MESZ schrieb Guillaume Ranquet <ranquet.guillaume@gmail.com>:
> > >> >Implement the cmdline configuration property as described in the spec
> > >> >[1]
> > >>
> > >>
> > >> I can't see in the spec that the command line property is x86 specific. Why would you try to implement it in arch/x86?
> > >>
> > >
> > >This is a little tricky though. It could perhaps be handled in
> > >bootm_process_cmdline_env() by setting bootargs. Both legacy bootm and
> > >bootstd (via the on_bootargs callback) would then pick it up without
> > >any arch-specific code. But I haven't tried it. Commands like
> > >'bootflow cmdline set' need to continue to operate as now.
> > >
> > >Regards,
> > >Simon
> > >
> >
> > Indeed, I've looked at implementing this in a generic way but it
> > requires a bit of massaging to get things working.
> >
> > I was also under the impression that no one in their right mind would
> > use the command line property if they had access to a device tree?
> >
> > Tell me if you think I should propose a generic implementation?
>
> I'm happy with what you have for now, so I'll leave this to Heinrich.
Hi Heinrich,
Any feedback on this?
Thx,
Guillaume.
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-06-25 23:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 14:28 [PATCH v2] arch/x86/lib: implement cmdline configuration property Guillaume Ranquet
2026-04-10 22:19 ` Simon Glass
2026-04-11 11:25 ` Heinrich Schuchardt
2026-04-12 11:37 ` Simon Glass
2026-04-13 10:48 ` Guillaume Ranquet
2026-04-13 13:35 ` Simon Glass
2026-06-25 23:20 ` ranquet guillaume
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox