summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/initramfs.conf9
-rw-r--r--debian/TODO2
-rw-r--r--debian/changelog99
-rw-r--r--debian/control4
-rw-r--r--debian/dirs1
-rw-r--r--debian/initramfs-tools.install2
-rw-r--r--debian/initramfs-tools.postinst22
-rw-r--r--debian/initramfs-tools.postrm2
-rw-r--r--debian/rules2
-rw-r--r--hook-functions133
-rw-r--r--init4
-rw-r--r--mkinitramfs122
-rw-r--r--scripts/functions16
-rw-r--r--scripts/local-top/md9
14 files changed, 307 insertions, 120 deletions
diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index a056469..b4a7dba 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -7,7 +7,7 @@
# Use busybox if available. You MUST use the -static version
#
-BUSYBOX=n
+BUSYBOX=y
#
# BOOT: [ local | nfs ]
@@ -28,7 +28,7 @@ BOOT=local
#
# list - Only include modules from the 'additional modules' list
#
-MODULES=list
+MODULES=most
#
# NFS Section of the config.
@@ -48,3 +48,8 @@ DEVICE=eth0
NFSROOT=auto
+# Hardcode partition to resume from so it doesn't have to be specified
+# on the command line. The command line will override this setting.
+
+#RESUME=
+
diff --git a/debian/TODO b/debian/TODO
index 7c6bc55..58f35fd 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -16,3 +16,5 @@ TODO
o Trace lilo bug
o Capture udev events and pass them to udevsend
+
+ o Detect RESUME partition
diff --git a/debian/changelog b/debian/changelog
index 06f40e3..11f476c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,98 @@
+initramfs-tools (0.19) breezy; urgency=low
+
+ "The basis of optimism is sheer terror."
+ - Oscar Wilde
+
+ * mkinitramfs: Honour MODULES=list and MODULES=dep.
+
+ * hook-functions: New function dep_add_modules.
+
+ -- Jeff Bailey <jbailey@ubuntu.com> Wed, 10 Aug 2005 23:20:11 -0400
+
+initramfs-tools (0.18) breezy; urgency=low
+
+ "We are all in the gutter, but some of us are looking at the stars."
+ - Oscar Wilde
+
+ * debian/initramfs-tools.postrm: Use rm -f for removing the modules
+ file, in case it doesn't exist for some reason. (Ubuntu #13335)
+ Thanks to Colin Watson for the bug report!
+
+ * mkinitramfs.8: Correct my email address to be jbailey@ubuntu.com
+ Document /etc/mkinitramfs/DSDT.aml
+
+ * debian/initramfs-tools.postinst: Attempt to inherit RESUME settings
+ from initrd-tools. Also copy the DSDT from /etc/mkinitrd/DSDT to
+ /etc/mkinitramfs/DSDT.aml
+
+ -- Jeff Bailey <jbailey@ubuntu.com> Wed, 10 Aug 2005 13:09:44 -0400
+
+initramfs-tools (0.17) breezy; urgency=low
+
+ "The public is wonderfully tolerant. It forgives everything except
+ genius."
+ - Oscar Wilde
+
+ * debian/initramfs-tools.postinst: Get the name of the config file
+ right when seeding RESUME=. Also fix the sed expression.
+ Thanks to Matthew Garrett for noticing this!
+
+ -- Jeff Bailey <jbailey@ubuntu.com> Wed, 10 Aug 2005 11:54:07 -0400
+
+initramfs-tools (0.16) breezy; urgency=low
+
+ "It is through art, and through art only, that we can realise our
+ perfection."
+ - Oscar Wilde
+
+ * mkinitramfs: Make sure all relevant ide modules are included.
+ Add RESUME= support.
+
+ * scripts/functions: Be silent when adding non-detected modules.
+
+ * conf/mkinitramfs.conf: MODULES=most by default, BUSYBOX=y
+ (Non-busybox isn't supported now. It's not clear that it ever
+ will be). Add RESUME line for resuming from suspend-to-disk.
+
+ * scripts/local-premount/suspend: New script for suspend-to-disk.
+
+ * debian/control: Bump depends on busybox-cvs-initramfs to
+ 20040623-1ubuntu19. Add dependancy on lvm2.
+ Bump standards version to 3.6.2.0 (no-op)
+
+ * debian/control:
+ Force version depend on lvm2 (>= 2.01.04-5) to make sure newer kernels
+ will boot.
+ Thanks for Andrew Mitchell for discovering this.
+
+ * hooks/: New directory
+
+ * debian/dirs: Move hooks to ...
+ * debian/initramfs-tools.install: ... here.
+
+ * hooks/acpid: New file.
+
+ * scripts/init-premount/acpid: New file
+ Thanks for the hint from Matthew Garrett for this.
+
+ * debian/initramfs-tools.postinst: Add RESUME support on first install.
+
+ * debian/mkinitramfs: Move functions to ...
+ * debian/hook-functions: ... here.
+
+ * debian/initramfs-tools.install: Install hook-functions
+
+ * mkinitramfs.8: New file.
+ Thanks to Maximilian Attems for contributing this!
+
+ * scripts/local-top/md: Don't try to detect raid on non-existant devices
+ or on whole devices. Quiet other warning messages.
+
+ * hook-functions: When generating initramfs, don't complain about missing
+ modules.
+
+ -- Jeff Bailey <jbailey@ubuntu.com> Tue, 9 Aug 2005 23:35:08 -0400
+
initramfs-tools (0.15) breezy; urgency=low
"Nothing looks so like innocence as an indiscretion."
@@ -12,7 +107,9 @@ initramfs-tools (0.15) breezy; urgency=low
* debian/dirs: Make the /etc version of this directory for user
addons.
- -- Jeff Bailey <jbailey@ubuntu.com> Fri, 5 Aug 2005 11:39:26 -0400
+ * debian/rules: Use prebuild, rather than debian-build-arch.
+
+ -- Jeff Bailey <jbailey@ubuntu.com> Tue, 9 Aug 2005 11:29:10 -0400
initramfs-tools (0.14) breezy; urgency=low
diff --git a/debian/control b/debian/control
index 514368c..1c1a6b2 100644
--- a/debian/control
+++ b/debian/control
@@ -3,11 +3,11 @@ Section: utils
Priority: optional
Maintainer: Jeff Bailey <jbailey@ubuntu.com>
Build-Depends-Indep: debhelper (>= 4.0.0), cdbs
-Standards-Version: 3.6.1
+Standards-Version: 3.6.2.0
Package: initramfs-tools
Architecture: all
-Depends: klibc-utils, busybox-cvs-initramfs, mdadm
+Depends: klibc-utils, busybox-cvs-initramfs (>= 20040623-1ubuntu19), mdadm, lvm2 (>= 2.01.04-5)
Description: tools for generating an initramfs
This package contains tools to create and boot an initramfs for prepackaged
2.6 Linux kernel. The initramfs is an cpio archive. At boot time, the kernel
diff --git a/debian/dirs b/debian/dirs
index 6de384e..d35ba7c 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -7,5 +7,4 @@ etc/mkinitramfs/local-top
etc/mkinitramfs/nfs-bottom
etc/mkinitramfs/nfs-premount
etc/mkinitramfs/nfs-top
-usr/share/initramfs-tools/hooks
usr/share/initramfs-tools/modules.d
diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install
index a2a78f5..8702d53 100644
--- a/debian/initramfs-tools.install
+++ b/debian/initramfs-tools.install
@@ -2,3 +2,5 @@ mkinitramfs usr/sbin
init usr/share/initramfs-tools
scripts usr/share/initramfs-tools
conf/initramfs.conf etc/mkinitramfs
+hooks usr/share/initramfs-tools
+hook-functions usr/share/initramfs-tools
diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst
index 70be9f6..ea92067 100644
--- a/debian/initramfs-tools.postinst
+++ b/debian/initramfs-tools.postinst
@@ -2,6 +2,28 @@
set -e
+if [ "$1" = configure ]; then
+ if [ x${2} = x ]; then
+
+ # First time install. Can we autodetect the RESUME partition?
+ RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ')
+
+ # Inhertic initrd-tools settings if possible.
+ if [ -e /etc/mkinitrd/mkinitrd.conf ]; then
+ . /etc/mkinitrd/mkinitrd.conf
+ fi
+
+ if [ -e ${RESUME} ]; then
+ sed -i -e "s@#RESUME=@RESUME=${RESUME}@" /etc/mkinitramfs/initramfs.conf
+ fi
+
+ if [ -e /etc/mkinitrd/DSDT ]; then
+ cp /etc/mkinitrd/DSDT /etc/mkinitramfs/DSDT.aml
+ fi
+
+ fi
+fi
+
if [ ! -e /etc/mkinitramfs/modules ]; then
cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/
fi
diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm
index 7bea06f..2af9945 100644
--- a/debian/initramfs-tools.postrm
+++ b/debian/initramfs-tools.postrm
@@ -1,7 +1,7 @@
#!/bin/sh
if [ "x${1}" = "xpurge" ]; then
- rm /etc/mkinitramfs/modules
+ rm -f /etc/mkinitramfs/modules
fi
#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index a1b8695..6b91c1f 100644
--- a/debian/rules
+++ b/debian/rules
@@ -2,5 +2,5 @@
include /usr/share/cdbs/1/rules/debhelper.mk
-common-build-arch::
+pre-build::
chmod +x init mkinitramfs
diff --git a/hook-functions b/hook-functions
index 0d79703..5db7d27 100644
--- a/hook-functions
+++ b/hook-functions
@@ -4,3 +4,136 @@ catenate_cpiogz() {
cat "$1" >>${__TMPCPIOGZ}
}
+add_modules_from_file()
+{
+ # Sanity check
+ if [ ! -e ${1} ]; then
+ return
+ fi
+
+ sed -e '/^#/d' ${1} | while read module rest; do
+ manual_add_modules ${module}
+ echo ${module}.ko "${rest}" >>${DESTDIR}/conf/modules
+ done
+}
+
+manual_add_modules()
+{
+ for mam_x in $(modprobe --set-version=${version} --show-depends ${1} 2>/dev/null | awk '{ print $2 }'); do
+ # Prune duplicates
+ if [ -e ${DESTDIR}/${mam_x} ]; then
+ continue
+ fi
+
+ mkdir -p ${DESTDIR}/$(dirname ${mam_x})
+ ln -s ${mam_x} ${DESTDIR}/$(dirname ${mam_x})
+ depmod -b ${DESTDIR} ${version}
+ done
+}
+
+# $1 is source
+# $2 is relative destination
+copy_exec() {
+ ln -s ${1} ${DESTDIR}/${2}
+
+ # Copy the dependant libraries
+ for x in $(ldd ${1} 2>/dev/null | sed -e '
+ /\//!d;
+ /linux-gate/d;
+ /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};
+ s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do
+ libname=$(basename ${x})
+ dirname=$(dirname ${x})
+ mkdir -p ${DESTDIR}/${dirname}
+ if [ ! -e ${DESTDIR}/${dirname}/${libname} ]; then
+ ln -s ${x} ${DESTDIR}/${dirname}
+ fi
+ done
+}
+
+# Copy entire subtrees to the initramfs
+copy_modules_dir()
+{
+ tmpdir_modbase=${DESTDIR}/lib/modules/${version}
+ mkdir -p $(dirname ${tmpdir_modbase}/${1})
+ cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1}
+}
+
+dep_add_modules()
+{
+
+ # Things that are too hard to autodetect.
+ for x in md raid0 raid1 raid5 raid6 ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do
+ manual_add_modules ${x}
+ done
+
+ for x in /sys/bus/pci/devices/*; do
+ if [ -e ${x}/modalias ]; then
+ manual_add_modules $(cat ${x}/modalias)
+ fi
+ done
+
+ # Give the USB bus a moment to catch up
+ sleep 2
+
+ for x in /sys/bus/usb/devices/*; do
+ if [ -e ${x}/modalias ]; then
+ manual_add_modules $(cat ${x}/modalias)
+ fi
+ done
+
+ if [ -e /proc/ide ]; then
+ for x in ide-generic ide-disk ide-cd; do
+ manual_add_modules ${x}
+ done
+ fi
+
+ if [ -e /sys/bus/scsi/devices/ ]; then
+ manual_add_modules sd_mod
+ fi
+}
+
+
+# Modules that we always add to the initramfs
+auto_add_modules()
+{
+ # base
+ for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do
+ manual_add_modules ${x}
+ done
+
+ # Ethernet
+ for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do
+ manual_add_modules ${x}
+ done
+
+ # ide
+ for x in ide-cd ide-disk ide-generic aec62xx alim15x3 amd74xx atuuxo cmd64x cs5520 cs5530 cy82c693 generic hpt34x hpt366 ns87415 pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks siimage sis5513 slc82c105 slc90e66 triflex trm290 via82cxxx; do
+ manual_add_modules ${x}
+ done
+
+ # scsi
+ for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do
+ manual_add_modules ${x}
+ done
+
+}
+
+usage()
+{
+ cat >&2 << EOF
+
+Usage: ${0} [OPTION]... <-o outfile> [version]
+
+Options:
+ -d confdir Specify an alternative configuration directory.
+ -k Keep temporary directory used to make the image.
+ -o outfile Write to outfile.
+ -r root Override ROOT setting in mkinitrd.conf.
+
+See ${0}(8) for further details.
+EOF
+ exit 1
+
+}
+
diff --git a/init b/init
index e1fee77..38450da 100644
--- a/init
+++ b/init
@@ -15,6 +15,7 @@ export init=/sbin/init
export quiet=n
export readonly=y
export ROOT=
+export resume=${RESUME}
export rootmnt=/root
for x in $(cat /proc/cmdline); do
case $x in
@@ -30,6 +31,9 @@ for x in $(cat /proc/cmdline); do
boot=*)
BOOT=${x#boot=}
;;
+ resume=*)
+ resume=${x#resume=}
+ ;;
quiet)
quiet=y
;;
diff --git a/mkinitramfs b/mkinitramfs
index 8092a14..3257c94 100644
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -1,112 +1,5 @@
#!/bin/sh
-# Takes a file containing a list of modules to be added as an
-# argument, figures out dependancies, and adds them.
-#
-# Input file syntax:
-#
-# # comment
-# modprobe_module_name [args ...]
-# [...]
-#
-add_modules_from_file()
-{
- # Sanity check
- if [ ! -e ${1} ]; then
- return
- fi
-
- sed -e '/^#/d' ${1} | while read module rest; do
- manual_add_modules ${module}
- echo ${module}.ko "${rest}" >>${DESTDIR}/conf/modules
- done
-}
-
-manual_add_modules()
-{
- for mam_x in $(modprobe --set-version=${version} --show-depends ${1} | awk '{ print $2 }'); do
- # Prune duplicates
- if [ -e ${DESTDIR}/${mam_x} ]; then
- continue
- fi
-
- mkdir -p ${DESTDIR}/$(dirname ${mam_x})
- ln -s ${mam_x} ${DESTDIR}/$(dirname ${mam_x})
- depmod -b ${DESTDIR} ${version}
- done
-}
-
-# $1 is source
-# $2 is relative destination
-copy_exec() {
- ln -s ${1} ${DESTDIR}/${2}
-
- # Copy the dependant libraries
- for x in $(ldd ${1} 2>/dev/null | sed -e '
- /\//!d;
- /linux-gate/d;
- /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};
- s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do
- libname=$(basename ${x})
- dirname=$(dirname ${x})
- mkdir -p ${DESTDIR}/${dirname}
- if [ ! -e ${DESTDIR}/${dirname}/${libname} ]; then
- ln -s ${x} ${DESTDIR}/${dirname}
- fi
- done
-}
-
-# Copy entire subtrees to the initramfs
-copy_modules_dir()
-{
- tmpdir_modbase=${DESTDIR}/lib/modules/${version}
- mkdir -p $(dirname ${tmpdir_modbase}/${1})
- cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1}
-}
-
-# Modules that we always add to the initramfs
-auto_add_modules()
-{
- # base
- for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do
- manual_add_modules ${x}
- done
-
- # Ethernet
- for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do
- manual_add_modules ${x}
- done
-
- # ide
- for x in ide-cd ide-disk ide-generic aec62xx cmd64x generic hpt34x hpt366 ns87415 pdc202xx_new pdc202xx_old piix sc1200 siimage slc82c105 trm290 via82cxxx; do
- manual_add_modules ${x}
- done
-
- # scsi
- for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx atp870u BusLogic ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips lpfc mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do
- manual_add_modules ${x}
- done
-
-}
-
-usage()
-{
- cat >&2 << EOF
-
-Usage: ${0} [OPTION]... <-o outfile> [version]
-
-Options:
- -d confdir Specify an alternative configuration directory.
- -k Keep temporary directory used to make the image.
- -o outfile Write to outfile.
- -r root Override ROOT setting in mkinitrd.conf.
-
-See ${0}(8) for further details.
-EOF
- exit 1
-
-}
-
# Defaults
keep="n"
CONFDIR="/etc/mkinitramfs"
@@ -135,6 +28,7 @@ shift $((${OPTIND} - 1))
# For dependency ordered mkinitramfs hook scripts.
. /usr/share/initramfs-tools/scripts/functions
+. /usr/share/initramfs-tools/hook-functions
. ${CONFDIR}/initramfs.conf
@@ -150,6 +44,11 @@ else
version="${1}"
fi
+if dpkg --compare-versions "${version}" lt 2.6.12; then
+ echo "Kernel version too old. initramfs-tools requires at least 2.6.12."
+ exit 1
+fi
+
case ${version} in
/lib/modules/*/[!/]*)
;;
@@ -192,11 +91,18 @@ for d in bin conf etc lib modules sbin scripts; do
mkdir -p ${DESTDIR}/${d}
done
+# MODULES=list case. Always honour.
for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do
add_modules_from_file ${x}
done
-auto_add_modules
+if [ "${MODULES}" = "dep" ]; then
+ dep_add_modules
+fi
+
+if [ "${MODULES}" = "most" ]; then
+ auto_add_modules
+fi
# Have to do each file, because cpio --dereference doesn't recurse down
# symlinks.
diff --git a/scripts/functions b/scripts/functions
index cf9f4a7..10918f8 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -194,7 +194,7 @@ load_modules()
then
continue;
else
- modprobe -v $m
+ modprobe -q $m
fi
done
fi
@@ -219,4 +219,18 @@ load_modules()
scsi_boot_events
}
+parse_numeric() {
+ case $1 in
+ *:*)
+ minor=${1#*:}
+ major=${1%:*}
+ ;;
+ *)
+ minor=$((0x${1#??}))
+ major=$((0x${1%??}))
+ ;;
+ esac
+
+ mknod /dev/root b ${major} ${minor}
+}
diff --git a/scripts/local-top/md b/scripts/local-top/md
index 48c3ce6..055e109 100644
--- a/scripts/local-top/md
+++ b/scripts/local-top/md
@@ -18,9 +18,12 @@ esac
unset raidlvl
# Detect raid level
-for x in /dev/hd* /dev/sd*; do
- raidlvl=$(mdadm --examine ${x} | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/')
- modprobe -q ${raidlvl}
+for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do
+ if [ ! -e ${x} ]; then
+ continue
+ fi
+ raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/')
+ modprobe -q ${raidlvl} 2>/dev/null
done
[ x${raidlvl} != x ] || return