Skip to contentSkip to conversation

Initial support for NXP iMX8 (imx8mq-evk)

PATCH Superseded Erik Larsson 3 participants 17 messages Mar 10, 2018 – Apr 11, 2018 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

v6 cover Initial support for NXP iMX8 (imx8mq-evk)

This series provides initial support for NXP iMX8 (imx8mq-evk).

This series of patches are tested against NXP imx8mq-evk. It only handles basic support for iIMX8M, currently no support for GPU, VPU and other HW features. This series makes it possible to build a minimal system for imx8mq-evk.

Changes since v5
================
- Switch to letting post-image.sh generate imx-boot-imx8mqevk-sd.bin instead of letting imx-mkimage do that.

Changes since v4
================
- Build kernel, u-boot, atf from tag rel_imx_4.9.51_8mq_beta_patch.
- Add board readme.txt.
- Update imx-mkimage package to use host mkimage

Changes since v3
================
- Use Buildroot toolchain instead of external Linareo toolchain.
- Changed title on patch number 2

Changes since v2
================
- Build kernel, u-boot, atf based on tags instead of branches.
- Make sure to assign BR2_PACKAGE_FREESCALE_IMX_PLATFORM to IMX8M.
- Remove kernel defconfig from board folder and use arch default in kernel tree.
- Split third commit into two commits.

Changes since v1
================
- Removed new imx-atf package, use boot/arm-trusted-firmware.
- Move imx-mkimage from package/freescale-imx to package.
- Add upstream URL for imx-mkimage in Config.in.host.
- Fix install command syntax for imx-mkimage package.
- Use Makefile in imx-mkimage to build imx-boot-imx8mqevk-sd.bin instead of doing that in the post-script.sh
- Split third commit into two, one for firmware-img package and one for iMX8 board.

Erik Larsson (4):
imx-mkimage: new package
freescale-imx: add config option for i.MX8M
firmware-imx: add support for iMX8M firmware configs/freescale_imx8mqevk: new defconfig

 .../common/imx/genimage.cfg.template_imx8          | 40 +++++++++++
 board/freescale/common/imx/post-image.sh           | 28 +++++++-
 board/freescale/imx8mqevk/readme.txt               | 83 ++++++++++++++++++++++
 configs/freescale_imx8mqevk_defconfig              | 41 +++++++++++
 package/Config.in.host                             |  1 +
 package/freescale-imx/Config.in                    |  5 +-
 package/freescale-imx/firmware-imx/Config.in       |  2 +-
 package/freescale-imx/firmware-imx/firmware-imx.mk | 13 ++++
 ...-for-overriding-bl32-and-bl33-not-only-bl.patch | 58 +++++++++++++++
 .../0002-add-ldflags-to-link-step.patch            | 26 +++++++
 package/imx-mkimage/Config.in.host                 |  7 ++
 package/imx-mkimage/imx-mkimage.hash               |  3 +
 package/imx-mkimage/imx-mkimage.mk                 | 24 +++++++
 13 files changed, 326 insertions(+), 5 deletions(-)
 create mode 100644 board/freescale/common/imx/genimage.cfg.template_imx8
 create mode 100644 board/freescale/imx8mqevk/readme.txt
 create mode 100644 configs/freescale_imx8mqevk_defconfig
 create mode 100644 package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch
 create mode 100644 package/imx-mkimage/0002-add-ldflags-to-link-step.patch
 create mode 100644 package/imx-mkimage/Config.in.host
 create mode 100644 package/imx-mkimage/imx-mkimage.hash
 create mode 100644 package/imx-mkimage/imx-mkimage.mk
Signature · 1 line
2.7.4
#1 lore raw

PATCH v6 1/4 imx-mkimage: new package

This package add support for imx-mkimage for iMX8M. Currently the only hardware it's tested for.

---
v6: Moved back to version v1 where imx-mkimage only build mkimage_imx8
and copy it together with mkimage_fit_atf.sh into host binaries.
(suggested by Thomas P.)
v5: Build with HDMI support
Add patch to use host mkimage instead of ./mkimage_uboot in soc.mk
Add host dependencies to dtc package
Add host configuration options in build
Add patch to make use of LDFLAGS in soc.mk (fixes build error with libz)
v4: No changes
v3: Use BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME in U-Boot so we don't
need to copy u-boot.bin to u-boot-nodtb.bin (suggested by Baruch)
Update license to GPL-2.0+ (suggested by Marcus F.)
v2: Moved package from package/freescale-imx to package (suggested by Thomas P.)
Add upstread URL in Config.in (suggested by Thomas P.)
Fix install syntax in imx-mkimage.mk (suggested by Thomas P.)
Use Makefile in imx-mkimage to build imx-boot-imx8mqevk-sd.bin instead of doing that in the post-script.sh (suggested Baruch)

---
 package/Config.in.host                             |  1 +
 ...-for-overriding-bl32-and-bl33-not-only-bl.patch | 58 ++++++++++++++++++++++
 .../0002-add-ldflags-to-link-step.patch            | 26 ++++++++++
 package/imx-mkimage/Config.in.host                 |  7 +++
 package/imx-mkimage/imx-mkimage.hash               |  3 ++
 package/imx-mkimage/imx-mkimage.mk                 | 24 +++++++++
 6 files changed, 119 insertions(+)
 create mode 100644 package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch
 create mode 100644 package/imx-mkimage/0002-add-ldflags-to-link-step.patch
 create mode 100644 package/imx-mkimage/Config.in.host
 create mode 100644 package/imx-mkimage/imx-mkimage.hash
 create mode 100644 package/imx-mkimage/imx-mkimage.mk
package/Config.in.host +1 -0
index 199a8e9..06ef5cb 100644
@@ -24,6 +24,7 @@ menu "Host utilities"
 	source "package/go-bootstrap/Config.in.host"
 	source "package/google-breakpad/Config.in.host"
 	source "package/gptfdisk/Config.in.host"
+	source "package/imx-mkimage/Config.in.host"
 	source "package/imx-usb-loader/Config.in.host"
 	source "package/jq/Config.in.host"
 	source "package/jsmin/Config.in.host"
package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch new file +58 -0

58 lines not on this page · raw message

package/imx-mkimage/0002-add-ldflags-to-link-step.patch new file +26 -0
new file mode 100644
index 0000000..22c6a7d
@@ -0,0 +1,26 @@
+From a73f20fbe921c7ecff3efda23bc506fdd935ee4d Mon Sep 17 00:00:00 2001
+From: Erik Larsson <[email protected]>
+Date: Tue, 6 Mar 2018 12:28:39 +0100
+Subject: [PATCH 1/2] Add LDFLAGS to link step
+
+Signed-off-by: Erik Larsson <[email protected]>
+---
+ iMX8M/soc.mak | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/iMX8M/soc.mak b/iMX8M/soc.mak
+index 8346769..38a14bb 100644
+--- a/iMX8M/soc.mak
++++ b/iMX8M/soc.mak
+@@ -15,7 +15,7 @@ FW_DIR = imx-boot/imx-boot-tools/imx8mq
+ 
+ $(MKIMG): mkimage_imx8.c
+ 	@echo "Compiling mkimage_imx8"
+-	$(CC) $(CFLAGS) mkimage_imx8.c -o $(MKIMG) -lz
++	$(CC) $(CFLAGS) mkimage_imx8.c -o $(MKIMG) $(LDFLAGS) -lz
+ 
+ $(DCD_CFG): $(DCD_CFG_SRC)
+ 	@echo "Converting iMX8M DCD file" 
+-- 
+2.7.4
+
package/imx-mkimage/Config.in.host new file +7 -0
new file mode 100644
index 0000000..8d27355
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_IMX_MKIMAGE
+	bool "host imx-mkimage"
+	help
+	  imx-mkimage is used to combine input images and generate
+	  final boot image with appropriate IVT set.
+
+	  https://source.codeaurora.org/external/imx/imx-mkimage
package/imx-mkimage/imx-mkimage.hash new file +3 -0
new file mode 100644
index 0000000..08d31ce
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 4ddb144520001c33baa24493f68ef2ea9434ac36bf3ae223f78d7ec581aa484c  imx-mkimage-imx_4.9.51_imx8m_beta.tar.gz
+sha256 231f7edcc7352d7734a96eef0b8030f77982678c516876fcb81e25b32d68564c  iMX8dv/COPYING
package/imx-mkimage/imx-mkimage.mk new file +24 -0
new file mode 100644
index 0000000..b60fea6
@@ -0,0 +1,24 @@
+################################################################################
+#
+# imx-mkimage
+#
+################################################################################
+
+IMX_MKIMAGE_VERSION = imx_4.9.51_imx8m_beta
+IMX_MKIMAGE_SITE = https://source.codeaurora.org/external/imx/imx-mkimage
+IMX_MKIMAGE_SITE_METHOD = git
+IMX_MKIMAGE_LICENSE = GPL-2.0+
+IMX_MKIMAGE_LICENSE_FILES = iMX8dv/COPYING
+
+define HOST_IMX_MKIMAGE_BUILD_CMDS
+	# Currently this only supports iMX8M. When more hardware is available
+	# this needs to be selectable based on iMX8-version (iMX8M,iMXQ etc).
+	$(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D)/iMX8M -f soc.mak mkimage_imx8
+endef
+
+define HOST_IMX_MKIMAGE_INSTALL_CMDS
+	$(INSTALL) -D -m 755 $(@D)/iMX8M/mkimage_imx8 $(HOST_DIR)/bin
+	$(INSTALL) -D -m 755 $(@D)/iMX8M/mkimage_fit_atf.sh $(HOST_DIR)/bin
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.7.4
#2 lore raw

PATCH v6 1/4 imx-mkimage: new package

Hello,

Again, thanks for this contribution!

Quoted 5 lines · Erik Larsson

This package add support for imx-mkimage for iMX8M. Currently the only hardware it's tested for.

Thanks, I've applied to master, after doing a few changes. I also have one request. See below.

Quoted 7 lines
 package/Config.in.host                             |  1 +
 ...-for-overriding-bl32-and-bl33-not-only-bl.patch | 58 ++++++++++++++++++++++
 .../0002-add-ldflags-to-link-step.patch            | 26 ++++++++++
 package/imx-mkimage/Config.in.host                 |  7 +++
 package/imx-mkimage/imx-mkimage.hash               |  3 ++
 package/imx-mkimage/imx-mkimage.mk                 | 24 +++++++++
 6 files changed, 119 insertions(+)

You forgot to add an entry in the DEVELOPERS file for this new package, so I've done so.

package/imx-mkimage/0002-add-ldflags-to-link-step.patch line 6

Quoted 12 lines
package/imx-mkimage/0002-add-ldflags-to-link-step.patch new file +6 -0
new file mode 100644
index 0000000..22c6a7d
@@ -0,0 +1,26 @@
+From a73f20fbe921c7ecff3efda23bc506fdd935ee4d Mon Sep 17 00:00:00 2001
+From: Erik Larsson <[email protected]>
+Date: Tue, 6 Mar 2018 12:28:39 +0100
+Subject: [PATCH 1/2] Add LDFLAGS to link step
+
+Signed-off-by: Erik Larsson <[email protected]>

This commit log really needs to be extended. What was the need to add LDFLAGS ? It seems like a very simple program, which could be built without special LDFLAGS. What was the issue that lead you to add this patch ?

package/imx-mkimage/0002-add-ldflags-to-link-step.patch line 9

Quoted 3 lines
package/imx-mkimage/0002-add-ldflags-to-link-step.patch new file +3 -0
+define HOST_IMX_MKIMAGE_INSTALL_CMDS
+	$(INSTALL) -D -m 755 $(@D)/iMX8M/mkimage_imx8 $(HOST_DIR)/bin
+	$(INSTALL) -D -m 755 $(@D)/iMX8M/mkimage_fit_atf.sh $(HOST_DIR)/bin

We prefer a complete destination path that includes the name of the file to install. Indeed, with the way you have written the commands, if $(HOST_DIR)/bin doesn't exist as a directory, mkimage_imx8 will be installed as a file called "bin" in $(HOST_DIR). I've also fixed this when applying.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v6 1/4 imx-mkimage: new package

Hi!

2018-04-09 22:07 GMT+02:00 Thomas Petazzoni <[email protected]>:

Quoted 35 lines

Hello,

Again, thanks for this contribution!

Quoted 5 lines · Erik Larsson

This package add support for imx-mkimage for iMX8M. Currently the only hardware it's tested for.

Thanks, I've applied to master, after doing a few changes. I also have one request. See below.

Quoted 7 lines
 package/Config.in.host                             |  1 +
 ...-for-overriding-bl32-and-bl33-not-only-bl.patch | 58 ++++++++++++++++++++++
 .../0002-add-ldflags-to-link-step.patch            | 26 ++++++++++
 package/imx-mkimage/Config.in.host                 |  7 +++
 package/imx-mkimage/imx-mkimage.hash               |  3 ++
 package/imx-mkimage/imx-mkimage.mk                 | 24 +++++++++
 6 files changed, 119 insertions(+)

You forgot to add an entry in the DEVELOPERS file for this new package, so I've done so.

Quoted 9 lines
package/imx-mkimage/0002-add-ldflags-to-link-step.patch new file +3 -0
new file mode 100644
index 0000000..22c6a7d
@@ -0,0 +1,26 @@
+From a73f20fbe921c7ecff3efda23bc506fdd935ee4d Mon Sep 17 00:00:00 2001
+From: Erik Larsson <[email protected]>
+Date: Tue, 6 Mar 2018 12:28:39 +0100
Quoted 8 lines

package/imx-mkimage/0002-add-ldflags-to-link-step.patch line 6

Quoted 3 lines
package/imx-mkimage/0002-add-ldflags-to-link-step.patch new file +3 -0
+Subject: [PATCH 1/2] Add LDFLAGS to link step
+
+Signed-off-by: Erik Larsson <[email protected]>

This commit log really needs to be extended. What was the need to add LDFLAGS ? It seems like a very simple program, which could be built without special LDFLAGS. What was the issue that lead you to add this patch ?

If LDFLAGS is not added it will use the host machine libz, and fail if not available, but by adding LDFLAGS it will build using Buildroot compiled libz. Do you want me to update the patch information in a new patch?

Quoted 12 lines

package/imx-mkimage/0002-add-ldflags-to-link-step.patch line 9

Quoted 5 lines
package/imx-mkimage/0002-add-ldflags-to-link-step.patch new file +3 -0
+define HOST_IMX_MKIMAGE_INSTALL_CMDS
+     $(INSTALL) -D -m 755 $(@D)/iMX8M/mkimage_imx8 $(HOST_DIR)/bin
+     $(INSTALL) -D -m 755 $(@D)/iMX8M/mkimage_fit_atf.sh $(HOST_DIR)/bin

We prefer a complete destination path that includes the name of the file to install. Indeed, with the way you have written the commands, if $(HOST_DIR)/bin doesn't exist as a directory, mkimage_imx8 will be installed as a file called "bin" in $(HOST_DIR). I've also fixed this when applying.

Quoted 7 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

/Erik

#4 lore raw

PATCH v6 1/4 imx-mkimage: new package

Hello,

Quoted 8 lines · Erik Larsson
Quoted 4 lines

This commit log really needs to be extended. What was the need to add LDFLAGS ? It seems like a very simple program, which could be built without special LDFLAGS. What was the issue that lead you to add this patch ?

If LDFLAGS is not added it will use the host machine libz, and fail if not available, but by adding LDFLAGS it will build using Buildroot compiled libz.

Hum, indeed, we're building a host package here, so we need to explicitly pass -L$(HOST_DIR)/lib, otherwise we link against the system-provided libraries.

Quoted 1 line

Do you want me to update the patch information in a new patch?

Yes, that would be nice. Thanks!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH v6 2/4 freescale-imx: add config option for i.MX8M

In reply to Erik Larsson

---
v6: No changes
v5: No changes
v4: Changed title on commit (suggested by Gary B.)

---
 package/freescale-imx/Config.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/freescale-imx/Config.in +4 -1
index b5e5ab2..fe993f3 100644
@@ -1,6 +1,6 @@
 menuconfig BR2_PACKAGE_FREESCALE_IMX
 	bool "Freescale i.MX libraries"
-	depends on BR2_arm
+	depends on BR2_arm || BR2_aarch64
 	help
 	  Those packages provide hardware acceleration for GPU or VPU,
 	  hardware optimization or some hardware tools for Freescale
@@ -40,6 +40,8 @@ config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6UL
 config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX7
 	bool "imx7d/imx7ulp"
 
+config BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
+	bool "imx8m"
 endchoice
 
 config BR2_PACKAGE_FREESCALE_IMX_PLATFORM
@@ -54,6 +56,7 @@ config BR2_PACKAGE_FREESCALE_IMX_PLATFORM
 	default "IMX6S" if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6S
 	default "IMX6UL" if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6UL
 	default "IMX7" if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX7
+	default "IMX8" if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
 
 config BR2_PACKAGE_FREESCALE_IMX_HAS_VPU
 	bool
Signature · 1 line
2.7.4
#6 lore raw

PATCH v6 2/4 freescale-imx: add config option for i.MX8M

Hello,

Quoted 9 lines · Erik Larsson

---
v6: No changes
v5: No changes
v4: Changed title on commit (suggested by Gary B.)

---
 package/freescale-imx/Config.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH v6 3/4 firmware-imx: add support for iMX8M firmware

In reply to Erik Larsson

---
v6: Build padded versions of lpddr4_pmu_*. This done here because we need to use
objcopy which is not availtable during post-image-script.
v5: No change
v4: No change
v3: Split v2 commit into two commits (suggested by Garry B.)
v2: Split v1 commit into two commits (suggested by Baruch)

---
 package/freescale-imx/firmware-imx/Config.in       |  2 +-
 package/freescale-imx/firmware-imx/firmware-imx.mk | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
package/freescale-imx/firmware-imx/Config.in +1 -1
index fca280a..56d5b80 100644
@@ -1,6 +1,6 @@
 config BR2_PACKAGE_FIRMWARE_IMX
 	bool "firmware-imx"
-	depends on BR2_arm # Only relevant for i.MX
+	depends on BR2_arm || BR2_aarch64 # Only relevant for i.MX
 	help
 	  Firmware blobs for the Freescale i.MX SoCs.
 
package/freescale-imx/firmware-imx/firmware-imx.mk +13 -0
index 630afca..ff8ca01 100644
@@ -18,6 +18,18 @@ define FIRMWARE_IMX_EXTRACT_CMDS
 	$(call FREESCALE_IMX_EXTRACT_HELPER,$(DL_DIR)/$(FIRMWARE_IMX_SOURCE))
 endef
 
+ifeq ($(BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M),y)
+FIRMWARE_IMX_INSTALL_IMAGES = YES
+define FIRMWARE_IMX_INSTALL_IMAGES_CMDS
+	# Create padded versions of lpddr4_pmu_*, needed for generating imx-boot-imx8mqevk-sd.bin
+	# which is done in post-image script.
+	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_imem_pad.bin
+	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_dmem_pad.bin
+	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_imem_pad.bin
+	cp $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_*.bin $(BINARIES_DIR)
+	cp $(@D)/firmware/hdmi/cadence/signed_hdmi_imx8m.bin $(BINARIES_DIR)
+endef
+else
 define FIRMWARE_IMX_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/lib/firmware/imx
 	for blobdir in $(FIRMWARE_IMX_BLOBS); do \
@@ -27,5 +39,6 @@ define FIRMWARE_IMX_INSTALL_TARGET_CMDS
 	mv $(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw.nonrestricted \
 		$(TARGET_DIR)/lib/firmware/imx/epdc/epdc_ED060XH2C1.fw
 endef
+endif
 
 $(eval $(generic-package))
Signature · 1 line
2.7.4
#8 lore raw

PATCH v6 3/4 firmware-imx: add support for iMX8M firmware

Hello,

package/freescale-imx/firmware-imx/firmware-imx.mk define FIRMWARE_IMX_EXTRACT_CMDS · line 28

Quoted 8 lines · Erik Larsson
package/freescale-imx/firmware-imx/firmware-imx.mk +8 -0
+ifeq ($(BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M),y)
+FIRMWARE_IMX_INSTALL_IMAGES = YES
+define FIRMWARE_IMX_INSTALL_IMAGES_CMDS
+	# Create padded versions of lpddr4_pmu_*, needed for generating imx-boot-imx8mqevk-sd.bin
+	# which is done in post-image script.
+	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_imem_pad.bin
+	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_dmem_pad.bin
+	$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_imem_pad.bin

I'm a bit unhappy with the division of work between this .mk file and the post-image script. Why are you doing the padding here, and then the concatenation in the post-image script?

I think it should be done in just one place. Perhaps this package is the most logical location. Also, use $(...) instead of ${...} in shell to refer to variables.

So, perhaps:

define FIRMWARE_IMX_PREPARE_LPDDR4_FW

	(cd $(@D)/firmware/ddr/synopsys/ && \
		$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 \
			lpddr4_pmu_train_$(1)_imem.bin \
			lpddr4_pmu_train_$(1)_imem_pad.bin
		$(TARGET_OBJCOPY) -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 \
			lpddr4_pmu_train_$(1)_dmem.bin \
			lpddr4_pmu_train_$(1)_dmem_pad.bin
		cat lpddr4_pmu_train_$(1)_imem_pad.bin lpddr4_pmu_train_$(1)_dmem_pad.bin > \
			lpddr4_pmu_train_$(1)_fw.bin
	)

endef

define FIRMWARE_IMX_INSTALL_IMAGES_CMDS

	$(call FIRMWARE_IMX_PREPARE_LPDDR4_FW,1d)
	$(call FIRMWARE_IMX_PREPARE_LPDDR4_FW,2d)
	cat $(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_1d_fw.bin \
		$(@D)/firmware/ddr/synopsys/lpddr4_pmu_train_2d_fw.bin > \
		$(BINARIES_DIR)/lpddr4_pmu_train_fw.bin
	...

endef

And then the post-image script can use
$(BINARIES_DIR)/lpddr4_pmu_train_fw.bin.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

In reply to Erik Larsson

---
v6: Generate imx-boot-imx8mqevk-sd.bin in post-image.sh using tools built
with package imx-mkimage. (suggested by Thomas P.)
Fix minor type in readme.txt (suggested by Fabio E.)
Add BR2_TARGET_UBOOT_NEEDS_DTC to defconfig
v5: Added readme.txt in board/freescale/imx8mqevk (suggested by Fabio E.)
Change version tags to rel_imx_4.9.51_8mq_beta_patch
for kernel, u-boot and atf (suggested by Baruch S.)
Remove generation of rootfs.tar
v4: Change to Buildroot toolchain from external toolchain
v3: Change commit message (suggested by Thomas P.)
Make sure to use tags instead of branches in kernel,bootloader and ATF repositorires (Arnout V.) Use BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG instead of copy kernel defconfig to board folder (suggested by Arnout V.) Split v2 commit into two commits

---
 .../common/imx/genimage.cfg.template_imx8          | 40 +++++++++++
 board/freescale/common/imx/post-image.sh           | 28 +++++++-
 board/freescale/imx8mqevk/readme.txt               | 83 ++++++++++++++++++++++
 configs/freescale_imx8mqevk_defconfig              | 41 +++++++++++
 4 files changed, 189 insertions(+), 3 deletions(-)
 create mode 100644 board/freescale/common/imx/genimage.cfg.template_imx8
 create mode 100644 board/freescale/imx8mqevk/readme.txt
 create mode 100644 configs/freescale_imx8mqevk_defconfig
board/freescale/common/imx/genimage.cfg.template_imx8 new file +40 -0
new file mode 100644
index 0000000..138beff
@@ -0,0 +1,40 @@
+# Minimal SD card image for the Freescale boards Template for SPL Boot
+#
+# We mimic the .sdcard Freescale's image format:
+# * the SD card must have 33 kB free space at the beginning,
+# * U-Boot is integrated into imx-boot-imx8mqevk-sd.bin and is dumped as is,
+# * a FAT partition at offset 64MB is containing Image and DTB files
+# * a single root filesystem partition is required (ext2, ext3 or ext4)
+#
+
+image boot.vfat {
+  vfat {
+    files = {
+      %FILES%
+    }
+  }
+  size = 64M
+}
+
+image sdcard.img {
+  hdimage {
+  }
+
+  partition imx-boot {
+    in-partition-table = "no"
+    image = "imx-boot-imx8mqevk-sd.bin"
+    offset = 33K
+  }
+
+  partition boot {
+    partition-type = 0xC
+    bootable = "true"
+    image = "boot.vfat"
+    offset = 8M
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+  }
+}
board/freescale/common/imx/post-image.sh +25 -3
index b239743..4c77ae2 100755
@@ -7,10 +7,10 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
 	for dt in $DTB_LIST; do
-		echo -n "\"$dt.dtb\", "
+		echo -n "\"`basename $dt`.dtb\", "
 	done
 }
 
@@ -23,6 +23,8 @@ linux_image()
 {
 	if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
 		echo "\"uImage\""
+	elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
+		echo "\"Image\""
 	else
 		echo "\"zImage\""
 	fi
@@ -30,19 +32,39 @@ linux_image()
 
 genimage_type()
 {
-	if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
+	if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+		echo "genimage.cfg.template_imx8"
+	elif grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
 		echo "genimage.cfg.template_spl"
 	else
 		echo "genimage.cfg.template"
 	fi
 }
 
+gen_imx8_boot()
+{
+	cat ${BINARIES_DIR}/lpddr4_pmu_train_1d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_dmem_pad.bin > ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin
+	cat ${BINARIES_DIR}/lpddr4_pmu_train_2d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_dmem.bin > ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+	cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
+	rm -f ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+
+	BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${BINARIES_DIR}/fsl-imx8mq-evk.dtb > ${BINARIES_DIR}/u-boot.its
+	${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
+	rm -f ${BINARIES_DIR}/u-boot.its
+
+	${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx-boot-imx8mqevk-sd.bin
+}
+
 main()
 {
 	local FILES="$(dtb_list) $(linux_image)"
 	local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
 	local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
 
+	if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+		gen_imx8_boot
+	fi
+
 	sed -e "s/%FILES%/${FILES}/" \
 		board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}
 
board/freescale/imx8mqevk/readme.txt new file +83 -0

83 lines not on this page · raw message

configs/freescale_imx8mqevk_defconfig new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.7.4
#10 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

Hello Erik,

Quoted 18 lines · Erik Larsson
board/freescale/common/imx/post-image.sh +2 -2
index b239743..4c77ae2 100755
@@ -7,10 +7,10 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
 	for dt in $DTB_LIST; do
-		echo -n "\"$dt.dtb\", "
+		echo -n "\"`basename $dt`.dtb\", "
 	done
 }
 

board/freescale/common/imx/post-image.sh linux_image() · line 30

Quoted 8 lines
board/freescale/common/imx/post-image.sh +2 -0
@@ -23,6 +23,8 @@ linux_image()
 {
 	if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
 		echo "\"uImage\""
+	elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
+		echo "\"Image\""
 	else
 		echo "\"zImage\""
 	fi

Those two changes could be in a patch reworking post-image.sh to be compatible with arm64.

Quoted 17 lines
board/freescale/common/imx/post-image.sh +6 -1
@@ -30,19 +32,39 @@ linux_image()
 
 genimage_type()
 {
-	if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
+	if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+		echo "genimage.cfg.template_imx8"
+	elif grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
 		echo "genimage.cfg.template_spl"
 	else
 		echo "genimage.cfg.template"
 	fi
 }
 
+gen_imx8_boot()
+{
+	cat ${BINARIES_DIR}/lpddr4_pmu_train_1d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_dmem_pad.bin > ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin

board/freescale/common/imx/post-image.sh linux_image() · line 56

Quoted 10 lines
board/freescale/common/imx/post-image.sh +10 -0
+	cat ${BINARIES_DIR}/lpddr4_pmu_train_2d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_dmem.bin > ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+	cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
+	rm -f ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+
+	BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${BINARIES_DIR}/fsl-imx8mq-evk.dtb > ${BINARIES_DIR}/u-boot.its
+	${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
+	rm -f ${BINARIES_DIR}/u-boot.its
+
+	${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx-boot-imx8mqevk-sd.bin
+}

Shouldn't this logic be moved to a specialized post-image script ? And then you do:

BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"

or something like that ? Fabio, what do you think ?

Also, could you split the i.MX8 stuff from the support of the i.MX8 EVK board itself ?

I.e adding the genimage.cfg file, and adding imx8-bootloader.prepare.sh should be one patch, and then adding the i.MX8 EVK defconfig and readme.txt should be another patch.

Could you rework the last two patches according to those comments ?

Thanks a lot!

Thomas Petazzoni

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
reviewer
#11 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

Hi Thomas,

Quoted 6 lines · Thomas Petazzoni

Shouldn't this logic be moved to a specialized post-image script ? And then you do:

BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"

or something like that ? Fabio, what do you think ?

Looks good, thanks.

#12 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

In reply to Thomas Petazzoni

Hi

2018-04-09 22:42 GMT+02:00 Thomas Petazzoni <[email protected]>:

Quoted 69 lines

Hello Erik,

Quoted 18 lines · Erik Larsson
board/freescale/common/imx/post-image.sh +2 -2
index b239743..4c77ae2 100755
@@ -7,10 +7,10 @@
 #
 dtb_list()
 {
-     local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+     local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
      for dt in $DTB_LIST; do
-             echo -n "\"$dt.dtb\", "
+             echo -n "\"`basename $dt`.dtb\", "
      done
 }
 

board/freescale/common/imx/post-image.sh linux_image() · line 30

Quoted 8 lines
board/freescale/common/imx/post-image.sh +2 -0
@@ -23,6 +23,8 @@ linux_image()
 {
      if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
              echo "\"uImage\""
+     elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
+             echo "\"Image\""
      else
              echo "\"zImage\""
      fi

Those two changes could be in a patch reworking post-image.sh to be compatible with arm64.

Quoted 17 lines
board/freescale/common/imx/post-image.sh +6 -1
@@ -30,19 +32,39 @@ linux_image()
 
 genimage_type()
 {
-     if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
+     if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+             echo "genimage.cfg.template_imx8"
+     elif grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
              echo "genimage.cfg.template_spl"
      else
              echo "genimage.cfg.template"
      fi
 }
 
+gen_imx8_boot()
+{
+     cat ${BINARIES_DIR}/lpddr4_pmu_train_1d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_dmem_pad.bin > ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin

board/freescale/common/imx/post-image.sh linux_image() · line 56

Quoted 10 lines
board/freescale/common/imx/post-image.sh +10 -0
+     cat ${BINARIES_DIR}/lpddr4_pmu_train_2d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_dmem.bin > ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+     cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
+     rm -f ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+
+     BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${BINARIES_DIR}/fsl-imx8mq-evk.dtb > ${BINARIES_DIR}/u-boot.its
+     ${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
+     rm -f ${BINARIES_DIR}/u-boot.its
+
+     ${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx-boot-imx8mqevk-sd.bin
+}

Shouldn't this logic be moved to a specialized post-image script ? And then you do:

BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"

or something like that ? Fabio, what do you think ?

Quoted 7 lines

Also, could you split the i.MX8 stuff from the support of the i.MX8 EVK board itself ?

I.e adding the genimage.cfg file, and adding imx8-bootloader.prepare.sh should be one patch, and then adding the i.MX8 EVK defconfig and readme.txt should be another patch.

Could you rework the last two patches according to those comments ?

Yes, I'll do! Thanks for all the support and feedback!

Quoted 8 lines

Thanks a lot!

Thomas Petazzoni
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

/Erik

#13 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

In reply to Thomas Petazzoni

Hi,

2018-04-09 22:42 GMT+02:00 Thomas Petazzoni <[email protected]>:

Quoted 69 lines

Hello Erik,

Quoted 18 lines · Erik Larsson
board/freescale/common/imx/post-image.sh +2 -2
index b239743..4c77ae2 100755
@@ -7,10 +7,10 @@
 #
 dtb_list()
 {
-     local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+     local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
      for dt in $DTB_LIST; do
-             echo -n "\"$dt.dtb\", "
+             echo -n "\"`basename $dt`.dtb\", "
      done
 }
 

board/freescale/common/imx/post-image.sh linux_image() · line 30

Quoted 8 lines
board/freescale/common/imx/post-image.sh +2 -0
@@ -23,6 +23,8 @@ linux_image()
 {
      if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
              echo "\"uImage\""
+     elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
+             echo "\"Image\""
      else
              echo "\"zImage\""
      fi

Those two changes could be in a patch reworking post-image.sh to be compatible with arm64.

Quoted 17 lines
board/freescale/common/imx/post-image.sh +6 -1
@@ -30,19 +32,39 @@ linux_image()
 
 genimage_type()
 {
-     if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
+     if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+             echo "genimage.cfg.template_imx8"
+     elif grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
              echo "genimage.cfg.template_spl"
      else
              echo "genimage.cfg.template"
      fi
 }
 
+gen_imx8_boot()
+{
+     cat ${BINARIES_DIR}/lpddr4_pmu_train_1d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_dmem_pad.bin > ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin

board/freescale/common/imx/post-image.sh linux_image() · line 56

Quoted 10 lines
board/freescale/common/imx/post-image.sh +10 -0
+     cat ${BINARIES_DIR}/lpddr4_pmu_train_2d_imem_pad.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_dmem.bin > ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+     cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
+     rm -f ${BINARIES_DIR}/lpddr4_pmu_train_1d_fw.bin ${BINARIES_DIR}/lpddr4_pmu_train_2d_fw.bin
+
+     BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ${HOST_DIR}/bin/mkimage_fit_atf.sh ${BINARIES_DIR}/fsl-imx8mq-evk.dtb > ${BINARIES_DIR}/u-boot.its
+     ${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
+     rm -f ${BINARIES_DIR}/u-boot.its
+
+     ${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx-boot-imx8mqevk-sd.bin
+}

Shouldn't this logic be moved to a specialized post-image script ? And then you do:

BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"

or something like that ? Fabio, what do you think ?

Quoted 7 lines

Also, could you split the i.MX8 stuff from the support of the i.MX8 EVK board itself ?

I.e adding the genimage.cfg file, and adding imx8-bootloader.prepare.sh should be one patch, and then adding the i.MX8 EVK defconfig and readme.txt should be another patch.

Could you rework the last two patches according to those comments ?

I've started to rework this and have something that at least works. I've moved the generation of imx-boot-imx8mqevk-sd.bin to a separate prepare script and tried to separate what is iMX8 general and what is imx8mqevk specific in that script. So the gen_imx8_boot() function can be removed from post-script.sh. I still need to keep the selection of genimage.cfg.template in post-script.sh but instead of checking for IMX8M it can check if it's a IMX8 platform. Is it something like that you hade in mind?

Quoted 8 lines

Thanks a lot!

Thomas Petazzoni
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

/Erik

#14 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

Hello,

Quoted 8 lines · Erik Larsson
Quoted 7 lines

Also, could you split the i.MX8 stuff from the support of the i.MX8 EVK board itself ?

I.e adding the genimage.cfg file, and adding imx8-bootloader.prepare.sh should be one patch, and then adding the i.MX8 EVK defconfig and readme.txt should be another patch.

Could you rework the last two patches according to those comments ?

Quoted 8 lines

I've started to rework this and have something that at least works. I've moved the generation of imx-boot-imx8mqevk-sd.bin to a separate prepare script and tried to separate what is iMX8 general and what is imx8mqevk specific in that script. So the gen_imx8_boot() function can be removed from post-script.sh. I still need to keep the selection of genimage.cfg.template in post-script.sh but instead of checking for IMX8M it can check if it's a IMX8 platform. Is it something like that you hade in mind?

How are you going to check if it's an IMX8 platform ? For me, the test on BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M to decide which genimage file to use was fine. What I wanted is:

(1) Split in different commits the introduction of i.MX8 support and the addition of the i.MX8 EVK support. A first commit should change the post-image.sh script to add i.MX8 stuff, and separate commit should add the defconfig and board/ stuff related to the i.MX8 EVK board.

(2) Split the i.MX8 specific bootloader preparation logic outside of the common post-image into a separate script called as a post-image script.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#15 lore raw

PATCH v6 4/4 configs/freescale_imx8mqevk: new defconfig

Hi

2018-04-10 23:26 GMT+02:00 Thomas Petazzoni <[email protected]>:

Quoted 21 lines

Hello,

Quoted 8 lines · Erik Larsson
Quoted 7 lines

Also, could you split the i.MX8 stuff from the support of the i.MX8 EVK board itself ?

I.e adding the genimage.cfg file, and adding imx8-bootloader.prepare.sh should be one patch, and then adding the i.MX8 EVK defconfig and readme.txt should be another patch.

Could you rework the last two patches according to those comments ?

Quoted 8 lines

I've started to rework this and have something that at least works. I've moved the generation of imx-boot-imx8mqevk-sd.bin to a separate prepare script and tried to separate what is iMX8 general and what is imx8mqevk specific in that script. So the gen_imx8_boot() function can be removed from post-script.sh. I still need to keep the selection of genimage.cfg.template in post-script.sh but instead of checking for IMX8M it can check if it's a IMX8 platform. Is it something like that you hade in mind?

Quoted 3 lines

How are you going to check if it's an IMX8 platform ? For me, the test on BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M to decide which genimage file to use was fine. What I wanted is:

Okay, maybe I over complicated it a bit then. I used BR2_PACKAGE_FREESCALE_IMX_PLATFORM to check if it's equal to "IMX8" when selecting genimage file to use. But if you are okay with BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M then I think it will be much more clearer. I'll look this over one more time.

Quoted 10 lines

(1) Split in different commits the introduction of i.MX8 support and the addition of the i.MX8 EVK support. A first commit should change the post-image.sh script to add i.MX8 stuff, and separate commit should add the defconfig and board/ stuff related to the i.MX8 EVK board.

(2) Split the i.MX8 specific bootloader preparation logic outside of the common post-image into a separate script called as a post-image script.

Okay, thanks!

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

Best regards,
Erik

#16 lore raw

v6 cover Initial support for NXP iMX8 (imx8mq-evk)

In reply to Erik Larsson

Hi all!

2018-03-10 12:51 GMT+01:00 Erik Larsson <[email protected]>:

Quoted 68 lines

This series provides initial support for NXP iMX8 (imx8mq-evk).

This series of patches are tested against NXP imx8mq-evk. It only handles basic support for iIMX8M, currently no support for GPU, VPU and other HW features. This series makes it possible to build a minimal system for imx8mq-evk.

Changes since v5
================
- Switch to letting post-image.sh generate imx-boot-imx8mqevk-sd.bin instead of letting imx-mkimage do that.

Changes since v4
================
- Build kernel, u-boot, atf from tag rel_imx_4.9.51_8mq_beta_patch.
- Add board readme.txt.
- Update imx-mkimage package to use host mkimage

Changes since v3
================
- Use Buildroot toolchain instead of external Linareo toolchain.
- Changed title on patch number 2

Changes since v2
================
- Build kernel, u-boot, atf based on tags instead of branches.
- Make sure to assign BR2_PACKAGE_FREESCALE_IMX_PLATFORM to IMX8M.
- Remove kernel defconfig from board folder and use arch default in kernel tree.
- Split third commit into two commits.

Changes since v1
================
- Removed new imx-atf package, use boot/arm-trusted-firmware.
- Move imx-mkimage from package/freescale-imx to package.
- Add upstream URL for imx-mkimage in Config.in.host.
- Fix install command syntax for imx-mkimage package.
- Use Makefile in imx-mkimage to build imx-boot-imx8mqevk-sd.bin instead of doing that in the post-script.sh
- Split third commit into two, one for firmware-img package and one for iMX8 board.

Erik Larsson (4):
imx-mkimage: new package
freescale-imx: add config option for i.MX8M
firmware-imx: add support for iMX8M firmware configs/freescale_imx8mqevk: new defconfig

 .../common/imx/genimage.cfg.template_imx8          | 40 +++++++++++
 board/freescale/common/imx/post-image.sh           | 28 +++++++-
 board/freescale/imx8mqevk/readme.txt               | 83 ++++++++++++++++++++++
 configs/freescale_imx8mqevk_defconfig              | 41 +++++++++++
 package/Config.in.host                             |  1 +
 package/freescale-imx/Config.in                    |  5 +-
 package/freescale-imx/firmware-imx/Config.in       |  2 +-
 package/freescale-imx/firmware-imx/firmware-imx.mk | 13 ++++
 ...-for-overriding-bl32-and-bl33-not-only-bl.patch | 58 +++++++++++++++
 .../0002-add-ldflags-to-link-step.patch            | 26 +++++++
 package/imx-mkimage/Config.in.host                 |  7 ++
 package/imx-mkimage/imx-mkimage.hash               |  3 +
 package/imx-mkimage/imx-mkimage.mk                 | 24 +++++++
 13 files changed, 326 insertions(+), 5 deletions(-)
 create mode 100644 board/freescale/common/imx/genimage.cfg.template_imx8
 create mode 100644 board/freescale/imx8mqevk/readme.txt
 create mode 100644 configs/freescale_imx8mqevk_defconfig
 create mode 100644 package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch
 create mode 100644 package/imx-mkimage/0002-add-ldflags-to-link-step.patch
 create mode 100644 package/imx-mkimage/Config.in.host
 create mode 100644 package/imx-mkimage/imx-mkimage.hash
 create mode 100644 package/imx-mkimage/imx-mkimage.mk
Quoted 3 lines

--
2.7.4

Any comments on this? I think this serie was missed by Patchwork a couple of weeks ago. I've also been a bit quiet due to the fact that I'm on my honeymoon and was not allowed to bring my iMX8 board. But I'm back on track in a couple of days.

/Erik