From cc2f98bfc5a75a4cc113e34847975a27654f0750 Mon Sep 17 00:00:00 2001 From: Mark Hamzy Date: Tue, 25 Mar 2014 15:35:31 -0500 Subject: [PATCH] support ppc64le in lorax Add support for the ppc64le architecture in lorax. Signed-off-by: Brian C. Lane --- share/ppc64le.tmpl | 82 ++++++++++++++++++++++++++++++++++++++ share/runtime-install.tmpl | 2 +- src/pylorax/__init__.py | 2 +- src/pylorax/treebuilder.py | 1 + 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 share/ppc64le.tmpl diff --git a/share/ppc64le.tmpl b/share/ppc64le.tmpl new file mode 100644 index 00000000..8fa15b00 --- /dev/null +++ b/share/ppc64le.tmpl @@ -0,0 +1,82 @@ +<%page args="kernels, runtime_img, basearch, libdir, inroot, outroot, product, isolabel"/> +<% +configdir="tmp/config_files/ppc" +BOOTDIR="ppc" +GRUBDIR="boot/grub" +LIVEDIR="LiveOS" + +## NOTE: yaboot freaks out and stops parsing its config if it sees a '\', +## so we can't use the udev escape sequences in the root arg. +## Instead we'll just replace any non-ASCII characters in the isolabel +## with '_', which means we won't need any udev escapes. +isolabel = ''.join(ch if ch.isalnum() else '_' for ch in isolabel) + +## Anaconda finds the CDROM device automatically +rootarg = "" +%> + +mkdir ${LIVEDIR} +install ${runtime_img} ${LIVEDIR}/squashfs.img +treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img + +## install the bootloaders +## ppc/chrp: for normal PPC systems. +## uses /ppc/bootinfo.txt in the iso root +## uses /boot/grub/grub.cfg in the iso root +mkdir ${BOOTDIR} +## boot stuff for normal (CHRP/PREP) PPC systems +install ${configdir}/bootinfo.txt ${BOOTDIR} + +mkdir ${GRUBDIR}/powerpc-ieee1275 +## "()" means the current device to grub2 +runcmd grub2-mkimage --format=powerpc-ieee1275 --directory=/usr/lib/grub/powerpc-ieee1275 --prefix="()/"${GRUBDIR} \ +--output=${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} +install ${configdir}/magic ${BOOTDIR} + +## Install kernel and bootloader config (in separate places for each arch) +%for kernel in kernels: + <% + bits = 64 + ## separate dirs/images for each arch + KERNELDIR=BOOTDIR+"/ppc%s" % bits + %> + ## install kernel + mkdir ${KERNELDIR} + installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz + installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img + + %if doupgrade: + ## upgrade image + installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img + %endif + + treeinfo images-${kernel.arch} zimage +%endfor + +## make boot.iso +mkdir images/ +runcmd mkisofs -v -U -J -R -T \ + -o ${outroot}/images/boot.iso \ + -part -hfs -r -l -sysid PPC \ + -A "${product.name} ${product.version}" -V '${isolabel}' \ + -volset "${product.version}" -volset-size 1 -volset-seqno 1 \ + -hfs-volid ${product.version} \ + -chrp-boot -map ${inroot}/${configdir}/mapping \ + -no-desktop -allow-multidot -graft-points \ + ${BOOTDIR}=${outroot}/${BOOTDIR} \ + ${GRUBDIR}=${outroot}/${GRUBDIR} \ + ${LIVEDIR}=${outroot}/${LIVEDIR} + +%for kernel in kernels: + treeinfo images-${kernel.arch} boot.iso images/boot.iso +%endfor diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl index db31844c..0150532e 100644 --- a/share/runtime-install.tmpl +++ b/share/runtime-install.tmpl @@ -34,7 +34,7 @@ installpkg grubby %if basearch in ("i386", "x86_64"): installpkg grub2 grub2-tools biosdevname memtest86+ syslinux %endif -%if basearch in ("ppc", "ppc64"): +%if basearch in ("ppc", "ppc64", "ppc64le"): installpkg grub2 grub2-tools fbset hfsutils kernel-bootwrapper ppc64-utils %endif %if basearch == "s390x": diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 380a30dc..f7029492 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -54,7 +54,7 @@ REMOVE_PPC64_DRIVERS = "floppy scsi_debug nouveau radeon cirrus mgag200" REMOVE_PPC64_MODULES = "drm plymouth" class ArchData(DataHolder): - lib64_arches = ("x86_64", "ppc64", "s390x", "ia64", "aarch64") + lib64_arches = ("x86_64", "ppc64", "ppc64le", "s390x", "ia64", "aarch64") bcj_arch = dict(i386="x86", x86_64="x86", ppc="powerpc", ppc64="powerpc", arm="arm", armhfp="arm") diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index d0fac4bb..dc8bb48b 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -35,6 +35,7 @@ templatemap = { 'x86_64': 'x86.tmpl', 'ppc': 'ppc.tmpl', 'ppc64': 'ppc.tmpl', + 'ppc64le': 'ppc64le.tmpl', 's390': 's390.tmpl', 's390x': 's390.tmpl', 'aarch64': 'aarch64.tmpl',