Skip to content

Commit

Permalink
erofs: Change the erofs compression default to zstd
Browse files Browse the repository at this point in the history
--rootfs-type erofs now uses:
zstd,8 -Ededupe,all-fragments -C 65536

unless overridden by the 'compression.erofs' section of a lorax config
file.
  • Loading branch information
bcl committed Nov 20, 2024
1 parent 0522a81 commit 0571214
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lorax.spec
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Requires: isomd5sum
Requires: module-init-tools
Requires: parted
Requires: squashfs-tools >= 4.2
Requires: erofs-utils
Requires: erofs-utils >= 1.8.2
Requires: util-linux
Requires: xz-lzma-compat
Requires: xz
Expand Down
4 changes: 2 additions & 2 deletions src/pylorax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def configure(self, conf_file="/etc/lorax/lorax.conf"):
self.conf.set("compression", "bcj", "on")

self.conf.add_section("compression.erofs")
self.conf.set("compression.erofs", "type", "lzma")
self.conf.set("compression.erofs", "args", "")
self.conf.set("compression.erofs", "type", "zstd,8")
self.conf.set("compression.erofs", "args", "-Ededupe,all-fragments -C 65536")

# read the config file
if os.path.isfile(conf_file):
Expand Down
2 changes: 1 addition & 1 deletion src/pylorax/imgutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def mksquashfs(rootdir, outfile, compression="default", compressargs=None):
compressargs = ["-comp", compression] + compressargs
return execWithRedirect("mksquashfs", [rootdir, outfile] + compressargs)

def mkerofs(rootdir, outfile, compression="lzma", compressargs=None):
def mkerofs(rootdir, outfile, compression="zstd", compressargs=None):
'''Make an erofs image containing the given rootdir.'''
compressargs = compressargs or []
compressargs = ["-z", compression] + compressargs
Expand Down
4 changes: 2 additions & 2 deletions src/pylorax/treebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ def create_ext4_runtime(self, outfile="/var/tmp/squashfs.img", compression="xz",
remove(workdir)
return rc

def create_erofs_runtime(self, outfile="/var/tmp/erofs.img", compression="lzma", compressargs=None, size=2):
def create_erofs_runtime(self, outfile="/var/tmp/erofs.img", compression="zstd", compressargs=None, size=2):
"""Create a plain erofs runtime"""
compressargs = compressargs or []
os.makedirs(os.path.dirname(outfile))

# erofs the rootfs
return imgutils.mkerofs(self.vars.root, outfile, compression, compressargs)

def create_erofs_ext4_runtime(self, outfile="/var/tmp/erofs.img", compression="lzma", compressargs=None, size=2):
def create_erofs_ext4_runtime(self, outfile="/var/tmp/erofs.img", compression="zstd", compressargs=None, size=2):
"""Create a erofs compressed ext4 runtime"""
# make live rootfs image - must be named "LiveOS/rootfs.img" for dracut
compressargs = compressargs or []
Expand Down

0 comments on commit 0571214

Please sign in to comment.