use internal implementation of the addrsize utility

Anaconda dropped the addrsize utility in F-16, so we need to implement
it directly in lorax.
This commit is contained in:
Dan Horák 2012-02-07 18:46:30 +01:00 committed by Martin Gracik
parent 2e08d3706c
commit 6cce4fd330
2 changed files with 15 additions and 2 deletions

View File

@ -26,10 +26,10 @@ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
## s390 needs some extra boot config ## 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 ## 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.prm ${BOOTDIR}/generic.prm
treeinfo images-${basearch} generic.ins generic.ins treeinfo images-${basearch} generic.ins generic.ins

View File

@ -34,6 +34,7 @@ from base import DataHolder
from mako.lookup import TemplateLookup from mako.lookup import TemplateLookup
from mako.exceptions import text_error_template from mako.exceptions import text_error_template
import sys, traceback import sys, traceback
import struct
class LoraxTemplate(object): class LoraxTemplate(object):
def __init__(self, directories=["/usr/share/lorax"]): def __init__(self, directories=["/usr/share/lorax"]):
@ -460,3 +461,15 @@ class LoraxTemplateRunner(object):
self.remove(*remove) self.remove(*remove)
else: else:
logger.debug("%s: no files to remove!", cmd) 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()