MEDIA_TYPE = netboot image (SSH)

TARGET = $(INITRD) $(KERNEL) seagate
EXTRANAME = $(MEDIUM)/
TYPE = netboot/network-console

MANIFEST-INITRD = "network-console initrd"
MANIFEST-KERNEL = "kernel image for network-console"

.PHONY: seagate
seagate:
	mkdir -p $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud
	mkimage -A arm -O linux -T kernel -C none -a 0x2000040 -e 0x2000040 -n "Debian kernel" -d $(TEMP_KERNEL) $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud/uImage "Linux kernel"
	# Generate an initrd with a preseed file and append it to the network-console initrd
	mkdir $(TEMP)/noninteractive-preseed
	cp boot/arm/ssh-noninteractive.preseed $(TEMP)/noninteractive-preseed/preseed.cfg
	(cd $(TEMP)/noninteractive-preseed && find . | sort | cpio --quiet -o -H newc) > $(TEMP)/noninteractive-preseed-initrd
	gzip $(TEMP)/noninteractive-preseed-initrd
	cat $(TEMP_INITRD) $(TEMP)/noninteractive-preseed-initrd.gz > $(TEMP)/noninteractive-initrd.gz
	mkimage -A arm -O linux -T ramdisk -C none -a 0x0 -e 0x0 -n "debian-installer ramdisk" -d $(TEMP)/noninteractive-initrd.gz $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud/uInitrd
	update-manifest $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud/uInitrd "Debian installer ramdisk"
	install -m 644 boot/arm/seagate-uboot-config $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud/uboot-config
	update-manifest $(SOME_DEST)/$(EXTRANAME)seagate/personal-cloud/uboot-config "U-Boot configuration for Seagate"
