[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Providing (armhf) u-boot images together with d-i images?



On Thu, Dec 18, 2014 at 07:28:45PM +0100, Karsten Merker wrote:
> On Wed, Dec 03, 2014 at 03:10:37PM -0800, Vagrant Cascadian wrote:
> > On 2014-12-03, Karsten Merker wrote:
> > > several armhf systems do not have u-boot (or another firmware) in
> > > non-volatile (i.e. ROM/Flash) memory, but instead store their
> > > system firmware on a removable medium such as an SD card.
> > ...
> > > Debian provides appropriate u-boot images for several supported
> > > systems in the u-boot-{exynos,imx,omap,sunxi} packages, but those
> > > are not easily accessible to somebody who does not already run a
> > > Debian/armhf system (or at least Debian on another architecture),
> > > so I am wondering whether we should offer these u-boot images
> > > (in unpacked form) together with the d-i images, similar to what
> > > we do with the device-tree files extracted from the linux-image
> > > package.
> [snip]
> > For images such as hd-media, we'd ideally want to provide complete
> > u-boot + kernel + initrd ( + gtk initrd) images, which would grow each
> > image considerably.
> [snip] 
> > I'd be happy to put a bit more time into it, especially if we can get
> > support in for Jessie's debian-installer.
[snip]
> just to avoid double work: I have recently started working on implementing
> image building support (both for "bare" u-boot images as well as for "full"
> images with u-boot + kernel + initrd) and I hope to find some time over
> Christmas to finish a working prototype.

Attached is a set of patches to implement building bootable
d-i images for armhf systems.  It offers various options:

- provide binary "u-boot-only" images for people who want to
  manually install u-boot and e.g. run the rest of the setup via
  tftpboot

- build "full" installer images in the variants netboot und
  hd-media, which contain u-boot, kernel, initrd and dtbs.

- build "concatenateable" installer images in the variants
  netboot and hd-media.  These have the same contents as the
  "full" images but are split into a device-specific and a
  device-independent part to save space and must be decompressed
  and then concatenated together by the user.

For testing purposes all options are enabled in the attached
patchset.  In the end we should decide which ones we actually
want to enable for production use, as it does not make sense to
build both the "full" and "concatenateable" variants.

If space and bandwidth are not much of an issue, I would propose
providing the "u-boot-only" and "full" image targets, as they are
the easiest for the end user and can also be handled on Windows
systems without problems.  If space and bandwidth use is too high
for the "full" images, we could use the "concatenateable"
variant, although this makes installing the images more
complicated for the end user and is only possible if we can
manage to boot _all_ armhf platforms with a single boot script,
as this boot script is in the device-independent part. The
latter is a point that still needs checking and for which I need
testers who have access to the respective systems.

I would like to commit the patches to the d-i git so that
testers can give images generated from the daily builds a try.
I would enable the "u-boot-only" and "full" targets for the daily
builds in this case.  If the full targets work properly on all
platforms, we can then think about whether we would like to
replace the "full" variant by the "concatenateable" variant.

@Kibi, is that ok for you?

Regards,
Karsten

P.S: I hope I have added all necessary dependencies to the
     control file - checking them by building d-i in pbuilder
     does not work as d-i requires network access during the
     build.
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.
>From 43bd59363968d603d44f72db7f854575f8699750 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sun, 21 Dec 2014 19:22:56 +0100
Subject: [PATCH 1/6] Add boot/arm/u-boot-image-config

The file boot/arm/u-boot-image-config contains the information
which u-boot components must be written to which offsets on the
disk to create a bootable image for various arm-based systems.
---
 build/boot/arm/u-boot-image-config | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 build/boot/arm/u-boot-image-config

diff --git a/build/boot/arm/u-boot-image-config b/build/boot/arm/u-boot-image-config
new file mode 100644
index 0000000..1d0208a
--- /dev/null
+++ b/build/boot/arm/u-boot-image-config
@@ -0,0 +1,21 @@
+# U-Boot SPL/TPL files and offsets for various platforms
+#
+# Line format (offsets are given in blocks of 512 Bytes):
+# platform_name SPL_filename SPL_offset TPL_filename TPL_offset
+#
+# Images from u-boot-imx
+MX53LOCO /usr/lib/u-boot/mx53loco/u-boot.imx 2
+MX6_Cubox-i /usr/lib/u-boot/mx6_cubox-i/SPL 2 /usr/lib/u-boot/mx6_cubox-i/u-boot.img 84
+Wandboard_Quad /usr/lib/u-boot/wandboard_quad/u-boot.imx 2
+#
+# Images from u-boot-omap
+BeagleBoneBlack /usr/lib/u-boot/am335x_boneblack/MLO 256 /usr/lib/u-boot/am335x_boneblack/u-boot.img 768
+PandaBoard /usr/lib/u-boot/am335x_boneblack/MLO 256 /usr/lib/u-boot/omap4_panda/u-boot.bin 768
+#
+# Images from u-boot-sunxi
+A10-OLinuXino-Lime /usr/lib/u-boot/A10-OLinuXino-Lime/u-boot-sunxi-with-spl.bin 16
+A20-OLinuXino-Lime /usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin 16
+BananaPi /usr/lib/u-boot/Bananapi/u-boot-sunxi-with-spl.bin 16
+Cubieboard /usr/lib/u-boot/Cubieboard/u-boot-sunxi-with-spl.bin 16
+Cubieboard2 /usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin 16
+Cubietruck /usr/lib/u-boot/Cubietruck/u-boot-sunxi-with-spl.bin 16
-- 
2.1.4

>From 149956b9ebf254722fc20f3ad9a4f8db48fdef27 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sun, 21 Dec 2014 21:46:18 +0100
Subject: [PATCH 2/6] Provide u-boot binaries for armhf systems without u-boot
 in flash.

---
 build/config/armhf.cfg        |  2 +-
 build/config/armhf/u-boot.cfg | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 build/config/armhf/u-boot.cfg

diff --git a/build/config/armhf.cfg b/build/config/armhf.cfg
index 1332c3a..73cdf39 100644
--- a/build/config/armhf.cfg
+++ b/build/config/armhf.cfg
@@ -1,4 +1,4 @@
-MEDIUM_SUPPORTED = hd-media netboot network-console netboot-gtk device-tree
+MEDIUM_SUPPORTED = hd-media netboot network-console netboot-gtk device-tree u-boot
 
 MKLIBS = mklibs --ldlib=/lib/ld-linux-armhf.so.3
 
diff --git a/build/config/armhf/u-boot.cfg b/build/config/armhf/u-boot.cfg
new file mode 100644
index 0000000..cb5338a
--- /dev/null
+++ b/build/config/armhf/u-boot.cfg
@@ -0,0 +1,26 @@
+MEDIA_TYPE = u-boot binaries
+
+TARGET = u-boot-binaries
+EXTRANAME = $(MEDIUM)/
+
+.PHONY: u-boot-binaries
+u-boot-binaries:
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/
+	while read LINE; \
+	do \
+	  if [ -n "$${LINE}" ] && ! echo $${LINE}|grep -q -e "^#"; then \
+	    set -- $${LINE}; \
+	    mkdir -p "$(SOME_DEST)/$(EXTRANAME)/$$1"; \
+	    if [ -n "$$2" ]; then \
+	      cp "$$2" "$(SOME_DEST)/$(EXTRANAME)/$$1/"; \
+	      dd if="$$2" of="$(SOME_DEST)/$(EXTRANAME)/$$1/$$1.sdcard.img" bs=512 seek="$$3"; \
+	      gzip -9 "$(SOME_DEST)/$(EXTRANAME)/$$1/$$2"; \
+	    fi; \
+	    if [ -n "$$4" ]; then \
+	      cp "$$4" "$(SOME_DEST)/$(EXTRANAME)/$$1/"; \
+	      dd if="$$4" of="$(SOME_DEST)/$(EXTRANAME)/$$1/$$1.sdcard.img" bs=512 seek="$$5" conv=notrunc; \
+	      gzip -9 "$(SOME_DEST)/$(EXTRANAME)/$$1/$$4"; \
+	    fi; \
+	    gzip -9 "$(SOME_DEST)/$(EXTRANAME)/$$1/$$1.sdcard.img"; \
+	  fi ;\
+	done < boot/arm/u-boot-image-config
-- 
2.1.4

>From 7efd17056a1a5b2363945e0efc10db7dadc86cb7 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 19:04:15 +0100
Subject: [PATCH 3/6] Add utils/gen-hd-image

gen-hd-image creates partitioned harddisk images from a directory
tree and optionally installs a bootloader into the image. Supported
target filesystems are fat16, fat32 and ext2.

Its main use is building bootable images for armhf/armel/arm64
systems which use u-boot as their system firmware.  U-boot
requires the boot device to have an MBR-style partition table,
therefore booting from "supperfloppy" style images (like they
are built by d-i for i386/amd64 systems) does not work there.
---
 build/util/gen-hd-image | 378 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 378 insertions(+)
 create mode 100755 build/util/gen-hd-image

diff --git a/build/util/gen-hd-image b/build/util/gen-hd-image
new file mode 100755
index 0000000..29d2116
--- /dev/null
+++ b/build/util/gen-hd-image
@@ -0,0 +1,378 @@
+#!/bin/sh
+#
+# gen-hd-image V1.00
+# Copyright 2014 by Karsten Merker <merker@debian.org>
+#
+# This file is dual-licensed. It is provided under (at your option)
+# either the terms of the GPL2+ or the terms of the X11 license as
+# described below.  Note that this dual licensing only applies to this
+# file, and not this project as a whole.
+#
+# License options:
+#
+# - Option "GPL2+":
+#
+#   This program is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU General Public License as
+#   published by the Free Software Foundation; either version 2 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+#   MA 02110-1301 USA
+#
+#   On Debian systems, the full text of the GPL version 2 is
+#   available in the file /usr/share/common-licenses/GPL-2.
+#
+# - or, alternatively, option "X11":
+#
+#   Permission is hereby granted, free of charge, to any person
+#   obtaining a copy of this software and associated documentation
+#   files (the "Software"), to deal in the Software without
+#   restriction, including without limitation the rights to use,
+#   copy, modify, merge, publish, distribute, sublicense, and/or
+#   sell copies of the Software, and to permit persons to whom the
+#   Software is furnished to do so, subject to the following
+#   conditions:
+#
+#   The above copyright notice and this permission notice shall be
+#   included in all copies or substantial portions of the Software.
+#
+#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+#   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+#   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+#   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+#   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+#   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+#   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+#   OTHER DEALINGS IN THE SOFTWARE.
+
+PATH="${PATH}:/bin:/sbin:/usr/bin:/usr/sbin"
+export PATH
+
+FSTYPE="fat32"
+PARTID="0x0c"
+FATSIZE="32"
+BUILDTYPE="complete"
+SOURCEDIR="."
+PARTOFFSET="2048"
+DEFAULT_IMAGESIZE="976560" # default d-i FLOPPY_SIZE for hd-media images
+IMAGESIZE="${DEFAULT_IMAGESIZE}"
+COMPRESS="none"
+VERBOSITY="0"
+PREREQUISITES="fmt sfdisk"
+PREREQUISITES_MISSING=""
+
+log()
+{
+  if [ "${VERBOSITY}" -gt 0 ]; then
+    echo "$(basename $0): $1"
+  fi
+}
+
+error()
+{
+  echo "$(basename $0): $1" 1>&2
+}
+
+clean_tempfiles()
+{
+  [ -f "${TEMP_FS_IMAGEFILE}" ] && rm -f "${TEMP_FS_IMAGEFILE}"
+  [ -f "${TEMP_HD_IMAGEFILE}" ] && rm -f "${TEMP_HD_IMAGEFILE}"
+}
+
+check_prerequisites()
+{
+  for TOOL in $1
+  do
+    which >/dev/null ${TOOL}
+    if [ ! "$?" -eq 0 ]; then
+      PREREQUISITES_MISSING="${PREREQUISITES_MISSING}${TOOL} "
+    fi
+  done
+  if [ -n "${PREREQUISITES_MISSING}" ]; then
+    error "ERROR: The following programs are unavailable, but required"
+    error "ERROR: for the selected options: ${PREREQUISITES_MISSING}"
+    error "ERROR: Exiting."
+    exit 1
+  fi
+}
+
+usage()
+{
+  fmt -w 75 -s <<EOF
+
+$(basename $0) - bootable harddisk image generator
+
+SYNOPSIS:
+
+$(basename $0) -o output_image_name [-s image_size] [-i sourcedir] [-t fstype] [-p partition_offset] [-b build_type] [-z|-j|-J] [-h] [[bootloader_image bootloader_offset] ...]
+
+DESCRIPTION:
+
+$(basename $0) generates harddisk images with a partition table and a
+single primary partition from a directory tree without requiring root
+priviledges.  It optionally also installs firmware/bootloader
+binaries (usually u-boot) in the image area between the MBR and the
+first partition and allows to generate concatenateable partial images
+(only the MBR+firmware area or only the partition area).
+
+OPTIONS
+
+  -b build_type
+
+       Specify the type of image to build. Valid options are:
+
+       - complete:   complete harddisk image (MBR/firmware + partition)
+       - firmware:   only MBR/firmware/bootloader image
+       - partition:  only partition image
+
+       The default is building a complete harddisk image.
+
+  -h
+
+       Display this help text and exit.
+
+  -i sourcedir
+
+       Specify the source directory from which the filesystem in
+       the image should be generated.  The default is the current
+       directory.
+
+  -j
+
+       Compress the image with bzip2.
+
+  -J
+
+       Compress the image with xz.
+
+  -o output_image_name
+
+       Specify the name of the generated image. If one of the
+       compression options (-z/-j/-J) is selected, the according
+       suffix (.gz/.bz2/.xz) will be appended to the supplied
+       file name.
+
+  -p partition_offset
+
+       Specify the partition offset from the beginning of the
+       device in blocks of 512 Bytes.  The default is 2048, i.e.
+       the partition starts at an offset of 1 MB.
+
+  -s image_size
+
+       Specify the size of the complete harddisk image in kB.
+       When building partial images, the size of the parts is
+       calculated accordingly, so that the sum of the parts is
+       the specified image size.  The default image size is
+       ${DEFAULT_IMAGESIZE} kB.
+
+  -t fstype
+
+       Type of the filesystem to create in the harddisk image.
+       Available options are fat32 (default), fat16 and ext2.
+       Generating large ext2 images can be very slow (ca. 5
+       minutes for a 1GB image on a 1GHz Cortex-A7).
+
+  -v
+
+       Verbose output.
+
+  -z
+
+       Compress the image with gzip.
+
+The bootloader_image and bootloader_offset parameters specify which
+bootloader image should be installed at which offset (in blocks of 512
+Bytes) from the start of the harddisk image.  This parameter set can be
+used multiple times to install multi-part bootloader images (e.g.  to
+install u-boot versions with separate SPL images).
+
+EOF
+}
+
+# Parse parameters:
+# -h help
+# -i input directory
+# -o output filename
+# -s size of disk image
+# -t type of filesystem (fat16/fat32/ext2)
+# -p partition offset
+# -b build type (complete/firmware/partition)
+# -z/-j/-J gzip/bzip2/xz compression
+# -v verbose
+
+while getopts "hi:o:s:t:p:b:zjJv" option; do
+  case ${option} in
+    h)
+      usage
+      exit 0
+      ;;
+    i)
+      SOURCEDIR="${OPTARG}"
+      ;;
+    o)
+      IMAGEFILE="${OPTARG}"
+      ;;
+    s)
+      IMAGESIZE="${OPTARG}"
+      ;;
+    t)
+      FSTYPE="${OPTARG}"
+      case "${FSTYPE}" in
+        fat16)
+          PARTID="0x0e"
+          FATSIZE="16"
+          ;;
+        fat32)
+          PARTID="0x0c"
+          FATSIZE="32"
+          ;;
+        ext2)
+          PARTID="0x83"
+          ;;
+        *)
+          echo "$(basename $0): Invalid filesystem type \"${FSTYPE}\". Use fat16, fat32 or ext2."
+          exit 1
+          ;;
+      esac
+      ;;
+    p)
+      PARTOFFSET="${OPTARG}"
+      ;;
+    b)
+      BUILDTYPE="${OPTARG}"
+      case "${BUILDTYPE}" in
+        complete|firmware|partition)
+          ;;
+        *)
+          echo "$(basename $0): Invalid build type \"${BUILDTYPE}\". Use complete, firmware or partition."
+          exit 1
+          ;;
+      esac
+      ;;
+    z)
+      COMPRESS="gzip"
+      PREREQUISITES="${PREREQUISITES} gzip"
+      ;;
+    j)
+      COMPRESS="bzip2"
+      PREREQUISITES="${PREREQUISITES} bzip2"
+      ;;
+    J)
+      COMPRESS="xz"
+      PREREQUISITES="${PREREQUISITES} xz"
+      ;;
+    v)
+      VERBOSITY="1"
+      ;;
+  esac
+done
+
+shift $((${OPTIND}-1))
+
+case "${FSTYPE}" in
+  fat16|fat32)
+    PREREQUISITES="${PREREQUISITES} mkfs.msdos mcopy"
+    ;;
+  ext2)
+    PREREQUISITES="${PREREQUISITES} genext2fs"
+    ;;
+esac
+
+check_prerequisites "${PREREQUISITES}"
+
+FS_SIZE=$((${IMAGESIZE}-${PARTOFFSET}/2))
+if [ ${FS_SIZE} -lt 34816 ] && [ "${FSTYPE}" = "fat32" ]; then
+  error "INFO: Image size too small for FAT32, using FAT16."
+  FSTYPE="fat16"
+  PARTID="0x0e"
+  FATSIZE="16"
+fi
+if [ ${FS_SIZE} -gt 2097152 ] && [ "${FSTYPE}" = "fat16" ]; then
+  error "INFO: Image size too big for FAT16, using FAT32."
+  FSTYPE="fat32"
+  PARTID="0x0c"
+  FATSIZE="32"
+fi
+
+log "Starting to generate image ${IMAGEFILE} ..."
+
+case "${BUILDTYPE}" in
+  complete|firmware)
+    log "Building partition table ..."
+    TEMP_HD_IMAGEFILE=$(mktemp)
+    dd 2>/dev/null if=/dev/zero bs=1k of="${TEMP_HD_IMAGEFILE}" seek=$((${IMAGESIZE}-1)) count=1
+    sfdisk --force -u S "${TEMP_HD_IMAGEFILE}" 1>/dev/null 2>/dev/null <<EOF
+${PARTOFFSET}, ,${PARTID},*,
+EOF
+    while [ "$#" -ge "2" ]
+    do
+      if [ -n "$1" ]; then
+        BOOTLOADER_IMAGE="$1"
+        BOOTLOADER_OFFSET="$2"
+        log "Installing ${BOOTLOADER_IMAGE} at sector ${BOOTLOADER_OFFSET} ..."
+        dd 2>/dev/null if="${BOOTLOADER_IMAGE}" of="${TEMP_HD_IMAGEFILE}" bs=512 seek="${BOOTLOADER_OFFSET}" conv=notrunc
+      fi
+      shift 2
+    done
+    if [ "$#" -eq 1 ]; then
+      error "ERROR: Firmware/bootloader image name or offset missing. Exiting."
+      clean_tempfiles
+      exit 1
+    fi
+    ;;
+esac
+
+case "${BUILDTYPE}" in
+  complete|partition)
+    log "Building filesystem ..."
+    TEMP_FS_IMAGEFILE=$(mktemp)
+    TEMP_FS_IMAGESIZE=$((${IMAGESIZE}-${PARTOFFSET}/2)) # fs size in kB
+    dd 2>/dev/null if=/dev/zero bs=1k of="${TEMP_FS_IMAGEFILE}" seek=$((${TEMP_FS_IMAGESIZE}-1)) count=1
+    case "${FSTYPE}" in
+      fat16|fat32)
+        mkfs.msdos >/dev/null -F "${FATSIZE}" "${TEMP_FS_IMAGEFILE}" "${TEMP_FS_IMAGESIZE}"
+        mcopy -s -i "${TEMP_FS_IMAGEFILE}" ${SOURCEDIR}// ::
+        # The trailing // is necessary to make mcopy copy the contents
+        # of ${SOURCEDIR} but not ${SOURCEDIR} itself. Using ${SOURCEDIR}/*
+        # would omit dotfiles and ${SOURCEDIR}/. does not work with mcopy.
+        ;;
+      ext2)
+        genext2fs -z -U -d "${SOURCEDIR}" -b "${TEMP_FS_IMAGESIZE}" "${TEMP_FS_IMAGEFILE}"
+        ;;
+    esac
+    ;;
+esac
+
+case "${BUILDTYPE}" in
+  firmware)
+    dd 2>/dev/null if="${TEMP_HD_IMAGEFILE}" bs=512 count="${PARTOFFSET}" of="${IMAGEFILE}"
+    ;;
+  complete)
+    dd 2>/dev/null if="${TEMP_HD_IMAGEFILE}" bs=512 count="${PARTOFFSET}" of="${IMAGEFILE}"
+    cat "${TEMP_FS_IMAGEFILE}" >> "${IMAGEFILE}"
+    ;;
+  partition)
+    mv "${TEMP_FS_IMAGEFILE}" "${IMAGEFILE}"
+    ;;
+esac
+
+if [ ! "${COMPRESS}" = "none" ];
+then
+  log "Compressing image ..."
+  "${COMPRESS}" -f "${IMAGEFILE}"
+fi
+
+clean_tempfiles
+
+log "Image finished."
+
+exit 0
-- 
2.1.4

>From 38a33a78c784e21bd2bd0f8b2c093037873332c8 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 21:46:32 +0100
Subject: [PATCH 4/6] Add SD-card image build support for hd-media builds on
 armhf.

---
 build/boot/README.concatenateable_images |  7 ++++++
 build/config/armhf/hd-media.cfg          | 41 +++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 build/boot/README.concatenateable_images

diff --git a/build/boot/README.concatenateable_images b/build/boot/README.concatenateable_images
new file mode 100644
index 0000000..662bb61
--- /dev/null
+++ b/build/boot/README.concatenateable_images
@@ -0,0 +1,7 @@
+This directory provides installer images in the form of a device-specific
+part (containing the partition table and the system firmware) and a
+device-indepent part (containing the actual installer), which can be
+unpacked and concatenated together to build a complete installer image.
+
+The device-specific part is named firmware.<board_name>.img(.gz|.bz2|.xz)
+and the device-independent part is named partition.img(.gz|.bz2|.xz).
diff --git a/build/config/armhf/hd-media.cfg b/build/config/armhf/hd-media.cfg
index ec119df..440cddd 100644
--- a/build/config/armhf/hd-media.cfg
+++ b/build/config/armhf/hd-media.cfg
@@ -1,9 +1,10 @@
 FLAVOUR_SUPPORTED = ""
+FLOPPY_SIZE = 40000
 
 GZIPPED = .gz
 EXTRANAME = hd-media/
 
-TARGET = $(KERNEL) $(INITRD) hd-media_bootscript hd-media_tarball
+TARGET = $(KERNEL) $(INITRD) hd-media_bootscript hd-media_tarball hd-media-images-full hd-media-images-concatenateable
 
 MANIFEST-INITRD = "Initrd for use on USB memory sticks"
 MANIFEST-KERNEL = "Kernel for use on USB memory sticks"
@@ -24,3 +25,41 @@ hd-media_tarball: $(KERNEL) $(INITRD) $(TEMP_DTBS) hd-media_bootscript
 	cp boot/README.device-tree $(TEMP)/hd-media/dtbs/README
 	tar -C $(TEMP)/hd-media -zcf $(TEMP)/hd-media.tar.gz boot.scr initrd.gz vmlinuz dtbs/
 	mv  $(TEMP)/hd-media.tar.gz $(SOME_DEST)/$(EXTRANAME)
+
+.PHONY: hd-media-images-full
+hd-media-images-full: $(KERNEL) $(INITRD) $(TEMP_DTBS) hd-media_bootscript
+	-rm -rf $(TEMP)/hd-media
+	mkdir $(TEMP)/hd-media
+	cp $(KERNEL) $(TEMP)/hd-media/vmlinuz
+	cp $(INITRD) $(TEMP)/hd-media/initrd.gz
+	cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/hd-media/boot.scr
+	cp -r $(TEMP_DTBS) $(TEMP)/hd-media/dtbs/
+	cp boot/README.device-tree $(TEMP)/hd-media/dtbs/README
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/full
+	while read LINE; \
+	do \
+	  if [ -n "$${LINE}" ] && ! echo $${LINE}|grep -q -e "^#"; then \
+	    set -- $${LINE} ;\
+	    gen-hd-image -v -z -b complete -s "$(FLOPPY_SIZE)" -i "$(TEMP)/hd-media" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/full/$${1}.img" "$$2" "$$3" "$$4" "$$5" ;\
+	  fi ;\
+	done < boot/arm/u-boot-image-config
+
+.PHONY: hd-media-images-concatenateable
+hd-media-images-concatenateable: $(KERNEL) $(INITRD) $(TEMP_DTBS) hd-media_bootscript
+	-rm -rf $(TEMP)/hd-media
+	mkdir $(TEMP)/hd-media
+	cp $(KERNEL) $(TEMP)/hd-media/vmlinuz
+	cp $(INITRD) $(TEMP)/hd-media/initrd.gz
+	cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/hd-media/boot.scr
+	cp -r $(TEMP_DTBS) $(TEMP)/hd-media/dtbs/
+	cp boot/README.device-tree $(TEMP)/hd-media/dtbs/README
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable
+	while read LINE; \
+	do \
+	  if [ -n "$${LINE}" ] && ! echo $${LINE}|grep -q -e "^#"; then \
+	    set -- $${LINE} ;\
+	    gen-hd-image -v -z -b firmware -s "$(FLOPPY_SIZE)" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable/firmware.$${1}.img" "$$2" "$$3" "$$4" "$$5" ;\
+	  fi ;\
+	done < boot/arm/u-boot-image-config
+	gen-hd-image -v -z -b partition -s "$(FLOPPY_SIZE)" -i "$(TEMP)/hd-media" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable/partition.img"
+	cp boot/README.concatenateable_images "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable/"
-- 
2.1.4

>From d37e6e6ed5e3e75f78adfdb15c870c4b17eea54e Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 21:48:25 +0100
Subject: [PATCH 5/6] Add SD-card image build support for netboot builds on
 armhf.

---
 build/config/armhf/netboot.cfg | 50 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/build/config/armhf/netboot.cfg b/build/config/armhf/netboot.cfg
index ce912c8..f98f4cc 100644
--- a/build/config/armhf/netboot.cfg
+++ b/build/config/armhf/netboot.cfg
@@ -1,7 +1,55 @@
 MEDIA_TYPE = netboot image
 
-TARGET = $(INITRD) $(KERNEL)
+TARGET = $(KERNEL) $(INITRD) netboot_bootscript netboot-images-full netboot-images-concatenateable
+
 EXTRANAME = $(MEDIUM)/
 
 MANIFEST-INITRD = "netboot initrd"
 MANIFEST-KERNEL = "kernel image to netboot"
+
+FLOPPY_SIZE = 40000
+
+GZIPPED = .gz
+
+.PHONY: netboot_bootscript
+netboot_bootscript:
+	mkimage -T script -A arm -d boot/arm/bootscr.mainline_common $(SOME_DEST)/$(EXTRANAME)boot.scr
+	update-manifest $(SOME_DEST)/$(EXTRANAME)boot.scr "Universal boot script for mainline u-boot (>= v2014.10)"
+
+.PHONY: netboot-images-full
+netboot-images-full: $(KERNEL) $(INITRD) $(TEMP_DTBS) netboot_bootscript
+	-rm -rf $(TEMP)/netboot
+	mkdir $(TEMP)/netboot
+	cp $(KERNEL) $(TEMP)/netboot/vmlinuz
+	cp $(INITRD) $(TEMP)/netboot/initrd.gz
+	cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/netboot/boot.scr
+	cp -r $(TEMP_DTBS) $(TEMP)/netboot/dtbs/
+	cp boot/README.device-tree $(TEMP)/netboot/dtbs/README
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/full
+	while read LINE; \
+	do \
+	  if [ -n "$${LINE}" ] && ! echo $${LINE}|grep -q -e "^#"; then \
+	    set -- $${LINE} ;\
+	    gen-hd-image -v -z -b complete -s "$(FLOPPY_SIZE)" -i "$(TEMP)/netboot" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/full/$${1}.img" "$$2" "$$3" "$$4" "$$5" ;\
+	  fi ;\
+	done < boot/arm/u-boot-image-config
+
+.PHONY: netboot-images-concatenateable
+netboot-images-concatenateable: $(KERNEL) $(INITRD) $(TEMP_DTBS) netboot_bootscript
+	-rm -rf $(TEMP)/netboot
+	mkdir $(TEMP)/netboot
+	cp $(KERNEL) $(TEMP)/netboot/vmlinuz
+	cp $(INITRD) $(TEMP)/netboot/initrd.gz
+	cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/netboot/boot.scr
+	cp -r $(TEMP_DTBS) $(TEMP)/netboot/dtbs/
+	cp boot/README.device-tree $(TEMP)/netboot/dtbs/README
+	mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable
+	while read LINE; \
+	do \
+	  if [ -n "$${LINE}" ] && ! echo $${LINE}|grep -q -e "^#"; then \
+	    set -- $${LINE} ;\
+	    gen-hd-image -v -z -b firmware -s "$(FLOPPY_SIZE)" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable/firmware.$${1}.img" "$$2" "$$3" "$$4" "$$5" ;\
+	  fi ;\
+	done < boot/arm/u-boot-image-config
+	gen-hd-image -v -z -b partition -s "$(FLOPPY_SIZE)" -i "$(TEMP)/netboot" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable/partition.img"
+	cp boot/README.concatenateable_images "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/concatenateable/"
-- 
2.1.4

>From 59342969941f6b6a07570ddf4710d55b3b24bc6d Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 22:32:03 +0100
Subject: [PATCH 6/6] Add additional dependencies (needed for building bootable
 images on armhf)

---
 debian/control | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index fbdb166..bf3a66d 100644
--- a/debian/control
+++ b/debian/control
@@ -68,11 +68,12 @@ Build-Depends:
 #		default.)
 	hfsutils [powerpc],
 #		For making bootable HFS USB sticks for powerpc.
-	dosfstools [i386 ia64 m68k amd64 arm64],
+	dosfstools [i386 ia64 m68k amd64 armhf arm64],
 #		For creating FAT filesystems with mkfs.msdos.
 #		Of course i386/amd64 use this for floppies, CDs etc.
 #		ia64 uses it for floppies (?)
 #		m68k uses it for atari floppies
+#		armhf uses it for building bootable SD card images
 	cpio,
 #		For creating initramfs images.
 	xz-utils,
@@ -133,12 +134,16 @@ Build-Depends:
 #		Used to make EFI bootable images
 	grub-ieee1275-bin [ppc64el],
 #		IEEE1275 bootloader support.
+	u-boot-imx [armhf],
+	u-boot-omap [armhf],
+	u-boot-sunxi [armhf],
+#		U-boot binaries, needed to build bootable SD card images.
 # 
 # Architecture specific build dependencies:
 	tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64],
 #		For todos, used on files that need to be accessible from
 #		DOS.
-	mtools [i386 ia64 m68k amd64 arm64 kfreebsd-i386 kfreebsd-amd64 hurd-i386],
+	mtools [i386 ia64 m68k amd64 armhf arm64 kfreebsd-i386 kfreebsd-amd64 hurd-i386],
 #		mcopy is used to put files onto FAT filesystems w/o
 #		mounting them.
 # 
-- 
2.1.4


Reply to: