[lorax] GRUB as the ISO boot loader for POWER arch

Paulo Flabiano Smorigo/Brazil/IBM pfsmorigo at br.ibm.com
Thu Aug 15 16:34:48 UTC 2013


Hi all,

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


---
  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 af2d42c..fe87b28 100644
--- a/lorax.spec
+++ b/lorax.spec
@@ -23,6 +23,8 @@ Requires:       genisoimage
  Requires:       glib2
  Requires:       glibc
  Requires:       glibc-common
+Requires:       grub2
+Requires:       grub2-tools
  Requires:       gzip
  Requires:       isomd5sum
  Requires:       libselinux-python
diff --git a/share/config_files/ppc/bootinfo.txt  
b/share/config_files/ppc/bootinfo.txt
index ac766d4..6eac6c4 100644
--- a/share/config_files/ppc/bootinfo.txt
+++ b/share/config_files/ppc/bootinfo.txt
@@ -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
diff --git a/share/config_files/ppc/grub.cfg.in  
b/share/config_files/ppc/grub.cfg.in
new file mode 100644
index 0000000..f125ac2
--- /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 bbef5fa..dfd3257 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}

-- 
1.8.2.1



More information about the anaconda-patches mailing list