From 4448e59f6e74bae563703835b7801f7b64414869 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 22 Sep 2011 10:07:11 +0200 Subject: [PATCH] Use own addrsize implementation (dhorak) 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 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index a5f4f4ce..abb1d859 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -27,6 +27,7 @@ import subprocess import shutil import glob import collections +import struct from base import DataHolder from sysutils import joinpaths, cpfile, replace @@ -635,16 +636,13 @@ 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") + 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]