diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-09-09 17:12:53 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-09-09 17:12:53 -0700 |
commit | 573e21e410934f2293d5ac4c738af5f77083b43b (patch) | |
tree | 006a2586447b7f2e9353556f74633db605436777 | |
parent | 0de1ad17c333d645774ac3b48d652ccd4ecd6900 (diff) | |
parent | 7a6f9e972def00f7f0435d9f2616bcb79dc619b7 (diff) | |
download | initramfs-tools-573e21e410934f2293d5ac4c738af5f77083b43b.tar.gz initramfs-tools-573e21e410934f2293d5ac4c738af5f77083b43b.zip |
Merge branch 'upstream' (0.98.2) into mendocino
Conflicts:
debian/changelog
debian/compat
debian/control
debian/rules
hook-functions
mkinitramfs
55 files changed, 2171 insertions, 927 deletions
diff --git a/bash_completion.d/initramfs-tools b/bash_completion.d/initramfs-tools new file mode 100644 index 0000000..a52074f --- /dev/null +++ b/bash_completion.d/initramfs-tools @@ -0,0 +1,26 @@ +# update-initramfs(8) completion + +_update_initramfs() +{ + local cur prev valid_options + + # TODO: this can be "_get_comp_words_by_ref cur prev" once + # bash-completion >= 1.2 is available, see #537139 + cur=$(_get_cword) + prev=${COMP_WORDS[COMP_CWORD-1]} + + # The only option that takes an argument is -k + if [[ "$prev" == '-k' ]]; then + # Complete with kernel versions + _kernel_versions + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all' -- "$cur" ) ) + return; + fi + + # Complete with available options (obtained from -h) + valid_options=$( update-initramfs -h 2>&1 | \ + sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' ) + COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) ) +} + +complete -F _update_initramfs update-initramfs diff --git a/conf/initramfs.conf b/conf/initramfs.conf index a2bd8db..bc9060b 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -2,13 +2,13 @@ # initramfs.conf # Configuration file for mkinitramfs(8). See initramfs.conf(5). # -# Note that configuration options from this file can be overriden +# Note that configuration options from this file can be overridden # by config files in the /etc/initramfs-tools/conf.d directory. # # MODULES: [ most | netboot | dep | list ] # -# most - Add all framebuffer, acpi, filesystem, and harddrive drivers. +# most - Add most filesystem and all harddrive drivers. # # dep - Try and guess which modules to load. # @@ -36,6 +36,12 @@ BUSYBOX=y KEYMAP=n # +# COMPRESS: [ gzip | bzip2 | lzma | lzop ] +# + +COMPRESS=gzip + +# # NFS Section of the config. # @@ -52,10 +58,11 @@ BOOT=local # # DEVICE: ... # -# Specify the network interface, like eth0 +# Specify a specific network interface, like eth0 +# Overridden by optional ip= bootarg # -DEVICE=eth0 +DEVICE= # # NFSROOT: [ auto | HOST:MOUNT ] diff --git a/conf/update-initramfs.conf b/conf/update-initramfs.conf index c08c6ed..31823e2 100644 --- a/conf/update-initramfs.conf +++ b/conf/update-initramfs.conf @@ -1,4 +1,4 @@ -# +# # Configuration file for update-initramfs(8) # @@ -14,7 +14,7 @@ update_initramfs=yes # # backup_initramfs [ yes | no ] # -# Default is yes +# Default is no # If set to no leaves no .bak backup files. -backup_initramfs=yes +backup_initramfs=no diff --git a/debian/NEWS b/debian/NEWS index 9ac39f5..350189b 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,6 +1,13 @@ +initramfs-tools (0.94) unstable; urgency=low + + To improve boot speed and avoid some complications, video drivers are + no longer included in the initramfs by default (MODULES=most). + + -- maximilian attems <maks@debian.org> Mon, 05 Apr 2010 08:10:34 +0200 + initramfs-tools (0.76) unstable; urgency=low - * This release features nfs auto detection in the initramfs. + This release features nfs auto detection in the initramfs. The boot paramaters are parsed according to the linux source Documentation/kernel-parameters.txt and more specifically Documentation/nfsroot.txt. @@ -13,7 +20,7 @@ initramfs-tools (0.76) unstable; urgency=low initramfs-tools (0.61) unstable; urgency=low - * This release moves the initramfs-tools confdir from /etc/mkinitramfs to + This release moves the initramfs-tools confdir from /etc/mkinitramfs to /etc/initramfs-tools. Packages are encouraged to ship files as scripts under /usr/share/initramfs-tools. @@ -24,7 +31,7 @@ initramfs-tools (0.61) unstable; urgency=low initramfs-tools (0.10) breezy; urgency=low - * This release includes hardware auto detection in the initramfs. + This release includes hardware auto detection in the initramfs. This means two things in particular that are important: 1) the resulting initramfs will be huge. Like 10 megs huge. diff --git a/debian/TODO b/debian/TODO index f62656f..505da9c 100644 --- a/debian/TODO +++ b/debian/TODO @@ -3,8 +3,18 @@ TODO o Grep for TODO and FIXME and do those. =) - o Eliminate ?udev?, ?klibc?, busybox (-> glibc). + o Exclude list of hooks for admin. + + o Easier generation for remote boxes, see #570522. + + o "Fix" sed magic for lib dependence, + copy_exec, maybe use dracut copy logic. - o Default to dep for PPC - Possibly to detect newworld? + o root loop support. + + o MODULES=dep md replace awk magic with proper parsing. + -> WIP, check + + o Eliminate ?udev?, ?klibc?, busybox (-> glibc). - o udevsettle timeouts handling + o Support expanding symlinks, see #506540 + #338405 diff --git a/debian/changelog b/debian/changelog index 5cf4dfb..20e84b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,539 @@ +initramfs-tools (0.98.2) unstable; urgency=high + + [ Eckhart Wörner ] + * [97f20c5] initramfs-tools: Add hid-cherry and hid-logitech to + initramfs (Closes: #595827) + + -- maximilian attems <maks@debian.org> Tue, 07 Sep 2010 12:54:01 +0200 + +initramfs-tools (0.98.1) unstable; urgency=high + + [ Vagrant Cascadian ] + * [85fbb23] configure_networking(): Look for presence of + /tmp/net-*.conf files to not recall ipconfig. (Closes: #584583) + + -- maximilian attems <maks@debian.org> Wed, 25 Aug 2010 22:13:18 +0200 + +initramfs-tools (0.98) unstable; urgency=low + + [ Michael Prokop ] + * [7faeb32] fix typos in manpage, scripts/functions and + conf/initramfs.conf - thanks lintian + * [f1360c9] debian/NEWS: drop asterisk chars to make lintian happy + * [c4a1981] install doc-base file for doc-base-registration + * [f813bd9] add debian/source/format with "3.0 (native)" to make + lintian happy + * [38ee1a0] maintainer-notes: document "git remote prune origin" - + thanks to maximilian attems <maks@debian.org> + * [2390db8] maintainer-notes: use git config instead of environment + variables - thanks to Gerfried Fuchs <rhonda@deb.at> + * [c85bb1f] some minor rewording of sentences about development + mailinglists + * [7af6ef4] mkinitramfs: do not execute compress command under quotes + (Closes: #588517) + * [b65a486] update-initramfs: stop buildprocess if any script is + failing + * [e7daaf7] init: provide validate_init() wrapper to support absolute + symlinks. (Closes: #590744) + * [a0c3140] init: provide fastforward path for the common case when + validating init binary. + * [b343994] Bump Standards-Version to 3.9.1. + + [ maximilian attems ] + * [837f261] mkinitramfs: set nounset and errexit + * [be71015] reportbug: list the mkinitramfs hook scripts of reporting + box + * [295bca7] initramfs-tools.8: Enhance documentation of boot option + * [c327689] update-initramfs: run_bootloader() return after zipl and + flash-kernel + * [089a903] mkinitramfs: set COMPRESS=gzip to be more consistent. - + thanks to Colin Watson <cjwatson@ubuntu.com> + * [210c83c] control: conform to latest policy without changes + * [9613412] mkinitramfs: Provide error code of failed mkinitramfs + creation + * [51a8d5f] revert mkinitramfs errexit and nounset + * [6bcb867] Maintainer notes document dev mailinglists + * [7c6221d] maintainer notes: underline that mail to one of the 2 + lists is good + * [762ae2a] update-initramfs: revert nounset (Closes: #588915) + * [a4e1a9e] initramfs-tools: only allow hook scripts to errexit on + mkinitramfs + * [6f0b646] update-initramfs: run_bootloader() invoke Initramfs hooks + + [ Stephen Powell ] + * [09d251a] postinst hook: respect INITRD variable + * [ff6116f] Redirect STDOUT to STDERR for post{inst,rm} hooks + + -- Michael Prokop <mika@debian.org> Sat, 07 Aug 2010 09:41:39 -0400 + +initramfs-tools (0.97.2) unstable; urgency=high + + * [ce732c3] initramfs-tools: output name of script that errexits. + (Closes: 586554) + + -- maximilian attems <maks@debian.org> Tue, 06 Jul 2010 12:58:37 +0200 + +initramfs-tools (0.97.1) unstable; urgency=high + + * [90d99e4] mkinitramfs: Fix initramfs generation without COMPRESS set. + (Closes: 587608) - thanks Valentin QUEQUET <valentin.quequet@orange.fr> + + -- maximilian attems <maks@debian.org> Mon, 05 Jul 2010 21:50:47 +0200 + +initramfs-tools (0.97) unstable; urgency=low + + [ Martin Michlmayr ] + * [e65ee48] Produce an error when root cannot be determined with + MODULES=dep + * [bb66fc2] hook-functions/init/scripts/local: add support for ubifs. + (Closes: #582858) - thanks to Martin Michlmayr <tbm@cyrius.com> + + [ Ferenc Wagner ] + * [1d66ae1] scripts/nfs: cleanup retry logic + + [ Colin Watson ] + * [3054e3e] initramfs-tools: work around 'find -printf %Y' bug + + [ maximilian attems ] + * [a8a5ce4] script: Add update-initramfs.conf to bug report + * [cc6077a] update-initramfs: Fix another unbound variable (Closes: + #583695) + * [b1f74e6] get_fstype: reference blkid in comment - thanks to + Christoph Anton Mitterer <calestyo@scientia.net> + * [eb93a7e] pre_mountroot(): reduce timeout to 30 seconds + * [38563fe] scripts/functions: On panic change to tty1 if chvt around + - thanks to Colin Watson <cjwatson@ubuntu.com> + * [2031379] mkinitramfs: No point in hardcoding busybox path + * [68c87cd] mkinitramfs: check syntax of boot and hook scripts + * [ae02e4b] scripts/functions: beautify a bit reduce_satisfied() + * [22d996c] maintainer doc: use git commands without the dash + * [6147641] nfsmount: more small cleanups + * [e967b03] mkinitramfs, lsinitramfs: Better error message for + non-GNU getopt + * Add lsinitramfs (to list content of an initramfs image) ([a39db63] + [969f8fd] [fafede5] [2f3eb88]) + + [ Michael Prokop ] + * [2a8c990] hook-functions/mkinitramfs/update-initramfs: consequently + output error messages to stderr + * [04b8619] init: display warning message if devtmpfs could not be + mounted. - thanks to Ferenc Wagner <wferi@niif.hu> + * [60afd2a] code cleanup: drop trailing whitespaces. + * [ab28c77] code cleanup: consequently replace spaces in indentions + with tabs to unify coding stile + * [3a02c6f] code cleanup: consequently use "W:" for warnings. + * [b1fff5e] add bash-completion for update-initramfs (Closes: #537139) + - thanks to Stéphane Jourdois <stephane@jourdois.fr> + * [5697c3b] hook-functions: replace awk calls with sed in + dep_add_modules() (Closes: #585991) - thanks to Thorsten Glaser + <tg@mirbsd.de> + * [7afab22] debian/script: append /proc/mdstat (iff present) to + bugreports + * [5b565be] scripts/functions: allow hooks to abort build (Closes: + #396388) + * [528ba78] hook-functions: do not install ubi module by default via + auto_add_modules() + * [ecb8416] lsinitramfs: be more defensive against cmdline options + * [2ff4ba2] scripts/functions: fix usage of test for script execution + * [74f71c9] scripts/functions: fix another sh -n usage and fix typo + * [91f5947] hook-functions: install virtio_pci module if + /sys/bus/virtio is present and using modules=dep (Closes: #585992) - + thanks to Vincent Danjean <vdanjean@debian.org> + * [d25f610] slightly improve manpage lsinitramfs.8 + * Provide maintainer-notes.html, being "Maintainer documentation for + initramfs-tools" ([7fc1ee5] [afafea4] [e506ee7] [d53a839] [6af23c2]) + + -- Michael Prokop <mika@debian.org> Fri, 18 Jun 2010 12:28:04 +0200 + +initramfs-tools (0.96.1) unstable; urgency=low + + * hook-functions: Make sure copy_exec hook function does not + exit with a non-zero return value in non-verbose mode. + [Closes: #584520] + * docs/framebuffer: Document mode vs. mode_option option in + framebuffer example script. [Closes: #439846] + * hook-functions: make device name handling for /proc/mdstat + more flexible for MODULES=dep. [Closes: #549680, #514756] + * mkinitramfs / scripts/functions + initramfs-tools.8: + Support dashes inside scripts names. [Closes: #566056] + * hook-functions: handle ubifs in dep_add_modules() and return + since ubifs root is a char device, (see issue #582858). + * mkinitramfs: warn if TMPDIR is mounted noexec + fall back + to not cache run scripts then. [Closes: #576678] + * Add myself to uploaders. + + -- Michael Prokop <mika@debian.org> Tue, 08 Jun 2010 15:59:08 +0200 + +initramfs-tools (0.95.1) unstable; urgency=low + + [ Michael Prokop ] + * NMU as requested by maintainer. + * update-initramfs: fix unbound variables. [Closes: #583695] + Based on patch by Jonathan Nieder. + + [ Jonathan Nieder ] + * update-initramfs: use $* instead of $@. + + -- Michael Prokop <mika@debian.org> Sun, 30 May 2010 22:09:15 +0200 + +initramfs-tools (0.95) unstable; urgency=low + + [ maximilian attems ] + * update TODO list. + * hook-functions: refactor copy_exec. + * mkinitramfs: check only once for existing ldd. + * mkinitramfs: Use eventual TMPDIR definition. + * mkinitramfs: guard against empty EXTRA_CONF. + * update-initramfs: Use nounset. + * mkinitramfs: Fix several unbound variables. + * mkinitramfs: On verbose indicate what we rm. + * bug script: include sizes of generated initramfs. + * debian/script: add generated resume param to bug. + * hook-functions: manual_add_modules simplify. + * hook-functions: copy_modules_dir() small simplifications. + * mkinitramfs.8: Fix wrong sourcing in boot script. (Closes: #545728) + * initramfs-tools.8: Mention /scritps/functions. + * initramfs-tools.8: cryptopts param gone. + * initramfs-tools.8: document BOOTIF variable. + * configure_networking(): work with empty DEVICE string. + (Closes: #566295, #575766) + * hook-functions: add hid-apple. (Closes: #577253) + * Revert "mkinitramfs: only copy modprobe conf files". (Closes: #577981) + * initramfs-tools: change license to GPL. + * hook-functions: re-add hid-microsoft. (Closes: #577253) + * initramfs-tools: drop outdated breaks. + * debian/copyright: add boilerplate to keep lintian happy. + * hook-functions: Fix copy_modules_dir(). + + [ Axel Beckert ] + * mkinitramfs.8: Add information about $TMPDIR environment variable. + + [ bert schulze ] + * mkinitramfs: add LZO support. + * mkinitramfs: use -9 for lzop. + + [ Vagrant Cascadian ] + * configure_networking: pxelinux BOOTIF fixes. + * init: add BOOTIF bootarg. + + [ Michael Prokop ] + * Support booting from USB 3 xHCI-based controllers. + + [ Claus Herwig ] + * mkinitramfs: fix MODULES=dep on mylex raid devices (DAC960). + (Closes: #579702) + + -- maximilian attems <maks@debian.org> Fri, 28 May 2010 17:22:56 -0700 + +initramfs-tools (0.94.4) unstable; urgency=low + + * init: fix hardcoded resume handling. (Closes: #576700) + + -- maximilian attems <maks@debian.org> Thu, 08 Apr 2010 06:02:28 +0200 + +initramfs-tools (0.94.3) unstable; urgency=low + + * debian/control: Add Breaks against experimental findutils. + (closes: #576677) + + -- maximilian attems <maks@debian.org> Thu, 08 Apr 2010 03:50:28 +0200 + +initramfs-tools (0.94.2) unstable; urgency=low + + * debian/control: amend Breaks for exp mdadm. + + -- maximilian attems <maks@debian.org> Tue, 06 Apr 2010 23:50:06 +0200 + +initramfs-tools (0.94.1) unstable; urgency=low + + * debian/control: Add a breaks mdadm. + * debian/control: Fix Breaks version comparison. + + -- maximilian attems <maks@debian.org> Tue, 06 Apr 2010 16:18:25 +0200 + +initramfs-tools (0.94) unstable; urgency=low + + * The "Litte Bang" release + + [ maximilian attems ] + * Nuke kernelextras hooks. + * Create a klibc hook script. + * Redefinde MODULES=most to not carry any fb driver per default. + * Nuke framebuffer boot script. + * Revert "hook-functions: Add hid_* modules." + * Move busybox addition to a hook script. + * mkinitramfs fix comment. + * hook-functions: Fix mounted /sys check for openvz container. + * initramfs-tools.8: fix boot example script to execute. + scripts/functions. (closes: #545728) + * Fix out-of-date-standards-version. + * /etc/kernel hook script support for make deb-pkg generated linux-images + and kernel-package. (closes: #523735, #561289) + * update-initramfs: allow -t takeover on delete. + * /etc/kernel/postrm.d/i-t: use now takeover on delete. + (closes: #524534, #547365, #559619) + * Nuke useless unused dir. + * kernel hook scripts: Fix typo, add comments. + * hook-funcitions: Only warn about missing firmware if /proc/modules + exists. (closes: #560266, #575154) + * mkinitramfs: Be opportunistic when calling modprobe thus showing + errors. (closes: #554873) + * copy_exec: Check if ldd is around. + * scripts/local: Use blkid as backup fstype detection. (closes: #568527) + * mkinitramfs: only copy modprobe conf files. (closes: #506533) + * blacklist earlier at init-top stage. + * scripts/local: fix blkid invocation. + * init: export and unset BOOTIF. + * init: rexport resume to reallow it's hardcoded usage. (closes: #572858) + * update-initramfs: -d delete .bak file. (closes: #559535) + * control: bump standards version without changes. + * control: Clean up Uploaders field. + * switch from cdbs to debhelper 7. + * update-initramfs: Stop second guessing lilo usage. (closes: #574553) + * mkinitramfs: allow to build initramfs for unmodular linux images. + (closes: #415474, #433708) + * initramfs.conf.5: document UMASK variable for sensitive initramfs. + (closes: #536195) + * update-initramfs: only run elilo if configured. (closes: #534201) + * update-initramfs: fix previous elilo commit. + * MODULES=DEP Use driver/module syfs attribute. (closes: #567189) + * panic: quote variable. + * MODULES=DEP: Check rootfs on mkinitramfs. (closes: #519800) + * Use ata_generic driver on all_generic_ide bootarg + * scripts/functions: add get_fstype() from scripts/local. (closes: #487409) + * mkinitramfs.8: update date. + * Keep acpi modules in initramfs so that udev can load them early. + * mkinitramfs: no longer copy depmod. + * init: Silence "Loading essential drivers..." on quiet boot. + * hook-functions: Add btrfs to base modules. + * init: export BOOT for casper and friends. + * hooks/klibc: Keep gzip in initramfs. + * modernize docs to todays standards. + * examples: shipp old framebuffer boot script. + * initramfs.conf.5, update-initramfs.conf.5: Add FILES section. + (closes: #565386) + * mkinitramfs: be silent if no modules.map was generated in first place. + * debian/control: Add a breaks cryptsetup. + + [ Tormod Volden ] + * blacklist boot hook write to /etc/modprobe.d/initramfs.conf. + (closes: #541864) + + [ Michael Prokop ] + * Fix path to nfsroot.txt in documentation. + * hook-functions: Avoid firmware copy error. (closes: #570678) + + [ Joey Hess ] + * scripts/local: avoid mount -t unknown. (closes: #567065) + + [ Avi Rozen ] + * mkinitramfs: add all usb storage devices. (closes: #543568) + + [ Ferenc Wagner ] + * initramfs-tools: make the panic argument available in the rescue + shell. (closes: #569033) + + [ Maximilian Gass ] + * mkinitramfs: KEYMAP option fails to work due to missing keymap. + (closes: #565416) + + [ Vagrant Cascadian ] + * configure_networking: support BOOTIF variable set by pxelinux. + (closes: #535008) + + [ Ben Hutchings ] + * copy_modules_dir: Take a list of exclusions after the base directory. + * auto_add_modules: Copy all modules from net, excluding some + subdirectories. + + [ Scott James Remnant ] + * init: Mount devtmpfs on /dev. + * mkinitramfs: Call depmod before packing the initramfs. + (closes: #465760, #562561) + * init: load the netconsole module with netconsole bootarg + * init: mount /dev/pts as well as /dev. + + [ Ben Collins ] + * update-initramfs: Default to not keep .bak backups. + + [ Piotr Lewandowski ] + * update-initramfs breaks if /etc/mtab is a symlink to /proc/mounts. + (closes: #525606) + + [ Martin Michlmayr ] + * MODULES=dep fix boot with MMC. (closes: #548711) + + [ Nikolaus Schulz ] + * hook-functions: let dep_add_modules() recurse into lvm slave devices. + (closes: 573761) + + [ Anna Jonna Armannsdottir ] + * configure_networking: Try repeatedly ipconfig with increasing + timeout. + + [ Colin Watson ] + * mkinitramfs: Filter out looping or broken symlinks from the + initramfs. (closes: #575157) + * mkinitramfs: set initramfs root to 755. + + [ Bert Schulze ] + * initramfs-tools: support different compression tools in mkinitramfs. + (closes: #533903) + * mkinitramfs: -c compression support / commandline override. + (closes: #576429) + + -- maximilian attems <maks@debian.org> Mon, 05 Apr 2010 05:25:48 +0200 + +initramfs-tools (0.93.4) unstable; urgency=medium + + [ Aaron M. Ucko ] + * scripts/init-top/framebuffer: i915 needs intel-agp too. (closes: #533258) + + [ maximilian attems ] + * preinst: Don't hardcode vol_id cmd. + * initramfs-tools.8: Convert hyphen to minus sign. + * control: bump versioned dep on debhelper. + * control: bump standards version without changes. + * hook-functions: Fix loading of entries without newline in + /etc/initramfs-tools/modules. (closes: #532745) + * MODULES=most: Add virtio_net to initramfs. (closes: #533894) + + -- maximilian attems <maks@debian.org> Wed, 29 Jul 2009 14:55:04 +0200 + +initramfs-tools (0.93.3) unstable; urgency=low + + [ maximilian attems ] + * cleanup LABEL handling code. + * update-initramfs: Use exit code of command -v too. + * hook-functions: Add i915 module for kms. + * update-initramfs: Pass version to flash-kernel. (closes: #523711) + * update-initramfs: Don't hardcode path for lilo or elilo. (closes: #524928) + * hook-functions: MODULES=dep error out if sysfs not mounted on /sys. + (closes: #524179) + * debian/control: No longer mention EVMS in long description. + * hook-functions: MODULES=most fix old typo s/smc911x/smc91x/. + (closes: #528094) + * mkinitramfs: Invoke dpkg --print-architecture. (closes: #529222) + + [ Loic Minier ] + * copy_exec: also avoid picking sse2, neon, and vfp hwcaps libs. + + -- maximilian attems <maks@debian.org> Tue, 21 Apr 2009 15:05:40 +0200 + +initramfs-tools (0.93.2) unstable; urgency=low + + [ François Delawarde ] + * hook-functions: MODULES=dep fix for luks over cciss devices. + (closes: #517072, #522030) + + [ maximilian attems ] + * hook-functions: stricter match on loaded module for firmware + warning. + * hook-functions: Add first firmware from $(uname -r) versioned + directories. (closes: #521370) + * hook-functions: MODULES=most add all fb modules per default. + * update-initramfs: Cleanup run_bootloader() + * update-initramfs: mbr_check() use /boot/grub/grub.cfg for grub2 + search. (closes: #427509) + * update-initramfs: Run update on highest version instead of + /initrd.img link. (closes: #493863) + * hook-functions: MODULES=most fb add all available agp modules. + * update-initramfs: Fix error message on wrong -k version argument. + * hooks/thermal: Prevent inclusion of windfarm modules on PS3. + * mkinitramfs: Allow dots in boot and script filenames. + + [ Maik Zumstrull ] + * init-top/framebuffer: Load intel-agp for intelfb. + (closes: #416063, #455876) + + -- maximilian attems <maks@debian.org> Thu, 02 Apr 2009 12:44:33 +0200 + +initramfs-tools (0.93.1) unstable; urgency=low + + [ maximilian attems ] + * init: export ip root param for configure_networking(). (closes: #516746) + * initramfs-tools.8: Document exported IP kernel parameter. + * initramfs-tools.preinst: Nuke initrd-tools related migration path. + * MODULES=dep: ide-disk got renamed to ide-gd_mod since 2.6.28. + * mkinitramfs: usage() fix conffile name. + * update copyright year of my contributions. + * control: conform to latest policy without changes. + * hook-functions: reword MODULES=dep error message. + * hook-functions: MODULES=dep fix for mmc root. (closes: #520198) + * debian/compat: Set debhelper compatibility version 5. + + [ Matt Kraai ] + * mkinitramfs-kpkg misspells "deprecation" as "depreciation". + (closes: #517344) + + [ Michael Vogt ] + * update-initramfs: set_linked_version() check if the links point to + an existing initrd.img. + + [ Scott James Remnant ] + * mkinitramfs: include the modules.order file. + + [ Ben Collins ] + * init-top/framebuffer: ignore blacklist for forced vga= usage. + + -- maximilian attems <maks@debian.org> Mon, 23 Mar 2009 07:55:16 +0100 + +initramfs-tools (0.93) unstable; urgency=low + + Release "Fischia il vento e infuria la bufera" + + [ maximilian attems ] + * manpages: Set Linux as necessary OS. + * initramfs-tools.8: Fix path of debug log - now kept after boot. + (closes: #488804) + * mkinitramfs: Use cp with correct DESTDIR instead of copy_exec for configs. + Fixes relative pathes for -d option. (closes: #472409) + * initramfs-tools.8: Document default 180s rootdelay. + * update-initramfs: Fix run_bootloader() to check for grub2. + (closes: #511514) + * control: Add ${misc:Depends} depends. + * nuke old lvm hook scripts. + * mkinitramfs-kpkg: deprecate it's usage. + * hook-functions: just ship old iee1394 if around. + * mkinitramfs: Post-Lenny cleanup. + * udevhelper: nuke as need for partial upgrades between etch/lenny. + * mkinitramfs: Fix new pipe construct to really work inside + "${DESTDIR}". + * thermal boot script: Don't load thermal+fan on acpi=off. (closes: #514997) + * MODULES=dep fix for minor partitions > 9. (closes: #513958) + * initramfs-tools.8: Document mkinitramfs and init env variables. + (closes: #512453) + * init: Fix boot with LABEL containting one or several '/'. Thanks to + Andres Salomon <dilinger@debian.org> for testing. (closes: #489008) + * scripts/local-premount/resume: Fix resume with LABEL containing '/'. + + [ e2xbegqsdyt21hfc ] + * update-initramfs.8: mentions the specific conf file. + + [ Kel Modderman ] + * init: variable `break' unset before `maybe_break init' is evaluated. + (closes: #509637) + + [ Kees Cook ] + * minitramfs: find/cpio exit codes ignored while building initramfs. + (closes: #514938) + * mkinitramfs: Do not pass exit code through on pipe failure. + + [ Luke Yelavich ] + * hook-functions: Add hid_* modules, since some keyboards will not be + usable at the initramfs/busybox prompt without them. (closes: #515866) + + [ Andres Salomon ] + * allow root=mtd0 to be used; skip root checks if ROOT doesn't start + with /dev. (closes: #497133) + * initramfs-tools: Readd support for linux-2.6 make deb-pkg target. + (closes: #504551) + + [ Ian Campbell ] + * MODULES=dep fix for Xen virtual block devices. + + -- maximilian attems <maks@debian.org> Wed, 18 Feb 2009 19:10:23 +0100 + initramfs-tools (0.92o+vyatta+8) unstable; urgency=low * fix for squeeze dpkg @@ -213,7 +749,7 @@ initramfs-tools (0.92d) unstable; urgency=low each message. - initramfs-tools.preinst: Try to use UUID for resume device. - add boot script loading ide-generic on all_generic_ide cmdline. - Thanks Frans Pop <elendil@planet.nl> for report. (closes: #485786) + Thanks Frans Pop <elendil@planet.nl> for report. (closes: #485786) * init: add possible mountroot break (closes: #488963) * initramfs-tools.8: document UUID usage for root and all_generic_ide. (closes: #489186) @@ -420,7 +956,7 @@ initramfs-tools (0.90) unstable; urgency=low -- maximilian attems <maks@debian.org> Thu, 09 Aug 2007 21:30:29 +0200 initramfs-tools (0.89) unstable; urgency=low - + Release "L'\xE9lecteur c'est notoire N'a pas tout' sa raison" [ Joey Hess ] diff --git a/debian/compat b/debian/compat index 7ed6ff8..7f8f011 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5 +7 diff --git a/debian/control b/debian/control index b1e16c8..9f02a4f 100644 --- a/debian/control +++ b/debian/control @@ -2,21 +2,22 @@ Source: initramfs-tools Section: utils Priority: optional Maintainer: Vyatta Package Maintainers <maintainers@vyatta.com> -Build-Depends: debhelper (>= 5), cdbs -Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 7.0) +Standards-Version: 3.9.1 Vcs-Browser: http://git.debian.org/?p=kernel/initramfs-tools.git Vcs-Git: git://git.debian.org/git/kernel/initramfs-tools.git Package: initramfs-tools Architecture: all Recommends: busybox (>= 1:1.01-3) | busybox-initramfs -Depends: klibc-utils (>= 1.5.9-1), cpio, module-init-tools, udev (>= 0.086-1), findutils (>= 4.2.24) +Depends: klibc-utils (>= 1.5.9-1), cpio, module-init-tools, udev (>= 0.086-1), findutils (>= 4.2.24), ${misc:Depends} +Suggests: bash-completion Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for packaged 2.6 Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the kernel unpacks that archive into RAM, mounts and uses it as initial root file system. The mounting of the real root file system occurs in early user space. - klibc provides utilities to setup root. Having the root on EVMS, MD, LVM2, - LUKS or NFS is also supported. + klibc provides utilities to setup root. Having the root on MD, LVM2, LUKS or + NFS is also supported. Any boot loader with initrd support is able to load an initramfs archive. diff --git a/debian/copyright b/debian/copyright index b473ab4..9fe89c8 100644 --- a/debian/copyright +++ b/debian/copyright @@ -13,7 +13,7 @@ http://git.debian.org/?p=kernel/initramfs-tools.git;a=shortlog Authors: Adam Conrad <adconrad@ubuntu.com>, Ben Collins <bcollins@ubuntu.com>, David Härdeman <david@hardeman.nu>, - Jeff Bailey <jbailey@ubuntu.com>, + Jeff Bailey <jbailey@ubuntu.com>, maximilian attems <maks@debian.org>, Scott James Remnant <scott@ubuntu.com> @@ -21,9 +21,12 @@ Copyright: 2005 - 2006 Adam Conrad 2006 Ben Collins 2005 - 2007 David Härdeman 2005 Jeff Bailey - 2005 - 2007 maximilian attems + 2005 - 2009 maximilian attems 2005 - 2006 Scott James Remnant License: -PUBLIC DOMAIN +GPL v2 or any later version + +On Debian systems, the complete text of the GNU General Public License version +2 can be found in `/usr/share/common-licenses/GPL-2'. diff --git a/debian/initramfs-tools.dirs b/debian/initramfs-tools.dirs index a11bf32..0f63f2f 100644 --- a/debian/initramfs-tools.dirs +++ b/debian/initramfs-tools.dirs @@ -10,6 +10,6 @@ etc/initramfs-tools/scripts/nfs-top etc/initramfs-tools/hooks etc/initramfs-tools/conf.d usr/share/initramfs-tools/conf.d -usr/share/initramfs-tools/hooksconf.d +usr/share/initramfs-tools/conf-hooks.d usr/share/initramfs-tools/modules.d /var/lib/initramfs-tools diff --git a/debian/initramfs-tools.doc-base b/debian/initramfs-tools.doc-base new file mode 100644 index 0000000..41f2134 --- /dev/null +++ b/debian/initramfs-tools.doc-base @@ -0,0 +1,10 @@ +Document: initramfs-maintainer +Title: Maintainer documentation for initramfs-tools +Author: Michael Prokop +Abstract: This document describes the workflow of + the initramfs-tools maintainers. +Section: Debian + +Format: HTML +Index: /usr/share/doc/initramfs-tools/maintainer-notes.html +Files: /usr/share/doc/initramfs-tools/maintainer-notes.html diff --git a/debian/initramfs-tools.docs b/debian/initramfs-tools.docs index 5c374b1..a592331 100644 --- a/debian/initramfs-tools.docs +++ b/debian/initramfs-tools.docs @@ -1 +1,2 @@ HACKING +docs/maintainer-notes.html diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples index 9f67297..bb28943 100644 --- a/debian/initramfs-tools.examples +++ b/debian/initramfs-tools.examples @@ -1,4 +1,4 @@ conf/modules docs/example_script docs/example_hook -docs/example_hook_cpiogz +docs/framebuffer diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index fb1c088..184837f 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -1,3 +1,4 @@ +lsinitramfs usr/bin mkinitramfs usr/sbin mkinitramfs-kpkg usr/sbin init usr/share/initramfs-tools @@ -10,3 +11,5 @@ conf/modules usr/share/initramfs-tools update-initramfs usr/sbin debian/script usr/share/bug/initramfs-tools debian/lintian/initramfs-tools usr/share/lintian/overrides +kernel etc +bash_completion.d etc diff --git a/debian/initramfs-tools.manpages b/debian/initramfs-tools.manpages index 0c88045..6d78d4c 100644 --- a/debian/initramfs-tools.manpages +++ b/debian/initramfs-tools.manpages @@ -1,3 +1,4 @@ +lsinitramfs.8 mkinitramfs.8 mkinitramfs-kpkg.8 initramfs.conf.5 diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index 758b504..bb58684 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -20,8 +20,8 @@ case "$1" in # First time install. Can we autodetect the RESUME partition? if [ -r /proc/swaps ]; then RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ') - if [ -x /sbin/vol_id ]; then - UUID=$(/sbin/vol_id -u "$RESUME" || true) + if command -v vol_id >/dev/null 2>&1; then + UUID=$(vol_id -u "$RESUME" || true) elif [ -x /lib/udev/vol_id ]; then UUID=$(/lib/udev/vol_id -u "$RESUME" || true) fi @@ -30,35 +30,11 @@ case "$1" in fi fi - # Inherit initrd-tools settings if possible. - if [ -e /etc/mkinitrd/mkinitrd.conf ]; then - . /etc/mkinitrd/mkinitrd.conf - fi # write conf.d/resume if not in a chroot if [ -n "${RESUME}" ] && ! chrooted; then echo "RESUME=${RESUME}" > /etc/initramfs-tools/conf.d/resume fi - # Add initrd-tools modules, while trying to minimize prompting - if [ -e /etc/mkinitrd/modules ]; then - cp /etc/mkinitrd/modules /etc/initramfs-tools/ - sed -i \ - -e 's/\/etc\/mkinitrd\/modules: Kernel modules to load for initrd./List of modules that you want to include in your initramfs./g' \ - -e 's/mkinitrd/update-initramfs/g' \ - -e '/# This file should/,/one per line\./d' \ - -e 's/Comments begin with.*/Syntax: module_name [args ...]/' \ - -e 's/^# ext2$/# raid1/' \ - -e 's/^# wd io=0x300$/# sd_mod/' \ - -e '/^ide-generic/d' \ - -e '/^ide-disk/d' \ - -e '/^ext2/d' \ - -e '/^ext3/d' \ - /etc/initramfs-tools/modules - fi - - if [ -e /etc/mkinitrd/DSDT ]; then - cp /etc/mkinitrd/DSDT /etc/initramfs-tools/DSDT.aml - fi ;; esac diff --git a/debian/lintian/initramfs-tools b/debian/lintian/initramfs-tools index 6d1b9c8..5191f49 100644 --- a/debian/lintian/initramfs-tools +++ b/debian/lintian/initramfs-tools @@ -1,3 +1,3 @@ initramfs-tools: package-contains-empty-directory usr/share/initramfs-tools/conf.d/ -initramfs-tools: package-contains-empty-directory usr/share/initramfs-tools/hooksconf.d/ +initramfs-tools: package-contains-empty-directory usr/share/initramfs-tools/conf-hooks.d/ initramfs-tools: package-contains-empty-directory usr/share/initramfs-tools/modules.d/ diff --git a/debian/rules b/debian/rules index 85343d0..08a2fd4 100755 --- a/debian/rules +++ b/debian/rules @@ -3,12 +3,8 @@ DEB_DH_GENCONTROL_ARGS_ALL = $(shell if [ -f "../.VYATTA_DEV_BUILD" ]; then \ echo "-- -v999.dev"; fi) -include /usr/share/cdbs/1/rules/debhelper.mk - pre-build:: rm -f debian/files - chmod +x init mkinitramfs - chmod +x hooks/* - for x in `find scripts/ -maxdepth 1 -type d | tail -n+2`; do \ - chmod -R +x $$x; \ - done + +%: + dh $@ diff --git a/debian/script b/debian/script index 706a84d..46b6650 100755 --- a/debian/script +++ b/debian/script @@ -2,10 +2,18 @@ exec >&3 +echo "-- initramfs sizes" +ls -lh /boot/initrd.img-2.6.* + echo "-- /proc/cmdline" cat /proc/cmdline echo +if [ -r /etc/initramfs-tools/conf.d/resume ]; then + echo "-- resume" + cat /etc/initramfs-tools/conf.d/resume +fi + echo "-- /proc/filesystems" grep -v nodev /proc/filesystems echo @@ -26,14 +34,30 @@ if [ -r /etc/initramfs-tools/initramfs.conf ]; then echo fi +if [ -r /etc/initramfs-tools/update-initramfs.conf ]; then + echo "-- /etc/initramfs-tools/update-initramfs.conf" + sed 's/#.*$//;/^[[:space:]]*$/d' /etc/initramfs-tools/update-initramfs.conf + echo +fi + if [ -r /etc/crypttab ]; then echo "-- /etc/crypttab" cat /etc/crypttab echo fi +if [ -r /proc/mdstat ]; then + echo "-- /proc/mdstat" + cat /proc/mdstat + echo +fi + if grep -q "MODULES=dep" /etc/initramfs-tools/initramfs.conf ; then echo "-- /sys/block" ls /sys/block echo fi + +echo "-- mkinitramfs hooks" +ls /usr/share/initramfs-tools/hooks /etc/initramfs-tools/hooks/ +echo diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/docs/example_hook b/docs/example_hook index a0d015a..1f35352 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -1,5 +1,5 @@ #!/bin/sh - +# # # This is an example hook script. It will be run by 'mkinitramfs' # when it creates the image. It's job is to decide which files to @@ -8,39 +8,12 @@ # package is installed, or when the administrator runs 'mkinitramfs' # by hand to update an initramfs image. # -# TODO: What about the case where you install something that should be -# added to the initramfs, but the linux-image it relates to has -# already been installed previously? Does this happen often -# enough that it needs to be handled? How can it be handled? -# -# * Think about the 'usplash'. The initramfs will need to be -# updated if a theme change or update is desired. Maybe it -# should not be totally automatic, but offered on upgrade -# predicated on a user response to a debconf question? That -# issue needs to be explored and a solution specified. -# -# * Do not assume that any needed subdirectories have been created -# yet, but don't bail out if they are already there. -# -# * All of the standard system tools are available, of course, since -# this hook is running in the real system, not the initramfs. -# -# * TODO: ... ? Anything else to tell them in this bullet-list? -# - -# -# The environment contains at least: -# -# CONFDIR -- usually /etc/mkinitramfs, can be set on mkinitramfs +# CONFDIR -- usually /etc/initramfs-tools, can be set on mkinitramfs # command line. # # DESTDIR -- The staging directory where we are building the image. # -# TODO: Decide what environment variables are meaningful and defined -# in this context, then document them as part of the interface. -# -# TODO: May need a version_compare function for comparison of VERSION? - +# see initramfs-tools(8) # # List the soft prerequisites here. This is a space separated list of @@ -80,7 +53,7 @@ esac # course may be other reasons to have custom logic deciding what to # install. The version variable may be useful for this. # -if [ -x /usr/bin/myprog ]; then +if command -v myprog >/dev/null 2>&1; then copy_exec /usr/bin/myprog usr/bin fi @@ -92,23 +65,4 @@ fi # ... and it should do what is necessary to have 'myprog' get run # inside the early runtime environment. -# Handle an error: -# -if [ -n "$an_error_occured" ]; -then - # - # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? - # - echo "An error occured in $0: $an_error_occured" >&2 - exit 1 - # - # TODO: Decide if different error codes are meaningful, what they - # mean, and what the semantics of them are wrt 'mkinitramfs' - # pass or fail. Consider naming the error values with - # mnemonic symbols rather than magic numbers. They may or - # may not be the same set of errors as the set for - # in-initramfs scripts. - # -fi - exit 0 diff --git a/docs/example_hook_cpiogz b/docs/example_hook_cpiogz deleted file mode 100644 index f3e44d9..0000000 --- a/docs/example_hook_cpiogz +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh - -# -# The environment contains at least: -# -# CONFDIR -- usually /etc/mkinitramfs, can be set on mkinitramfs -# command line. -# -# DESTDIR -- The staging directory where we are building the image. -# -# TODO: Decide what environment variables are meaningful and defined -# in this context, then document them as part of the interface. -# -# TODO: Write a common header for these examples or move this -# documentation to a man page and reference it here. :-) -# - -# -# List the soft prerequisites here. This is a space separated list of -# names, of scripts that are in the same directory as this one, that -# must be run before this one can be. -# -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# -# Source the 'hook-functions' scriptlet (for 'catenate_cpiogz'): -# -. /usr/share/initramfs-tools/hook-functions - -# -# Lets pretend it has a conffile (think debconf), and we source it -# here. Don't make debconf lookup calls here. The postinst for the -# package owning this hook script should have done that and configured -# the "/etc/default/conffile" already. -# -# TODO: How does the package ensure that it's installed BEFORE the -# corresponding 'linux-image' package? Can it declare that, in -# the case where it's an add-on that the 'linux-image' is not -# aware of? This might be an apt and dpkg issue. -# -# * Eg. an optional usplash or suspend2ui_fbsplash package. -# -. /etc/default/mypackage-initramfs - -# -# Also pretend that we only include our initramfs overlay if an opion -# is not "no", and the 'linux-image' package we are generating this -# initramfs for matches the version this script's package is designed -# for. Just for example; pretend this example mkinitramfs hook script -# is part of a 'linux-image' or 'xxx-modules' package. -# -if [ "$MYOPTION" != "no" -a "$version" = "2.6.12+ss2.1.9.1" ]; then - catenate_cpiogz /usr/lib/mypackage/initramfs.cpio.gz -fi - -# -# In this case, there does not have to be an (eg.): -# -# "/etc/mkinitramfs/init-top/mypackage" -# -# ... since that script is probably inside of the initramfs overlay -# already. If it's a conffile though, it does not belong in there, -# and should be placed in the appropriate location inside of -# "/etc/mkinitramfs". Remember that if it needs access to the -# settings in our "/etc/default/mypackage-initramfs", then that file -# must also get copied into a location inside of ${DESTDIR} by this -# hook script in order to make it available inside of the initramfs -# environment. -# - -exit 0 diff --git a/docs/example_script b/docs/example_script index d7f407f..5e9153b 100644 --- a/docs/example_script +++ b/docs/example_script @@ -2,45 +2,11 @@ # # This script is run inside of the initramfs environment during the -# system boot process. It is installed there by 'mkinitramfs'. The -# package that owns it may opt to install it in either an appropriate -# location under "/usr/share/initramfs-tools/scripts/", or a similar -# location under "/etc/mkinitramfs/scripts/", depending upon whether -# it should be considered to be a user modifiable conffile or not. -# -# TODO: How do we deal with the case where the package that installed -# this has been removed but not purged, if we always arbitrarily -# copy all of these scripts into the initramfs? -# -# * The available toolset is limited inside this environment... -# -# TODO: document that toolset in the man page. -# -# * /dev, /proc, and /sys are already mounted. / is a ?? ro/rw -# filesystem... etc. more documentation. -# -# * It is expected that /proc and /sys will be umounted before -# changing over to the real root file system, so you must not keep -# any files open on them beyond these scripts. -# -# * You may like to strip these documentation comments from this -# example if you take it for a template, to save a little space in -# the initramfs, since nobody will ever read it from inside of -# there anyhow. -# - -# -# The environment contains at least the following variables: -# -# TODO: Decide what environment variables are meaningful and defined -# in this context, then document them as part of the interface. -# -# Because this script will be run as a full separate process, rather -# than sourced inside the context of the driver script, if it needs to -# pass information to another script that may run after it, it must do -# so by writing data to a file location known to both scripts. Simply -# setting an environment variable will not work. +# system boot process. It is installed there by 'update-initramfs'. +# The # package that owns it may opt to install it in an appropriate +# location under "/usr/share/initramfs-tools/scripts/". # +# see initramfs-tools(8) for more details. # # List the soft prerequisites here. This is a space separated list of @@ -66,25 +32,4 @@ esac echo "Got here!" -# Handle an error: - -if [ -n "$an_error_occured" ]; -then - # - # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? - # I think we ultimately do, and that they need to be in their own - # well-documented location so that an overlay can override them. - # Think 'usplash' progress updates. - # - echo "An error occured in $0: $an_error_occured" >&2 - exit 1 - # - # TODO: Decide if different error codes are meaningful, what they - # mean, and what the semantics of them are wrt 'init' pass - # or panic. Consider naming the error values with mnemonic - # symbols rather than magic numbers. - # -fi - exit 0 - diff --git a/scripts/init-top/framebuffer b/docs/framebuffer index 0ed798e..47d8302 100755..100644 --- a/scripts/init-top/framebuffer +++ b/docs/framebuffer @@ -21,14 +21,16 @@ esac # 1) options are comma-separated # 2) options can be in either of these three forms: # <arg>=<value>, <arg>:<value>, <boolean-arg>. -# 3) the "mode" option has the form <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] -# and may or may not start with "mode=" +# 3) the "mode" or "mode_option" option (name depends on the framebuffer driver) +# has the form <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] +# and may or may not start with "mode=" or "mode_option=" +# -> please adjust as necessary in the parse_video_opts() function # # When the options are used with modules, they need to be space-separated # and the following conversions are needed: # <arg>:<value> -> <arg>=<value> # <boolean-arg> -> <boolean-arg>=1 -# <modevalue> -> mode=<modevalue> +# <modevalue> -> mode=<modevalue> or mode_option=<modevalue> parse_video_opts() { local OPTS="$1" @@ -48,7 +50,10 @@ parse_video_opts() echo -n "${opt%:*}=${opt#*:} " # Presumably a modevalue without the "mode=" prefix elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then + # Adjust: mode= option? echo -n "mode=$opt " + # ... or mode_option= option? + # echo -n "mode_option=$opt " # Presumably a boolean else echo -n "${opt}=1 " @@ -72,11 +77,16 @@ for x in $(cat /proc/cmdline); do esac done -# Map command line name to module name and other tweaks +# Module-specific workarounds case ${FB} in matroxfb) + # Map command line name to module name FB=matroxfb_base ;; +intelfb|i810fb|i915) + # Needs AGP driver loaded + modprobe intel-agp + ;; uvesafb) # v86d requires /dev/zero and dev/mem, but udev haven't been started yet [ -e /dev/zero ] || mknod -m 0666 /dev/zero c 1 5 @@ -87,8 +97,9 @@ uvesafb) esac if [ -n "${FB}" ]; then - modprobe fbcon - modprobe ${FB} ${OPTS} + unset MODPROBE_OPTIONS + modprobe -q fbcon + modprobe -q ${FB} ${OPTS} fi if [ -e /proc/fb ]; then diff --git a/docs/maintainer-notes.html b/docs/maintainer-notes.html new file mode 100644 index 0000000..e9cec2d --- /dev/null +++ b/docs/maintainer-notes.html @@ -0,0 +1,372 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<title>Maintainer documentation for initramfs-tools</title> +<style type="text/css"> +/*<![CDATA[*/ +a { color: black; } +a:hover { text-decoration: none; } +a:visited { color: gray; } +acronym { cursor: help; } +body { font-family: "DejaVu Sans", "Bitstream Vera Sans", sans-serif; } +pre { background-color: #EEEEEE; border: 1px dashed black; padding: 1em; } +div.right { text-align: right; } +/*]]>*/ +</style> +</head> + +<body> + +<div> +<hr /> + +<h1>Maintainer documentation for initramfs-tools</h1> + +<hr /> + +<h2><a name="toc">Table of Contents</a></h2> + +<ul> + +<li><a href="#definitions">1. Definitions</a></li> +<li><a href="#preparations">2. Preparations</a></li> + +<li><a href="#workflow">3. Workflow for daily work</a> +<ul> +<li><a href="#newfeature">3.1 Implement new features</a></li> +<li><a href="#merge">3.2 Merge branches</a></li> +<li><a href="#test">3.3 Test specific branch</a></li> +<li><a href="#snapshot">3.4 Build snapshot version</a></li> +</ul> +</li> + +<li><a href="#contribute">4. Contribute</a></li> +<li><a href="#release">5. Release new version</a></li> +<li><a href="#ressources">6. Ressources</a></li> +<li><a href="#credits">7. Credits</a></li> +<li><a href="#license">8. License</a></li> + +</ul> + +<hr /> + +<p><b>NOTE:</b> The most recent version of this document is available at +docs/maintainer-notes.html in the <a href="#checkout">the git repository</a> +or online at <a + href="http://git.debian.org/?p=kernel/initramfs-tools.git;a=blob_plain;f=docs/maintainer-notes.html;hb=HEAD">git.debian.org</a>.</p> + +<hr /> + +<h2><a name="definitions">1. Definitions</a></h2> + +<table> + <tr><td><code><b>$mailaddress:</b></code></td><td>mailaddress of the user</td></tr> + <tr><td><code><b>$username:</b></code></td><td>name of the alioth account</td></tr> + <tr><td><code><b>$version:</b></code></td><td>version string</td></tr> + <tr><td><code><b>$yourname:</b></code></td><td>your fullname</td></tr> +</table> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="preparations">2. Preparations</a></h2> + +<ol> + +<li>Install required software (notice: git is named git-core on Debian/stable): +<pre> +<b># apt-get install git git-buildpackage dpkg-dev</b> +</pre> +</li> + +<li>Set environment variables (e.g. through your ~/.bashrc or ~/.zshrc) for devscripts (git dch): +<pre> +<b>export DEBEMAIL=$mailaddress +export DEBFULLNAME=$yourname</b> +</pre> +</li> + +<li>Set user name and email address for git (drop the --global option to use configuration per-repo basis): +<pre> +<b>% git config --global user.name "$yourname" +% git config --global user.email "$mailaddress"</b> +</pre> +</li> + +<li><a name="checkout">Checkout</a> repository (anonymous): +<pre> +<b>% git clone git://git.debian.org/git/kernel/initramfs-tools.git +% cd initramfs-tools</b> +</pre> +</li> + +<li>Checkout repository (with developer access): +<pre> +<b>% git clone ssh://<code><i>$username</i></code>@git.debian.org/git/kernel/initramfs-tools.git +% cd initramfs-tools</b> +</pre> +</li> + +</ol> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="workflow">3. Workflow for daily work</a></h2> + +<h3><a name="newfeature">3.1 Implement new features</a></h3> + +<ol> + +<li>Checkout new branch and switch to it: +<pre> +<b>% git checkout -b <code><i>$username</i></code>/short-descr-of-new-feature</b> +</pre> +</li> + +<li>Hack and commit work: +<pre> +<b>% $EDITOR $somefile +% git add $somefile +% git commit -s</b> +</pre> + +<b>NOTE:</b> Use 'Closes: #BUGID' for closing a bugreport and 'Thanks: Fullname +<<code><i>mailaddress</i></code>>' for giving credits in your commit message. git dch will use +this information for generating the changelog using the --meta option later +on. + +</li> + +<li>Finally push your branch to alioth: +<pre> +<b>% git push origin <code><i>$username</i></code>/short-descr-of-new-feature</b> +</pre> +</li> + +</ol> + +<h3><a name="merge">3.2 Merge branches</a></h3> + +<ol> + +<li>Switch to the branch you want to merge: +<pre> +<b>% git checkout <code><i>$username</i></code>/new-feature</b> +</pre> +</li> + +<li>Rebase to master: +<pre> +<b>% git rebase master</b> +</pre> +</li> + +<li>Switch to master branch and merge: +<pre> +<b>% git checkout master +% git merge <code><i>$username</i></code>/new-feature</b> +</pre> +</li> + +<li>Push: +<pre> +<b>% git push</b> +</pre> +</li> + +<li>After branch is merged delete branch on server and locally: +<pre> +<b>% git push origin :<code><i>$username</i></code>/short-descr-of-new-feature +% git branch -d <code><i>$username</i></code>/short-descr-of-new-feature</b> +</pre> +</li> + +<li>If a branch is removed from the server it will stay locally. You can get of +any stale remote branches locally by executing: +<pre> +<b>% git remote prune origin</b> +</pre> +</li> + +</ol> + +<h3><a name="test">3.3 Test specific branch</a></h3> + +<ol> + +<li>Checkout a specific branch iff branch is not already present locally: +<pre> +<b>% git checkout -b somename/short-descr-of-new-feature origin/somename/short-descr-of-new-feature</b> +</pre> +</li> + +<li>Checkout a specific branch iff branch is already present locally: +<pre> +<b>% git checkout -b somename/short-descr-of-new-feature</b> +</pre> +</li> + +<li>Adjust debian/changelog accordingly: +<pre> +<b>% git dch --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" \ + --since="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" -S --id-length=7 --meta</b> +</pre> +</li> + +<li>Build package: +<pre> +<b>% git buildpackage --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" -tc</b> +</pre> +</li> + +</ol> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h3><a name="snapshot">3.4 Build snapshot version</a></h3> + +<ol> + +<li>Adjust debian/changelog accordingly: +<pre> +<b>% git dch --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" \ + --since="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" -S --id-length=7 --meta</b> +</pre> +</li> + +<li>Build package: +<pre> +<b>% git buildpackage --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" -tc [-us -uc]</b> +</pre> +</li> + +</ol> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="contribute">4. Contribute</a></h2> + +<ol> +<li>Create patch: +<pre> +<b>% git format-patch -s -p origin/master</b> +</pre> +</li> + +<li>Send patch file(s) to maintainers via mail (requires Debian package git-email): +<pre> +<b>% git send-email --to=initramfs-tools@packages.qa.debian.org $PATCHFILE[S]</b> +</pre> +</li> + +<li>The development mailinglists are <a + href="mailto:debian-kernel@lists.debian.org">debian-kernel@lists.debian.org</a> +and <a href="mailto:initramfs@vger.kernel.org">initramfs@vger.kernel.org</a>. +Discussion of features, bugs and patches are more than welcome on one +of these lists.</li> + +</ol> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="release">5. Release new version</a></h2> + +<ol> + +<li>Creating changelog: + +<pre> +<b>% git dch --debian-branch master --release --since <code><i>HASH</i></code></b> +</pre> + +or more dynamically: + +<pre> +<b>% git dch --meta --release --since v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" [--id-length=7] [--full]</b> +</pre> + +<b>NOTE:</b> we do not use history based sorting for the changelog entries but +sort them by author (doing that manually when reviewing the changelog, see <a + href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586165">#586165</a>). + +</li> + +<li>Releasing: +<pre> +<b>% git commit -a -s -m "Releasing version <code><i>$version</i></code>."</b> +</pre> +</li> + +<li>Tagging: +<pre> +<b>% git tag -s v"<code><i>$version</i></code>" -m "release <code><i>$version</i></code>"</b> +</pre> +</li> + +<li>Pushing: +<pre> +<b>% git push +% git push --tags</b> +</pre> +</li> + +<li>Build in chroot and upload to ftp-master.</li> + +<li>Send mail announcing the new initramfs-tools version with subject +"initramfs-tools $VERSION release" to initramfs@vger.kernel.org, +debian-kernel@lists.debian.org + kernel-team@lists.ubuntu.com - including a +shortlog (generated through "git shortlog $TAG..").</li> + +</ol> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="ressources">6. Ressources</a></h2> + +<ul> + <li><a href="http://git.debian.org/?p=kernel/initramfs-tools.git">initramfs-tools git web interface</a></li> + <li><a href="http://wiki.debian.org/initramfs">initramfs @ debian-wiki</a></li> + <li><a href="http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=initramfs-tools;dist=unstable">bugreports</a></li> + <li><a href="http://packages.qa.debian.org/i/initramfs-tools.html">initramfs-tools @ PTS</a></li> + <li><a href="http://qa.debian.org/popcon.php?package=initramfs-tools">popcon graph</a></li> + <li><a href="http://people.debian.org/~glandium/bts/i/initramfs-tools.png">bugcount for initramfs-tools</a></li> + <li><a href="https://launchpad.net/ubuntu/+source/initramfs-tools">bugreports @ ubuntu</a></li> + <li><a href="http://status.qa.ubuntu.com/qapkgstatus/initramfs-tools">qa page @ ubuntu</a></li> +</ul> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="credits">7. Credits</a></h2> + +<ul> + <li>Thanks to Daniel Baumann for his "<a href="http://documentation.debian-projects.org/other/debian-packaging-git/">Debian Packaging with Git</a>" which inspired this document.</li> +</ul> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<h2><a name="license">8. License</a></h2> + +<ul> + <li>This document is licensed under GPL v2 or any later version.</li> +</ul> + +<div class="right"><a href="#toc">^</a></div> +<hr /> + +<p> +<i>-- Michael Prokop <<a href="mailto:mika@debian.org" title="Send mail to the author of this document">mika@debian.org</a>></i> +</p> + +<hr /> + +</div> +</body> +</html> diff --git a/hook-functions b/hook-functions index cfabe50..915d2ef 100644 --- a/hook-functions +++ b/hook-functions @@ -3,7 +3,7 @@ catenate_cpiogz() { # Sanity check if [ ! -e "${1}" ]; then - echo "W:catenate_cpiogz: arg1='${1}' does not exist." >&2 + echo "W: catenate_cpiogz: arg1='${1}' does not exist." >&2 return fi @@ -29,39 +29,36 @@ add_modules_from_file() { # Sanity check if [ ! -e "${1}" ]; then - echo "W:add_modules_from_file: arg1='${1}' does not exist." >&2 + echo "W: add_modules_from_file: arg1='${1}' does not exist." >&2 return fi - sed -e '/^#/d' ${1} | while read module rest; do - force_load "${module}" "${rest}" + grep '^[^#]' ${1} | while read module args; do + [ -n "$module" ] || continue + force_load "${module}" "${args}" done } # Add dependent modules + eventual firmware manual_add_modules() { - local mam_x firmwares firmware + local kmod firmware - for mam_x in $(modprobe --set-version="${version}" --ignore-install \ - --show-depends "${1}" 2>/dev/null | awk '/^insmod/ { print $2 }'); do + for kmod in $(modprobe --set-version="${version}" --ignore-install \ + --quiet --show-depends "${1}" | awk '/^insmod/ { print $2 }'); do # Prune duplicates - if [ -e "${DESTDIR}/${mam_x}" ]; then + if [ -e "${DESTDIR}/${kmod}" ]; then continue fi - mkdir -p "${DESTDIR}/$(dirname "${mam_x}")" - ln -s "${mam_x}" "${DESTDIR}/$(dirname "${mam_x}")" + mkdir -p "${DESTDIR}/$(dirname "${kmod}")" + ln -s "${kmod}" "${DESTDIR}/$(dirname "${kmod}")" if [ "${verbose}" = "y" ]; then - echo "Adding module ${mam_x}" + echo "Adding module ${kmod}" fi - # Add firmware files if necessary - firmwares=$(modinfo -F firmware "${mam_x}") - if [ -z "${firmwares}" ]; then - continue - fi - for firmware in $firmwares; do + # Add required firmware + for firmware in $(modinfo -F firmware "${kmod}"); do if [ -e "${DESTDIR}/lib/firmware/${firmware}" ] \ || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ]; then continue @@ -70,12 +67,18 @@ manual_add_modules() # Only print warning for missing fw of loaded module # or forced loaded module if [ ! -e "/lib/firmware/${firmware}" ] \ - && [ ! -e "/lib/firmware/${version}/${firmware}" ]; then - if grep -q "^$(basename "${mam_x}" .ko)" \ + && [ ! -e "/lib/firmware/${version}/${firmware}" ] ; then + # Only warn about missing firmware if + # /proc/modules exists + if [ ! -e /proc/modules ] ; then + continue + fi + + if grep -q "^$(basename "${kmod}" .ko)[[:space:]]" \ /proc/modules \ - || grep -q "^$(basename "${mam_x}" .ko)" \ + || grep -q "^$(basename "${kmod}" .ko)" \ "${CONFDIR}/modules"; then - echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${mam_x} .ko)" >&2 + echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${kmod} .ko)" >&2 fi continue fi @@ -97,63 +100,42 @@ manual_add_modules() done } -# $1 is the source path (e.g. /usr/bin/time) -# $2 is the relative destination (e.g. /usr or /usr/time) -# -# The destination is interpreted in the same way "cp" would, meaning -# (assuming /bin is a directory): -# -# "copy_exec /usr/bin/time /bin" -> /bin/time -# "copy_exec /usr/bin/time /bin/mytime" -> /bin/mytime -# -# If $2 is left out, the same destination path as for the source arg will -# be used and directories will be created as needed, so: -# -# "copy_exec /usr/bin/time" -> /usr/bin/time -# +# $1 = file to copy to ramdisk +# $2 (optional) Name for the file on the ramdisk +# Location of the image dir is assumed to be $DESTDIR +# We never overwrite the target if it exists. copy_exec() { - local source target destination final_destination x nonoptlib + local src target x nonoptlib local libname dirname - source="${1}" - if [ -n "${2}" ]; then - target="${2}" - else - if [ ! -e "${DESTDIR}/$(dirname "${1}")" ]; then - mkdir -p "${DESTDIR}/$(dirname "${1}")" - fi - target="${1}" - fi + src="${1}" + target="${2:-$1}" + + [ -f "${src}" ] || return 1 if [ -d "${DESTDIR}/${target}" ]; then - destination="${target}/$(basename "${source}")" + # check if already copied + [ -e "${DESTDIR}/$target/${src##*/}" ] && return 0 else - destination="${target}" + [ -e "${DESTDIR}/$target" ] && return 0 + #FIXME: inst_dir + mkdir -p "${DESTDIR}/${target%/*}" fi - final_destination="${DESTDIR}/${destination}" - if [ -L "$final_destination" ]; then - if [ $(readlink "${final_destination}") != "${source}" ]; then - echo "W:copy_exec: Not copying ${source} to \$DESTDIR${destination}, which is already a copy of $(readlink ${final_destination})" >&2 - return - fi - else - ln -s ${source} ${DESTDIR}/${destination} - if [ "${verbose}" = "y" ]; then - echo "Adding binary ${source}" - fi - fi + [ "${verbose}" = "y" ] && echo "Adding binary ${src}" + ln -s "${src}" "${DESTDIR}/${target}" # Copy the dependant libraries - for x in $(ldd ${source} 2>/dev/null | sed -e ' - /\//!d; - /linux-gate/d; - /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; - s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do + for x in $(ldd ${src} 2>/dev/null | sed -e ' + /\//!d; + /linux-gate/d; + /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; + s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do # Try to use non-optimised libraries where possible. - # We assume that all HWCAP libraries will be in tls. - nonoptlib=$(echo "${x}" | sed -e 's#/lib/\(tls\|i686\).*/\(lib.*\)#/lib/\2#') + # We assume that all HWCAP libraries will be in tls, + # sse2, vfp or neon. + nonoptlib=$(echo "${x}" | sed -e 's#/lib/\(tls\|i686\|sse2\|neon\|vfp\).*/\(lib.*\)#/lib/\2#') if [ -e "${nonoptlib}" ]; then x="${nonoptlib}" @@ -162,12 +144,11 @@ copy_exec() { libname=$(basename "${x}") dirname=$(dirname "${x}") + # FIXME inst_lib mkdir -p "${DESTDIR}/${dirname}" if [ ! -e "${DESTDIR}/${dirname}/${libname}" ]; then ln -s "${x}" "${DESTDIR}/${dirname}" - if [ "${verbose}" = "y" ]; then - echo "Adding library ${x}" - fi + [ "${verbose}" = "y" ] && echo "Adding library ${x}" || true fi done } @@ -175,16 +156,25 @@ copy_exec() { # Copy entire subtrees to the initramfs copy_modules_dir() { - local x_mod + local kmod exclude + local dir="$1" + shift - if ! [ -d "${MODULESDIR}/${1}" ]; then + if ! [ -d "${MODULESDIR}/${dir}" ]; then return; fi if [ "${verbose}" = "y" ]; then - echo "Copying module directory ${1}" + echo "Copying module directory ${dir}" + if [ $# -ge 1 ]; then + echo "(excluding $*)" + fi fi - for x_mod in $(find "${MODULESDIR}/${1}" -name '*.ko' -print); do - manual_add_modules $(basename ${x_mod} .ko) + while [ $# -ge 1 ]; do + exclude="${exclude:-} -name $1 -prune -o " + shift + done + for kmod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' -print); do + manual_add_modules $(basename ${kmod} .ko) done } @@ -193,10 +183,10 @@ sys_walk_mod_add() { local driver_path module device_path="$1" - + while [ "${device_path}" != "/sys" ]; do sys_walk_modalias ${device_path} - driver_path="$(readlink -f ${device_path}/driver)" + driver_path="$(readlink -f ${device_path}/driver/module)" if [ -e "$driver_path" ]; then module="$(basename $(readlink -f $driver_path))" if [ -n "${module}" ]; then @@ -228,24 +218,49 @@ dep_add_modules() { local block minor root FSTYPE root_dev_path x + # require mounted sysfs + if [ ! -d /sys/devices/ ]; then + echo "mkinitramfs: MODULES dep requires mounted sysfs on /sys" >&2 + exit 1 + fi + # findout root block device + fstype eval "$(mount | awk '/\/dev\// {if ($3 == "/") {print "root=" $1 "\nFSTYPE=" $5; exit}}')" + if [ -z "$root" ]; then + echo "mkinitramfs: failed to determine root device" >&2 + echo "mkinitramfs: workaround is MODULES=most" >&2 + echo "Error please report bug on initramfs-tools and include the output of 'mount'" >&2 + exit 1 + fi + + # handle ubifs and return since ubifs root is a char device but + # most of the commands below only work with block devices. + if [ "${FSTYPE}" = "ubifs" ]; then + manual_add_modules "${FSTYPE}" + # add some modules required by ubifs on which it doesn's depend + manual_add_modules deflate + manual_add_modules zlib + manual_add_modules lzo + return + fi + if [ "${root}" = "/dev/root" ] ; then - root="/dev/disk/by-uuid/"$(/lib/udev/vol_id --uuid ${root}) 2>/dev/null + root="/dev/disk/by-uuid/"$(blkid -o value -s UUID ${root}) 2>/dev/null fi root="$(readlink -f ${root})" - # find out real rootfs on auto type - if [ "${FSTYPE}" = "auto" ]; then - eval "$(/usr/lib/klibc/bin/fstype ${root})" - fi + # do not trust mount, check superblock + eval "$(/usr/lib/klibc/bin/fstype ${root})" # check that fstype rootfs recognition if [ "${FSTYPE}" = "unknown" ]; then - echo "mkinitramfs: unknown fstype on root ${root}" - echo "mkinitramfs: workaround is MODULES=most" - echo "mkinitramfs: Error please report bug on initramfs-tools" - exit 1 + FSTYPE=$(blkid -o value -s TYPE "${root}") + if [ -z "${FSTYPE}" ]; then + echo "mkinitramfs: unknown fstype on root ${root}" >&2 + echo "mkinitramfs: workaround is MODULES=most" >&2 + echo "Error please report bug on initramfs-tools" >&2 + exit 1 + fi fi # Add rootfs @@ -256,26 +271,33 @@ dep_add_modules() || [ "${root#/dev/dm-}" != "${root}" ]; then minor=$((0x$(stat --format "%T" ${root}) % 256)) block=$(ls -1 /sys/block/dm-${minor}/slaves | head -n 1) - # lvm on luks or luks on lvm - if [ "${block#dm-}" != "${block}" ]; then + # lvm on luks or luks on lvm, possibly lvm snapshots + while [ "${block#dm-}" != "${block}" ]; do block=$(ls -1 /sys/block/${block}/slaves | head -n 1) - fi + done # lvm on md or luks on md if [ "${block#md}" != "${block}" ]; then - block=$(awk "/^${block}/{print substr(\$5, 1, 4); exit}" \ - /proc/mdstat) + block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^'${block}' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat) + fi + # luks or lvm on cciss or ida + if [ "${block#cciss}" != "${block}" ] \ + || [ "${block#ida}" != "${block}" ]; then + block="${block%p*}" + else + block=${block%%[0-9]*} fi - block=${block%[0-9]*} # md root new naming scheme /dev/md/X elif [ "${root#/dev/md/}" != "${root}" ]; then root=${root#/dev/md/} - block=$(awk "/^md${root}/{print substr(\$5, 1, 3); exit}" \ - /proc/mdstat) + # drop the partition number only for sdX and hdX devices + # and keep it for other devices like loop#, dm-# devices + block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^md'$root' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat) # md root /dev/mdX elif [ "${root#/dev/md}" != "${root}" ]; then - root=${root#/dev/} - block=$(awk "/^${root}/{print substr(\$5, 1, 3); exit}" \ - /proc/mdstat) + root=${root#/dev/md} + # drop the partition number only for sdX and hdX devices + # and keep it for other devices like loop#, dm-# devices + block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^md'$root' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' </proc/mdstat) # cciss device elif [ "${root#/dev/cciss/}" != "${root}" ]; then block=${root#/dev/cciss/*} @@ -289,17 +311,36 @@ dep_add_modules() root=${root#/dev/} block=$(losetup -a \ | awk "/${root}/{print substr(\$3, 7, 3); exit}") + # Xen virtual device /dev/xvdX + elif [ "${root#/dev/xvd}" != "${root}" ]; then + block=${root#/dev/} + # Xen has a mode where only the individual partitions are + # registered with the kernel as well as the usual full disk + # with partition table scheme. + if [ ! -e /sys/block/${block} ] ; then + block=${block%%[0-9]*} + fi + # mmc root /dev/mmcblkXpX + elif [ "${root#/dev/mmcblk}" != "${root}" ]; then + block=${root#/dev/} + block=${block%%p[0-9]*} + + # DAC960 - good old mylex raid - root dev format /dev/rd/cXdXpX + elif [ "${root#/dev/rd/c}" != "${root}" ]; then + block="rd!c${root#/dev/rd/c}" + block=${block%%p[0-9]*} + # classical root device else block=${root#/dev/} - block=${block%[0-9]*} + block=${block%%[0-9]*} fi # Error out if /sys lack block dev if [ -z "${block}" ] || [ ! -e /sys/block/${block} ]; then - echo "mkinitramfs: missing ${block} root ${root} /sys entry" - echo "mkinitramfs: workaround is MODULES=most" - echo "mkinitramfs: Error please report the bug" + echo "mkinitramfs: for root ${root} missing ${block} /sys/block/ entry" >&2 + echo "mkinitramfs: workaround is MODULES=most" >&2 + echo "mkinitramfs: Error please report the bug" >&2 exit 1 fi @@ -310,6 +351,8 @@ dep_add_modules() # catch old-style IDE if [ -e /sys/bus/ide/devices/ ]; then sys_walk_modalias ${root_dev_path} + manual_add_modules ide-gd_mod + # FIXME: remove post Squeeze manual_add_modules ide-disk manual_add_modules ide-cd fi @@ -318,6 +361,14 @@ dep_add_modules() manual_add_modules sd_mod fi + if [ -e /sys/bus/mmc/devices/ ]; then + manual_add_modules mmc_block + fi + + if [ -e /sys/bus/virtio ] ; then + manual_add_modules virtio_pci + fi + if [ -e /sys/bus/i2o/devices/ ]; then force_load i2o_block force_load i2o_config @@ -340,11 +391,12 @@ dep_add_modules() # The modules "most" classes added per default to the initramfs auto_add_modules() { - case "$1" in + case "${1:-}" in base) - for x in ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 \ - ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs af_packet \ - atkbd i8042 virtio_pci; do + for x in ehci-hcd ohci-hcd uhci-hcd usbhid xhci hid-apple \ + hid-cherry hid-logitech hid-microsoft \ + btrfs ext2 ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs \ + af_packet atkbd i8042 virtio_pci; do manual_add_modules "${x}" done ;; @@ -362,6 +414,9 @@ auto_add_modules() xircom_cb xircom_tulip_cb yellowfin; do manual_add_modules "${x}" done + copy_modules_dir kernel/drivers/net \ + appletalk arcnet bonding can hamradio irda pcmcia \ + tokenring usb wan wimax wireless ;; ide) copy_modules_dir kernel/drivers/ide @@ -381,7 +436,11 @@ auto_add_modules() block) copy_modules_dir kernel/drivers/block ;; - # FIXME: can be removed after Lenny release + ubi) + for x in deflate zlib lzo ubi ubifs; do + manual_add_modules "${x}" + done + ;; ieee1394) for x in ohci1394 sbp2; do manual_add_modules "${x}" @@ -402,6 +461,9 @@ auto_add_modules() manual_add_modules "${x}" done ;; + usb_storage) + copy_modules_dir kernel/drivers/usb/storage + ;; *) auto_add_modules base auto_add_modules net @@ -414,10 +476,12 @@ auto_add_modules() auto_add_modules ieee1394 auto_add_modules firewire auto_add_modules mmc + auto_add_modules usb_storage ;; esac } +# mkinitramfs help message usage() { cat >&2 << EOF @@ -425,10 +489,11 @@ usage() 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. + -c compress Override COMPRESS setting in initramfs.conf. + -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 initramfs.conf. See mkinitramfs(8) for further details. EOF @@ -436,16 +501,31 @@ EOF } +# cache boot scripts order +cache_run_scripts() +{ + DESTDIR=${1} + scriptdir=${2} + initdir=${DESTDIR}${scriptdir} + [ ! -d ${initdir} ] && return + + runlist=$(get_prereq_pairs | tsort) + for crs_x in ${runlist}; do + [ -f ${initdir}/${crs_x} ] || continue + echo "${scriptdir}/${crs_x}" >> ${initdir}/ORDER + echo "[ -e /conf/param.conf ] && . /conf/param.conf" >> ${initdir}/ORDER + done +} + # minimal supported kernel version check_minkver() { local curversion initdir DPKG_ARCH minversion cm_x tmp - curversion="${1}" - initdir="${2}" + curversion="${1:-}" + initdir="${2:-}" if [ -z "${initdir}" ]; then - DPKG_ARCH=$(dpkg --print-architecture) - case ${DPKG_ARCH} in + case ${DPKG_ARCH:-} in ia64|hppa) minversion="2.6.15" ;; @@ -461,11 +541,11 @@ check_minkver() return 0 fi set_initlist - for cm_x in ${initlist}; do - # sed: keep last line starting with MINKVER=, - # remove MINKVER= and trailing space + for cm_x in ${initlist:-}; do + # sed: keep last line starting with MINKVER=, + # remove MINKVER= and trailing space minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}") - if [ -z "${tmp}" ]; then + if [ -z "${tmp:-}" ]; then continue elif dpkg --compare-versions "${curversion}" lt "${minver}"; then echo "W: ${cm_x} hook script requires at least kernel version ${minver}" >&2 diff --git a/hooks/busybox b/hooks/busybox new file mode 100755 index 0000000..1a275b7 --- /dev/null +++ b/hooks/busybox @@ -0,0 +1,31 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# busybox +if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then + # those root need busybox + eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')" + if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then + echo "W: Busybox is required for successful boot!" + fi +else + . /usr/share/initramfs-tools/hook-functions + rm -f ${DESTDIR}/bin/sh + rm -f ${DESTDIR}/bin/busybox + copy_exec ${BUSYBOXDIR}/busybox /bin/busybox + ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh +fi diff --git a/hooks/kernelextras b/hooks/kernelextras deleted file mode 100755 index 714e9a9..0000000 --- a/hooks/kernelextras +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Hooks for loading extra kernel bits into the initramfs - -. /usr/share/initramfs-tools/hook-functions - -fbcon=n - -for x in ${MODULESDIR}/initrd/*; do - x=${x##*/} - x=${x%.*} - case ${x} in - '*') - break - ;; - *fb) - fbcon=y - ;; - esac - - force_load ${x} -done - -# And add vga16fb for usplash to use as well -manual_add_modules vga16fb - -if [ ${fbcon} = "y" ]; then - force_load fbcon -fi diff --git a/hooks/keymap b/hooks/keymap index a2b1b08..fa97209 100755 --- a/hooks/keymap +++ b/hooks/keymap @@ -21,13 +21,20 @@ if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then fi # Step 1 - Basic tools -if [ ! -x /bin/loadkeys ] || [ ! -r /etc/console/boottime.kmap.gz ]; then +if [ ! -x /bin/loadkeys ] || +! ( [ -r /etc/console/boottime.kmap.gz ] \ + || [ -r /etc/console-setup/cached.kmap.gz ] ); then exit 0 fi . /usr/share/initramfs-tools/hook-functions copy_exec /bin/loadkeys /bin -cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/ + +if [ -e /etc/console-setup/cached.kmap.gz ]; then + cp /etc/console-setup/cached.kmap.gz ${DESTDIR}/etc/boottime.kmap.gz +else + cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/ +fi # Step 2 - Check for UTF8 console if [ ! -x /usr/bin/kbd_mode ]; then diff --git a/hooks/klibc b/hooks/klibc new file mode 100755 index 0000000..e41c631 --- /dev/null +++ b/hooks/klibc @@ -0,0 +1,24 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# klibc +ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin +ln -s /lib/klibc-*.so ${DESTDIR}/lib +rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/zcat +if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then + mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh +fi diff --git a/hooks/legacylvm b/hooks/legacylvm deleted file mode 100755 index 9121f90..0000000 --- a/hooks/legacylvm +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# FIXME: Remove this hook after Lenny releases -. /usr/share/initramfs-tools/hook-functions - -if [ -x /sbin/vgchange ] && [ -d /lib/lvm-200 ] \ - && [ ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then - copy_exec /lib/lvm-200/vgchange /sbin - for x in dm_mod dm_snapshot dm_mirror; do - manual_add_modules ${x} - done -fi -exit 0 diff --git a/hooks/thermal b/hooks/thermal index ece7243..aa10ebf 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -22,6 +22,9 @@ esac case "$DPKG_ARCH" in # copy the right modules powerpc|ppc64) + if [ -e /sys/bus/ps3_system_bus/ ]; then + exit 0 + fi manual_add_modules therm_pm72 manual_add_modules windfarm_core manual_add_modules windfarm_cpufreq_clamp diff --git a/hooks/udevhelper b/hooks/udevhelper deleted file mode 100755 index f86e4af..0000000 --- a/hooks/udevhelper +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# FIXME: kill after lenny release -# needed for UUID root and partial etch upgrades -# -PREREQ="udev" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -. /usr/share/initramfs-tools/hook-functions - -# should never happen -if [ ! -e $DESTDIR/lib/udev/ ]; then - exit 0 -fi - -# fixed udev hook -if [ -e $DESTDIR/lib/udev/ ] && [ -e $DESTDIR/lib/udev/hotplug.functions ]; then - exit 0 -fi - -cp /lib/udev/hotplug.functions $DESTDIR/lib/udev/ -for program in /lib/udev/*_id; do - copy_exec $program /lib/udev/ -done -exit 0 @@ -8,8 +8,8 @@ echo "Loading, please wait..." [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp mkdir -p /var/lock -mount -t sysfs -o nodev,noexec,nosuid none /sys -mount -t proc -o nodev,noexec,nosuid none /proc +mount -t sysfs -o nodev,noexec,nosuid none /sys +mount -t proc -o nodev,noexec,nosuid none /proc # Note that this only becomes /dev on the real filesystem if udev's scripts # are used; which they will be, but it's worth pointing out @@ -17,9 +17,14 @@ tmpfs_size="10M" if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi -mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev -[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 -[ -e /dev/null ] || mknod /dev/null c 1 3 +if ! mount -t devtmpfs -o mode=0755 none /dev; then + echo "W: devtmpfs not available, falling back to tmpfs for /dev" + mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev + [ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 + [ -e /dev/null ] || mknod /dev/null c 1 3 +fi +mkdir /dev/pts +mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts || true > /dev/.initramfs-tools mkdir /dev/.initramfs @@ -35,6 +40,10 @@ export ROOT= export ROOTDELAY= export ROOTFLAGS= export ROOTFSTYPE= +export IP= +export BOOT= +export BOOTIF= +export UBIMTD= export break= export init=/sbin/init export quiet=n @@ -43,6 +52,7 @@ export rootmnt=/root export debug= export panic= export blacklist= +export resume= export resume_offset= # Bring in the main config @@ -62,7 +72,30 @@ for x in $(cat /proc/cmdline); do ROOT=${x#root=} case $ROOT in LABEL=*) - ROOT="/dev/disk/by-label/${ROOT#LABEL=}" + ROOT="${ROOT#LABEL=}" + + # support any / in LABEL= path (escape to \x2f) + case "${ROOT}" in + */*) + if command -v sed >/dev/null 2>&1; then + ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')" + else + if [ "${ROOT}" != "${ROOT#/}" ]; then + ROOT="\x2f${ROOT#/}" + fi + if [ "${ROOT}" != "${ROOT%/}" ]; then + ROOT="${ROOT%/}\x2f" + fi + IFS='/' + newroot= + for s in $ROOT; do + newroot="${newroot:+${newroot}\\x2f}${s}" + done + unset IFS + ROOT="${newroot}" + fi + esac + ROOT="/dev/disk/by-label/${ROOT}" ;; UUID=*) ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" @@ -90,11 +123,14 @@ for x in $(cat /proc/cmdline); do NFSROOT="${x#nfsroot=}" ;; ip=*) - IPOPTS="${x#ip=}" + IP="${x#ip=}" ;; boot=*) BOOT=${x#boot=} ;; + ubi.mtd=*) + UBIMTD=${x#ubi.mtd=} + ;; resume=*) RESUME="${x#resume=}" ;; @@ -141,25 +177,33 @@ for x in $(cat /proc/cmdline); do blacklist=*) blacklist=${x#blacklist=} ;; + netconsole=*) + netconsole=${x#netconsole=} + ;; + BOOTIF=*) + BOOTIF=${x#BOOTIF=} + ;; esac done -if [ -z "${noresume}" ]; then - export resume=${RESUME} -else +if [ -n "${noresume}" ]; then export noresume + unset resume +else + resume=${RESUME:-} fi -depmod -a +[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}" + maybe_break top # Don't do log messages here to avoid confusing usplash run_scripts /scripts/init-top maybe_break modules -log_begin_msg "Loading essential drivers" +[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers" load_modules -log_end_msg +[ "$quiet" != "y" ] && log_end_msg maybe_break premount [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount" @@ -183,27 +227,56 @@ run_scripts /scripts/init-bottom mount -n -o move -t sysfs /sys ${rootmnt}/sys mount -n -o move -t proc /proc ${rootmnt}/proc +validate_init() { + checktarget="${1}" + + # Work around absolute symlinks + if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${checktarget}" ]; then + case $(readlink "${rootmnt}${checktarget}") in /*) + checktarget="$(chroot ${rootmnt} readlink ${checktarget})" + ;; + esac + fi + + # Make sure the specified init can be executed + if [ ! -x "${rootmnt}${checktarget}" ]; then + return 1 + fi + + # Upstart uses /etc/init as configuration directory :-/ + if [ -d "${rootmnt}${checktarget}" ]; then + return 1 + fi +} + # Check init bootarg -if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then - echo "Target filesystem doesn't have ${init}." - init= +if [ -n "${init}" ]; then + if ! validate_init "$init"; then + echo "Target filesystem doesn't have requested ${init}." + init= + fi fi -# Search for valid init -if [ -z "${init}" ] ; then - for init in /sbin/init /etc/init /bin/init /bin/sh; do - if [ ! -x "${rootmnt}${init}" ]; then - continue - fi - break - done -fi +# Common case: /sbin/init is present +if [ ! -x "${rootmnt}/sbin/init" ]; then + # ... if it's not available search for valid init + if [ -z "${init}" ] ; then + for inittest in /sbin/init /etc/init /bin/init /bin/sh; do + if validate_init "${inittest}"; then + init="$inittest" + break + fi + done + fi -# No init on rootmount -if [ ! -x "${rootmnt}${init}" ]; then - panic "No init found. Try passing init= bootarg." + # No init on rootmount + if ! validate_init "${init}" ; then + panic "No init found. Try passing init= bootarg." + fi fi +maybe_break init + # don't leak too much of env - some init(8) don't clear it # (keep init, rootmnt) unset debug @@ -213,6 +286,10 @@ unset ROOTFLAGS unset ROOTFSTYPE unset ROOTDELAY unset ROOT +unset IP +unset BOOT +unset BOOTIF +unset UBIMTD unset blacklist unset break unset noresume @@ -223,6 +300,5 @@ unset resume unset resume_offset # Chain to real filesystem -maybe_break init exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console panic "Could not execute run-init." diff --git a/initramfs-tools.8 b/initramfs-tools.8 index ea0952b..fc2c085 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "2008/12/18" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "2010/06/22" "Linux" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -9,52 +9,39 @@ will be used during different phases of execution. Each of these will be discussed separately below with the help of an imaginary tool which performs a frobnication of a lvm partition prior to mounting the root partition. -Valid boot and hook scripts names consist solely of alphabetics, numerics -and underscores. Other scripts are discarded. +.SH Kernel Command Line +The root filesystem used by the kernel is specified by the boot loader as +always. The traditional \fBroot=/dev/sda1\fR style device specification is +allowed. If a label is used, as in \fBroot=LABEL=rootPart\fR the initrd will +search all available devices for a filesystem with the appropriate label, and +mount that device as the root filesystem. \fBroot=UUID=uuidnumber\fR will +mount the partition with that UUID as the root filesystem. -.SS Hook scripts -These are used when an initramfs image is created and not included in the -image itself. They can however cause files to be included in the image. - -.SS Boot scripts -These are included in the initramfs image and normally executed during -kernel boot in the early user-space before the root partition has been -mounted. - -.SH INIT SCRIPT -The script which is executed first and is in charge of running all other -scripts can be found in /usr/share/initramfs-tools/init. It takes a number of -arguments which influence the boot procedure: - -.SS Boot options - -The init and root are usually passed by the boot loader for local boot. -The other parameters are optional. +.SS Standard .TP -\fB\fI init +\fB\fI init= "<path to real init>" the binary to hand over execution to on the root fs after the initramfs scripts are done. .TP -\fB\fI root +\fB\fI root= "<path to blockdevice>" the device node to mount as the root file system. The recommended usage is to specify the UUID as followed "root=UUID=xxx". -As normal device names are not stable and may change depending on the -boot order. + +.TP +\fB\fI rootfstype +set the root file system type. .TP \fB\fI rootdelay set delay in seconds. Determines how long mountroot waits for root to appear. +The default is 180 seconds. .TP \fB\fI rootflags set the file system mount option string. .TP -\fB\fI rootfstype -set the root file system type. - -.TP \fB\fI nfsroot can be either "auto" to try to get the relevant information from DHCP or a string of the form NFSSERVER:NFSPATH or NFSSERVER:NFSPATH:NFSOPTS. @@ -64,12 +51,14 @@ Use root=/dev/nfs for NFS to kick to in. NFSOPTS can be looked up in .TP \fB\fI ip tells how to configure the ip address. Allows to specify an different -NFS server than the DHCP server. See Documentation/nfsroot.txt in -any recent Linux source for details. Optional paramater for NFS root. +NFS server than the DHCP server. See Documentation/filesystems/nfsroot.txt +in any recent Linux source for details. Optional parameter for NFS root. .TP -\fB\fI cryptopts -passes the args for cryptoroot. Set by the cryptsetup boot hooks. +\fB\fI BOOTIF +is a mac address in pxelinux format with leading "01-" and "-" as separations. +pxelinux passes mac address of network card used to PXE boot on with this +bootarg. .TP \fB\fI boot @@ -103,6 +92,7 @@ mounts the rootfs read-write. disables load of specific modules. Use blacklist=module1,module2,module3 bootparameter. +.SS Debug .TP \fB\fI panic sets an timeout on panic. @@ -110,7 +100,7 @@ panic=<sec> is a documented security feature: it disables the debug shell. .TP \fB\fI debug -generates lots of output. It writes a log to /tmp/initramfs.debug. +generates lots of output. It writes a log to /dev/.initramfs/initramfs.debug. Instead when invoked with an arbitrary argument output is written to console. Use for example "debug=vc". @@ -123,12 +113,31 @@ Beware that if both "panic" and "break" are present, initramfs will not spawn any shells but reboot instead. .TP +\fB\fI netconsole +loads netconsole linux modules with the chosen args. + +.TP \fB\fI all_generic_ide loads generic IDE/ATA chipset support on boot. .SH HOOK SCRIPTS +Valid boot and hook scripts names consist solely of alphabetics, numerics, +dashes and underscores. Other scripts are discarded. + +.SS Hook scripts +These are used when an initramfs image is created and not included in the +image itself. They can however cause files to be included in the image. +Hook scripts are executed under errexit. Thus a hook script can abort the +mkinitramfs build on possible errors (exitcode != 0). + +.SS Boot scripts +These are included in the initramfs image and normally executed during +kernel boot in the early user-space before the root partition has been +mounted. + + Hooks can be found in two places: /usr/share/initramfs-tools/hooks and /etc/initramfs-tools/hooks. They are executed during generation of the initramfs-image and are responsible for including all the necessary components @@ -225,6 +234,36 @@ and copy them to the initramfs. This means that most executables, unless compiled with klibc, will automatically include glibc in the image which will increase its size by several hundred kilobytes. +.SS Exported variables +mkinitramfs sets several variables for the hook scripts environment. + +.TP +\fB\fI MODULESDIR +corresponds to the linux-2.6 modules dir. +.TP +\fB\fI version +is the $(uname \-r) linux-2.6 version against mkinitramfs is run. +.TP +\fB\fI CONFDIR +is the path of the used initramfs-tools configurations. +.TP +\fB\fI DESTDIR +is the root path of the newly build initramfs. +.TP +\fB\fI DPKG_ARCH +allows arch specific hook additions. +.TP +\fB\fI verbose +corresponds to the verbosity of the update-initramfs run. +.TP +\fB\fI KEYMAP +sets if a keymap needs to be added to initramfs. +.TP +\fB\fI MODULES +specifies which kind of modules should land on initramfs. +This setting shouldn't be overridden by hook script, but can guide them +on how much they need to include on initramfs. + .SH BOOT SCRIPTS @@ -260,7 +299,9 @@ esac Where PREREQ is modified to list other scripts in the same subdirectory if necessary. .SS Help functions -A number of functions (mostly dealing with output) are provided to boot scripts: +A number of functions (mostly dealing with output) are provided to boot scripts in +.I /scripts/functions +: .TP \fB\fI @@ -434,6 +475,7 @@ prereqs) ;; esac +\fR. /scripts/functions # Begin real processing below this line if [ ! \-x "/sbin/frobnicate" ]; then panic "Frobnication executable not found" @@ -451,6 +493,45 @@ exit 0 .fi .RE +.SS Exported variables +init sets several variables for the boot scripts environment. + +.TP +\fB\fI ROOT +corresponds to the root boot option. +Advanced boot scripts like cryptsetup or live-initramfs need to play tricks. +Otherwise keep it alone. +.TP +\fB\fI ROOTDELAY, ROOTFLAGS, ROOTFSTYPE, IP +corresponds to the rootdelay, rootflags, rootfstype or ip boot option. +.TP +\fB\fI DPKG_ARCH +allows arch specific boot actions. +.TP +\fB\fI blacklist, panic, quiet, resume, noresume, resume_offset +set according relevant boot option. +.TP +\fB\fI break +Useful for manual intervention during setup and coding an boot script. +.TP +\fB\fI REASON +Argument passed to the \fIpanic\fP helper function. Use to find out why +you landed in the initramfs shell. +.TP +\fB\fI init +passes the path to init(8) usually /sbin/init. +.TP +\fB\fI readonly +is the default for mounting the root corresponds to the ro bootarg. +Overridden by rw bootarg. +.TP +\fB\fI rootmnt +is the path where root gets mounted usually /root. +.TP +\fB\fI debug +indicates that a debug log is captured for further investigation. + + .SH DEBUG It is easy to check the generated initramfs for its content. One may need to double-check if it contains the relevant binaries, libs or modules: diff --git a/initramfs.conf.5 b/initramfs.conf.5 index ac3b959..92c3a6d 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "2007/01/01" "" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "2010/04/05" "Linux" "initramfs.conf manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs @@ -24,7 +24,7 @@ directly. Specifies the modules for the initramfs image. The default setting is \fImost\fP. -\fImost\fP adds all the framebuffer, acpi, file system, ide, sata, scsi and usb drivers. +\fImost\fP adds most file system, all ide, sata, scsi and usb drivers. \fIdep\fP tries to guess which modules are necessary for the running box. @@ -48,6 +48,18 @@ 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. +Useful to not disclose eventual keys. + .SH NFS VARIABLES .TP \fB BOOT @@ -69,6 +81,9 @@ A root bootarg overrides that special setting. Defaults to \fIauto\fP in order to pick up value from DHCP server. Otherwise you need to specify \fIHOST:MOUNT\fP. +.SH FILES +.TP +.I /etc/initramfs-tools/initramfs.conf .SH AUTHOR The initramfs-tools are written by Maximilian Attems <maks@debian.org>, diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools new file mode 100755 index 0000000..d4db23d --- /dev/null +++ b/kernel/postinst.d/initramfs-tools @@ -0,0 +1,31 @@ +#!/bin/sh + +version="$1" +bootopt="" + +# passing the kernel version is required +[ -z "${version}" ] && exit 0 + +# kernel-package passes an extra arg +if [ -n "$2" ]; then + if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then + # exit if custom kernel does not need an initramfs + [ "$INITRD" = 'No' ] && exit 0 + bootdir=$(dirname "$2") + bootopt="-b ${bootdir}" + else + # official Debian linux-images take care themself + exit 0 + fi +fi + +# avoid running multiple times +if [ -n "$DEB_MAINT_PARAMS" ]; then + eval set -- "$DEB_MAINT_PARAMS" + if [ -z "$1" ] || [ "$1" != "configure" ]; then + exit 0 + fi +fi + +# we're good - create initramfs. update runs do_bootloader +update-initramfs -c -t -k "${version}" ${bootopt} >&2 diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools new file mode 100755 index 0000000..4e8f73b --- /dev/null +++ b/kernel/postrm.d/initramfs-tools @@ -0,0 +1,29 @@ +#!/bin/sh + +version="$1" +bootopt="" + +# passing the kernel version is required +[ -z "${version}" ] && exit 0 + +# kernel-package passes an extra arg +if [ -n "$2" ]; then + if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then + bootdir=$(dirname "$2") + bootopt="-b ${bootdir}" + else + # official linux-images take care themself + exit 0 + fi +fi + +# avoid running multiple times +if [ -n "$DEB_MAINT_PARAMS" ]; then + eval set -- "$DEB_MAINT_PARAMS" + if [ -z "$1" ] || [ "$1" != "remove" ]; then + exit 0 + fi +fi + +# delete initramfs +update-initramfs -d -t -k "${version}" ${bootopt} >&2 diff --git a/lsinitramfs b/lsinitramfs new file mode 100755 index 0000000..91c65e1 --- /dev/null +++ b/lsinitramfs @@ -0,0 +1,51 @@ +#!/bin/sh + +set -eu + +usage() +{ + echo "Usage: $(basename $0) <initramfs file>" +} + +if [ "$#" -eq 0 ] ; then + usage >&2 + exit 1 +fi + +cpio_args="--extract --quiet --list" + +OPTIONS=`getopt -o hl --long help,long -n "$0" -- "$@"` +# Check for non-GNU getopt +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi + +eval set -- "$OPTIONS" + +while true; do + case "$1" in + -h|--help) + usage + exit 0 + ;; + -l|--long) + cpio_args="${cpio_args:+${cpio_args} --verbose}" + shift + ;; + --) + shift + break + ;; + *) + echo "Internal error!" >&2 + exit 1 + esac +done + +for initramfs in "$@" ; do + if ! [ -r "${initramfs}" ] ; then + echo "Specified file could not be read." >&2 + exit 1 + else + echo "${initramfs}" + zcat "${initramfs}" | cpio ${cpio_args} + fi +done diff --git a/lsinitramfs.8 b/lsinitramfs.8 new file mode 100644 index 0000000..d802c76 --- /dev/null +++ b/lsinitramfs.8 @@ -0,0 +1,47 @@ +.TH LSINITRAMFS 8 "2010/06/16" "Linux" "lsinitramfs manual" + +.SH NAME +lsinitramfs \- list content of an initramfs image + +.SH SYNOPSIS +.B lsinitramfs +.RI [ options ] " <initramfsfile> " [ <initramfsfile> ] +.br + +.SH DESCRIPTION +The +.B lsinitramfs +command lists the content of given initramfs images. It allows to quickly check +the content of one (or multiple) specified initramfs files. + +.SH OPTIONS + +.TP +.B -h +Display usage information and exit. + +.TP +.B -l +Display long and more verbose listing of initramfs content. + +.SH USAGE EXAMPLES + +List initramfs content of current running kernel: + +.PP +.B lsinitramfs /boot/initrd.img-$(uname -r) + +List content of two initramfs files in verbose mode: + +.PP +.B lsinitramfs -l /boot/vmlinuz-2.6.31-grml64 /boot/vmlinuz-2.6.33-grml64 + +.SH AUTHOR +The initramfs-tools are written by Maximilian Attems <maks@debian.org> +and numerous others. + +.SH SEE ALSO +.BR +.IR initramfs-tools (8), +.IR mkinitramfs (8), +.IR update-initramfs (8). diff --git a/mkinitramfs b/mkinitramfs index 3c59757..0bb7806 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -7,19 +7,23 @@ export PATH='/usr/bin:/sbin:/bin' keep="n" CONFDIR="/etc/initramfs-tools" verbose="n" -errors_to="2>/dev/null" -# BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" -BUSYBOXDIR="/bin" +test -e /bin/busybox && BUSYBOXDIR=/bin +test -e /usr/lib/initramfs-tools/bin/busybox && BUSYBOXDIR=/usr/lib/initramfs-tools/bin +export BUSYBOXDIR -OPTIONS=`getopt -o d:ko:r:v --long supported-host-version:,supported-target-version: -n "$0" -- "$@"` +OPTIONS=`getopt -o c:d:ko:r:v -n "$0" -- "$@"` # Check for non-GNU getopt -if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi +if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi eval set -- "$OPTIONS" while true; do case "$1" in + -c) + compress="$2" + shift 2 + ;; -d) CONFDIR="$2" shift 2 @@ -44,14 +48,6 @@ while true; do verbose="y" shift ;; - --supported-host-version) - supported_host_version="$2" - shift 2 - ;; - --supported-target-version) - supported_target_version="$2" - shift 2 - ;; --) shift break @@ -63,21 +59,6 @@ while true; do esac done -# FIXME: remove after Lenny (needed for Etch linux-images) -if [ -n "$supported_host_version" ] || [ -n "$supported_target_version" ]; then - if [ -n "$supported_host_version" ]; then - host_upstream_version="${supported_host_version%%-*}" - fi - if [ -n "$supported_target_version" ]; then - target_upstream_version="${supported_target_version%%-*}" - if dpkg --compare-versions "$target_upstream_version" lt "2.6.12"; then - exit 2 - fi - fi - echo "Depreciation warning: use ramdisk=mkinitramfs-kpkg." - exit 0 -fi - # For dependency ordered mkinitramfs hook scripts. . /usr/share/initramfs-tools/scripts/functions . /usr/share/initramfs-tools/hook-functions @@ -85,11 +66,11 @@ fi . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' for i in /usr/share/initramfs-tools/conf.d/* ${CONFDIR}/conf.d/*; do - EXTRA_CONF="${EXTRA_CONF} $(basename $i \ + [ -e $i ] && EXTRA_CONF="${EXTRA_CONF} $(basename $i \ | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; done # FIXME: deprecated those settings on mkinitramfs run -# these conf dirs are for boot scripts and land on initramfs +# these conf dirs are for boot scripts and land on initramfs for i in ${EXTRA_CONF}; do if [ -e ${CONFDIR}/conf.d/${i} ]; then . ${CONFDIR}/conf.d/${i} @@ -105,7 +86,7 @@ for i in /usr/share/initramfs-tools/conf-hooks.d/*; do fi done -if [ -n "${UMASK}" ]; then +if [ -n "${UMASK:-}" ]; then umask "${UMASK}" fi @@ -146,23 +127,54 @@ case "${version}" in ;; esac +# Check userspace and kernel support for compressed initramfs images +if [ -z "${compress:-}" ]; then + compress=${COMPRESS} +else + COMPRESS=${compress} +fi + +if ! command -v "${compress}" >/dev/null 2>&1; then + compress=gzip + COMPRESS=gzip + [ "${verbose}" = y ] && \ + echo "No ${COMPRESS} in ${PATH}, using gzip" +fi + +if ! `grep -q -i ^config_rd_${COMPRESS%p} /boot/config-${version}` ; then + compress=gzip + [ "${verbose}" = y ] && \ + echo "linux-2.6 misses ${COMPRESS} support, using gzip" +fi + +[ "${compress}" = lzop ] && compress="lzop -9" + if [ -d "${outfile}" ]; then - echo "${outfile} is a directory" + echo "${outfile} is a directory" >&2 exit 1 fi MODULESDIR="/lib/modules/${version}" if [ ! -e "${MODULESDIR}" ]; then - echo "Cannot find ${MODULESDIR}" - exit 1 + echo "WARNING: missing ${MODULESDIR}" + echo "Device driver support needs thus be built-in linux image!" fi if [ ! -e "${MODULESDIR}/modules.dep" ]; then depmod ${version} fi -DESTDIR="$(mktemp -t -d mkinitramfs_XXXXXX)" || exit 1 -__TMPCPIOGZ="$(mktemp -t mkinitramfs-OL_XXXXXX)" || exit 1 +DESTDIR="$(mktemp -d ${TMPDIR:-/tmp}/mkinitramfs_XXXXXX)" || exit 1 +chmod 755 "${DESTDIR}" + +# do not execute cache_run_scripts() if mounted with noexec +NOEXEC="" +fs=$(df $DESTDIR | tail -1 | awk '{print $6}') +if [ -n "$fs" ] && mount | grep -q "on $fs .*noexec" ; then + NOEXEC=1 +fi + +__TMPCPIOGZ="$(mktemp ${TMPDIR:-/tmp}/mkinitramfs-OL_XXXXXX)" || exit 1 DPKG_ARCH=`dpkg --print-architecture` @@ -176,6 +188,7 @@ export DPKG_ARCH export verbose export KEYMAP export MODULES +export BUSYBOX # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ @@ -184,6 +197,12 @@ for d in bin conf/conf.d etc lib/modules sbin scripts ${MODULESDIR}; do mkdir -p "${DESTDIR}/${d}" done +# Copy the modules.order file in +if [ -f "${MODULESDIR}/modules.order" ]; then + cp -p "${MODULESDIR}/modules.order" \ + "${DESTDIR}${MODULESDIR}/modules.order" +fi + # MODULES=list case. Always honour. for x in "${CONFDIR}/modules" /usr/share/initramfs-tools/modules.d/*; do if [ -f "${x}" ]; then @@ -207,8 +226,8 @@ list) # nothing to add ;; *) - echo "mkinitramfs: Warning unsupported MODULES setting: ${MODULES}." - echo "mkinitramfs: Falling back to MODULES=most." + echo "W: mkinitramfs: unsupported MODULES setting: ${MODULES}." + echo "W: mkinitramfs: Falling back to MODULES=most." auto_add_modules ;; esac @@ -216,30 +235,25 @@ esac # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. -# klibc -ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin -ln -s /lib/klibc-*.so ${DESTDIR}/lib -rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip - -copy_exec /usr/share/initramfs-tools/init /init +cp -p /usr/share/initramfs-tools/init ${DESTDIR}/init # add existant boot scripts for b in $(cd /usr/share/initramfs-tools/scripts/ && find . \ - -regextype posix-extended -regex '.*/[[:alnum:]_]+$' -type f); do + -regextype posix-extended -regex '.*/[[:alnum:]\._-]+$' -type f); do [ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \ || mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")" cp -p "/usr/share/initramfs-tools/scripts/${b}" \ "${DESTDIR}/scripts/$(dirname "${b}")/" done for b in $(cd "${CONFDIR}/scripts" && find . \ - -regextype posix-extended -regex '.*/[[:alnum:]_]+$' -type f); do + -regextype posix-extended -regex '.*/[[:alnum:]\._-]+$' -type f); do [ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \ || mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")" cp -p "${CONFDIR}/scripts/${b}" "${DESTDIR}/scripts/$(dirname "${b}")/" done echo "DPKG_ARCH=${DPKG_ARCH}" > ${DESTDIR}/conf/arch.conf -copy_exec "${CONFDIR}/initramfs.conf" /conf +cp -p "${CONFDIR}/initramfs.conf" ${DESTDIR}/conf for i in ${EXTRA_CONF}; do if [ -e "${CONFDIR}/conf.d/${i}" ]; then copy_exec "${CONFDIR}/conf.d/${i}" /conf/conf.d @@ -249,28 +263,17 @@ for i in ${EXTRA_CONF}; do done # ROOT hardcoding -if [ -n "${ROOT}" ]; then +if [ -n "${ROOT:-}" ]; then echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root fi -# Busybox -if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then - mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh - # those root need busybox - eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')" - if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then - echo "Warning: Busybox is required for successful boot!" - fi -else - rm -f ${DESTDIR}/bin/sh - rm -f ${DESTDIR}/bin/busybox - copy_exec ${BUSYBOXDIR}/busybox /bin/busybox - ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh +if ! command -v ldd >/dev/null 2>&1 ; then + echo "WARNING: no ldd around - install libc-bin" >&2 + exit 1 fi -# Modutils +# module-init-tools copy_exec /sbin/modprobe /sbin -copy_exec /sbin/depmod /sbin copy_exec /sbin/rmmod /sbin mkdir -p "${DESTDIR}/etc/modprobe.d" cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d/" @@ -283,13 +286,58 @@ fi run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks +# cache boot run order +if [ -n "$NOEXEC" ]; then + echo "W: TMPDIR is mounted noexec, will not cache run scripts." +else + for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do + cache_run_scripts "${DESTDIR}" "/scripts/${b#./}" + done +fi + +# generate module deps +depmod -a -b "${DESTDIR}" ${version} +rm -f "${DESTDIR}/lib/modules/${version}"/modules.*map + # Apply DSDT to initramfs if [ -e "${CONFDIR}/DSDT.aml" ]; then copy_exec "${CONFDIR}/DSDT.aml" / fi +# Remove any looping or broken symbolic links, since they break cpio. +[ "${verbose}" = y ] && xargs_verbose="-t" +(cd "${DESTDIR}" && find . -type l -printf '%p %Y\n' | sed -n 's/ [LN]$//p' \ + | xargs ${xargs_verbose:-} -rL1 rm -f) + [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" -(cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}") || exit 1 +( +# work around lack of "set -o pipefail" for the following pipe: +# cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" || exit 1 +exec 3>&1 +eval ` + # http://cfaj.freeshell.org/shell/cus-faq-2.html + exec 4>&1 >&3 3>&- + cd "${DESTDIR}" + { + find . 4>&-; echo "ec1=$?;" >&4 + } | { + cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4 + } | ${compress} >"${outfile}" + echo "ec3=$?;" >&4 +` +if [ "$ec1" -ne 0 ]; then + echo "E: mkinitramfs failure find $ec1 cpio $ec2 $compress $ec3" + exit "$ec1" +fi +if [ "$ec2" -ne 0 ]; then + echo "E: mkinitramfs failure cpio $ec2 $compress $ec3" + exit "$ec2" +fi +if [ "$ec3" -ne 0 ]; then + echo "E: mkinitramfs failure $compress $ec3" + exit "$ec3" +fi +) || exit 1 if [ -s "${__TMPCPIOGZ}" ]; then cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 diff --git a/mkinitramfs-kpkg b/mkinitramfs-kpkg index ea0e783..6beaad5 100755 --- a/mkinitramfs-kpkg +++ b/mkinitramfs-kpkg @@ -95,6 +95,8 @@ case "${version}" in ;; esac +echo "Deprecation WARNING: use update-initramfs(8)" >&2 + # linux-image installs latest version mkinitramfs -o ${outfile} ${version} sha1sum "${outfile}" | sed -e 's/\.new//' > "${STATEDIR}/${version}" diff --git a/mkinitramfs-kpkg.8 b/mkinitramfs-kpkg.8 index 482a49b..0e8783e 100644 --- a/mkinitramfs-kpkg.8 +++ b/mkinitramfs-kpkg.8 @@ -1,4 +1,4 @@ -.TH MKINITRAMFS-KPKG 8 "2006/02/17" "" "mkinitramfs-kpkg manual" +.TH MKINITRAMFS-KPKG 8 "2008/12/19" "Linux" "mkinitramfs-kpkg manual" .SH NAME mkinitramfs-kpkg \- generates an initramfs image for kernel-package diff --git a/mkinitramfs.8 b/mkinitramfs.8 index abb3f39..49db6c8 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -1,10 +1,12 @@ -.TH MKINITRAMFS 8 "2008/08/12" "" "mkinitramfs manual" +.TH MKINITRAMFS 8 "2010/04/07" "Linux" "mkinitramfs manual" .SH NAME mkinitramfs \- low-level tool for generating an initramfs image .SH SYNOPSIS .B mkinitramfs +.RB [ \-c +.IR compress ] .RB [ \-d .IR confdir ] .RB [ \-k ] @@ -27,7 +29,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 @@ -45,6 +47,13 @@ happens in this early userspace. .SH OPTIONS .TP +\fB \-c \fI compress +Override the +.B COMPRESS +setting in +.IR initramfs.conf . + +.TP \fB \-d \fI confdir Set an alternate configuration directory. @@ -83,6 +92,19 @@ This option queries if mkinitramfs can create ramdisks on a running kernel of ve This option queries if mkinitramfs can create ramdisks for kernel version .IR tversion . +.SH ENVIRONMENT +.B mkinitramfs +honours the +.B TMPDIR +environment variable. If set, it uses subdirectories in the given +directory to create its temporary working directories. Else it uses +.I /tmp +as default value for that purpose. The given directory should be on a +filesystem which allows the execution of files stored there, i.e. +should not be mounted with the +.B noexec +mount option. + .SH FILES .TP .I /etc/initramfs-tools/initramfs.conf diff --git a/scripts/functions b/scripts/functions index f715e68..419203a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -42,6 +42,11 @@ panic() if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "QUIT" fi + + if command -v chvt >/dev/null 2>&1; then + chvt 1 + fi + # Disallow console access if [ -n "${panic}" ]; then sleep ${panic} @@ -49,8 +54,8 @@ panic() fi modprobe i8042 modprobe atkbd - echo $@ - PS1='(initramfs) ' /bin/sh -i </dev/console >/dev/console 2>&1 + echo "$@" + REASON="$@" PS1='(initramfs) ' /bin/sh -i </dev/console >/dev/console 2>&1 } maybe_break() @@ -74,7 +79,7 @@ set_initlist() # only allow variable name chars case ${si_x#${initdir}/} in - *[![:alnum:]_]*) + *[![:alnum:]\._-]*) [ "${verbose}" = "y" ] \ && echo "$si_x ignored: not alphanumeric or '_' file" continue @@ -95,7 +100,14 @@ set_initlist() continue fi - initlist="${initlist} ${si_x#${initdir}/}" + # skip bad syntax + if ! sh -n ${si_x} ; then + [ "${verbose}" = "y" ] \ + && echo "$si_x ignored: bad syntax" + continue + fi + + initlist="${initlist:-} ${si_x#${initdir}/}" done } @@ -106,18 +118,17 @@ reduce_satisfied() for rs_y in ${deplist}; do # only allow variable name chars case ${rs_y} in - *[![:alnum:]_]*) + *[![:alnum:]\._-]*) continue ;; esac # skip non executable scripts - if [ ! -x ${initdir}/${rs_y} ]; then - continue - fi + [ ! -x ${initdir}/${rs_y} ] && continue # skip directories - if [ -d ${initdir}/${rs_y} ]; then - continue - fi + [ -d ${initdir}/${rs_y} ] && continue + # skip bad syntax + sh -n ${initdir}/${rs_y} || continue + tmpdeplist="${tmpdeplist} ${rs_y}" done deplist=${tmpdeplist} @@ -186,28 +197,57 @@ reduce_prereqs() done } +get_prereq_pairs() +{ + set_initlist + for gp_x in ${initlist:-}; do + echo ${gp_x} ${gp_x} + prereqs=$(${initdir}/${gp_x} prereqs) + for prereq in ${prereqs}; do + echo ${prereq} ${gp_x} + done + done +} + call_scripts() { + set -e for cs_x in ${runlist}; do + [ -f ${initdir}/${cs_x} ] || continue # mkinitramfs verbose output if [ "${verbose}" = "y" ]; then echo "Calling hook ${cs_x}" fi - ${initdir}/${cs_x} - # allow boot scripts to modify exported boot paramaters + ${initdir}/${cs_x} && ec=$? || ec=$? + # allow hooks to abort build: + if [ "$ec" -ne 0 ]; then + echo "E: ${initdir}/${cs_x} failed with return $ec." + # only errexit on mkinitramfs + [ -n "${version}" ] && exit $ec + fi + # allow boot scripts to modify exported boot parameters if [ -e /conf/param.conf ]; then . /conf/param.conf fi done + set +e } run_scripts() { initdir=${1} [ ! -d ${initdir} ] && return - get_prereqs - reduce_prereqs - call_scripts + + if [ -f ${initdir}/ORDER ]; then + . ${initdir}/ORDER + elif command -v tsort >/dev/null 2>&1; then + runlist=$(get_prereq_pairs | tsort) + call_scripts ${2:-} + else + get_prereqs + reduce_prereqs + call_scripts + fi } # Load custom modules first @@ -256,47 +296,122 @@ parse_numeric() { ROOT=/dev/root } +# Parameter: device node to check +# Echos fstype to stdout +# Return value: indicates if an fs could be recognized +get_fstype () +{ + local FS FSTYPE FSSIZE RET + FS="${1}" + + # blkid has a more complete list of file systems, + # but fstype is more robust + eval $(fstype "${FS}" 2> /dev/null) + if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then + FSTYPE=$(blkid -o value -s TYPE "${FS}") + elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) + fi + RET=$? + + if [ -z "${FSTYPE}" ]; then + FSTYPE="unknown" + fi + + echo "${FSTYPE}" + return ${RET} +} + configure_networking() { + if [ -n "${BOOTIF}" ]; then + # pxelinux sets BOOTIF to a value based on the mac address of the + # network card used to PXE boot, so use this value for DEVICE rather + # than a hard-coded device name from initramfs.conf. this facilitates + # network booting when machines may have multiple network cards. + # pxelinux sets BOOTIF to 01-$mac_address + + # strip off the leading "01-", which isn't part of the mac + # address + temp_mac=${BOOTIF#*-} + + # convert to typical mac address format by replacing "-" with ":" + bootif_mac="" + IFS='-' + for x in $temp_mac ; do + if [ -z "$bootif_mac" ]; then + bootif_mac="$x" + else + bootif_mac="$bootif_mac:$x" + fi + done + unset IFS + + # look for devices with matching mac address, and set DEVICE to + # appropriate value if match is found. + for device in /sys/class/net/* ; do + if [ -f "$device/address" ]; then + current_mac=$(cat "$device/address") + if [ "$bootif_mac" = "$current_mac" ]; then + DEVICE=${device##*/} + break + fi + fi + done + fi + # networking already configured thus bail out [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0 # support ip options see linux sources # Documentation/filesystems/nfsroot.txt - case ${IPOPTS} in - none|off) - # Do nothing - ;; - ""|on|any) - # Bring up device - ipconfig -t 180 ${DEVICE} - ;; - dhcp|bootp|rarp|both) - ipconfig -t 180 -c ${IPOPTS} -d ${DEVICE} - ;; - *) - ipconfig -t 180 -d $IPOPTS - - # grab device entry from ip option - NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} - if [ "${NEW_DEVICE}" != "${IPOPTS}" ]; then - NEW_DEVICE=${NEW_DEVICE%:*} - else - # wrong parse, possibly only a partial string - NEW_DEVICE= - fi - if [ -n "${NEW_DEVICE}" ]; then - DEVICE="${NEW_DEVICE}" - fi - ;; - esac + # Documentation/frv/booting.txt + + for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do + + # The NIC is to be configured if this file does not exist. + # Ip-Config tries to create this file and when it succeds + # creating the file, ipconfig is not run again. + for x in /tmp/net-"${DEVICE}".conf /tmp/net-*.conf ; do + [ -e "$x" ] && break 2 + done + + case ${IP} in + none|off) + # Do nothing + ;; + ""|on|any) + # Bring up device + ipconfig -t ${ROUNDTTT} "${DEVICE}" + ;; + dhcp|bootp|rarp|both) + ipconfig -t ${ROUNDTTT} -c ${IP} -d "${DEVICE}" + ;; + *) + ipconfig -t ${ROUNDTTT} -d $IP + + # grab device entry from ip option + NEW_DEVICE=${IP#*:*:*:*:*:*} + if [ "${NEW_DEVICE}" != "${IP}" ]; then + NEW_DEVICE=${NEW_DEVICE%:*} + else + # wrong parse, possibly only a partial string + NEW_DEVICE= + fi + if [ -n "${NEW_DEVICE}" ]; then + DEVICE="${NEW_DEVICE}" + fi + ;; + esac + done # source ipconfig output if [ -n "${DEVICE}" ]; then # source specific bootdevice . /tmp/net-${DEVICE}.conf else - # source any interface as not exaclty specified + # source any interface... + # ipconfig should have quit after first response . /tmp/net-*.conf fi } @@ -304,6 +419,6 @@ configure_networking() # Wait for queued kernel/udev events wait_for_udev() { - [ -x "$(command -v udevadm)" ] || return 0 + command -v udevadm >/dev/null 2>&1 || return 0 udevadm settle ${1:+--timeout=$1} } diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal deleted file mode 100755 index aa146ec..0000000 --- a/scripts/init-premount/thermal +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -case "$DPKG_ARCH" in -# load the right modules -powerpc|ppc64) - modprobe i2c-powermac - modprobe therm_pm72 - modprobe windfarm_cpufreq_clamp - modprobe windfarm_lm75_sensor - modprobe windfarm_max6690_sensor - modprobe windfarm_pm112 - modprobe windfarm_pm81 - modprobe windfarm_pm91 - modprobe windfarm_smu_controls - modprobe windfarm_smu_sat - modprobe windfarm_smu_sensors - ;; -i386|amd64|ia64) - modprobe fan - modprobe thermal - ;; -esac diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide index 3274ee8..e9539d8 100755 --- a/scripts/init-top/all_generic_ide +++ b/scripts/init-top/all_generic_ide @@ -16,11 +16,11 @@ esac for x in $(cat /proc/cmdline); do case ${x} in all_generic_ide) - modprobe ide-generic + modprobe ata_generic all_generic_ide=1 ;; all_generic_ide=*) if [ ${x#all_generic_ide=} ]; then - modprobe ide-generic + modprobe ata_generic all_generic_ide=1 fi ;; esac diff --git a/scripts/init-premount/blacklist b/scripts/init-top/blacklist index 1dd9dbc..2164906 100755 --- a/scripts/init-premount/blacklist +++ b/scripts/init-top/blacklist @@ -21,5 +21,5 @@ esac # write blacklist to modprobe.d IFS=',' for b in ${blacklist}; do - echo "blacklist $b" >> /etc/modprobe.d/initramfs + echo "blacklist $b" >> /etc/modprobe.d/initramfs.conf done diff --git a/scripts/local b/scripts/local index 85d62af..8cb279a 100644 --- a/scripts/local +++ b/scripts/local @@ -1,31 +1,6 @@ # Local filesystem mounting -*- shell-script -*- -# Parameter: device node to check -# Echos fstype to stdout -# Return value: indicates if an fs could be recognized -get_fstype () -{ - local FS FSTYPE FSSIZE RET - FS="${1}" - - # vol_id has a more complete list of file systems, - # but fstype is more robust - eval $(fstype "${FS}" 2> /dev/null) - if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) - fi - RET=$? - - if [ -z "${FSTYPE}" ]; then - FSTYPE="unknown" - fi - - echo "${FSTYPE}" - return ${RET} -} - -# Parameter: Where to mount the filesystem -mountroot () +pre_mountroot() { [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top @@ -33,17 +8,27 @@ mountroot () wait_for_udev 10 + # Load ubi with the correct MTD partition and return since fstype + # doesn't work with a char device like ubi. + if [ -n "$UBIMTD" ]; then + modprobe ubi mtd=$UBIMTD + return + fi + + # Don't wait for a root device that doesn't have a corresponding + # device in /dev (ie, mtd0) + if [ "${ROOT#/dev}" = "${ROOT}" ]; then + return + fi + # If the root device hasn't shown up yet, give it a little while # to deal with removable devices if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then log_begin_msg "Waiting for root file system" - # Default delay is 180s - if [ -z "${ROOTDELAY}" ]; then - slumber=180 - else - slumber=${ROOTDELAY} - fi + # Default delay is 30s + slumber=${ROOTDELAY:-30} + if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "TIMEOUT ${slumber}" || true fi @@ -69,7 +54,7 @@ mountroot () # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do # give hint about renamed root - case "${ROOT}" in + case "${ROOT}" in /dev/hd*) suffix="${ROOT#/dev/hd}" major="${suffix%[[:digit:]]}" @@ -94,6 +79,11 @@ mountroot () echo " - Missing modules (cat /proc/modules; ls /dev)" panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done +} + +mountroot() +{ + pre_mountroot # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then @@ -117,7 +107,11 @@ mountroot () # FIXME This has no error checking # Mount root - mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} + if [ "${FSTYPE}" != "unknown" ]; then + mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} + else + mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt} + fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom" run_scripts /scripts/local-bottom diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 6bf95e5..11acfc7 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -20,10 +20,33 @@ if [ -z "${resume}" ]; then fi case $resume in - LABEL=*) - resume="/dev/disk/by-label/${resume#LABEL=}" +LABEL=*) + resume="${resume#LABEL=}" + + # support any / in LABEL= path (escape to \x2f) + case "${resume}" in + */*) + if command -v sed >/dev/null 2>&1; then + resume="$(echo ${resume} | sed 's,/,\\x2f,g')" + else + if [ "${resume}" != "${resume#/}" ]; then + resume="\x2f${resume#/}" + fi + if [ "${resume}" != "${resume%/}" ]; then + resume="${resume%/}\x2f" + fi + IFS='/' + newresume= + for s in $resume; do + newresume="${newresume:+${newresume}\\x2f}${s}" + done + unset IFS + resume="${newresume}" + fi + esac + resume="/dev/disk/by-label/${resume}" ;; - UUID=*) +UUID=*) resume="/dev/disk/by-uuid/${resume#UUID=}" ;; esac diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm deleted file mode 100755 index 4cf48ad..0000000 --- a/scripts/local-top/lvm +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh - -PREREQ="mdadm mdrun lvm2" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -activate_vg() -{ - local vg="$1" - - # Make sure that we have a non-empty argument - if [ -z "${vg}" ]; then - return 1 - fi - - # Take care of lilo boot arg, risky activating of all vg - case $vg in - fe[0-9]*) - vgchange -ay - exit 0 - ;; - # FIXME: check major - /dev/root) - vgchange -ay - exit 0 - ;; - esac - - # Make sure that we have a d-m path - vg=${vg#/dev/mapper/} - if [ "$vg" = "$1" ]; then - return 1 - fi - - # Make sure that the device includes at least one dash - if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then - return 1 - fi - - # Split volume group from logical volume. - vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#') - # Reduce padded --'s to -'s - vg=$(echo ${vg} | sed -e 's#--#-#g') - - vgchange -ay ${vg} -} - -if [ -e /scripts/local-top/lvm2 ]; then - exit 0 -fi - -if [ ! -e /sbin/vgchange ]; then - exit 0 -fi - -modprobe dm-mod -modprobe dm-snapshot -modprobe dm-mirror - -activate_vg "$ROOT" -activate_vg "$resume" - -exit 0 diff --git a/scripts/nfs b/scripts/nfs index 435d2d0..6fa0c43 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -4,7 +4,7 @@ retry_nr=0 -# parse nfs bootargs and mount nfs +# parse nfs bootargs and mount nfs do_nfsmount() { @@ -62,21 +62,16 @@ mountroot() wait_for_udev 10 # Default delay is around 180s - # FIXME: add usplash_write info - if [ -z "${ROOTDELAY}" ]; then - delay=180 - else - delay=${ROOTDELAY} - fi + delay=${ROOTDELAY:-180} - # loop until nfsmount succeds + # loop until nfsmount succeeds + do_nfsmount while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do - [ ${retry_nr} -gt 0 ] && \ [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" + /bin/sleep 1 do_nfsmount retry_nr=$(( ${retry_nr} + 1 )) - [ ! -e ${rootmnt}${init} ] && /bin/sleep 1 - [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg + [ "$quiet" != "y" ] && log_end_msg done [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" diff --git a/update-initramfs b/update-initramfs index 11f630f..f2439c8 100755 --- a/update-initramfs +++ b/update-initramfs @@ -7,13 +7,15 @@ KPKGCONF=/etc/kernel-img.conf USETRIGGERS=true mode="" version="" +update_initramfs=yes +backup_initramfs=no set -e [ -r ${CONF} ] && . ${CONF} if $USETRIGGERS \ - && [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \ + && [ x"${DPKG_MAINTSCRIPT_PACKAGE:-}" != x ] \ && [ $# = 1 ] \ && [ x"$1" = x-u ] \ && dpkg-trigger --check-supported 2>/dev/null @@ -26,8 +28,8 @@ fi usage() { - if [ -n "${1}" ]; then - printf "${@}\n\n" >&2 + if [ -n "${1:-}" ]; then + printf "${*}\n\n" >&2 fi cat >&2 << EOF Usage: ${0} [OPTION]... @@ -49,28 +51,28 @@ EOF # chroot check chrooted() { - # borrowed from udev's postinst - if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then - # the devicenumber/inode pair of / is the same as that of - # /sbin/init's root, so we're *not* in a chroot and hence - # return false. - return 1 - fi - return 0 + # borrowed from udev's postinst + if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then + # the devicenumber/inode pair of / is the same as that of + # /sbin/init's root, so we're *not* in a chroot and hence + # return false. + return 1 + fi +return 0 } mild_panic() { - if [ -n "${1}" ]; then - printf "${@}\n" >&2 + if [ -n "${1:-}" ]; then + printf "${*}\n" >&2 fi exit 0 } panic() { - if [ -n "${1}" ]; then - printf "${@}\n" >&2 + if [ -n "${1:-}" ]; then + printf "${*}\n" >&2 fi exit 1 } @@ -78,7 +80,7 @@ panic() verbose() { if [ "${verbose}" = 1 ]; then - printf "${@}\n" + printf "${*}\n" fi } @@ -127,6 +129,7 @@ backup_booted_initramfs() fi # keep booted initramfs + boot_initramfs= uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime) if [ -n "$uptime_days" ]; then boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days}) @@ -141,9 +144,9 @@ backup_booted_initramfs() } # nuke generated copy -remove_initramfs() +remove_initramfs_bak() { - [ -z "${initramfs_bak}" ] && return 0 + [ -z "${initramfs_bak:-}" ] && return 0 rm -f "${initramfs_bak}" verbose "Removing ${initramfs_bak}" } @@ -161,13 +164,13 @@ generate_initramfs() set_sha1 else mkinitramfs_return="$?" - remove_initramfs + remove_initramfs_bak rm -f "${initramfs}.new" if [ "$mkinitramfs_return" = "2" ]; then # minversion wasn't met, exit 0 exit 0 fi - echo "update-initramfs: failed for ${initramfs}" + echo "update-initramfs: failed for ${initramfs}" >&2 exit $mkinitramfs_return fi } @@ -177,93 +180,61 @@ run_lilo() { # show lilo errors on failure if ! lilo -t > /dev/null 2>&1 ; then - echo "ERROR lilo fails for new ${initramfs}:" + echo "ERROR lilo fails for new ${initramfs}:" >&2 echo lilo -t fi lilo } -# check if lilo is on mbr -mbr_check() -{ - # try to discover grub and be happy - [ -r /boot/grub/menu.lst ] \ - && groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \ - /boot/grub/menu.lst) - [ -e /boot/grub/device.map ] && [ -n "${groot}" ] \ - && dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map) - [ -n "${dev}" ] && [ -r ${dev} ] \ - && dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \ - | grep -q GRUB && return 0 - - # check out lilo.conf for validity - boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf) - [ -z "${boot}" ] && return 0 - case ${boot} in - /dev/md/*) - if [ -r /proc/mdstat ]; then - MD=${boot#/dev/md/} - boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \ - /proc/mdstat)" - fi - ;; - /dev/md*) - if [ -r /proc/mdstat ]; then - MD=${boot#/dev/} - boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \ - /proc/mdstat)" - fi - ;; - esac - [ ! -r "${boot}" ] && return 0 - dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \ - && run_lilo && return 0 - - # no idea which bootloader is used - echo - echo "WARNING: grub and lilo installed." - echo "If you use grub as bootloader everything is fine." - echo "If you use lilo as bootloader you must run lilo!" - echo -} - # Invoke bootloader run_bootloader() { + # invoke policy conformant bootloader hooks + if [ -d /etc/initramfs/post-update.d/ ]; then + run-parts --arg=${version} --arg=${initramfs} \ + /etc/initramfs/post-update.d/ + return 0 + fi + + # FIXME: to be removed postsqueeze release # if both lilo and grub around, figure out if lilo needs to be run - if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ] \ - || [ -x /usr/sbin/grub ]; then - if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then - [ -r "${KPKGCONF}" ] && \ - do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}") - if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ - || [ "${do_b}" = "YES" ]; then - run_lilo - return 0 - elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \ - || [ "${do_b}" = "NO" ]; then - return 0 - else - mbr_check - return 0 - fi + if ( command -v update-grub >/dev/null 2>&1 \ + || [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \ + && ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then + [ -r "${KPKGCONF}" ] && \ + do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}") + if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ + || [ "${do_b}" = "YES" ]; then + run_lilo + return 0 + elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \ + || [ "${do_b}" = "NO" ]; then + return 0 fi + + # do_bootloader unconfigured + echo + echo "WARNING: grub and lilo installed." + echo "Please deinstall unused bootloader." + echo return 0 fi - if [ -r /etc/lilo.conf ] && [ -x /sbin/lilo ]; then + if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then run_lilo return 0 fi - if [ -x /sbin/elilo ]; then + if [ -r /etc/elilo.conf ] && command -v elilo >/dev/null 2>&1; then elilo return 0 fi if [ -r /etc/zipl.conf ]; then zipl + return 0 fi if flash-kernel --supported >/dev/null 2>&1; then - flash-kernel + flash-kernel ${version} + return 0 fi } @@ -337,11 +308,12 @@ set_current_version() set_linked_version() { - if [ -L /initrd.img ]; then + linktarget= + if [ -e /initrd.img ] && [ -L /initrd.img ]; then linktarget="$(basename "$(readlink /initrd.img)")" fi - if [ -L /boot/initrd.img ]; then + if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then linktarget="$(basename "$(readlink /boot/initrd.img)")" fi @@ -355,6 +327,10 @@ set_linked_version() set_highest_version() { get_sorted_versions + if [ -z "${version_list}" ]; then + version= + return + fi set -- ${version_list} version=${1} } @@ -388,11 +364,11 @@ update() fi if [ -z "${version}" ]; then - set_linked_version + set_highest_version fi if [ -z "${version}" ]; then - set_highest_version + set_linked_version fi if [ -z "${version}" ]; then @@ -427,12 +403,14 @@ delete() set_initramfs - if [ ! -e "${initramfs}" ]; then - panic "Cannot delete ${initramfs}, doesn't exist." - fi + if [ "${takeover}" = 0 ]; then + if [ ! -e "${initramfs}" ]; then + panic "Cannot delete ${initramfs}, doesn't exist." + fi - if ! version_exists "${version}"; then - panic "Cannot delete version ${version}: Not created by this utility." + if ! version_exists "${version}"; then + panic "Cannot delete version ${version}: Not created by this utility." + fi fi altered_check @@ -441,7 +419,7 @@ delete() delete_sha1 - rm -f "${initramfs}" + rm -f "${initramfs}" "${initramfs}.bak" } # Check for update mode on existing and modified initramfs @@ -492,7 +470,7 @@ while getopts "k:cudyvtb:h?" flag; do b) BOOTDIR="${OPTARG}" if [ ! -d "${BOOTDIR}" ]; then - echo "Error: ${BOOTDIR} is not a directory." + echo "Error: ${BOOTDIR} is not a directory." >&2 exit 1 fi ;; @@ -502,6 +480,13 @@ while getopts "k:cudyvtb:h?" flag; do esac done +shift $((${OPTIND} - 1)) + +if [ $# -ne 0 ]; then + echo "Invalid argument for option -k." >&2 + usage +fi + # Validate arguments if [ -z "${mode}" ]; then usage "You must specify at least one of -c, -u, or -d." @@ -527,11 +512,8 @@ if [ "${version}" = "all" ] \ OPTS="${OPTS} -y" fi for u_version in ${version_list}; do - # Don't stop if one version doesn't work. - set +e verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}" "${0}" -${mode} -k "${u_version}" ${OPTS} - set -e done exit 0 fi diff --git a/update-initramfs.8 b/update-initramfs.8 index a01ba06..bf5080b 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS 8 "2008/12/19" "" "update\-initramfs manual" +.TH UPDATE-INITRAMFS 8 "2008/12/19" "Linux" "update\-initramfs manual" .SH NAME update\-initramfs \- generate an initramfs image @@ -83,6 +83,9 @@ Create the initramfs for a specific kernel: .PP .B update\-initramfs -c -k 2.6.18-1-686 +.SH FILES +/etc/initramfs-tools/update-initramfs.conf + .SH AUTHOR The initramfs-tools are written by Maximilian Attems <maks@debian.org>, Jeff Bailey <jbailey@raspberryginger.com> and numerous others. diff --git a/update-initramfs.conf.5 b/update-initramfs.conf.5 index fa28ee0..525cd64 100644 --- a/update-initramfs.conf.5 +++ b/update-initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS.CONF 5 "2008/07/03" "" "update-initramfs.conf manual" +.TH UPDATE-INITRAMFS.CONF 5 "2010/04/05" "Linux" "update-initramfs.conf manual" .SH NAME update-initramfs.conf \- configuration file for update-initramfs @@ -18,7 +18,11 @@ conservative manners needs to be applied. This disables the \fBupdate_initramfs \-u\fP call. .TP \fB backup_initramfs -By default \fBupdate_initramfs\fP keeps an .bak file of the previous initramfs. If set to \fIno\fP the backup initramfs will not be kept. +If set \fBupdate_initramfs\fP keeps an .bak file of the previous initramfs. If unset the backup initramfs will not be kept. + +.SH FILES +.TP +.I /etc/initramfs-tools/update-initramfs.conf .SH AUTHOR The initramfs-tools are written by Maximilian Attems <maks@debian.org>, |