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

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

 



On 09/01/2011 11:21 AM, Dan Horák wrote:
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]

Ack.

--
David Cantrell <dcantrell@xxxxxxxxxx>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
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