Compare commits

...

15 Commits

Author SHA1 Message Date
David Abdurachmanov f670be0513
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-07-16 10:31:40 +03:00
David Abdurachmanov d57f7e1e86
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-12-23 19:56:14 +02:00
David Abdurachmanov 04d35b2d65
Fix extlinux configuration for RISC-V (riscv64)
- Remove fdtdir entry (we ship DTB files, but DTB is built-in into
  FSBL and OpenSBI; also could be in U-Boot).
- Use addappend entry instead of append. This allows us to have a single
  disk image for QEMU virt machine and SiFive Unleashed.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-10-30 16:20:11 +02:00
David Abdurachmanov 33bfa1e82a
Do not specify src twice for zstd
src must be spcified only once (forgot to remove it). Also add more
debug messages.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-10-03 13:36:54 +03:00
David Abdurachmanov a4dfae1286
Add support fot zstd compression instead of xz (optional)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-10-02 13:35:04 +03:00
David Abdurachmanov 7913f0ca22
Match f31 branch
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-10-02 13:31:43 +03:00
David Abdurachmanov ee1e8e0ce1
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-18 14:24:09 -07:00
David Abdurachmanov 59da02d2e3
Ensure that ramdisk extension is not used with U-Boot images
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-01 23:20:14 +02:00
David Abdurachmanov f24b708f6e
Fix another typo in uboot riscv patch
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-01 11:51:15 +02:00
David Abdurachmanov e49ba84cdc
Fix typo in patch
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-04-01 06:35:19 +02:00
David Abdurachmanov 665a74ad2a
Make sure to check for uInitrd first
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-31 10:24:15 +02:00
David Abdurachmanov d1dccea49d
Changes for U-Boot RISC-V extlinux support
- Allow user to override partition layout (msdos default) via clearpart
  kickstart command.
- Check boot prefix (usually /boot) for DTB directory. If does not exist
  skip fdtdir entry in extlinux.conf
- Detect U-Boot uImage / uInitrd images for extlinux.conf

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-30 21:21:18 +01:00
David Abdurachmanov 32d524791c
Remove obsolete patch
The patch was already upstreamed.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-30 21:16:33 +01:00
David Abdurachmanov 4c476827ec
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-30 21:16:02 +01:00
David Abdurachmanov 981a8b348a
Multi-threaded compression and user specified disk label
Allow xz to use all available cores on node. If bootloader is disabled
in kickstart then use user provided disk label.

This speeds up disk image creation for RISC-V (riscv64) and allows
having GPT instead of msdos for partition tables.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2018-06-15 21:54:59 +02:00
3 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,87 @@
diff --git a/appcreate/appliance.py b/appcreate/appliance.py
index c6706cb..dc49bcb 100644
--- a/appcreate/appliance.py
+++ b/appcreate/appliance.py
@@ -47,7 +47,7 @@ class ApplianceImageCreator(ImageCreator):
"""
- def __init__(self, ks, name, disk_format, vmem, vcpu, releasever=None, no_compress=False):
+ def __init__(self, ks, name, disk_format, vmem, vcpu, releasever=None, no_compress=False, zstd=False, zstd_level=None):
"""Initialize a ApplianceImageCreator instance.
This method takes the same arguments as ImageCreator.__init__()
@@ -60,6 +60,8 @@ class ApplianceImageCreator(ImageCreator):
self.__disks = {}
self.__disk_format = disk_format
self.__compress = not no_compress
+ self.__zstd = zstd
+ self.__zstd_level = zstd_level
#appliance parameters
self.vmem = vmem
@@ -657,14 +659,32 @@ class ApplianceImageCreator(ImageCreator):
dst = "%s/%s-%s.%s" % (self._outdir, self.name, name, self.__disk_format)
if self.__compress:
- # Compress with xz using 16 MiB block size for seekability
- rc = subprocess.call(["xz", "-z", "--block-size=16777216", "-T 0", src])
- if rc == 0:
- logging.debug("compression successful")
- if rc != 0:
- raise CreatorError("Unable to compress disk to %s" % self.__disk_format)
- src = "%s.xz" % (src)
- dst = "%s.xz" % (dst)
+ logging.debug("compressing disk image")
+ if self.__zstd:
+ logging.debug("using zstd for compression")
+ # Compress with zstd using 16MiB blocks size (for future seekability)
+ zstd_cmd = ["zstd", "-z", "--block-size=16777216", "-T0"]
+ # Use custom compression level if specified
+ if self.__zstd_level:
+ zstd_cmd.append("-%s" % self.__zstd_level)
+ zstd_cmd.append(src)
+ rc = subprocess.call(zstd_cmd)
+ if rc == 0:
+ logging.debug("compression successful")
+ if rc != 0:
+ raise CreatorError("Unable to compress disk to %s, command: %s" % (self.__disk_format, zstd_cmd))
+ src = "%s.zst" % (src)
+ dst = "%s.zst" % (dst)
+ else:
+ logging.debug("using xz for compression")
+ # Compress with xz using 16 MiB block size for seekability
+ rc = subprocess.call(["xz", "-z", "--block-size=16777216", "-T 0", src])
+ if rc == 0:
+ logging.debug("compression successful")
+ if rc != 0:
+ raise CreatorError("Unable to compress disk to %s" % self.__disk_format)
+ src = "%s.xz" % (src)
+ dst = "%s.xz" % (dst)
logging.debug("moving %s to %s" % (src, dst))
shutil.move(src, dst)
diff --git a/tools/appliance-creator b/tools/appliance-creator
index eef1ede..6a0cf1c 100755
--- a/tools/appliance-creator
+++ b/tools/appliance-creator
@@ -61,6 +61,10 @@ def parse_options(args):
help="Disk format (default: raw)")
appopt.add_option("", "--no-compress", action="store_true", dest="no_compress", default=False,
help="Avoid compressing the image")
+ appopt.add_option("", "--zstd", action="store_true", dest="zstd", default=False,
+ help="Compress the image using zstd instead of xz")
+ appopt.add_option("", "--zstd-level", type="int", dest="zstd_level",
+ help="Compress using specified compression level for zstd")
parser.add_option_group(appopt)
@@ -134,7 +138,7 @@ def main():
if options.name:
name = options.name
- creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu, releasever=options.version, no_compress=options.no_compress)
+ creator = appcreate.ApplianceImageCreator(ks, name, options.disk_format, options.vmem, options.vcpu, releasever=options.version, no_compress=options.no_compress, zstd=options.zstd, zstd_level=options.zstd_level)
creator.tmpdir = options.tmpdir
creator.checksum = options.checksum

View File

@ -21,7 +21,7 @@
Name: appliance-tools
Summary: Tools for building Appliances
Version: 010.0
Release: 2%{?dist}
Release: 2.0.riscv64%{?dist}
License: GPLv2
URL: https://pagure.io/appliance-tools
@ -30,6 +30,14 @@ Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.bz2
# Backports from upstream
Patch0001: 0001-fix-subvolume-umount-path.patch
# NOT upstream
# Add support for zstd compression instead of xz (optional)
Patch0010: appliance-tools-add-zstd.patch
# NOT upstream
# Fix extlinux configuration file for RISC-V (riscv64)
Patch0011: riscv-fix-extlinux-conf.patch
# Ensure system deps are installed (rhbz#1409536)
Requires: python%{python_pkgversion}-imgcreate %{?min_imgcrate_evr:>= %{min_imgcreate_evr}}
Requires: python%{python_pkgversion}-progress
@ -38,6 +46,7 @@ Requires: curl rsync kpartx
Requires: zlib
Requires: qemu-img
Requires: xz
Requires: zstd
%if 0%{?fedora}
Requires: btrfs-progs
%endif
@ -76,6 +85,10 @@ rm -rf %{buildroot}%{_datadir}/doc/%{name}
%{python_sitelib}/ec2convert/
%changelog
* Thu Jul 16 2020 David Abdurachmanov <david.abdurachmanov@sifive.com> - 010.0-2.0.riscv64
- Fix extlinux configuration for RISC-V (riscv64)
- Add support for zstd compression for images (optional)
* Sat Jul 11 2020 Neal Gompa <ngompa13@gmail.com> - 010.0-2
- Add patch to fix unmounting btrfs subvolumes

View File

@ -0,0 +1,15 @@
diff --git a/appcreate/appliance.py b/appcreate/appliance.py
index dc49bcb..f65d12a 100644
--- a/appcreate/appliance.py
+++ b/appcreate/appliance.py
@@ -362,9 +362,7 @@ class ApplianceImageCreator(ImageCreator):
for v in versions:
extlinux += "label %s (%s)\n" % (self.name, v)
extlinux += "\tkernel %s/vmlinuz-%s\n" % (prefix, v)
- extlinux += "\tappend ro root=%s %s\n" % (rootdev, options)
- if 'extlinux-bootloader' in packages:
- extlinux += "\tfdtdir %s/dtb-%s/\n" % (prefix, v)
+ extlinux += "\taddappend ro root=%s %s\n" % (rootdev, options)
extlinux += "\tinitrd %s/%s-%s.img\n\n" % (prefix, initrd, v)