From 6cce4fd330be0fab7fe4a749d4338e7c437b2e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 7 Feb 2012 18:46:30 +0100 Subject: [PATCH] use internal implementation of the addrsize utility Anaconda dropped the addrsize utility in F-16, so we need to implement it directly in lorax. --- share/s390.tmpl | 4 ++-- src/pylorax/ltmpl.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/share/s390.tmpl b/share/s390.tmpl index 41531773..ffc7ec37 100644 --- a/share/s390.tmpl +++ b/share/s390.tmpl @@ -26,10 +26,10 @@ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ## s390 needs some extra boot config -runcmd usr/libexec/anaconda/addrsize ${INITRD_ADDRESS} ${KERNELDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd_addrsize +createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize ## s390 also has some special treeinfo data -treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd_addrsize +treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm treeinfo images-${basearch} generic.ins generic.ins diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 850fe52e..2abce21b 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -34,6 +34,7 @@ from base import DataHolder from mako.lookup import TemplateLookup from mako.exceptions import text_error_template import sys, traceback +import struct class LoraxTemplate(object): def __init__(self, directories=["/usr/share/lorax"]): @@ -460,3 +461,15 @@ class LoraxTemplateRunner(object): self.remove(*remove) else: logger.debug("%s: no files to remove!", cmd) + + def createaddrsize(self, addr, src, dest): + ''' + createaddrsize INITRD_ADDRESS INITRD ADDRSIZE + Create the initrd.addrsize file required in LPAR boot process. + Examples: + createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize + ''' + addrsize = open(dest, "wb") + addrsize_data = struct.pack(">iiii", 0, int(addr, 16), 0, os.stat(src).st_size) + addrsize.write(addrsize_data) + addrsize.close()