Skip to contentSkip to conversation

Minor improvements to secure boot and enable on beaglebone

PATCH New Simon Glass 3 participants 33 messages Jun 3, 2014 – Jun 12, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Minor improvements to secure boot and enable on beaglebone

This series fixes a few problems that have come up since the secure boot series was merged:

- A recent commit broken the assumption that u-boot.bin ends at a known address (thus making things appended to U-Boot inaccessible from the code). This is fixed for Beaglebone and a few other boards. A new test is added to the Makefile to ensure that it does not break again. All boards have been tested to make sure the problem does not appear elsewhere.

- A way is needed to provide an externally-build device tree binary for U-Boot. This allows signing to happen outside the U-Boot build system.

- The .img files generated by an OMAP build need to include the FDT if one is appended.

- Adding signatures to an FDT can cause the FDT to run out of space. The fix is to regenerate the FDT from scratch with different dtc parameters, so pretty painful. Instead, we automatically expand the FDT.

The last commit enables verified boot on a Beaglebone Black with a special configuration. Use 'am335x_boneblack_vboot' for this. This will soon disable support for legacy images.

Changes in v3:
- Add new patch to ensure the hash section is inside the image for cm_t335
- Add new patch to ensure the hash section is inside the image for mx31ads
- Rebase to master and update commit message
- Fix typo in commit message
- Add new patch to improve error handling in fit_common
- Rebase to master
- Also enable LZO and timestamps, plus increase the maximum kernel size
- Use verified boot only on a new board - am335x_boneblack_vboot

Changes in v2:
- Add new patch to ensure the hash section is inside the image for am335x
- Add new patch to check u-boot.bin size against symbol table
- Update to cover all omap devices
- Adjust for kbuild changes
- Fix line over 80cols
- Move device tree files into arch/arm/dts

Simon Glass (14):
ti: am335x: Fix the U-Boot binary output
cm_t335: Fix the U-Boot binary output
mx31ads: Fix the U-Boot binary output
Check that u-boot.bin size looks correct
am33xx/omap: Allow cache enable for all Sitara/OMAP
hash: Export the function to show a hash
fdt: Add DEV_TREE_BIN option to specify a device tree binary file
fdt: Update functions which write to an FDT to return -ENOSPC Improve error handling in fit_common
mkimage: Automatically make space in FDT when full
arm: ti: Increase malloc size to 16MB for armv7 boards am33xx/omap: Enable CONFIG_OF_CONTROL
am33xx/omap: Enable FIT support
am33xx/omap: Add a new board to enable verified boot

 Makefile                                       |  16 +-
 arch/arm/cpu/armv7/am33xx/board.c              |   8 -
 arch/arm/cpu/armv7/omap-common/Makefile        |   4 +
 arch/arm/cpu/armv7/omap-common/hwinit-common.c |  42 --
 arch/arm/cpu/armv7/omap-common/omap-cache.c    |  56 +++
 arch/arm/cpu/armv7/omap3/board.c               |   8 -
 arch/arm/dts/Makefile                          |   1 +
 arch/arm/dts/am335x-bone-common.dtsi           | 262 ++++++++++
 arch/arm/dts/am335x-boneblack.dts              |  17 +
 arch/arm/dts/am33xx.dtsi                       | 649 +++++++++++++++++++++++++
 arch/arm/dts/dt-bindings/gpio/gpio.h           |  15 +
 arch/arm/dts/dt-bindings/pinctrl/am33xx.h      |  42 ++
 arch/arm/dts/dt-bindings/pinctrl/omap.h        |  55 +++
 arch/arm/dts/tps65217.dtsi                     |  56 +++
 board/compulab/cm_t335/u-boot.lds              |   4 +-
 board/freescale/mx31ads/u-boot.lds             |   4 +-
 board/ti/am335x/u-boot.lds                     |   3 +-
 boards.cfg                                     |   1 +
 common/hash.c                                  |   7 +-
 common/image-fit.c                             |   4 +-
 doc/README.fdt-control                         |  16 +-
 dts/Makefile                                   |   4 +
 include/configs/am335x_evm.h                   |  15 +
 include/configs/ti_armv7_common.h              |   2 +-
 include/hash.h                                 |  15 +
 include/rsa.h                                  |   3 +-
 lib/rsa/rsa-sign.c                             |  28 +-
 tools/fit_check_sign.c                         |   4 +-
 tools/fit_common.c                             |  49 +-
 tools/fit_common.h                             |  15 +-
 tools/fit_image.c                              | 112 +++--
 tools/fit_info.c                               |   2 +-
 tools/image-host.c                             |  26 +-
 33 files changed, 1390 insertions(+), 155 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/omap-common/omap-cache.c
 create mode 100644 arch/arm/dts/am335x-bone-common.dtsi
 create mode 100644 arch/arm/dts/am335x-boneblack.dts
 create mode 100644 arch/arm/dts/am33xx.dtsi
 create mode 100644 arch/arm/dts/dt-bindings/gpio/gpio.h
 create mode 100644 arch/arm/dts/dt-bindings/pinctrl/am33xx.h
 create mode 100644 arch/arm/dts/dt-bindings/pinctrl/omap.h
 create mode 100644 arch/arm/dts/tps65217.dtsi
Signature · 1 line
1.9.1.423.g4596e3a
#1 lore raw

PATCH v3 1/14 ti: am335x: Fix the U-Boot binary output

This should include the hash so that image_binary_size is really at the end of the image, and not some 300 bytes earlier.

---

Changes in v3: None
Changes in v2:
- Add new patch to ensure the hash section is inside the image for am335x

 board/ti/am335x/u-boot.lds | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
board/ti/am335x/u-boot.lds +2 -1
index 2c5a0f8..78f294a 100644
@@ -78,6 +78,8 @@ SECTIONS
 		*(.__rel_dyn_end)
 	}
 
+	.hash : { *(.hash*) }
+
 	.end :
 	{
 		*(.__end)
@@ -118,7 +120,6 @@ SECTIONS
 	.dynbss : { *(.dynbss) }
 	.dynstr : { *(.dynstr*) }
 	.dynamic : { *(.dynamic*) }
-	.hash : { *(.hash*) }
 	.gnu.hash : { *(.gnu.hash) }
 	.plt : { *(.plt*) }
 	.interp : { *(.interp*) }
Signature · 1 line
1.9.1.423.g4596e3a
#2 lore raw

PATCH v3 1/14 ti: am335x: Fix the U-Boot binary output

Quoted 4 lines · Simon Glass

This should include the hash so that image_binary_size is really at the end of the image, and not some 300 bytes earlier.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/aa5e98d5/attachment.pgp>
#3 lore raw

PATCH v3 2/14 cm_t335: Fix the U-Boot binary output

In reply to Simon Glass

Correct the binary output so that image_binary_size is really at the end of the image.

---

Changes in v3:
- Add new patch to ensure the hash section is inside the image for cm_t335

Changes in v2: None

 board/compulab/cm_t335/u-boot.lds | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/compulab/cm_t335/u-boot.lds +2 -2
index c8ab716..6275836 100644
@@ -62,6 +62,8 @@ SECTIONS
 		*(.__rel_dyn_end)
 	}
 
+	.hash : { *(.hash*) }
+
 	.end :
 	{
 		*(.__end)
@@ -99,8 +101,6 @@ SECTIONS
 	}
 
 	.dynsym _image_binary_end : { *(.dynsym) }
-	.hash : { *(.hash) }
-	.got.plt : { *(.got.plt) }
 	.dynbss : { *(.dynbss) }
 	.dynstr : { *(.dynstr*) }
 	.dynamic : { *(.dynamic*) }
Signature · 1 line
1.9.1.423.g4596e3a
#4 lore raw

PATCH v3 2/14 cm_t335: Fix the U-Boot binary output

Quoted 4 lines · Simon Glass

Correct the binary output so that image_binary_size is really at the end of the image.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/00b5af25/attachment.pgp>
#5 lore raw

PATCH v3 3/14 mx31ads: Fix the U-Boot binary output

In reply to Simon Glass

Correct the binary output so that image_binary_size is really at the end of the image.

---

Changes in v3:
- Add new patch to ensure the hash section is inside the image for mx31ads

Changes in v2: None

 board/freescale/mx31ads/u-boot.lds | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
board/freescale/mx31ads/u-boot.lds +3 -1
index 61b83bf..8a4a8a2 100644
@@ -70,6 +70,8 @@ SECTIONS
 		*(.__rel_dyn_end)
 	}
 
+	.hash : { *(.hash*) }
+
 	.end :
 	{
 		*(.__end)
@@ -100,7 +102,7 @@ SECTIONS
 	.dynbss : { *(.dynbss) }
 	.dynstr : { *(.dynstr*) }
 	.dynamic : { *(.dynamic*) }
-	.hash : { *(.hash*) }
+	.gnu.hash : { *(.gnu.hash) }
 	.plt : { *(.plt*) }
 	.interp : { *(.interp*) }
 	.gnu : { *(.gnu*) }
Signature · 1 line
1.9.1.423.g4596e3a
#6 lore raw

PATCH v3 3/14 mx31ads: Fix the U-Boot binary output

Quoted 4 lines · Simon Glass

Correct the binary output so that image_binary_size is really at the end of the image.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/7b2311f7/attachment.pgp>
#7 lore raw

PATCH v3 4/14 Check that u-boot.bin size looks correct

In reply to Simon Glass

Check that the image size matches the size we get from u-boot.bin. If it doesn't, that generally means that some extra sections are being added to u-boot.bin, meaning that it is not possible to access data appended to the U-Boot binary. This is used for device tree, so needs to work.

This problem was introduced by commit b02bfc4. By adding a test we can prevent a reccurence.

---

Changes in v3: None
Changes in v2:
- Add new patch to check u-boot.bin size against symbol table

 Makefile | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Makefile +13 -1
index 1df3f70..ece622f 100644
@@ -740,7 +740,7 @@ DO_STATIC_RELA =
 endif
 
 # Always append ALL so that arch config.mk's can add custom ones
-ALL-y += u-boot.srec u-boot.bin System.map
+ALL-y += u-boot.srec u-boot.bin System.map binary_size_check
 
 ALL-$(CONFIG_NAND_U_BOOT) += u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
@@ -820,6 +820,18 @@ u-boot.hex u-boot.srec: u-boot FORCE
 
 OBJCOPYFLAGS_u-boot.bin := -O binary
 
+binary_size_check: u-boot.bin System.map FORCE
+	@file_size=`stat -c %s u-boot.bin` ; \
+	map_size=$(shell cat System.map | \
+		awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print strtonum("0x" end) - strtonum("0x" start)}'); \
+	if [ "" != "$$map_size" ]; then \
+		if test $$map_size -ne $$file_size; then \
+			echo "System.map shows a binary size of $$map_size" >&2 ; \
+			echo "  but u-boot.bin shows $$file_size" >&2 ; \
+			exit 1; \
+		fi \
+	fi
+
 u-boot.bin: u-boot FORCE
 	$(call if_changed,objcopy)
 	$(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
Signature · 1 line
1.9.1.423.g4596e3a
#8 lore raw

PATCH v3 5/14 am33xx/omap: Allow cache enable for all Sitara/OMAP

In reply to Simon Glass

Enable the cache for all devices, unless CONFIG_SYS_DCACHE_OFF is defined. This speeds up the Beaglebone Black boot considerable.

(Tested only on Beaglebone Black with SD card boot)

---

Changes in v3: None
Changes in v2:
- Update to cover all omap devices

 arch/arm/cpu/armv7/am33xx/board.c              |  8 ----
 arch/arm/cpu/armv7/omap-common/Makefile        |  4 ++
 arch/arm/cpu/armv7/omap-common/hwinit-common.c | 42 -------------------
 arch/arm/cpu/armv7/omap-common/omap-cache.c    | 56 ++++++++++++++++++++++++++
 arch/arm/cpu/armv7/omap3/board.c               |  8 ----
 5 files changed, 60 insertions(+), 58 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/omap-common/omap-cache.c
arch/arm/cpu/armv7/am33xx/board.c +0 -8
index 28c16f8..9ae8c34 100644
@@ -241,11 +241,3 @@ void s_init(void)
 	sdram_init();
 }
 #endif
-
-#ifndef CONFIG_SYS_DCACHE_OFF
-void enable_caches(void)
-{
-	/* Enable D-cache. I-cache is already enabled in start.S */
-	dcache_enable();
-}
-#endif /* !CONFIG_SYS_DCACHE_OFF */
arch/arm/cpu/armv7/omap-common/Makefile +4 -0
index 5f5132f..7695e16 100644
@@ -22,6 +22,10 @@ obj-y	+= pipe3-phy.o
 obj-$(CONFIG_SCSI_AHCI_PLAT) += sata.o
 endif
 
+ifeq ($(CONFIG_SYS_DCACHE_OFF),)
+obj-y	+= omap-cache.o
+endif
+
 ifeq ($(CONFIG_OMAP34XX),)
 obj-y	+= boot-common.o
 obj-y	+= lowlevel_init.o
arch/arm/cpu/armv7/omap-common/hwinit-common.c +0 -42

53 lines not on this page · raw message

arch/arm/cpu/armv7/omap-common/omap-cache.c new file +56 -0

56 lines not on this page · raw message

arch/arm/cpu/armv7/omap3/board.c +0 -8
index 9bb1a1c..e252e7f 100644
@@ -478,11 +478,3 @@ void omap3_outer_cache_disable(void)
 	omap3_update_aux_cr(0, 0x2);
 }
 #endif /* !CONFIG_SYS_L2CACHE_OFF */
-
-#ifndef CONFIG_SYS_DCACHE_OFF
-void enable_caches(void)
-{
-	/* Enable D-cache. I-cache is already enabled in start.S */
-	dcache_enable();
-}
-#endif /* !CONFIG_SYS_DCACHE_OFF */
Signature · 1 line
1.9.1.423.g4596e3a
#9 lore raw

PATCH v3 5/14 am33xx/omap: Allow cache enable for all Sitara/OMAP

Quoted 6 lines · Simon Glass

Enable the cache for all devices, unless CONFIG_SYS_DCACHE_OFF is defined. This speeds up the Beaglebone Black boot considerable.

(Tested only on Beaglebone Black with SD card boot)

Applied to u-boot/master (and tested on am43xx evm as well), thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/9292d7d8/attachment.pgp>
#10 lore raw

PATCH v3 6/14 hash: Export the function to show a hash

In reply to Simon Glass

This function is useful for displaying a hash value, so export it.

---

Changes in v3:
- Rebase to master and update commit message

Changes in v2: None

 common/hash.c  |  7 +++----
 include/hash.h | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)
common/hash.c +3 -4
index 7627b84..41a4a28 100644
@@ -311,8 +311,7 @@ int hash_lookup_algo(const char *algo_name, struct hash_algo **algop)
 	return -EPROTONOSUPPORT;
 }
 
-static void show_hash(struct hash_algo *algo, ulong addr, ulong len,
-		      u8 *output)
+void hash_show(struct hash_algo *algo, ulong addr, ulong len, u8 *output)
 {
 	int i;
 
@@ -392,7 +391,7 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
 			if (memcmp(output, vsum, algo->digest_size) != 0) {
 				int i;
 
-				show_hash(algo, addr, len, output);
+				hash_show(algo, addr, len, output);
 				printf(" != ");
 				for (i = 0; i < algo->digest_size; i++)
 					printf("%02x", vsum[i]);
@@ -400,7 +399,7 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
 				return 1;
 			}
 		} else {
-			show_hash(algo, addr, len, output);
+			hash_show(algo, addr, len, output);
 			printf("\n");
 
 			if (argc) {
include/hash.h +15 -0
index dc21678..c6de20d 100644
@@ -125,4 +125,19 @@ int hash_block(const char *algo_name, const void *data, unsigned int len,
  * @return 0 if ok, -EPROTONOSUPPORT for an unknown algorithm.
  */
 int hash_lookup_algo(const char *algo_name, struct hash_algo **algop);
+
+/**
+ * hash_show() - Print out a hash algorithm and value
+ *
+ * You will get a message like this (without a newline at the end):
+ *
+ * "sha1 for 9eb3337c ... 9eb3338f ==> 7942ef1df479fd3130f716eb9613d107dab7e257"
+ *
+ * @algo:		Algorithm used for hash
+ * @addr:		Address of data that was hashed
+ * @len:		Length of data that was hashed
+ * @output:		Hash value to display
+ */
+void hash_show(struct hash_algo *algo, ulong addr, ulong len, u8 *output);
+
 #endif
Signature · 1 line
1.9.1.423.g4596e3a
#11 lore raw

PATCH v3 6/14 hash: Export the function to show a hash

Quoted 3 lines · Simon Glass

This function is useful for displaying a hash value, so export it.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/d5aa349b/attachment.pgp>
#12 lore raw

PATCH v3 7/14 fdt: Add DEV_TREE_BIN option to specify a device tree binary file

In reply to Simon Glass

In some cases, an externally-built device tree binary is required to be attached to U-Boot. An example is when using image signing, since in that case the .dtb file must include the public keys.

Add a DEV_TREE_BIN option to the Makefile, and update the documentation.

Usage is something like:

make DEV_TREE_BIN=boot/am335x-boneblack-pubkey.dtb

---

Changes in v3: None
Changes in v2:
- Adjust for kbuild changes

 Makefile               |  2 +-
 doc/README.fdt-control | 16 ++++++++++++++--
 dts/Makefile           |  4 ++++
 3 files changed, 19 insertions(+), 3 deletions(-)
Makefile +1 -1
index ece622f..92819bf 100644
@@ -867,7 +867,7 @@ MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
 
-u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
+u-boot.img u-boot.kwb u-boot.pbl: u-boot$(if $(CONFIG_OF_SEPARATE),-dtb,).bin FORCE
 	$(call if_changed,mkimage)
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
doc/README.fdt-control +14 -2
index 86bae68..8a4aa7a 100644
@@ -122,7 +122,8 @@ This should include your CPU or SOC's device tree file, placed in
 arch/<arch>/dts, and then make any adjustments required.
 
 If CONFIG_OF_EMBED is defined, then it will be picked up and built into
-the U-Boot image (including u-boot.bin).
+the U-Boot image (including u-boot.bin). This is suitable for debugging
+and development only and is not recommended for production devices.
 
 If CONFIG_OF_SEPARATE is defined, then it will be built and placed in
 a u-boot.dtb file alongside u-boot.bin. A common approach is then to
@@ -130,7 +131,10 @@ join the two:
 
 	cat u-boot.bin u-boot.dtb >image.bin
 
-and then flash image.bin onto your board.
+and then flash image.bin onto your board. Note that U-Boot creates
+u-boot-dtb.bin which does the above step for you also. If you are using
+CONFIG_SPL_FRAMEWORK, then u-boot.img will be built to include the device
+tree binary.
 
 If CONFIG_OF_HOSTFILE is defined, then it will be read from a file on
 startup. This is only useful for sandbox. Use the -d flag to U-Boot to
@@ -138,6 +142,14 @@ specify the file to read.
 
 You cannot use more than one of these options at the same time.
 
+To use a device tree file that you have compiled yourself, pass
+DEV_TREE_BIN=<filename> to 'make', as in:
+
+	make DEV_TREE_BIN=boot/am335x-boneblack-pubkey.dtb
+
+Then U-Boot will copy that file to u-boot.dtb, put it in the .img file
+if used, and u-boot-dtb.bin.
+
 If you wish to put the fdt at a different address in memory, you can
 define the "fdtcontroladdr" environment variable. This is the hex
 address of the fdt binary blob, and will override either of the options.
dts/Makefile +4 -0
index e59550c..8bb5212 100644
@@ -12,7 +12,11 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+ifneq ($(DEV_TREE_BIN),)
+DTB := $(DEV_TREE_BIN)
+else
 DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+endif
 
 quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
Signature · 1 line
1.9.1.423.g4596e3a
#13 lore raw

PATCH v3 7/14 fdt: Add DEV_TREE_BIN option to specify a device tree binary file

Hi Simon,

Quoted 3 lines · On Mon, 2 Jun 2014 22:04:50 -0600 Simon Glass <[email protected]> wrote:

In some cases, an externally-built device tree binary is required to be attached to U-Boot. An example is when using image signing, since in that case the .dtb file must include the public keys.

I do not want to expand this argument, but
I am not sure if DTB stands for "device tree binary".

linux/Documentation often refer it as "device tree blob",
while linux/Documentation/devicetree/booting-without-of.txt
says "device tree block".

Quoted 1 line

Add a DEV_TREE_BIN option to the Makefile, and update the documentation.

Is it possible to rename it without mentioning _BIN or _BLOB ?

For example, DTB_PATH=... or EXT_DTB=...
or some other variable name you like.

Makefile MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ · line 871

Quoted 11 lines
Makefile +1 -1
index ece622f..92819bf 100644
@@ -867,7 +867,7 @@ MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
 
-u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
+u-boot.img u-boot.kwb u-boot.pbl: u-boot$(if $(CONFIG_OF_SEPARATE),-dtb,).bin FORCE
 	$(call if_changed,mkimage)

The second comma in '(if $(CONFIG_OF_SEPARATE),-dtb,)' is redundant.

This is duplicating the same image as u-boot-dtb.img

Your way is that "u-boot.img" includes DTB in some time and doesn't in the other. I am not sure which way is better.
But we don't need two rules to generate the equivalent image.

If you go along with this change, I think it's OK with me. Please consider removing below in that case:

ifeq ($(CONFIG_SPL_FRAMEWORK),y)
ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
endif

and

u-boot-dtb.img: u-boot-dtb.bin FORCE

        $(call if_changed,mkimage)

Best Regards
Masahiro Yamada

#14 lore raw

PATCH v3 7/14 fdt: Add DEV_TREE_BIN option to specify a device tree binary file

Quoted 18 lines · Masahiro Yamada

Hi Simon,

Quoted 3 lines · On Mon, 2 Jun 2014 22:04:50 -0600 Simon Glass <[email protected]> wrote:

In some cases, an externally-built device tree binary is required to be attached to U-Boot. An example is when using image signing, since in that case the .dtb file must include the public keys.

I do not want to expand this argument, but
I am not sure if DTB stands for "device tree binary".

linux/Documentation often refer it as "device tree blob",
while linux/Documentation/devicetree/booting-without-of.txt
says "device tree block".

Quoted 6 lines
Quoted 1 line

Add a DEV_TREE_BIN option to the Makefile, and update the documentation.

Is it possible to rename it without mentioning _BIN or _BLOB ?

For example, DTB_PATH=... or EXT_DTB=...
or some other variable name you like.

Yes.

Quoted 25 lines

Makefile MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ · line 871

Quoted 11 lines
Makefile +1 -1
index ece622f..92819bf 100644
@@ -867,7 +867,7 @@ MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
 
-u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
+u-boot.img u-boot.kwb u-boot.pbl: u-boot$(if $(CONFIG_OF_SEPARATE),-dtb,).bin FORCE
 	$(call if_changed,mkimage)

The second comma in '(if $(CONFIG_OF_SEPARATE),-dtb,)' is redundant.

This is duplicating the same image as u-boot-dtb.img

Your way is that "u-boot.img" includes DTB in some time and doesn't in the other. I am not sure which way is better.
But we don't need two rules to generate the equivalent image.

If you go along with this change, I think it's OK with me. Please consider removing below in that case:

Quoted 8 lines

ifeq ($(CONFIG_SPL_FRAMEWORK),y)
ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
endif

and

u-boot-dtb.img: u-boot-dtb.bin FORCE

        $(call if_changed,mkimage)

... as a follow up (I want to get this in already). Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/0ead2a2e/attachment.pgp>
#15 lore raw

PATCH v3 7/14 fdt: Add DEV_TREE_BIN option to specify a device tree binary file

Hi Tom,

On 11 June 2014 18:18, Tom Rini <[email protected]> wrote:
[snip]

Quoted 1 line

... as a follow up (I want to get this in already). Thanks!

I'll send a new patch to update this when I finish testing the rebase you asked for.

Regards,
Simon

#16 lore raw

PATCH v3 7/14 fdt: Add DEV_TREE_BIN option to specify a device tree binary file

In reply to Masahiro Yamada

Hi Masahiro,

Quoted 18 lines · Masahiro Yamada

Hi Simon,

Quoted 3 lines · On Mon, 2 Jun 2014 22:04:50 -0600 Simon Glass <[email protected]> wrote:

In some cases, an externally-built device tree binary is required to be attached to U-Boot. An example is when using image signing, since in that case the .dtb file must include the public keys.

I do not want to expand this argument, but
I am not sure if DTB stands for "device tree binary".

linux/Documentation often refer it as "device tree blob",
while linux/Documentation/devicetree/booting-without-of.txt
says "device tree block".

Quoted 6 lines
Quoted 1 line

Add a DEV_TREE_BIN option to the Makefile, and update the documentation.

Is it possible to rename it without mentioning _BIN or _BLOB ?

For example, DTB_PATH=... or EXT_DTB=...
or some other variable name you like.

I think EXT_DTB is quite a nice name so I've made that change.

Quoted 10 lines
Quoted 10 lines
Makefile +0 -0
index ece622f..92819bf 100644
@@ -867,7 +867,7 @@ MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
              -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
 
Quoted 6 lines

Makefile MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ · line 871

Quoted 3 lines
Makefile +1 -1
-u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
+u-boot.img u-boot.kwb u-boot.pbl: u-boot$(if $(CONFIG_OF_SEPARATE),-dtb,).bin FORCE
      $(call if_changed,mkimage)

The second comma in '(if $(CONFIG_OF_SEPARATE),-dtb,)' is redundant.

OK

Quoted 11 lines

This is duplicating the same image as u-boot-dtb.img

Your way is that "u-boot.img" includes DTB in some time and doesn't in the other. I am not sure which way is better.
But we don't need two rules to generate the equivalent image.

If you go along with this change, I think it's OK with me. Please consider removing below in that case:

Quoted 8 lines

ifeq ($(CONFIG_SPL_FRAMEWORK),y)
ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
endif

and

u-boot-dtb.img: u-boot-dtb.bin FORCE

        $(call if_changed,mkimage)

I took a look this morning but I'm still not quite sure about this. I will spend some more time to understand it fully.

Regards,
Simon

#17 lore raw

PATCH v3 7/14 fdt: Add DEV_TREE_BIN option to specify a device tree binary file

In reply to Simon Glass
Quoted 11 lines · Simon Glass

In some cases, an externally-built device tree binary is required to be attached to U-Boot. An example is when using image signing, since in that case the .dtb file must include the public keys.

Add a DEV_TREE_BIN option to the Makefile, and update the documentation.

Usage is something like:

make DEV_TREE_BIN=boot/am335x-boneblack-pubkey.dtb

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/4afaa341/attachment.pgp>
#18 lore raw

PATCH v3 8/14 fdt: Update functions which write to an FDT to return -ENOSPC

In reply to Simon Glass

When writing values into an FDT it is possible that there will be insufficient space. If the caller gets a useful error then it can potentially deal with the situation.

Adjust these functions to return -ENOSPC when the FDT is full.

---

Changes in v3:
- Fix typo in commit message

Changes in v2:
- Fix line over 80cols

 common/image-fit.c |  4 ++--
 include/rsa.h      |  3 ++-
 lib/rsa/rsa-sign.c | 28 +++++++++++++++++++---------
 3 files changed, 23 insertions(+), 12 deletions(-)
common/image-fit.c +2 -2
index 77f32bc..732505a 100644
@@ -833,7 +833,7 @@ static int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore)
  *
  * returns:
  *     0, on success
- *     -1, on property read failure
+ *     -ENOSPC if no space in device tree, -1 for other error
  */
 int fit_set_timestamp(void *fit, int noffset, time_t timestamp)
 {
@@ -847,7 +847,7 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp)
 		printf("Can't set '%s' property for '%s' node (%s)\n",
 		       FIT_TIMESTAMP_PROP, fit_get_name(fit, noffset, NULL),
 		       fdt_strerror(ret));
-		return -1;
+		return ret == -FDT_ERR_NOSPACE ? -ENOSPC : -1;
 	}
 
 	return 0;
include/rsa.h +2 -1
index a5680ab..325751a 100644
@@ -60,7 +60,8 @@ int rsa_sign(struct image_sign_info *info,
  *
  * @info:	Specifies key and FIT information
  * @keydest:	Destination FDT blob for public key data
- * @return: 0, on success, -ve on error
+ * @return: 0, on success, -ENOSPC if the keydest FDT blob ran out of space,
+		other -ve value on error
 */
 int rsa_add_verify_data(struct image_sign_info *info, void *keydest);
 #else
lib/rsa/rsa-sign.c +19 -9
index ca8c120..48f3197 100644
@@ -429,20 +429,30 @@ int rsa_add_verify_data(struct image_sign_info *info, void *keydest)
 
 	ret = fdt_setprop_string(keydest, node, "key-name-hint",
 				 info->keyname);
-	ret |= fdt_setprop_u32(keydest, node, "rsa,num-bits", bits);
-	ret |= fdt_setprop_u32(keydest, node, "rsa,n0-inverse", n0_inv);
-	ret |= fdt_add_bignum(keydest, node, "rsa,modulus", modulus, bits);
-	ret |= fdt_add_bignum(keydest, node, "rsa,r-squared", r_squared, bits);
-	ret |= fdt_setprop_string(keydest, node, FIT_ALGO_PROP,
-				  info->algo->name);
+	if (!ret)
+		ret = fdt_setprop_u32(keydest, node, "rsa,num-bits", bits);
+	if (!ret)
+		ret = fdt_setprop_u32(keydest, node, "rsa,n0-inverse", n0_inv);
+	if (!ret) {
+		ret = fdt_add_bignum(keydest, node, "rsa,modulus", modulus,
+				     bits);
+	}
+	if (!ret) {
+		ret = fdt_add_bignum(keydest, node, "rsa,r-squared", r_squared,
+				     bits);
+	}
+	if (!ret) {
+		ret = fdt_setprop_string(keydest, node, FIT_ALGO_PROP,
+					 info->algo->name);
+	}
 	if (info->require_keys) {
-		fdt_setprop_string(keydest, node, "required",
-				   info->require_keys);
+		ret = fdt_setprop_string(keydest, node, "required",
+					 info->require_keys);
 	}
 	BN_free(modulus);
 	BN_free(r_squared);
 	if (ret)
-		return -EIO;
+		return ret == FDT_ERR_NOSPACE ? -ENOSPC : -EIO;
 
 	return 0;
 }
Signature · 1 line
1.9.1.423.g4596e3a
#19 lore raw

PATCH v3 8/14 fdt: Update functions which write to an FDT to return -ENOSPC

Quoted 7 lines · Simon Glass

When writing values into an FDT it is possible that there will be insufficient space. If the caller gets a useful error then it can potentially deal with the situation.

Adjust these functions to return -ENOSPC when the FDT is full.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/a57c8755/attachment.pgp>
#20 lore raw

PATCH v3 9/14 Improve error handling in fit_common

In reply to Simon Glass

Make the error handling common, and make sure the file is always closed on error. Rename the parameter to be more description and add comments.

---

Changes in v3:
- Add new patch to improve error handling in fit_common

Changes in v2: None

 tools/fit_check_sign.c |  4 ++--
 tools/fit_common.c     | 28 ++++++++++++++--------------
 tools/fit_common.h     | 14 ++++++++++++--
 tools/fit_info.c       |  2 +-
 4 files changed, 29 insertions(+), 19 deletions(-)
tools/fit_check_sign.c +2 -2
index d6d9340..e6df610 100644
@@ -61,10 +61,10 @@ int main(int argc, char **argv)
 			break;
 	}
 
-	ffd = mmap_fdt(cmdname, fdtfile, &fit_blob, &fsbuf, 0);
+	ffd = mmap_fdt(cmdname, fdtfile, &fit_blob, &fsbuf, false);
 	if (ffd < 0)
 		return EXIT_FAILURE;
-	kfd = mmap_fdt(cmdname, keyfile, &key_blob, &ksbuf, 0);
+	kfd = mmap_fdt(cmdname, keyfile, &key_blob, &ksbuf, false);
 	if (ffd < 0)
 		return EXIT_FAILURE;
 
tools/fit_common.c +14 -14
index ee1767b..286f357 100644
@@ -38,8 +38,8 @@ int fit_check_image_types(uint8_t type)
 		return EXIT_FAILURE;
 }
 
-int mmap_fdt(char *cmdname, const char *fname, void **blobp,
-		struct stat *sbuf, int useunlink)
+int mmap_fdt(const char *cmdname, const char *fname, void **blobp,
+	     struct stat *sbuf, bool delete_on_error)
 {
 	void *ptr;
 	int fd;
@@ -50,17 +50,13 @@ int mmap_fdt(char *cmdname, const char *fname, void **blobp,
 	if (fd < 0) {
 		fprintf(stderr, "%s: Can't open %s: %s\n",
 			cmdname, fname, strerror(errno));
-		if (useunlink)
-			unlink(fname);
-		return -1;
+		goto err;
 	}
 
 	if (fstat(fd, sbuf) < 0) {
 		fprintf(stderr, "%s: Can't stat %s: %s\n",
 			cmdname, fname, strerror(errno));
-		if (useunlink)
-			unlink(fname);
-		return -1;
+		goto err;
 	}
 
 	errno = 0;
@@ -68,19 +64,23 @@ int mmap_fdt(char *cmdname, const char *fname, void **blobp,
 	if ((ptr == MAP_FAILED) || (errno != 0)) {
 		fprintf(stderr, "%s: Can't read %s: %s\n",
 			cmdname, fname, strerror(errno));
-		if (useunlink)
-			unlink(fname);
-		return -1;
+		goto err;
 	}
 
 	/* check if ptr has a valid blob */
 	if (fdt_check_header(ptr)) {
 		fprintf(stderr, "%s: Invalid FIT blob\n", cmdname);
-		if (useunlink)
-			unlink(fname);
-		return -1;
+		goto err;
 	}
 
 	*blobp = ptr;
 	return fd;
+
+err:
+	if (fd >= 0)
+		close(fd);
+	if (delete_on_error)
+		unlink(fname);
+
+	return -1;
 }
tools/fit_common.h +12 -2
index adf4404..adcee6d 100644
@@ -16,7 +16,17 @@ int fit_verify_header(unsigned char *ptr, int image_size,
 
 int fit_check_image_types(uint8_t type);
 
-int mmap_fdt(char *cmdname, const char *fname, void **blobp,
-		struct stat *sbuf, int useunlink);
+/**
+ * Map an FDT into memory, optionally increasing its size
+ *
+ * @cmdname:	Tool name (for displaying with error messages)
+ * @fname:	Filename containing FDT
+ * @blobp:	Returns pointer to FDT blob
+ * @sbuf:	File status information is stored here
+ * @delete_on_error:	true to delete the file if we get an error
+ * @return 0 if OK, -1 on error.
+ */
+int mmap_fdt(const char *cmdname, const char *fname, void **blobp,
+	     struct stat *sbuf, bool delete_on_error);
 
 #endif /* _FIT_COMMON_H_ */
tools/fit_info.c +1 -1
index 50f3c8e..9442ff1 100644
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
 			break;
 		}
 
-	ffd = mmap_fdt(cmdname, fdtfile, &fit_blob, &fsbuf, 0);
+	ffd = mmap_fdt(cmdname, fdtfile, &fit_blob, &fsbuf, false);
 
 	if (ffd < 0) {
 		printf("Could not open %s\n", fdtfile);
Signature · 1 line
1.9.1.423.g4596e3a
#21 lore raw

PATCH v3 9/14 Improve error handling in fit_common

Quoted 4 lines · Simon Glass

Make the error handling common, and make sure the file is always closed on error. Rename the parameter to be more description and add comments.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/1ebe0791/attachment.pgp>
#22 lore raw

PATCH v3 10/14 mkimage: Automatically make space in FDT when full

In reply to Simon Glass

When adding hashes or signatures, the target FDT may be full. Detect this and automatically try again after making 1KB of space.

---

Changes in v3:
- Rebase to master

Changes in v2: None

 tools/fit_check_sign.c |   4 +-
 tools/fit_common.c     |  25 ++++++++++-
 tools/fit_common.h     |   5 ++-
 tools/fit_image.c      | 112 ++++++++++++++++++++++++++++++-------------------
 tools/fit_info.c       |   2 +-
 tools/image-host.c     |  26 ++++++++----
 6 files changed, 114 insertions(+), 60 deletions(-)
tools/fit_check_sign.c +2 -2
index e6df610..c2aefae 100644
@@ -61,10 +61,10 @@ int main(int argc, char **argv)
 			break;
 	}
 
-	ffd = mmap_fdt(cmdname, fdtfile, &fit_blob, &fsbuf, false);
+	ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
 	if (ffd < 0)
 		return EXIT_FAILURE;
-	kfd = mmap_fdt(cmdname, keyfile, &key_blob, &ksbuf, false);
+	kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false);
 	if (ffd < 0)
 		return EXIT_FAILURE;
 
tools/fit_common.c +23 -2
index 286f357..81ba698 100644
@@ -38,8 +38,8 @@ int fit_check_image_types(uint8_t type)
 		return EXIT_FAILURE;
 }
 
-int mmap_fdt(const char *cmdname, const char *fname, void **blobp,
-	     struct stat *sbuf, bool delete_on_error)
+int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
+	     void **blobp, struct stat *sbuf, bool delete_on_error)
 {
 	void *ptr;
 	int fd;
@@ -59,6 +59,15 @@ int mmap_fdt(const char *cmdname, const char *fname, void **blobp,
 		goto err;
 	}
 
+	if (size_inc) {
+		sbuf->st_size += size_inc;
+		if (ftruncate(fd, sbuf->st_size)) {
+			fprintf(stderr, "%s: Can't expand %s: %s\n",
+				cmdname, fname, strerror(errno));
+		goto err;
+		}
+	}
+
 	errno = 0;
 	ptr = mmap(0, sbuf->st_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
 	if ((ptr == MAP_FAILED) || (errno != 0)) {
@@ -73,6 +82,18 @@ int mmap_fdt(const char *cmdname, const char *fname, void **blobp,
 		goto err;
 	}
 
+	/* expand if needed */
+	if (size_inc) {
+		int ret;
+
+		ret = fdt_open_into(ptr, ptr, sbuf->st_size);
+		if (ret) {
+			fprintf(stderr, "%s: Cannot expand FDT: %s\n",
+				cmdname, fdt_strerror(ret));
+			goto err;
+		}
+	}
+
 	*blobp = ptr;
 	return fd;
 
tools/fit_common.h +3 -2
index adcee6d..b8d8438 100644
@@ -21,12 +21,13 @@ int fit_check_image_types(uint8_t type);
  *
  * @cmdname:	Tool name (for displaying with error messages)
  * @fname:	Filename containing FDT
+ * @size_inc:	Amount to increase size by (0 = leave it alone)
  * @blobp:	Returns pointer to FDT blob
  * @sbuf:	File status information is stored here
  * @delete_on_error:	true to delete the file if we get an error
  * @return 0 if OK, -1 on error.
  */
-int mmap_fdt(const char *cmdname, const char *fname, void **blobp,
-	     struct stat *sbuf, bool delete_on_error);
+int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
+	     void **blobp, struct stat *sbuf, bool delete_on_error);
 
 #endif /* _FIT_COMMON_H_ */
tools/fit_image.c +68 -44

142 lines not on this page · raw message

tools/fit_info.c +1 -1
index 9442ff1..afbed7b 100644
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
 			break;
 		}
 
-	ffd = mmap_fdt(cmdname, fdtfile, &fit_blob, &fsbuf, false);
+	ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
 
 	if (ffd < 0) {
 		printf("Could not open %s\n", fdtfile);
tools/image-host.c +17 -9
index 651f1c2..2be5e80 100644
@@ -224,7 +224,9 @@ static int fit_image_process_sig(const char *keydir, void *keydest,
 	ret = fit_image_write_sig(fit, noffset, value, value_len, comment,
 			NULL, 0);
 	if (ret) {
-		printf("Can't write signature for '%s' signature node in '%s' image node: %s\n",
+		if (ret == -FDT_ERR_NOSPACE)
+			return -ENOSPC;
+		printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
 		       node_name, image_name, fdt_strerror(ret));
 		return -1;
 	}
@@ -589,10 +591,13 @@ static int fit_config_process_sig(const char *keydir, void *keydest,
 		return -1;
 	}
 
-	if (fit_image_write_sig(fit, noffset, value, value_len, comment,
-				region_prop, region_proplen)) {
-		printf("Can't write signature for '%s' signature node in '%s' conf node\n",
-		       node_name, conf_name);
+	ret = fit_image_write_sig(fit, noffset, value, value_len, comment,
+				region_prop, region_proplen);
+	if (ret) {
+		if (ret == -FDT_ERR_NOSPACE)
+			return -ENOSPC;
+		printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
+		       node_name, conf_name, fdt_strerror(ret));
 		return -1;
 	}
 	free(value);
@@ -602,10 +607,13 @@ static int fit_config_process_sig(const char *keydir, void *keydest,
 	info.keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
 
 	/* Write the public key into the supplied FDT file */
-	if (keydest && info.algo->add_verify_data(&info, keydest)) {
-		printf("Failed to add verification data for '%s' signature node in '%s' image node\n",
-		       node_name, conf_name);
-		return -1;
+	if (keydest) {
+		ret = info.algo->add_verify_data(&info, keydest);
+		if (ret) {
+			printf("Failed to add verification data for '%s' signature node in '%s' image node\n",
+			       node_name, conf_name);
+			return ret == FDT_ERR_NOSPACE ? -ENOSPC : -EIO;
+		}
 	}
 
 	return 0;
Signature · 1 line
1.9.1.423.g4596e3a
#23 lore raw

PATCH v3 10/14 mkimage: Automatically make space in FDT when full

Quoted 4 lines · Simon Glass

When adding hashes or signatures, the target FDT may be full. Detect this and automatically try again after making 1KB of space.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/330f0d7c/attachment.pgp>
#24 lore raw

PATCH v3 11/14 arm: ti: Increase malloc size to 16MB for armv7 boards

In reply to Simon Glass

The current size of 1MB is not enough use to use DFU. Increase it for ARMv7 boards, all of which should have 32MB or more SDRAM.

With this change it is possible to do 'dfu mmc 0' on a Beaglebone Black.

---

Changes in v3: None
Changes in v2: None

 include/configs/ti_armv7_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/ti_armv7_common.h +1 -1
index 4854272..b2896ff 100644
@@ -127,7 +127,7 @@
  * we are on so we do not need to rely on the command prompt.  We set a
  * console baudrate of 115200 and use the default baud rate table.
  */
-#define CONFIG_SYS_MALLOC_LEN		(1024 << 10)
+#define CONFIG_SYS_MALLOC_LEN		(16 << 20)
 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_SYS_PROMPT		"U-Boot# "
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
Signature · 1 line
1.9.1.423.g4596e3a
#25 lore raw

PATCH v3 11/14 arm: ti: Increase malloc size to 16MB for armv7 boards

Quoted 6 lines · Simon Glass

The current size of 1MB is not enough use to use DFU. Increase it for ARMv7 boards, all of which should have 32MB or more SDRAM.

With this change it is possible to do 'dfu mmc 0' on a Beaglebone Black.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/753a7cfa/attachment.pgp>
#26 lore raw

PATCH v3 12/14 am33xx/omap: Enable CONFIG_OF_CONTROL

In reply to Simon Glass

Add support for device tree control and add device tree files for the beaglebone black initially.

---

Changes in v3: None
Changes in v2:
- Move device tree files into arch/arm/dts

 arch/arm/dts/Makefile                     |   1 +
 arch/arm/dts/am335x-bone-common.dtsi      | 262 ++++++++++++
 arch/arm/dts/am335x-boneblack.dts         |  17 +
 arch/arm/dts/am33xx.dtsi                  | 649 ++++++++++++++++++++++++++++++
 arch/arm/dts/dt-bindings/gpio/gpio.h      |  15 +
 arch/arm/dts/dt-bindings/pinctrl/am33xx.h |  42 ++
 arch/arm/dts/dt-bindings/pinctrl/omap.h   |  55 +++
 arch/arm/dts/tps65217.dtsi                |  56 +++
 include/configs/am335x_evm.h              |   6 +
 9 files changed, 1103 insertions(+)
 create mode 100644 arch/arm/dts/am335x-bone-common.dtsi
 create mode 100644 arch/arm/dts/am335x-boneblack.dts
 create mode 100644 arch/arm/dts/am33xx.dtsi
 create mode 100644 arch/arm/dts/dt-bindings/gpio/gpio.h
 create mode 100644 arch/arm/dts/dt-bindings/pinctrl/am33xx.h
 create mode 100644 arch/arm/dts/dt-bindings/pinctrl/omap.h
 create mode 100644 arch/arm/dts/tps65217.dtsi
arch/arm/dts/Makefile +1 -0
index 5554615..61527a2 100644
@@ -31,6 +31,7 @@ dtb-$(CONFIG_ZYNQ) += zynq-zc702.dtb \
 	zynq-zc770-xm010.dtb \
 	zynq-zc770-xm012.dtb \
 	zynq-zc770-xm013.dtb
+dtb-$(CONFIG_AM33XX) += am335x-boneblack.dtb
 
 targets += $(dtb-y)
 
arch/arm/dts/am335x-bone-common.dtsi new file +262 -0

262 lines not on this page · raw message

arch/arm/dts/am335x-boneblack.dts new file +17 -0
new file mode 100644
index 0000000..197cadf
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "am33xx.dtsi"
+#include "am335x-bone-common.dtsi"
+
+&ldo3_reg {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-always-on;
+};
arch/arm/dts/am33xx.dtsi new file +649 -0

649 lines not on this page · raw message

arch/arm/dts/dt-bindings/gpio/gpio.h new file +15 -0
new file mode 100644
index 0000000..e6b1e0a
@@ -0,0 +1,15 @@
+/*
+ * This header provides constants for most GPIO bindings.
+ *
+ * Most GPIO bindings include a flags cell as part of the GPIO specifier.
+ * In most cases, the format of the flags cell uses the standard values
+ * defined in this header.
+ */
+
+#ifndef _DT_BINDINGS_GPIO_GPIO_H
+#define _DT_BINDINGS_GPIO_GPIO_H
+
+#define GPIO_ACTIVE_HIGH 0
+#define GPIO_ACTIVE_LOW 1
+
+#endif
arch/arm/dts/dt-bindings/pinctrl/am33xx.h new file +42 -0

42 lines not on this page · raw message

arch/arm/dts/dt-bindings/pinctrl/omap.h new file +55 -0

55 lines not on this page · raw message

arch/arm/dts/tps65217.dtsi new file +56 -0

56 lines not on this page · raw message

include/configs/am335x_evm.h +6 -0
index 762f6d2..11e7771 100644
@@ -18,6 +18,12 @@
 
 #include <configs/ti_am335x_common.h>
 
+#ifndef CONFIG_SPL_BUILD
+# define CONFIG_OF_CONTROL
+# define CONFIG_OF_SEPARATE
+# define CONFIG_DEFAULT_DEVICE_TREE am335x-boneblack
+#endif
+
 #define MACH_TYPE_TIAM335EVM		3589	/* Until the next sync */
 #define CONFIG_MACH_TYPE		MACH_TYPE_TIAM335EVM
 #define CONFIG_BOARD_LATE_INIT
Signature · 1 line
1.9.1.423.g4596e3a
#27 lore raw

PATCH v3 12/14 am33xx/omap: Enable CONFIG_OF_CONTROL

Quoted 4 lines · Simon Glass

Add support for device tree control and add device tree files for the beaglebone black initially.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/f120af7f/attachment.pgp>
#28 lore raw

PATCH v3 13/14 am33xx/omap: Enable FIT support

In reply to Simon Glass

Enable booting a FIT containing a kernel/device tree.

---

Changes in v3:
- Also enable LZO and timestamps, plus increase the maximum kernel size

Changes in v2: None

 include/configs/am335x_evm.h | 5 +++++
 1 file changed, 5 insertions(+)
include/configs/am335x_evm.h +5 -0
index 11e7771..edc5841 100644
@@ -19,11 +19,16 @@
 #include <configs/ti_am335x_common.h>
 
 #ifndef CONFIG_SPL_BUILD
+# define CONFIG_FIT
+# define CONFIG_TIMESTAMP
+# define CONFIG_LZO
 # define CONFIG_OF_CONTROL
 # define CONFIG_OF_SEPARATE
 # define CONFIG_DEFAULT_DEVICE_TREE am335x-boneblack
 #endif
 
+#define CONFIG_SYS_BOOTM_LEN		(16 << 20)
+
 #define MACH_TYPE_TIAM335EVM		3589	/* Until the next sync */
 #define CONFIG_MACH_TYPE		MACH_TYPE_TIAM335EVM
 #define CONFIG_BOARD_LATE_INIT
Signature · 1 line
1.9.1.423.g4596e3a
#29 lore raw

PATCH v3 13/14 am33xx/omap: Enable FIT support

Quoted 3 lines · Simon Glass

Enable booting a FIT containing a kernel/device tree.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/d580fd6c/attachment.pgp>
#30 lore raw

PATCH v3 14/14 am33xx/omap: Add a new board to enable verified boot

In reply to Simon Glass

Enable verified boot functionality for a new am335x_boneblack_vboot target.

---

Changes in v3:
- Use verified boot only on a new board - am335x_boneblack_vboot

Changes in v2: None

 boards.cfg                   | 1 +
 include/configs/am335x_evm.h | 4 ++++
 2 files changed, 5 insertions(+)
boards.cfg +1 -0
index b8cfead..f255ba7 100644
@@ -269,6 +269,7 @@ Active  arm         armv7          am33xx      siemens         pxm2
 Active  arm         armv7          am33xx      siemens         rut                 rut                                   -                                                                                                                                 Roger Meier <[email protected]>
 Active  arm         armv7          am33xx      silica          pengwyn             pengwyn                               -                                                                                                                                 Lothar Felten <[email protected]>
 Active  arm         armv7          am33xx      ti              am335x              am335x_boneblack                      am335x_evm:SERIAL1,CONS_INDEX=1,EMMC_BOOT                                                                                         Tom Rini <[email protected]>
+Active  arm         armv7          am33xx      ti              am335x              am335x_boneblack_vboot                am335x_evm:SERIAL1,CONS_INDEX=1,EMMC_BOOT,ENABLE_VBOOT                                                                            Tom Rini <[email protected]>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm                            am335x_evm:SERIAL1,CONS_INDEX=1,NAND                                                                                              Tom Rini <[email protected]>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_nor                        am335x_evm:SERIAL1,CONS_INDEX=1,NAND,NOR                                                                                          Tom Rini <[email protected]>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_norboot                    am335x_evm:SERIAL1,CONS_INDEX=1,NOR,NOR_BOOT                                                                                      Tom Rini <[email protected]>
include/configs/am335x_evm.h +4 -0
index edc5841..5ae8c46 100644
@@ -25,6 +25,10 @@
 # define CONFIG_OF_CONTROL
 # define CONFIG_OF_SEPARATE
 # define CONFIG_DEFAULT_DEVICE_TREE am335x-boneblack
+# ifdef CONFIG_ENABLE_VBOOT
+#  define CONFIG_FIT_SIGNATURE
+#  define CONFIG_RSA
+# endif
 #endif
 
 #define CONFIG_SYS_BOOTM_LEN		(16 << 20)
Signature · 1 line
1.9.1.423.g4596e3a
#31 lore raw

PATCH v3 14/14 am33xx/omap: Add a new board to enable verified boot

Quoted 3 lines · Simon Glass

Enable verified boot functionality for a new am335x_boneblack_vboot target.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/25085527/attachment.pgp>
#32 lore raw

v3 cover Minor improvements to secure boot and enable on beaglebone

In reply to Simon Glass
Quoted 33 lines · Simon Glass

This series fixes a few problems that have come up since the secure boot series was merged:

- A recent commit broken the assumption that u-boot.bin ends at a known address (thus making things appended to U-Boot inaccessible from the code). This is fixed for Beaglebone and a few other boards. A new test is added to the Makefile to ensure that it does not break again. All boards have been tested to make sure the problem does not appear elsewhere.

- A way is needed to provide an externally-build device tree binary for U-Boot. This allows signing to happen outside the U-Boot build system.

- The .img files generated by an OMAP build need to include the FDT if one is appended.

- Adding signatures to an FDT can cause the FDT to run out of space. The fix is to regenerate the FDT from scratch with different dtc parameters, so pretty painful. Instead, we automatically expand the FDT.

The last commit enables verified boot on a Beaglebone Black with a special configuration. Use 'am335x_boneblack_vboot' for this. This will soon disable support for legacy images.

Changes in v3:
- Add new patch to ensure the hash section is inside the image for cm_t335
- Add new patch to ensure the hash section is inside the image for mx31ads
- Rebase to master and update commit message
- Fix typo in commit message
- Add new patch to improve error handling in fit_common
- Rebase to master
- Also enable LZO and timestamps, plus increase the maximum kernel size
- Use verified boot only on a new board - am335x_boneblack_vboot

Quoted 7 lines

Changes in v2:
- Add new patch to ensure the hash section is inside the image for am335x
- Add new patch to check u-boot.bin size against symbol table
- Update to cover all omap devices
- Adjust for kbuild changes
- Fix line over 80cols
- Move device tree files into arch/arm/dts

Note that I applied this directly to master since it's largely TI boards or generic code, I hope you don't mind Albert.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140611/800f9765/attachment.pgp>