Skip to contentSkip to conversation

boot/uboot: add config option for uboot environment padding byte

PATCH New Yann E. MORIN 1 participant 1 message Dec 10, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 boot/uboot: add config option for uboot environment padding byte

Johannes, All,

On 2017-12-10 17:43 +0100, Johannes Schmitz spake thusly:

Quoted 6 lines

The size of the uboot environment as well as the padding bytes have to be exactly correct in order to generate an image with the correct CRC checksum that can be read by the target during boot. Hence add the option to specify the padding byte which is used by mkenvimage and updated the help texts to inform the user about the importance of these parameters.

As said on IRC, I would love to see more commit loges like this one: it explains the problem, and how the patch solves it.

Yet, a few comments below...

Quoted 11 lines
---
 boot/uboot/Config.in | 11 +++++++++--
 boot/uboot/uboot.mk  | 10 ++++++----
 2 files changed, 15 insertions(+), 6 deletions(-)
boot/uboot/Config.in +0 -0
index 8215912..b52fb81 100644

boot/uboot/Config.in config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE · line 404

Quoted 7 lines
boot/uboot/Config.in +2 -2
@@ -400,8 +400,15 @@ config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
 config BR2_TARGET_UBOOT_ENVIMAGE_SIZE
 	string "Size of environment"
 	help
-	  Size of envronment, can be prefixed with 0x for hexadecimal
-	  values.
+	  Size of environment in bytes, can be prefixed with 0x for hexadecimal
+	  values. Needs to match exactly for correct CRC checksum calculation.

Now you also state the size must be expressed in bytes, say so in the commit log as well.

Quoted 17 lines
boot/uboot/Config.in +6 -0
+config BR2_TARGET_UBOOT_ENVIMAGE_PADDING_BYTE
+	hex "Padding byte"
+	default 0x00
+	help
+	  The byte used for padding at the end of the environment image.
+	  Needs to be correct for correct CRC checksum calculation.
 
 config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT
 	bool "Environment has two copies"
boot/uboot/uboot.mk +0 -0
index a1fac7d..8796e8d 100644
@@ -251,10 +251,12 @@ define UBOOT_INSTALL_IMAGES_CMDS
 	)
 	$(if $(BR2_TARGET_UBOOT_ENVIMAGE),
 		cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) | \

boot/uboot/uboot.mk define UBOOT_INSTALL_IMAGES_CMDS · line 259

Quoted 10 lines
boot/uboot/uboot.mk +6 -4
-			$(HOST_DIR)/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
-			$(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
-			$(if $(filter BIG,$(BR2_ENDIAN)),-b) \
-			-o $(BINARIES_DIR)/uboot-env.bin -)
+			$(HOST_DIR)/bin/mkenvimage \
+				$(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
+				$(if $(filter BIG,$(BR2_ENDIAN)),-b) \
+				-p $(BR2_TARGET_UBOOT_ENVIMAGE_PADDING_BYTE) \
+				-s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
+				-o $(BINARIES_DIR)/uboot-env.bin -)

You re-indent here. State so in the commit log.

Otherwise, that's fine.

Of course, this conflicts with my own patch touching the same code, but it's pretty obvious how to fix it then:

    https://patchwork.ozlabs.org/patch/846557/

Regards,
Yann E. MORIN.

Quoted 6 lines
boot/uboot/uboot.mk +0 -0
 	$(if $(BR2_TARGET_UBOOT_BOOT_SCRIPT),
 		$(HOST_DIR)/bin/mkimage -C none -A $(MKIMAGE_ARCH) -T script \
 			-d $(call qstrip,$(BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE)) \
Signature · 1 line
2.7.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'