MEDIA_TYPE = netboot image (SSH)

TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) dns-320 lacie lschlv2 lsqvl lsvl lswsxl lswvl lswxl lsxhl
EXTRANAME = $(MEDIUM)/
TYPE = netboot/network-console

# D-Link DNS-320
dns-320:
	mkdir -p $(SOME_DEST)/$(EXTRANAME)d-link/dns-320
	mkdir -p $(TEMP)/dns-320
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-dns320.dtb > $(TEMP)/dns-320/vmlinuz-dns320
	mkimage -A arm -O linux -T kernel -C none -e 0x00008000 -a 0x00008000 -n "Debian kernel" -d $(TEMP)/dns-320/vmlinuz-dns320 $(TEMP)/dns-320/kernel.uboot
	mkimage -A arm -O linux -T ramdisk -C gzip -e 0x00e00000 -a 0x00e00000 -n "debian-installer ramdisk" -d $(TEMP_INITRD) $(TEMP)/dns-320/initrd.uboot
	mkdns323fw -k $(TEMP)/dns-320/kernel.uboot -i $(TEMP)/dns-320/initrd.uboot -t DNS-320 -o $(SOME_DEST)/$(EXTRANAME)d-link/dns-320/netboot.img
	update-manifest $(SOME_DEST)/$(EXTRANAME)d-link/dns-320/netboot.img "installer image (dlink firmware) for D-Link DNS-320"

# LaCie NAS series: Network Space v2 (and parents), d2 Network v2 and *Big Network v2
lacie:
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie
	mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n "debian-installer ramdisk" -d $(TEMP_INITRD) $(SOME_DEST)/$(EXTRANAME)lacie/uInitrd
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/uInitrd "initrd for LaCie NAS"
	# LaCie 2Big Network v2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie/net2big
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-net2big.dtb > $(TEMP)/vmlinuz-net2big
	mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d $(TEMP)/vmlinuz-net2big $(SOME_DEST)/$(EXTRANAME)lacie/net2big/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/net2big/uImage "Linux kernel for LaCie 2Big Network v2"
	# LaCie 5Big Network v2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie/net5big
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-net5big.dtb > $(TEMP)/vmlinuz-net5big
	mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d $(TEMP)/vmlinuz-net5big $(SOME_DEST)/$(EXTRANAME)lacie/net5big/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/net5big/uImage "Linux kernel for LaCie 5Big Network v2"
	# LaCie Internet Space v2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie/is2
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-is2.dtb > $(TEMP)/vmlinuz-is2
	mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d $(TEMP)/vmlinuz-is2 $(SOME_DEST)/$(EXTRANAME)lacie/is2/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/is2/uImage "Linux kernel for LaCie Internet Space v2"
	# LaCie Network Space v2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie/ns2
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-ns2.dtb > $(TEMP)/vmlinuz-ns2
	mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d $(TEMP)/vmlinuz-ns2 $(SOME_DEST)/$(EXTRANAME)lacie/ns2/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/ns2/uImage "Linux kernel for LaCie Network Space v2"
	# LaCie Network Space Max v2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie/ns2max
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-ns2max.dtb > $(TEMP)/vmlinuz-ns2max
	mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d $(TEMP)/vmlinuz-ns2max $(SOME_DEST)/$(EXTRANAME)lacie/ns2max/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/ns2max/uImage "Linux kernel for LaCie Network Space Max v2"
	# LaCie d2 Network v2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)lacie/d2net
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-d2net.dtb > $(TEMP)/vmlinuz-d2net
	mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Debian kernel" -d $(TEMP)/vmlinuz-d2net $(SOME_DEST)/$(EXTRANAME)lacie/d2net/uImage
	update-manifest $(SOME_DEST)/$(EXTRANAME)lacie/d2net/uImage "Linux kernel for LaCie d2 Network v2"

# Buffalo Linkstation LS-CHLv2
lschlv2:
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-lschlv2.dtb > $(TEMP)/vmlinuz-lschlv2
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lschlv2 $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2/uImage.buffalo
	mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n "debian-installer ramdisk" -d $(TEMP_INITRD) $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2/initrd.buffalo
	install -m 744 boot/arm/linkstation-config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2/config-debian
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2/uImage.buffalo "Linux kernel for LS-CHLv2"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-chlv2/initrd.buffalo "initrd for LS-CHLv2"

# Buffalo Linkstation LS-VL
lsvl: lschlv2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-linkstation-lsvl.dtb > $(TEMP)/vmlinuz-lsvl
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lsvl $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl/uImage.buffalo
	ln -nfs ../ls-chlv2/initrd.buffalo $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl/
	ln -nfs ../ls-chlv2/config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl/
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl/uImage.buffalo "Linux kernel for LS-VL"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-vl/initrd.buffalo "initrd for LS-VL"

# Buffalo Linkstation LS-QVL
lsqvl: lschlv2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-linkstation-lsqvl.dtb > $(TEMP)/vmlinuz-lsqvl
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lsqvl $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl/uImage.buffalo
	ln -nfs ../ls-chlv2/initrd.buffalo $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl/
	ln -nfs ../ls-chlv2/config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl/
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl/uImage.buffalo "Linux kernel for LS-QVL"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-qvl/initrd.buffalo "initrd for LS-QVL"

# Buffalo Linkstation LS-WSXL
lswsxl: lschlv2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-linkstation-lswsxl.dtb > $(TEMP)/vmlinuz-lswsxl
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lswsxl $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl/uImage.buffalo
	ln -nfs ../ls-chlv2/initrd.buffalo $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl/
	ln -nfs ../ls-chlv2/config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl/
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl/uImage.buffalo "Linux kernel for LS-WSXL"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wsxl/initrd.buffalo "initrd for LS-WSXL"

# Buffalo Linkstation LS-WVL
lswvl: lschlv2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-linkstation-lswvl.dtb > $(TEMP)/vmlinuz-lswvl
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lswvl $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl/uImage.buffalo
	ln -nfs ../ls-chlv2/initrd.buffalo $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl/
	ln -nfs ../ls-chlv2/config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl/
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl/uImage.buffalo "Linux kernel for LS-WVL"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wvl/initrd.buffalo "initrd for LS-WVL"

# Buffalo Linkstation LS-WXL
lswxl: lschlv2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-linkstation-lswxl.dtb > $(TEMP)/vmlinuz-lswxl
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lswxl $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl/uImage.buffalo
	ln -nfs ../ls-chlv2/initrd.buffalo $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl/
	ln -nfs ../ls-chlv2/config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl/
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl/uImage.buffalo "Linux kernel for LS-WXL"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-wxl/initrd.buffalo "initrd for LS-WXL"

# Buffalo Linkstation LS-XHL
lsxhl: lschlv2
	mkdir -p $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl
	cat $(TEMP_KERNEL) $(TEMP_DTBS)/kirkwood-lsxhl.dtb > $(TEMP)/vmlinuz-lsxhl
	mkimage -A arm -O linux -T kernel -C none -a 0x01a00000 -e 0x01a00000 -n "Debian kernel" -d $(TEMP)/vmlinuz-lsxhl $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl/uImage.buffalo
	ln -nfs ../ls-chlv2/initrd.buffalo $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl/
	ln -nfs ../ls-chlv2/config-debian $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl/
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl/config-debian "Script to run debian-installer"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl/uImage.buffalo "Linux kernel for LS-XHL"
	update-manifest $(SOME_DEST)/$(EXTRANAME)buffalo/ls-xhl/initrd.buffalo "initrd for LS-XHL"
