From: Alexandre Gambier <agambier.dev@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/9] iMX6S-PICO: add post image scripts
Date: Wed, 11 Oct 2017 14:19:32 +0200 [thread overview]
Message-ID: <1507724378-23461-3-git-send-email-agambier.dev@gmail.com> (raw)
In-Reply-To: <1507724378-23461-1-git-send-email-agambier.dev@gmail.com>
Signed-off-by: Alexandre Gambier <agambier.dev@gmail.com>
---
board/technexion/imx6spico/genimage.cfg.template | 40 ++++++++++++++++++
board/technexion/imx6spico/post-image.sh | 54 ++++++++++++++++++++++++
2 files changed, 94 insertions(+)
create mode 100644 board/technexion/imx6spico/genimage.cfg.template
create mode 100755 board/technexion/imx6spico/post-image.sh
diff --git a/board/technexion/imx6spico/genimage.cfg.template b/board/technexion/imx6spico/genimage.cfg.template
new file mode 100644
index 0000000..45450a9
--- /dev/null
+++ b/board/technexion/imx6spico/genimage.cfg.template
@@ -0,0 +1,40 @@
+# Minimal SD card image for the Freescale boards Template
+#
+# 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/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 {
+ in-partition-table = "no"
+ image = "SPL"
+ offset = 1024
+ }
+
+ partition boot {
+ partition-type = 0xC
+ bootable = "true"
+ image = "boot.vfat"
+ offset = 8M
+ }
+
+ partition rootfs {
+ partition-type = 0x83
+ image = "rootfs.ext2"
+ }
+}
diff --git a/board/technexion/imx6spico/post-image.sh b/board/technexion/imx6spico/post-image.sh
new file mode 100755
index 0000000..52b423a
--- /dev/null
+++ b/board/technexion/imx6spico/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="imx6dl-pico_dwarf"
+
+ 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), \"u-boot.img\""
+ local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
+ local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+ sed -e "s/%FILES%/${FILES}/" \
+ board/technexion/imx6spico/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
next prev parent reply other threads:[~2017-10-11 12:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 12:19 [Buildroot] [PATCH 1/9] iMX6S-PICO: add default config file (imx6spico_defconfig) Alexandre Gambier
2017-10-11 12:19 ` [Buildroot] [PATCH 2/9] iMX6S-PICO: add linux default config file (defconfig) Alexandre Gambier
2017-10-11 12:19 ` Alexandre Gambier [this message]
2017-10-11 12:19 ` [Buildroot] [PATCH 4/9] iMX6S-PICO: add firmware files (nvram*) Alexandre Gambier
2017-10-11 12:19 ` [Buildroot] [PATCH 5/9] iMX6S-PICO: add firmware files (bcm*) Alexandre Gambier
2017-10-11 12:19 ` [Buildroot] [PATCH 6/9] iMX6S-PICO: add firmware files (bcmfmac*) Alexandre Gambier
2017-10-11 13:14 ` [Buildroot] [PATCH 1/9] iMX6S-PICO: add default config file (imx6spico_defconfig) Thomas Petazzoni
2017-10-11 16:34 ` Arnout Vandecappelle
2017-10-11 13:17 ` Thomas Petazzoni
[not found] ` <CAKrb2srEz1UeT-RJgY7NCEDp28OX7xGq=JD5qOvR_eZBkkahKg@mail.gmail.com>
[not found] ` <20171011164908.3cc14130@windsurf.lan>
[not found] ` <CAKrb2soZLWtymDeToLxPmk=Vtdt0E+wT5KHMcCa6x-BLukSCaQ@mail.gmail.com>
2017-10-11 15:34 ` Thomas Petazzoni
2017-10-11 16:04 ` Fabio Estevam
2017-10-11 16:06 ` Fabio Estevam
2017-10-11 16:26 ` Arnout Vandecappelle
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=1507724378-23461-3-git-send-email-agambier.dev@gmail.com \
--to=agambier.dev@gmail.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