From af4cf820717993bbefeebe72274b15d3bab7692d Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Wed, 28 Aug 2013 15:56:56 -0700 Subject: [PATCH] GRUB2 as the ISO boot loader for POWER arch (#1131199) 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 Resolves: rhbz#1131199 Signed-off-by: Brian C. Lane --- lorax.spec | 2 ++ share/config_files/ppc/bootinfo.txt | 9 +++--- share/config_files/ppc/grub.cfg.in | 34 ++++++++++++++++++++++ share/ppc.tmpl | 44 +++++++++-------------------- 4 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 share/config_files/ppc/grub.cfg.in diff --git a/lorax.spec b/lorax.spec index b74d2196..6900f5a6 100644 --- a/lorax.spec +++ b/lorax.spec @@ -54,6 +54,8 @@ Requires: syslinux >= 4.02-5 %ifarch ppc ppc64 Requires: kernel-bootwrapper +Requires: grub2 +Requires: grub2-tools %endif %ifarch s390 s390x diff --git a/share/config_files/ppc/bootinfo.txt b/share/config_files/ppc/bootinfo.txt index ac766d4d..6eac6c4d 100644 --- a/share/config_files/ppc/bootinfo.txt +++ b/share/config_files/ppc/bootinfo.txt @@ -1,7 +1,8 @@ - Linux -Linux -boot &device;:\ppc\chrp\yaboot - + +grub 2.00 +grub 2.00 +boot &device;:\boot\grub\powerpc-ieee1275\core.elf + 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 diff --git a/share/config_files/ppc/grub.cfg.in b/share/config_files/ppc/grub.cfg.in new file mode 100644 index 00000000..b156edeb --- /dev/null +++ b/share/config_files/ppc/grub.cfg.in @@ -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 + } +} + diff --git a/share/ppc.tmpl b/share/ppc.tmpl index bbef5fa1..ee6359d1 100644 --- a/share/ppc.tmpl +++ b/share/ppc.tmpl @@ -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}