summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/modules4
-rw-r--r--debian/changelog20
-rw-r--r--debian/dirs6
-rw-r--r--mkinitramfs38
-rw-r--r--scripts/functions49
-rw-r--r--scripts/local2
-rw-r--r--scripts/local-top/md3
-rw-r--r--scripts/nfs1
8 files changed, 99 insertions, 24 deletions
diff --git a/conf/modules b/conf/modules
index 8f12189..0067831 100644
--- a/conf/modules
+++ b/conf/modules
@@ -1,4 +1,8 @@
# List of modules that you want to include in your initramfs.
+#
+# Syntax: module_name [args ...]
+#
+#
# This might be good choices:
#
# raid1
diff --git a/debian/changelog b/debian/changelog
index 07d6a4e..54d3fcd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,31 @@
initramfs-tools (0.12) breezy; urgency=low
+ "I am not young enough to know everything." - Oscar Wilde
+
* Don't complain if /etc/mkinitramfs/modules doesn't exist.
* Make sure that raid1 is pulled in.
* Include /etc/modprobe.d/aliases in the initramfs
+ * Default to currently running kernel version.
+ Based on a patch from maximilian attems, thanks!
+
+ * Handle module arguments in /etc/mkinitramfs/modules
+
+ * Do hookscripts at generation time. Drop things into
+ /usr/share/initramfs-tools/hooks or /etc/mkinitramfs/hooks
+
+ * Make sure local-bottom and nfs-bottom get created
+ Thanks to Karl Hegbloom for these three patches!
+
+ * Prune stray echo from call_scripts
+
+ * Load raid1 for now so that md setups will work.
+
+ * Detect ide modules load
+ Thanks to Jeff Waugh for initial testing of this!
+
-- Jeff Bailey <jbailey@ubuntu.com> Mon, 20 Jun 2005 23:05:04 +0000
initramfs-tools (0.11) breezy; urgency=low
diff --git a/debian/dirs b/debian/dirs
index ef40692..94484bb 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1,7 +1,9 @@
etc/mkinitramfs/init-bottom
etc/mkinitramfs/init-top
-etc/mkinitramfs/local-premount
etc/mkinitramfs/local-top
-etc/mkinitramfs/nfs-premount
+etc/mkinitramfs/local-premount
+etc/mkinitramfs/local-bottom
etc/mkinitramfs/nfs-top
+etc/mkinitramfs/nfs-premount
+etc/mkinitramfs/nfs-bottom
usr/share/initramfs-tools/modules.d
diff --git a/mkinitramfs b/mkinitramfs
index f06811e..4dabfce 100644
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -1,7 +1,17 @@
#!/bin/sh
+# For dependency ordered mkinitramfs hook scripts.
+. /usr/share/initramfs-tools/scripts/functions
+
# Takes a file containing a list of modules to be added as an argument
# Figures out dependancies and adds it in.
+#
+# File syntax:
+#
+# # comment
+# modprobe_module_name [args ...]
+# [...]
+#
manual_add_modules()
{
# Sanity check
@@ -9,8 +19,8 @@ manual_add_modules()
return
fi
- for x in $(sed -e '/^#/d' ${1}); do
- for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do
+ sed -e '/^#/d' ${1} | while read module rest; do
+ for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do
# Prune duplicates
if [ -e ${TMPDIR}/${y} ]; then
continue
@@ -18,7 +28,7 @@ manual_add_modules()
mkdir -p ${TMPDIR}/$(dirname ${y})
ln -s ${y} ${TMPDIR}/$(dirname ${y})
- echo $(basename ${y} .ko) >>${TMPDIR}/conf/modules
+ echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules
done
done
}
@@ -51,7 +61,7 @@ auto_add_modules()
copy_modules_dir kernel/fs/xfs
# These aren't caught by the above but really need to be there:
- for x in mbcache nfs af_packet raid1; do
+ for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do
for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do
# Prune duplicates
if [ -e ${TMPDIR}/${y} ]; then
@@ -99,9 +109,6 @@ while getopts "d:ko:r:" flag; do
o)
outfile="${OPTARG}"
;;
- v)
- version="${OPTARG}"
- ;;
k)
keep="y"
;;
@@ -112,14 +119,18 @@ shift $((${OPTIND} - 1))
. ${CONFDIR}/initramfs.conf
-if [ x${outfile} = x ] || [ ${#} -ne 1 ]; then
+if [ x${outfile} = x ]; then
usage
fi
# And by "version" we really mean path to kernel modules
# This is braindead, and exists to preserve the interface with mkinitrd
-version=${1}
-[ $# -gt 0 ] || unset version
+if [ ${#} -ne 1 ]; then
+ version=$(uname -r)
+else
+ version="${1}"
+fi
+
case ${version} in
/lib/modules/*/[!/]*)
;;
@@ -136,8 +147,6 @@ case ${version} in
;;
esac
-version="${version-$(uname -r)}"
-
if [ -d ${outfile} ]; then
echo "${outfile} is a directory"
exit 1
@@ -193,6 +202,11 @@ ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d
ln -s /sbin/mdadm ${TMPDIR}/sbin
ln -s /sbin/mdrun ${TMPDIR}/sbin
+run_scripts /usr/share/initramfs-tools/hooks
+run_scripts /etc/mkinitramfs/hooks
+
+# FIXME catenate extra cpio.gz here >>${outfile}
+
(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile})
if [ "${keep}" = "y" ]; then
diff --git a/scripts/functions b/scripts/functions
index 73b773a..5fb8c04 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1,3 +1,5 @@
+# -*- shell-script -*-
+
panic()
{
echo $@
@@ -92,7 +94,6 @@ reduce_prereqs()
call_scripts()
{
- echo ${runlist}
for cs_x in ${runlist}; do
${initdir}/${cs_x}
done
@@ -106,9 +107,44 @@ run_scripts()
call_scripts
}
+ide_boot_events() {
+ [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return
+
+ for drive in /proc/ide/*/media; do
+ # nothing to do if the device has already been took in charge
+ unit=${drive#/proc/ide/}; unit=${unit%/media}
+ [ -d /sys/block/$unit ] && continue
+
+ read media < $drive
+ case "$media" in
+ disk) MODULE=ide-disk ;;
+ cdrom) MODULE=ide-cd ;;
+ tape) MODULE=ide-tape ;;
+ floppy) MODULE=ide-floppy ;;
+ *) MODULE=ide-generic ;;
+ esac
+
+ modprobe -q ${MODULE}
+ done
+}
+
load_modules()
{
- depmod
+ depmod -a
+
+ # Load custom modules first
+ if [ -e /conf/modules ]; then
+ cat /conf/modules | while read m; do
+ if [ -z "$m" ] \
+ || expr "$m" : "#" >/dev/null \
+ || expr "$m" : "[ \t]+#?" > /dev/null
+ then
+ continue;
+ else
+ modprobe -v $m
+ fi
+ done
+ fi
for x in /sys/bus/pci/devices/*; do
if [ -e ${x}/modalias ]; then
@@ -125,11 +161,6 @@ load_modules()
fi
done
- # Load the modules
- # FIXME - do module options here
- if [ -e /conf/modules ]; then
- for x in $(cat /conf/modules); do
- modprobe -v $x
- done
- fi
+ ide_boot_events
+
}
diff --git a/scripts/local b/scripts/local
index 99eea77..4a17abb 100644
--- a/scripts/local
+++ b/scripts/local
@@ -1,4 +1,4 @@
-# Local filesystem mounting
+# Local filesystem mounting -*- shell-script -*-
# Parameter: Where to mount the filesystem
mountroot ()
diff --git a/scripts/local-top/md b/scripts/local-top/md
index 864ffe4..062852f 100644
--- a/scripts/local-top/md
+++ b/scripts/local-top/md
@@ -15,4 +15,7 @@ prereqs)
;;
esac
+# FIXME detect this!
+modprobe raid1
+
/sbin/mdrun /dev
diff --git a/scripts/nfs b/scripts/nfs
index 11c61f8..1e2be2c 100644
--- a/scripts/nfs
+++ b/scripts/nfs
@@ -1,3 +1,4 @@
+# NFS filesystem mounting *- shell-script -*-
# Paramter: Where the root should be mounted
mountroot ()