Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Changming Huang <jerry.huang@nxp.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 8/9] board/freescale/common/ls: Add standard post image script for Layerscape processors
Date: Wed, 20 Nov 2019 12:07:24 +0800	[thread overview]
Message-ID: <20191120040725.32207-9-jerry.huang@nxp.com> (raw)
In-Reply-To: <20191120040725.32207-1-jerry.huang@nxp.com>

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

Signed-off-by: Changming Huang <jerry.huang@nxp.com>
---
 board/freescale/common/ls/busybox.config    |  9 ++
 board/freescale/common/ls/post-image-spi.sh | 64 ++++++++++++++
 board/freescale/common/ls/post-image.sh     | 92 +++++++++++++++++++++
 3 files changed, 165 insertions(+)
 create mode 100644 board/freescale/common/ls/busybox.config
 create mode 100755 board/freescale/common/ls/post-image-spi.sh
 create mode 100755 board/freescale/common/ls/post-image.sh

diff --git a/board/freescale/common/ls/busybox.config b/board/freescale/common/ls/busybox.config
new file mode 100644
index 0000000000..7074c65aa6
--- /dev/null
+++ b/board/freescale/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/freescale/common/ls/post-image-spi.sh b/board/freescale/common/ls/post-image-spi.sh
new file mode 100755
index 0000000000..5e63b005ed
--- /dev/null
+++ b/board/freescale/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_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
+                echo "genimage.qspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
+		echo "genimage.xspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
+                echo "genimage.emmc.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
+                echo "genimage.sd.cfg.template"
+        fi
+}
+
+main()
+{
+	# build the itb image
+	cp board/freescale/$(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/freescale/$(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/freescale/common/ls/post-image.sh b/board/freescale/common/ls/post-image.sh
new file mode 100755
index 0000000000..a34894b167
--- /dev/null
+++ b/board/freescale/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_RCW_BOOT_MODE=\"qspi\"$" ${BR2_CONFIG}; then
+                echo "genimage.qspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_RCW_BOOT_MODE=\"flexspi_nor\"$" ${BR2_CONFIG}; then
+		echo "genimage.xspi.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_RCW_BOOT_MODE=\"emmc\"$" ${BR2_CONFIG}; then
+                echo "genimage.emmc.cfg.template"
+        elif grep -Eq "^BR2_PACKAGE_HOST_RCW_BOOT_MODE=\"sd\"$" ${BR2_CONFIG}; then
+                echo "genimage.sd.cfg.template"
+        fi
+}
+
+dp_fw()
+{
+	if grep -Eq "^BR2_PACKAGE_CADENCE_DP_BIN=\"ls1028a-dp-fw.bin\"$" ${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/freescale/$(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 $@
-- 
2.17.1

  parent reply	other threads:[~2019-11-20  4:07 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20  4:07 [Buildroot] [PATCH 0/9] new board ls1028ardb introduced Changming Huang
2019-11-20  4:07 ` [Buildroot] [PATCH 1/9] package/rcw: upgrade the rcw version to LSDK-19.09 Changming Huang
2019-11-20  7:59   ` Thomas Petazzoni
2019-11-20  8:04     ` [Buildroot] [EXT] " Jerry Huang
2019-11-20  9:21   ` [Buildroot] " Michael Walle
2019-11-20  9:32     ` Thomas Petazzoni
2019-11-20  9:38       ` Matthew Weber
2019-11-20  9:45         ` Thomas Petazzoni
2019-11-20  9:51           ` [Buildroot] [External] " Matthew Weber
2019-11-20  9:57             ` [Buildroot] [EXT] " Jerry Huang
2019-11-20 10:00             ` [Buildroot] " Michael Walle
2019-11-20 10:23               ` Matthew Weber
2019-11-20  9:54           ` [Buildroot] [EXT] " Jerry Huang
2019-11-20  4:07 ` [Buildroot] [PATCH 2/9] package/rcw: add target rcw binary support Changming Huang
2019-11-20  9:30   ` Matthew Weber
2019-11-20  4:07 ` [Buildroot] [PATCH 3/9] boot/arm-trusted-firmware: Add u-boot-dtb.bin support Changming Huang
2019-11-20  7:37   ` Sergey Matyukevich
2019-11-20  8:13     ` [Buildroot] [EXT] " Jerry Huang
2019-11-20  9:07     ` [Buildroot] " Thomas Petazzoni
2019-11-20  4:07 ` [Buildroot] [PATCH 4/9] boot/arm-trusted-firmware: Add RCW support Changming Huang
2019-11-20  7:50   ` Sergey Matyukevich
2019-11-20  8:45     ` [Buildroot] [EXT] " Jerry Huang
2019-11-21  8:02       ` Sergey Matyukevich
2019-11-21  8:37         ` Jerry Huang
2019-11-21  8:39           ` Jerry Huang
2019-11-20  4:07 ` [Buildroot] [PATCH 5/9] package/freescale-qoriq: new package directory Changming Huang
2019-11-20  8:57   ` Thomas Petazzoni
2019-11-20  4:07 ` [Buildroot] [PATCH 6/9] package/freescale-qoriq/cadence: new package Changming Huang
2019-11-20  9:13   ` Thomas Petazzoni
2019-11-20  9:30     ` [Buildroot] [EXT] " Jerry Huang
2019-11-20  9:36       ` Thomas Petazzoni
2019-11-20  9:47         ` Jerry Huang
2019-11-20  4:07 ` [Buildroot] [PATCH 7/9] package/rcw: Enable IIC5_PMUX and CLK_OUT_PMUX for GPIO Changming Huang
2019-11-20  9:14   ` Thomas Petazzoni
2019-11-20  9:34     ` [Buildroot] [EXT] " Jerry Huang
2019-11-20  9:38       ` Thomas Petazzoni
2019-11-20 10:22         ` Jerry Huang
2019-11-20  4:07 ` Changming Huang [this message]
2019-11-20  4:07 ` [Buildroot] [PATCH 9/9] configs/freescale_ls1028ardb*: new board Changming Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191120040725.32207-9-jerry.huang@nxp.com \
    --to=jerry.huang@nxp.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox