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

[PATCH V3 5/6] Add SD-card image and tftpboot tarball build support for netboot builds on armhf



---
 build/boot/arm/bootscr.tftpboot | 21 +++++++++++++
 build/config/armhf/netboot.cfg  | 69 ++++++++++++++++++++++++++++++++++++++++-
 debian/changelog                |  2 ++
 3 files changed, 91 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..c5a26f4
--- /dev/null
+++ b/build/boot/arm/bootscr.tftpboot
@@ -0,0 +1,21 @@
+if test -z "${fdtfile}"; then
+  echo 'fdtfile environment variable not set. Aborting boot process.'
+  exit 0
+fi
+
+# Some i.MX6-based systems do not encode the baudrate in the console variable
+if test "${console}" = "ttymxc0" && test -n "${baudrate}" ; then
+  setenv console "${console},${baudrate}"
+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..517a8ed 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 =
+CONCATENATEABLE_SUFFIX = concatenateable
+TFTP_INSTALLER_PATH = debian-installer/armhf/
+
+TARGET = $(KERNEL) $(INITRD) netboot_bootscript_sd netboot_bootscript_tftp netboot_tarball netboot_images_full
+
 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)/"
diff --git a/debian/changelog b/debian/changelog
index 3243380..9020933 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ debian-installer (201410XX) UNRELEASED; urgency=medium
   * 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.
+  * Add SD-card image and tftpboot tarball build support for netboot builds
+    on armhf.
 
   [ Aurelien Jarno ]
   * Add scsi-modules to the cdrom flavour on ppc64el to be able to access
-- 
2.1.4


Reply to: