# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../yaboot/boot/boot.in
# Copyright (C) 2008 The OpenSDE Project
# Copyright (C) 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

boot_cd_pre()
{
	mkdir -p $isofsdir/{boot,etc}/

	cp $build_root/usr/lib/yaboot/yaboot $isofsdir/boot/yaboot
	cp $build_root/usr/lib/yaboot/yaboot.rs6k $isofsdir/boot/yaboot.rs6k
	# rs6k b50, but does not work, yet:
	cp $isofsdir/{boot/yaboot.rs6k,install.bin}

	cp -v $base/package/$bootloader/boot/{boot.msg,ofboot.b} \
	      $isofsdir/boot/
        cp -v $base/package/$bootloader/boot/mapping $isofsdir/

	# IBM RS/6000
	echo "device=cdrom:" > $isofsdir/etc/yaboot.conf
	# Apple New World
	echo "device=cd:" > $isofsdir/boot/yaboot.conf

	echo -e "\nmessage=/boot/boot.msg\n" > $isofsdir/x
}

boot_cd_add()
{
	# unused $3, verbose name
	cat >> $isofsdir/x <<-EOT
image=$4
    label=$2
    initrd=$5
    initrd-size=8192

EOT
}

boot_cd_post()
{
	# footer
	cat $isofsdir/x >> $isofsdir/boot/yaboot.conf
	cat $isofsdir/x >> $isofsdir/etc/yaboot.conf
	rm $isofsdir/x

	echo_status "Creating isofs_arch.txt file .."

	cat > $build_toolchain/isofs_arch.txt <<- EOT
BOOT    -hfs -part -map $isofsdir/mapping -hfs-volid T2
BOOTx   -hfs-bless boot -sysid PPC -l -L -r -T -chrp-boot -no-desktop
BOOTx   --prep-boot install.bin
DISK1   $isofsdir/boot/ boot/
DISK1   $isofsdir/etc/ etc/
DISK1   $isofsdir/install.bin install.bin
DISK1   $isofsdir/2nd_stage.tar 2nd_stage.tar
DISK1   $isofsdir/2nd_stage_small.tar 2nd_stage_small.tar
EOT
}