[PATCH 2/2] use internal implementation of the addrsize utility

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

 



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..9faed8b 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} ${KERNELDIR}/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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux