[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[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 81aa4c9..a46331a 100644
--- a/share/s390.tmpl
+++ b/share/s390.tmpl
@@ -24,9 +24,9 @@ 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 03a7aed..92eac34 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()
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]