summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes-bsp/u-boot/u-boot-toradex/0001-arm-imx-add-u-boot-nand.imx-to-boot-from-NAND-withou.patch61
-rw-r--r--recipes-bsp/u-boot/u-boot-toradex_2022.07.bb24
2 files changed, 23 insertions, 62 deletions
diff --git a/recipes-bsp/u-boot/u-boot-toradex/0001-arm-imx-add-u-boot-nand.imx-to-boot-from-NAND-withou.patch b/recipes-bsp/u-boot/u-boot-toradex/0001-arm-imx-add-u-boot-nand.imx-to-boot-from-NAND-withou.patch
deleted file mode 100644
index b00ae98..0000000
--- a/recipes-bsp/u-boot/u-boot-toradex/0001-arm-imx-add-u-boot-nand.imx-to-boot-from-NAND-withou.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From c74098299453e0a7cb5b9c710a66c9d579142a0d Mon Sep 17 00:00:00 2001
-From: Luca Ceresoli <luca.ceresoli@bootlin.com>
-Date: Fri, 10 Mar 2023 11:07:52 +0100
-Subject: [PATCH] arm: imx: add u-boot-nand.imx to boot from NAND without SPL
-
-U-Boot can be booted from NAND without SPL by prepending the DCD header to
-the actual U-Boot binary. However this requires prepending 1024 bytes to
-u-boot.imx (DCD + u-boot.bin).
-
-There is already a similar target to build spl/u-boot-nand-spl.imx, add the
-same option for no-SPL boot.
-
-Tested on i.MX6ULL.
-
-The resulting layout of u-boot-nand.imx is:
-
- - Offset 0x0000 (0 KiB): padding
- - Offset 0x0400 (1 KiB): DCD header
- - Offset 0x1000 (4 KiB): u-boot.bin
-
-Upstream-Status: Backport [95942f99a7057359c07bf383214d57154e2466fe]
-Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
----
- Makefile | 3 +++
- arch/arm/mach-imx/Makefile | 6 ++++++
- 2 files changed, 9 insertions(+)
-
-diff --git a/Makefile b/Makefile
-index 98867fbe06..402adbe26c 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1562,6 +1562,9 @@ endif
- u-boot.uim: u-boot.bin FORCE
- $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
-
-+u-boot-nand.imx: u-boot.imx FORCE
-+ $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
-+
- u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE
- $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
-
-diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
-index aa0b6447f1..e9b484fa9b 100644
---- a/arch/arm/mach-imx/Makefile
-+++ b/arch/arm/mach-imx/Makefile
-@@ -132,6 +132,12 @@ u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log
- u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE
- $(call if_changed,mkimage)
-
-+quiet_cmd_u-boot-nand_imx = GEN $@
-+cmd_u-boot-nand_imx = (dd bs=1024 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@
-+
-+u-boot-nand.imx: u-boot.imx FORCE
-+ $(call if_changed,u-boot-nand_imx)
-+
- ifeq ($(CONFIG_MULTI_DTB_FIT),y)
- MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
- -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE)
---
-2.40.1
-
diff --git a/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb b/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb
index 4b9a433..6fda945 100644
--- a/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb
+++ b/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb
@@ -26,7 +26,6 @@ TDX_PATCHES = " \
file://0001-apalis-colibri_imx6-imx6ull-_imx7-update-env-memory-.patch \
file://0001-configs-colibri-imx7-Fix-bad-block-table-in-flash-co.patch \
file://0001-colibri_imx6-fix-RALAT-and-WALAT-values.patch \
- file://0001-arm-imx-add-u-boot-nand.imx-to-boot-from-NAND-withou.patch \
"
SRC_URI:append = " ${TDX_PATCHES}"
SRC_URI:append:use-nxp-bsp:colibri-imx7 = " \
@@ -37,10 +36,33 @@ inherit toradex-u-boot-localversion
UBOOT_INITIAL_ENV = "u-boot-initial-env"
+PADDING_DIR = "${B}"
+nand_padding () {
+ # pad the end of U-Boot with 0x00 up to the the end of the CSF area
+ #PAD_END=$(echo -n "0x"; od -X -j 0x24 -N 4 u-boot.imx | sed -e '/................/!d' -e 's/........\(.*\)/\1/')
+ #PAD_END=$(( $PAD_END - 0x400 ))
+ #objcopy -I binary -O binary --pad-to $PAD_END u-boot.imx u-boot.imx.zero-padded
+ # assume that the above never need more than 10k of padding and skip the
+ # shell magic to get a correct size.
+ dd bs=10k count=1 if=/dev/zero | cat ${PADDING_DIR}/u-boot.imx - > ${PADDING_DIR}/u-boot.imx.zero-padded
+
+ # U-Boot is flashed 1k into a NAND block, create a binary which prepends
+ # U-boot with 1k of zeros to ease flashing
+ dd bs=1024 count=1 if=/dev/zero | cat - ${PADDING_DIR}/u-boot.imx.zero-padded > ${PADDING_DIR}/u-boot-nand.imx
+}
+
# build imx-boot from within U-Boot
inherit ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '1', 'imx-boot-container', '')}
DEPENDS:imx-boot-container += "bc-native bison-native dtc-native python3-setuptools-native swig-native"
+do_compile:append:colibri-imx6ull () {
+ nand_padding
+}
+
+do_compile:append:colibri-imx7 () {
+ nand_padding
+}
+
BOOT_TOOLS = "imx-boot-tools"
do_deploy:append:mx8m-generic-bsp() {
# Deploy u-boot-nodtb.bin and fsl-imx8m*-XX.dtb for mkimage to generate boot binary