All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] distroboot: ubifs: Add support for specifying UBI header offset
@ 2022-08-07 19:04 Pali Rohár
  2022-08-08 16:10 ` Tom Rini
  2022-08-27 12:06 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Pali Rohár @ 2022-08-07 19:04 UTC (permalink / raw)
  To: Simon Glass, Tom Rini; +Cc: u-boot

Some UBI partitions may use non-standard UBI header offset. For attaching
these UBI partitions it is required to pass second argument with offset to
"ubi part" command.

Therefore extend distroboot to allow specifying additional optional 6th
argument with UBI header offset. This offset is set in new distroboot
variable ${bootubioff} which may be used by distroboot script to e.g.
properly pass this value to linux kernel command line for proper mounting
of rootfs by kernel. This variable is set to empty string (cleared) when
UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES
macro.

Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there
as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified
UBIFS func with either 5 or 6 arguments. If not then cpp throws compile
error.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 include/config_distro_bootcmd.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 4e0c23be5645..f28f6095da08 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -70,7 +70,7 @@
 #ifdef CONFIG_CMD_UBIFS
 #define BOOTENV_SHARED_UBIFS \
 	"ubifs_boot=" \
-		"if ubi part ${bootubipart} && " \
+		"if ubi part ${bootubipart} ${bootubioff} && " \
 			"ubifsmount ubi0:${bootubivol}; " \
 		"then " \
 			"devtype=ubi; " \
@@ -80,12 +80,14 @@
 			"run scan_dev_for_boot; " \
 			"ubifsumount; " \
 		"fi\0"
-#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
+#define BOOTENV_DEV_UBIFS_BOOTUBIOFF(off) #off /* type check, throw error when called with more args */
+#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol, ...) \
 	"bootcmd_ubifs" #instance "=" \
 		"bootubipart=" #bootubipart "; " \
 		"bootubivol=" #bootubivol "; " \
+		"bootubioff=" BOOTENV_DEV_UBIFS_BOOTUBIOFF(__VA_ARGS__) "; " \
 		"run ubifs_boot\0"
-#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
+#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, ...) \
 	#devtypel #instance " "
 #else
 #define BOOTENV_SHARED_UBIFS
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] distroboot: ubifs: Add support for specifying UBI header offset
  2022-08-07 19:04 [PATCH] distroboot: ubifs: Add support for specifying UBI header offset Pali Rohár
@ 2022-08-08 16:10 ` Tom Rini
  2022-08-25 13:52   ` Pali Rohár
  2022-08-27 12:06 ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Rini @ 2022-08-08 16:10 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, u-boot

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

On Sun, Aug 07, 2022 at 09:04:22PM +0200, Pali Rohár wrote:

> Some UBI partitions may use non-standard UBI header offset. For attaching
> these UBI partitions it is required to pass second argument with offset to
> "ubi part" command.
> 
> Therefore extend distroboot to allow specifying additional optional 6th
> argument with UBI header offset. This offset is set in new distroboot
> variable ${bootubioff} which may be used by distroboot script to e.g.
> properly pass this value to linux kernel command line for proper mounting
> of rootfs by kernel. This variable is set to empty string (cleared) when
> UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES
> macro.
> 
> Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there
> as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified
> UBIFS func with either 5 or 6 arguments. If not then cpp throws compile
> error.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] distroboot: ubifs: Add support for specifying UBI header offset
  2022-08-08 16:10 ` Tom Rini
@ 2022-08-25 13:52   ` Pali Rohár
  2022-08-26 15:28     ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2022-08-25 13:52 UTC (permalink / raw)
  To: Tom Rini; +Cc: Simon Glass, u-boot

On Monday 08 August 2022 12:10:27 Tom Rini wrote:
> On Sun, Aug 07, 2022 at 09:04:22PM +0200, Pali Rohár wrote:
> 
> > Some UBI partitions may use non-standard UBI header offset. For attaching
> > these UBI partitions it is required to pass second argument with offset to
> > "ubi part" command.
> > 
> > Therefore extend distroboot to allow specifying additional optional 6th
> > argument with UBI header offset. This offset is set in new distroboot
> > variable ${bootubioff} which may be used by distroboot script to e.g.
> > properly pass this value to linux kernel command line for proper mounting
> > of rootfs by kernel. This variable is set to empty string (cleared) when
> > UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES
> > macro.
> > 
> > Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there
> > as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified
> > UBIFS func with either 5 or 6 arguments. If not then cpp throws compile
> > error.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>
> 
> -- 
> Tom

Tom, who can take this patch?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] distroboot: ubifs: Add support for specifying UBI header offset
  2022-08-25 13:52   ` Pali Rohár
@ 2022-08-26 15:28     ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2022-08-26 15:28 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, u-boot

[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]

On Thu, Aug 25, 2022 at 03:52:20PM +0200, Pali Rohár wrote:
> On Monday 08 August 2022 12:10:27 Tom Rini wrote:
> > On Sun, Aug 07, 2022 at 09:04:22PM +0200, Pali Rohár wrote:
> > 
> > > Some UBI partitions may use non-standard UBI header offset. For attaching
> > > these UBI partitions it is required to pass second argument with offset to
> > > "ubi part" command.
> > > 
> > > Therefore extend distroboot to allow specifying additional optional 6th
> > > argument with UBI header offset. This offset is set in new distroboot
> > > variable ${bootubioff} which may be used by distroboot script to e.g.
> > > properly pass this value to linux kernel command line for proper mounting
> > > of rootfs by kernel. This variable is set to empty string (cleared) when
> > > UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES
> > > macro.
> > > 
> > > Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there
> > > as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified
> > > UBIFS func with either 5 or 6 arguments. If not then cpp throws compile
> > > error.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > 
> > Reviewed-by: Tom Rini <trini@konsulko.com>
> > 
> > -- 
> > Tom
> 
> Tom, who can take this patch?

I'll take it, as part of putting together a number of small fixes for
this release.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] distroboot: ubifs: Add support for specifying UBI header offset
  2022-08-07 19:04 [PATCH] distroboot: ubifs: Add support for specifying UBI header offset Pali Rohár
  2022-08-08 16:10 ` Tom Rini
@ 2022-08-27 12:06 ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2022-08-27 12:06 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Simon Glass, u-boot

[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]

On Sun, Aug 07, 2022 at 09:04:22PM +0200, Pali Rohár wrote:

> Some UBI partitions may use non-standard UBI header offset. For attaching
> these UBI partitions it is required to pass second argument with offset to
> "ubi part" command.
> 
> Therefore extend distroboot to allow specifying additional optional 6th
> argument with UBI header offset. This offset is set in new distroboot
> variable ${bootubioff} which may be used by distroboot script to e.g.
> properly pass this value to linux kernel command line for proper mounting
> of rootfs by kernel. This variable is set to empty string (cleared) when
> UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES
> macro.
> 
> Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there
> as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified
> UBIFS func with either 5 or 6 arguments. If not then cpp throws compile
> error.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-27 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 19:04 [PATCH] distroboot: ubifs: Add support for specifying UBI header offset Pali Rohár
2022-08-08 16:10 ` Tom Rini
2022-08-25 13:52   ` Pali Rohár
2022-08-26 15:28     ` Tom Rini
2022-08-27 12:06 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.