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

[PATCH V3 4/6] Add SD-card image build support for hd-media builds on armhf



---
 build/boot/README.concatenateable_images | 30 ++++++++++++++++++++++
 build/config/armhf/hd-media.cfg          | 44 +++++++++++++++++++++++++++++++-
 debian/changelog                         |  1 +
 3 files changed, 74 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..326054a
--- /dev/null
+++ b/build/boot/README.concatenateable_images
@@ -0,0 +1,30 @@
+This directory provides installer images in the form of a device-specific
+part (containing the partition table and the system firmware) and a
+device-independent 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).
+
+To create a complete image from the two parts on Linux systems, you can
+use zcat (for .gz images), bzcat (for .bz2 images) or xzcat (for .xz
+images) as follows:
+
+  zcat firmware.<board_name>.img.gz partition.img.gz > complete_image.img
+
+respectively
+
+  bzcat firmware.<board_name>.img.bz2 partition.img.bz2 > complete_image.img
+
+respectively
+
+  xzcat firmware.<board_name>.img.xz partition.img.xz > complete_image.img
+
+
+On Windows systems, you have to first decompress the two parts separately,
+which can be done e.g. by using 7-Zip, and then concatenate the decompressed
+parts together by running the command
+
+  copy firmware.<board_name>.img + partition.img complete_image.img
+
+in a Windows CMD.exe window.
diff --git a/build/config/armhf/hd-media.cfg b/build/config/armhf/hd-media.cfg
index ec119df..5107f40 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 =
+CONCATENATEABLE_SUFFIX = concatenateable
+
+TARGET = $(KERNEL) $(INITRD) hd-media_bootscript hd-media_tarball hd-media_images_full
 
 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)/"
diff --git a/debian/changelog b/debian/changelog
index 4fafb44..3243380 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ debian-installer (201410XX) UNRELEASED; urgency=medium
   * Provide u-boot binaries for armhf systems without u-boot in flash.
   * Add utils/gen-hd-image (a script to create partitioned harddisk images
     from a directory and optionally install a bootloader into the image).
+  * Add SD-card image build support for hd-media builds on armhf.
 
   [ Aurelien Jarno ]
   * Add scsi-modules to the cdrom flavour on ppc64el to be able to access
-- 
2.1.4


Reply to: