From 00cfa9ee5f8cf39ea2b86d924dc3f9d3b716a597 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 20 Feb 2010 04:06:10 +0100 Subject: [PATCH] initramfs-tools: added support for bzip2 and lzma compressed initramfs. By default behaviour hasn't been changed, `gzip'. You can now compress them with bzip2 or lzma. By default -9 is always used, we are worried about size here so I don't think it should be tweakable. A new option for initramfs.conf has been added COMPRESSION_TYPE. --HG-- extra : convert_revision : 4ad57146dc1b7bee2585c1d4d792b3ea242e1fd3 --- srcpkgs/initramfs-tools/files/conf/initramfs.conf | 8 ++++++++ srcpkgs/initramfs-tools/files/initramfs.conf.5 | 12 +++++++++++- srcpkgs/initramfs-tools/files/mkinitramfs | 14 ++++++++++++-- srcpkgs/initramfs-tools/template | 4 +++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/srcpkgs/initramfs-tools/files/conf/initramfs.conf b/srcpkgs/initramfs-tools/files/conf/initramfs.conf index 22406a83162..fe5dd9c910f 100644 --- a/srcpkgs/initramfs-tools/files/conf/initramfs.conf +++ b/srcpkgs/initramfs-tools/files/conf/initramfs.conf @@ -55,3 +55,11 @@ DEVICE=eth0 NFSROOT=auto +# +# COMPRESSION_TYPE: [ gzip | bzip2 | lzma ] +# +# Compression type for the newly generated initramfs. By default +# it's compressed with gzip. +# + +COMPRESSION_TYPE=gzip diff --git a/srcpkgs/initramfs-tools/files/initramfs.conf.5 b/srcpkgs/initramfs-tools/files/initramfs.conf.5 index eacb5dded6a..5aeb8463f3f 100644 --- a/srcpkgs/initramfs-tools/files/initramfs.conf.5 +++ b/srcpkgs/initramfs-tools/files/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "2008/12/19" "Linux" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "2010/02/20" "Linux" "initramfs.conf manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs @@ -19,6 +19,12 @@ so you can override the settings in the main config file without editing it directly. .SH GENERAL VARIABLES +.TP +\fB COMPRESSION_TYPE +Specifies the compression type used by the generated initramfs. Possible +values are \fIgzip\fP, \fIbzip2\fP and \fIlzma\fP. If not set or any other +invalid value is set it will default to \fIgzip\fP. + .TP \fB MODULES Specifies the modules for the initramfs image. @@ -67,6 +73,10 @@ The initramfs-tools are written by Maximilian Attems , Jeff Bailey and numerous others. Loosely based on mkinitrd.conf by Herbert Xu. +This version of initramfs-tools has been modified and improved by +Juan Romero Pardines for XBPS - The X Binary +Package System. + .SH SEE ALSO .BR .IR initramfs-tools (8), diff --git a/srcpkgs/initramfs-tools/files/mkinitramfs b/srcpkgs/initramfs-tools/files/mkinitramfs index 35476f77b95..49ed0fcb0ac 100755 --- a/srcpkgs/initramfs-tools/files/mkinitramfs +++ b/srcpkgs/initramfs-tools/files/mkinitramfs @@ -73,6 +73,16 @@ for i in ${EXTRA_CONF}; do fi done +# Handle COMPRESSION_TYPE from initramfs.conf. +compress_cmd_args="-9" + +case "${COMPRESSION_TYPE}" in +gzip) compress_cmd=gzip;; +bzip2) compress_cmd=bzip2;; +lzma) compress_cmd=lzma; compress_cmd_args="$compress_cmd_args -c";; +*) compress_cmd=gzip;; +esac + # source package confs for i in /usr/share/initramfs-tools/conf-hooks.d/*; do if [ -e "${i}" ]; then @@ -239,7 +249,7 @@ fi # Copy resume from klibc copy_exec /bin/resume /bin -[ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" +[ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs (${COMPRESSION_TYPE})" ( # work around lack of "set -o pipefail" for the following pipe: # cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" || exit 1 @@ -252,7 +262,7 @@ eval ` find . 4>&-; echo "ec1=$?;" >&4 } | { cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4 - } | gzip >"${outfile}" + } | ${compress_cmd} ${compress_cmd_args} >"${outfile}" echo "ec3=$?;" >&4 ` if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi diff --git a/srcpkgs/initramfs-tools/template b/srcpkgs/initramfs-tools/template index de6ed18bc6b..3b5bb03d060 100644 --- a/srcpkgs/initramfs-tools/template +++ b/srcpkgs/initramfs-tools/template @@ -1,6 +1,6 @@ # Template file for 'initramfs-tools' pkgname=initramfs-tools -version=0.96 +version=0.97 build_style=custom-install short_desc="Tools for generating an initramfs" maintainer="Juan RP " @@ -28,6 +28,8 @@ Add_dependency full findutils Add_dependency full sed Add_dependency full grep Add_dependency full gzip +Add_dependency full bzip2 +Add_dependency full xz Add_dependency full udev Add_dependency full module-init-tools Add_dependency full busybox-initramfs