configs: mx53loco: use genimage to generate sdcard image
authorFabio Estevam <festevam@gmail.com>
Thu, 26 May 2016 19:28:31 +0000 (16:28 -0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 31 May 2016 19:27:47 +0000 (21:27 +0200)
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
board/freescale/imx53loco/create-boot-sd.sh [deleted symlink]
board/freescale/imx53loco/genimage.cfg [new file with mode: 0644]
board/freescale/imx53loco/post-image.sh [new file with mode: 0644]
configs/mx53loco_defconfig

diff --git a/board/freescale/imx53loco/create-boot-sd.sh b/board/freescale/imx53loco/create-boot-sd.sh
deleted file mode 120000 (symlink)
index d45d639..0000000
+++ /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 (file)
index 0000000..b56c168
--- /dev/null
@@ -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 (file)
index 0000000..8757355
--- /dev/null
@@ -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 $?
index e461f7a16c52290a0dee15c585e96adc7469a322..b62172cbc797f1cb891a4049b8b3964c1724b2a7 100644 (file)
@@ -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