Explicitly set number of xz compressor threads
This commit is contained in:
parent
5791d18d31
commit
4f514f5212
11
Makefile
11
Makefile
@ -23,6 +23,7 @@ ALL_CLOUD_IMAGES=$(foreach cloud,$(CLOUD_IMGS),void-$(cloud)-$(DATE).tar.gz)
|
||||
SUDO := sudo
|
||||
|
||||
XBPS_REPOSITORY := -r https://lug.utdallas.edu/mirror/void/current -r https://lug.utdallas.edu/mirror/void/current/musl -r https://lug.utdallas.edu/mirror/void/current/aarch64
|
||||
COMPRESSOR_THREADS=2
|
||||
|
||||
%.sh: %.sh.in
|
||||
sed -e "s|@@MKLIVE_VERSION@@|$(VERSION) $(GITVER)|g" $^ > $@
|
||||
@ -45,10 +46,10 @@ rootfs-all-print:
|
||||
echo $(ALL_ROOTFS)
|
||||
|
||||
void-%-ROOTFS-$(DATE).tar.xz: $(SCRIPTS)
|
||||
$(SUDO) ./mkrootfs.sh $(XBPS_REPOSITORY) $*
|
||||
$(SUDO) ./mkrootfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $*
|
||||
|
||||
void-%-PLATFORMFS-$(DATE).tar.xz: $(SCRIPTS)
|
||||
$(SUDO) ./mkplatformfs.sh $(XBPS_REPOSITORY) $* void-$(shell ./lib.sh platform2arch $*)-ROOTFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mkplatformfs.sh $(XBPS_REPOSITORY) -x $(COMPRESSOR_THREADS) $* void-$(shell ./lib.sh platform2arch $*)-ROOTFS-$(DATE).tar.xz
|
||||
|
||||
platformfs-all: rootfs-all $(ALL_PLATFORMFS)
|
||||
|
||||
@ -65,14 +66,14 @@ images-all-print:
|
||||
@echo $(ALL_SBC_IMAGES) $(ALL_CLOUD_IMAGES)
|
||||
|
||||
void-%-$(DATE).img.xz:
|
||||
$(SUDO) ./mkimage.sh void-$*-PLATFORMFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-$*-PLATFORMFS-$(DATE).tar.xz
|
||||
|
||||
# The GCP images are special for $reasons
|
||||
void-GCP-$(DATE).tar.gz:
|
||||
$(SUDO) ./mkimage.sh void-GCP-PLATFORMFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-GCP-PLATFORMFS-$(DATE).tar.xz
|
||||
|
||||
void-GCP-musl-$(DATE).tar.gz:
|
||||
$(SUDO) ./mkimage.sh void-GCP-musl-PLATFORMFS-$(DATE).tar.xz
|
||||
$(SUDO) ./mkimage.sh -x $(COMPRESSOR_THREADS) void-GCP-musl-PLATFORMFS-$(DATE).tar.xz
|
||||
|
||||
|
||||
|
||||
|
@ -73,6 +73,7 @@ OPTIONS
|
||||
-r <fstype> Set / filesystem type (defaults to EXT4)
|
||||
-s <totalsize> Set total image size (defaults to 2GB)
|
||||
-o <output> Set image filename (guessed automatically)
|
||||
-x <num> Use <num> threads to compress the image (dynamic if unset)
|
||||
-h Show this help
|
||||
-V Show version
|
||||
|
||||
@ -85,13 +86,14 @@ _EOF
|
||||
# SCRIPT EXECUTION STARTS HERE
|
||||
# ########################################
|
||||
|
||||
while getopts "b:B:o:r:s:hV" opt; do
|
||||
while getopts "b:B:o:r:s:x:h:V" opt; do
|
||||
case $opt in
|
||||
b) BOOT_FSTYPE="$OPTARG";;
|
||||
B) BOOT_FSSIZE="$OPTARG";;
|
||||
o) FILENAME="$OPTARG";;
|
||||
r) ROOT_FSTYPE="$OPTARG";;
|
||||
s) IMGSIZE="$OPTARG";;
|
||||
x) COMPRESSOR_THREADS="$OPTARG" ;;
|
||||
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
|
||||
h) usage;;
|
||||
esac
|
||||
@ -350,7 +352,7 @@ case "$PLATFORM" in
|
||||
;;
|
||||
*)
|
||||
info_msg "Compressing $FILENAME with xz (level 9 compression)"
|
||||
xz -T0 -9 "$FILENAME"
|
||||
xz "-T${COMPRESSOR_THREADS:-0}" -9 "$FILENAME"
|
||||
info_msg "Successfully created $FILENAME image."
|
||||
;;
|
||||
esac
|
||||
|
@ -60,6 +60,7 @@ Options
|
||||
-c <dir> Set XBPS cache directory (defaults to \$PWD/xbps-cachedir-<arch>)
|
||||
-C <file> Full path to the XBPS configuration file
|
||||
-r <repo> Set XBPS repository (may be set multiple times)
|
||||
-x <num> Use <num> threads to compress the image (dynamic if unset)
|
||||
-h Show this help
|
||||
-V Show version
|
||||
_EOF
|
||||
@ -71,7 +72,7 @@ _EOF
|
||||
|
||||
BASEPKG=base-system
|
||||
|
||||
while getopts "b:p:k:c:C:r:h:V" opt; do
|
||||
while getopts "b:p:k:c:C:r:x:h:V" opt; do
|
||||
case $opt in
|
||||
b) BASEPKG="$OPTARG" ;;
|
||||
p) EXTRA_PKGS="$OPTARG" ;;
|
||||
@ -79,6 +80,7 @@ while getopts "b:p:k:c:C:r:h:V" opt; do
|
||||
c) XBPS_CACHEDIR="--cachedir=$OPTARG" ;;
|
||||
C) XBPS_CONFFILE="-C $OPTARG" ;;
|
||||
r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG" ;;
|
||||
x) COMPRESSOR_THREADS="$OPTARG" ;;
|
||||
h) usage; exit 0 ;;
|
||||
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0 ;;
|
||||
esac
|
||||
@ -161,7 +163,7 @@ rm -rf "$ROOTFS/var/cache/*" 2>/dev/null
|
||||
# Finally we can compress the tarball, the name will include the
|
||||
# platform and the date on which the tarball was built.
|
||||
tarball=void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz
|
||||
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T0 -9 > $tarball "
|
||||
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball "
|
||||
|
||||
# Now that we have the tarball we don't need the rootfs anymore, so we
|
||||
# can get rid of it.
|
||||
|
@ -61,6 +61,7 @@ Options
|
||||
-C <file> Full path to the XBPS configuration file
|
||||
-h Show this help
|
||||
-r <repo> Set XBPS repository (may be set multiple times)
|
||||
-x <num> Use <num> threads to compress the image (dynamic if unset)
|
||||
-V Show version
|
||||
_EOF
|
||||
}
|
||||
@ -71,12 +72,13 @@ _EOF
|
||||
|
||||
# Boilerplate option parsing. This script supports the bare minimum
|
||||
# needed to build an image.
|
||||
while getopts "C:c:h:r:V" opt; do
|
||||
while getopts "C:c:h:r:x:V" opt; do
|
||||
case $opt in
|
||||
C) XBPS_CONFFILE="-C $OPTARG";;
|
||||
c) XBPS_CACHEDIR="--cachedir=$OPTARG";;
|
||||
h) usage; exit 0;;
|
||||
r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG";;
|
||||
x) COMPRESSOR_THREADS="$OPTARG" ;;
|
||||
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
|
||||
esac
|
||||
done
|
||||
@ -205,7 +207,7 @@ rm -rf "$ROOTFS/var/cache/*" 2>/dev/null
|
||||
# Finally we can compress the tarball, the name will include the
|
||||
# architecture and the date on which the tarball was built.
|
||||
tarball=void-${XBPS_TARGET_ARCH}-ROOTFS-$(date '+%Y%m%d').tar.xz
|
||||
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T0 -9 > $tarball "
|
||||
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball "
|
||||
|
||||
# Now that we have the tarball we don't need the rootfs anymore, so we
|
||||
# can get rid of it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user