summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/initramfs.conf6
-rw-r--r--initramfs.conf.59
-rwxr-xr-xmkinitramfs16
-rw-r--r--mkinitramfs.82
4 files changed, 30 insertions, 3 deletions
diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index 23dd249..18c6c7e 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -36,6 +36,12 @@ BUSYBOX=y
KEYMAP=n
#
+# COMPRESS: [ gzip | bzip2 | lzma ]
+#
+
+COMPRESS=gzip
+
+#
# NFS Section of the config.
#
diff --git a/initramfs.conf.5 b/initramfs.conf.5
index 984d1a2..4d8ef89 100644
--- a/initramfs.conf.5
+++ b/initramfs.conf.5
@@ -1,4 +1,4 @@
-.TH INITRAMFS.CONF 5 "2010/03/25" "Linux" "initramfs.conf manual"
+.TH INITRAMFS.CONF 5 "2010/04/04" "Linux" "initramfs.conf manual"
.SH NAME
initramfs.conf \- configuration file for mkinitramfs
@@ -48,6 +48,13 @@ The keymap will anyway be loaded by the initscripts later, and the packages
that might need input will normally set this variable automatically, so there
should normally be no need to set this.
+.TP
+\fB COMPRESS
+Specifies the compression method used for the initramfs image.
+.B mkinitramfs
+will default to gzip if the kernel lacks support (CONFIG_RD) or the
+corresponding userspace utility is not present.
+
.TP
\fB UMASK
Set the umask value of the generated initramfs file.
diff --git a/mkinitramfs b/mkinitramfs
index 877dfb4..33ef99b 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -123,6 +123,20 @@ case "${version}" in
;;
esac
+# Check userspace and kernel support for compressed initramfs images
+compress=${COMPRESS}
+if command -v ${compress} >/dev/null 2>&1; then
+ compress=gzip
+ [ "${verbose}" = y ] && \
+ echo "No ${COMPRESS} in ${PATH}, using gzip"
+fi
+
+if ! `grep -q -i config_rd_${COMPRESS}=y /boot/config-${version}` ; then
+ compress=gzip
+ [ "${verbose}" = y ] && \
+ echo "linux-2.6 misses ${COMPRESS} support, using gzip"
+fi
+
if [ -d "${outfile}" ]; then
echo "${outfile} is a directory"
exit 1
@@ -273,7 +287,7 @@ eval `
find . 4>&-; echo "ec1=$?;" >&4
} | {
cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4
- } | gzip >"${outfile}"
+ } | ${compress} >"${outfile}"
echo "ec3=$?;" >&4
`
if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi
diff --git a/mkinitramfs.8 b/mkinitramfs.8
index 5d3c42b..c19697a 100644
--- a/mkinitramfs.8
+++ b/mkinitramfs.8
@@ -27,7 +27,7 @@ mkinitramfs \- low-level tool for generating an initramfs image
The
.B mkinitramfs
script generates an initramfs image.
-The initramfs is a gzipped cpio archive. The archive can be used on a
+The initramfs is a compressed cpio archive. The archive can be used on a
different box of the same arch with the corresponding Linux kernel.
.B mkinitramfs
is meant for advanced usage. On your local box