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

[PATCH 1/2] lorax: use own addrsize implementation



Anaconda doesn't built the addrsize tool used to create the file
containing size and load address for initrd.img. So we implement
its function directly in lorax.
---
 src/pylorax/images.py |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/pylorax/images.py b/src/pylorax/images.py
index 75d38e0..5b9a351 100644
--- a/src/pylorax/images.py
+++ b/src/pylorax/images.py
@@ -641,16 +641,12 @@ class S390(object):
             logger.info("compressing the install tree")
             self.installtree.compress(initrd, kernel, self.ctype, self.cargs)
 
-            # run addrsize
-            addrsize = joinpaths(self.installtree.root, "usr/libexec",
-                                 "anaconda", "addrsize")
-
-            cmd = [addrsize, INITRD_ADDRESS, initrd.fpath,
-                   joinpaths(self.outputroot, IMAGESDIR, "initrd.addrsize")]
-
-            p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
-                                 stdout=subprocess.PIPE)
-            p.wait()
+            # create initrd.addrsize
+            addrsize = open(joinpaths(self.outputroot, IMAGESDIR, "initrd.addrsize"), "wb")
+            import struct
+            addrsize_data = struct.pack('>iiii', 0, int(INITRD_ADDRESS, 16), 0, os.stat(initrd.fpath).st_size)
+            addrsize.write(addrsize_data)
+            addrsize.close()
 
             # add kernel and initrd to .treeinfo
             kernel_arch = kernel.version.split(".")[-1]
-- 
1.7.4.4


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