Skip to contentSkip to conversation

board/wandboard: add a genimage config

PATCH New Vivien Didelot 3 participants 3 messages Apr 17, 2015 – Jul 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/wandboard: add a genimage config

This patch adds a genimage config file and a post-image script for the Wandboard, to generate a medium image "sdcard.img", ready to be booted. The image contains the layout explained in the board readme.txt file:
U-Boot, its environment, and an Ext2 rootfs partition.

The defconfig has been slightly changed to enable this feature. Also lighten the readme file since the config file is documented and simpler.

Tested on a Wandboard Solo.

---
 board/wandboard/genimage.cfg  | 32 ++++++++++++++++++++++++++++++++
 board/wandboard/post-image.sh | 15 +++++++++++++++
 board/wandboard/readme.txt    | 41 +++++++++--------------------------------
 configs/wandboard_defconfig   |  2 ++
 4 files changed, 58 insertions(+), 32 deletions(-)
 create mode 100644 board/wandboard/genimage.cfg
 create mode 100755 board/wandboard/post-image.sh
board/wandboard/genimage.cfg new file +32 -0
new file mode 100644
index 0000000..24c4049
@@ -0,0 +1,32 @@
+# Minimal SD card image for the Wandboard
+#
+# The SD card must have at least 1 MB free at the beginning.
+# U-Boot and its environment are dumped as is.
+# A single root filesystem partition is required (Ext2 in this case).
+#
+# For details about the layout, see:
+# http://wiki.wandboard.org/index.php/Boot-process
+
+image sdcard.img {
+  hdimage {
+  }
+
+  partition u-boot {
+    in-partition-table = "no"
+    image = "u-boot.imx"
+    offset = 1024
+  }
+
+  partition u-boot-env {
+    in-partition-table = "no"
+    image = "uboot-env.bin"
+    offset = 393216
+    size = 8192
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+    size = 512M
+  }
+}
board/wandboard/post-image.sh new file +15 -0
new file mode 100755
index 0000000..8d224c9
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+GENIMAGE_CFG="board/wandboard/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/.genimage_tmp"
+
+genimage \
+  --rootpath "${TARGET_DIR}" \
+  --tmppath "${GENIMAGE_TMP}" \
+  --inputpath "${BINARIES_DIR}" \
+  --outputpath "${BINARIES_DIR}" \
+  --config "${GENIMAGE_CFG}"
+
+RET=${?}
+rm -rf "${GENIMAGE_TMP}"
+exit ${RET}
board/wandboard/readme.txt +9 -32

46 lines not on this page · raw message

configs/wandboard_defconfig +2 -0
index 0a6ba50..5d74fc3 100644
@@ -4,6 +4,8 @@ BR2_KERNEL_HEADERS_VERSION=y
 BR2_DEFAULT_KERNEL_VERSION="3.0.101"
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_0=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/wandboard/post-image.sh"
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_UBOOT=y
Signature · 1 line
2.3.5
#1 lore raw

PATCH v3 1/1 board/wandboard: add a genimage config

From: Vivien Didelot <[email protected]>

This patch adds a genimage config file and a post-image script for the Wandboard, to generate a medium image "sdcard.img", ready to be booted. The image contains the layout explained in the board readme.txt file:
U-Boot, its environment, and an Ext2 rootfs partition.

The defconfig has been slightly changed to enable this feature. Also lighten the readme file since the config file is documented and simpler.

Tested on a Wandboard Solo.

[Arnout: change the name of the tmp dir, and remove it before using it.]
---
v3 [Arnout]
- Change the name of the tmp dir to genimage.tmp, which is more consistent with other names we use e.g. for iso9660.
- Remove the tmp dir before running genimage instead of after. We normally don't remove any (partial) build artefacts, but on the other hand genimage barfs if the directory exists already.

---
 board/wandboard/genimage.cfg  | 32 ++++++++++++++++++++++++++++++++
 board/wandboard/post-image.sh | 16 ++++++++++++++++
 board/wandboard/readme.txt    | 41 +++++++++--------------------------------
 configs/wandboard_defconfig   |  2 ++
 4 files changed, 59 insertions(+), 32 deletions(-)
 create mode 100644 board/wandboard/genimage.cfg
 create mode 100755 board/wandboard/post-image.sh
board/wandboard/genimage.cfg new file +32 -0
new file mode 100644
index 0000000..24c4049
@@ -0,0 +1,32 @@
+# Minimal SD card image for the Wandboard
+#
+# The SD card must have at least 1 MB free at the beginning.
+# U-Boot and its environment are dumped as is.
+# A single root filesystem partition is required (Ext2 in this case).
+#
+# For details about the layout, see:
+# http://wiki.wandboard.org/index.php/Boot-process
+
+image sdcard.img {
+  hdimage {
+  }
+
+  partition u-boot {
+    in-partition-table = "no"
+    image = "u-boot.imx"
+    offset = 1024
+  }
+
+  partition u-boot-env {
+    in-partition-table = "no"
+    image = "uboot-env.bin"
+    offset = 393216
+    size = 8192
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+    size = 512M
+  }
+}
board/wandboard/post-image.sh new file +16 -0
new file mode 100755
index 0000000..7c90271
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+GENIMAGE_CFG="board/wandboard/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}"
+
+RET=${?}
+exit ${RET}
board/wandboard/readme.txt +9 -32

46 lines not on this page · raw message

configs/wandboard_defconfig +2 -0
index 0a6ba50..5d74fc3 100644
@@ -4,6 +4,8 @@ BR2_KERNEL_HEADERS_VERSION=y
 BR2_DEFAULT_KERNEL_VERSION="3.0.101"
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_0=y
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/wandboard/post-image.sh"
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_UBOOT=y
Signature · 1 line
2.1.4
#2 lore raw

PATCH v3 1/1 board/wandboard: add a genimage config

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 23 lines · Arnout Vandecappelle (Essensium/Mind)

From: Vivien Didelot <[email protected]>

This patch adds a genimage config file and a post-image script for the Wandboard, to generate a medium image "sdcard.img", ready to be booted. The image contains the layout explained in the board readme.txt file:
U-Boot, its environment, and an Ext2 rootfs partition.

The defconfig has been slightly changed to enable this feature. Also lighten the readme file since the config file is documented and simpler.

Tested on a Wandboard Solo.

[Arnout: change the name of the tmp dir, and remove it before using it.]
---
v3 [Arnout]
- Change the name of the tmp dir to genimage.tmp, which is more consistent with other names we use e.g. for iso9660.
- Remove the tmp dir before running genimage instead of after. We normally don't remove any (partial) build artefacts, but on the other hand genimage barfs if the directory exists already.

Quoted 8 lines
---
 board/wandboard/genimage.cfg  | 32 ++++++++++++++++++++++++++++++++
 board/wandboard/post-image.sh | 16 ++++++++++++++++
 board/wandboard/readme.txt    | 41 +++++++++--------------------------------
 configs/wandboard_defconfig   |  2 ++
 4 files changed, 59 insertions(+), 32 deletions(-)
 create mode 100644 board/wandboard/genimage.cfg
 create mode 100755 board/wandboard/post-image.sh

Applied, thanks.

Thomas

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