Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/3] imx53loco: Use common script for generating sdcard image
Date: Wed, 25 May 2016 17:16:08 -0300	[thread overview]
Message-ID: <1464207368-22532-3-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1464207368-22532-1-git-send-email-festevam@gmail.com>

Use the common script used by other i.mx boards to generate the sdcard image.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 board/freescale/imx53loco/create-boot-sd.sh |  1 -
 board/freescale/imx53loco/genimage.cfg      | 42 +++++++++++++++++++++++++++++
 board/freescale/imx53loco/post-image.sh     | 16 +++++++++++
 configs/mx53loco_defconfig                  |  6 +++++
 4 files changed, 64 insertions(+), 1 deletion(-)
 delete mode 120000 board/freescale/imx53loco/create-boot-sd.sh
 create mode 100644 board/freescale/imx53loco/genimage.cfg
 create mode 100644 board/freescale/imx53loco/post-image.sh

diff --git a/board/freescale/imx53loco/create-boot-sd.sh b/board/freescale/imx53loco/create-boot-sd.sh
deleted file mode 120000
index d45d639..0000000
--- a/board/freescale/imx53loco/create-boot-sd.sh
+++ /dev/null
@@ -1 +0,0 @@
-../create-boot-sd.sh
\ No newline at end of file
diff --git a/board/freescale/imx53loco/genimage.cfg b/board/freescale/imx53loco/genimage.cfg
new file mode 100644
index 0000000..b56c168
--- /dev/null
+++ b/board/freescale/imx53loco/genimage.cfg
@@ -0,0 +1,42 @@
+# 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
new file mode 100644
index 0000000..8757355
--- /dev/null
+++ b/board/freescale/imx53loco/post-image.sh
@@ -0,0 +1,16 @@
+#!/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}"
+
+exit $?
diff --git a/configs/mx53loco_defconfig b/configs/mx53loco_defconfig
index e461f7a..b62172c 100644
--- a/configs/mx53loco_defconfig
+++ b/configs/mx53loco_defconfig
@@ -11,7 +11,13 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
 # patches
 BR2_GLOBAL_PATCH_DIR="board/freescale/imx53loco/patches/"
 
+# required tools to create the SD card image
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+
 # Filesystem
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/imx53loco/post-image.sh"
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 
-- 
1.9.1

  parent reply	other threads:[~2016-05-25 20:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 20:16 [Buildroot] [PATCH 1/3] configs: mx53loco: Update bootloader and kernel versions Fabio Estevam
2016-05-25 20:16 ` [Buildroot] [PATCH 2/3] configs: mx53loco: Extend to ext4 type Fabio Estevam
2016-05-25 20:16 ` Fabio Estevam [this message]
2016-05-26  3:25 ` [Buildroot] [PATCH 1/3] configs: mx53loco: Update bootloader and kernel versions Baruch Siach

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=1464207368-22532-3-git-send-email-festevam@gmail.com \
    --to=festevam@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