Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28
@ 2016-11-06 19:12 Fabio Estevam
  2016-11-06 19:12 ` [Buildroot] [PATCH 2/2] configs/imx28evk: Use the common mxs genimage script Fabio Estevam
  2016-11-06 21:44 ` [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-11-06 19:12 UTC (permalink / raw)
  To: buildroot

Add a standard genimage script for the MXS processors (MX23 and MX28).

Based on the common scripts for the other imx devices:
board/freescale/common/genimage.cfg.template
board/freescale/common/post-image.sh

This makes it easier to add new MX23/MX28 boards configurations into
Buildroot.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 board/freescale/common/mxs/genimage.cfg.template | 39 +++++++++++++++++
 board/freescale/common/mxs/post-image.sh         | 54 ++++++++++++++++++++++++
 2 files changed, 93 insertions(+)
 create mode 100644 board/freescale/common/mxs/genimage.cfg.template
 create mode 100755 board/freescale/common/mxs/post-image.sh

diff --git a/board/freescale/common/mxs/genimage.cfg.template b/board/freescale/common/mxs/genimage.cfg.template
new file mode 100644
index 0000000..91031ab
--- /dev/null
+++ b/board/freescale/common/mxs/genimage.cfg.template
@@ -0,0 +1,39 @@
+# Minimal SD card image for the Freescale MX23/MX28 Template
+#
+# We mimic the .sdcard Freescale's MX23/MX28 image format:
+# * u-boot.sb is placed at offset 1M,
+# * a FAT partition at offset 16 MB is containing zImage/uImage and DTB files
+# * a single root filesystem partition is required (ext2, ext3 or ext4)
+#
+
+image boot.vfat {
+	vfat {
+		files = {
+			%FILES%
+		}
+	}
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot {
+		partition-type = 0x53
+		image = "u-boot.sd"
+		offset = 1M
+		size = 16M
+	}
+
+	partition kernel {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+	}
+}
diff --git a/board/freescale/common/mxs/post-image.sh b/board/freescale/common/mxs/post-image.sh
new file mode 100755
index 0000000..0bfb835
--- /dev/null
+++ b/board/freescale/common/mxs/post-image.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+#
+# 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_list()
+{
+	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\", "
+	done
+}
+
+#
+# linux_image extracts the Linux image format from BR2_LINUX_KERNEL_UIMAGE in
+# ${BR_CONFIG}, then prints the corresponding file name for the genimage
+# configuration file
+#
+linux_image()
+{
+	if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
+		echo "\"uImage\""
+	else
+		echo "\"zImage\""
+	fi
+}
+
+main()
+{
+	local FILES="$(dtb_list) $(linux_image)"
+	local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+	local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+	sed -e "s/%FILES%/${FILES}/" \
+		board/freescale/common/mxs/genimage.cfg.template > ${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.7.4

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

* [Buildroot] [PATCH 2/2] configs/imx28evk: Use the common mxs genimage script
  2016-11-06 19:12 [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Fabio Estevam
@ 2016-11-06 19:12 ` Fabio Estevam
  2016-11-06 21:44 ` [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-11-06 19:12 UTC (permalink / raw)
  To: buildroot

Use the common mxs genimage script instead of a custom one.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 board/freescale/imx28evk/genimage.cfg  | 29 -----------------------------
 board/freescale/imx28evk/post-image.sh | 14 --------------
 configs/freescale_imx28evk_defconfig   |  2 +-
 3 files changed, 1 insertion(+), 44 deletions(-)
 delete mode 100644 board/freescale/imx28evk/genimage.cfg
 delete mode 100755 board/freescale/imx28evk/post-image.sh

diff --git a/board/freescale/imx28evk/genimage.cfg b/board/freescale/imx28evk/genimage.cfg
deleted file mode 100644
index 4df432f..0000000
--- a/board/freescale/imx28evk/genimage.cfg
+++ /dev/null
@@ -1,29 +0,0 @@
-image kernel.vfat {
-	vfat {
-		files = {
-		"zImage", "imx28-evk.dtb"
-		}
-	}
-	size = 16M
-}
-
-image sdcard.img {
-	hdimage {
-	}
-	partition boot {
-		partition-type = 0x53
-		image = "u-boot.sd"
-		offset = 1M
-		size = 16M
-	}
-
-	partition kernel {
-		partition-type = 0xC
-		image = "kernel.vfat"
-	}
-
-	partition rootfs {
-		partition-type = 0x83
-		image = "rootfs.ext2"
-	}
-}
diff --git a/board/freescale/imx28evk/post-image.sh b/board/freescale/imx28evk/post-image.sh
deleted file mode 100755
index b4ac460..0000000
--- a/board/freescale/imx28evk/post-image.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-BOARD_DIR="$(dirname $0)"
-GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
-GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
-
-rm -rf "${GENIMAGE_TMP}"
-
-genimage \
-  --rootpath "${TARGET_DIR}" \
-  --tmppath "${GENIMAGE_TMP}" \
-  --inputpath "${BINARIES_DIR}" \
-  --outputpath "${BINARIES_DIR}" \
-  --config "${GENIMAGE_CFG}"
diff --git a/configs/freescale_imx28evk_defconfig b/configs/freescale_imx28evk_defconfig
index 790c338..08d5bd9 100644
--- a/configs/freescale_imx28evk_defconfig
+++ b/configs/freescale_imx28evk_defconfig
@@ -31,4 +31,4 @@ BR2_TARGET_ROOTFS_EXT4=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
-BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/imx28evk/post-image.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/mxs/post-image.sh"
-- 
2.7.4

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

* [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28
  2016-11-06 19:12 [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Fabio Estevam
  2016-11-06 19:12 ` [Buildroot] [PATCH 2/2] configs/imx28evk: Use the common mxs genimage script Fabio Estevam
@ 2016-11-06 21:44 ` Thomas Petazzoni
  2016-11-06 22:06   ` Fabio Estevam
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2016-11-06 21:44 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun,  6 Nov 2016 17:12:14 -0200, Fabio Estevam wrote:
> Add a standard genimage script for the MXS processors (MX23 and MX28).
> 
> Based on the common scripts for the other imx devices:
> board/freescale/common/genimage.cfg.template
> board/freescale/common/post-image.sh
> 
> This makes it easier to add new MX23/MX28 boards configurations into
> Buildroot.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
>  board/freescale/common/mxs/genimage.cfg.template | 39 +++++++++++++++++
>  board/freescale/common/mxs/post-image.sh         | 54 ++++++++++++++++++++++++
>  2 files changed, 93 insertions(+)
>  create mode 100644 board/freescale/common/mxs/genimage.cfg.template
>  create mode 100755 board/freescale/common/mxs/post-image.sh

I've applied both to next. However, we now have this a bit weird
hierarchy:

board/freescale/common/
??? genimage.cfg.template
??? mxs
??? ??? genimage.cfg.template
??? ??? post-image.sh
??? post-image.sh

Perhaps we should move the i.MX genimage.cfg.template and post-image.sh
in an imx/ sub-directory? This means adjusting all the defconfig, but
it can be done mechanically.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28
  2016-11-06 21:44 ` [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Thomas Petazzoni
@ 2016-11-06 22:06   ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-11-06 22:06 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Sun, Nov 6, 2016 at 7:44 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:

> I've applied both to next. However, we now have this a bit weird
> hierarchy:
>
> board/freescale/common/
> ??? genimage.cfg.template
> ??? mxs
> ?   ??? genimage.cfg.template
> ?   ??? post-image.sh
> ??? post-image.sh
>
> Perhaps we should move the i.MX genimage.cfg.template and post-image.sh
> in an imx/ sub-directory? This means adjusting all the defconfig, but
> it can be done mechanically.

Yes, I will prepare a patch that implements this proposal, thanks.

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

end of thread, other threads:[~2016-11-06 22:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-06 19:12 [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Fabio Estevam
2016-11-06 19:12 ` [Buildroot] [PATCH 2/2] configs/imx28evk: Use the common mxs genimage script Fabio Estevam
2016-11-06 21:44 ` [Buildroot] [PATCH 1/2] freescale: Add a standard genimage script for MX23/MX28 Thomas Petazzoni
2016-11-06 22:06   ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox