ソースを参照

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.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[Arnout: change the name of the tmp dir, and remove it before using
it.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Vivien Didelot 8 年 前
コミット
7fce2970ad

+ 32 - 0
board/wandboard/genimage.cfg

@@ -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
+  }
+}

+ 16 - 0
board/wandboard/post-image.sh

@@ -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}

+ 9 - 32
board/wandboard/readme.txt

@@ -1,37 +1,14 @@
-Minimal board support for the Wandboard
+Wandboard
 
-Wandboard's homepage is here: http://www.wandboard.org/
+http://www.wandboard.org
 
-This config is only tested with the dual core wandboard.
+To build a minimal support for this board:
 
-Installing:
+    $ make wandboard_defconfig
+    $ make
 
-You need a micro SD card and a slot/adapter for your development machine.
-
-Partition the SD card leaving at least 1 MB in front of the first partition.
-
-Partition layout (example):
-
-Disk /dev/sdi: 3965 MB, 3965190144 bytes
-255 heads, 63 sectors/track, 482 cylinders
-Units = cylinders of 16065 * 512 = 8225280 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / 512 bytes
-Disk identifier: 0x77b47445
-
-   Device Boot      Start         End      Blocks   Id  System
-/dev/sdi1               2         482     3863632+  83  Linux
-
-Copy u-boot and its environment to the SD card:
-sudo dd if=output/images/u-boot.imx bs=512 seek=2 of=/dev/sd<x>
-sudo dd if=output/images/uboot-env.bin bs=512 seek=768 of=/dev/sd<x>
-
-Copy the root filesystem:
-sudo dd if=output/images/rootfs.ext2 of=/dev/sd<x>1
-
-Alternative commands to copy root filesystem:
-sudo mkfs.ext4 /dev/sd<x>1
-sudo mount /dev/sd<x>1 /mnt
-sudo tar xf output/images/rootfs.tar -C /mnt
-sudo umount /mnt
+Buildroot prepares a bootable "sdcard.img" image in the output/images/
+directory, ready to be dumped on an SD card.
 
+For details about the medium image layout, see the definition in
+board/wandboard/genimage.cfg.

+ 2 - 0
configs/wandboard_defconfig

@@ -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