mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Fabian Pflug <f.pflug@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v3 1/4] block.h: renamed get_rootargs to get_root
Date: Fri, 28 Nov 2025 10:45:15 +0100	[thread overview]
Message-ID: <c15f6ae3-812a-43b2-aa3b-47c4d4e4da1b@pengutronix.de> (raw)
In-Reply-To: <20251127143052.3114915-2-f.pflug@pengutronix.de>

Hi,

On 11/27/25 3:25 PM, Fabian Pflug wrote:
> Don't return the full commandline-parameter, but instead just return the
> root block/fs/etc. The functions downstream can add root= before.
> 
> This is the first commit in a series to make root= dynamic.
> 
> Signed-off-by: Fabian Pflug <f.pflug@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  common/block.c         | 10 ++++++++--
>  drivers/mci/mci-core.c |  4 ++--
>  include/block.h        |  2 +-
>  3 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/common/block.c b/common/block.c
> index ca2ed37dbd..07c4d5d504 100644
> --- a/common/block.c
> +++ b/common/block.c
> @@ -598,8 +598,14 @@ char *cdev_get_linux_rootarg(const struct cdev *partcdev)
>  	if (!blk)
>  		return NULL;
>  
> -	if (blk->ops->get_rootarg)
> -		rootarg = blk->ops->get_rootarg(blk, partcdev);
> +	if (blk->ops->get_root) {
> +		char *root = NULL;
> +		root = blk->ops->get_root(blk, partcdev);
> +		if (root) {
> +			rootarg = basprintf("root=%s", root);
> +			free(root);
> +		}
> +	}
>  	if (!rootarg && partcdev->partuuid[0] != 0)
>  		rootarg = basprintf("root=PARTUUID=%s", partcdev->partuuid);
>  
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 57825bc849..206147cb93 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -2691,7 +2691,7 @@ static char *mci_get_linux_mmcblkdev(struct block_device *blk,
>  		 * skipping it.
>  		 */
>  		if (cdev_partname_equal(partcdev, cdev))
> -			return basprintf("root=/dev/mmcblk%dp%d", id, partnum);
> +			return basprintf("/dev/mmcblk%dp%d", id, partnum);
>  		if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
>  			partnum++;
>  	}
> @@ -2703,7 +2703,7 @@ static struct block_device_ops mci_ops = {
>  	.read = mci_sd_read,
>  	.write = IS_ENABLED(CONFIG_MCI_WRITE) ? mci_sd_write : NULL,
>  	.erase = IS_ENABLED(CONFIG_MCI_ERASE) ? mci_sd_erase : NULL,
> -	.get_rootarg = IS_ENABLED(CONFIG_MMCBLKDEV_ROOTARG) ?
> +	.get_root = IS_ENABLED(CONFIG_MMCBLKDEV_ROOTARG) ?
>  		mci_get_linux_mmcblkdev : NULL,
>  };
>  
> diff --git a/include/block.h b/include/block.h
> index fc7a0a32fb..b277f590e4 100644
> --- a/include/block.h
> +++ b/include/block.h
> @@ -14,7 +14,7 @@ struct block_device_ops {
>  	int (*write)(struct block_device *, const void *buf, sector_t block, blkcnt_t num_blocks);
>  	int (*erase)(struct block_device *blk, sector_t block, blkcnt_t num_blocks);
>  	int (*flush)(struct block_device *);
> -	char *(*get_rootarg)(struct block_device *blk, const struct cdev *partcdev);
> +	char *(*get_root)(struct block_device *blk, const struct cdev *partcdev);
>  };
>  
>  struct chunk;

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2025-11-28  9:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24 10:16 [PATCH] common: setting the root= command line parameter Fabian Pflug
2025-11-24 12:00 ` Ahmad Fatoum
2025-11-25 10:22   ` Fabian Pflug
2025-11-25 19:13     ` Ahmad Fatoum
2025-11-26  6:42   ` [PATCH 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-26  6:42     ` [PATCH 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-26  9:50       ` Ahmad Fatoum
2025-11-26  6:42     ` [PATCH 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-26 10:13       ` Ahmad Fatoum
2025-11-26 10:31       ` Ahmad Fatoum
2025-11-26  6:42     ` [PATCH 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-26 10:25       ` Ahmad Fatoum
2025-11-26 11:29         ` Fabian Pflug
2025-11-26 11:33           ` Ahmad Fatoum
2025-11-26  6:42     ` [PATCH 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-11-26 10:28       ` Ahmad Fatoum
2025-11-27 10:57     ` [PATCH v2 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-27 10:57       ` [PATCH v2 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-27 11:08         ` Ahmad Fatoum
2025-11-27 10:57       ` [PATCH v2 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-27 10:57       ` [PATCH v2 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-27 10:57       ` [PATCH v2 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-11-27 14:25       ` [PATCH v3 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-27 14:25         ` [PATCH v3 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-28  9:45           ` Ahmad Fatoum [this message]
2025-11-27 14:25         ` [PATCH v3 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-28 10:01           ` Ahmad Fatoum
2025-11-27 14:25         ` [PATCH v3 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-28 10:04           ` Ahmad Fatoum
2025-11-27 14:25         ` [PATCH v3 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-11-28 10:07           ` Ahmad Fatoum
2025-11-28 14:58         ` [PATCH v4 0/4] make the root= command line parameter variable Fabian Pflug
2025-11-28 14:59           ` [PATCH v4 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-11-28 14:59           ` [PATCH 2/4] fs: split rootargs into root and options Fabian Pflug
2025-11-28 14:59           ` [PATCH v4 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-11-28 14:59           ` [PATCH v4 4/4] bootm: introduce bootm.root_arg variable Fabian Pflug
2025-12-01  7:20           ` [PATCH v5 0/4] make the root= command line parameter variable Fabian Pflug
2025-12-01  7:20             ` [PATCH v5 1/4] block.h: renamed get_rootargs to get_root Fabian Pflug
2025-12-01  7:20             ` [PATCH v5 2/4] fs: split rootargs into root and options Fabian Pflug
2025-12-01  7:20             ` [PATCH v5 3/4] bootm: use new api to get kernel command line params Fabian Pflug
2025-12-01  7:21             ` [PATCH v5 4/4] bootm: introduce bootm.root_param variable Fabian Pflug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c15f6ae3-812a-43b2-aa3b-47c4d4e4da1b@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=f.pflug@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox