All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 4/9] package/qoriq-rcw: add target rcw binary support
@ 2019-11-27  7:30 Changming Huang
  2019-11-27  7:30 ` [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors Changming Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Changming Huang @ 2019-11-27  7:30 UTC (permalink / raw)
  To: buildroot

From: Jerry Huang <jerry.huang@nxp.com>

For NXP QorIQ (PowerPC and Layerscape) platform,
we need to specify the RCW file and build it to binary.

Introduce BR2_PACKAGE_HOST_QORIQ_RCW_BIN to specify the RCW binary file.

Signed-off-by: Jerry Huang <jerry.huang@nxp.com>
---
changes since v2:
1. modify the patch descrition
2. more detail for BR2_PACKAGE_HOST_QORIQ_RCW_BIN
3. remove two options not used in this patch
4. add the condition detection in makefile for QorIQ RCW 

changes since v1:
1. add option BR2_PACKAGE_HOST_RCW_ATF for ATF.
---
 package/nxp/qoriq-rcw/Config.in.host | 12 ++++++++++++
 package/nxp/qoriq-rcw/qoriq-rcw.mk   | 15 +++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/package/nxp/qoriq-rcw/Config.in.host b/package/nxp/qoriq-rcw/Config.in.host
index 8f78a40908..9bf55894e8 100644
--- a/package/nxp/qoriq-rcw/Config.in.host
+++ b/package/nxp/qoriq-rcw/Config.in.host
@@ -25,4 +25,16 @@ config BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH
 	  included for use in the SDK or with post scripts but no
 	  RCW binary will not be generated.
 
+config BR2_PACKAGE_HOST_QORIQ_RCW_BIN
+	string "Custom RCW"
+	depends on !BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH
+	help
+	  This option is used to specify the RCW binary file for board.
+	  which is composed with platform/serdes_value/rcw_file, platform
+	  is the platform name, serdes_value is the setting of the Serdes,
+	  rcw_file is the file name of RCW, for example:
+	  "ls1028ardb/R_SQPP_0x85bb/rcw_1300_sdboot.bin"
+
+	  If this option is empty, no rcw file is used.
+
 endif
diff --git a/package/nxp/qoriq-rcw/qoriq-rcw.mk b/package/nxp/qoriq-rcw/qoriq-rcw.mk
index 7a0494adc6..bbd085f277 100644
--- a/package/nxp/qoriq-rcw/qoriq-rcw.mk
+++ b/package/nxp/qoriq-rcw/qoriq-rcw.mk
@@ -37,6 +37,21 @@ endef
 define HOST_QORIQ_RCW_INSTALL_DELIVERY_FILE
 	$(INSTALL) -D -m 0644 $(@D)/PBL.bin $(BINARIES_DIR)/PBL.bin
 endef
+else
+QORIQ_RCW_PATH_FILE_BIN = $(call qstrip,$(BR2_PACKAGE_HOST_QORIQ_RCW_BIN))
+
+ifneq ($(QORIQ_RCW_PATH_FILE_BIN),)
+QORIQ_RCW_PLATFORM = $(firstword $(subst /, ,$(QORIQ_RCW_PATH_FILE_BIN)))
+QORIQ_RCW_FILE_BIN = $(lastword $(subst /, ,$(QORIQ_RCW_PATH_FILE_BIN)))
+
+define HOST_QORIQ_RCW_BUILD_CMDS
+	$(MAKE) -C $(@D)/$(QORIQ_RCW_PLATFORM)
+endef
+
+define HOST_QORIQ_RCW_INSTALL_DELIVERY_FILE
+	$(INSTALL) -D -m 0644 $(@D)/$(QORIQ_RCW_PATH_FILE_BIN) $(BINARIES_DIR)/$(QORIQ_RCW_FILE_BIN)
+endef
+endif
 endif
 
 # Copy source files and script into $(HOST_DIR)/share/rcw/ so a developer
-- 
2.17.1

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

* [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-11-27  7:30 [Buildroot] [PATCH v3 4/9] package/qoriq-rcw: add target rcw binary support Changming Huang
@ 2019-11-27  7:30 ` Changming Huang
  2019-12-03  1:34   ` Vladimir Oltean
  0 siblings, 1 reply; 8+ messages in thread
From: Changming Huang @ 2019-11-27  7:30 UTC (permalink / raw)
  To: buildroot

Add the standard post image script for Layerscape processors (LS1028A
and other processors).

Introduce BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE to define the boot mode.
Because the RCW binary can be stored in different media, for example:
SD card - RCW locate in SD card, boot the board from SD card
eMMC    - RCW locate in eMMC chip, boot the board from eMMC chip
flexSPI - RCW locate in flexSPI, boot the board from flexSPI Nor/Nand flash
QSPI    - RCW locate in QSPI flash, boot the board from QSPI flash

Signed-off-by: Changming Huang <jerry.huang@nxp.com>
---
changes since v2:
1. add option BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE for boot mode.
2. change the condition for qoriq-cadence-dp-firmware firmware file.

changes since v1:
1. update DEVELOPERS.
2. modify the condition for display firmware.
---
 DEVELOPERS                            |  1 +
 board/nxp/common/ls/busybox.config    |  9 +++
 board/nxp/common/ls/post-image-spi.sh | 64 +++++++++++++++++++
 board/nxp/common/ls/post-image.sh     | 92 +++++++++++++++++++++++++++
 package/nxp/qoriq-rcw/Config.in.host  |  6 ++
 5 files changed, 172 insertions(+)
 create mode 100644 board/nxp/common/ls/busybox.config
 create mode 100755 board/nxp/common/ls/post-image-spi.sh
 create mode 100755 board/nxp/common/ls/post-image.sh

diff --git a/DEVELOPERS b/DEVELOPERS
index 70f2671ff8..6fd8f8ee08 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -514,6 +514,7 @@ F:	configs/olimex_a13_olinuxino_defconfig
 F:	configs/orangepi_plus_defconfig
 
 N:	Changming Huang <jerry.huang@nxp.com>
+F:	board/nxp/common/ls/
 F:	package/nxp/qoriq-cadence-dp-firmware/
 
 N:	Chris Packham <judge.packham@gmail.com>
diff --git a/board/nxp/common/ls/busybox.config b/board/nxp/common/ls/busybox.config
new file mode 100644
index 0000000000..7074c65aa6
--- /dev/null
+++ b/board/nxp/common/ls/busybox.config
@@ -0,0 +1,9 @@
+#
+# Additional Busybox Settings
+#
+CONFIG_TASKSET=y
+CONFIG_FEATURE_TASKSET_FANCY=y
+CONFIG_FEATURE_DF_FANCY=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_XZ=y
diff --git a/board/nxp/common/ls/post-image-spi.sh b/board/nxp/common/ls/post-image-spi.sh
new file mode 100755
index 0000000000..81e9b96648
--- /dev/null
+++ b/board/nxp/common/ls/post-image-spi.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+# args from BR2_ROOTFS_POST_SCRIPT_ARGS
+# $2 linux building directory
+# $3 buildroot top directory
+# $4 u-boot building directory
+#
+plat_name()
+{
+	if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$" ${BR2_CONFIG}; then
+		echo "ls1028ardb"
+	fi
+}
+
+# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
+# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
+# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
+# genimage.cfg.template: Boot from SD and eMMC
+#
+genimage_type()
+{
+        if grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
+                echo "genimage.qspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
+		echo "genimage.xspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
+                echo "genimage.emmc.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
+                echo "genimage.sd.cfg.template"
+        fi
+}
+
+main()
+{
+	# build the itb image
+	cp board/nxp/$(plat_name)/kernel.its ${BINARIES_DIR}/kernel.its
+	cd ${BINARIES_DIR}/
+	/usr/bin/mkimage -f kernel.its kernel.itb
+	rm kernel.its
+
+	cd ${3}
+
+	# build the SDcard image
+	local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+	local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+
+	sed -e "s/%FILES%/${FILES}/" \
+		board/nxp/$(plat_name)/$(genimage_type) > ${GENIMAGE_CFG}
+
+	rm -rf "${GENIMAGE_TMP}"
+
+	genimage \
+		--rootpath "${TARGET_DIR}" \
+		--tmppath "${GENIMAGE_TMP}" \
+		--inputpath "${BINARIES_DIR}" \
+		--outputpath "${BINARIES_DIR}" \
+		--config "${GENIMAGE_CFG}"
+
+	rm -f ${GENIMAGE_CFG}
+
+	exit $?
+}
+
+main $@
diff --git a/board/nxp/common/ls/post-image.sh b/board/nxp/common/ls/post-image.sh
new file mode 100755
index 0000000000..6137379d29
--- /dev/null
+++ b/board/nxp/common/ls/post-image.sh
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+# args from BR2_ROOTFS_POST_SCRIPT_ARGS
+# $2 linux building directory
+# $3 buildroot top directory
+# $4 u-boot building directory
+
+#
+# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
+# in ${BR_CONFIG}, then prints the corresponding list of file names for the
+# genimage configuration file
+#
+dtb_file()
+{
+        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 "\"`basename $dt`.dtb\", "
+        done
+}
+
+#
+# For Freescale/NXP Layerscape serial platforms (ARM v8), we use Image for SD/eMMC boot,
+# Image.gz for QSPI/XSPI boot. Then,prints the corresponding file name for the genimage
+# configuration file
+#
+linux_image()
+{
+	if grep -Eq "^BR2_LINUX_KERNEL_IMAGE_TARGET_NAME=\"Image\"$" ${BR2_CONFIG}; then
+		echo "\"Image\""
+	else
+		echo "\"Image.gz\""
+	fi
+}
+
+plat_name()
+{
+	if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$" ${BR2_CONFIG}; then
+		echo "ls1028ardb"
+	fi
+}
+
+#
+# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
+# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
+# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
+# genimage.cfg.template: Boot from SD and eMMC
+#
+genimage_type()
+{
+        if grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
+                echo "genimage.qspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
+		echo "genimage.xspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
+                echo "genimage.emmc.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
+                echo "genimage.sd.cfg.template"
+        fi
+}
+
+dp_fw()
+{
+	if grep -Eq "^BR2_PACKAGE_QORIQ_CADENCE_DP_FIRMWARE=y$" ${BR2_CONFIG}; then
+		echo "\"ls1028a-dp-fw.bin\", "
+
+	fi
+}
+
+main()
+{
+	local FILES="$(dtb_file) $(dp_fw) $(linux_image)"
+	local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+	local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+	sed -e "s/%FILES%/${FILES}/" \
+		board/nxp/$(plat_name)/$(genimage_type) > ${GENIMAGE_CFG}
+
+	rm -rf "${GENIMAGE_TMP}"
+
+	genimage \
+		--rootpath "${TARGET_DIR}" \
+		--tmppath "${GENIMAGE_TMP}" \
+		--inputpath "${BINARIES_DIR}" \
+		--outputpath "${BINARIES_DIR}" \
+		--config "${GENIMAGE_CFG}"
+
+	rm -f ${GENIMAGE_CFG}
+
+	exit $?
+}
+
+main $@
diff --git a/package/nxp/qoriq-rcw/Config.in.host b/package/nxp/qoriq-rcw/Config.in.host
index 9bf55894e8..7f5fbb3202 100644
--- a/package/nxp/qoriq-rcw/Config.in.host
+++ b/package/nxp/qoriq-rcw/Config.in.host
@@ -37,4 +37,10 @@ config BR2_PACKAGE_HOST_QORIQ_RCW_BIN
 
 	  If this option is empty, no rcw file is used.
 
+config BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE
+	string "QorIQ RCW Boot mode"
+	depends on !BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH
+	help
+	  Specify the boot mode, for example, sd, emmc, flexspi_nor.
+
 endif
-- 
2.17.1

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

* [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-11-27  7:30 ` [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors Changming Huang
@ 2019-12-03  1:34   ` Vladimir Oltean
  2019-12-06  7:23     ` [Buildroot] [EXT] " Jerry Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Oltean @ 2019-12-03  1:34 UTC (permalink / raw)
  To: buildroot

Hi Jerry,

On Wed, 27 Nov 2019 at 09:30, Changming Huang <jerry.huang@nxp.com> wrote:
>
> Add the standard post image script for Layerscape processors (LS1028A
> and other processors).
>
> Introduce BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE to define the boot mode.
> Because the RCW binary can be stored in different media, for example:
> SD card - RCW locate in SD card, boot the board from SD card
> eMMC    - RCW locate in eMMC chip, boot the board from eMMC chip
> flexSPI - RCW locate in flexSPI, boot the board from flexSPI Nor/Nand flash
> QSPI    - RCW locate in QSPI flash, boot the board from QSPI flash
>
> Signed-off-by: Changming Huang <jerry.huang@nxp.com>
> ---
> changes since v2:
> 1. add option BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE for boot mode.
> 2. change the condition for qoriq-cadence-dp-firmware firmware file.
>
> changes since v1:
> 1. update DEVELOPERS.
> 2. modify the condition for display firmware.
> ---
>  DEVELOPERS                            |  1 +
>  board/nxp/common/ls/busybox.config    |  9 +++
>  board/nxp/common/ls/post-image-spi.sh | 64 +++++++++++++++++++
>  board/nxp/common/ls/post-image.sh     | 92 +++++++++++++++++++++++++++
>  package/nxp/qoriq-rcw/Config.in.host  |  6 ++
>  5 files changed, 172 insertions(+)
>  create mode 100644 board/nxp/common/ls/busybox.config
>  create mode 100755 board/nxp/common/ls/post-image-spi.sh
>  create mode 100755 board/nxp/common/ls/post-image.sh
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 70f2671ff8..6fd8f8ee08 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -514,6 +514,7 @@ F:  configs/olimex_a13_olinuxino_defconfig
>  F:     configs/orangepi_plus_defconfig
>
>  N:     Changming Huang <jerry.huang@nxp.com>
> +F:     board/nxp/common/ls/
>  F:     package/nxp/qoriq-cadence-dp-firmware/
>
>  N:     Chris Packham <judge.packham@gmail.com>
> diff --git a/board/nxp/common/ls/busybox.config b/board/nxp/common/ls/busybox.config
> new file mode 100644
> index 0000000000..7074c65aa6
> --- /dev/null
> +++ b/board/nxp/common/ls/busybox.config
> @@ -0,0 +1,9 @@
> +#
> +# Additional Busybox Settings
> +#
> +CONFIG_TASKSET=y
> +CONFIG_FEATURE_TASKSET_FANCY=y
> +CONFIG_FEATURE_DF_FANCY=y
> +CONFIG_FEATURE_SEAMLESS_GZ=y
> +CONFIG_FEATURE_SEAMLESS_BZ2=y
> +CONFIG_FEATURE_SEAMLESS_XZ=y
> diff --git a/board/nxp/common/ls/post-image-spi.sh b/board/nxp/common/ls/post-image-spi.sh
> new file mode 100755
> index 0000000000..81e9b96648
> --- /dev/null
> +++ b/board/nxp/common/ls/post-image-spi.sh
> @@ -0,0 +1,64 @@
> +#!/usr/bin/env bash
> +# args from BR2_ROOTFS_POST_SCRIPT_ARGS
> +# $2 linux building directory
> +# $3 buildroot top directory
> +# $4 u-boot building directory
> +#
> +plat_name()
> +{
> +       if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$" ${BR2_CONFIG}; then
> +               echo "ls1028ardb"
> +       fi
> +}
> +
> +# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
> +# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
> +# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
> +# genimage.cfg.template: Boot from SD and eMMC
> +#
> +genimage_type()
> +{
> +        if grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then

Tabs or spaces? This is pretty inconsistent across all shell scripts
in the board/nxp folder.

> +                echo "genimage.qspi.cfg.template"
> +        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
> +               echo "genimage.xspi.cfg.template"
> +        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
> +                echo "genimage.emmc.cfg.template"
> +        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
> +                echo "genimage.sd.cfg.template"
> +        fi
> +}
> +
> +main()
> +{
> +       # build the itb image
> +       cp board/nxp/$(plat_name)/kernel.its ${BINARIES_DIR}/kernel.its
> +       cd ${BINARIES_DIR}/
> +       /usr/bin/mkimage -f kernel.its kernel.itb

Why does mkimage have the full path specified here?

> +       rm kernel.its
> +
> +       cd ${3}
> +
> +       # build the SDcard image
> +       local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
> +       local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
> +
> +
> +       sed -e "s/%FILES%/${FILES}/" \

You might want a different sed separator here than "/", since that is
a common character to be found in file names.

> +               board/nxp/$(plat_name)/$(genimage_type) > ${GENIMAGE_CFG}
> +
> +       rm -rf "${GENIMAGE_TMP}"
> +
> +       genimage \
> +               --rootpath "${TARGET_DIR}" \
> +               --tmppath "${GENIMAGE_TMP}" \
> +               --inputpath "${BINARIES_DIR}" \
> +               --outputpath "${BINARIES_DIR}" \
> +               --config "${GENIMAGE_CFG}"
> +
> +       rm -f ${GENIMAGE_CFG}
> +
> +       exit $?
> +}
> +
> +main $@
> diff --git a/board/nxp/common/ls/post-image.sh b/board/nxp/common/ls/post-image.sh
> new file mode 100755
> index 0000000000..6137379d29
> --- /dev/null
> +++ b/board/nxp/common/ls/post-image.sh
> @@ -0,0 +1,92 @@
> +#!/usr/bin/env bash
> +# args from BR2_ROOTFS_POST_SCRIPT_ARGS
> +# $2 linux building directory
> +# $3 buildroot top directory
> +# $4 u-boot building directory
> +
> +#
> +# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
> +# in ${BR_CONFIG}, then prints the corresponding list of file names for the
> +# genimage configuration file
> +#
> +dtb_file()
> +{
> +        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 "\"`basename $dt`.dtb\", "
> +        done
> +}
> +
> +#
> +# For Freescale/NXP Layerscape serial platforms (ARM v8), we use Image for SD/eMMC boot,
> +# Image.gz for QSPI/XSPI boot. Then,prints the corresponding file name for the genimage

Why does the boot source make any difference to the kernel compression format?

> +# configuration file
> +#
> +linux_image()
> +{
> +       if grep -Eq "^BR2_LINUX_KERNEL_IMAGE_TARGET_NAME=\"Image\"$" ${BR2_CONFIG}; then
> +               echo "\"Image\""
> +       else
> +               echo "\"Image.gz\""
> +       fi
> +}
> +
> +plat_name()
> +{
> +       if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$" ${BR2_CONFIG}; then
> +               echo "ls1028ardb"
> +       fi
> +}

How will the other boards resolve to a correct plat_name here? Not all
of them (e.g. LS1021A) use ATF.
How about specifying it in BR2_ROOTFS_POST_SCRIPT_ARGS=?
Or creating a board/nxp/ls1028ardb/post-image.sh that sources the
board/nxp/common/post-image.sh and runs the functions defined there
with custom parameters?

> +
> +#
> +# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
> +# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
> +# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
> +# genimage.cfg.template: Boot from SD and eMMC
> +#
> +genimage_type()
> +{
> +        if grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
> +                echo "genimage.qspi.cfg.template"
> +        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
> +               echo "genimage.xspi.cfg.template"
> +        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
> +                echo "genimage.emmc.cfg.template"
> +        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
> +                echo "genimage.sd.cfg.template"
> +        fi
> +}
> +
> +dp_fw()
> +{
> +       if grep -Eq "^BR2_PACKAGE_QORIQ_CADENCE_DP_FIRMWARE=y$" ${BR2_CONFIG}; then
> +               echo "\"ls1028a-dp-fw.bin\", "
> +
> +       fi
> +}

How generic it is to specify the DisplayPort firmware in the common
post-image.sh script, since no other device than the LS1028A uses it?
I echo other comments and wonder if it is possible for the kernel
driver to simply call request_firmware on a file in the rootfs, rather
than relying on the bootloader to do this operation.

> +
> +main()
> +{
> +       local FILES="$(dtb_file) $(dp_fw) $(linux_image)"
> +       local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
> +       local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
> +
> +       sed -e "s/%FILES%/${FILES}/" \
> +               board/nxp/$(plat_name)/$(genimage_type) > ${GENIMAGE_CFG}
> +
> +       rm -rf "${GENIMAGE_TMP}"
> +
> +       genimage \
> +               --rootpath "${TARGET_DIR}" \
> +               --tmppath "${GENIMAGE_TMP}" \
> +               --inputpath "${BINARIES_DIR}" \
> +               --outputpath "${BINARIES_DIR}" \
> +               --config "${GENIMAGE_CFG}"
> +
> +       rm -f ${GENIMAGE_CFG}
> +
> +       exit $?
> +}
> +
> +main $@
> diff --git a/package/nxp/qoriq-rcw/Config.in.host b/package/nxp/qoriq-rcw/Config.in.host
> index 9bf55894e8..7f5fbb3202 100644
> --- a/package/nxp/qoriq-rcw/Config.in.host
> +++ b/package/nxp/qoriq-rcw/Config.in.host
> @@ -37,4 +37,10 @@ config BR2_PACKAGE_HOST_QORIQ_RCW_BIN
>
>           If this option is empty, no rcw file is used.
>
> +config BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE
> +       string "QorIQ RCW Boot mode"
> +       depends on !BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH
> +       help
> +         Specify the boot mode, for example, sd, emmc, flexspi_nor.
> +
>  endif
> --
> 2.17.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Thanks,
-Vladimir

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

* [Buildroot] [EXT] Re: [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-12-03  1:34   ` Vladimir Oltean
@ 2019-12-06  7:23     ` Jerry Huang
  2019-12-06  8:03       ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry Huang @ 2019-12-06  7:23 UTC (permalink / raw)
  To: buildroot

Hi, Vladimir,


Best Regards
Jerry Huang

> -----Original Message-----
> From: Vladimir Oltean <olteanv@gmail.com>
> Sent: Tuesday, December 3, 2019 9:34 AM
> To: Jerry Huang <jerry.huang@nxp.com>
> Cc: buildroot at busybox.net; Michael Walle <michael@walle.cc>;
> geomatsi at gmail.com; matthew.weber at collins.com; Thomas Petazzoni
> <thomas.petazzoni@bootlin.com>
> Subject: [EXT] Re: [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add
> standard post image script for Layerscape processors
> 
> Caution: EXT Email
> 
> Hi Jerry,
> 
> On Wed, 27 Nov 2019 at 09:30, Changming Huang <jerry.huang@nxp.com>
> wrote:
> >
> > Add the standard post image script for Layerscape processors (LS1028A
> > and other processors).
> >
> > Introduce BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE to define the
> boot mode.
> > Because the RCW binary can be stored in different media, for example:
> > SD card - RCW locate in SD card, boot the board from SD card
> > eMMC    - RCW locate in eMMC chip, boot the board from eMMC chip
> > flexSPI - RCW locate in flexSPI, boot the board from flexSPI Nor/Nand flash
> > QSPI    - RCW locate in QSPI flash, boot the board from QSPI flash
> >
> > Signed-off-by: Changming Huang <jerry.huang@nxp.com>
> > ---
> > changes since v2:
> > 1. add option BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE for boot
> mode.
> > 2. change the condition for qoriq-cadence-dp-firmware firmware file.
> >
> > changes since v1:
> > 1. update DEVELOPERS.
> > 2. modify the condition for display firmware.
> > ---
> >  DEVELOPERS                            |  1 +
> >  board/nxp/common/ls/busybox.config    |  9 +++
> >  board/nxp/common/ls/post-image-spi.sh | 64 +++++++++++++++++++
> >  board/nxp/common/ls/post-image.sh     | 92
> +++++++++++++++++++++++++++
> >  package/nxp/qoriq-rcw/Config.in.host  |  6 ++
> >  5 files changed, 172 insertions(+)
> >  create mode 100644 board/nxp/common/ls/busybox.config
> >  create mode 100755 board/nxp/common/ls/post-image-spi.sh
> >  create mode 100755 board/nxp/common/ls/post-image.sh
> >
> > diff --git a/DEVELOPERS b/DEVELOPERS
> > index 70f2671ff8..6fd8f8ee08 100644
> > --- a/DEVELOPERS
> > +++ b/DEVELOPERS
> > @@ -514,6 +514,7 @@ F:  configs/olimex_a13_olinuxino_defconfig
> >  F:     configs/orangepi_plus_defconfig
> >
> >  N:     Changming Huang <jerry.huang@nxp.com>
> > +F:     board/nxp/common/ls/
> >  F:     package/nxp/qoriq-cadence-dp-firmware/
> >
> >  N:     Chris Packham <judge.packham@gmail.com>
> > diff --git a/board/nxp/common/ls/busybox.config
> > b/board/nxp/common/ls/busybox.config
> > new file mode 100644
> > index 0000000000..7074c65aa6
> > --- /dev/null
> > +++ b/board/nxp/common/ls/busybox.config
> > @@ -0,0 +1,9 @@
> > +#
> > +# Additional Busybox Settings
> > +#
> > +CONFIG_TASKSET=y
> > +CONFIG_FEATURE_TASKSET_FANCY=y
> > +CONFIG_FEATURE_DF_FANCY=y
> > +CONFIG_FEATURE_SEAMLESS_GZ=y
> > +CONFIG_FEATURE_SEAMLESS_BZ2=y
> > +CONFIG_FEATURE_SEAMLESS_XZ=y
> > diff --git a/board/nxp/common/ls/post-image-spi.sh
> > b/board/nxp/common/ls/post-image-spi.sh
> > new file mode 100755
> > index 0000000000..81e9b96648
> > --- /dev/null
> > +++ b/board/nxp/common/ls/post-image-spi.sh
> > @@ -0,0 +1,64 @@
> > +#!/usr/bin/env bash
> > +# args from BR2_ROOTFS_POST_SCRIPT_ARGS # $2 linux building directory
> > +# $3 buildroot top directory # $4 u-boot building directory #
> > +plat_name()
> > +{
> > +       if grep -Eq
> "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$"
> ${BR2_CONFIG}; then
> > +               echo "ls1028ardb"
> > +       fi
> > +}
> > +
> > +# genimage.qspi.cfg.template: Boot from 64MB QSPI flash #
> > +genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash #
> > +genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash #
> > +genimage.cfg.template: Boot from SD and eMMC #
> > +genimage_type()
> > +{
> > +        if grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$"
> > +${BR2_CONFIG}; then
> 
> Tabs or spaces? This is pretty inconsistent across all shell scripts in the board/nxp
> folder.
that's will be corrected.

> > +                echo "genimage.qspi.cfg.template"
> > +        elif grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$"
> ${BR2_CONFIG}; then
> > +               echo "genimage.xspi.cfg.template"
> > +        elif grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$"
> ${BR2_CONFIG}; then
> > +                echo "genimage.emmc.cfg.template"
> > +        elif grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG};
> then
> > +                echo "genimage.sd.cfg.template"
> > +        fi
> > +}
> > +
> > +main()
> > +{
> > +       # build the itb image
> > +       cp board/nxp/$(plat_name)/kernel.its ${BINARIES_DIR}/kernel.its
> > +       cd ${BINARIES_DIR}/
> > +       /usr/bin/mkimage -f kernel.its kernel.itb
> 
> Why does mkimage have the full path specified here?
Use the mkimage at host machine.

> > +       rm kernel.its
> > +
> > +       cd ${3}
> > +
> > +       # build the SDcard image
> > +       local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
> > +       local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
> > +
> > +
> > +       sed -e "s/%FILES%/${FILES}/" \
> 
> You might want a different sed separator here than "/", since that is a common
> character to be found in file names.
Ok, will correct it.

> > +               board/nxp/$(plat_name)/$(genimage_type) >
> > + ${GENIMAGE_CFG}
> > +
> > +       rm -rf "${GENIMAGE_TMP}"
> > +
> > +       genimage \
> > +               --rootpath "${TARGET_DIR}" \
> > +               --tmppath "${GENIMAGE_TMP}" \
> > +               --inputpath "${BINARIES_DIR}" \
> > +               --outputpath "${BINARIES_DIR}" \
> > +               --config "${GENIMAGE_CFG}"
> > +
> > +       rm -f ${GENIMAGE_CFG}
> > +
> > +       exit $?
> > +}
> > +
> > +main $@
> > diff --git a/board/nxp/common/ls/post-image.sh
> > b/board/nxp/common/ls/post-image.sh
> > new file mode 100755
> > index 0000000000..6137379d29
> > --- /dev/null
> > +++ b/board/nxp/common/ls/post-image.sh
> > @@ -0,0 +1,92 @@
> > +#!/usr/bin/env bash
> > +# args from BR2_ROOTFS_POST_SCRIPT_ARGS # $2 linux building directory
> > +# $3 buildroot top directory # $4 u-boot building directory
> > +
> > +#
> > +# dtb_list extracts the list of DTB files from
> BR2_LINUX_KERNEL_INTREE_DTS_NAME
> > +# in ${BR_CONFIG}, then prints the corresponding list of file names for the
> > +# genimage configuration file
> > +#
> > +dtb_file()
> > +{
> > +        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 "\"`basename $dt`.dtb\", "
> > +        done
> > +}
> > +
> > +#
> > +# For Freescale/NXP Layerscape serial platforms (ARM v8), we use Image for
> SD/eMMC boot,
> > +# Image.gz for QSPI/XSPI boot. Then,prints the corresponding file name for
> the genimage
> 
> Why does the boot source make any difference to the kernel compression
> format?
Because there are enough space on SD card or eMMC for Image without compressed.
But for qspi or xspi flash, the space is limited, so I used the compressed kernel image.

> > +# configuration file
> > +#
> > +linux_image()
> > +{
> > +       if grep -Eq
> "^BR2_LINUX_KERNEL_IMAGE_TARGET_NAME=\"Image\"$" ${BR2_CONFIG};
> then
> > +               echo "\"Image\""
> > +       else
> > +               echo "\"Image.gz\""
> > +       fi
> > +}
> > +
> > +plat_name()
> > +{
> > +       if grep -Eq
> "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$"
> ${BR2_CONFIG}; then
> > +               echo "ls1028ardb"
> > +       fi
> > +}
> 
> How will the other boards resolve to a correct plat_name here? Not all
> of them (e.g. LS1021A) use ATF.
> How about specifying it in BR2_ROOTFS_POST_SCRIPT_ARGS=?
> Or creating a board/nxp/ls1028ardb/post-image.sh that sources the
> board/nxp/common/post-image.sh and runs the functions defined there
> with custom parameters?
currently I just think about armv8, which use the ATF.
Yes, we can create post-imag.sh under board directory.

> > +
> > +#
> > +# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
> > +# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
> > +# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
> > +# genimage.cfg.template: Boot from SD and eMMC
> > +#
> > +genimage_type()
> > +{
> > +        if grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$"
> ${BR2_CONFIG}; then
> > +                echo "genimage.qspi.cfg.template"
> > +        elif grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$"
> ${BR2_CONFIG}; then
> > +               echo "genimage.xspi.cfg.template"
> > +        elif grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$"
> ${BR2_CONFIG}; then
> > +                echo "genimage.emmc.cfg.template"
> > +        elif grep -Eq
> "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG};
> then
> > +                echo "genimage.sd.cfg.template"
> > +        fi
> > +}
> > +
> > +dp_fw()
> > +{
> > +       if grep -Eq "^BR2_PACKAGE_QORIQ_CADENCE_DP_FIRMWARE=y$"
> ${BR2_CONFIG}; then
> > +               echo "\"ls1028a-dp-fw.bin\", "
> > +
> > +       fi
> > +}
> 
> How generic it is to specify the DisplayPort firmware in the common
> post-image.sh script, since no other device than the LS1028A uses it?
> I echo other comments and wonder if it is possible for the kernel
> driver to simply call request_firmware on a file in the rootfs, rather
> than relying on the bootloader to do this operation.
If put firmware into rootfs, we just can load the driver as module, if the driver is build-in which will be loaded before mounting rootfs, then no firmware can be loaded.
I can put this script in board directory to avoid this concern.

> > +
> > +main()
> > +{
> > +       local FILES="$(dtb_file) $(dp_fw) $(linux_image)"
> > +       local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
> > +       local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
> > +
> > +       sed -e "s/%FILES%/${FILES}/" \
> > +               board/nxp/$(plat_name)/$(genimage_type) >
> ${GENIMAGE_CFG}
> > +
> > +       rm -rf "${GENIMAGE_TMP}"
> > +
> > +       genimage \
> > +               --rootpath "${TARGET_DIR}" \
> > +               --tmppath "${GENIMAGE_TMP}" \
> > +               --inputpath "${BINARIES_DIR}" \
> > +               --outputpath "${BINARIES_DIR}" \
> > +               --config "${GENIMAGE_CFG}"
> > +
> > +       rm -f ${GENIMAGE_CFG}
> > +
> > +       exit $?
> > +}
> > +
> > +main $@
> > diff --git a/package/nxp/qoriq-rcw/Config.in.host
> b/package/nxp/qoriq-rcw/Config.in.host
> > index 9bf55894e8..7f5fbb3202 100644
> > --- a/package/nxp/qoriq-rcw/Config.in.host
> > +++ b/package/nxp/qoriq-rcw/Config.in.host
> > @@ -37,4 +37,10 @@ config BR2_PACKAGE_HOST_QORIQ_RCW_BIN
> >
> >           If this option is empty, no rcw file is used.
> >
> > +config BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE
> > +       string "QorIQ RCW Boot mode"
> > +       depends on !BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH
> > +       help
> > +         Specify the boot mode, for example, sd, emmc, flexspi_nor.
> > +
> >  endif
> > --
> > 2.17.1
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot at busybox.net
> >
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.busyb
> ox.net%2Fmailman%2Flistinfo%2Fbuildroot&amp;data=02%7C01%7Cjerry.huan
> g%40nxp.com%7Ce81f76b8fc2d40a9339508d77790f67a%7C686ea1d3bc2b4c6f
> a92cd99c5c301635%7C0%7C0%7C637109336805597618&amp;sdata=%2FKzb
> wp%2BdPOd1mI0zxRbtZwmdlOWRInszWY9UDslpDOs%3D&amp;reserved=0
> 
> Thanks,
> -Vladimir

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

* [Buildroot] [EXT] Re: [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-12-06  7:23     ` [Buildroot] [EXT] " Jerry Huang
@ 2019-12-06  8:03       ` Thomas Petazzoni
  2019-12-06 12:34         ` Jerry Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2019-12-06  8:03 UTC (permalink / raw)
  To: buildroot

On Fri, 6 Dec 2019 07:23:17 +0000
Jerry Huang <jerry.huang@nxp.com> wrote:

> > > +       # build the itb image
> > > +       cp board/nxp/$(plat_name)/kernel.its ${BINARIES_DIR}/kernel.its
> > > +       cd ${BINARIES_DIR}/
> > > +       /usr/bin/mkimage -f kernel.its kernel.itb  
> > 
> > Why does mkimage have the full path specified here?  
> Use the mkimage at host machine.

And that is not correct because nothing guarantees you that there is an
mkimage installed in /usr/bin/mkimage. You can only rely on the mkimage
built by Buildroot.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [EXT] Re: [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-12-06  8:03       ` Thomas Petazzoni
@ 2019-12-06 12:34         ` Jerry Huang
  2019-12-06 12:49           ` Jerry Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Jerry Huang @ 2019-12-06 12:34 UTC (permalink / raw)
  To: buildroot



Best Regards
Jerry Huang

> -----Original Message-----
> From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Sent: Friday, December 6, 2019 4:04 PM
> To: Jerry Huang <jerry.huang@nxp.com>
> Cc: Vladimir Oltean <olteanv@gmail.com>; buildroot at busybox.net; Michael
> Walle <michael@walle.cc>; geomatsi at gmail.com;
> matthew.weber at collins.com
> Subject: Re: [EXT] Re: [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add
> standard post image script for Layerscape processors
> 
> Caution: EXT Email
> 
> On Fri, 6 Dec 2019 07:23:17 +0000
> Jerry Huang <jerry.huang@nxp.com> wrote:
> 
> > > > +       # build the itb image
> > > > +       cp board/nxp/$(plat_name)/kernel.its
> ${BINARIES_DIR}/kernel.its
> > > > +       cd ${BINARIES_DIR}/
> > > > +       /usr/bin/mkimage -f kernel.its kernel.itb
> > >
> > > Why does mkimage have the full path specified here?
> > Use the mkimage at host machine.
> 
> And that is not correct because nothing guarantees you that there is an
> mkimage installed in /usr/bin/mkimage. You can only rely on the mkimage built
> by Buildroot.
I want to use the mkimage built by buildroot from uboot-tools, but I got this error when handling DTB file:
mkimage: unsupported type Flat Device Tree

the DTB file is create with command "make" during building Linux kernel.

When I use mkimage from ubuntu system, it is no any problem.

So ,how to handle it?

> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbootlin.c
> om&amp;data=02%7C01%7Cjerry.huang%40nxp.com%7Cc0a9dbf3584742076d
> c608d77a22d5f2%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6371
> 12162347177474&amp;sdata=iAhqJ45WKxYlgdrbEd8DISqFyKX4t3nfm8jNN6BEl
> ZQ%3D&amp;reserved=0

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

* [Buildroot] [EXT] Re: [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-12-06 12:34         ` Jerry Huang
@ 2019-12-06 12:49           ` Jerry Huang
  0 siblings, 0 replies; 8+ messages in thread
From: Jerry Huang @ 2019-12-06 12:49 UTC (permalink / raw)
  To: buildroot



Best Regards
Jerry Huang

> -----Original Message-----
> From: Jerry Huang
> Sent: Friday, December 6, 2019 8:35 PM
> To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Vladimir Oltean <olteanv@gmail.com>; buildroot at busybox.net; Michael
> Walle <michael@walle.cc>; geomatsi at gmail.com;
> matthew.weber at collins.com
> Subject: RE: [EXT] Re: [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add
> standard post image script for Layerscape processors
> 
> 
> 
> Best Regards
> Jerry Huang
> 
> > -----Original Message-----
> > From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> > Sent: Friday, December 6, 2019 4:04 PM
> > To: Jerry Huang <jerry.huang@nxp.com>
> > Cc: Vladimir Oltean <olteanv@gmail.com>; buildroot at busybox.net;
> > Michael Walle <michael@walle.cc>; geomatsi at gmail.com;
> > matthew.weber at collins.com
> > Subject: Re: [EXT] Re: [Buildroot] [PATCH v3 8/9] board/nxp/common/ls:
> > Add standard post image script for Layerscape processors
> >
> > Caution: EXT Email
> >
> > On Fri, 6 Dec 2019 07:23:17 +0000
> > Jerry Huang <jerry.huang@nxp.com> wrote:
> >
> > > > > +       # build the itb image
> > > > > +       cp board/nxp/$(plat_name)/kernel.its
> > ${BINARIES_DIR}/kernel.its
> > > > > +       cd ${BINARIES_DIR}/
> > > > > +       /usr/bin/mkimage -f kernel.its kernel.itb
> > > >
> > > > Why does mkimage have the full path specified here?
> > > Use the mkimage at host machine.
> >
> > And that is not correct because nothing guarantees you that there is
> > an mkimage installed in /usr/bin/mkimage. You can only rely on the
> > mkimage built by Buildroot.
> I want to use the mkimage built by buildroot from uboot-tools, but I got this
> error when handling DTB file:
> mkimage: unsupported type Flat Device Tree
> 
> the DTB file is create with command "make" during building Linux kernel.
> 
> When I use mkimage from ubuntu system, it is no any problem.
> 
> So ,how to handle it?
More information:
When the Linux kernel is 4.14, there is not any issue when using mkimage built by buildroot to create ITB file.

Now the Linux kernel is 4.19, the error is reported when using mkimage built by buildroot to handle the DTB file.

> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fboot
> > lin.c
> om&amp;data=02%7C01%7Cjerry.huang%40nxp.com%7Cc0a9dbf3584742076d
> >
> c608d77a22d5f2%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6371
> >
> 12162347177474&amp;sdata=iAhqJ45WKxYlgdrbEd8DISqFyKX4t3nfm8jNN6BEl
> > ZQ%3D&amp;reserved=0

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

* [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors
  2019-11-27  7:17 [Buildroot] [PATCH v3 1/9] package/nxp: new package directory Changming Huang
@ 2019-11-27  7:17 ` Changming Huang
  0 siblings, 0 replies; 8+ messages in thread
From: Changming Huang @ 2019-11-27  7:17 UTC (permalink / raw)
  To: buildroot

Add the standard post image script for Layerscape processors (LS1028A
and other processors).

Signed-off-by: Changming Huang <jerry.huang@nxp.com>
---
changes since v2:
1. add option BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE for boot mode.
2. change the condition for qoriq-cadence-dp-firmware firmware file.

changes since v1:
1. update DEVELOPERS.
2. modify the condition for display firmware.
---
 DEVELOPERS                            |  1 +
 board/nxp/common/ls/busybox.config    |  9 +++
 board/nxp/common/ls/post-image-spi.sh | 64 +++++++++++++++++++
 board/nxp/common/ls/post-image.sh     | 92 +++++++++++++++++++++++++++
 package/nxp/qoriq-rcw/Config.in.host  |  6 ++
 5 files changed, 172 insertions(+)
 create mode 100644 board/nxp/common/ls/busybox.config
 create mode 100755 board/nxp/common/ls/post-image-spi.sh
 create mode 100755 board/nxp/common/ls/post-image.sh

diff --git a/DEVELOPERS b/DEVELOPERS
index 70f2671ff8..6fd8f8ee08 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -514,6 +514,7 @@ F:	configs/olimex_a13_olinuxino_defconfig
 F:	configs/orangepi_plus_defconfig
 
 N:	Changming Huang <jerry.huang@nxp.com>
+F:	board/nxp/common/ls/
 F:	package/nxp/qoriq-cadence-dp-firmware/
 
 N:	Chris Packham <judge.packham@gmail.com>
diff --git a/board/nxp/common/ls/busybox.config b/board/nxp/common/ls/busybox.config
new file mode 100644
index 0000000000..7074c65aa6
--- /dev/null
+++ b/board/nxp/common/ls/busybox.config
@@ -0,0 +1,9 @@
+#
+# Additional Busybox Settings
+#
+CONFIG_TASKSET=y
+CONFIG_FEATURE_TASKSET_FANCY=y
+CONFIG_FEATURE_DF_FANCY=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_XZ=y
diff --git a/board/nxp/common/ls/post-image-spi.sh b/board/nxp/common/ls/post-image-spi.sh
new file mode 100755
index 0000000000..81e9b96648
--- /dev/null
+++ b/board/nxp/common/ls/post-image-spi.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+# args from BR2_ROOTFS_POST_SCRIPT_ARGS
+# $2 linux building directory
+# $3 buildroot top directory
+# $4 u-boot building directory
+#
+plat_name()
+{
+	if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$" ${BR2_CONFIG}; then
+		echo "ls1028ardb"
+	fi
+}
+
+# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
+# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
+# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
+# genimage.cfg.template: Boot from SD and eMMC
+#
+genimage_type()
+{
+        if grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
+                echo "genimage.qspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
+		echo "genimage.xspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
+                echo "genimage.emmc.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
+                echo "genimage.sd.cfg.template"
+        fi
+}
+
+main()
+{
+	# build the itb image
+	cp board/nxp/$(plat_name)/kernel.its ${BINARIES_DIR}/kernel.its
+	cd ${BINARIES_DIR}/
+	/usr/bin/mkimage -f kernel.its kernel.itb
+	rm kernel.its
+
+	cd ${3}
+
+	# build the SDcard image
+	local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+	local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+
+	sed -e "s/%FILES%/${FILES}/" \
+		board/nxp/$(plat_name)/$(genimage_type) > ${GENIMAGE_CFG}
+
+	rm -rf "${GENIMAGE_TMP}"
+
+	genimage \
+		--rootpath "${TARGET_DIR}" \
+		--tmppath "${GENIMAGE_TMP}" \
+		--inputpath "${BINARIES_DIR}" \
+		--outputpath "${BINARIES_DIR}" \
+		--config "${GENIMAGE_CFG}"
+
+	rm -f ${GENIMAGE_CFG}
+
+	exit $?
+}
+
+main $@
diff --git a/board/nxp/common/ls/post-image.sh b/board/nxp/common/ls/post-image.sh
new file mode 100755
index 0000000000..6137379d29
--- /dev/null
+++ b/board/nxp/common/ls/post-image.sh
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+# args from BR2_ROOTFS_POST_SCRIPT_ARGS
+# $2 linux building directory
+# $3 buildroot top directory
+# $4 u-boot building directory
+
+#
+# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
+# in ${BR_CONFIG}, then prints the corresponding list of file names for the
+# genimage configuration file
+#
+dtb_file()
+{
+        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 "\"`basename $dt`.dtb\", "
+        done
+}
+
+#
+# For Freescale/NXP Layerscape serial platforms (ARM v8), we use Image for SD/eMMC boot,
+# Image.gz for QSPI/XSPI boot. Then,prints the corresponding file name for the genimage
+# configuration file
+#
+linux_image()
+{
+	if grep -Eq "^BR2_LINUX_KERNEL_IMAGE_TARGET_NAME=\"Image\"$" ${BR2_CONFIG}; then
+		echo "\"Image\""
+	else
+		echo "\"Image.gz\""
+	fi
+}
+
+plat_name()
+{
+	if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"ls1028ardb\"$" ${BR2_CONFIG}; then
+		echo "ls1028ardb"
+	fi
+}
+
+#
+# genimage.qspi.cfg.template: Boot from 64MB QSPI flash
+# genimage.xspi.256MB.cfg.template: Boot from 256MB flexSPI_nor flash
+# genimage.xspi.64MB.cfg.template: Boot from 64MB flexSPI_nor flash
+# genimage.cfg.template: Boot from SD and eMMC
+#
+genimage_type()
+{
+        if grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
+                echo "genimage.qspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
+		echo "genimage.xspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
+                echo "genimage.emmc.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
+                echo "genimage.sd.cfg.template"
+        fi
+}
+
+dp_fw()
+{
+	if grep -Eq "^BR2_PACKAGE_QORIQ_CADENCE_DP_FIRMWARE=y$" ${BR2_CONFIG}; then
+		echo "\"ls1028a-dp-fw.bin\", "
+
+	fi
+}
+
+main()
+{
+	local FILES="$(dtb_file) $(dp_fw) $(linux_image)"
+	local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+	local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+	sed -e "s/%FILES%/${FILES}/" \
+		board/nxp/$(plat_name)/$(genimage_type) > ${GENIMAGE_CFG}
+
+	rm -rf "${GENIMAGE_TMP}"
+
+	genimage \
+		--rootpath "${TARGET_DIR}" \
+		--tmppath "${GENIMAGE_TMP}" \
+		--inputpath "${BINARIES_DIR}" \
+		--outputpath "${BINARIES_DIR}" \
+		--config "${GENIMAGE_CFG}"
+
+	rm -f ${GENIMAGE_CFG}
+
+	exit $?
+}
+
+main $@
diff --git a/package/nxp/qoriq-rcw/Config.in.host b/package/nxp/qoriq-rcw/Config.in.host
index 9bf55894e8..7f5fbb3202 100644
--- a/package/nxp/qoriq-rcw/Config.in.host
+++ b/package/nxp/qoriq-rcw/Config.in.host
@@ -37,4 +37,10 @@ config BR2_PACKAGE_HOST_QORIQ_RCW_BIN
 
 	  If this option is empty, no rcw file is used.
 
+config BR2_PACKAGE_HOST_QORIQ_RCW_BOOT_MODE
+	string "QorIQ RCW Boot mode"
+	depends on !BR2_PACKAGE_HOST_QORIQ_RCW_CUSTOM_PATH
+	help
+	  Specify the boot mode, for example, sd, emmc, flexspi_nor.
+
 endif
-- 
2.17.1

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

end of thread, other threads:[~2019-12-06 12:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27  7:30 [Buildroot] [PATCH v3 4/9] package/qoriq-rcw: add target rcw binary support Changming Huang
2019-11-27  7:30 ` [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors Changming Huang
2019-12-03  1:34   ` Vladimir Oltean
2019-12-06  7:23     ` [Buildroot] [EXT] " Jerry Huang
2019-12-06  8:03       ` Thomas Petazzoni
2019-12-06 12:34         ` Jerry Huang
2019-12-06 12:49           ` Jerry Huang
  -- strict thread matches above, loose matches on Subject: below --
2019-11-27  7:17 [Buildroot] [PATCH v3 1/9] package/nxp: new package directory Changming Huang
2019-11-27  7:17 ` [Buildroot] [PATCH v3 8/9] board/nxp/common/ls: Add standard post image script for Layerscape processors Changming Huang

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.