All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/4] board/minnowboard-max: Rework to generate SD card image
Date: Tue, 12 Apr 2016 02:29:22 -0300	[thread overview]
Message-ID: <1460438965-28065-2-git-send-email-ezequiel@vanguardiasur.com.ar> (raw)
In-Reply-To: <1460438965-28065-1-git-send-email-ezequiel@vanguardiasur.com.ar>

Let's rework the board and config files to use genimage
to generate the SD card image directly.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 board/minnowboard-max/genimage.cfg  | 34 ++++++++++++++++++++++++++++++++
 board/minnowboard-max/post-image.sh | 13 +++++++++++++
 board/minnowboard-max/readme.txt    | 39 ++++++++++++-------------------------
 configs/minnowboard_max_defconfig   |  8 ++++++++
 4 files changed, 67 insertions(+), 27 deletions(-)
 create mode 100644 board/minnowboard-max/genimage.cfg
 create mode 100755 board/minnowboard-max/post-image.sh

diff --git a/board/minnowboard-max/genimage.cfg b/board/minnowboard-max/genimage.cfg
new file mode 100644
index 000000000000..6cf787430752
--- /dev/null
+++ b/board/minnowboard-max/genimage.cfg
@@ -0,0 +1,34 @@
+# Create an image of the efi partition
+image efi-part.vfat {
+	vfat {
+		file startup.nsh {
+			image = "efi-part/startup.nsh"
+		}
+		file EFI {
+			image = "efi-part/EFI"
+		}
+		file bzImage {
+			image = "bzImage"
+		}
+	}
+	size=10M
+}
+
+# Create the sdcard image, pulling in
+#  * the image created by buildroot
+#  * the efi-partition created above
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xEF
+		image = "efi-part.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
diff --git a/board/minnowboard-max/post-image.sh b/board/minnowboard-max/post-image.sh
new file mode 100755
index 000000000000..e90dd6b8cf10
--- /dev/null
+++ b/board/minnowboard-max/post-image.sh
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+
+GENIMAGE_CFG="board/minnowboard-max/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}"
diff --git a/board/minnowboard-max/readme.txt b/board/minnowboard-max/readme.txt
index 5f52369b97d6..dfad2aba2123 100644
--- a/board/minnowboard-max/readme.txt
+++ b/board/minnowboard-max/readme.txt
@@ -1,40 +1,25 @@
-Prepare the SD card for the Minnow Board MAX
+How to get started with the Minnow Board MAX
 ============================================
 
- 1. Partition the SD card with a GPT partition table
+1. Build
 
-    sudo cgdisk /dev/mmcblk0
+  Apply the defconfig:
 
-    Create two partitions:
+  $ make minnowboard_max_defconfig
 
-     a) First partition of a few dozens of megabytes, which will be
-        used to store the bootloader and the kernel image. Type must
-        be EF00 (EFI partition).
+  Add any additional packages required and build:
 
-     b) Second partition of any size, which will be used to store the
-        root filesystem. Type must be 8300 (Linux filesystem)
+  $ make
 
- 2. Prepare the boot partition
+2. Write the SD card
 
-    We will format it, mount it, copy the EFI data generated by
-    Buildroot, and the kernel image.
+  The build process will create a SD card image in output/images.
+  Write the image to an mSD card, insert into the Minnowboard MAX
+  and power the board on.
 
-    sudo mkfs.vfat -F 32 -n boot /dev/mmcblk0p1
-    sudo mount /dev/mmcblk0p1 /mnt
-    sudo cp -a output/images/efi-part/* /mnt/
-    sudo cp output/images/bzImage /mnt/
-    sudo umount /mnt
+  $ dd if=output/images/sdcard.img of=/dev/mmcblk0; sync
 
- 3. Prepare the root partition
-
-    We will format it, mount it, and extract the root filesystem.
-
-    sudo mkfs.ext4 -L root /dev/mmcblk0p2
-    sudo mount /dev/mmcblk0p2 /mnt
-    sudo tar -C /mnt -xf output/images/rootfs.tar
-    sudo umount /mnt
-
- 4. Enjoy
+3. Enjoy
 
 Additional information about this board can be found at
 http://www.minnowboard.org/ or http://wiki.minnowboard.org/MinnowBoard_MAX
diff --git a/configs/minnowboard_max_defconfig b/configs/minnowboard_max_defconfig
index 98996db958ff..47f7d4e96a55 100644
--- a/configs/minnowboard_max_defconfig
+++ b/configs/minnowboard_max_defconfig
@@ -5,9 +5,12 @@ BR2_x86_atom=y
 # Misc
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/minnowboard-max/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/minnowboard-max/post-image.sh"
 
 # Linux headers same as kernel, a 4.4 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
 
 # Needed for ethernet
 BR2_PACKAGE_LINUX_FIRMWARE=y
@@ -23,3 +26,8 @@ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/minnowboard-max/linux.config"
 # Bootloader
 BR2_TARGET_GRUB2=y
 BR2_TARGET_GRUB2_X86_64_EFI=y
+
+# Filesystem image
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+# BR2_TARGET_ROOTFS_TAR is not set
-- 
2.7.0

  reply	other threads:[~2016-04-12  5:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12  5:29 [Buildroot] [PATCH 0/4] Fun with Minnowboard Turot Ezequiel Garcia
2016-04-12  5:29 ` Ezequiel Garcia [this message]
2016-04-12 23:21   ` [Buildroot] [PATCH 1/4] board/minnowboard-max: Rework to generate SD card image Arnout Vandecappelle
2016-04-13 19:59     ` Peter Korsgaard
2016-04-13 20:05       ` Ezequiel Garcia
2016-04-13 20:39   ` Peter Korsgaard
2016-04-12  5:29 ` [Buildroot] [PATCH 2/4] board/minnowboard: " Ezequiel Garcia
2016-04-12 23:24   ` Arnout Vandecappelle
2016-04-12 23:56     ` Ezequiel Garcia
2016-04-12  5:29 ` [Buildroot] [PATCH 3/4] board/minnowboard-max: Add more peripherals and features to the kernel Ezequiel Garcia
2016-04-12 23:29   ` Arnout Vandecappelle
2016-04-12 23:55     ` Ezequiel Garcia
2016-04-13 21:02       ` Peter Korsgaard
2016-04-13 22:02         ` Ezequiel Garcia
2016-04-12  5:29 ` [Buildroot] [PATCH 4/4] board/minnowboard-max: Add a X-based graphical defconfig Ezequiel Garcia
2016-04-12 23:41   ` Arnout Vandecappelle
2016-04-13  0:02     ` Ezequiel Garcia
2016-04-13  7:38       ` Arnout Vandecappelle
2016-04-13 21:02     ` Peter Korsgaard

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=1460438965-28065-2-git-send-email-ezequiel@vanguardiasur.com.ar \
    --to=ezequiel@vanguardiasur.com.ar \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.