All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk)
@ 2018-03-10 11:51 Erik Larsson
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 1/4] imx-mkimage: new package Erik Larsson
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Erik Larsson @ 2018-03-10 11:51 UTC (permalink / raw)
  To: buildroot

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

-- 
2.7.4

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

* [Buildroot] [PATCH v6 1/4] imx-mkimage: new package
  2018-03-10 11:51 [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
@ 2018-03-10 11:51 ` Erik Larsson
  2018-04-09 20:07   ` Thomas Petazzoni
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 2/4] freescale-imx: add config option for i.MX8M Erik Larsson
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Erik Larsson @ 2018-03-10 11:51 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
---
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

diff --git a/package/Config.in.host b/package/Config.in.host
index 199a8e9..06ef5cb 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch b/package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch
new file mode 100644
index 0000000..430122f
--- /dev/null
+++ b/package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch
@@ -0,0 +1,58 @@
+From 0677e6cff00506de56d11bfa230b6c366e74f6ed Mon Sep 17 00:00:00 2001
+From: Erik Larsson <erik.larsson@combitech.se>
+Date: Thu, 8 Mar 2018 19:04:37 +0100
+Subject: [PATCH] Add support for overriding BL32 and BL33 not only BL31
+
+Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
+Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
+Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
+---
+ iMX8M/mkimage_fit_atf.sh | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/iMX8M/mkimage_fit_atf.sh b/iMX8M/mkimage_fit_atf.sh
+index 3a3bd10..727f746 100755
+--- a/iMX8M/mkimage_fit_atf.sh
++++ b/iMX8M/mkimage_fit_atf.sh
+@@ -11,29 +11,29 @@ if [ ! -f $BL31 ]; then
+ 	echo "ERROR: BL31 file $BL31 NOT found" >&2
+ 	exit 0
+ else
+-	echo "bl31.bin size: " >&2
+-	ls -lct bl31.bin | awk '{print $5}' >&2
++	echo "$BL31 size: " >&2
++	ls -lct $BL31 | awk '{print $5}' >&2
+ fi
+ 
+-BL32="tee.bin"
++[ -z "$BL32" ] && BL32="tee.bin"
+ 
+ if [ ! -f $BL32 ]; then
+ 	BL32=/dev/null
+ else
+-	echo "Building with TEE support, make sure your bl31 is compiled with spd. If you do not want tee, please delete tee.bin" >&2
+-	echo "tee.bin size: " >&2
+-	ls -lct tee.bin | awk '{print $5}' >&2
++	echo "Building with TEE support, make sure your bl31 is compiled with spd. If you do not want tee, please delete $BL32" >&2
++	echo "$BL32 size: " >&2
++	ls -lct $BL32 | awk '{print $5}' >&2
+ fi
+ 
+-BL33="u-boot-nodtb.bin"
++[ -z "$BL33" ] && BL33="u-boot-nodtb.bin"
+ 
+ if [ ! -f $BL33 ]; then
+ 	echo "ERROR: $BL33 file NOT found" >&2
+ 	exit 0
+ else
+ 	
+-	echo "u-boot-nodtb.bin size: " >&2
+-	ls -lct u-boot-nodtb.bin | awk '{print $5}' >&2
++	echo "$BL33: " >&2
++	ls -lct $BL33 | awk '{print $5}' >&2
+ fi
+ 
+ for dtname in $*
+-- 
+2.7.4
+
diff --git a/package/imx-mkimage/0002-add-ldflags-to-link-step.patch b/package/imx-mkimage/0002-add-ldflags-to-link-step.patch
new file mode 100644
index 0000000..22c6a7d
--- /dev/null
+++ b/package/imx-mkimage/0002-add-ldflags-to-link-step.patch
@@ -0,0 +1,26 @@
+From a73f20fbe921c7ecff3efda23bc506fdd935ee4d Mon Sep 17 00:00:00 2001
+From: Erik Larsson <erik.larsson@combitech.se>
+Date: Tue, 6 Mar 2018 12:28:39 +0100
+Subject: [PATCH 1/2] Add LDFLAGS to link step
+
+Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
+---
+ 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
+
diff --git a/package/imx-mkimage/Config.in.host b/package/imx-mkimage/Config.in.host
new file mode 100644
index 0000000..8d27355
--- /dev/null
+++ b/package/imx-mkimage/Config.in.host
@@ -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
diff --git a/package/imx-mkimage/imx-mkimage.hash b/package/imx-mkimage/imx-mkimage.hash
new file mode 100644
index 0000000..08d31ce
--- /dev/null
+++ b/package/imx-mkimage/imx-mkimage.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 4ddb144520001c33baa24493f68ef2ea9434ac36bf3ae223f78d7ec581aa484c  imx-mkimage-imx_4.9.51_imx8m_beta.tar.gz
+sha256 231f7edcc7352d7734a96eef0b8030f77982678c516876fcb81e25b32d68564c  iMX8dv/COPYING
diff --git a/package/imx-mkimage/imx-mkimage.mk b/package/imx-mkimage/imx-mkimage.mk
new file mode 100644
index 0000000..b60fea6
--- /dev/null
+++ b/package/imx-mkimage/imx-mkimage.mk
@@ -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))
-- 
2.7.4

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

* [Buildroot] [PATCH v6 2/4] freescale-imx: add config option for i.MX8M
  2018-03-10 11:51 [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 1/4] imx-mkimage: new package Erik Larsson
@ 2018-03-10 11:51 ` Erik Larsson
  2018-04-09 20:08   ` Thomas Petazzoni
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 3/4] firmware-imx: add support for iMX8M firmware Erik Larsson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Erik Larsson @ 2018-03-10 11:51 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
---
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(-)

diff --git a/package/freescale-imx/Config.in b/package/freescale-imx/Config.in
index b5e5ab2..fe993f3 100644
--- a/package/freescale-imx/Config.in
+++ b/package/freescale-imx/Config.in
@@ -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
-- 
2.7.4

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

* [Buildroot] [PATCH v6 3/4] firmware-imx: add support for iMX8M firmware
  2018-03-10 11:51 [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 1/4] imx-mkimage: new package Erik Larsson
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 2/4] freescale-imx: add config option for i.MX8M Erik Larsson
@ 2018-03-10 11:51 ` Erik Larsson
  2018-04-09 20:38   ` Thomas Petazzoni
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig Erik Larsson
  2018-03-28  9:23 ` [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
  4 siblings, 1 reply; 17+ messages in thread
From: Erik Larsson @ 2018-03-10 11:51 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
---
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(-)

diff --git a/package/freescale-imx/firmware-imx/Config.in b/package/freescale-imx/firmware-imx/Config.in
index fca280a..56d5b80 100644
--- a/package/freescale-imx/firmware-imx/Config.in
+++ b/package/freescale-imx/firmware-imx/Config.in
@@ -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.
 
diff --git a/package/freescale-imx/firmware-imx/firmware-imx.mk b/package/freescale-imx/firmware-imx/firmware-imx.mk
index 630afca..ff8ca01 100644
--- a/package/freescale-imx/firmware-imx/firmware-imx.mk
+++ b/package/freescale-imx/firmware-imx/firmware-imx.mk
@@ -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))
-- 
2.7.4

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-03-10 11:51 [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
                   ` (2 preceding siblings ...)
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 3/4] firmware-imx: add support for iMX8M firmware Erik Larsson
@ 2018-03-10 11:51 ` Erik Larsson
  2018-04-09 20:42   ` Thomas Petazzoni
  2018-03-28  9:23 ` [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
  4 siblings, 1 reply; 17+ messages in thread
From: Erik Larsson @ 2018-03-10 11:51 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
---
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

diff --git a/board/freescale/common/imx/genimage.cfg.template_imx8 b/board/freescale/common/imx/genimage.cfg.template_imx8
new file mode 100644
index 0000000..138beff
--- /dev/null
+++ b/board/freescale/common/imx/genimage.cfg.template_imx8
@@ -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"
+  }
+}
diff --git a/board/freescale/common/imx/post-image.sh b/board/freescale/common/imx/post-image.sh
index b239743..4c77ae2 100755
--- a/board/freescale/common/imx/post-image.sh
+++ b/board/freescale/common/imx/post-image.sh
@@ -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}
 
diff --git a/board/freescale/imx8mqevk/readme.txt b/board/freescale/imx8mqevk/readme.txt
new file mode 100644
index 0000000..3728f02
--- /dev/null
+++ b/board/freescale/imx8mqevk/readme.txt
@@ -0,0 +1,83 @@
+***************************
+Freescale i.MX8mq EVK board
+***************************
+
+This file documents the Buildroot support for the Freescale i.MX8mq EVK board.
+
+Hardware support
+================
+
+Currently only basic support for hardware is avialable, currently no
+support for GPU, VPU and other HW features.
+
+Build
+=====
+
+First, configure Buildroot for the i.MX8mq EVK board:
+
+  make freescale_imx8mqevk_defconfig
+
+Build all components:
+
+  make
+
+You will find in output/images/ the following files:
+  - bl31.bin
+  - boot.vfat
+  - fsl-imx8mq-evk.dtb
+  - Image
+  - imx-boot-imx8mqevk-sd.bin
+  - lpddr4_pmu_train_1d_dmem.bin
+  - lpddr4_pmu_train_1d_imem.bin
+  - lpddr4_pmu_train_2d_dmem.bin
+  - lpddr4_pmu_train_2d_imem.bin
+  - rootfs.ext2
+  - rootfs.ext4
+  - rootfs.tar
+  - sdcard.img
+  - signed_hdmi_imx8m.bin
+  - u-boot.bin
+  - u-boot.imx
+  - u-boot-nodtb.bin
+
+Create a bootable SD card
+=========================
+
+To determine the device associated to the SD card have a look in the
+/proc/partitions file:
+
+  cat /proc/partitions
+
+Buildroot prepares a bootable "sdcard.img" image in the output/images/
+directory, ready to be dumped on a SD card. Launch the following
+command as root:
+
+  dd if=output/images/sdcard.img of=/dev/<your-sd-device>
+
+*** WARNING! This will destroy all the card content. Use with care! ***
+
+For details about the medium image layout, see the definition in
+board/freescale/common/imx/genimage.cfg.template_imx8.
+
+Boot the i.MX8mq EVK board
+==========================
+
+To boot your newly created system:
+- insert the SD card in the SD slot of the board;
+- put a micro USB cable into the Debug USB Port and connect using a terminal
+  emulator at 115200 bps, 8n1;
+- power on the board.
+
+Enable HDMI output
+==================
+
+To enable HDMI output at boot you must provide the video kernel boot argument.
+To set the video boot argument from U-Boot run after stoping in U-Boot prompt:
+
+setenv mmcargs 'setenv bootargs console=${console} root=${mmcroot} video=HDMI-A-1:1920x1080-32 at 60'
+saveenv
+reset
+
+Change screen resolution to suit your connected display.
+
+Enjoy!
diff --git a/configs/freescale_imx8mqevk_defconfig b/configs/freescale_imx8mqevk_defconfig
new file mode 100644
index 0000000..217224c
--- /dev/null
+++ b/configs/freescale_imx8mqevk_defconfig
@@ -0,0 +1,41 @@
+BR2_aarch64=y
+BR2_ARM_FPU_VFPV3=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://source.codeaurora.org/external/imx/linux-imx"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="rel_imx_4.9.51_8mq_beta_patch"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/fsl-imx8mq-evk"
+BR2_PACKAGE_FREESCALE_IMX=y
+BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y
+BR2_PACKAGE_FIRMWARE_IMX=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL="https://source.codeaurora.org/external/imx/imx-atf"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="rel_imx_4.9.51_8mq_beta_patch"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mq"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://source.codeaurora.org/external/imx/uboot-imx"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="rel_imx_4.9.51_8mq_beta_patch"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mq_evk"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_FORMAT_IMX=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
+BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-nodtb.bin"
+BR2_TARGET_UBOOT_SPL=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_IMX_MKIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
-- 
2.7.4

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

* [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk)
  2018-03-10 11:51 [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
                   ` (3 preceding siblings ...)
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig Erik Larsson
@ 2018-03-28  9:23 ` Erik Larsson
  4 siblings, 0 replies; 17+ messages in thread
From: Erik Larsson @ 2018-03-28  9:23 UTC (permalink / raw)
  To: buildroot

Hi all!

2018-03-10 12:51 GMT+01:00 Erik Larsson <karl.erik.larsson@gmail.com>:
> 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
>
> --
> 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

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

* [Buildroot] [PATCH v6 1/4] imx-mkimage: new package
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 1/4] imx-mkimage: new package Erik Larsson
@ 2018-04-09 20:07   ` Thomas Petazzoni
  2018-04-10  5:27     ` Erik Larsson
  0 siblings, 1 reply; 17+ messages in thread
From: Thomas Petazzoni @ 2018-04-09 20:07 UTC (permalink / raw)
  To: buildroot

Hello,

Again, thanks for this contribution!

On Sat, 10 Mar 2018 12:51:39 +0100, Erik Larsson wrote:
> This package add support for imx-mkimage for iMX8M.
> Currently the only hardware it's tested for.
> 
> Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
> Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>

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

>  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.


> diff --git a/package/imx-mkimage/0002-add-ldflags-to-link-step.patch b/package/imx-mkimage/0002-add-ldflags-to-link-step.patch
> new file mode 100644
> index 0000000..22c6a7d
> --- /dev/null
> +++ b/package/imx-mkimage/0002-add-ldflags-to-link-step.patch
> @@ -0,0 +1,26 @@
> +From a73f20fbe921c7ecff3efda23bc506fdd935ee4d Mon Sep 17 00:00:00 2001
> +From: Erik Larsson <erik.larsson@combitech.se>
> +Date: Tue, 6 Mar 2018 12:28:39 +0100
> +Subject: [PATCH 1/2] Add LDFLAGS to link step
> +
> +Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>

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 ?


> +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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v6 2/4] freescale-imx: add config option for i.MX8M
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 2/4] freescale-imx: add config option for i.MX8M Erik Larsson
@ 2018-04-09 20:08   ` Thomas Petazzoni
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Petazzoni @ 2018-04-09 20:08 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 10 Mar 2018 12:51:40 +0100, Erik Larsson wrote:
> Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
> Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
> ---
> 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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v6 3/4] firmware-imx: add support for iMX8M firmware
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 3/4] firmware-imx: add support for iMX8M firmware Erik Larsson
@ 2018-04-09 20:38   ` Thomas Petazzoni
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Petazzoni @ 2018-04-09 20:38 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 10 Mar 2018 12:51:41 +0100, Erik Larsson wrote:

> +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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-03-10 11:51 ` [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig Erik Larsson
@ 2018-04-09 20:42   ` Thomas Petazzoni
  2018-04-09 20:46     ` Fabio Estevam
                       ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Thomas Petazzoni @ 2018-04-09 20:42 UTC (permalink / raw)
  To: buildroot

Hello Erik,

On Sat, 10 Mar 2018 12:51:42 +0100, Erik Larsson wrote:

> diff --git a/board/freescale/common/imx/post-image.sh b/board/freescale/common/imx/post-image.sh
> index b239743..4c77ae2 100755
> --- a/board/freescale/common/imx/post-image.sh
> +++ b/board/freescale/common/imx/post-image.sh
> @@ -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

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

> @@ -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
> +}

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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-04-09 20:42   ` Thomas Petazzoni
@ 2018-04-09 20:46     ` Fabio Estevam
  2018-04-10  5:37     ` Erik Larsson
  2018-04-10 17:31     ` Erik Larsson
  2 siblings, 0 replies; 17+ messages in thread
From: Fabio Estevam @ 2018-04-09 20:46 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Mon, Apr 9, 2018 at 5:42 PM, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:

> 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.

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

* [Buildroot] [PATCH v6 1/4] imx-mkimage: new package
  2018-04-09 20:07   ` Thomas Petazzoni
@ 2018-04-10  5:27     ` Erik Larsson
  2018-04-10  6:56       ` Thomas Petazzoni
  0 siblings, 1 reply; 17+ messages in thread
From: Erik Larsson @ 2018-04-10  5:27 UTC (permalink / raw)
  To: buildroot

Hi!

2018-04-09 22:07 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@bootlin.com>:
> Hello,
>
> Again, thanks for this contribution!
>
> On Sat, 10 Mar 2018 12:51:39 +0100, Erik Larsson wrote:
>> This package add support for imx-mkimage for iMX8M.
>> Currently the only hardware it's tested for.
>>
>> Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
>> Signed-off-by: Christopher Dahlberg <crille.dahlberg@gmail.com>
>
> Thanks, I've applied to master, after doing a few changes. I also have
> one request. See below.
>
>>  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.
>
>
>> diff --git a/package/imx-mkimage/0002-add-ldflags-to-link-step.patch b/package/imx-mkimage/0002-add-ldflags-to-link-step.patch
>> new file mode 100644
>> index 0000000..22c6a7d
>> --- /dev/null
>> +++ b/package/imx-mkimage/0002-add-ldflags-to-link-step.patch
>> @@ -0,0 +1,26 @@
>> +From a73f20fbe921c7ecff3efda23bc506fdd935ee4d Mon Sep 17 00:00:00 2001
>> +From: Erik Larsson <erik.larsson@combitech.se>
>> +Date: Tue, 6 Mar 2018 12:28:39 +0100
>> +Subject: [PATCH 1/2] Add LDFLAGS to link step
>> +
>> +Signed-off-by: Erik Larsson <karl.erik.larsson@gmail.com>
>
> 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?

>
>
>> +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
> --
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com

/Erik

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-04-09 20:42   ` Thomas Petazzoni
  2018-04-09 20:46     ` Fabio Estevam
@ 2018-04-10  5:37     ` Erik Larsson
  2018-04-10 17:31     ` Erik Larsson
  2 siblings, 0 replies; 17+ messages in thread
From: Erik Larsson @ 2018-04-10  5:37 UTC (permalink / raw)
  To: buildroot

Hi

2018-04-09 22:42 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@bootlin.com>:
> Hello Erik,
>
> On Sat, 10 Mar 2018 12:51:42 +0100, Erik Larsson wrote:
>
>> diff --git a/board/freescale/common/imx/post-image.sh b/board/freescale/common/imx/post-image.sh
>> index b239743..4c77ae2 100755
>> --- a/board/freescale/common/imx/post-image.sh
>> +++ b/board/freescale/common/imx/post-image.sh
>> @@ -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
>
> Those two changes could be in a patch reworking post-image.sh to be
> compatible with arm64.
>
>> @@ -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
>> +}
>
> 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 ?

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

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

/Erik

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

* [Buildroot] [PATCH v6 1/4] imx-mkimage: new package
  2018-04-10  5:27     ` Erik Larsson
@ 2018-04-10  6:56       ` Thomas Petazzoni
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Petazzoni @ 2018-04-10  6:56 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 10 Apr 2018 07:27:22 +0200, Erik Larsson wrote:

> > 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.

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

Yes, that would be nice. Thanks!

Best regards,

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

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-04-09 20:42   ` Thomas Petazzoni
  2018-04-09 20:46     ` Fabio Estevam
  2018-04-10  5:37     ` Erik Larsson
@ 2018-04-10 17:31     ` Erik Larsson
  2018-04-10 21:26       ` Thomas Petazzoni
  2 siblings, 1 reply; 17+ messages in thread
From: Erik Larsson @ 2018-04-10 17:31 UTC (permalink / raw)
  To: buildroot

Hi,

2018-04-09 22:42 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@bootlin.com>:
> Hello Erik,
>
> On Sat, 10 Mar 2018 12:51:42 +0100, Erik Larsson wrote:
>
>> diff --git a/board/freescale/common/imx/post-image.sh b/board/freescale/common/imx/post-image.sh
>> index b239743..4c77ae2 100755
>> --- a/board/freescale/common/imx/post-image.sh
>> +++ b/board/freescale/common/imx/post-image.sh
>> @@ -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
>
> Those two changes could be in a patch reworking post-image.sh to be
> compatible with arm64.
>
>> @@ -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
>> +}
>
> 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 ?

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?

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

/Erik

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-04-10 17:31     ` Erik Larsson
@ 2018-04-10 21:26       ` Thomas Petazzoni
  2018-04-11  5:23         ` Erik Larsson
  0 siblings, 1 reply; 17+ messages in thread
From: Thomas Petazzoni @ 2018-04-10 21:26 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 10 Apr 2018 19:31:51 +0200, Erik Larsson wrote:

> > 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?

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
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig
  2018-04-10 21:26       ` Thomas Petazzoni
@ 2018-04-11  5:23         ` Erik Larsson
  0 siblings, 0 replies; 17+ messages in thread
From: Erik Larsson @ 2018-04-11  5:23 UTC (permalink / raw)
  To: buildroot

Hi

2018-04-10 23:26 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@bootlin.com>:
> Hello,
>
> On Tue, 10 Apr 2018 19:31:51 +0200, Erik Larsson wrote:
>
>> > 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?
>
> 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.

>
>  (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!

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

Best regards,
Erik

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

end of thread, other threads:[~2018-04-11  5:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-10 11:51 [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson
2018-03-10 11:51 ` [Buildroot] [PATCH v6 1/4] imx-mkimage: new package Erik Larsson
2018-04-09 20:07   ` Thomas Petazzoni
2018-04-10  5:27     ` Erik Larsson
2018-04-10  6:56       ` Thomas Petazzoni
2018-03-10 11:51 ` [Buildroot] [PATCH v6 2/4] freescale-imx: add config option for i.MX8M Erik Larsson
2018-04-09 20:08   ` Thomas Petazzoni
2018-03-10 11:51 ` [Buildroot] [PATCH v6 3/4] firmware-imx: add support for iMX8M firmware Erik Larsson
2018-04-09 20:38   ` Thomas Petazzoni
2018-03-10 11:51 ` [Buildroot] [PATCH v6 4/4] configs/freescale_imx8mqevk: new defconfig Erik Larsson
2018-04-09 20:42   ` Thomas Petazzoni
2018-04-09 20:46     ` Fabio Estevam
2018-04-10  5:37     ` Erik Larsson
2018-04-10 17:31     ` Erik Larsson
2018-04-10 21:26       ` Thomas Petazzoni
2018-04-11  5:23         ` Erik Larsson
2018-03-28  9:23 ` [Buildroot] [PATCH v6 0/4] Initial support for NXP iMX8 (imx8mq-evk) Erik Larsson

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