summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorGeorges Savoundararadj <savoundg@gmail.com>2016-09-07 15:29:08 -0700
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-09-11 23:24:04 +0200
commitf645f914ac026504bfe4f966bfe620cc3f91e04c (patch)
tree07a25489161e003f79cb96da42a7e6700adb7b61 /board
parenta5033dd7facaec3cd8d0d129b1f457a2f55f6d7e (diff)
board/freescale: factorize genimage logic
For the boards imx6ulevk, imx6sabresd, mx25pdk, mx51evk, mx53loco, warpboard: * Replace genimage.cfg with a common Freescale genimage template named genimage.cfg.template because they all use the same layout. The only difference comes from the device tree blobs. * Replace each post-image.sh script with a generic post-image.sh script which is able to generate the right genimage.cfg depending on: ** the image type (zImage or uImage) from BR2_LINUX_KERNEL_UIMAGE ** the device tree blobs from BR2_LINUX_KERNEL_INTREE_DTS_NAME ** the rootfs type (ext2, ext3 or ext4) from BR2_TARGET_ROOTFS_EXT2 * Fix the readme.txt files accordingly Signed-off-by: Georges Savoundararadj <savoundg@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Yann E. MORIN <yann.morin.1998@free.fr> [Thomas: remove handling of rootfs type, using rootfs.ext2 in all cases is fine, rootfs.ext3 and rootfs.ext4 are just symbolic links to it.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'board')
-rw-r--r--board/freescale/common/genimage.cfg.template (renamed from board/freescale/imx25pdk/genimage.cfg)13
-rwxr-xr-xboard/freescale/common/post-image.sh54
-rwxr-xr-xboard/freescale/imx25pdk/post-image.sh14
-rw-r--r--board/freescale/imx25pdk/readme.txt2
-rw-r--r--board/freescale/imx51evk/genimage.cfg41
-rwxr-xr-xboard/freescale/imx51evk/post-image.sh14
-rw-r--r--board/freescale/imx51evk/readme.txt2
-rw-r--r--board/freescale/imx53loco/genimage.cfg42
-rwxr-xr-xboard/freescale/imx53loco/post-image.sh14
-rw-r--r--board/freescale/imx6ulevk/genimage.cfg41
-rwxr-xr-xboard/freescale/imx6ulevk/post-image.sh14
-rw-r--r--board/freescale/imx6ulevk/readme.txt2
-rw-r--r--board/freescale/imx7dsdb/genimage.cfg41
-rwxr-xr-xboard/freescale/imx7dsdb/post-image.sh14
-rw-r--r--board/freescale/imx7dsdb/readme.txt2
-rw-r--r--board/freescale/warpboard/genimage.cfg41
-rwxr-xr-xboard/freescale/warpboard/post-image.sh14
17 files changed, 64 insertions, 301 deletions
diff --git a/board/freescale/imx25pdk/genimage.cfg b/board/freescale/common/genimage.cfg.template
index 9386e3296..acce058b2 100644
--- a/board/freescale/imx25pdk/genimage.cfg
+++ b/board/freescale/common/genimage.cfg.template
@@ -1,17 +1,16 @@
-# Minimal SD card image for the Freescale's i.MX25 PDK board
+# Minimal SD card image for the Freescale boards Template
#
-# We mimic the .sdcard Freescale's image format for i.MX25:
+# We mimic the .sdcard Freescale's image format:
# * the SD card must have 1 kB free space at the beginning,
# * U-Boot is dumped as is,
-# * a FAT partition at offset 8 MB is containing zImage and dtbs,
-# * a single root filesystem partition is required (Ext4 in this case).
+# * a FAT partition at offset 8 MB is containing zImage/uImage and DTB files
+# * a single root filesystem partition is required (ext2, ext3 or ext4)
#
image boot.vfat {
vfat {
files = {
- "imx25-pdk.dtb",
- "zImage"
+ %FILES%
}
}
size = 16M
@@ -36,6 +35,6 @@ image sdcard.img {
partition rootfs {
partition-type = 0x83
- image = "rootfs.ext4"
+ image = "rootfs.ext2"
}
}
diff --git a/board/freescale/common/post-image.sh b/board/freescale/common/post-image.sh
new file mode 100755
index 000000000..7d48550a5
--- /dev/null
+++ b/board/freescale/common/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/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 $@
diff --git a/board/freescale/imx25pdk/post-image.sh b/board/freescale/imx25pdk/post-image.sh
deleted file mode 100755
index b4ac4608f..000000000
--- a/board/freescale/imx25pdk/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/board/freescale/imx25pdk/readme.txt b/board/freescale/imx25pdk/readme.txt
index a154b995f..df7c61726 100644
--- a/board/freescale/imx25pdk/readme.txt
+++ b/board/freescale/imx25pdk/readme.txt
@@ -40,7 +40,7 @@ command as root:
*** WARNING! This will destroy all the card content. Use with care! ***
For details about the medium image layout, see the definition in
-board/freescale/imx25pdk/genimage.cfg.
+board/freescale/common/genimage.cfg.template.
Boot the i.MX25 PDK board
=========================
diff --git a/board/freescale/imx51evk/genimage.cfg b/board/freescale/imx51evk/genimage.cfg
deleted file mode 100644
index a44ed300b..000000000
--- a/board/freescale/imx51evk/genimage.cfg
+++ /dev/null
@@ -1,41 +0,0 @@
-# Minimal SD card image for the Freescale's i.MX51 EVK board
-#
-# We mimic the .sdcard Freescale's image format for i.MX51:
-# * the microSD card must have 1 kB free space at the beginning,
-# * U-Boot is dumped as is,
-# * a FAT partition at offset 8 MB is containing zImage and dtbs,
-# * a single root filesystem partition is required (Ext4 in this case).
-#
-
-image boot.vfat {
- vfat {
- files = {
- "imx51-babbage.dtb",
- "zImage"
- }
- }
- size = 16M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition u-boot {
- in-partition-table = "no"
- image = "u-boot.imx"
- offset = 1024
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- offset = 8M
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/freescale/imx51evk/post-image.sh b/board/freescale/imx51evk/post-image.sh
deleted file mode 100755
index b4ac4608f..000000000
--- a/board/freescale/imx51evk/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/board/freescale/imx51evk/readme.txt b/board/freescale/imx51evk/readme.txt
index 6639a9208..bf739fd65 100644
--- a/board/freescale/imx51evk/readme.txt
+++ b/board/freescale/imx51evk/readme.txt
@@ -40,7 +40,7 @@ command as root:
*** WARNING! This will destroy all the card content. Use with care! ***
For details about the medium image layout, see the definition in
-board/freescale/imx51evk/genimage.cfg.
+board/freescale/common/genimage.cfg.template.
Boot the i.MX51 EVK board
=========================
diff --git a/board/freescale/imx53loco/genimage.cfg b/board/freescale/imx53loco/genimage.cfg
deleted file mode 100644
index b56c1687e..000000000
--- a/board/freescale/imx53loco/genimage.cfg
+++ /dev/null
@@ -1,42 +0,0 @@
-# Minimal microSD card image for the Freescale's i.MX53 QSB board
-#
-# We mimic the .sdcard Freescale's image format for i.MX53:
-# * the microSD card must have 1 kB free space at the beginning,
-# * U-Boot is dumped as is,
-# * a FAT partition at offset 8 MB is containing zImage and dtbs,
-# * a single root filesystem partition is required (Ext4 in this case).
-#
-
-image boot.vfat {
- vfat {
- files = {
- "imx53-qsb.dtb",
- "imx53-qsrb.dtb",
- "zImage"
- }
- }
- size = 16M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition u-boot {
- in-partition-table = "no"
- image = "u-boot.imx"
- offset = 1024
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- offset = 8M
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/freescale/imx53loco/post-image.sh b/board/freescale/imx53loco/post-image.sh
deleted file mode 100755
index b4ac4608f..000000000
--- a/board/freescale/imx53loco/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/board/freescale/imx6ulevk/genimage.cfg b/board/freescale/imx6ulevk/genimage.cfg
deleted file mode 100644
index b58193ae7..000000000
--- a/board/freescale/imx6ulevk/genimage.cfg
+++ /dev/null
@@ -1,41 +0,0 @@
-# Minimal microSD card image for the Freescale's i.MX6UL EVK board
-#
-# We mimic the .sdcard Freescale's image format for i.MX6UL:
-# * the microSD card must have 1 kB free space at the beginning,
-# * U-Boot is dumped as is,
-# * a FAT partition at offset 8 MB is containing zImage and dtbs,
-# * a single root filesystem partition is required (Ext4 in this case).
-#
-
-image boot.vfat {
- vfat {
- files = {
- "imx6ul-14x14-evk.dtb",
- "zImage"
- }
- }
- size = 16M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition u-boot {
- in-partition-table = "no"
- image = "u-boot.imx"
- offset = 1024
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- offset = 8M
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/freescale/imx6ulevk/post-image.sh b/board/freescale/imx6ulevk/post-image.sh
deleted file mode 100755
index b4ac4608f..000000000
--- a/board/freescale/imx6ulevk/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/board/freescale/imx6ulevk/readme.txt b/board/freescale/imx6ulevk/readme.txt
index 462715c18..98de2775d 100644
--- a/board/freescale/imx6ulevk/readme.txt
+++ b/board/freescale/imx6ulevk/readme.txt
@@ -43,7 +43,7 @@ command as root:
*** WARNING! This will destroy all the card content. Use with care! ***
For details about the medium image layout, see the definition in
-board/freescale/imx6ulevk/genimage.cfg.
+board/freescale/common/genimage.cfg.template.
Boot the i.MX6UL EVK board
=========================
diff --git a/board/freescale/imx7dsdb/genimage.cfg b/board/freescale/imx7dsdb/genimage.cfg
deleted file mode 100644
index aa6ae9e21..000000000
--- a/board/freescale/imx7dsdb/genimage.cfg
+++ /dev/null
@@ -1,41 +0,0 @@
-# Minimal microSD card image for the Freescale's i.MX7D SDB board
-#
-# We mimic the .sdcard Freescale's image format for i.MX7D:
-# * the microSD card must have 1 kB free space at the beginning,
-# * U-Boot is dumped as is,
-# * a FAT partition at offset 8 MB is containing zImage and dtbs,
-# * a single root filesystem partition is required (Ext4 in this case).
-#
-
-image boot.vfat {
- vfat {
- files = {
- "imx7d-sdb.dtb",
- "zImage"
- }
- }
- size = 16M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition u-boot {
- in-partition-table = "no"
- image = "u-boot.imx"
- offset = 1024
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- offset = 8M
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/freescale/imx7dsdb/post-image.sh b/board/freescale/imx7dsdb/post-image.sh
deleted file mode 100755
index b4ac4608f..000000000
--- a/board/freescale/imx7dsdb/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/board/freescale/imx7dsdb/readme.txt b/board/freescale/imx7dsdb/readme.txt
index c72e9a979..9aeeb166d 100644
--- a/board/freescale/imx7dsdb/readme.txt
+++ b/board/freescale/imx7dsdb/readme.txt
@@ -40,7 +40,7 @@ command as root:
*** WARNING! This will destroy all the card content. Use with care! ***
For details about the medium image layout, see the definition in
-board/freescale/imx7dsdb/genimage.cfg.
+board/freescale/common/genimage.cfg.template.
Boot the i.MX7D SDB board
=========================
diff --git a/board/freescale/warpboard/genimage.cfg b/board/freescale/warpboard/genimage.cfg
deleted file mode 100644
index a22aa2a08..000000000
--- a/board/freescale/warpboard/genimage.cfg
+++ /dev/null
@@ -1,41 +0,0 @@
-# Minimal SD card image for the Warp board
-#
-# We mimic the .sdcard Freescale's image format for i.MX6SL:
-# * the microSD card must have 1 kB free space at the beginning,
-# * U-Boot is dumped as is,
-# * a FAT partition at offset 8 MB is containing zImage and dtbs,
-# * a single root filesystem partition is required (Ext4 in this case).
-#
-
-image boot.vfat {
- vfat {
- files = {
- "imx6sl-warp.dtb",
- "zImage"
- }
- }
- size = 16M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition u-boot {
- in-partition-table = "no"
- image = "u-boot.imx"
- offset = 1024
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- offset = 8M
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/freescale/warpboard/post-image.sh b/board/freescale/warpboard/post-image.sh
deleted file mode 100755
index b4ac4608f..000000000
--- a/board/freescale/warpboard/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}"