The following patches add support for network booting PowerPC systems using yaboot. The version of yaboot included is yaboot-1.3.14. This version does not yet full support booting Fedora10 ppc images yet. Work is underway with the yaboot-devel (http://yaboot.ozlabs.org/) crew to address this.
In addition to network boot support, `cobbler import` will now recognize and process ppc distros.
As suggested by Michael, my next step will be to flesh out a wiki page detailing the process.
Comments/questions welcome.
Thanks, James
--- kickstarts/legacy.ks | 6 ++---- kickstarts/sample.ks | 5 ++--- kickstarts/sample_end.ks | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/kickstarts/legacy.ks b/kickstarts/legacy.ks index 348798c..a4fd8c2 100644 --- a/kickstarts/legacy.ks +++ b/kickstarts/legacy.ks @@ -34,13 +34,11 @@ timezone America/New_York install # Clear the Master Boot Record zerombr - -# Magically figure out how to partition this thing -SNIPPET::main_partition_select +# Allow anaconda to partition the system as needed +autopart
%pre $kickstart_start -SNIPPET::pre_partition_select SNIPPET::pre_install_network_config
%packages diff --git a/kickstarts/sample.ks b/kickstarts/sample.ks index dda8e0a..00672fb 100644 --- a/kickstarts/sample.ks +++ b/kickstarts/sample.ks @@ -36,13 +36,12 @@ timezone America/New_York install # Clear the Master Boot Record zerombr +# Allow anaconda to partition the system as needed +autopart
-# Magically figure out how to partition this thing -$SNIPPET('main_partition_select')
%pre $kickstart_start -$SNIPPET('pre_partition_select') $SNIPPET('pre_install_network_config')
%packages diff --git a/kickstarts/sample_end.ks b/kickstarts/sample_end.ks index 7901adf..c807413 100644 --- a/kickstarts/sample_end.ks +++ b/kickstarts/sample_end.ks @@ -40,12 +40,10 @@ timezone America/New_York install # Clear the Master Boot Record zerombr - -# Magically figure out how to partition this thing -SNIPPET::main_partition_select +# Allow anaconda to partition the system as needed +autopart
%pre -SNIPPET::pre_partition_select SNIPPET::pre_install_network_config $kickstart_start %end
--- snippets/partition_select | 24 ++++++++++++++++++++++-- snippets/pre_partition_select | 24 ++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/snippets/partition_select b/snippets/partition_select index 1f3e523..a878767 100644 --- a/snippets/partition_select +++ b/snippets/partition_select @@ -7,8 +7,28 @@ let numd=$#/2 d1=$1 d2=$3
+# Determine architecture-specific partitioning needs +EFI_PART="" +PPC_PREP_PART="" +BOOT_PART="" + +case $(uname -m) in + ia64) + EFI_PART="part /boot/efi --fstype vfat --size 200 --recommended" + ;; + ppc*) + PPC_PREP_PART="part None --fstype 'PPC PReP Boot' --size 8" + BOOT_PART="part /boot --fstype ext3 --size 200 --recommended" + ;; + *) + BOOT_PART="part /boot --fstype ext3 --size 200 --recommended" + ;; +esac + cat << EOF > /tmp/partinfo +$EFI_PART +$PPC_PREP_PART +$BOOT_PART part / --fstype ext3 --size=1024 --grow --ondisk=$d1 --asprimary -part swap --size=1024 --ondisk=$d1 --asprimary +part swap --recommended --ondisk=$d1 --asprimary EOF - diff --git a/snippets/pre_partition_select b/snippets/pre_partition_select index 1ea7e81..f9cac1e 100644 --- a/snippets/pre_partition_select +++ b/snippets/pre_partition_select @@ -6,8 +6,28 @@ let numd=$#/2 d1=$1 d2=$3
+# Determine architecture-specific partitioning needs +EFI_PART="" +PPC_PREP_PART="" +BOOT_PART="" + +case $(uname -m) in + ia64) + EFI_PART="part /boot/efi --fstype vfat --size 200 --recommended" + ;; + ppc*) + PPC_PREP_PART="part None --fstype 'PPC PReP Boot' --size 8" + BOOT_PART="part /boot --fstype ext3 --size 200 --recommended" + ;; + *) + BOOT_PART="part /boot --fstype ext3 --size 200 --recommended" + ;; +esac + cat << EOF > /tmp/partinfo +$EFI_PART +$PPC_PREP_PART +$BOOT_PART part / --fstype ext3 --size=1024 --grow --ondisk=$d1 --asprimary -part swap --size=1024 --ondisk=$d1 --asprimary +part swap --recommended --ondisk=$d1 --asprimary EOF -
--- templates/pxesystem_ppc.template | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 templates/pxesystem_ppc.template
diff --git a/templates/pxesystem_ppc.template b/templates/pxesystem_ppc.template new file mode 100644 index 0000000..09cf2aa --- /dev/null +++ b/templates/pxesystem_ppc.template @@ -0,0 +1,11 @@ +# yaboot.conf generated by cobbler +init-message="Cobbler generated yaboot configuration.\nHit <TAB> for boot options" +timeout=80 +delay=100 +default=linux + +image=$kernel_path + label=linux + initrd=$initrd_path + append="$append_line" +
--- cobbler/codes.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cobbler/codes.py b/cobbler/codes.py index b3b5bc8..968e517 100644 --- a/cobbler/codes.py +++ b/cobbler/codes.py @@ -41,7 +41,7 @@ VALID_OS_BREEDS = [ ]
VALID_OS_VERSIONS = { - "redhat" : [ "rhel2.1", "rhel3", "rhel4", "rhel5", "fedora5", "fedora6", "fedora7", "fedora8", "fedora9", "generic24", "generic26", "other" ], + "redhat" : [ "rhel2.1", "rhel3", "rhel4", "rhel5", "fedora5", "fedora6", "fedora7", "fedora8", "fedora9", "fedora10", "generic24", "generic26", "other" ], "suse" : [ "sles10", "generic24", "generic26", "other" ], "debian" : [ "etch", "lenny", "generic24", "generic26", "other" ], "ubuntu" : [ "WartyWarthog", "HoaryHedgehog", "BreezyBadger", "DapperDrake", "EdgyEft", "FeistyFawn", "GutsyGibbon", "HardyHeron", "IntrepidIbex", "JauntyJackalope" ],
--- setup.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/setup.py b/setup.py index 909ce81..2886587 100644 --- a/setup.py +++ b/setup.py @@ -145,6 +145,7 @@ if __name__ == "__main__": # bootloaders and syslinux support files (cobpath, ['loaders/elilo-3.8-ia64.efi']), (cobpath, ['loaders/menu.c32']), + (cobpath, ['loaders/yaboot-1.3.14']), ("/var/lib/cobbler/config/distros.d", []), ("/var/lib/cobbler/config/profiles.d", []), ("/var/lib/cobbler/config/systems.d", []), @@ -169,6 +170,7 @@ if __name__ == "__main__": (etcpath, ['templates/pxesystem.template']), (etcpath, ['templates/pxesystem_s390x.template']), (etcpath, ['templates/pxesystem_ia64.template']), + (etcpath, ['templates/pxesystem_ppc.template']), (etcpath, ['templates/pxeprofile.template']), (etcpath, ['templates/pxelocal.template']), (etcpath, ['templates/zone.template']),
--- cobbler/utils.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cobbler/utils.py b/cobbler/utils.py index fe01209..59325d0 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -886,13 +886,13 @@ def mkdir(path,mode=0777): raise CX(_("Error creating") % path)
def set_arch(self,arch): - if arch in [ "standard", "ia64", "x86", "i386", "x86_64", "s390x" ]: + if arch in [ "standard", "ia64", "x86", "i386", "ppc", "x86_64", "s390x" ]: if arch == "x86" or arch == "standard": # be consistent arch = "i386" self.arch = arch return True - raise CX(_("arch choices include: x86, x86_64, s390x and ia64")) + raise CX(_("arch choices include: x86, x86_64, ppc, s390x and ia64"))
def set_os_version(self,os_version): if os_version is None:
--- cobbler/modules/manage_isc.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/cobbler/modules/manage_isc.py b/cobbler/modules/manage_isc.py index a645072..bafa54d 100644 --- a/cobbler/modules/manage_isc.py +++ b/cobbler/modules/manage_isc.py @@ -172,6 +172,7 @@ class IscManager: # through each network interface of each system. dhcp_tags = { "default": {} } elilo = "/elilo-3.6-ia64.efi" + yaboot = "/yaboot-1.3.14"
for system in self.systems: if not system.is_management_supported(cidr_ok=False): @@ -206,6 +207,8 @@ class IscManager: # can't use pxelinux.0 anymore if distro.arch == "ia64": interface["filename"] = elilo + elif distro.arch.startswith("ppc"): + interface["filename"] = yaboot
# If we have all values defined and we're using omapi, # we will just create entries dinamically into DHCPD @@ -237,6 +240,7 @@ class IscManager: "cobbler_server" : self.settings.server, "next_server" : self.settings.next_server, "elilo" : elilo, + "yaboot" : yaboot, "dhcp_tags" : dhcp_tags }
--- cobbler/action_import.py | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 4a12fac..7baa79f 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -88,8 +88,8 @@ class Importer: if self.arch == "x86": # be consistent self.arch = "i386" - if self.arch not in [ "i386", "ia64", "x86_64", "s390x" ]: - raise CX(_("arch must be i386, ia64, x86_64, or s390x")) + if self.arch not in [ "i386", "ia64", "ppc", "s390x", "x86_64", ]: + raise CX(_("arch must be i386, ia64, ppc, s390x or x86_64"))
# if we're going to do any copying, set where to put things # and then make sure nothing is already there. @@ -113,7 +113,7 @@ class Importer: if self.arch: # append the arch path to the name if the arch is not already # found in the name. - for x in [ "ia64", "i386", "x86_64", "x86", "s390x" ]: + for x in [ "i386", "ia64", "ppc", "s390x", "x86_64", "x86", ]: if self.mirror_name.lower().find(x) != -1: if self.arch != x : raise CX(_("Architecture found on pathname (%s) does not fit the one given in command line (%s)")%(x,self.arch)) @@ -515,7 +515,7 @@ class Importer: print "- following symlink: %s" % fullname os.path.walk(fullname, self.distro_adder, foo)
- if x.startswith("initrd"): + if x.startswith("initrd") or x.startswith("ramdisk.image.gz"): initrd = os.path.join(dirname,x) if ( x.startswith("vmlinuz") or x.startswith("kernel.img") ) and x.find("initrd") == -1: kernel = os.path.join(dirname,x) @@ -680,7 +680,7 @@ class Importer: # remove any architecture name related string, as real arch will be appended later
for separator in [ '-' , '_' , '.' ] : - for arch in [ "i386" , "x86_64" , "ia64" , "x86" , "s390x" , "386" , "amd" ]: + for arch in [ "i386" , "x86_64" , "ia64" , "x86" , "s390x" , "ppc", "386" , "amd" ]: name = name.replace("%s%s" % ( separator , arch ),"")
return name @@ -700,6 +700,8 @@ class Importer: return "i386" if dirname.find("s390") != -1: return "s390x" + if dirname.find("ppc") != -1: + return "ppc" return None
# ============================================== @@ -810,7 +812,7 @@ class BaseImporter: for x in fnames: if self.match_kernelarch_file(x): # print _("- kernel header found: %s") % x - for arch in [ "i386" , "x86_64" , "ia64" , "s390x" ]: + for arch in [ "i386" , "x86_64" , "ia64" , "ppc", "s390x" ]: if x.find(arch) != -1: foo[arch] = 1 for arch in [ "i686" , "amd64" ]:
--- cobbler/pxegen.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index 012689b..9487846 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -87,6 +87,9 @@ class PXEGen: # copy menu.c32 as the older one has some bugs on certain RHEL utils.copyfile_pattern('/var/lib/cobbler/menu.c32', dst)
+ # copy yaboot which we include for PowerPC targets + utils.copyfile_pattern('/var/lib/cobbler/yaboot-1.3.14', dst) + # copy memdisk as we need it to boot ISOs try: utils.copyfile_pattern('/usr/lib/syslinux/memdisk', dst) @@ -191,6 +194,26 @@ class PXEGen:
filename = "%s.conf" % utils.get_config_filename(system,interface=name) f2 = os.path.join(self.bootloc, filename) + elif working_arch.startswith("ppc"): + # If no ip address is stored with this interface, try the hostname + if not ip: + ip = interface.get("hostname", "") + + # yaboot wants a filename using the IP address in hex under etc/ + if ip is None or ip == "": + # print _("Warning: Skipping PowerPC system object (%s) with interface '%s'. Needs an IP address or hostname to PXE") % (system.name, interface["mac_address"]) + continue + else: + # Determine filename for system-specific yaboot.conf + filename = "%s" % utils.get_config_filename(system, interface=name).lower() + f2 = os.path.join(self.bootloc, "etc", filename) + + # Link to the yaboot binary + f3 = os.path.join(self.bootloc, "ppc", filename) + if os.path.lexists(f3): + utils.rmfile(f3) + os.symlink("../yaboot-1.3.14", f3) + elif working_arch == "s390x": filename = "%s" % utils.get_config_filename(system,interface=name) f2 = os.path.join(self.bootloc, "s390x", filename) @@ -385,8 +408,41 @@ class PXEGen: template = "/etc/cobbler/pxesystem_s390x.template" elif arch == "ia64": template = "/etc/cobbler/pxesystem_ia64.template" + elif arch.startswith("ppc"): + template = "/etc/cobbler/pxesystem_ppc.template" else: - template = "/etc/cobbler/pxelocal.template" + # local booting on ppc requires removing the system-specific dhcpd.conf filename + if arch.startswith("ppc"): + # Disable yaboot network booting for all interfaces on the system + for (name,interface) in system.interfaces.iteritems(): + + # If no ip address is stored with this interface, try the hostname + ip_or_hostname = None + for key in ["ip_address", "hostname"]: + ip_or_hostname = interface.get(key, None) + if ip_or_hostname: + break + + # If an ip or hostname was found, attempt to remove the yaboot.conf and symlink + if ip_or_hostname: + # Determine filename for system-specific yaboot.conf + filename = "%s" % utils.get_config_filename(system, interface=name).lower() + + # Remove symlink to the yaboot binary + f3 = os.path.join(self.bootloc, "ppc", filename) + if os.path.lexists(f3): + utils.rmfile(f3) + + # Remove the interface-specific config file + f3 = os.path.join(self.bootloc, "etc", filename) + if os.path.lexists(f3): + utils.rmfile(f3) + + # Yaboot/OF doesn't support booting locally once you've + # booted off the network, so nothing left to do + return None + else: + template = "/etc/cobbler/pxelocal.template" else: template = "/etc/cobbler/pxeprofile.template"
@@ -402,7 +458,7 @@ class PXEGen:
# generate the append line hkopts = utils.hash_to_string(kopts) - if (not arch or arch != "ia64") and initrd_path: + if (not arch or arch not in ["ia64","ppc"]) and initrd_path: append_line = "append initrd=%s %s" % (initrd_path, hkopts) else: append_line = "append %s" % hkopts @@ -427,7 +483,7 @@ class PXEGen: # interface=bootif causes a failure # append_line = append_line.replace("ksdevice","interface")
- if arch == "s390x": + if arch in ["s390x", "ppc", "ppc64"]: # remove the prefix "append" append_line = append_line[7:]
James Laska wrote:
cobbler/pxegen.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 59 insertions(+), 3 deletions(-)
I've merged this entire series, outstanding, thanks!
Aside -- the partition autocreation snippets have changed to now use autopart. To the best of our knowledge this does /not/ work on RHEL 2, so in the short future I'll be adding a rhel 2 specific snippet. I imagine there's not a ton of RHEL 2 out there, but it seems to require additional changes above and beyond what we had in the "legacy.ks" template anyway.
--Michael
On Fri, 2008-11-14 at 11:13 -0500, Michael DeHaan wrote:
Aside -- the partition autocreation snippets have changed to now use autopart.
Thanks for the reminder Michael!
The existing pre_partition_ SNIPPETS have been adjusted to better accommodate ia64 and ppc partitioning needs (see https://fedorahosted.org/pipermail/cobbler/2008-November/001539.html). Folks can continue to use those SNIPPETS to install RHEL2 and newer products.
To the best of our knowledge this does /not/ work on RHEL 2, so in the short future I'll be adding a rhel 2 specific snippet. I imagine there's not a ton of RHEL 2 out there, but it seems to require additional changes above and beyond what we had in the "legacy.ks" template anyway.
Oops, I should have changed legacy.ks then ... would it make sense for that kickstart to continue to use the SNIPPETs?
Thanks, James
James Laska wrote:
On Fri, 2008-11-14 at 11:13 -0500, Michael DeHaan wrote:
Aside -- the partition autocreation snippets have changed to now use autopart.
Thanks for the reminder Michael!
The existing pre_partition_ SNIPPETS have been adjusted to better accommodate ia64 and ppc partitioning needs (see https://fedorahosted.org/pipermail/cobbler/2008-November/001539.html). Folks can continue to use those SNIPPETS to install RHEL2 and newer products.
To the best of our knowledge this does /not/ work on RHEL 2, so in the short future I'll be adding a rhel 2 specific snippet. I imagine there's not a ton of RHEL 2 out there, but it seems to require additional changes above and beyond what we had in the "legacy.ks" template anyway.
Oops, I should have changed legacy.ks then ... would it make sense for that kickstart to continue to use the SNIPPETs?
Thanks, James
That kickstart (legacy.ks) is used for anything that doesn't support yum via "repo" in the kickstart.
So it's also used by EL 4.
I think it would be better to make things all use autopart /if/ it's safe and make a new kickstart for EL 2.
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
--- Makefile | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile index 6bf0994..536007e 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,11 @@ clean: #-rm -f docs/cobbler.1.gz #-rm -f docs/cobbler.html #-rm -f po/messages.pot* + -rm -f cobbler/*.pyc + -rm -f cobbler/yaml/*.pyc + -rm -f cobbler/webui/master.py + -rm -f config/modules.conf config/settings + -rm -f docs/cobbler.1.gz docs/cobbler.html
manpage: pod2man --center="cobbler" --release="" ./docs/cobbler.pod | gzip -c > ./docs/cobbler.1.gz
cobbler@lists.fedorahosted.org