MEDIUM_SUPPORTED = netboot cdrom utopic-netboot utopic-cdrom vivid-netboot vivid-cdrom wily-netboot wily-cdrom xenial-netboot xenial-cdrom

MKLIBS = mklibs-copy

KERNELMAJOR = 2.6
BASEVERSION = 3.13.0-110
KERNELVERSION = $(BASEVERSION)-generic
KERNEL_FLAVOUR = di
KERNELNAME = vmlinux
KERNELIMAGEVERSION = $(KERNELVERSION)

GRUB_CFG_CDROM = boot/ppc64el/grub-cdrom.cfg
GRUB_CFG_NETBOOT=boot/ppc64el/grub-cdrom.cfg

GRUB_MODULES = linux normal
GRUB_MODULES_CDROM = iso9660

arch_boot_screens:
arch_tree:

# Miniature CD image using GRUB, with only an initrd, no udebs or debs.
.PHONY: arch_miniiso
arch_miniiso: $(TEMP_INITRD) $(TEMP_KERNEL) $(TREE)
	-rm -f $(TEMP_CD_TREE)/*
	mkdir -p $(TEMP_CD_TREE)/boot/grub/powerpc-ieee1275 \
		 $(TEMP_CD_TREE)/ppc/chrp \
		 $(TEMP_CD_TREE)/install

	cp $(TEMP_KERNEL) $(TEMP_CD_TREE)/install/vmlinux
	cp $(TEMP_INITRD) $(TEMP_CD_TREE)/install/initrd.gz

	bootvars-subst \
		KERNEL /install/vmlinux \
		INITRD /install/initrd.gz \
	< $(GRUB_CFG_CDROM) > $(TEMP_CD_TREE)/boot/grub/grub.cfg

	cp -p /usr/lib/grub/powerpc-ieee1275/bootinfo.txt \
		$(TEMP_CD_TREE)/ppc/

	grub-mkrescue --output=$(TEMP_MINIISO) $(TEMP_CD_TREE)

# genisoimage CD info directory, including GRUB and configuration files.
.PHONY: arch_cd_info_dir
arch_cd_info_dir:
	rm -rf $(TEMP_CD_INFO_DIR)
	mkdir -p $(TEMP_CD_INFO_DIR)/boot/grub/powerpc-ieee1275 \
		 $(TEMP_CD_INFO_DIR)/ppc/chrp

	bootvars-subst \
		KERNEL /install/vmlinux \
		INITRD /install/initrd.gz \
	< $(GRUB_CFG_CDROM) > $(TEMP_CD_INFO_DIR)/boot/grub/grub.cfg
	grub-mkimage -O powerpc-ieee1275 -p '()/boot/grub' \
		-o $(TEMP_CD_INFO_DIR)/boot/grub/powerpc.elf \
		$(GRUB_MODULES) $(GRUB_MODULES_CDROM)
	cp -p /usr/lib/grub/powerpc-ieee1275/bootinfo.txt \
		$(TEMP_CD_INFO_DIR)/ppc/

# Netboot files
.PHONY: arch_netboot_dir
arch_netboot_dir:
	-rm -f $(TEMP_NETBOOT_DIR)
	mkdir -p $(TEMP_NETBOOT_DIR)/$(NETBOOT_PATH)
	cp $(TEMP_INITRD) $(TEMP_NETBOOT_DIR)/$(NETBOOT_PATH)
	cp $(TEMP_KERNEL) $(TEMP_NETBOOT_DIR)/$(NETBOOT_PATH)
	
	bootvars-subst \
		KERNEL $(NETBOOT_PATH)/vmlinux \
		INITRD $(NETBOOT_PATH)/initrd.gz \
	< $(GRUB_CFG_NETBOOT) > $(TEMP_NETBOOT_DIR)/$(NETBOOT_PATH)/grub.cfg
	if [ -n "$(SPLASH_PNG)" ]; then \
		cp $(SPLASH_PNG) $(TEMP_NETBOOT_DIR)/$(NETBOOT_PATH)/splash.png; \
	fi

	grub-mknetdir --net-directory=$(TEMP_NETBOOT_DIR) \
		--subdir=$(NETBOOT_PATH)
