Configurable compression type/speed/bcj use
* add bcj arch dict to ArchData * add "compression" settings back to __init__.py * pass them to treebuilder.create_runtime * pass them through to imgutils.mksquashfs
This commit is contained in:
parent
7f087ead73
commit
3099c0a44d
@ -51,10 +51,14 @@ from discinfo import DiscInfo
|
||||
|
||||
class ArchData(DataHolder):
|
||||
lib64_arches = ("x86_64", "ppc64", "sparc64", "s390x", "ia64")
|
||||
bcj = dict(i386="x86", x86_64="x86",
|
||||
ppc="powerpc", ppc64="powerpc",
|
||||
sparc="sparc", sparc64="sparc")
|
||||
def __init__(self, buildarch):
|
||||
self.buildarch = buildarch
|
||||
self.basearch = getBaseArch(buildarch)
|
||||
self.libdir = "lib64" if self.basearch in self.lib64_arches else "lib"
|
||||
self.bcj = bcj.get(self.basearch)
|
||||
|
||||
class Lorax(BaseLoraxClass):
|
||||
|
||||
@ -83,7 +87,8 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
self.conf.add_section("compression")
|
||||
self.conf.set("compression", "type", "xz")
|
||||
self.conf.set("compression", "speed", "9")
|
||||
self.conf.set("compression", "args", "")
|
||||
self.conf.set("compression", "bcj", "on")
|
||||
|
||||
# read the config file
|
||||
if os.path.isfile(conf_file):
|
||||
@ -210,8 +215,15 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
logger.info("creating the runtime image")
|
||||
runtime = "images/install.img"
|
||||
# FIXME: compression options (type, speed, etc.)
|
||||
rb.create_runtime(joinpaths(installroot,runtime))
|
||||
compression = self.conf.get("compression", "type")
|
||||
compressargs = self.conf.get("compression", "args").split()
|
||||
if self.conf.getboolean("compression", "bcj"):
|
||||
if self.arch.bcj:
|
||||
compressargs += ["-Xbcj", self.arch.bcj]
|
||||
else:
|
||||
logger.info("no BCJ filter for arch %s", self.arch.basearch)
|
||||
rb.create_runtime(joinpaths(installroot,runtime),
|
||||
compression=compression, compressargs=compressargs)
|
||||
|
||||
logger.info("preparing to build output tree and boot images")
|
||||
treebuilder = TreeBuilder(product=self.product, arch=self.arch,
|
||||
|
@ -108,7 +108,7 @@ class RuntimeBuilder(object):
|
||||
check_call(["depmod", "-a", "-F", ksyms, "-b", root, kver])
|
||||
generate_module_info(moddir+kver, outfile=moddir+"module-info")
|
||||
|
||||
def create_runtime(self, outfile="/tmp/squashfs.img"):
|
||||
def create_runtime(self, outfile="/tmp/squashfs.img", compression="xz", compressargs=[]):
|
||||
# make live rootfs image - must be named "LiveOS/rootfs.img" for dracut
|
||||
workdir = joinpaths(os.path.dirname(outfile), "runtime-workdir")
|
||||
fssize = 2 * (1024*1024*1024) # 2GB sparse file compresses down to nothin'
|
||||
@ -116,7 +116,7 @@ class RuntimeBuilder(object):
|
||||
imgutils.mkext4img(self.vars.root, joinpaths(workdir, "LiveOS/rootfs.img"),
|
||||
label="Anaconda", size=fssize)
|
||||
# squash the live rootfs and clean up workdir
|
||||
imgutils.mksquashfs(workdir, outfile)
|
||||
imgutils.mksquashfs(workdir, outfile, compression, compressargs)
|
||||
remove(workdir)
|
||||
|
||||
class TreeBuilder(object):
|
||||
|
Loading…
Reference in New Issue
Block a user