MEDIUM_SUPPORTED = cdrom netboot

KERNELMAJOR = 2.6
BASEVERSION = $(LINUX_KERNEL_ABI)
KERNELVERSION = $(BASEVERSION)-powerpc64le
KERNELNAME = vmlinux

GRUB_CFG_CDROM = boot/ppc64el/grub-cdrom.cfg

# GRUB modules
GRUB_MODULES = echo gzio linux minicmd 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)

include config/linux.cfg
