What do you think about adding such a feature? It would be useful
for creating custom initramfs images for other machines in conjunction
with the -d option. Find attached a patch against the Lenny branch.
Thanks,
Feri.
>From eee04d47a9571de8ce5823fd6d1de88d6ae4298d Mon Sep 17 00:00:00 2001
From: Ferenc Wagner <wferi@niif.hu>
Date: Fri, 12 Mar 2010 16:57:26 +0100
Subject: [PATCH] mkinitramfs: new -b option to ignore stuff under /usr/share/initramfs-tools
# Check for non-GNU getopt
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
@@ -20,6 +21,10 @@ eval set -- "$OPTIONS"
while true; do
case "$1" in
+ -b)
+ unset system # prepare a "bare" initramfs, based on user configuration only
+ shift
+ ;;
-d)
CONFDIR="$2"
shift 2
@@ -84,7 +89,7 @@ fi
. "${CONFDIR}/initramfs.conf"
EXTRA_CONF='
-for i in /usr/share/initramfs-tools/conf.d/* ${CONFDIR}/conf.d/*; do
+for i in ${system:+/usr/share/initramfs-tools/conf.d/*} ${CONFDIR}/conf.d/*; do
EXTRA_CONF="${EXTRA_CONF} $(basename $i
| grep '^[[:alnum:]][[:alnum:]._-]*$' | grep -v '.dpkg-.*$')";
done
@@ -93,13 +98,13 @@ done
for i in ${EXTRA_CONF}; do
if [ -e ${CONFDIR}/conf.d/${i} ]; then
. ${CONFDIR}/conf.d/${i}
- elif [ -e /usr/share/initramfs-tools/conf.d/${i} ]; then
+ elif [ -n "$system" ] && [ -e /usr/share/initramfs-tools/conf.d/${i} ]; then
. /usr/share/initramfs-tools/conf.d/${i}
fi
done
# source package confs
-for i in /usr/share/initramfs-tools/conf-hooks.d/*; do
+for i in ${system:+/usr/share/initramfs-tools/conf-hooks.d/*}; do
if [ -e "${i}" ]; then
. "${i}"
fi
@@ -127,7 +132,7 @@ fi
# Check that we're using a new enough kernel version, first for ourselves,
# then for each of the hooks, which can have a MINKVER variable defined
check_minkver ${version}
-check_minkver ${version} /usr/share/initramfs-tools/hooks
+[ -n "$system" ] && check_minkver ${version} /usr/share/initramfs-tools/hooks
check_minkver ${version} ${CONFDIR}/hooks
case "${version}" in
@@ -185,7 +190,7 @@ for d in bin conf/conf.d etc lib/modules sbin scripts ${MODULESDIR}; do
done
# MODULES=list case. Always honour.
-for x in "${CONFDIR}/modules" /usr/share/initramfs-tools/modules.d/*; do
+for x in "${CONFDIR}/modules" ${system:+/usr/share/initramfs-tools/modules.d/*}; do
if [ -f "${x}" ]; then
add_modules_from_file "${x}"
fi
@@ -224,7 +229,7 @@ rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip
copy_exec /usr/share/initramfs-tools/init /init
# add existant boot scripts
-for b in $(cd /usr/share/initramfs-tools/scripts/ && find .
+[ -n "$system" ] && for b in $(cd /usr/share/initramfs-tools/scripts/ && find .
-regextype posix-extended -regex '.*/[[:alnum:]_]+$' -type f); do
[ -d "${DESTDIR}/scripts/$(dirname "${b}")" ]
|| mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")"
@@ -243,7 +248,7 @@ copy_exec "${CONFDIR}/initramfs.conf" /conf
for i in ${EXTRA_CONF}; do
if [ -e "${CONFDIR}/conf.d/${i}" ]; then
copy_exec "${CONFDIR}/conf.d/${i}" /conf/conf.d
- elif [ -e "/usr/share/initramfs-tools/conf.d/${i}" ]; then
+ elif [ -n "$system" ] && [ -e "/usr/share/initramfs-tools/conf.d/${i}" ]; then
copy_exec "/usr/share/initramfs-tools/conf.d/${i}" /conf/conf.d
fi
done
@@ -280,7 +285,7 @@ if [ "$DPKG_ARCH" = arm ] || [ "$DPKG_ARCH" = armeb ]; then
cp -a /lib/libgcc_s.so.1 "${DESTDIR}/lib/"
fi
# Apply DSDT to initramfs
diff --git a/mkinitramfs.8 b/mkinitramfs.8
index abb3f39..5a18b29 100644
--- a/mkinitramfs.8
+++ b/mkinitramfs.8
@@ -5,6 +5,7 @@ mkinitramfs - low-level tool for generating an initramfs image
.SH SYNOPSIS
.B mkinitramfs
+.RB [ -b ]
.RB [ -d
.IR confdir ]
.RB [ -k ]
@@ -45,6 +46,12 @@ happens in this early userspace.
.SH OPTIONS
.TP
+fB -b
+Create a `bare' initramfs image by ignoring the system-wide hooks, scripts,
+modules and configuration under
+.IR /usr/share/initramfs-tools .
+
+.TP
fB -d fI confdir
Set an alternate configuration directory.
--
1.5.6.5
04-04-2010, 03:46 PM
maximilian attems
Bug#573580: new option to ignore hooks etc. under /usr/share/initramfs-tools
On Fri, 12 Mar 2010, Ferenc Wagner wrote:
> What do you think about adding such a feature? It would be useful
> for creating custom initramfs images for other machines in conjunction
> with the -d option.
don't think both features mix equaly well.
first of all the ignore mechanism should be more flexible,
allowing to pass a list of things like an
EXCLUDE="lvm2,legacylvm,keymap,cryptopensc,cryptro ot"
in initramfs.conf
second the other box feature request needs deeper structural changes
hadn't time to get along yet and didn't see anyhting conclusive yet.
> Find attached a patch against the Lenny branch.
please go for latest git, has lots of changes, thanks:
http://git.debian.org/?p=kernel/initramfs-tools.git;a=summary
(that will land soonest in sid)
but i don't think that I'd want to merge this proposal as is currently,
due to aboves points.
> Thanks,
> Feri.
thanks for tackling this issues.
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100404154613.GA3799@stro.at">http://lists.debian.org/20100404154613.GA3799@stro.at