File adding-grub2-support-for-ppc.patch of Package cobbler
Index: cobbler-2.2.2/cobbler/pxegen.py
===================================================================
--- cobbler-2.2.2.orig/cobbler/pxegen.py
+++ cobbler-2.2.2/cobbler/pxegen.py
@@ -77,6 +77,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
@@ -122,6 +123,13 @@ class PXEGen:
require_match=False, api=self.api, cache=False, logger=self.logger)
+ # copy grub2 which we include for PowerPC targets
+ grub2_ppc_src = '/var/lib/cobbler/loaders/grub2-ieee1275'
+ if os.path.exists(grub2_ppc_src):
+ if os.path.exists(grub2_ppc_dst):
+ shutil.rmtree(grub2_ppc_dst)
+ shutil.copytree(grub2_ppc_src, grub2_ppc_dst)
+
def copy_images(self):
"""
Like copy_distros except for images.
@@ -364,6 +372,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:
@@ -373,7 +382,7 @@ class PXEGen:
continue
distro = profile.get_conceptual_parent()
# xen distros can be ruled out as they won't boot
- if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64"]:
+ if distro.name.find("-xen") != -1 or distro.arch not in ["i386", "x86_64", "ppc", "ppc64", "ppc64le"]:
# can't PXE Xen
continue
contents = self.write_pxe_file(filename=None, system=None,
@@ -388,14 +397,20 @@ class PXEGen:
if grub_contents is not None:
grub_menu_items = grub_menu_items + grub_contents + "\n"
+ # We add grub2 menu entries for SLE12+ ppc distros and yaboot for SLE11
if distro.arch.startswith("ppc"):
+ 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"
+
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):
@@ -430,6 +445,14 @@ class PXEGen:
self.templar.render(template_data, metadata, outfile, None)
template_src.close()
+ # Write the grub2 ppc64le menu:
+ metadata = { "grub2_menu_items" : grub2_menu_items }
+ 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" : yaboot_menu_items }
outfile = os.path.join(self.bootloc, "yaboot.conf")
@@ -548,6 +571,8 @@ class PXEGen:
if system:
if format == "grub":
template = os.path.join(self.settings.pxe_template_dir, "grubsystem.template")
+ 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
@@ -558,6 +583,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 distro and distro.os_version.startswith("esxi"):
@@ -599,6 +626,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 format == "grub":
template = os.path.join(self.settings.pxe_template_dir,"grubprofile.template")
elif distro and distro.os_version.startswith("esxi"):
Index: cobbler-2.2.2/templates/pxe/grub2default.template
===================================================================
--- /dev/null
+++ cobbler-2.2.2/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.2.2/templates/pxe/grub2system_ppc.template
===================================================================
--- /dev/null
+++ cobbler-2.2.2/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
+}
Index: cobbler-2.2.2/cobbler/utils.py
===================================================================
--- cobbler-2.2.2.orig/cobbler/utils.py
+++ cobbler-2.2.2/cobbler/utils.py
@@ -1310,9 +1310,9 @@ def set_arch(self,arch,repo=False):
arch = "i386"
if repo:
- valids = [ "i386", "x86_64", "ia64", "ppc", "ppc64", "s390", "s390x", "noarch", "src" ]
+ valids = [ "i386", "x86_64", "ia64", "ppc", "ppc64" "ppc64le", "s390", "s390x", "noarch", "src" ]
else:
- valids = [ "i386", "x86_64", "ia64", "ppc", "ppc64", "s390", "s390x" ]
+ valids = [ "i386", "x86_64", "ia64", "ppc", "ppc64", "ppc64le", "s390", "s390x" ]
if arch in valids:
self.arch = arch