tazlito rev 513

Add lz4 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 25 22:18:53 2019 +0100 (7 weeks ago)
parents 2a856694226f
children 7c8e4ca19511
files tazlito
line diff
     1.1 --- a/tazlito	Thu Jun 07 10:44:25 2018 +0200
     1.2 +++ b/tazlito	Fri Jan 25 22:18:53 2019 +0100
     1.3 @@ -550,6 +550,7 @@
     1.4  		count=$s 2> /dev/null
     1.5  
     1.6  	# Create boot sector
     1.7 +	doslabel="$(echo "SLITAZ BOOT         " | od -v -N 11 -t x1 -w1 -An)"
     1.8  	if [ "$ftype" == "33 32" ]; then
     1.9  		hexdump -R <<EOT | dd of=$basedir/boot/isolinux/efi.img \
    1.10  			conv=notrunc
    1.11 @@ -557,8 +558,8 @@
    1.12  0  02 00 00 $size f8 00 00  20 00 40 00 00 00 00 00  |
    1.13  0  $size32     $fsz         00 00 00 00 02 00 00 00  |
    1.14  0  01 00 03 00 00 00 00 00  00 00 00 00 00 00 00 00  |  
    1.15 -0  80 00 29 00 00 00 00 53  59 53 54 45 4d 00 00 00  |
    1.16 -0  00 00 46 41 54 $ftype 20 20 20 cd 18 cd 19 eb fa  |
    1.17 +0  80 00 29 00 00 00 00 $doslabel                    |
    1.18 +0        46 41 54 $ftype 20 20 20 cd 18 cd 19 eb fa  |
    1.19  EOT
    1.20  		while read ofs data; do
    1.21  			echo "0 ${data//:/ } |" | hexdump -R | dd conv=notrunc \
    1.22 @@ -575,8 +576,8 @@
    1.23  			conv=notrunc
    1.24  0  eb 3c 90 53 6c 69 54 61  7a 00 00 00 02 04 $rsect 00  |
    1.25  0  02 40 00 $size f8 $fsz   20 00 40 00 00 00 00 00  |
    1.26 -0  $size32     80 00 29 00  00 00 00 53 59 53 54 45  |
    1.27 -0  4d 20 20 20 20 20 46 41  54 $ftype 20 20 20 cd 18  |
    1.28 +0  $size32     80 00 29 00  00 00 00 $doslabel       |
    1.29 +0                    46 41  54 $ftype 20 20 20 cd 18  |
    1.30  0  cd 19 eb fa  |
    1.31  EOT
    1.32  	fi 2> /dev/null
    1.33 @@ -588,7 +589,7 @@
    1.34  		seek=$(($rsect+$fsect)) bs=512 conv=notrunc 2> /dev/null
    1.35  
    1.36  	# Add label
    1.37 -	echo "0  53 59 53 54 45 4d 20 20  20 20 20 08 |" | hexdump -R | \
    1.38 +	echo "0  $doslabel 08 |" | hexdump -R | \
    1.39  		dd of=$basedir/boot/isolinux/efi.img bs=512 conv=notrunc \
    1.40  		seek=$(($rsect+$fsect+$fsect)) 2> /dev/null
    1.41  
    1.42 @@ -773,6 +774,12 @@
    1.43  }
    1.44  
    1.45  
    1.46 +dolz4() {
    1.47 +	[ "$(which lz4)" ] || tazpkg get-install lz4
    1.48 +	lz4 -9 > $1
    1.49 +}
    1.50 +
    1.51 +
    1.52  dogzip() {
    1.53  	gzip -9 > $1
    1.54  	[ -x /usr/bin/advdef ] && advdef -qz4 $1
    1.55 @@ -788,6 +795,10 @@
    1.56  			_ 'Creating %s without compression...' 'initramfs'
    1.57  			cat > $2
    1.58  			;;
    1.59 +		lz4)
    1.60 +			_ 'Creating %s with lz4 compression...' 'initramfs'
    1.61 +			dolz4 $2
    1.62 +			;;
    1.63  		gzip)
    1.64  			_ 'Creating %s with gzip compression...' 'initramfs'
    1.65  			dogzip $2
    1.66 @@ -817,6 +828,10 @@
    1.67  			_ 'Creating %s with gzip compression...' "$INITRAMFS"
    1.68  			cpio -o -H newc | dogzip "/$INITRAMFS"
    1.69  			;;
    1.70 +		lz4)
    1.71 +			_ 'Creating %s with lz4 compression...' "$INITRAMFS"
    1.72 +			cpio -o -H newc | dolz4 "/$INITRAMFS"
    1.73 +			;;
    1.74  		*)
    1.75  			# align='y'
    1.76  			_ 'Creating %s without compression...' "$INITRAMFS"