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
This commit is contained in:
Juan RP 2010-02-20 04:06:10 +01:00
parent 2433e8662c
commit 00cfa9ee5f
4 changed files with 34 additions and 4 deletions

View file

@ -55,3 +55,11 @@ DEVICE=eth0
NFSROOT=auto NFSROOT=auto
#
# COMPRESSION_TYPE: [ gzip | bzip2 | lzma ]
#
# Compression type for the newly generated initramfs. By default
# it's compressed with gzip.
#
COMPRESSION_TYPE=gzip

View file

@ -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 .SH NAME
initramfs.conf \- configuration file for mkinitramfs 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. directly.
.SH GENERAL VARIABLES .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 .TP
\fB MODULES \fB MODULES
Specifies the modules for the initramfs image. Specifies the modules for the initramfs image.
@ -67,6 +73,10 @@ The initramfs-tools are written by Maximilian Attems <maks@debian.org>,
Jeff Bailey <jbailey@raspberryginger.com> and numerous others. Jeff Bailey <jbailey@raspberryginger.com> and numerous others.
Loosely based on mkinitrd.conf by Herbert Xu. Loosely based on mkinitrd.conf by Herbert Xu.
This version of initramfs-tools has been modified and improved by
Juan Romero Pardines <xtraeme@gmail.com> for XBPS - The X Binary
Package System.
.SH SEE ALSO .SH SEE ALSO
.BR .BR
.IR initramfs-tools (8), .IR initramfs-tools (8),

View file

@ -73,6 +73,16 @@ for i in ${EXTRA_CONF}; do
fi fi
done 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 # source package confs
for i in /usr/share/initramfs-tools/conf-hooks.d/*; do for i in /usr/share/initramfs-tools/conf-hooks.d/*; do
if [ -e "${i}" ]; then if [ -e "${i}" ]; then
@ -239,7 +249,7 @@ fi
# Copy resume from klibc # Copy resume from klibc
copy_exec /bin/resume /bin 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: # work around lack of "set -o pipefail" for the following pipe:
# cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" || exit 1 # cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" || exit 1
@ -252,7 +262,7 @@ eval `
find . 4>&-; echo "ec1=$?;" >&4 find . 4>&-; echo "ec1=$?;" >&4
} | { } | {
cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4 cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4
} | gzip >"${outfile}" } | ${compress_cmd} ${compress_cmd_args} >"${outfile}"
echo "ec3=$?;" >&4 echo "ec3=$?;" >&4
` `
if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi

View file

@ -1,6 +1,6 @@
# Template file for 'initramfs-tools' # Template file for 'initramfs-tools'
pkgname=initramfs-tools pkgname=initramfs-tools
version=0.96 version=0.97
build_style=custom-install build_style=custom-install
short_desc="Tools for generating an initramfs" short_desc="Tools for generating an initramfs"
maintainer="Juan RP <xtraeme@gmail.com>" maintainer="Juan RP <xtraeme@gmail.com>"
@ -28,6 +28,8 @@ Add_dependency full findutils
Add_dependency full sed Add_dependency full sed
Add_dependency full grep Add_dependency full grep
Add_dependency full gzip Add_dependency full gzip
Add_dependency full bzip2
Add_dependency full xz
Add_dependency full udev Add_dependency full udev
Add_dependency full module-init-tools Add_dependency full module-init-tools
Add_dependency full busybox-initramfs Add_dependency full busybox-initramfs