Re: Providing (armhf) u-boot images together with d-i images?
On Wed, Dec 24, 2014 at 12:51:41AM +0100, Cyril Brulebois wrote:
> Added debian-cd@.
>
> Karsten Merker <merker@debian.org> (2014-12-23):
[snip]
> > 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?
>
> I'd be happy to have more feedback on this, notably from Steve on the
> debian-cd@ side, and from Ian for the arm side (just to make sure).
Hello,
attached is V2 of the patchset. Changes since V1:
- fix a copy-and-paste error in boot/arm/u-boot-image-config,
spotted by Vagrant Cascadian
- add support for building a netboot.tar.gz, intended to be
unpacked on a tftp server; this is modeled after the the PXE
netboot.tar.gz on i386/amd64
- use unique temporary directories for the different targets
to avoid problems if some day parallel builds should become
supported
- make the destination path for the full and concatenateable
SD card images configurable by setting a makefile variable
- rework some of the information printed during the build process
- some cosmetic clean-up (make all targets use the same naming
convention regarding dashes vs. underscores)
Regards,
Karsten
--
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 a809f8fa7e3357149e3b5333b7b319271e7a67e6 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sun, 21 Dec 2014 19:22:56 +0100
Subject: [PATCH V2 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..4f00b4b
--- /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/omap4_panda/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 5b651368622cf884d642a47e5f2a2558f1d8ce65 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Sun, 21 Dec 2014 21:46:18 +0100
Subject: [PATCH V2 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 | 27 +++++++++++++++++++++++++++
2 files changed, 28 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..f8bcd2c
--- /dev/null
+++ b/build/config/armhf/u-boot.cfg
@@ -0,0 +1,27 @@
+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 \
+ echo "Providing u-boot binaries for $$1 ..."; \
+ cp "$$2" "$(SOME_DEST)/$(EXTRANAME)/$$1/"; \
+ dd 2>/dev/null if="$$2" of="$(SOME_DEST)/$(EXTRANAME)/$$1/$$1.sdcard.img" bs=512 seek="$$3"; \
+ gzip -9 "$(SOME_DEST)/$(EXTRANAME)/$$1/$$(basename $$2)"; \
+ fi; \
+ if [ -n "$$4" ]; then \
+ cp "$$4" "$(SOME_DEST)/$(EXTRANAME)/$$1/"; \
+ dd 2>/dev/null if="$$4" of="$(SOME_DEST)/$(EXTRANAME)/$$1/$$1.sdcard.img" bs=512 seek="$$5" conv=notrunc; \
+ gzip -9 "$(SOME_DEST)/$(EXTRANAME)/$$1/$$(basename $$4)"; \
+ fi; \
+ gzip -9 "$(SOME_DEST)/$(EXTRANAME)/$$1/$$1.sdcard.img"; \
+ fi ;\
+ done < boot/arm/u-boot-image-config
--
2.1.4
>From f57ee0d545b104d926b5067250d893ca08dd6be1 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 19:04:15 +0100
Subject: [PATCH V2 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 dc59135b1c816632c04dd0d7ba02f31bac8fa0fa Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 21:46:32 +0100
Subject: [PATCH V2 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 | 44 +++++++++++++++++++++++++++++++-
2 files changed, 50 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..d4345c6 100644
--- a/build/config/armhf/hd-media.cfg
+++ b/build/config/armhf/hd-media.cfg
@@ -1,9 +1,13 @@
FLAVOUR_SUPPORTED = ""
+FLOPPY_SIZE = 40000
GZIPPED = .gz
EXTRANAME = hd-media/
-TARGET = $(KERNEL) $(INITRD) hd-media_bootscript hd-media_tarball
+FULL_SUFFIX = full
+CONCATENATEABLE_SUFFIX = concatenateable
+
+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 +28,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_images_full
+ mkdir $(TEMP)/hd-media_images_full
+ cp $(KERNEL) $(TEMP)/hd-media_images_full/vmlinuz
+ cp $(INITRD) $(TEMP)/hd-media_images_full/initrd.gz
+ cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/hd-media_images_full/boot.scr
+ cp -r $(TEMP_DTBS) $(TEMP)/hd-media_images_full/dtbs/
+ cp boot/README.device-tree $(TEMP)/hd-media_images_full/dtbs/README
+ mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(FULL_SUFFIX)
+ 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_images_full" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(FULL_SUFFIX)/$${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_images_concatenateable
+ mkdir $(TEMP)/hd-media_images_concatenateable
+ cp $(KERNEL) $(TEMP)/hd-media_images_concatenateable/vmlinuz
+ cp $(INITRD) $(TEMP)/hd-media_images_concatenateable/initrd.gz
+ cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/hd-media_images_concatenateable/boot.scr
+ cp -r $(TEMP_DTBS) $(TEMP)/hd-media_images_concatenateable/dtbs/
+ cp boot/README.device-tree $(TEMP)/hd-media_images_concatenateable/dtbs/README
+ mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(CONCATENATEABLE_SUFFIX)
+ 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_SUFFIX)/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_images_concatenateable" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(CONCATENATEABLE_SUFFIX)/partition.img"
+ cp boot/README.concatenateable_images "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(CONCATENATEABLE_SUFFIX)/"
--
2.1.4
>From 85e9b70ff28ef701cc6be1dac8d7e0e3daa28493 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 21:48:25 +0100
Subject: [PATCH V2 5/6] Add SD-card image and tftpboot tarball build support
for netboot builds on armhf
---
build/boot/arm/bootscr.tftpboot | 17 ++++++++++
build/config/armhf/netboot.cfg | 69 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 85 insertions(+), 1 deletion(-)
create mode 100644 build/boot/arm/bootscr.tftpboot
diff --git a/build/boot/arm/bootscr.tftpboot b/build/boot/arm/bootscr.tftpboot
new file mode 100644
index 0000000..bc76fcf
--- /dev/null
+++ b/build/boot/arm/bootscr.tftpboot
@@ -0,0 +1,17 @@
+
+if test -z "${fdtfile}"; then
+ echo 'fdtfile environment variable not set. Aborting boot process.'
+ exit 0
+fi
+
+if test -n "${console}"; then
+ setenv bootargs "${bootargs} console=${console}"
+fi
+
+setenv installer-path "/debian-installer/armhf/"
+
+tftpboot ${fdt_addr_r} ${installer-path}dtbs/${fdtfile} \
+&& tftpboot ${kernel_addr_r} ${installer-path}vmlinuz \
+&& tftpboot ${ramdisk_addr_r} ${installer-path}initrd.gz \
+&& echo "Booting the Debian installer..." \
+&& bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
diff --git a/build/config/armhf/netboot.cfg b/build/config/armhf/netboot.cfg
index ce912c8..61d7d14 100644
--- a/build/config/armhf/netboot.cfg
+++ b/build/config/armhf/netboot.cfg
@@ -1,7 +1,74 @@
MEDIA_TYPE = netboot image
-TARGET = $(INITRD) $(KERNEL)
+FULL_SUFFIX = full
+CONCATENATEABLE_SUFFIX = concatenateable
+TFTP_INSTALLER_PATH = debian-installer/armhf/
+
+TARGET = $(KERNEL) $(INITRD) netboot_bootscript_sd netboot_bootscript_tftp netboot_tarball 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_sd
+netboot_bootscript_sd:
+ 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_bootscript_tftp
+netboot_bootscript_tftp:
+ mkimage -T script -A arm -d boot/arm/bootscr.tftpboot $(SOME_DEST)/$(EXTRANAME)tftpboot.scr
+ update-manifest $(SOME_DEST)/$(EXTRANAME)tftpboot.scr "TFTP boot script for mainline u-boot (>= v2014.10)"
+
+.PHONY: netboot_tarball
+netboot_tarball: $(KERNEL) $(INITRD) $(TEMP_DTBS) netboot_bootscript_tftp
+ rm -rf $(TEMP)/netboot_tarball
+ mkdir -p $(TEMP)/netboot_tarball/$(TFTP_INSTALLER_PATH)
+ cp $(KERNEL) $(TEMP)/netboot_tarball/$(TFTP_INSTALLER_PATH)vmlinuz
+ cp $(INITRD) $(TEMP)/netboot_tarball/$(TFTP_INSTALLER_PATH)initrd.gz
+ cp -r $(TEMP_DTBS) $(TEMP)/netboot_tarball/$(TFTP_INSTALLER_PATH)dtbs/
+ cp $(SOME_DEST)/$(EXTRANAME)tftpboot.scr $(TEMP)/netboot_tarball/$(TFTP_INSTALLER_PATH)
+ tar -C $(TEMP)/netboot_tarball/ -zcf $(SOME_DEST)/$(EXTRANAME)netboot.tar.gz $(TFTP_INSTALLER_PATH)tftpboot.scr $(TFTP_INSTALLER_PATH)initrd.gz $(TFTP_INSTALLER_PATH)vmlinuz $(TFTP_INSTALLER_PATH)dtbs/
+
+.PHONY: netboot_images_full
+netboot_images_full: $(KERNEL) $(INITRD) $(TEMP_DTBS) netboot_bootscript_sd
+ -rm -rf $(TEMP)/netboot_images_full
+ mkdir $(TEMP)/netboot_images_full
+ cp $(KERNEL) $(TEMP)/netboot_images_full/vmlinuz
+ cp $(INITRD) $(TEMP)/netboot_images_full/initrd.gz
+ cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/netboot_images_full/boot.scr
+ cp -r $(TEMP_DTBS) $(TEMP)/netboot_images_full/dtbs/
+ cp boot/README.device-tree $(TEMP)/netboot_images_full/dtbs/README
+ mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(FULL_SUFFIX)
+ 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_images_full" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(FULL_SUFFIX)/$${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_sd
+ -rm -rf $(TEMP)/netboot_images_concatenateable
+ mkdir $(TEMP)/netboot_images_concatenateable
+ cp $(KERNEL) $(TEMP)/netboot_images_concatenateable/vmlinuz
+ cp $(INITRD) $(TEMP)/netboot_images_concatenateable/initrd.gz
+ cp $(SOME_DEST)/$(EXTRANAME)boot.scr $(TEMP)/netboot_images_concatenateable/boot.scr
+ cp -r $(TEMP_DTBS) $(TEMP)/netboot_images_concatenateable/dtbs/
+ cp boot/README.device-tree $(TEMP)/netboot_images_concatenateable/dtbs/README
+ mkdir -p $(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(CONCATENATEABLE_SUFFIX)
+ 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_SUFFIX)/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_images_concatenateable" -o "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(CONCATENATEABLE_SUFFIX)/partition.img"
+ cp boot/README.concatenateable_images "$(SOME_DEST)/$(EXTRANAME)/SD-card-images/$(CONCATENATEABLE_SUFFIX)/"
--
2.1.4
>From c8daf4684f67fe2da4d5cb8793dbe932efe7d860 Mon Sep 17 00:00:00 2001
From: Karsten Merker <merker@debian.org>
Date: Mon, 22 Dec 2014 22:32:03 +0100
Subject: [PATCH V2 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: