File adding-grub2-support-for-ppc.patch of Package cobbler.3314
Index: cobbler-2.6.6/cobbler/pxegen.py
===================================================================
--- cobbler-2.6.6.orig/cobbler/pxegen.py
+++ cobbler-2.6.6/cobbler/pxegen.py
@@ -78,6 +78,7 @@ class PXEGen:
"""
dst = self.bootloc
grub_dst = os.path.join(dst, "grub")
+ grub2_ppc_dst = os.path.join(dst, "boot/ppc64le/grub2-ieee1275")
image_dst = os.path.join(dst, "images")
# copy syslinux from one of two locations
@@ -136,6 +137,11 @@ class PXEGen:
os.path.join(self.bootloc, 'boot'))
pxegrub_imported = True
+ # copy grub2 which we include for PowerPC targets
+ grub2_ppc_src = '/var/lib/cobbler/loaders/grub2-ieee1275'
+ if os.path.exists(grub2_ppc_src):
+ shutil.copytree(grub2_ppc_src, grub2_ppc_dst)
+
def copy_images(self):
"""
Like copy_distros except for images.
@@ -391,6 +397,7 @@ class PXEGen:
# the default menus:
pxe_menu_items = ""
grub_menu_items = ""
+ grub2_menu_items = ""
yaboot_menu_items = ""
# For now, profiles are the only items we want grub EFI boot menu entries for:
@@ -415,14 +422,22 @@ class PXEGen:
if grub_contents is not None:
grub_menu_items = grub_menu_items + grub_contents + "\n"
- if distro.arch.startswith("ppc"):
+ # We add grub2 menu entries for SLE12+ ppc distros
+ if distro.arch.startswith("ppc") and distro.os_version.startswith("sles12"):
+ grub2_contents = self.write_pxe_file(filename=None, system=None,
+ profile=profile, distro=distro,
+ arch=distro.arch, include_header=False, format="grub2")
+ if grub2_contents is not None:
+ grub2_menu_items = grub2_menu_items + grub2_contents + "\n"
+
+ # For SLE11 we uses yaboot
+ elif distro.arch.startswith("ppc"):
yaboot_contents = self.write_pxe_file(filename=None, system=None,
profile=profile, distro=distro,
arch=distro.arch, include_header=False,format="yaboot")
if yaboot_contents is not None:
yaboot_menu_items = yaboot_menu_items + yaboot_contents + "\n"
-
# image names towards the bottom
for image in image_list:
if os.path.exists(image.file):
@@ -441,7 +456,8 @@ class PXEGen:
contents = self.write_memtest_pxe("/%s" % base)
pxe_menu_items = pxe_menu_items + contents + "\n"
- return {'pxe' : pxe_menu_items, 'grub' : grub_menu_items, 'yaboot' : yaboot_menu_items}
+ return {'pxe' : pxe_menu_items, 'grub' : grub_menu_items,
+ 'grub2': grub2_menu_items, 'yaboot' : yaboot_menu_items}
def get_menu_items_nexenta(self):
"""
@@ -506,6 +522,14 @@ class PXEGen:
self.templar.render(template_data, metadata, outfile, None)
template_src.close()
+ # Write the grub2 ppc64le menu:
+ metadata = { "grub2_menu_items" : menu_items['grub2'] }
+ outfile = os.path.join(self.bootloc, "boot/ppc64le/grub2-ieee1275", "grub.cfg")
+ template_src = open(os.path.join(self.settings.pxe_template_dir, "grub2default.template"))
+ template_data = template_src.read()
+ self.templar.render(template_data, metadata, outfile, None)
+ template_src.close()
+
# Write the yaboot menu:
metadata = { "yaboot_menu_items" : menu_items['yaboot'] }
outfile = os.path.join(self.bootloc, "yaboot.conf")
@@ -651,7 +675,9 @@ class PXEGen:
local = os.path.join(self.settings.pxe_template_dir, "grublocal.template")
if os.path.exists(local):
template = local
- elif format =="yaboot":
+ elif format == "grub2":
+ template = os.path.join(self.settings.pxe_template_dir,"grub2system_ppc.template")
+ elif format == "yaboot":
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ppc.template")
else: # pxe
if system.netboot_enabled:
@@ -661,6 +687,8 @@ class PXEGen:
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_s390x.template")
elif arch == "ia64":
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ia64.template")
+ elif distro and distro.os_version.startswith("sles12") and arch.startswith("ppc"):
+ template = os.path.join(self.settings.pxe_template_dir,"grub2system_ppc.template")
elif arch.startswith("ppc"):
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ppc.template")
elif arch.startswith("arm"):
@@ -704,6 +732,8 @@ class PXEGen:
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_s390x.template")
elif arch.startswith("ppc") and format == "yaboot":
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_ppc.template")
+ elif arch.startswith("ppc") and format == "grub2":
+ template = os.path.join(self.settings.pxe_template_dir,"grub2system_ppc.template")
elif arch.startswith("arm"):
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_arm.template")
elif format == "grub":
Index: cobbler-2.6.6/templates/pxe/grub2default.template
===================================================================
--- /dev/null
+++ cobbler-2.6.6/templates/pxe/grub2default.template
@@ -0,0 +1,13 @@
+with_gfx=0
+
+gfxmode=auto
+lang=en
+
+insmod gettext
+
+color_normal=light-gray/black
+color_highlight=white/light-gray
+
+timeout=80
+
+$grub2_menu_items
Index: cobbler-2.6.6/templates/pxe/grub2system_ppc.template
===================================================================
--- /dev/null
+++ cobbler-2.6.6/templates/pxe/grub2system_ppc.template
@@ -0,0 +1,6 @@
+menuentry '$profile_name' --class opensuse --class gnu-linux --class gnu --class os {
+ echo 'Loading kernel ...'
+ linux $kernel_path $kernel_options
+ echo 'Loading initial ramdisk ...'
+ initrd $initrd_path
+}