GRUB2 as the ISO boot loader for POWER arch

Currently, yaboot is the ISO boot loader in fedora and the Fedora on
POWER team is making an effort in order to replace it by GRUB2 in the
F20 release cycle. I'm sending a lorax patch so you guys can comment
on it. I'm planning to create a feature page for that too.

This patch only change the lorax template for ppc and should not
affect other archs, like x86.

--
Paulo Flabiano Smorigo
Software Engineer
Linux Technology Center - IBM Systems & Technology Group
This commit is contained in:
Paulo Flabiano Smorigo 2013-08-28 15:56:56 -07:00 committed by Brian C. Lane
parent 27a77100f5
commit 44638fbc8d
4 changed files with 55 additions and 34 deletions

View File

@ -51,6 +51,8 @@ Requires: syslinux >= 4.02-5
%ifarch ppc ppc64
Requires: kernel-bootwrapper
Requires: grub2
Requires: grub2-tools
%endif
%ifarch s390 s390x

View File

@ -1,7 +1,8 @@
<chrp-boot> <description>Linux</description>
<os-name>Linux</os-name>
<boot-script>boot &device;:\ppc\chrp\yaboot</boot-script>
<icon size=64,64 color-space=3,3,2>
<chrp-boot>
<description>grub 2.00</description>
<os-name>grub 2.00</os-name>
<boot-script>boot &device;:\boot\grub\powerpc-ieee1275\core.elf</boot-script>
<icon size=64,64 color-space=3,3,2>
<bitmap> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

View File

@ -0,0 +1,34 @@
set default=0
set timeout=5
echo -e "\nWelcome to the @PRODUCT@ @VERSION@ installer!\n\n"
for BITS in 32 64; do
if [ -d "/ppc/ppc${BITS}" ]; then
menuentry "Install @PRODUCT@ @VERSION@ (${BITS}-bit kernel)" $BITS --class fedora --class gnu-linux --class gnu --class os {
linux /ppc/ppc${2}/vmlinuz @ROOT@ ro
initrd /ppc/ppc${2}/initrd.img
}
menuentry "Test this media & install @PRODUCT@ @VERSION@ (${BITS}-bit kernel)" $BITS --class fedora --class gnu-linux --class gnu --class os {
linux /ppc/ppc${2}/vmlinuz @ROOT@ rd.live.check ro
initrd /ppc/ppc${2}/initrd.img
}
menuentry "Rescue a @PRODUCT@ system (${BITS}-bit kernel)" $BITS --class fedora --class gnu-linux --class gnu --class os {
linux /ppc/ppc${2}/vmlinuz @ROOT@ rescue ro
initrd /ppc/ppc${2}/initrd.img
}
fi
done
submenu 'Other options...' {
menuentry 'Reboot' {
reboot
}
menuentry 'Exit to Open Firmware' {
exit
}
}

View File

@ -2,6 +2,7 @@
<%
configdir="tmp/config_files/ppc"
BOOTDIR="ppc"
GRUBDIR="boot/grub"
LIVEDIR="LiveOS"
MACDIR=BOOTDIR+"/mac"
NETBOOTDIR="images/netboot"
@ -9,7 +10,6 @@ NETBOOTDIR="images/netboot"
WRAPPER="usr/sbin/wrapper"
WRAPPER_DATA="usr/"+libdir+"/kernel-wrapper"
bitsizes = set()
prepboot = ""
## NOTE: yaboot freaks out and stops parsing its config if it sees a '\',
@ -37,13 +37,18 @@ mkdir ${BOOTDIR}
## boot stuff for normal (CHRP/PREP) PPC systems
install ${configdir}/bootinfo.txt ${BOOTDIR}
install boot/efika.forth ${BOOTDIR}
mkdir ${BOOTDIR}/chrp
install usr/lib/yaboot/yaboot ${BOOTDIR}/chrp
runcmd ${inroot}/usr/lib/yaboot/addnote ${outroot}/${BOOTDIR}/chrp/yaboot
## special boot dir for PowerMacs
mkdir ${MACDIR}
install usr/lib/yaboot/yaboot ${MACDIR}
install ${configdir}/ofboot.b ${MACDIR}
mkdir ${GRUBDIR}/powerpc-ieee1275
runcmd grub2-mkimage -O powerpc-ieee1275 -d /usr/lib/grub/powerpc-ieee1275 -p '()/boot/grub' \
-o ${outroot}/${GRUBDIR}/powerpc-ieee1275/core.elf iso9660 ext2 ofnet net tftp http
install /usr/lib/grub/powerpc-ieee1275/*.mod ${GRUBDIR}/powerpc-ieee1275
install /usr/lib/grub/powerpc-ieee1275/*.lst ${GRUBDIR}/powerpc-ieee1275
install ${configdir}/grub.cfg.in ${GRUBDIR}/grub.cfg
replace @PRODUCT@ '${product.name}' ${GRUBDIR}/grub.cfg
replace @VERSION@ ${product.version} ${GRUBDIR}/grub.cfg
replace @ROOT@ "${rootarg}" ${GRUBDIR}/grub.cfg
## copy mapping and magic files needed for isos
install ${configdir}/mapping ${BOOTDIR}
@ -59,7 +64,6 @@ install ${configdir}/magic ${BOOTDIR}
## separate dirs/images for each arch
KERNELDIR=BOOTDIR+"/ppc%s" % bits
NETIMG=NETBOOTDIR+"/ppc%s.img" % bits
bitsizes.add(bits)
%>
## install kernel
mkdir ${KERNELDIR} ${NETBOOTDIR}
@ -71,13 +75,6 @@ install ${configdir}/magic ${BOOTDIR}
installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
%endif
## install arch-specific bootloader config
install ${configdir}/yaboot.conf.in ${KERNELDIR}/yaboot.conf
replace @BITS@ ${bits} ${KERNELDIR}/yaboot.conf
replace @PRODUCT@ '${product.name}' ${KERNELDIR}/yaboot.conf
replace @VERSION@ ${product.version} ${KERNELDIR}/yaboot.conf
replace @ROOT@ "${rootarg}" ${KERNELDIR}/yaboot.conf
## kernel-wrapper magic that makes the netboot combined ppc{32,64}.img
runcmd ${inroot}/${WRAPPER} -p of \
-D ${inroot}/${WRAPPER_DATA} \
@ -92,19 +89,6 @@ install ${configdir}/magic ${BOOTDIR}
%endif
%endfor
## choose correct yaboot.conf
mkdir etc
%if len(bitsizes) == 2:
## both kernels means hybrid - use the magic hybrid config
install ${configdir}/yaboot.conf.3264 etc/yaboot.conf
replace @PRODUCT@ ${product.name} etc/yaboot.conf
replace @VERSION@ ${product.version} etc/yaboot.conf
replace @ROOT@ "${rootarg}" etc/yaboot.conf
%else:
## single arch - use the arch-specific yaboot.conf from above
copy ${KERNELDIR}/yaboot.conf etc/yaboot.conf
%endif
## make boot.iso
runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
${prepboot} -part -hfs -T -r -l -J \
@ -113,8 +97,8 @@ runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
-hfs-volid ${product.version} -hfs-bless ${outroot}/${MACDIR} \
-map ${inroot}/${configdir}/mapping \
-no-desktop -allow-multidot -graft-points \
etc=${outroot}/etc \
${BOOTDIR}=${outroot}/${BOOTDIR} \
${GRUBDIR}=${outroot}/${GRUBDIR} \
${NETBOOTDIR}=${outroot}/${NETBOOTDIR} \
${LIVEDIR}=${outroot}/${LIVEDIR}