From 8d4c6bc6cf9cd29fd93af1e5ec861e9f290a5877 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sat, 1 Sep 2018 12:45:59 +0200 Subject: Finish the zstd compression implementation in liveslak The new zstd compression support for squashfs modules allows for a much snappier system because zstd decompression is 5 times faster than that of xz (see https://sourceforge.net/p/squashfs/mailman/message/35989805/), but at the expense of ISO sizes that are at least 10% bigger. The latter means that we have to do some more pruning of the XFCE and PLASMA5 images to make these fit in a CDROM and DVD image, respectively. Here are some initial benchmarks with PLASMA5 Live ISO images, booting in QEMU (times are in minutes:seconds): Stage ZSTD XZ --------------------------------------- Boot to runlevel 4 start 0:39 0:50 SDDM Login Manager visible 0:55 1:26 Plasma5 desktop ready 1:42 3:17 I also tested two of the bigger applications, measuring the time between entering the command in a terminal and having a usable application window: Stage ZSTD XZ ---------------------------------------- LO Writer window visible 0:17 0:34 Chromium window visible 0:09 0:14 It is obvious that a big Desktop Environment like Plasma5 where a lot of binaries have to be loaded from their squashfs modules benefits a lot from zstd, because after booting, the Plasma5 DE is available in roughly 53% of the time it takes when using xz compression. Zstd support in squashfs was added to Linux kernel 4.14. That means, no customimzation of Slackware is required to make the Live OS work from zstd-compressed squashfs modules. In order to *create* these zstd-compressed squashfs modules, you will need some custom packages at the moment, until they get added to Slackware-current: zstd and a rebuild squashfs-tools to add the lacking zstd support to mksqhashfs/unsquashfs. --- liveinit.tpl | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'liveinit.tpl') diff --git a/liveinit.tpl b/liveinit.tpl index da1b4ff..e4f38d1 100755 --- a/liveinit.tpl +++ b/liveinit.tpl @@ -46,6 +46,8 @@ VERSION="@VERSION@" LIVEUID="@LIVEUID@" +SQ_EXT_AVAIL="@SQ_EXT_AVAIL@" + LIVEMEDIA="" LIVEPATH="" @@ -479,6 +481,21 @@ if [ "$RESCUE" = "" ]; then echo "$lodev" } + mod_base() { + MY_MOD="$1" + + echo $(basename ${MY_MOD}) |rev |cut -d. -f2- |rev + } + + find_mod() { + MY_LOC="$1" + + ( for MY_EXT in ${SQ_EXT_AVAIL} ; do + echo "$(find ${MY_LOC} -name "*.${MY_EXT}" 2>/dev/null)" + done + ) | sort + } + find_modloc() { MY_LOC="$1" MY_BASE="$2" @@ -501,8 +518,10 @@ if [ "$RESCUE" = "" ]; then # SUBSYS can be 'system', 'addons', 'optional': SUBSYS="$1" - for MODULE in $(find /mnt/media/${LIVEMAIN}/${SUBSYS}/ -name "*.sxz" 2>/dev/null |sort) ; do - MODBASE="$(basename ${MODULE} .sxz)" + # Find all supported modules: + for MODULE in $(find_mod /mnt/media/${LIVEMAIN}/${SUBSYS}/) ; do + # Strip path and extension from the modulename: + MODBASE="$(mod_base ${MODULE})" if [ "$SUBSYS" = "optional" ]; then # Load one or more optionals by using boot parameter 'load': # load=mod1[,mod2[,mod3]] @@ -715,7 +734,7 @@ if [ "$RESCUE" = "" ]; then # Start assembling our live system components below /mnt/live : mkdir /mnt/live - # Mount our squashed modules (.sxz extension). + # Mount our squashed modules (.sxz or other supported extension) mkdir /mnt/live/modules if [ $TORAM -ne 0 ]; then @@ -1192,7 +1211,7 @@ EOT RUN_DEPMOD=0 for MOD in $(cat /sys/block/loop*/loop/backing_file |grep -E "optional|addons") do - if [ -d /mnt/live/modules/$(basename $MOD .sxz)/lib/modules/$(uname -r)/ ] + if [ -d /mnt/live/modules/$(mod_base $MOD)/lib/modules/$(uname -r)/ ] then # Found kernel modules directory; we need to make a 'depmod' call. RUN_DEPMOD=1 -- cgit v1.2.3