From de9c780f57ae626f05ec1c971c56648250cba03c Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 8 Jun 2005 21:13:41 +0000 Subject: Initial checkin --- scripts/functions | 9 +++++++++ scripts/local | 15 +++++++++++++++ scripts/nfs | 11 +++++++++++ 3 files changed, 35 insertions(+) create mode 100644 scripts/functions create mode 100644 scripts/local create mode 100644 scripts/nfs (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions new file mode 100644 index 0000000..19560ba --- /dev/null +++ b/scripts/functions @@ -0,0 +1,9 @@ +panic() +{ + echo $@ + if [ -e /bin/busybox ]; then + FS1='(initramfs) ' exec /bin/busybox sh + else + FS1='(initramfs) ' exec /bin/sh + fi +} diff --git a/scripts/local b/scripts/local new file mode 100644 index 0000000..572f185 --- /dev/null +++ b/scripts/local @@ -0,0 +1,15 @@ +# Local filesystem mounting + +# Parameter: Where to mount the filesystem +mountroot () +{ + # Get the root filesystem type + if [ ! -e ${ROOT} ]; then + panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" + fi + + eval $(fstype < ${ROOT}) + + # Mount root + mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} +} diff --git a/scripts/nfs b/scripts/nfs new file mode 100644 index 0000000..1225c4d --- /dev/null +++ b/scripts/nfs @@ -0,0 +1,11 @@ + +# Paramter: Where the root should be mounted +mountroot () +{ + ipconfig ${DEVICE} + . /tmp/net-${DEVICE}.conf + if [ "x${NFSROOT}" = "xauto" ]; then + NFSROOT=${ROOTSERVER}:${ROOTPATH} + fi + nfsmount ${NFSROOT} ${rootmnt} +} -- cgit v1.2.3 From ac222142f849ed340c3b7a0300a57cc3153e0436 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 9 Jun 2005 17:23:35 +0000 Subject: Add hookscripts --- debian/changelog | 7 ++- debian/initramfs-tools.examples | 1 + docs/example_script | 21 +++++++ init | 4 ++ scripts/functions | 121 ++++++++++++++++++++++++++++++++++++++++ scripts/init-top/test | 18 ++++++ scripts/local | 6 ++ scripts/nfs | 8 +++ 8 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 docs/example_script create mode 100644 scripts/init-top/test (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 787f5fa..41f15e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,7 +13,12 @@ initramfs-tools (0.7) breezy; urgency=low * Add hookscript directories. - -- Jeff Bailey Thu, 9 Jun 2005 15:16:15 +0000 + * Call hookscripts + + Thanks to David Weinhall for the dependancy-based + hookscripts. + + -- Jeff Bailey Thu, 9 Jun 2005 17:08:01 +0000 initramfs-tools (0.6) breezy; urgency=low diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples index 35ca94c..0e8472b 100644 --- a/debian/initramfs-tools.examples +++ b/debian/initramfs-tools.examples @@ -1 +1,2 @@ conf/modules +docs/example_script diff --git a/docs/example_script b/docs/example_script new file mode 100644 index 0000000..111b0d8 --- /dev/null +++ b/docs/example_script @@ -0,0 +1,21 @@ +#!/bin/sh + +# List the soft prerequisites here. So if there's something you know +# should be run first iff it exists. +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Do the work here. +echo "Got here!" diff --git a/init b/init index c3e4887..c09074f 100644 --- a/init +++ b/init @@ -40,6 +40,8 @@ for x in $(cat /proc/cmdline); do esac done +run_scripts /scripts/init_top + . /scripts/${BOOT} # Load the modules @@ -57,6 +59,8 @@ fi mountroot +run_scripts /scripts/init_bottom + umount /sys umount /proc diff --git a/scripts/functions b/scripts/functions index 19560ba..586c82f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -7,3 +7,124 @@ panic() FS1='(initramfs) ' exec /bin/sh fi } + +# this function finds scripts with empty depends and adds them +# to the ordered list +dep_reduce() +{ + i=0 + j=0 + unset neworder + + for entry in "${array[@]}"; do + set - ${entry} + + if [ "$#" -eq "0" ]; then + continue + elif [ "$#" -eq "1" ]; then + if [ $end -eq 0 ] || + [ x"${order[$((end-1))]}" != x"$1" ]; then + order[$((end))]=$1 + end=$((end+1)) + neworder[$((j))]=$1 + j=$((j+1)) + fi + + array[$((i))]= + fi + + i=$((i+1)) + done +} + +dep_remove() +{ + i=0 + + # for each row in the array + for entry in "${array[@]}"; do + unset newentry + + set - ${entry} + + # for each dependency of the script + for dep in "$@"; do + new=1 + + # for each new dependency + for tmp in "${order[@]}"; do + if [ x"$dep" = x"$tmp" ]; then + new=0 + fi + done + + if [ x"$new" = x"1" ]; then + newentry="$newentry $dep" + fi + done + + array[$((i))]="$newentry" + i=$((i+1)) + done +} + +run_scripts() +{ + initdir=${1} + scripts=$(ls ${initdir}) + order= + end=0 + array= + + # FIXME: New algorithm + # array of strings: "$file $prereqs" + # iterate over all strings; find empty strings (just $file) + # add to order, delete from all strings and zero out entry + # repeat until all strings are empty + + i=0 + for file in $scripts; do + # if it's not a regular file, or if it's not executable, skip it + if ! [ -f ${initdir}/${file} ] || ! [ -x ${initdir}/${file} ]; then + continue + fi + + array[$((i))]="$file $(${initdir}/${file} prereqs)" + i=$((i+1)) + done + + # No scripts in directory, bail. + if [ ${i} -eq 0 ]; then + return 0 + fi + + while /bin/true; do + set - ${array[@]} + + if [ "$#" -eq "0" ]; then + break + fi + + dep_reduce + + dep_remove + + if [ "${#neworder}" -eq "0" ]; then + for x in "${array[@]}"; do + if [ x"$x" != x"" ]; then + printf "could not reduce further; " + printf "circular dependencies\n" + return 1 + fi + done + + # we're done! + break + fi + done + + # run the initscripts + for script in "${order[@]}"; do + ${initdir}/${script} + done +} diff --git a/scripts/init-top/test b/scripts/init-top/test new file mode 100644 index 0000000..e4d59fb --- /dev/null +++ b/scripts/init-top/test @@ -0,0 +1,18 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +echo "Got here!" diff --git a/scripts/local b/scripts/local index 572f185..ffbd230 100644 --- a/scripts/local +++ b/scripts/local @@ -3,6 +3,8 @@ # Parameter: Where to mount the filesystem mountroot () { + run_scripts /scripts/local_top + # Get the root filesystem type if [ ! -e ${ROOT} ]; then panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" @@ -10,6 +12,10 @@ mountroot () eval $(fstype < ${ROOT}) + run_scripts /scripts/local_premount + # Mount root mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} + + run_scripts /scripts/local_bottom } diff --git a/scripts/nfs b/scripts/nfs index 1225c4d..d0f1600 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -2,10 +2,18 @@ # Paramter: Where the root should be mounted mountroot () { + run_scripts /scripts/nfs_top + ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf if [ "x${NFSROOT}" = "xauto" ]; then NFSROOT=${ROOTSERVER}:${ROOTPATH} fi + + run_scripts /scripts/nfs_premount + nfsmount ${NFSROOT} ${rootmnt} + + run_scripts /scripts/nfs_bottom + } -- cgit v1.2.3 From d49e80ad3723c35714bf44b21545090da62f558e Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 9 Jun 2005 20:08:12 +0000 Subject: Hookscripts, prunce extras --- debian/dirs | 13 +-- debian/files | 2 +- debian/initramfs-tools/DEBIAN/conffiles | 1 - debian/initramfs-tools/DEBIAN/control | 10 --- debian/initramfs-tools/DEBIAN/md5sums | 9 -- debian/initramfs-tools/DEBIAN/postinst | 10 --- debian/initramfs-tools/DEBIAN/postrm | 8 -- .../initramfs-tools/etc/mkinitramfs/initramfs.conf | 50 ----------- debian/initramfs-tools/usr/sbin/mkinitramfs | 93 --------------------- .../usr/share/doc/initramfs-tools/TODO | 8 -- .../usr/share/doc/initramfs-tools/changelog.gz | Bin 784 -> 0 bytes .../usr/share/doc/initramfs-tools/copyright | 10 --- .../usr/share/doc/initramfs-tools/examples/modules | 7 -- .../initramfs-tools/usr/share/initramfs-tools/init | 64 -------------- .../usr/share/initramfs-tools/scripts/functions | 9 -- .../usr/share/initramfs-tools/scripts/local | 15 ---- .../usr/share/initramfs-tools/scripts/nfs | 11 --- mkinitramfs | 36 +++++--- scripts/functions | 1 + 19 files changed, 35 insertions(+), 322 deletions(-) delete mode 100644 debian/initramfs-tools/DEBIAN/conffiles delete mode 100644 debian/initramfs-tools/DEBIAN/control delete mode 100644 debian/initramfs-tools/DEBIAN/md5sums delete mode 100644 debian/initramfs-tools/DEBIAN/postinst delete mode 100644 debian/initramfs-tools/DEBIAN/postrm delete mode 100644 debian/initramfs-tools/etc/mkinitramfs/initramfs.conf delete mode 100644 debian/initramfs-tools/usr/sbin/mkinitramfs delete mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO delete mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz delete mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright delete mode 100644 debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules delete mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/init delete mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions delete mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/scripts/local delete mode 100644 debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs (limited to 'scripts') diff --git a/debian/dirs b/debian/dirs index fd55804..ef40692 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,6 +1,7 @@ -etc/mkiniramfs/init-bottom -etc/mkiniramfs/init-top -etc/mkiniramfs/local-premount -etc/mkiniramfs/local-top -etc/mkiniramfs/nfs-premount -etc/mkiniramfs/nfs-top +etc/mkinitramfs/init-bottom +etc/mkinitramfs/init-top +etc/mkinitramfs/local-premount +etc/mkinitramfs/local-top +etc/mkinitramfs/nfs-premount +etc/mkinitramfs/nfs-top +usr/share/initramfs-tools/modules.d diff --git a/debian/files b/debian/files index b9277fc..47aa909 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -initramfs-tools_0.6_all.deb utils optional +initramfs-tools_0.7_all.deb utils optional diff --git a/debian/initramfs-tools/DEBIAN/conffiles b/debian/initramfs-tools/DEBIAN/conffiles deleted file mode 100644 index cd2afc0..0000000 --- a/debian/initramfs-tools/DEBIAN/conffiles +++ /dev/null @@ -1 +0,0 @@ -/etc/mkinitramfs/initramfs.conf diff --git a/debian/initramfs-tools/DEBIAN/control b/debian/initramfs-tools/DEBIAN/control deleted file mode 100644 index 9192ae1..0000000 --- a/debian/initramfs-tools/DEBIAN/control +++ /dev/null @@ -1,10 +0,0 @@ -Package: initramfs-tools -Version: 0.6 -Section: utils -Priority: optional -Architecture: all -Depends: klibc-utils -Installed-Size: 100 -Maintainer: Jeff Bailey -Description: tools for generting an Ubuntu-style initramfs - This package generates an initramfs for an Ubuntu system. diff --git a/debian/initramfs-tools/DEBIAN/md5sums b/debian/initramfs-tools/DEBIAN/md5sums deleted file mode 100644 index 420e544..0000000 --- a/debian/initramfs-tools/DEBIAN/md5sums +++ /dev/null @@ -1,9 +0,0 @@ -741626a7104d48b15ee4f7f0f8973deb usr/share/doc/initramfs-tools/TODO -ed79de81154495c4c23a93b32471cb19 usr/share/doc/initramfs-tools/copyright -12933b9f50570c11cf0f384eee619ee9 usr/share/doc/initramfs-tools/examples/modules -35c556b7165396ffbb9daf1e33f75e80 usr/share/doc/initramfs-tools/changelog.gz -614dec8a64e5f9798d4e0eb42219d96d usr/share/initramfs-tools/init -f18121fe1135572dbbea347371e8d730 usr/share/initramfs-tools/scripts/nfs -9d5014b1fbc092a32526ffa52549193c usr/share/initramfs-tools/scripts/local -6ebc6e800720aab93d022fe8ef5063d5 usr/share/initramfs-tools/scripts/functions -fd7c4a390d50d181203e0ca2007254e2 usr/sbin/mkinitramfs diff --git a/debian/initramfs-tools/DEBIAN/postinst b/debian/initramfs-tools/DEBIAN/postinst deleted file mode 100644 index 36f508d..0000000 --- a/debian/initramfs-tools/DEBIAN/postinst +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -e - -if [ ! -e /etc/mkinitramfs/modules ]; then - cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/ -fi - - - diff --git a/debian/initramfs-tools/DEBIAN/postrm b/debian/initramfs-tools/DEBIAN/postrm deleted file mode 100644 index 84bff36..0000000 --- a/debian/initramfs-tools/DEBIAN/postrm +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "x${1}" = "xpurge" ]; then - rm /etc/mkinitramfs/modules -fi - - - diff --git a/debian/initramfs-tools/etc/mkinitramfs/initramfs.conf b/debian/initramfs-tools/etc/mkinitramfs/initramfs.conf deleted file mode 100644 index a056469..0000000 --- a/debian/initramfs-tools/etc/mkinitramfs/initramfs.conf +++ /dev/null @@ -1,50 +0,0 @@ -# -# initramfs.conf -# - -# BUSYBOX: [ y | n ] -# -# Use busybox if available. You MUST use the -static version -# - -BUSYBOX=n - -# -# BOOT: [ local | nfs ] -# -# local - Boot off of local media (harddrive, USB stick). -# -# nfs - Boot using an NFS drive as the root of the drive. -# - -BOOT=local - -# -# MODULES: [ most | dep | list ] -# -# most - Add all framebuffer, acpi, filesystem, and harddrive drivers. -# -# dep - Try and guess which modules to load. -# -# list - Only include modules from the 'additional modules' list -# -MODULES=list - -# -# NFS Section of the config. -# - -# -# DEVICE: ... -# -# Specify the network device, like eth0 -# - -DEVICE=eth0 - -# -# NFSROOT: [ auto | HOST:MOUNT ] -# - -NFSROOT=auto - diff --git a/debian/initramfs-tools/usr/sbin/mkinitramfs b/debian/initramfs-tools/usr/sbin/mkinitramfs deleted file mode 100644 index 593c69e..0000000 --- a/debian/initramfs-tools/usr/sbin/mkinitramfs +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -. /etc/mkinitramfs/initramfs.conf - -usage() -{ - echo "-o Output" - echo "-v version" - echo "-k Keep temp files" - exit 1 -} - -# Defaults -keep="n" - -while getopts "ko:v:" flag; do - case $flag in - o) - outfile="${OPTARG}" - ;; - v) - version="${OPTARG}" - ;; - k) - keep="y" - ;; - esac -done - -if [ x${outfile} = x ]; then - usage -fi - -if [ -d ${outfile} ]; then - echo "${outfile} is a directory" - exit 1 -fi - -if [ ! -e /lib/modules/${version} ]; then - echo "Cannot find /lib/modules/${version}" - exit 1 -fi - -TMPDIR=$(mktemp -d) || exit 1 -mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc -mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts - -for x in $(sed -e '/^#/d' /etc/mkinitramfs/modules); do - for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do - # Prune duplicates - if [ -e ${TMPDIR}/modules/$(basename ${y}) ]; then - continue - fi - - ln -s ${y} ${TMPDIR}/modules - echo $(basename ${y}) >>${TMPDIR}/conf/modules - done -done - -# Have to do each file, because cpio --dereference doesn't recurse down -# symlinks. - -ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin -ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib -ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init -ln -s /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts -ln -s /etc/mkinitramfs/initramfs.conf ${TMPDIR}/conf -ln -s /etc/udev ${TMPDIR}/etc - -# Hack until udev is built with klibc -ln -s /sbin/udev ${TMPDIR}/bin -ln -s /sbin/udevstart ${TMPDIR}/bin -ln -s /lib/libc.so.* ${TMPDIR}/lib -ln -s /lib/ld*.so.* ${TMPDIR}/lib -rm ${TMPDIR}/lib/*lsb* - -# Busybox -if [ "x${BUSYBOX}" = "xy" ]; then - rm ${TMPDIR}/bin/sh - ln -s /bin/busybox ${TMPDIR}/bin/sh -fi - -# Raid -ln -s /sbin/mdadm ${TMPDIR}/bin -ln -s /sbin/mdrun ${TMPDIR}/bin - -(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) - -if [ "${keep}" = "y" ]; then - echo "Working files in ${TMPDIR}" -else - rm -rf "${TMPDIR}" -fi diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO b/debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO deleted file mode 100644 index bf7e07d..0000000 --- a/debian/initramfs-tools/usr/share/doc/initramfs-tools/TODO +++ /dev/null @@ -1,8 +0,0 @@ -TODO -==== - - o Get udev compiled against klibc - - o Integrate hotplug-ng - - o Add option to make-kpkg to use mkinitramfs diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz b/debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz deleted file mode 100644 index c89e14f..0000000 Binary files a/debian/initramfs-tools/usr/share/doc/initramfs-tools/changelog.gz and /dev/null differ diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright b/debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright deleted file mode 100644 index cdc2919..0000000 --- a/debian/initramfs-tools/usr/share/doc/initramfs-tools/copyright +++ /dev/null @@ -1,10 +0,0 @@ -This package was debianized by Jeff Bailey on -Thu, 27 Jan 2005 15:23:52 -0500. - -Copyright: - -Author: Jeff Bailey, with some pieces for initrd-tools - -License: - -PUBLIC DOMAIN diff --git a/debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules b/debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules deleted file mode 100644 index ee1310a..0000000 --- a/debian/initramfs-tools/usr/share/doc/initramfs-tools/examples/modules +++ /dev/null @@ -1,7 +0,0 @@ -# List of modules that you want to include in your initramfs. -# This might be good choices: -# -#ide-disk -#ide-generic -#ext2 -#ext3 diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/init b/debian/initramfs-tools/usr/share/initramfs-tools/init deleted file mode 100644 index c3e4887..0000000 --- a/debian/initramfs-tools/usr/share/initramfs-tools/init +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -x -mkdir /sys -mkdir /proc -mkdir /tmp -mount -t sysfs sysfs /sys -mount -t proc proc /proc - -. /conf/initramfs.conf -. /scripts/functions - -# Parse command line options -init=/sbin/init -root= -ro=-r -break= -rootmnt=/root -for x in $(cat /proc/cmdline); do - case $x in - init=*) - INIT=${x#init=} - ;; - root=*) - ROOT=${x#root=} - ;; - nfsroot=*) - NFSROOT=${x#nfsroot=} - ;; - boot=*) - BOOT=${x#boot=} - ;; - ro) - ro=-r - ;; - rw) - ro=-w - ;; - break) - break=yes - ;; - esac -done - -. /scripts/${BOOT} - -# Load the modules -# FIXME - do module options here -for x in $(cat /conf/modules); do - insmod /modules/$x -done - -# Populate /dev tree -udevstart - -if [ x${break} = xyes ]; then - panic "Spawning shell within the initramfs" -fi - -mountroot - -umount /sys -umount /proc - -# Chain to real filesystem -exec run-init ${rootmnt} ${init} "$@" diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions deleted file mode 100644 index 19560ba..0000000 --- a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/functions +++ /dev/null @@ -1,9 +0,0 @@ -panic() -{ - echo $@ - if [ -e /bin/busybox ]; then - FS1='(initramfs) ' exec /bin/busybox sh - else - FS1='(initramfs) ' exec /bin/sh - fi -} diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/local b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/local deleted file mode 100644 index 572f185..0000000 --- a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/local +++ /dev/null @@ -1,15 +0,0 @@ -# Local filesystem mounting - -# Parameter: Where to mount the filesystem -mountroot () -{ - # Get the root filesystem type - if [ ! -e ${ROOT} ]; then - panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" - fi - - eval $(fstype < ${ROOT}) - - # Mount root - mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} -} diff --git a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs b/debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs deleted file mode 100644 index 1225c4d..0000000 --- a/debian/initramfs-tools/usr/share/initramfs-tools/scripts/nfs +++ /dev/null @@ -1,11 +0,0 @@ - -# Paramter: Where the root should be mounted -mountroot () -{ - ipconfig ${DEVICE} - . /tmp/net-${DEVICE}.conf - if [ "x${NFSROOT}" = "xauto" ]; then - NFSROOT=${ROOTSERVER}:${ROOTPATH} - fi - nfsmount ${NFSROOT} ${rootmnt} -} diff --git a/mkinitramfs b/mkinitramfs index 7b6af66..2134a2d 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,5 +1,27 @@ #!/bin/sh +# Takes a file containing a list of modules to be added as an argument +# Figures out dependancies and adds it in. +manual_add_modules() +{ + # Sanity check + if [ ! -e ${1} ]; then + return + fi + + for x in $(sed -e '/^#/d' ${1}); do + for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do + # Prune duplicates + if [ -e ${TMPDIR}/modules/$(basename ${y}) ]; then + continue + fi + + ln -s ${y} ${TMPDIR}/modules + echo $(basename ${y}) >>${TMPDIR}/conf/modules + done + done +} + usage() { cat >&2 << EOF @@ -51,6 +73,8 @@ if [ x${outfile} = x ] || [ ${#} -ne 1 ]; then usage fi +version=${1} + if [ -d ${outfile} ]; then echo "${outfile} is a directory" exit 1 @@ -65,16 +89,8 @@ TMPDIR=$(mktemp -d) || exit 1 mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts -for x in $(sed -e '/^#/d' ${CONFDIR}/modules); do - for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do - # Prune duplicates - if [ -e ${TMPDIR}/modules/$(basename ${y}) ]; then - continue - fi - - ln -s ${y} ${TMPDIR}/modules - echo $(basename ${y}) >>${TMPDIR}/conf/modules - done +for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do + manual_add_modules ${x} done # Have to do each file, because cpio --dereference doesn't recurse down diff --git a/scripts/functions b/scripts/functions index 586c82f..4a92011 100644 --- a/scripts/functions +++ b/scripts/functions @@ -128,3 +128,4 @@ run_scripts() ${initdir}/${script} done } + -- cgit v1.2.3 From 8d503582491ccf26b6925e5eb7cf77d9158fc65b Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Mon, 13 Jun 2005 01:40:55 +0000 Subject: Update with new dependancy based init system, call the right script directories, always use busybox now, sigh. --- debian/control | 4 +- init | 14 +++- mkinitramfs | 8 ++- scripts/functions | 178 ++++++++++++++++++++++---------------------------- scripts/init-top/test | 18 ----- scripts/local | 6 +- scripts/local-top/md | 18 +++++ scripts/nfs | 6 +- 8 files changed, 122 insertions(+), 130 deletions(-) delete mode 100644 scripts/init-top/test create mode 100644 scripts/local-top/md (limited to 'scripts') diff --git a/debian/control b/debian/control index fe8d332..89c37e4 100644 --- a/debian/control +++ b/debian/control @@ -2,11 +2,11 @@ Source: initramfs-tools Section: utils Priority: optional Maintainer: Jeff Bailey -Build-Depends-Indep: debhelper (>= 4.0.0), cdbs, busybox-cvs-static +Build-Depends-Indep: debhelper (>= 4.0.0), cdbs Standards-Version: 3.6.1 Package: initramfs-tools Architecture: all -Depends: klibc-utils +Depends: klibc-utils, busybox-cvs-static Description: tools for generting an Ubuntu-style initramfs This package generates an initramfs for an Ubuntu system. diff --git a/init b/init index c09074f..733e7fd 100644 --- a/init +++ b/init @@ -1,4 +1,14 @@ #!/bin/sh -x + +/bin/busybox ln -s /bin/busybox /bin/[ +/bin/busybox ln -s /bin/busybox /bin/basename +/bin/busybox ln -s /bin/busybox /bin/mount +/bin/busybox ln -s /bin/busybox /bin/mkdir +/bin/busybox ln -s /bin/busybox /bin/umount +/bin/busybox ln -s /bin/busybox /bin/sed +/bin/busybox ln -s /bin/busybox /bin/grep +/bin/busybox ln -s /bin/busybox /bin/cat + mkdir /sys mkdir /proc mkdir /tmp @@ -40,7 +50,7 @@ for x in $(cat /proc/cmdline); do esac done -run_scripts /scripts/init_top +run_scripts /scripts/init-top . /scripts/${BOOT} @@ -59,7 +69,7 @@ fi mountroot -run_scripts /scripts/init_bottom +run_scripts /scripts/init-bottom umount /sys umount /proc diff --git a/mkinitramfs b/mkinitramfs index 359ecd2..e1c9a6b 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -99,7 +99,7 @@ done ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init -ln -s /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts +cp -a /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts ln -s ${CONFDIR}/initramfs.conf ${TMPDIR}/conf ln -s /etc/udev ${TMPDIR}/etc @@ -112,14 +112,16 @@ rm ${TMPDIR}/lib/*lsb* # Busybox if [ "x${BUSYBOX}" = "xy" ]; then + rm ${TMPDIR}/bin/sh ln -s /bin/busybox ${TMPDIR}/bin + ln -s /bin/busybox ${TMPDIR}/bin/sh fi # Raid ln -s /sbin/mdadm ${TMPDIR}/bin ln -s /sbin/mdrun ${TMPDIR}/bin -ln -s /bin/grep ${TMPDIR}/bin -ln -s /bin/sed ${TMPDIR}/bin +#ln -s /bin/grep ${TMPDIR}/bin +#ln -s /bin/sed ${TMPDIR}/bin (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) diff --git a/scripts/functions b/scripts/functions index 4a92011..a2ffd54 100644 --- a/scripts/functions +++ b/scripts/functions @@ -8,124 +8,104 @@ panic() fi } -# this function finds scripts with empty depends and adds them -# to the ordered list -dep_reduce() +render() { - i=0 - j=0 - unset neworder - - for entry in "${array[@]}"; do - set - ${entry} + eval "echo -n \${$@}" +} - if [ "$#" -eq "0" ]; then +set_initlist() +{ + unset initlist + for si_x in ${initdir}/*; do + if [ ! -x ${si_x} ]; then continue - elif [ "$#" -eq "1" ]; then - if [ $end -eq 0 ] || - [ x"${order[$((end-1))]}" != x"$1" ]; then - order[$((end))]=$1 - end=$((end+1)) - neworder[$((j))]=$1 - j=$((j+1)) - fi - - array[$((i))]= fi - - i=$((i+1)) + initlist="${initlist} $(basename ${si_x})" done } -dep_remove() +reduce_satisfied() { - i=0 - - # for each row in the array - for entry in "${array[@]}"; do - unset newentry - - set - ${entry} - - # for each dependency of the script - for dep in "$@"; do - new=1 - - # for each new dependency - for tmp in "${order[@]}"; do - if [ x"$dep" = x"$tmp" ]; then - new=0 - fi - done - - if [ x"$new" = x"1" ]; then - newentry="$newentry $dep" - fi - done + deplist="$(render array_${1})" + for rs_x in ${runlist}; do + pop_list_item ${rs_x} ${deplist} + deplist=${tmppop} + done + eval array_${1}=\"${deplist}\" +} - array[$((i))]="$newentry" - i=$((i+1)) +get_prereqs() +{ + set_initlist + for gp_x in ${initlist}; do + tmp=$(${initdir}/${gp_x} prereqs) + eval array_${gp_x}=\"${tmp}\" done } -run_scripts() +count_unsatisfied() { - initdir=${1} - scripts=$(ls ${initdir}) - order= - end=0 - array= + set - ${@} + return ${#} +} - # FIXME: New algorithm - # array of strings: "$file $prereqs" - # iterate over all strings; find empty strings (just $file) - # add to order, delete from all strings and zero out entry - # repeat until all strings are empty - - i=0 - for file in $scripts; do - # if it's not a regular file, or if it's not executable, skip it - if ! [ -f ${initdir}/${file} ] || ! [ -x ${initdir}/${file} ]; then +# Removes $1 from initlist +pop_list_item() +{ + item=${1} + shift + set - ${@} + unset tmppop + # Iterate + for pop in ${@}; do + if [ ${pop} = ${item} ]; then continue fi - - array[$((i))]="$file $(${initdir}/${file} prereqs)" - i=$((i+1)) + tmppop="${tmppop} ${pop}" done - # No scripts in directory, bail. - if [ ${i} -eq 0 ]; then - return 0 - fi - - while /bin/true; do - set - ${array[@]} - - if [ "$#" -eq "0" ]; then - break - fi - - dep_reduce - - dep_remove - - if [ "${#neworder}" -eq "0" ]; then - for x in "${array[@]}"; do - if [ x"$x" != x"" ]; then - printf "could not reduce further; " - printf "circular dependencies\n" - return 1 - fi - done - - # we're done! - break +} + +# This function generates the runlist, so we clear it first. +reduce_prereqs() +{ + unset runlist + set_initlist + set - ${initlist} + i=$# + # Loop until there's no more in the queue to loop through + while [ ${i} -ne 0 ]; do + oldi=${i} + for rp_x in ${initlist}; do + reduce_satisfied ${rp_x} + count_unsatisfied $(render array_${rp_x}) + cnt=${?} + if [ ${cnt} -eq 0 ]; then + runlist="${runlist} ${rp_x}" + pop_list_item ${rp_x} ${initlist} + initlist=${tmppop} + i=$((${i} - 1)) + fi + done + if [ ${i} -eq ${oldi} ]; then + echo "PANIC: Circular dependancy. Exiting." >&2 + exit 1 fi done - - # run the initscripts - for script in "${order[@]}"; do - ${initdir}/${script} +} + +call_scripts() +{ + echo ${runlist} + for cs_x in ${runlist}; do + ${initdir}/${cs_x} done -} +} +run_scripts() +{ + initdir=${1} + get_prereqs + reduce_prereqs + call_scripts +} diff --git a/scripts/init-top/test b/scripts/init-top/test deleted file mode 100644 index e4d59fb..0000000 --- a/scripts/init-top/test +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -echo "Got here!" diff --git a/scripts/local b/scripts/local index ffbd230..b322f09 100644 --- a/scripts/local +++ b/scripts/local @@ -3,7 +3,7 @@ # Parameter: Where to mount the filesystem mountroot () { - run_scripts /scripts/local_top + run_scripts /scripts/local-top # Get the root filesystem type if [ ! -e ${ROOT} ]; then @@ -12,10 +12,10 @@ mountroot () eval $(fstype < ${ROOT}) - run_scripts /scripts/local_premount + run_scripts /scripts/local-premount # Mount root mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} - run_scripts /scripts/local_bottom + run_scripts /scripts/local-bottom } diff --git a/scripts/local-top/md b/scripts/local-top/md new file mode 100644 index 0000000..d6f7e94 --- /dev/null +++ b/scripts/local-top/md @@ -0,0 +1,18 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +/bin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index d0f1600..9860ea7 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -2,7 +2,7 @@ # Paramter: Where the root should be mounted mountroot () { - run_scripts /scripts/nfs_top + run_scripts /scripts/nfs-top ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf @@ -10,10 +10,10 @@ mountroot () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi - run_scripts /scripts/nfs_premount + run_scripts /scripts/nfs-premount nfsmount ${NFSROOT} ${rootmnt} - run_scripts /scripts/nfs_bottom + run_scripts /scripts/nfs-bottom } -- cgit v1.2.3 From 43528be821f50d8676ba29d7e51be6915d74cfae Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Tue, 14 Jun 2005 21:39:18 +0000 Subject: export command line parameters to run scripts. honour commandline readonly/readwrite parameters for nfs. Release initramfs 0.8 --- debian/changelog | 11 +++++++---- init | 14 +++++++------- scripts/local | 8 +++++++- scripts/nfs | 8 +++++++- 4 files changed, 28 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 7f0053e..b96929f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,13 @@ -initramfs-tools (0.8) UNRELEASED; urgency=low +initramfs-tools (0.8) breezy; urgency=low - + The "We are one in the spirit..." release - * + * Export the command line variables so that the various scripts + can see them. - -- Jeff Bailey Mon, 13 Jun 2005 01:53:01 +0000 + * Honour command line 'ro' or 'rw' settings for nfs. + + -- Jeff Bailey Tue, 14 Jun 2005 21:35:14 +0000 initramfs-tools (0.7) breezy; urgency=low diff --git a/init b/init index 733e7fd..31a16c0 100644 --- a/init +++ b/init @@ -19,11 +19,11 @@ mount -t proc proc /proc . /scripts/functions # Parse command line options -init=/sbin/init -root= -ro=-r -break= -rootmnt=/root +export init=/sbin/init +export root= +export readonly=y +export break= +export rootmnt=/root for x in $(cat /proc/cmdline); do case $x in init=*) @@ -39,10 +39,10 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; ro) - ro=-r + readonly=yes ;; rw) - ro=-w + readonly=no ;; break) break=yes diff --git a/scripts/local b/scripts/local index b322f09..cf9e331 100644 --- a/scripts/local +++ b/scripts/local @@ -14,8 +14,14 @@ mountroot () run_scripts /scripts/local-premount + if [ ${readonly} = y ]; then + roflag=-r + else + roflag=-w + fi + # Mount root - mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} + mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} run_scripts /scripts/local-bottom } diff --git a/scripts/nfs b/scripts/nfs index 9860ea7..d8a259a 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -12,7 +12,13 @@ mountroot () run_scripts /scripts/nfs-premount - nfsmount ${NFSROOT} ${rootmnt} + if [ ${readonly} = y ]; then + roflag="-o ro" + else + roflag="-o rw" + fi + + nfsmount ${roflag} ${NFSROOT} ${rootmnt} run_scripts /scripts/nfs-bottom -- cgit v1.2.3 From 333765e767ca14365b8078598aee55bfb5a4db32 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 16 Jun 2005 19:41:14 +0000 Subject: Require busybox-cvs-initramfs, include modprobe bits --- debian/changelog | 8 ++++++++ debian/control | 2 +- init | 9 --------- mkinitramfs | 13 ++++++------- scripts/functions | 6 +----- 5 files changed, 16 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b96929f..88abe0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +initramfs-tools (0.9) breezy; urgency=low + + * Unconditionally require busybox. Might revert this eventually + but it's too much of a pain right now do this without + a reasonably environment. + + -- Jeff Bailey Thu, 16 Jun 2005 02:23:50 +0000 + initramfs-tools (0.8) breezy; urgency=low The "We are one in the spirit..." release diff --git a/debian/control b/debian/control index e2c4dbb..7222e98 100644 --- a/debian/control +++ b/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.6.1 Package: initramfs-tools Architecture: all -Depends: klibc-utils, busybox-cvs-static, mdadm +Depends: klibc-utils, busybox-cvs-initramfs, mdadm Description: tools for generting an Ubuntu-style initramfs This package generates an initramfs for an Ubuntu system. diff --git a/init b/init index 31a16c0..a338889 100644 --- a/init +++ b/init @@ -1,14 +1,5 @@ #!/bin/sh -x -/bin/busybox ln -s /bin/busybox /bin/[ -/bin/busybox ln -s /bin/busybox /bin/basename -/bin/busybox ln -s /bin/busybox /bin/mount -/bin/busybox ln -s /bin/busybox /bin/mkdir -/bin/busybox ln -s /bin/busybox /bin/umount -/bin/busybox ln -s /bin/busybox /bin/sed -/bin/busybox ln -s /bin/busybox /bin/grep -/bin/busybox ln -s /bin/busybox /bin/cat - mkdir /sys mkdir /proc mkdir /tmp diff --git a/mkinitramfs b/mkinitramfs index e1c9a6b..94cf4c5 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -111,17 +111,16 @@ ln -s /lib/ld*.so.* ${TMPDIR}/lib rm ${TMPDIR}/lib/*lsb* # Busybox -if [ "x${BUSYBOX}" = "xy" ]; then - rm ${TMPDIR}/bin/sh - ln -s /bin/busybox ${TMPDIR}/bin - ln -s /bin/busybox ${TMPDIR}/bin/sh -fi +rm ${TMPDIR}/bin/sh +ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/sh + +# Modutils +ln -s /sbin/insmod ${TMPDIR}/bin +ln -s /sbin/modprobe ${TMPDIR}/bin # Raid ln -s /sbin/mdadm ${TMPDIR}/bin ln -s /sbin/mdrun ${TMPDIR}/bin -#ln -s /bin/grep ${TMPDIR}/bin -#ln -s /bin/sed ${TMPDIR}/bin (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) diff --git a/scripts/functions b/scripts/functions index a2ffd54..717418f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,11 +1,7 @@ panic() { echo $@ - if [ -e /bin/busybox ]; then - FS1='(initramfs) ' exec /bin/busybox sh - else - FS1='(initramfs) ' exec /bin/sh - fi + FS1='(initramfs) ' exec /bin/sh } render() -- cgit v1.2.3 From bf8d6100fb13127151c309d842185b3a250ecfff Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 17 Jun 2005 12:17:42 +0000 Subject: Integrate Matt Zimmerman's changes to initramfs --- debian/changelog | 15 +++++++++++++-- init | 10 +++------- mkinitramfs | 25 +++++++++++++++++++++++-- scripts/functions | 20 ++++++++++++++++++++ scripts/local | 2 ++ 5 files changed, 61 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 88abe0c..5cd9969 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,22 @@ -initramfs-tools (0.9) breezy; urgency=low +initramfs-tools (0.10) breezy; urgency=low * Unconditionally require busybox. Might revert this eventually but it's too much of a pain right now do this without - a reasonably environment. + a reasonably environment + + * Use modprobe to load modules + + * Iterate through /sys/bus/pci and /sys/bus/usb and load drivers + based on their modalias -- Jeff Bailey Thu, 16 Jun 2005 02:23:50 +0000 +initramfs-tools (0.9) breezy; urgency=low + + * Be consistent about y/n vs. yes/no values for the readonly variable + + -- Matt Zimmerman Thu, 16 Jun 2005 15:22:30 -0700 + initramfs-tools (0.8) breezy; urgency=low The "We are one in the spirit..." release diff --git a/init b/init index 73981a5..52e10bd 100644 --- a/init +++ b/init @@ -30,10 +30,10 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; ro) - readonly=yes + readonly=y ;; rw) - readonly=no + readonly=n ;; break) break=yes @@ -45,11 +45,7 @@ run_scripts /scripts/init-top . /scripts/${BOOT} -# Load the modules -# FIXME - do module options here -for x in $(cat /conf/modules); do - modprobe $x -done +load_modules # Populate /dev tree udevstart diff --git a/mkinitramfs b/mkinitramfs index bfb0007..c3e98a3 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -19,7 +19,24 @@ manual_add_modules() mkdir -p ${TMPDIR}/$(dirname ${y}) ln -s ${y} ${TMPDIR}/$(dirname ${y}) depmod -b ${TMPDIR} ${version} - echo $(basename ${y}) >>${TMPDIR}/conf/modules + echo $(basename ${y} .ko) >>${TMPDIR}/conf/modules + done + done +} + +# Modules that we always add to the initramfs +auto_add_modules() +{ + for x in ext3 ext2 raid1 md sd_mod sata_svw usbhid ohci_hcd ehci_hcd; do + for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do + # Prune duplicates + if [ -e ${TMPDIR}/${y} ]; then + continue + fi + + mkdir -p ${TMPDIR}/$(dirname ${y}) + ln -s ${y} ${TMPDIR}/$(dirname ${y}) + depmod -b ${TMPDIR} ${version} done done } @@ -90,11 +107,14 @@ fi TMPDIR=$(mktemp -d) || exit 1 mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts +mkdir -p ${TMPDIR}/sbin for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do manual_add_modules ${x} done +auto_add_modules + # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. @@ -119,7 +139,8 @@ ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/sh ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox # Modutils -ln -s /sbin/modprobe ${TMPDIR}/bin +ln -s /sbin/modprobe ${TMPDIR}/sbin +ln -s /sbin/rmmod ${TMPDIR}/bin # Raid ln -s /sbin/mdadm ${TMPDIR}/bin diff --git a/scripts/functions b/scripts/functions index 717418f..7e8c725 100644 --- a/scripts/functions +++ b/scripts/functions @@ -105,3 +105,23 @@ run_scripts() reduce_prereqs call_scripts } + +load_modules() +{ + for x in /sys/bus/pci/devices/*; do + modprobe -q $(cat ${x}/modalias) + done + + # Give the USB bus a moment to catch up + sleep 2 + + for x in /sys/bus/usb/devices/*; do + modprobe -q $(cat ${x}/modalias) + done + + # Load the modules + # FIXME - do module options here + for x in $(cat /conf/modules); do + modprobe -v $x + done +} diff --git a/scripts/local b/scripts/local index cf9e331..99eea77 100644 --- a/scripts/local +++ b/scripts/local @@ -20,6 +20,8 @@ mountroot () roflag=-w fi + modprobe ${FSTYPE} + # Mount root mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} -- cgit v1.2.3 From 287dcae1407c303ee929d2bff0a49c1e721b05ae Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 17 Jun 2005 15:57:54 +0000 Subject: Use /sbin, do depmod at boot time, copy all the interesting hardware drivers onto the initramfs --- conf/modules | 6 ++---- debian/NEWS | 15 +++++++++++++++ debian/changelog | 11 ++++++++++- mkinitramfs | 35 ++++++++++++++++++++++++++++++----- scripts/functions | 2 ++ scripts/local-top/md | 2 +- 6 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 debian/NEWS (limited to 'scripts') diff --git a/conf/modules b/conf/modules index ee1310a..8f12189 100644 --- a/conf/modules +++ b/conf/modules @@ -1,7 +1,5 @@ # List of modules that you want to include in your initramfs. # This might be good choices: # -#ide-disk -#ide-generic -#ext2 -#ext3 +# raid1 +# sd_mod diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 0000000..e755806 --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,15 @@ +initramfs-tools (0.10) breezy; urgency=low + + * 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. + I will shrink it down once it's correct. If you're on an + arch that doesn't like >4mb initramfs', then this won't boot. + + 2) Your network drivers are loaded in the initramfs, so hotplug + won't see a network event, so ifup won't be run. This will + be fixed shortly in hotplug. + + -- Jeff Bailey Fri, 17 Jun 2005 15:17:06 +0000 + diff --git a/debian/changelog b/debian/changelog index 5cd9969..ca4efc1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,7 @@ initramfs-tools (0.10) breezy; urgency=low + The "I can see you!" release. + * Unconditionally require busybox. Might revert this eventually but it's too much of a pain right now do this without a reasonably environment @@ -9,7 +11,14 @@ initramfs-tools (0.10) breezy; urgency=low * Iterate through /sys/bus/pci and /sys/bus/usb and load drivers based on their modalias - -- Jeff Bailey Thu, 16 Jun 2005 02:23:50 +0000 + * Start to use /sbin for things + + * Include depmod in the image. Use it at boot time. + + * Edit config example to show the modules that do need to be included + manually for this build. + + -- Jeff Bailey Fri, 17 Jun 2005 12:45:07 +0000 initramfs-tools (0.9) breezy; urgency=low diff --git a/mkinitramfs b/mkinitramfs index c3e98a3..078346f 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -18,16 +18,40 @@ manual_add_modules() mkdir -p ${TMPDIR}/$(dirname ${y}) ln -s ${y} ${TMPDIR}/$(dirname ${y}) - depmod -b ${TMPDIR} ${version} echo $(basename ${y} .ko) >>${TMPDIR}/conf/modules done done } +# Copy entire subtrees to the initramfs +copy_modules_dir() +{ + tmpdir_modbase=${TMPDIR}/lib/modules/${version} + mkdir -p $(dirname ${tmpdir_modbase}/${1}) + cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1} +} + # Modules that we always add to the initramfs auto_add_modules() { - for x in ext3 ext2 raid1 md sd_mod sata_svw usbhid ohci_hcd ehci_hcd; do + copy_modules_dir kernel/drivers/net + copy_modules_dir kernel/drivers/scsi + copy_modules_dir kernel/drivers/ide + copy_modules_dir kernel/drivers/md + copy_modules_dir kernel/drivers/usb + copy_modules_dir kernel/drivers/block + copy_modules_dir kernel/drivers/input + copy_modules_dir kernel/fs/ext2 + copy_modules_dir kernel/fs/ext3 + copy_modules_dir kernel/fs/isofs + copy_modules_dir kernel/fs/jbd + copy_modules_dir kernel/fs/jfs + copy_modules_dir kernel/fs/nfs + copy_modules_dir kernel/fs/reiserfs + copy_modules_dir kernel/fs/xfs + + # These aren't caught by the above but really need to be there: + for x in mbcache; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then @@ -140,11 +164,12 @@ ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox # Modutils ln -s /sbin/modprobe ${TMPDIR}/sbin -ln -s /sbin/rmmod ${TMPDIR}/bin +ln -s /sbin/depmod ${TMPDIR}/sbin +ln -s /sbin/rmmod ${TMPDIR}/sbin # Raid -ln -s /sbin/mdadm ${TMPDIR}/bin -ln -s /sbin/mdrun ${TMPDIR}/bin +ln -s /sbin/mdadm ${TMPDIR}/sbin +ln -s /sbin/mdrun ${TMPDIR}/sbin (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) diff --git a/scripts/functions b/scripts/functions index 7e8c725..d5d1035 100644 --- a/scripts/functions +++ b/scripts/functions @@ -108,6 +108,8 @@ run_scripts() load_modules() { + depmod + for x in /sys/bus/pci/devices/*; do modprobe -q $(cat ${x}/modalias) done diff --git a/scripts/local-top/md b/scripts/local-top/md index d6f7e94..864ffe4 100644 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -15,4 +15,4 @@ prereqs) ;; esac -/bin/mdrun /dev +/sbin/mdrun /dev -- cgit v1.2.3 From b22f2c7fc49c9874eb8f2df1d8b1fabec540cfb0 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 17 Jun 2005 21:24:55 +0000 Subject: Make quieter, match mkinitrd interface, pull in dependencies for nfs and dhcp, document upstream repository location --- debian/changelog | 17 +++++++++++++++++ debian/copyright | 7 +++++-- init | 2 +- mkinitramfs | 22 +++++++++++++++++++++- scripts/functions | 8 ++++++-- scripts/nfs | 4 ++++ 6 files changed, 54 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index ca4efc1..dfdbc50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,20 @@ +initramfs-tools (0.11) breezy; urgency=low + + "Illusion is the first of all pleasures" - Oscar Wilde + + * Make the init much less noisy + + * Pull in all the dependancies for nfs and af_packet + + * Be compatible with misdocumented mkinitrd interface + + Thanks to Matt Zimmerman for the bug reports and testing! + + * Update debian/copyright to have the location of the bzr + archive + + -- Jeff Bailey Fri, 17 Jun 2005 21:23:25 +0000 + initramfs-tools (0.10) breezy; urgency=low The "I can see you!" release. diff --git a/debian/copyright b/debian/copyright index cdc2919..a40b722 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,12 @@ -This package was debianized by Jeff Bailey on +This package was debianized by Jeff Bailey on Thu, 27 Jan 2005 15:23:52 -0500. Copyright: -Author: Jeff Bailey, with some pieces for initrd-tools +Author: Jeff Bailey + +The source code can be found by using "bzr" at: +http://people.ubuntu.com/~jbailey/bzrtree/initramfs-tools License: diff --git a/init b/init index 52e10bd..8c5c53e 100644 --- a/init +++ b/init @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh mkdir /sys mkdir /proc diff --git a/mkinitramfs b/mkinitramfs index 078346f..8ef22c4 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -51,7 +51,7 @@ auto_add_modules() copy_modules_dir kernel/fs/xfs # These aren't caught by the above but really need to be there: - for x in mbcache; do + for x in mbcache nfs af_packet; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then @@ -116,7 +116,27 @@ if [ x${outfile} = x ] || [ ${#} -ne 1 ]; then usage fi +# And by "version" we really mean path to kernel modules +# This is braindead, and exists to preserve the interface with mkinitrd version=${1} +[ $# -gt 0 ] || unset version +case ${version} in +/lib/modules/*/[!/]*) + ;; +/lib/modules/[!/]*) + version=${version#/lib/modules/} + version=${version%%/*} + ;; +esac + +case ${version} in +*/*) + echo $PROG: ${version} is not a valid kernel version >&2 + exit 1 + ;; +esac + +version="${version-$(uname -r)}" if [ -d ${outfile} ]; then echo "${outfile} is a directory" diff --git a/scripts/functions b/scripts/functions index d5d1035..ab23352 100644 --- a/scripts/functions +++ b/scripts/functions @@ -111,14 +111,18 @@ load_modules() depmod for x in /sys/bus/pci/devices/*; do - modprobe -q $(cat ${x}/modalias) + if [ -e ${x}/modalias ]; then + modprobe -q $(cat ${x}/modalias) + fi done # Give the USB bus a moment to catch up sleep 2 for x in /sys/bus/usb/devices/*; do - modprobe -q $(cat ${x}/modalias) + if [ -e ${x}/modalias ]; then + modprobe -q $(cat ${x}/modalias) + fi done # Load the modules diff --git a/scripts/nfs b/scripts/nfs index d8a259a..11c61f8 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -4,6 +4,10 @@ mountroot () { run_scripts /scripts/nfs-top + modprobe nfs + # For DHCP + modprobe af_packet + ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf if [ "x${NFSROOT}" = "xauto" ]; then -- cgit v1.2.3 From a137627150b76d48d96ef72d26915005a1ce8538 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Mon, 20 Jun 2005 23:05:53 +0000 Subject: * Don't complain if /etc/mkinitramfs/modules doesn't exist. * Make sure that raid1 is pulled in. * Include /etc/modprobe.d/aliases in the initramfs --- debian/changelog | 10 ++++++++++ mkinitramfs | 4 +++- scripts/functions | 8 +++++--- 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index dfdbc50..07d6a4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +initramfs-tools (0.12) breezy; urgency=low + + * Don't complain if /etc/mkinitramfs/modules doesn't exist. + + * Make sure that raid1 is pulled in. + + * Include /etc/modprobe.d/aliases in the initramfs + + -- Jeff Bailey Mon, 20 Jun 2005 23:05:04 +0000 + initramfs-tools (0.11) breezy; urgency=low "Illusion is the first of all pleasures" - Oscar Wilde diff --git a/mkinitramfs b/mkinitramfs index 8ef22c4..f06811e 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -51,7 +51,7 @@ auto_add_modules() copy_modules_dir kernel/fs/xfs # These aren't caught by the above but really need to be there: - for x in mbcache nfs af_packet; do + for x in mbcache nfs af_packet raid1; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then @@ -186,6 +186,8 @@ ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox ln -s /sbin/modprobe ${TMPDIR}/sbin ln -s /sbin/depmod ${TMPDIR}/sbin ln -s /sbin/rmmod ${TMPDIR}/sbin +mkdir -p ${TMPDIR}/etc/modprobe.d +ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d # Raid ln -s /sbin/mdadm ${TMPDIR}/sbin diff --git a/scripts/functions b/scripts/functions index ab23352..73b773a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -127,7 +127,9 @@ load_modules() # Load the modules # FIXME - do module options here - for x in $(cat /conf/modules); do - modprobe -v $x - done + if [ -e /conf/modules ]; then + for x in $(cat /conf/modules); do + modprobe -v $x + done + fi } -- cgit v1.2.3 From f12ad818ffc10d8243cd75d552226273df3d65a0 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Tue, 21 Jun 2005 01:31:54 +0000 Subject: * Default to currently running kernel version. Based on a patch from maximilian attems, thanks! * Handle module arguments in /etc/mkinitramfs/modules * Do hookscripts at generation time. Drop things into /usr/share/initramfs-tools/hooks or /etc/mkinitramfs/hooks * Make sure local-bottom and nfs-bottom get created Thanks to Karl Hegbloom for these three patches! * Prune stray echo from call_scripts * Load raid1 for now so that md setups will work. * Detect ide modules load Thanks to Jeff Waugh for initial testing of this! --- conf/modules | 4 ++++ debian/changelog | 20 ++++++++++++++++++++ debian/dirs | 6 ++++-- mkinitramfs | 38 ++++++++++++++++++++++++++------------ scripts/functions | 49 ++++++++++++++++++++++++++++++++++++++++--------- scripts/local | 2 +- scripts/local-top/md | 3 +++ scripts/nfs | 1 + 8 files changed, 99 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/conf/modules b/conf/modules index 8f12189..0067831 100644 --- a/conf/modules +++ b/conf/modules @@ -1,4 +1,8 @@ # List of modules that you want to include in your initramfs. +# +# Syntax: module_name [args ...] +# +# # This might be good choices: # # raid1 diff --git a/debian/changelog b/debian/changelog index 07d6a4e..54d3fcd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,31 @@ initramfs-tools (0.12) breezy; urgency=low + "I am not young enough to know everything." - Oscar Wilde + * Don't complain if /etc/mkinitramfs/modules doesn't exist. * Make sure that raid1 is pulled in. * Include /etc/modprobe.d/aliases in the initramfs + * Default to currently running kernel version. + Based on a patch from maximilian attems, thanks! + + * Handle module arguments in /etc/mkinitramfs/modules + + * Do hookscripts at generation time. Drop things into + /usr/share/initramfs-tools/hooks or /etc/mkinitramfs/hooks + + * Make sure local-bottom and nfs-bottom get created + Thanks to Karl Hegbloom for these three patches! + + * Prune stray echo from call_scripts + + * Load raid1 for now so that md setups will work. + + * Detect ide modules load + Thanks to Jeff Waugh for initial testing of this! + -- Jeff Bailey Mon, 20 Jun 2005 23:05:04 +0000 initramfs-tools (0.11) breezy; urgency=low diff --git a/debian/dirs b/debian/dirs index ef40692..94484bb 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,7 +1,9 @@ etc/mkinitramfs/init-bottom etc/mkinitramfs/init-top -etc/mkinitramfs/local-premount etc/mkinitramfs/local-top -etc/mkinitramfs/nfs-premount +etc/mkinitramfs/local-premount +etc/mkinitramfs/local-bottom etc/mkinitramfs/nfs-top +etc/mkinitramfs/nfs-premount +etc/mkinitramfs/nfs-bottom usr/share/initramfs-tools/modules.d diff --git a/mkinitramfs b/mkinitramfs index f06811e..4dabfce 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,7 +1,17 @@ #!/bin/sh +# For dependency ordered mkinitramfs hook scripts. +. /usr/share/initramfs-tools/scripts/functions + # Takes a file containing a list of modules to be added as an argument # Figures out dependancies and adds it in. +# +# File syntax: +# +# # comment +# modprobe_module_name [args ...] +# [...] +# manual_add_modules() { # Sanity check @@ -9,8 +19,8 @@ manual_add_modules() return fi - for x in $(sed -e '/^#/d' ${1}); do - for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do + sed -e '/^#/d' ${1} | while read module rest; do + for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then continue @@ -18,7 +28,7 @@ manual_add_modules() mkdir -p ${TMPDIR}/$(dirname ${y}) ln -s ${y} ${TMPDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) >>${TMPDIR}/conf/modules + echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules done done } @@ -51,7 +61,7 @@ auto_add_modules() copy_modules_dir kernel/fs/xfs # These aren't caught by the above but really need to be there: - for x in mbcache nfs af_packet raid1; do + for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then @@ -99,9 +109,6 @@ while getopts "d:ko:r:" flag; do o) outfile="${OPTARG}" ;; - v) - version="${OPTARG}" - ;; k) keep="y" ;; @@ -112,14 +119,18 @@ shift $((${OPTIND} - 1)) . ${CONFDIR}/initramfs.conf -if [ x${outfile} = x ] || [ ${#} -ne 1 ]; then +if [ x${outfile} = x ]; then usage fi # And by "version" we really mean path to kernel modules # This is braindead, and exists to preserve the interface with mkinitrd -version=${1} -[ $# -gt 0 ] || unset version +if [ ${#} -ne 1 ]; then + version=$(uname -r) +else + version="${1}" +fi + case ${version} in /lib/modules/*/[!/]*) ;; @@ -136,8 +147,6 @@ case ${version} in ;; esac -version="${version-$(uname -r)}" - if [ -d ${outfile} ]; then echo "${outfile} is a directory" exit 1 @@ -193,6 +202,11 @@ ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d ln -s /sbin/mdadm ${TMPDIR}/sbin ln -s /sbin/mdrun ${TMPDIR}/sbin +run_scripts /usr/share/initramfs-tools/hooks +run_scripts /etc/mkinitramfs/hooks + +# FIXME catenate extra cpio.gz here >>${outfile} + (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) if [ "${keep}" = "y" ]; then diff --git a/scripts/functions b/scripts/functions index 73b773a..5fb8c04 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,3 +1,5 @@ +# -*- shell-script -*- + panic() { echo $@ @@ -92,7 +94,6 @@ reduce_prereqs() call_scripts() { - echo ${runlist} for cs_x in ${runlist}; do ${initdir}/${cs_x} done @@ -106,9 +107,44 @@ run_scripts() call_scripts } +ide_boot_events() { + [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return + + for drive in /proc/ide/*/media; do + # nothing to do if the device has already been took in charge + unit=${drive#/proc/ide/}; unit=${unit%/media} + [ -d /sys/block/$unit ] && continue + + read media < $drive + case "$media" in + disk) MODULE=ide-disk ;; + cdrom) MODULE=ide-cd ;; + tape) MODULE=ide-tape ;; + floppy) MODULE=ide-floppy ;; + *) MODULE=ide-generic ;; + esac + + modprobe -q ${MODULE} + done +} + load_modules() { - depmod + depmod -a + + # Load custom modules first + if [ -e /conf/modules ]; then + cat /conf/modules | while read m; do + if [ -z "$m" ] \ + || expr "$m" : "#" >/dev/null \ + || expr "$m" : "[ \t]+#?" > /dev/null + then + continue; + else + modprobe -v $m + fi + done + fi for x in /sys/bus/pci/devices/*; do if [ -e ${x}/modalias ]; then @@ -125,11 +161,6 @@ load_modules() fi done - # Load the modules - # FIXME - do module options here - if [ -e /conf/modules ]; then - for x in $(cat /conf/modules); do - modprobe -v $x - done - fi + ide_boot_events + } diff --git a/scripts/local b/scripts/local index 99eea77..4a17abb 100644 --- a/scripts/local +++ b/scripts/local @@ -1,4 +1,4 @@ -# Local filesystem mounting +# Local filesystem mounting -*- shell-script -*- # Parameter: Where to mount the filesystem mountroot () diff --git a/scripts/local-top/md b/scripts/local-top/md index 864ffe4..062852f 100644 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -15,4 +15,7 @@ prereqs) ;; esac +# FIXME detect this! +modprobe raid1 + /sbin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index 11c61f8..1e2be2c 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -1,3 +1,4 @@ +# NFS filesystem mounting *- shell-script -*- # Paramter: Where the root should be mounted mountroot () -- cgit v1.2.3 From 2c72958bfc090b046e21e9eaad9134235095ad30 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 30 Jun 2005 00:05:01 +0000 Subject: * Use detailed logging now for debian/changelog. We have at least three people hacking now, and details would probably be useful. * debian/TODO: Update * debian/dirs: Sort and add usr/share/initramfs-tools/hooks * debian/initramfs-tools.examples: Add docs/example_hook and docs/example_hook_cpiogz * debian/initramfs-tools.install: Pretty Print. * debian/rules: Ensure that mkinitramfs is executable * docs/example_script: New file * init: Add concept of 'quiet', be verbose if not specified * mkinitramfs: Do not load script functions until needed Clear up comments / documentation Use DESTDIR instead of TMPDIR Add ability to link in extra hunks into the cpio file Cosmetic cleanups * scripts/functions: Add lsb stype log_FOO_msg functions * scripts/local: Add logging * scripts/nfs: Add logging --- debian/TODO | 2 + debian/changelog | 39 +++++++++++++++ debian/dirs | 9 ++-- debian/initramfs-tools.examples | 2 + debian/initramfs-tools.install | 8 +-- debian/rules | 2 +- docs/example_script | 73 ++++++++++++++++++++++++++- mkinitramfs | 106 +++++++++++++++++++++++----------------- scripts/functions | 39 ++++++++++++++- scripts/local | 8 +++ scripts/nfs | 10 +++- 11 files changed, 240 insertions(+), 58 deletions(-) (limited to 'scripts') diff --git a/debian/TODO b/debian/TODO index bf7e07d..d080de3 100644 --- a/debian/TODO +++ b/debian/TODO @@ -1,6 +1,8 @@ TODO ==== + o Grep for TODO and FIXME and do those. =) + o Get udev compiled against klibc o Integrate hotplug-ng diff --git a/debian/changelog b/debian/changelog index 54d3fcd..6c37206 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +initramfs-tools (0.13) breezy; urgency=low + + "We live in age when unnecessary things are our only necessities." + - Oscar Wilde + + * Use detailed logging now for debian/changelog. We have at least + three people hacking now, and details would probably be useful. + + * debian/TODO: Update + + * debian/dirs: Sort and add usr/share/initramfs-tools/hooks + + * debian/initramfs-tools.examples: Add docs/example_hook and + docs/example_hook_cpiogz + + * debian/initramfs-tools.install: Pretty Print. + + * debian/rules: Ensure that mkinitramfs is executable + + * docs/example_script: New file + + * init: Add concept of 'quiet', be verbose if not specified + + * mkinitramfs: Do not load script functions until needed + Clear up comments / documentation + Use DESTDIR instead of TMPDIR + Add ability to link in extra hunks into the cpio file + Cosmetic cleanups + + * scripts/functions: Add lsb stype log_FOO_msg functions + + * scripts/local: Add logging + + * scripts/nfs: Add logging + + Thanks to Karl Hegbloom for most of these patches! + + -- Jeff Bailey Wed, 29 Jun 2005 23:50:56 +0000 + initramfs-tools (0.12) breezy; urgency=low "I am not young enough to know everything." - Oscar Wilde diff --git a/debian/dirs b/debian/dirs index 94484bb..ac6210e 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,9 +1,10 @@ etc/mkinitramfs/init-bottom etc/mkinitramfs/init-top -etc/mkinitramfs/local-top -etc/mkinitramfs/local-premount etc/mkinitramfs/local-bottom -etc/mkinitramfs/nfs-top -etc/mkinitramfs/nfs-premount +etc/mkinitramfs/local-premount +etc/mkinitramfs/local-top etc/mkinitramfs/nfs-bottom +etc/mkinitramfs/nfs-premount +etc/mkinitramfs/nfs-top +usr/share/initramfs-tools/hooks usr/share/initramfs-tools/modules.d diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples index 0e8472b..9f67297 100644 --- a/debian/initramfs-tools.examples +++ b/debian/initramfs-tools.examples @@ -1,2 +1,4 @@ conf/modules docs/example_script +docs/example_hook +docs/example_hook_cpiogz diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index e76186f..a2a78f5 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -1,4 +1,4 @@ -mkinitramfs usr/sbin -init usr/share/initramfs-tools -scripts usr/share/initramfs-tools -conf/initramfs.conf etc/mkinitramfs +mkinitramfs usr/sbin +init usr/share/initramfs-tools +scripts usr/share/initramfs-tools +conf/initramfs.conf etc/mkinitramfs diff --git a/debian/rules b/debian/rules index 0a1575f..a1b8695 100644 --- a/debian/rules +++ b/debian/rules @@ -3,4 +3,4 @@ include /usr/share/cdbs/1/rules/debhelper.mk common-build-arch:: - chmod +x init + chmod +x init mkinitramfs diff --git a/docs/example_script b/docs/example_script index 111b0d8..221c888 100644 --- a/docs/example_script +++ b/docs/example_script @@ -1,7 +1,52 @@ #!/bin/sh -# List the soft prerequisites here. So if there's something you know -# should be run first iff it exists. +# +# 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. +# + +# +# 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() @@ -18,4 +63,28 @@ prereqs) esac # Do the work here. + 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/mkinitramfs b/mkinitramfs index 4dabfce..c05fa47 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,12 +1,9 @@ #!/bin/sh -# For dependency ordered mkinitramfs hook scripts. -. /usr/share/initramfs-tools/scripts/functions - -# Takes a file containing a list of modules to be added as an argument -# Figures out dependancies and adds it in. +# Takes a file containing a list of modules to be added as an +# argument, figures out dependancies, and adds them. # -# File syntax: +# Input file syntax: # # # comment # modprobe_module_name [args ...] @@ -22,13 +19,13 @@ manual_add_modules() sed -e '/^#/d' ${1} | while read module rest; do for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do # Prune duplicates - if [ -e ${TMPDIR}/${y} ]; then + if [ -e ${DESTDIR}/${y} ]; then continue fi - mkdir -p ${TMPDIR}/$(dirname ${y}) - ln -s ${y} ${TMPDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules + mkdir -p ${DESTDIR}/$(dirname ${y}) + ln -s ${y} ${DESTDIR}/$(dirname ${y}) + echo $(basename ${y} .ko) "${rest}" >>${DESTDIR}/conf/modules done done } @@ -36,7 +33,7 @@ manual_add_modules() # Copy entire subtrees to the initramfs copy_modules_dir() { - tmpdir_modbase=${TMPDIR}/lib/modules/${version} + tmpdir_modbase=${DESTDIR}/lib/modules/${version} mkdir -p $(dirname ${tmpdir_modbase}/${1}) cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1} } @@ -64,13 +61,13 @@ auto_add_modules() for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates - if [ -e ${TMPDIR}/${y} ]; then + if [ -e ${DESTDIR}/${y} ]; then continue fi - mkdir -p ${TMPDIR}/$(dirname ${y}) - ln -s ${y} ${TMPDIR}/$(dirname ${y}) - depmod -b ${TMPDIR} ${version} + mkdir -p ${DESTDIR}/$(dirname ${y}) + ln -s ${y} ${DESTDIR}/$(dirname ${y}) + depmod -b ${DESTDIR} ${version} done done } @@ -96,6 +93,8 @@ EOF # Defaults keep="n" CONFDIR="/etc/mkinitramfs" +verbose="n" +errors_to="2>/dev/null" while getopts "d:ko:r:" flag; do case $flag in @@ -117,6 +116,9 @@ done shift $((${OPTIND} - 1)) +# For dependency ordered mkinitramfs hook scripts. +. /usr/share/initramfs-tools/scripts/functions + . ${CONFDIR}/initramfs.conf if [ x${outfile} = x ]; then @@ -157,10 +159,21 @@ if [ ! -e /lib/modules/${version} ]; then exit 1 fi -TMPDIR=$(mktemp -d) || exit 1 -mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc -mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts -mkdir -p ${TMPDIR}/sbin +DESTDIR=$(mktemp -t -d mkinitramfs_XXXXXX) || exit 1 +__TMPCPIOGZ=$(mktemp -t mkinitramfs-OL_XXXXXX) || exit 1 + +# Export environment for hook scripts. +# +export version +export CONFDIR +export DESTDIR + +# Private, used by 'catenate_cpiogz'. +export __TMPCPIOGZ + +for d in bin conf etc lib modules sbin scripts; do + mkdir -p ${DESTDIR}/${d} +done for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do manual_add_modules ${x} @@ -171,46 +184,51 @@ auto_add_modules # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. -ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin -ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib -ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init -cp -a /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts -ln -s ${CONFDIR}/initramfs.conf ${TMPDIR}/conf -ln -s /etc/udev ${TMPDIR}/etc +ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin +ln -s /usr/lib/klibc/lib/* ${DESTDIR}/lib +ln -s /usr/share/initramfs-tools/init ${DESTDIR}/init +cp -a /usr/share/initramfs-tools/scripts/* ${DESTDIR}/scripts +ln -s ${CONFDIR}/initramfs.conf ${DESTDIR}/conf +ln -s /etc/udev ${DESTDIR}/etc # Hack until udev is built with klibc -ln -s /sbin/udev ${TMPDIR}/bin -ln -s /sbin/udevstart ${TMPDIR}/bin -ln -s /lib/libc.so.* ${TMPDIR}/lib -ln -s /lib/ld*.so.* ${TMPDIR}/lib -rm ${TMPDIR}/lib/*lsb* +ln -s /sbin/udev ${DESTDIR}/bin +ln -s /sbin/udevstart ${DESTDIR}/bin +ln -s /lib/libc.so.* ${DESTDIR}/lib +ln -s /lib/ld*.so.* ${DESTDIR}/lib +rm ${DESTDIR}/lib/*lsb* # Busybox -rm ${TMPDIR}/bin/sh -ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/sh +rm ${DESTDIR}/bin/sh +ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/sh # This is ugly, but needed atm to make the builtins work =( -ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox +ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/busybox # Modutils -ln -s /sbin/modprobe ${TMPDIR}/sbin -ln -s /sbin/depmod ${TMPDIR}/sbin -ln -s /sbin/rmmod ${TMPDIR}/sbin -mkdir -p ${TMPDIR}/etc/modprobe.d -ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d +ln -s /sbin/modprobe ${DESTDIR}/sbin +ln -s /sbin/depmod ${DESTDIR}/sbin +ln -s /sbin/rmmod ${DESTDIR}/sbin +mkdir -p ${DESTDIR}/etc/modprobe.d +ln -s /etc/modprobe.d/aliases ${DESTDIR}/etc/modprobe.d # Raid -ln -s /sbin/mdadm ${TMPDIR}/sbin -ln -s /sbin/mdrun ${TMPDIR}/sbin +ln -s /sbin/mdadm ${DESTDIR}/sbin +ln -s /sbin/mdrun ${DESTDIR}/sbin run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks -# FIXME catenate extra cpio.gz here >>${outfile} +(cd ${DESTDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) -(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) +if [ -s ${__TMPCPIOGZ} ]; then + cat ${__TMPCPIOGZ} >>${outfile} +fi if [ "${keep}" = "y" ]; then - echo "Working files in ${TMPDIR}" + echo "Working files in ${DESTDIR} and overlay in ${__TMPCPIOGZ}" else - rm -rf "${TMPDIR}" + rm -rf "${DESTDIR}" + rm -rf "${__TMPCPIOGZ}" fi + +exit 0 diff --git a/scripts/functions b/scripts/functions index 5fb8c04..1899a14 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,9 +1,45 @@ # -*- shell-script -*- +_log_msg() +{ + if [ "$quiet" = "y" ]; then return; fi + echo "$@" +} + +log_success_msg() +{ + _log_msg "Success: $@" +} + +log_failure_msg() +{ + _log_msg "Failure: $@" +} + +log_warning_msg() +{ + _log_msg "Warning: $@" +} + +log_begin_msg() +{ + _log_msg "Begin: $@ ..." +} + +log_end_msg() +{ + _log_msg "Done." +} + +# update_progress() # ToDo: NOP placeholder... what else for usplash? +# { +# : +# } + panic() { echo $@ - FS1='(initramfs) ' exec /bin/sh + FS1='(initramfs) ' exec /bin/sh /dev/console 2>&1 } render() @@ -162,5 +198,4 @@ load_modules() done ide_boot_events - } diff --git a/scripts/local b/scripts/local index 4a17abb..bcc96ad 100644 --- a/scripts/local +++ b/scripts/local @@ -3,7 +3,9 @@ # Parameter: Where to mount the filesystem mountroot () { + log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top + log_end_msg # Get the root filesystem type if [ ! -e ${ROOT} ]; then @@ -12,7 +14,9 @@ mountroot () eval $(fstype < ${ROOT}) + log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount + log_end_msg if [ ${readonly} = y ]; then roflag=-r @@ -20,10 +24,14 @@ mountroot () roflag=-w fi + # FIXME This has no error checking modprobe ${FSTYPE} + # FIXME This has no error checking # Mount root mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} + log_begin_msg "Running /scripts/log-bottom" run_scripts /scripts/local-bottom + log_end_msg } diff --git a/scripts/nfs b/scripts/nfs index 1e2be2c..8149e86 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -1,9 +1,13 @@ -# NFS filesystem mounting *- shell-script -*- +# NFS filesystem mounting -*- shell-script -*- + +# FIXME This needs error checking # Paramter: Where the root should be mounted mountroot () { + log_begin_msg "Running /scripts/nfs-top" run_scripts /scripts/nfs-top + log_end_msg modprobe nfs # For DHCP @@ -15,7 +19,9 @@ mountroot () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi + log_begin_msg "Running /scripts/nfs-premount" run_scripts /scripts/nfs-premount + log_end_msg if [ ${readonly} = y ]; then roflag="-o ro" @@ -25,6 +31,8 @@ mountroot () nfsmount ${roflag} ${NFSROOT} ${rootmnt} + log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom + log_end_msg } -- cgit v1.2.3 From 38f6779d4a0aa081412b154bd7cd88ed005678af Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 15 Jul 2005 02:40:59 +0000 Subject: Add lvm support, update control --- debian/changelog | 17 ++++++++ debian/control | 9 +++- mkinitramfs | 125 +++++++++++++++++++++++++++++++----------------------- scripts/functions | 2 + 4 files changed, 97 insertions(+), 56 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 6c37206..ac451da 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,23 @@ initramfs-tools (0.13) breezy; urgency=low Thanks to Karl Hegbloom for most of these patches! + * debian/control: Get a much better description + + Thanks to Maximilian Attems for this! + + * scripts/functions: Add copy_exec function that copies a program + and all libraries that it depends on. + + * mkinitramfs: Use it + + * scripts/local-top/lvm: New file + + * mkinitramfs: Specify the modules to copy rather than mass copying + directories + + * scripts/functions: Always load ide-generic to cope with ide subsystem + suckage. + -- Jeff Bailey Wed, 29 Jun 2005 23:50:56 +0000 initramfs-tools (0.12) breezy; urgency=low diff --git a/debian/control b/debian/control index 7222e98..514368c 100644 --- a/debian/control +++ b/debian/control @@ -8,5 +8,10 @@ Standards-Version: 3.6.1 Package: initramfs-tools Architecture: all Depends: klibc-utils, busybox-cvs-initramfs, mdadm -Description: tools for generting an Ubuntu-style initramfs - This package generates an initramfs for an Ubuntu system. +Description: tools for generating an initramfs + This package contains tools to create and boot an initramfs for prepackaged + 2.6 Linux kernel. The initramfs is an cpio archive. At boot time, the kernel + unpacks that archive into ram, mounts and uses it as initial root file system. + From there on the mounting of the real root file system occurs in user space. + klibc handles the boot-time networking setup. Supports nfs root system. + Any boot loader with initrd support is able to load an initramfs archive. diff --git a/mkinitramfs b/mkinitramfs index c05fa47..cbc1f82 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -9,7 +9,7 @@ # modprobe_module_name [args ...] # [...] # -manual_add_modules() +add_modules_from_file() { # Sanity check if [ ! -e ${1} ]; then @@ -17,16 +17,42 @@ manual_add_modules() fi sed -e '/^#/d' ${1} | while read module rest; do - for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do - # Prune duplicates - if [ -e ${DESTDIR}/${y} ]; then - continue - fi - - mkdir -p ${DESTDIR}/$(dirname ${y}) - ln -s ${y} ${DESTDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) "${rest}" >>${DESTDIR}/conf/modules - done + manual_add_modules ${module} + echo ${module}.ko "${rest}" >>${DESTDIR}/conf/modules + done +} + +manual_add_modules() +{ + for mam_x in $(modprobe --set-version=${version} --show-depends ${1} | awk '{ print $2 }'); do + # Prune duplicates + if [ -e ${DESTDIR}/${mam_x} ]; then + continue + fi + + mkdir -p ${DESTDIR}/$(dirname ${mam_x}) + ln -s ${mam_x} ${DESTDIR}/$(dirname ${mam_x}) + depmod -b ${DESTDIR} ${version} + done +} + +# $1 is source +# $2 is relative destination +copy_exec() { + ln -s ${1} ${DESTDIR}/${2} + + # Copy the dependant libraries + for x in $(ldd ${1} 2>/dev/null | sed -e ' + /\//!d; + /linux-gate/d; + /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; + s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do + libname=$(basename ${x}) + dirname=$(dirname ${x}) + mkdir -p ${DESTDIR}/${dirname} + if [ ! -e ${DESTDIR}/${dirname}/${libname} ]; then + ln -s ${x} ${DESTDIR}/${dirname} + fi done } @@ -41,35 +67,26 @@ copy_modules_dir() # Modules that we always add to the initramfs auto_add_modules() { - copy_modules_dir kernel/drivers/net - copy_modules_dir kernel/drivers/scsi - copy_modules_dir kernel/drivers/ide - copy_modules_dir kernel/drivers/md - copy_modules_dir kernel/drivers/usb - copy_modules_dir kernel/drivers/block - copy_modules_dir kernel/drivers/input - copy_modules_dir kernel/fs/ext2 - copy_modules_dir kernel/fs/ext3 - copy_modules_dir kernel/fs/isofs - copy_modules_dir kernel/fs/jbd - copy_modules_dir kernel/fs/jfs - copy_modules_dir kernel/fs/nfs - copy_modules_dir kernel/fs/reiserfs - copy_modules_dir kernel/fs/xfs - - # These aren't caught by the above but really need to be there: - for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do - for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do - # Prune duplicates - if [ -e ${DESTDIR}/${y} ]; then - continue - fi - - mkdir -p ${DESTDIR}/$(dirname ${y}) - ln -s ${y} ${DESTDIR}/$(dirname ${y}) - depmod -b ${DESTDIR} ${version} - done + # base + for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do + manual_add_modules ${x} + done + + # Ethernet + for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do + manual_add_modules ${x} + done + + # ide + for x in ide-cd ide-disk ide-generic aec62xx cmd64x generic hpt34x hpt366 ns87415 pdc202xx_new pdc202xx_old piix sc1200 siimage slc82c105 trm290 via82cxxx; do + manual_add_modules ${x} + done + + # scsi + for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx atp870u BusLogic ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips lpfc mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do + manual_add_modules ${x} done + } usage() @@ -176,7 +193,7 @@ for d in bin conf etc lib modules sbin scripts; do done for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do - manual_add_modules ${x} + add_modules_from_file ${x} done auto_add_modules @@ -186,17 +203,14 @@ auto_add_modules ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /usr/lib/klibc/lib/* ${DESTDIR}/lib -ln -s /usr/share/initramfs-tools/init ${DESTDIR}/init +copy_exec /usr/share/initramfs-tools/init /init cp -a /usr/share/initramfs-tools/scripts/* ${DESTDIR}/scripts -ln -s ${CONFDIR}/initramfs.conf ${DESTDIR}/conf -ln -s /etc/udev ${DESTDIR}/etc +copy_exec ${CONFDIR}/initramfs.conf /conf +cp -a /etc/udev ${DESTDIR}/etc # Hack until udev is built with klibc -ln -s /sbin/udev ${DESTDIR}/bin -ln -s /sbin/udevstart ${DESTDIR}/bin -ln -s /lib/libc.so.* ${DESTDIR}/lib -ln -s /lib/ld*.so.* ${DESTDIR}/lib -rm ${DESTDIR}/lib/*lsb* +copy_exec /sbin/udev /sbin +copy_exec /sbin/udevstart /sbin # Busybox rm ${DESTDIR}/bin/sh @@ -205,15 +219,18 @@ ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/sh ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/busybox # Modutils -ln -s /sbin/modprobe ${DESTDIR}/sbin -ln -s /sbin/depmod ${DESTDIR}/sbin -ln -s /sbin/rmmod ${DESTDIR}/sbin +copy_exec /sbin/modprobe /sbin +copy_exec /sbin/depmod /sbin +copy_exec /sbin/rmmod /sbin mkdir -p ${DESTDIR}/etc/modprobe.d -ln -s /etc/modprobe.d/aliases ${DESTDIR}/etc/modprobe.d +copy_exec /etc/modprobe.d/aliases /etc/modprobe.d # Raid -ln -s /sbin/mdadm ${DESTDIR}/sbin -ln -s /sbin/mdrun ${DESTDIR}/sbin +copy_exec /sbin/mdadm /sbin +copy_exec /sbin/mdrun /sbin + +# LVM +copy_exec /lib/lvm-200/vgchange /sbin run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks diff --git a/scripts/functions b/scripts/functions index 1899a14..d4e9ece 100644 --- a/scripts/functions +++ b/scripts/functions @@ -199,3 +199,5 @@ load_modules() ide_boot_events } + + -- cgit v1.2.3 From ec6a1979e3dab46996ebb1601cf892f24b1fc7e4 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 15 Jul 2005 02:41:15 +0000 Subject: Add lvm support, update control --- scripts/local-top/lvm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/local-top/lvm (limited to 'scripts') diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm new file mode 100644 index 0000000..8fcb234 --- /dev/null +++ b/scripts/local-top/lvm @@ -0,0 +1,18 @@ +#!/bin/sh + +PREREQ="md" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +vgchange -ay -- cgit v1.2.3 From 9ba23f790a81b3e5f017e1a293e16e593ff9ccc9 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 27 Jul 2005 00:45:18 -0400 Subject: initramfs-tools (0.14) breezy; urgency=low The --- scripts/functions | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index d4e9ece..cf9f4a7 100644 --- a/scripts/functions +++ b/scripts/functions @@ -144,14 +144,17 @@ run_scripts() } ide_boot_events() { - [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return + [ -e /proc/ide ] || return - for drive in /proc/ide/*/media; do + modprobe -q ide-generic + + for drive in /proc/ide/*; do + [ -e ${drive}/media ] || continue # nothing to do if the device has already been took in charge - unit=${drive#/proc/ide/}; unit=${unit%/media} + unit=${drive#/proc/ide/} [ -d /sys/block/$unit ] && continue - read media < $drive + read media < $drive/media case "$media" in disk) MODULE=ide-disk ;; cdrom) MODULE=ide-cd ;; @@ -164,6 +167,20 @@ ide_boot_events() { done } +scsi_boot_events() +{ + [ -e /sys/bus/scsi/devices/ ] || return + + for device in /sys/bus/scsi/devices/*; do + read media < ${device}/type + case "$media" in + 0) modprobe -q sd_mod; + esac + + done + +} + load_modules() { depmod -a @@ -198,6 +215,8 @@ load_modules() done ide_boot_events + + scsi_boot_events } -- cgit v1.2.3 From 3a6236e7ba7a060a4daddce8569633763c549412 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 27 Jul 2005 00:45:30 -0400 Subject: initramfs-tools (0.14) breezy; urgency=low The --- scripts/local-top/lvm | 8 +++++++- scripts/local-top/md | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 8fcb234..4f199de 100644 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -15,4 +15,10 @@ prereqs) ;; esac -vgchange -ay +vg=$(echo ${ROOT} | sed -e 's#/dev/mapper/\(.*\)-.*#\1#') + +[ x${vg} != x ] || return + +modprobe -q dm-mod + +vgchange -ay ${vg} diff --git a/scripts/local-top/md b/scripts/local-top/md index 062852f..48c3ce6 100644 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -15,7 +15,14 @@ prereqs) ;; esac -# FIXME detect this! -modprobe raid1 +unset raidlvl + +# Detect raid level +for x in /dev/hd* /dev/sd*; do + raidlvl=$(mdadm --examine ${x} | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') + modprobe -q ${raidlvl} +done + +[ x${raidlvl} != x ] || return /sbin/mdrun /dev -- cgit v1.2.3 From 618760b004d07efb11f05e57d46ed4b5adb2823c Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Tue, 16 Aug 2005 13:34:13 -0400 Subject: Cleanup commit, sorry for the mess --- conf/initramfs.conf | 9 ++- debian/TODO | 2 + debian/changelog | 99 +++++++++++++++++++++++++++++- debian/control | 4 +- debian/dirs | 1 - debian/initramfs-tools.install | 2 + debian/initramfs-tools.postinst | 22 +++++++ debian/initramfs-tools.postrm | 2 +- debian/rules | 2 +- hook-functions | 133 ++++++++++++++++++++++++++++++++++++++++ init | 4 ++ mkinitramfs | 122 +++++------------------------------- scripts/functions | 16 ++++- scripts/local-top/md | 9 ++- 14 files changed, 307 insertions(+), 120 deletions(-) (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index a056469..b4a7dba 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -7,7 +7,7 @@ # Use busybox if available. You MUST use the -static version # -BUSYBOX=n +BUSYBOX=y # # BOOT: [ local | nfs ] @@ -28,7 +28,7 @@ BOOT=local # # list - Only include modules from the 'additional modules' list # -MODULES=list +MODULES=most # # NFS Section of the config. @@ -48,3 +48,8 @@ DEVICE=eth0 NFSROOT=auto +# Hardcode partition to resume from so it doesn't have to be specified +# on the command line. The command line will override this setting. + +#RESUME= + diff --git a/debian/TODO b/debian/TODO index 7c6bc55..58f35fd 100644 --- a/debian/TODO +++ b/debian/TODO @@ -16,3 +16,5 @@ TODO o Trace lilo bug o Capture udev events and pass them to udevsend + + o Detect RESUME partition diff --git a/debian/changelog b/debian/changelog index 06f40e3..11f476c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,98 @@ +initramfs-tools (0.19) breezy; urgency=low + + "The basis of optimism is sheer terror." + - Oscar Wilde + + * mkinitramfs: Honour MODULES=list and MODULES=dep. + + * hook-functions: New function dep_add_modules. + + -- Jeff Bailey Wed, 10 Aug 2005 23:20:11 -0400 + +initramfs-tools (0.18) breezy; urgency=low + + "We are all in the gutter, but some of us are looking at the stars." + - Oscar Wilde + + * debian/initramfs-tools.postrm: Use rm -f for removing the modules + file, in case it doesn't exist for some reason. (Ubuntu #13335) + Thanks to Colin Watson for the bug report! + + * mkinitramfs.8: Correct my email address to be jbailey@ubuntu.com + Document /etc/mkinitramfs/DSDT.aml + + * debian/initramfs-tools.postinst: Attempt to inherit RESUME settings + from initrd-tools. Also copy the DSDT from /etc/mkinitrd/DSDT to + /etc/mkinitramfs/DSDT.aml + + -- Jeff Bailey Wed, 10 Aug 2005 13:09:44 -0400 + +initramfs-tools (0.17) breezy; urgency=low + + "The public is wonderfully tolerant. It forgives everything except + genius." + - Oscar Wilde + + * debian/initramfs-tools.postinst: Get the name of the config file + right when seeding RESUME=. Also fix the sed expression. + Thanks to Matthew Garrett for noticing this! + + -- Jeff Bailey Wed, 10 Aug 2005 11:54:07 -0400 + +initramfs-tools (0.16) breezy; urgency=low + + "It is through art, and through art only, that we can realise our + perfection." + - Oscar Wilde + + * mkinitramfs: Make sure all relevant ide modules are included. + Add RESUME= support. + + * scripts/functions: Be silent when adding non-detected modules. + + * conf/mkinitramfs.conf: MODULES=most by default, BUSYBOX=y + (Non-busybox isn't supported now. It's not clear that it ever + will be). Add RESUME line for resuming from suspend-to-disk. + + * scripts/local-premount/suspend: New script for suspend-to-disk. + + * debian/control: Bump depends on busybox-cvs-initramfs to + 20040623-1ubuntu19. Add dependancy on lvm2. + Bump standards version to 3.6.2.0 (no-op) + + * debian/control: + Force version depend on lvm2 (>= 2.01.04-5) to make sure newer kernels + will boot. + Thanks for Andrew Mitchell for discovering this. + + * hooks/: New directory + + * debian/dirs: Move hooks to ... + * debian/initramfs-tools.install: ... here. + + * hooks/acpid: New file. + + * scripts/init-premount/acpid: New file + Thanks for the hint from Matthew Garrett for this. + + * debian/initramfs-tools.postinst: Add RESUME support on first install. + + * debian/mkinitramfs: Move functions to ... + * debian/hook-functions: ... here. + + * debian/initramfs-tools.install: Install hook-functions + + * mkinitramfs.8: New file. + Thanks to Maximilian Attems for contributing this! + + * scripts/local-top/md: Don't try to detect raid on non-existant devices + or on whole devices. Quiet other warning messages. + + * hook-functions: When generating initramfs, don't complain about missing + modules. + + -- Jeff Bailey Tue, 9 Aug 2005 23:35:08 -0400 + initramfs-tools (0.15) breezy; urgency=low "Nothing looks so like innocence as an indiscretion." @@ -12,7 +107,9 @@ initramfs-tools (0.15) breezy; urgency=low * debian/dirs: Make the /etc version of this directory for user addons. - -- Jeff Bailey Fri, 5 Aug 2005 11:39:26 -0400 + * debian/rules: Use prebuild, rather than debian-build-arch. + + -- Jeff Bailey Tue, 9 Aug 2005 11:29:10 -0400 initramfs-tools (0.14) breezy; urgency=low diff --git a/debian/control b/debian/control index 514368c..1c1a6b2 100644 --- a/debian/control +++ b/debian/control @@ -3,11 +3,11 @@ Section: utils Priority: optional Maintainer: Jeff Bailey Build-Depends-Indep: debhelper (>= 4.0.0), cdbs -Standards-Version: 3.6.1 +Standards-Version: 3.6.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils, busybox-cvs-initramfs, mdadm +Depends: klibc-utils, busybox-cvs-initramfs (>= 20040623-1ubuntu19), mdadm, lvm2 (>= 2.01.04-5) Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged 2.6 Linux kernel. The initramfs is an cpio archive. At boot time, the kernel diff --git a/debian/dirs b/debian/dirs index 6de384e..d35ba7c 100644 --- a/debian/dirs +++ b/debian/dirs @@ -7,5 +7,4 @@ etc/mkinitramfs/local-top etc/mkinitramfs/nfs-bottom etc/mkinitramfs/nfs-premount etc/mkinitramfs/nfs-top -usr/share/initramfs-tools/hooks usr/share/initramfs-tools/modules.d diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index a2a78f5..8702d53 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -2,3 +2,5 @@ mkinitramfs usr/sbin init usr/share/initramfs-tools scripts usr/share/initramfs-tools conf/initramfs.conf etc/mkinitramfs +hooks usr/share/initramfs-tools +hook-functions usr/share/initramfs-tools diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index 70be9f6..ea92067 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -2,6 +2,28 @@ set -e +if [ "$1" = configure ]; then + if [ x${2} = x ]; then + + # First time install. Can we autodetect the RESUME partition? + RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ') + + # Inhertic initrd-tools settings if possible. + if [ -e /etc/mkinitrd/mkinitrd.conf ]; then + . /etc/mkinitrd/mkinitrd.conf + fi + + if [ -e ${RESUME} ]; then + sed -i -e "s@#RESUME=@RESUME=${RESUME}@" /etc/mkinitramfs/initramfs.conf + fi + + if [ -e /etc/mkinitrd/DSDT ]; then + cp /etc/mkinitrd/DSDT /etc/mkinitramfs/DSDT.aml + fi + + fi +fi + if [ ! -e /etc/mkinitramfs/modules ]; then cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/ fi diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm index 7bea06f..2af9945 100644 --- a/debian/initramfs-tools.postrm +++ b/debian/initramfs-tools.postrm @@ -1,7 +1,7 @@ #!/bin/sh if [ "x${1}" = "xpurge" ]; then - rm /etc/mkinitramfs/modules + rm -f /etc/mkinitramfs/modules fi #DEBHELPER# diff --git a/debian/rules b/debian/rules index a1b8695..6b91c1f 100644 --- a/debian/rules +++ b/debian/rules @@ -2,5 +2,5 @@ include /usr/share/cdbs/1/rules/debhelper.mk -common-build-arch:: +pre-build:: chmod +x init mkinitramfs diff --git a/hook-functions b/hook-functions index 0d79703..5db7d27 100644 --- a/hook-functions +++ b/hook-functions @@ -4,3 +4,136 @@ catenate_cpiogz() { cat "$1" >>${__TMPCPIOGZ} } +add_modules_from_file() +{ + # Sanity check + if [ ! -e ${1} ]; then + return + fi + + sed -e '/^#/d' ${1} | while read module rest; do + manual_add_modules ${module} + echo ${module}.ko "${rest}" >>${DESTDIR}/conf/modules + done +} + +manual_add_modules() +{ + for mam_x in $(modprobe --set-version=${version} --show-depends ${1} 2>/dev/null | awk '{ print $2 }'); do + # Prune duplicates + if [ -e ${DESTDIR}/${mam_x} ]; then + continue + fi + + mkdir -p ${DESTDIR}/$(dirname ${mam_x}) + ln -s ${mam_x} ${DESTDIR}/$(dirname ${mam_x}) + depmod -b ${DESTDIR} ${version} + done +} + +# $1 is source +# $2 is relative destination +copy_exec() { + ln -s ${1} ${DESTDIR}/${2} + + # Copy the dependant libraries + for x in $(ldd ${1} 2>/dev/null | sed -e ' + /\//!d; + /linux-gate/d; + /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; + s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do + libname=$(basename ${x}) + dirname=$(dirname ${x}) + mkdir -p ${DESTDIR}/${dirname} + if [ ! -e ${DESTDIR}/${dirname}/${libname} ]; then + ln -s ${x} ${DESTDIR}/${dirname} + fi + done +} + +# Copy entire subtrees to the initramfs +copy_modules_dir() +{ + tmpdir_modbase=${DESTDIR}/lib/modules/${version} + mkdir -p $(dirname ${tmpdir_modbase}/${1}) + cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1} +} + +dep_add_modules() +{ + + # Things that are too hard to autodetect. + for x in md raid0 raid1 raid5 raid6 ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do + manual_add_modules ${x} + done + + for x in /sys/bus/pci/devices/*; do + if [ -e ${x}/modalias ]; then + manual_add_modules $(cat ${x}/modalias) + fi + done + + # Give the USB bus a moment to catch up + sleep 2 + + for x in /sys/bus/usb/devices/*; do + if [ -e ${x}/modalias ]; then + manual_add_modules $(cat ${x}/modalias) + fi + done + + if [ -e /proc/ide ]; then + for x in ide-generic ide-disk ide-cd; do + manual_add_modules ${x} + done + fi + + if [ -e /sys/bus/scsi/devices/ ]; then + manual_add_modules sd_mod + fi +} + + +# Modules that we always add to the initramfs +auto_add_modules() +{ + # base + for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do + manual_add_modules ${x} + done + + # Ethernet + for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do + manual_add_modules ${x} + done + + # ide + for x in ide-cd ide-disk ide-generic aec62xx alim15x3 amd74xx atuuxo cmd64x cs5520 cs5530 cy82c693 generic hpt34x hpt366 ns87415 pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks siimage sis5513 slc82c105 slc90e66 triflex trm290 via82cxxx; do + manual_add_modules ${x} + done + + # scsi + for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do + manual_add_modules ${x} + done + +} + +usage() +{ + cat >&2 << EOF + +Usage: ${0} [OPTION]... <-o outfile> [version] + +Options: + -d confdir Specify an alternative configuration directory. + -k Keep temporary directory used to make the image. + -o outfile Write to outfile. + -r root Override ROOT setting in mkinitrd.conf. + +See ${0}(8) for further details. +EOF + exit 1 + +} + diff --git a/init b/init index e1fee77..38450da 100644 --- a/init +++ b/init @@ -15,6 +15,7 @@ export init=/sbin/init export quiet=n export readonly=y export ROOT= +export resume=${RESUME} export rootmnt=/root for x in $(cat /proc/cmdline); do case $x in @@ -30,6 +31,9 @@ for x in $(cat /proc/cmdline); do boot=*) BOOT=${x#boot=} ;; + resume=*) + resume=${x#resume=} + ;; quiet) quiet=y ;; diff --git a/mkinitramfs b/mkinitramfs index 8092a14..3257c94 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,112 +1,5 @@ #!/bin/sh -# Takes a file containing a list of modules to be added as an -# argument, figures out dependancies, and adds them. -# -# Input file syntax: -# -# # comment -# modprobe_module_name [args ...] -# [...] -# -add_modules_from_file() -{ - # Sanity check - if [ ! -e ${1} ]; then - return - fi - - sed -e '/^#/d' ${1} | while read module rest; do - manual_add_modules ${module} - echo ${module}.ko "${rest}" >>${DESTDIR}/conf/modules - done -} - -manual_add_modules() -{ - for mam_x in $(modprobe --set-version=${version} --show-depends ${1} | awk '{ print $2 }'); do - # Prune duplicates - if [ -e ${DESTDIR}/${mam_x} ]; then - continue - fi - - mkdir -p ${DESTDIR}/$(dirname ${mam_x}) - ln -s ${mam_x} ${DESTDIR}/$(dirname ${mam_x}) - depmod -b ${DESTDIR} ${version} - done -} - -# $1 is source -# $2 is relative destination -copy_exec() { - ln -s ${1} ${DESTDIR}/${2} - - # Copy the dependant libraries - for x in $(ldd ${1} 2>/dev/null | sed -e ' - /\//!d; - /linux-gate/d; - /=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/}; - s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do - libname=$(basename ${x}) - dirname=$(dirname ${x}) - mkdir -p ${DESTDIR}/${dirname} - if [ ! -e ${DESTDIR}/${dirname}/${libname} ]; then - ln -s ${x} ${DESTDIR}/${dirname} - fi - done -} - -# Copy entire subtrees to the initramfs -copy_modules_dir() -{ - tmpdir_modbase=${DESTDIR}/lib/modules/${version} - mkdir -p $(dirname ${tmpdir_modbase}/${1}) - cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1} -} - -# Modules that we always add to the initramfs -auto_add_modules() -{ - # base - for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do - manual_add_modules ${x} - done - - # Ethernet - for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do - manual_add_modules ${x} - done - - # ide - for x in ide-cd ide-disk ide-generic aec62xx cmd64x generic hpt34x hpt366 ns87415 pdc202xx_new pdc202xx_old piix sc1200 siimage slc82c105 trm290 via82cxxx; do - manual_add_modules ${x} - done - - # scsi - for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx atp870u BusLogic ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips lpfc mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do - manual_add_modules ${x} - done - -} - -usage() -{ - cat >&2 << EOF - -Usage: ${0} [OPTION]... <-o outfile> [version] - -Options: - -d confdir Specify an alternative configuration directory. - -k Keep temporary directory used to make the image. - -o outfile Write to outfile. - -r root Override ROOT setting in mkinitrd.conf. - -See ${0}(8) for further details. -EOF - exit 1 - -} - # Defaults keep="n" CONFDIR="/etc/mkinitramfs" @@ -135,6 +28,7 @@ shift $((${OPTIND} - 1)) # For dependency ordered mkinitramfs hook scripts. . /usr/share/initramfs-tools/scripts/functions +. /usr/share/initramfs-tools/hook-functions . ${CONFDIR}/initramfs.conf @@ -150,6 +44,11 @@ else version="${1}" fi +if dpkg --compare-versions "${version}" lt 2.6.12; then + echo "Kernel version too old. initramfs-tools requires at least 2.6.12." + exit 1 +fi + case ${version} in /lib/modules/*/[!/]*) ;; @@ -192,11 +91,18 @@ for d in bin conf etc lib modules sbin scripts; do mkdir -p ${DESTDIR}/${d} done +# MODULES=list case. Always honour. for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do add_modules_from_file ${x} done -auto_add_modules +if [ "${MODULES}" = "dep" ]; then + dep_add_modules +fi + +if [ "${MODULES}" = "most" ]; then + auto_add_modules +fi # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. diff --git a/scripts/functions b/scripts/functions index cf9f4a7..10918f8 100644 --- a/scripts/functions +++ b/scripts/functions @@ -194,7 +194,7 @@ load_modules() then continue; else - modprobe -v $m + modprobe -q $m fi done fi @@ -219,4 +219,18 @@ load_modules() scsi_boot_events } +parse_numeric() { + case $1 in + *:*) + minor=${1#*:} + major=${1%:*} + ;; + *) + minor=$((0x${1#??})) + major=$((0x${1%??})) + ;; + esac + + mknod /dev/root b ${major} ${minor} +} diff --git a/scripts/local-top/md b/scripts/local-top/md index 48c3ce6..055e109 100644 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -18,9 +18,12 @@ esac unset raidlvl # Detect raid level -for x in /dev/hd* /dev/sd*; do - raidlvl=$(mdadm --examine ${x} | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') - modprobe -q ${raidlvl} +for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do + if [ ! -e ${x} ]; then + continue + fi + raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') + modprobe -q ${raidlvl} 2>/dev/null done [ x${raidlvl} != x ] || return -- cgit v1.2.3 From baab5f5fc3d6cfe4821a82e5b17f0f57bef060b0 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Tue, 16 Aug 2005 13:34:37 -0400 Subject: Cleanup commit, sorry for the mess --- debian/initramfs-tools.manpages | 1 + hooks/acpid | 24 ++++++++++++++ mkinitramfs.8 | 71 +++++++++++++++++++++++++++++++++++++++++ scripts/init-premount/acpid | 19 +++++++++++ scripts/local-premount/suspend | 30 +++++++++++++++++ 5 files changed, 145 insertions(+) create mode 100644 debian/initramfs-tools.manpages create mode 100644 hooks/acpid create mode 100644 mkinitramfs.8 create mode 100644 scripts/init-premount/acpid create mode 100644 scripts/local-premount/suspend (limited to 'scripts') diff --git a/debian/initramfs-tools.manpages b/debian/initramfs-tools.manpages new file mode 100644 index 0000000..61d8057 --- /dev/null +++ b/debian/initramfs-tools.manpages @@ -0,0 +1 @@ +mkinitramfs.8 diff --git a/hooks/acpid b/hooks/acpid new file mode 100644 index 0000000..0f3c84c --- /dev/null +++ b/hooks/acpid @@ -0,0 +1,24 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Hooks for loading acpi bits into the initramfs + +. /usr/share/initramfs-tools/hook-functions + +for x in fan thermal; do + manual_add_modules ${x} +done diff --git a/mkinitramfs.8 b/mkinitramfs.8 new file mode 100644 index 0000000..cc56915 --- /dev/null +++ b/mkinitramfs.8 @@ -0,0 +1,71 @@ +.TH MKINITRAMFS 8 "$Date: 2005/07/15 $" "" "mkinitramfs manual" + +.SH NAME +mkinitramfs \- generate an initramfs image + +.SH SYNOPSIS +.B mkinitramfs +.RB [ \-d +.IR confdir ] +.RB [ \-k ] +.RB [ \-o +.IR outfile ] +.RB [ \-r +.IR root ] +.RI [ version ] +.SH DESCRIPTION +The +.B mkinitramfs +script generates an initramfs image. The initramfs is an cpio archive. +At boot time, the kernel unpacks that archive into ram disk, mounts and +uses it as initial root file system. All finding of the root device +happens in this early userspace. + +.SH OPTIONS +.TP +\fB \-d \fI confdir +Set an alternate configuration directory. + +.TP +\fB \-k +Keep the temporary directory used to make the image. + +.TP +\fB \-o \fI outfile +Write the image to +.IR outfile . + +.TP +\fB \-r \fI root +Override the +.B ROOT +setting in +.IR mkinitramfs.conf . + +.SH FILES +.TP +.I /etc/mkinitramfs/initramfs.conf +The default configuration file for the script. See +.BR initramfs.conf (8) +for a description of the available configuration parameter. + +.TP +.I /etc/mkinitramfs/modules +Specified modules will be put in the generated image and loaded when the system boots. The format - one per line - is identical to that of +.I /etc/modules, +which is described in +.BR modules (5). + +.TP +.I /etc/mkinitramfs/DSDT.aml +If this file exists, it will be appended to the initramfs in a way that causes +it to be loaded by ACPI. + + +.SH AUTHOR +The initramfs-tools are written by Jeff Bailey . +This manual is maintained by Maximilian Attems . + +.SH SEE ALSO + +.BR initramfs.conf (8) diff --git a/scripts/init-premount/acpid b/scripts/init-premount/acpid new file mode 100644 index 0000000..61d226a --- /dev/null +++ b/scripts/init-premount/acpid @@ -0,0 +1,19 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +modprobe -q fan +modprobe -q thermal diff --git a/scripts/local-premount/suspend b/scripts/local-premount/suspend new file mode 100644 index 0000000..5791123 --- /dev/null +++ b/scripts/local-premount/suspend @@ -0,0 +1,30 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +if [ "x${resume}" = "x" ]; then + exit +fi + +if [ ! -e ${resume} ]; then + exit +fi + +if [ -e /sys/power/resume ]; then + major=$((0x$(stat -c%t ${resume}))) + minor=$((0x$(stat -c%T ${resume}))) + echo ${major}:${minor} >/sys/power/resume +fi -- cgit v1.2.3 From f0a04306ac01b22e80cbd1d2a7578a1a3efa6e5f Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 25 Aug 2005 16:21:19 -0400 Subject: initramfs-tools (0.23) breezy; urgency=low "This suspense is terrible. I hope it will last." - Oscar Wilde * scripts/local: Quote ${ROOT} so that an empty value causes us to drop to a shell. Thanks to Matt Zimmerman for this fix! - hook-functions (auto_add_modules): Add atiixp and opti621 to the IDE set. - hook-functions (dep_add_modules): Detect i2o and add i2o_block (auto_add_modules): Include i2o_block. - scripts/functions (i2o_boot_events): New function (load_modules): Call it. (Ubuntu# 13806) Thanks to Tollef Fog Heen for the i2o patch! - debian/control: Depend on udev. Thanks to Alexander Butenko for troubleshooting this with me. - init: Move the /dev directory to the root filesystem. Handle all the udev bind mounts as needed. Make sure input and output is associated with dev/console. - scripts/functions (parse_numeric): Exit if we're refering to a path. Otherwise override root setting to be /dev/root. - init: Call parse_numeric when setting the root variable. - scripts/local-top/lvm: When using a numeric root, call vgchange -ay Don't attempt to start LVM on regular partitions. (Ubuntu #13365, #13778, and some of #13399) - scripts/local-top/lvm: Cope with -'s in the Volume Group and logical volume names. (Ubuntu #13387) Thanks to Stephen Shirley for the patch! -- Jeff Bailey Thu, 25 Aug 2005 11:48:15 -0400 initramfs-tools (0.22) breezy; urgency=low * Fix argument handling in force_load hook-function * Add "sleep 3" to scripts/nfs as a nasty hack around bug #12942 -- Matt Zimmerman Fri, 19 Aug 2005 23:50:16 -0700 --- debian/changelog | 48 ++++++++++++++++++++++++++++++++++++++++- debian/control | 2 +- debian/initramfs-tools.postinst | 1 + hook-functions | 13 +++++++++-- init | 12 ++++++++++- scripts/functions | 15 +++++++++++++ scripts/local | 2 +- scripts/local-top/lvm | 17 ++++++++++++--- scripts/nfs | 1 + 9 files changed, 102 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index aaa2dba..09bc345 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,49 @@ +initramfs-tools (0.23) breezy; urgency=low + + "This suspense is terrible. I hope it will last." + - Oscar Wilde + + * scripts/local: Quote ${ROOT} so that an empty value causes us + to drop to a shell. + Thanks to Matt Zimmerman for this fix! + + - hook-functions (auto_add_modules): Add atiixp and opti621 to + the IDE set. + + - hook-functions (dep_add_modules): Detect i2o and add i2o_block + (auto_add_modules): Include i2o_block. + + - scripts/functions (i2o_boot_events): New function + (load_modules): Call it. (Ubuntu# 13806) + Thanks to Tollef Fog Heen for the i2o patch! + + - debian/control: Depend on udev. + Thanks to Alexander Butenko for troubleshooting this with me. + + - init: Move the /dev directory to the root filesystem. + Handle all the udev bind mounts as needed. + Make sure input and output is associated with dev/console. + + - scripts/functions (parse_numeric): Exit if we're refering to a path. + Otherwise override root setting to be /dev/root. + - init: Call parse_numeric when setting the root variable. + - scripts/local-top/lvm: When using a numeric root, call vgchange -ay + Don't attempt to start LVM on regular partitions. + (Ubuntu #13365, #13778, and some of #13399) + + - scripts/local-top/lvm: Cope with -'s in the Volume Group and + logical volume names. (Ubuntu #13387) + Thanks to Stephen Shirley for the patch! + + -- Jeff Bailey Thu, 25 Aug 2005 11:48:15 -0400 + +initramfs-tools (0.22) breezy; urgency=low + + * Fix argument handling in force_load hook-function + * Add "sleep 3" to scripts/nfs as a nasty hack around bug #12942 + + -- Matt Zimmerman Fri, 19 Aug 2005 23:50:16 -0700 + initramfs-tools (0.21) breezy; urgency=low "All that I desire to point out is the general principle that @@ -20,7 +66,7 @@ initramfs-tools (0.21) breezy; urgency=low * debian/initramfs-tools.postinst: Preserve /etc/mkinitrd/modules if possible on new install. (Ubuntu #13372) - -- Jeff Bailey Tue, 16 Aug 2005 15:56:00 -0400 + -- Jeff Bailey Thu, 18 Aug 2005 00:20:11 -0400 initramfs-tools (0.20) breezy; urgency=low diff --git a/debian/control b/debian/control index cd47480..4120074 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.6.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils, busybox-cvs-initramfs (>= 20040623-1ubuntu19), cpio, mdadm, lvm2 (>= 2.01.04-5) +Depends: klibc-utils, busybox-cvs-initramfs (>= 20040623-1ubuntu19), cpio, mdadm, lvm2 (>= 2.01.04-5), udev Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged 2.6 Linux kernel. The initramfs is an cpio archive. At boot time, the kernel diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index fe734cf..6e61803 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -15,6 +15,7 @@ if [ "$1" = configure ]; then if [ -e /etc/mkinitrd/modules ]; then cp /etc/mkinitrd/modules /etc/mkinitramfs + sed -i -e 's/mkinitrd/mkinitramfs/g' /etc/mkinitramfs/modules fi if [ -e ${RESUME} ]; then diff --git a/hook-functions b/hook-functions index 8642af9..8ff5267 100644 --- a/hook-functions +++ b/hook-functions @@ -6,7 +6,7 @@ catenate_cpiogz() { force_load() { - manual_add_modules ${module} + manual_add_modules ${@} echo ${@} >>${DESTDIR}/conf/modules } @@ -106,6 +106,10 @@ dep_add_modules() if [ -e /sys/bus/scsi/devices/ ]; then manual_add_modules sd_mod fi + + if [ -e /sys/bus/i2o/devices/ ]; then + manual_add_modules i2o_block + fi } @@ -123,7 +127,7 @@ auto_add_modules() done # ide - for x in ide-cd ide-disk ide-generic aec62xx alim15x3 amd74xx atuuxo cmd64x cs5520 cs5530 cy82c693 generic hpt34x hpt366 ns87415 pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks siimage sis5513 slc82c105 slc90e66 triflex trm290 via82cxxx; do + for x in ide-cd ide-disk ide-generic aec62xx alim15x3 amd74xx atiixp atuuxo cmd64x cs5520 cs5530 cy82c693 generic hpt34x hpt366 ns87415 opti621 pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks siimage sis5513 slc82c105 slc90e66 triflex trm290 via82cxxx; do manual_add_modules ${x} done @@ -132,6 +136,11 @@ auto_add_modules() manual_add_modules ${x} done + # i2o + for x in i2o_block; do + manual_add_modules ${x} + done + } usage() diff --git a/init b/init index 38450da..f3aa221 100644 --- a/init +++ b/init @@ -61,6 +61,9 @@ log_end_msg # Populate /dev tree log_begin_msg "Initializing /dev" +mount -t ramfs none /dev +touch /dev/.initramfs-tools +parse_numeric ${ROOT} udevstart log_end_msg @@ -80,8 +83,15 @@ log_begin_msg "Running /scripts/init-bottom" run_scripts /scripts/init-bottom log_end_msg +# Move our /dev to the real filesystem. Do the setup that udev otherwise +# would. +mkdir -p /dev/.static/dev +chmod 700 /dev/.static/ +mount -o bind /root/dev /dev/.static/dev +mount -o move /dev /root/dev + umount /sys umount /proc # Chain to real filesystem -exec run-init ${rootmnt} ${init} "$@" +exec run-init ${rootmnt} ${init} "$@" /root/dev/console diff --git a/scripts/functions b/scripts/functions index 10918f8..956b1c3 100644 --- a/scripts/functions +++ b/scripts/functions @@ -181,6 +181,15 @@ scsi_boot_events() } +i2o_boot_events() +{ + [ -e /sys/bus/i2o/devices/ ] || return + + for device in /sys/bus/i2o/devices/*; do + [ -e ${device}/block ] && modprobe i2o_block + done +} + load_modules() { depmod -a @@ -217,10 +226,15 @@ load_modules() ide_boot_events scsi_boot_events + + i2o_boot_events } parse_numeric() { case $1 in + /*) + return + ;; *:*) minor=${1#*:} major=${1%:*} @@ -232,5 +246,6 @@ parse_numeric() { esac mknod /dev/root b ${major} ${minor} + ROOT=/dev/root } diff --git a/scripts/local b/scripts/local index bcc96ad..539a2a4 100644 --- a/scripts/local +++ b/scripts/local @@ -8,7 +8,7 @@ mountroot () log_end_msg # Get the root filesystem type - if [ ! -e ${ROOT} ]; then + if [ ! -e "${ROOT}" ]; then panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" fi diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 4f199de..9307f55 100644 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -15,10 +15,21 @@ prereqs) ;; esac -vg=$(echo ${ROOT} | sed -e 's#/dev/mapper/\(.*\)-.*#\1#') - -[ x${vg} != x ] || return +vg=${ROOT#/dev/mapper/} +case ${vg} in + /dev/root) + unset vg + ;; + /*) + exit 0 + ;; +esac + modprobe -q dm-mod +# Cope with -'s in the volume group and node names. +vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#') + vgchange -ay ${vg} + diff --git a/scripts/nfs b/scripts/nfs index 8149e86..10f8f1d 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -29,6 +29,7 @@ mountroot () roflag="-o rw" fi + sleep 3 nfsmount ${roflag} ${NFSROOT} ${rootmnt} log_begin_msg "Running /scripts/nfs-bottom" -- cgit v1.2.3 From 7379c1bbf48cfa9df83dc7e92d169e2db37e3bc8 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 26 Aug 2005 14:39:14 -0400 Subject: initramfs-tools (0.24) breezy; urgency=low "Experience is simply the name we give out mistakes." - Oscar Wilde * hook-functions (auto_add_modules): Add cciss (Ubuntu #14177) Thanks Fabionne! * scripts/functions (parse_numeric): Noop on empty parameter. Fixes LTSP boot failure. Thanks to Oliver Grawert for testing! * scripts/local-top/md: Don't run modprobe when raidlvl is unset. Run mdadm if raidlvl has ever been set, not just if the most recent device checked was part of the raid setup. Thanks to Jeff Waugh for the bug report! * mkinitramfs: Feed the -o argument through readlink -f to get the canonical pathname. -- Jeff Bailey Fri, 26 Aug 2005 09:35:32 -0400 --- debian/changelog | 40 +++++++++++++++++++++++++++++++--------- hook-functions | 2 +- mkinitramfs | 3 ++- scripts/functions | 4 +++- scripts/local-top/md | 8 ++++++-- 5 files changed, 43 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 09bc345..06292ff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,25 @@ +initramfs-tools (0.24) breezy; urgency=low + + "Experience is simply the name we give out mistakes." + - Oscar Wilde + + * hook-functions (auto_add_modules): Add cciss + (Ubuntu #14177) Thanks Fabionne! + + * scripts/functions (parse_numeric): Noop on empty parameter. + Fixes LTSP boot failure. Thanks to Oliver Grawert + for testing! + + * scripts/local-top/md: Don't run modprobe when raidlvl is unset. + Run mdadm if raidlvl has ever been set, not just if the most + recent device checked was part of the raid setup. + Thanks to Jeff Waugh for the bug report! + + * mkinitramfs: Feed the -o argument through readlink -f to + get the canonical pathname. + + -- Jeff Bailey Fri, 26 Aug 2005 09:35:32 -0400 + initramfs-tools (0.23) breezy; urgency=low "This suspense is terrible. I hope it will last." @@ -7,31 +29,31 @@ initramfs-tools (0.23) breezy; urgency=low to drop to a shell. Thanks to Matt Zimmerman for this fix! - - hook-functions (auto_add_modules): Add atiixp and opti621 to + * hook-functions (auto_add_modules): Add atiixp and opti621 to the IDE set. - - hook-functions (dep_add_modules): Detect i2o and add i2o_block + * hook-functions (dep_add_modules): Detect i2o and add i2o_block (auto_add_modules): Include i2o_block. - - scripts/functions (i2o_boot_events): New function + * scripts/functions (i2o_boot_events): New function (load_modules): Call it. (Ubuntu# 13806) Thanks to Tollef Fog Heen for the i2o patch! - - debian/control: Depend on udev. + * debian/control: Depend on udev. Thanks to Alexander Butenko for troubleshooting this with me. - - init: Move the /dev directory to the root filesystem. + * init: Move the /dev directory to the root filesystem. Handle all the udev bind mounts as needed. Make sure input and output is associated with dev/console. - - scripts/functions (parse_numeric): Exit if we're refering to a path. + * scripts/functions (parse_numeric): Exit if we're refering to a path. Otherwise override root setting to be /dev/root. - - init: Call parse_numeric when setting the root variable. - - scripts/local-top/lvm: When using a numeric root, call vgchange -ay + * init: Call parse_numeric when setting the root variable. + * scripts/local-top/lvm: When using a numeric root, call vgchange -ay Don't attempt to start LVM on regular partitions. (Ubuntu #13365, #13778, and some of #13399) - - scripts/local-top/lvm: Cope with -'s in the Volume Group and + * scripts/local-top/lvm: Cope with -'s in the Volume Group and logical volume names. (Ubuntu #13387) Thanks to Stephen Shirley for the patch! diff --git a/hook-functions b/hook-functions index 8ff5267..b189c34 100644 --- a/hook-functions +++ b/hook-functions @@ -132,7 +132,7 @@ auto_add_modules() done # scsi - for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do + for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do manual_add_modules ${x} done diff --git a/mkinitramfs b/mkinitramfs index 7344a03..a93f97c 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -16,7 +16,8 @@ while getopts "d:ko:r:" flag; do fi ;; o) - outfile="${OPTARG}" + touch ${OPTARG} + outfile="$(readlink -f ${OPTARG})" ;; k) keep="y" diff --git a/scripts/functions b/scripts/functions index 956b1c3..4b3b7cf 100644 --- a/scripts/functions +++ b/scripts/functions @@ -232,6 +232,9 @@ load_modules() parse_numeric() { case $1 in + "") + return + ;; /*) return ;; @@ -248,4 +251,3 @@ parse_numeric() { mknod /dev/root b ${major} ${minor} ROOT=/dev/root } - diff --git a/scripts/local-top/md b/scripts/local-top/md index 055e109..c7515fe 100644 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -16,6 +16,7 @@ prereqs) esac unset raidlvl +gotraid=n # Detect raid level for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do @@ -23,9 +24,12 @@ for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do continue fi raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') - modprobe -q ${raidlvl} 2>/dev/null + if [ "$raidlvl" ]; then + modprobe -q ${raidlvl} 2>/dev/null + gotraid=y + fi done -[ x${raidlvl} != x ] || return +[ "${gotraid}" = y ] || exit /sbin/mdrun /dev -- cgit v1.2.3 From 5582f19f77d283348d946dd4cafcbc2134a3186c Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Sat, 17 Sep 2005 16:45:40 -0400 Subject: initramfs-tools (0.26) breezy; urgency=low "Experience is one thing you can't get for nothing." - Oscar Wilde * scripts/local-top/lvm: Reduce -- to - in VG strings for feeding to vgchange. (Ubuntu: #13387) * update-initramfs: New file * debian/dirs: Add /var/lib/initramfs-tools * hooks/evms: New file * scripts/local-top: New file. * debian/control: Bump klibc depends to 1.0.14-1ubuntu2 for jfs support * hook-scripts (manual_add_modules): Don't do unnecessary depmod (dep_add_modules): No need for a sleep 2 here. Thanks to Matt Zimmmerman for noticing these! * scripts/functions: Attempt resume before loading USB or Network modules to avoid resume issues with USB. Thanks to Matthew Garrett for this patch! * scripts/functions (ide_boot_events): Always load ide-generic before going further. This allows us to catch any hidden IDE controllers that might not otherwise get found. * initramfs.conf.5: New file * debian/initramfs-tools.manpages: Install it. Thanks to maximilian attems for the manpage! * hook-functions (auto_add_modules): Add mptscsih (Ubuntu #15406) Thanks to Jesper Krogh for the bug report! * debian/dirs: Add etc/mkinitramfs/hooks, move all scripts subdirs into etc/mkinitramfs/scripts. * mkinitramfs: Set the umask. Copy the scripts from /etc/mkinitramfs/scripts into the image. Make sure that modules file lists is actually a regular file. * init: Use ${rootmnt} instead of hardcoded /root, use mount -n Fix typo. * hook-functions (catenate_cpiogz): Add sanity check. (add_modules_from_file): Document, quote variable, add warning. * docs/example_hook: Update Thanks to Karl Hegbloom for these previous 5 patches! * init: Create /var/lock on the initramfs Thanks to Jerry Haltom for noticing this! * debian/dirs: rename to ... * debian/initramfs-tools.dirs: ... this. * scripts/functions (scsi_boot_events): Don't attempt to look at ${device}/type if it doesn't actually exist. -- Jeff Bailey Wed, 14 Sep 2005 14:12:24 -0400 --- debian/changelog | 62 +++++++++ debian/control | 2 +- debian/dirs | 10 -- debian/initramfs-tools.dirs | 12 ++ debian/initramfs-tools.install | 1 + debian/initramfs-tools.manpages | 1 + docs/example_hook | 17 ++- hook-functions | 26 +++- hooks/evms | 31 +++++ init | 7 +- initramfs.conf.5 | 62 +++++++++ mkinitramfs | 12 +- scripts/functions | 40 +++++- scripts/local-top/evms | 31 +++++ scripts/local-top/lvm | 4 +- update-initramfs | 281 ++++++++++++++++++++++++++++++++++++++++ 16 files changed, 563 insertions(+), 36 deletions(-) delete mode 100644 debian/dirs create mode 100644 debian/initramfs-tools.dirs create mode 100644 hooks/evms create mode 100644 initramfs.conf.5 create mode 100644 scripts/local-top/evms create mode 100644 update-initramfs (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 38ec69f..7232019 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,65 @@ +initramfs-tools (0.26) breezy; urgency=low + + "Experience is one thing you can't get for nothing." + - Oscar Wilde + + * scripts/local-top/lvm: Reduce -- to - in VG strings for feeding + to vgchange. (Ubuntu: #13387) + + * update-initramfs: New file + * debian/dirs: Add /var/lib/initramfs-tools + + * hooks/evms: New file + * scripts/local-top: New file. + + * debian/control: Bump klibc depends to 1.0.14-1ubuntu2 for jfs support + + * hook-scripts (manual_add_modules): Don't do unnecessary depmod + (dep_add_modules): No need for a sleep 2 here. + Thanks to Matt Zimmmerman for noticing these! + + * scripts/functions: Attempt resume before loading USB or Network + modules to avoid resume issues with USB. + Thanks to Matthew Garrett for this patch! + + * scripts/functions (ide_boot_events): Always load ide-generic + before going further. This allows us to catch any hidden + IDE controllers that might not otherwise get found. + + * initramfs.conf.5: New file + * debian/initramfs-tools.manpages: Install it. + Thanks to maximilian attems for the manpage! + + * hook-functions (auto_add_modules): Add mptscsih (Ubuntu #15406) + Thanks to Jesper Krogh for the bug report! + + * debian/dirs: Add etc/mkinitramfs/hooks, move all scripts subdirs + into etc/mkinitramfs/scripts. + + * mkinitramfs: Set the umask. Copy the scripts from + /etc/mkinitramfs/scripts into the image. + Make sure that modules file lists is actually a regular file. + + * init: Use ${rootmnt} instead of hardcoded /root, use mount -n + Fix typo. + + * hook-functions (catenate_cpiogz): Add sanity check. + (add_modules_from_file): Document, quote variable, add warning. + + * docs/example_hook: Update + Thanks to Karl Hegbloom for these previous 5 patches! + + * init: Create /var/lock on the initramfs + Thanks to Jerry Haltom for noticing this! + + * debian/dirs: rename to ... + * debian/initramfs-tools.dirs: ... this. + + * scripts/functions (scsi_boot_events): Don't attempt to look + at ${device}/type if it doesn't actually exist. + + -- Jeff Bailey Wed, 14 Sep 2005 14:12:24 -0400 + initramfs-tools (0.25) breezy; urgency=low "If there was less sympathy in the world, there would be less diff --git a/debian/control b/debian/control index 4120074..8a1aae1 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.6.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils, busybox-cvs-initramfs (>= 20040623-1ubuntu19), cpio, mdadm, lvm2 (>= 2.01.04-5), udev +Depends: klibc-utils (>= 1.0.14-1ubuntu2), busybox-cvs-initramfs (>= 20040623-1ubuntu19), cpio, mdadm, lvm2 (>= 2.01.04-5), udev Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged 2.6 Linux kernel. The initramfs is an cpio archive. At boot time, the kernel diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index d35ba7c..0000000 --- a/debian/dirs +++ /dev/null @@ -1,10 +0,0 @@ -etc/mkinitramfs/init-bottom -etc/mkinitramfs/init-premount -etc/mkinitramfs/init-top -etc/mkinitramfs/local-bottom -etc/mkinitramfs/local-premount -etc/mkinitramfs/local-top -etc/mkinitramfs/nfs-bottom -etc/mkinitramfs/nfs-premount -etc/mkinitramfs/nfs-top -usr/share/initramfs-tools/modules.d diff --git a/debian/initramfs-tools.dirs b/debian/initramfs-tools.dirs new file mode 100644 index 0000000..ba4ac4d --- /dev/null +++ b/debian/initramfs-tools.dirs @@ -0,0 +1,12 @@ +etc/mkinitramfs/scripts/init-bottom +etc/mkinitramfs/scripts/init-premount +etc/mkinitramfs/scripts/init-top +etc/mkinitramfs/scripts/local-bottom +etc/mkinitramfs/scripts/local-premount +etc/mkinitramfs/scripts/local-top +etc/mkinitramfs/scripts/nfs-bottom +etc/mkinitramfs/scripts/nfs-premount +etc/mkinitramfs/scripts/nfs-top +etc/mkinitramfs/hooks +usr/share/initramfs-tools/modules.d +/var/lib/initramfs-tools diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index 8702d53..3a7a503 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -4,3 +4,4 @@ scripts usr/share/initramfs-tools conf/initramfs.conf etc/mkinitramfs hooks usr/share/initramfs-tools hook-functions usr/share/initramfs-tools +update-initramfs usr/sbin diff --git a/debian/initramfs-tools.manpages b/debian/initramfs-tools.manpages index 61d8057..95edfac 100644 --- a/debian/initramfs-tools.manpages +++ b/debian/initramfs-tools.manpages @@ -1 +1,2 @@ mkinitramfs.8 +initramfs.conf.5 diff --git a/docs/example_hook b/docs/example_hook index 27582a7..de5392d 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -39,6 +39,7 @@ # 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? # @@ -66,18 +67,21 @@ esac # # Source the optional 'hook-functions' scriptlet, if you need the -# functions defined within it: +# functions defined within it. Read it to see what is available to +# you. It contains functions for copying dynamically linked program +# binaries, and kernel modules into the DESTDIR. # -# . /usr/share/initramfs-tools/hook-functions +. /usr/share/initramfs-tools/hook-functions -# If this is a conffile, it must take care to do the right thing when -# the package containing it is removed but not purged. There of +# If this hook script is a conffile (and thus stored in +# /etc/mkinitramfs/hooks), it must take care to do the right thing +# when the package containing it is removed but not purged. There of # course may be other reasons to have custom logic deciding what to -# install. +# install. The version variable may be useful for this. # if [ -x /usr/bin/myprog ]; then - install -D /usr/bin/myprog ${DESTDIR}/usr/bin + copy_exec /usr/bin/myprog usr/bin fi # To accompany this, there should usually be a script for inside the @@ -108,4 +112,3 @@ then fi exit 0 - diff --git a/hook-functions b/hook-functions index b189c34..4371962 100644 --- a/hook-functions +++ b/hook-functions @@ -1,7 +1,13 @@ # -*- shell-script -*- catenate_cpiogz() { - cat "$1" >>${__TMPCPIOGZ} + # Sanity check + if [ ! -e "${1}" ]; then + echo "W:catenate_cpiogz: arg1='${1}' does not exist." >&2 + return + fi + + cat "${1}" >>${__TMPCPIOGZ} } force_load() @@ -10,10 +16,20 @@ force_load() echo ${@} >>${DESTDIR}/conf/modules } +# Takes a file containing a list of modules to be added as an +# argument, figures out dependancies, and adds them. +# +# Input file syntax: +# +# # comment +# modprobe_module_name [args ...] +# [...] +# add_modules_from_file() { # Sanity check - if [ ! -e ${1} ]; then + if [ ! -e "${1}" ]; then + echo "W:add_modules_from_file: arg1='${1}' does not exist." >&2 return fi @@ -32,7 +48,6 @@ manual_add_modules() mkdir -p ${DESTDIR}/$(dirname ${mam_x}) ln -s ${mam_x} ${DESTDIR}/$(dirname ${mam_x}) - depmod -b ${DESTDIR} ${version} done } @@ -88,9 +103,6 @@ dep_add_modules() fi done - # Give the USB bus a moment to catch up - sleep 2 - for x in /sys/bus/usb/devices/*; do if [ -e ${x}/modalias ]; then manual_add_modules $(cat ${x}/modalias) @@ -132,7 +144,7 @@ auto_add_modules() done # scsi - for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do + for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptscsih nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do manual_add_modules ${x} done diff --git a/hooks/evms b/hooks/evms new file mode 100644 index 0000000..0981672 --- /dev/null +++ b/hooks/evms @@ -0,0 +1,31 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +prereqs) + prereqs + exit 0 + ;; +esac + +. /usr/share/initramfs-tools/hook-functions + +if [ ! -x /sbin/evms_activate ]; then + exit 0 +fi + +copy_exec /sbin/evms_activate /sbin + +EVMS_VERSION=$(/usr/sbin/evms_query info | grep "EVMS Version" | awk '{ print $3; }') + +mkdir -p ${DESTDIR}/lib/evms/${EVMS_VERSION} + +for x in disk lvm2 dos multipath; do + copy_exec /lib/evms/${EVMS_VERSION}/${x}* /lib/evms/${EVMS_VERSION} +done diff --git a/init b/init index f11908d..6bf4be7 100644 --- a/init +++ b/init @@ -3,6 +3,7 @@ mkdir /sys mkdir /proc mkdir /tmp +mkdir -p /var/lock mount -t sysfs sysfs /sys mount -t proc proc /proc mount -t ramfs none /dev @@ -53,7 +54,7 @@ for x in $(cat /proc/cmdline); do esac done -log_begin_msg "Running /script/init-top" +log_begin_msg "Running /scripts/init-top" run_scripts /scripts/init-top log_end_msg @@ -89,8 +90,8 @@ log_end_msg # would. mkdir -p /dev/.static/dev chmod 700 /dev/.static/ -mount -o bind /root/dev /dev/.static/dev -mount -o move /dev /root/dev +mount -n -o bind ${rootmnt}/dev /dev/.static/dev +mount -n -o move /dev ${rootmnt}/dev umount /sys umount /proc diff --git a/initramfs.conf.5 b/initramfs.conf.5 new file mode 100644 index 0000000..24cfff7 --- /dev/null +++ b/initramfs.conf.5 @@ -0,0 +1,62 @@ +.TH INITRAMFS.CONF 5 "$Date: 2005/09/13 $" "" "initramfs.conf manual" + +.SH NAME +initramfs.conf \- configuration file for mkinitramfs + +.SH DESCRIPTION +The behaviour of +.B mkinitramfs +can be modified by its configuration file. + +Each line in the file can be a configuration variable, a blank line, +or a comment. The value of an variable is assigned by an statement +of the form: \fIname\fP=[\fIvalue\fP] + +.SH GENERAL VARIABLES +.TP +\fB MODULES +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. + +\fIdep\fP tries to guess which modules are necessary for the running box. + +\fIlist\fP includes only modules from the additional modules list. + +.TP +\fB RESUME +Optional setting of the swap partition to resume from. +The resume= passed on the command line of your boot loader +will override this setting. + +.TP +\fB BUSYBOX +If this is set to \fIy\fP then \fBbusybox\fP will be included on the +initramfs image. You MUST use the -static version. + +.SH NFS VARIABLES +.TP +\fB BOOT +Allows to use an nfs drive as the root of the drive. +The default is to boot of an \fIlocal\fP media (harddrive, USB stick). +Set to \fInfs\fP for an NFS root share. + +.TP +\fB DEVICE +Specifies the network interface, like eth0. + +.TP +\fB NFSROOT +Defaults to \fIauto\fP in order to pick up value from DHCP server. +Otherwise you need to specify \fIHOST:MOUNT\fP. + +.SH SEE ALSO + +.BR mkinitramfs (8) + +.SH AUTHOR +The initramfs-tools are written by Jeff Bailey . +This manual is maintained by Maximilian Attems . +Loosely based on mkinitrd.conf by Herbert Xu. + diff --git a/mkinitramfs b/mkinitramfs index a93f97c..8257b7f 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,5 +1,7 @@ #!/bin/sh +umask 0022 + # Defaults keep="n" CONFDIR="/etc/mkinitramfs" @@ -97,7 +99,9 @@ done # MODULES=list case. Always honour. for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do - add_modules_from_file ${x} + if [ -f "${x}" ]; then + add_modules_from_file ${x} + fi done if [ "${MODULES}" = "dep" ]; then @@ -115,6 +119,12 @@ ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /usr/lib/klibc/lib/* ${DESTDIR}/lib copy_exec /usr/share/initramfs-tools/init /init cp -a /usr/share/initramfs-tools/scripts/* ${DESTDIR}/scripts +for f in $(cd /etc/mkinitramfs/scripts && \ + find . \( -name '*.dpkg*' -prune -o -name '*~' -prune \) \ + -o -type f -print); do + mkdir --parents ${DESTDIR}/scripts/$(dirname ${f}) +cp -p /etc/mkinitramfs/scripts/${f} ${DESTDIR}/scripts/$(dirname ${f}) +done copy_exec ${CONFDIR}/initramfs.conf /conf cp -a /etc/udev ${DESTDIR}/etc diff --git a/scripts/functions b/scripts/functions index 4b3b7cf..148dda7 100644 --- a/scripts/functions +++ b/scripts/functions @@ -144,10 +144,11 @@ run_scripts() } ide_boot_events() { - [ -e /proc/ide ] || return modprobe -q ide-generic + [ -e /proc/ide ] || return + for drive in /proc/ide/*; do [ -e ${drive}/media ] || continue # nothing to do if the device has already been took in charge @@ -156,11 +157,11 @@ ide_boot_events() { read media < $drive/media case "$media" in - disk) MODULE=ide-disk ;; - cdrom) MODULE=ide-cd ;; - tape) MODULE=ide-tape ;; - floppy) MODULE=ide-floppy ;; - *) MODULE=ide-generic ;; + disk) MODULE=ide-disk ;; + cdrom) MODULE=ide-cd ;; + tape) MODULE=ide-tape ;; + floppy) MODULE=ide-floppy ;; + *) MODULE=ide-generic ;; esac modprobe -q ${MODULE} @@ -172,6 +173,7 @@ scsi_boot_events() [ -e /sys/bus/scsi/devices/ ] || return for device in /sys/bus/scsi/devices/*; do + [ -e "${device}"/type ] || continue read media < ${device}/type case "$media" in 0) modprobe -q sd_mod; @@ -208,6 +210,32 @@ load_modules() done fi + for x in /sys/bus/pci/devices/*; do + if [ -e ${x}/class ]; then + case $(cat ${x}/class) in + 0x0100*|0x0101*) + if [ -e ${x}/modalias ]; then + modprobe -q $(cat ${x}/modalias) + fi + ;; + esac + fi + done + + ide_boot_events + + scsi_boot_events + + i2o_boot_events + + if [ -e /sys/power/resume ]; then + if [ -e ${resume} ]; then + major=$((0x$(stat -c%t ${resume}))) + minor=$((0x$(stat -c%T ${resume}))) + echo ${major}:${minor} >/sys/power/resume + fi + fi + for x in /sys/bus/pci/devices/*; do if [ -e ${x}/modalias ]; then modprobe -q $(cat ${x}/modalias) diff --git a/scripts/local-top/evms b/scripts/local-top/evms new file mode 100644 index 0000000..2ee7e80 --- /dev/null +++ b/scripts/local-top/evms @@ -0,0 +1,31 @@ +#!/bin/sh + +PREREQ="lvm" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +evms=${ROOT#/dev/evms/} + +case ${evms} in + /dev/root) + unset evms + ;; + /*) + exit 0 + ;; +esac + +modprobe -q dm-mod + +/sbin/evms_activate diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 9307f55..7ac81e6 100644 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -28,8 +28,10 @@ esac modprobe -q dm-mod -# Cope with -'s in the volume group and node names. +# 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} diff --git a/update-initramfs b/update-initramfs new file mode 100644 index 0000000..9d7d1bc --- /dev/null +++ b/update-initramfs @@ -0,0 +1,281 @@ +#!/bin/sh + +STATEDIR=/var/lib/initramfs-tools +BOOTDIR=/boot + +set -e + +usage() +{ + if [ -n "${1}" ]; then + printf "${@}\n\n" >&2 + fi + cat >&2 << EOF +Usage: ${0} [OPTION]... + +Options: + -k [version] Specify kernel version or ALL + -c Create a new initramfs + -u Update an existing initramfs + -d Remove an existing initramfs + -t Take over a custom initramfs with this one + -v Be verbose + -h This message + +EOF + exit 1 +} + +mild_panic() +{ + if [ -n "${1}" ]; then + printf "${@}\n" >&2 + fi + exit 0 +} + +panic() +{ + if [ -n "${1}" ]; then + printf "${@}\n" >&2 + fi + exit 1 +} + +verbose() +{ + if [ "${verbose}" = 1 ]; then + printf "${@}\n" + fi +} + +version_exists() +{ + [ -e "${STATEDIR}/${1}" ] + return $? +} + +set_initramfs() +{ + initramfs="${BOOTDIR}/initrd.img-${version}" +} + +generate_initramfs() +{ + verbose "Generating ${initramfs}" + mkinitramfs -o ${initramfs} ${version} + set_sha1 +} + +compare_sha1() +{ + sha1sum ${initramfs} | diff ${STATEDIR}/${version} - >/dev/null 2>&1 + return $? +} + +# Note that this must overwrite so that updates work. +set_sha1() +{ + sha1sum ${initramfs} > ${STATEDIR}/${version} +} + +delete_sha1() +{ + rm -f ${STATEDIR}/${version} +} + +get_sorted_versions() +{ + version_list="" + + for gsv_x in ${STATEDIR}/*; do + gsv_x=$(basename ${gsv_x}) + if [ "${gsv_x}" = '*' ]; then + verbose "Nothing to do, exiting." + exit 0 + fi + worklist="" + for gsv_i in $version_list; do + if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then + worklist="${worklist} ${gsv_x} ${gsv_i}" + gsv_x="" + else + worklist="${worklist} ${gsv_i}" + fi + done + if [ "${gsv_x}" != "" ]; then + worklist="${worklist} ${gsv_x}" + fi + version_list=${worklist} + done + + verbose "Available versions: ${version_list}" +} + +set_linked_version() +{ + if [ -L /initrd.img ]; then + linktarget=$(readlink /initrd.img) + fi + + if [ -L /boot/initrd.img ]; then + linktarget=$(readlink /boot/initrd.img) + fi + + if [ -z "${linktarget}" ]; then + return + fi + + version="${linktarget##initrd.img-}" +} + +set_highest_version() +{ + get_sorted_versions + set - ${version_list} + version=${1} +} + +create() +{ + if [ -z "${version}" ]; then + usage "Create mode requires a version argument" + fi + + set_initramfs + + if [ "${takeover}" = 0 ]; then + if version_exists ${version}; then + panic "Cannot create version ${version}: already exists" + fi + + if [ -e ${initramfs} ]; then + panic "${initramfs} already exists, cannot create." + fi + fi + + generate_initramfs +} + +update() +{ + if [ -z "${version}" ]; then + set_linked_version + fi + + if [ -z "${version}" ]; then + set_highest_version + fi + + if [ "${version}" = "all" ]; then + : FIXME check for --yes, and if not ask are you sure + get_sorted_versions + for u_version in ${version_list}; do + if [ "${verbose}" = "1" ]; then + vflag="-v" + fi + # Don't stop if one version doesn't work. + set +e + ${0} ${vflag} -u -k ${u_version} + set -e + done + exit 0 + fi + + set_initramfs + + altered_check + + generate_initramfs + +} + +delete() +{ + if [ -z "${version}" ]; then + usage "Delete mode requires a version argument" + fi + + set_initramfs + + 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." + fi + + altered_check + + delete_sha1 + + rm -f "${initramfs}" +} + + +altered_check() +{ + if [ "${takeover}" = 0 ]; then + if ! compare_sha1; then + delete_sha1 + mild_panic "${initramfs} was been altered. Cannot update." + fi + fi +} + +# Defaults +verbose=0 +yes=0 +takeover=0 + +## + +while getopts "k:cudyvht" flag; do + case "${flag}" in + k) + version="${OPTARG}" + ;; + c) + mode="c" + ;; + d) + mode="d" + ;; + u) + mode="u" + ;; + v) + verbose="1" + ;; + y) + yes="1" + ;; + t) + takeover="1" + ;; + h) + usage + ;; + esac +done + +# Validate arguments + +if [ -z "${mode}" ]; then + usage "You must specify at least one of -c, -u, or -d." +fi + +case "${mode}" in + c) + create + ;; + d) + delete + ;; + u) + update + ;; +esac + + -- cgit v1.2.3 From a893fa82665ee472079292eb84a125ef81009124 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 1 Oct 2005 02:33:30 +0200 Subject: apply all the 0.30 upstream changes. --- HACKING | 19 +++++++++++++++++++ debian/changelog | 41 ++++++++++++++++++++++++++++++++++++++++- debian/initramfs-tools.docs | 1 + debian/rules | 4 ++++ hook-functions | 2 +- init | 11 +++++++++-- scripts/functions | 19 ++++++++++++++++--- scripts/local-premount/suspend | 2 +- update-initramfs | 4 ++-- 9 files changed, 93 insertions(+), 10 deletions(-) create mode 100644 HACKING create mode 100644 debian/initramfs-tools.docs (limited to 'scripts') diff --git a/HACKING b/HACKING new file mode 100644 index 0000000..2fd9136 --- /dev/null +++ b/HACKING @@ -0,0 +1,19 @@ +> I am not sure how to modify mkinitramfs to do this automatically, maybe you know? + +I need to document this more clearly, but the initramfs-tools have a collection of hooks that will solve your problem. While there's no way that Breezy could do this in the install, we could certainly include the scripts in the package (Especially if you're willing to test them to make sure they work! *g*) + +There are two phases that need to be accounted for. The first is the install phase for generating the initramfs, the second is run-time phase for actually doing the needed magic. + +To install the components you need, look at the scripts in /usr/share/initramfs-tools/hooks. evms and acpid are good choices. You can see a bunch of header stuff at the top that basically guarantees that things are run in the right order if they need to be. Two functions that will interest you: + +copy_exec copies a binary and any libraries it depends on +manual_add_modules takes bareword module names (like fan, thermal, etc) and installs those modules and any of their dependancies into the initramfs. + +The runtime phase is handled by scripts in /usr/share/initramfs-tools/scripts/ you probably want to start up at about the same point as lvm, md, and evms do, so local-top is a good directory to look in. +You can see the same sort of magic at the top of the script, although lvm and evms each require that md run first. + +I hope this helps. I'll paste this text into a HACKING file on the hopes that someone will see fit to improve it. That person will probably be me, mind you... =) + +Tks, +Jeff Bailey + diff --git a/debian/changelog b/debian/changelog index 4591d65..1ea455b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +initramfs-tools (0.30) unstable; urgency=low + + Apparition Octobre Rouge + + [ maximilian Attems ] + + * Resynconise with latest upstream now we are in unstable. + + [ Jeff Bailey ] + * debian/rules: Make sure hooks and scripts are chmod +x + + * hook-functions (auto_add_modules): Add advansys. + + * debian/init: Add "Loading, please wait..." message. + Don't log for init-top scripts to avoid usplash noise. + + * init: Add start of debug command line option. + + * scripts/functions (log_begin_msg): Call usplash if available + (log_end_msg): Call usplash if available + (panic): Close usplash if available + + * scripts/functions (load_modules): Quote resume variable. + Thanks to Christian Kellner for helping test that! + + * scripts/local-premount/suspend: Quote resume variable. + + * update-initramfs: Use basename on the link target to get the + version number. + + * HACKING: Start of some notes on how this package actually works. + * debian/initramfs-tools.docs: Install it. + + [ Matthew Garrett ] + * scripts/functions (load_modules): Run udevstart after loading block + drivers should fix resume from hibernate on non-LVM systems. + + -- maximilian attems Fri, 30 Sep 2005 19:34:55 +0200 + initramfs-tools (0.27) unstable; urgency=low * Remove unused BUSYBOX config option as we use busybox anyway. @@ -17,7 +56,7 @@ initramfs-tools (0.27) unstable; urgency=low * update-initramfs.8 New file install it. * The debian busybox-cvs-static installs into /bin/busybox: - fix pathes vis--vis ubuntu version. make that a variable on top. + fix pathes vis-a-vis ubuntu version. make that a variable on top. -- maximilian attems Tue, 20 Sep 2005 13:52:00 +0200 diff --git a/debian/initramfs-tools.docs b/debian/initramfs-tools.docs new file mode 100644 index 0000000..5c374b1 --- /dev/null +++ b/debian/initramfs-tools.docs @@ -0,0 +1 @@ +HACKING diff --git a/debian/rules b/debian/rules index 6b91c1f..2a5ae55 100644 --- a/debian/rules +++ b/debian/rules @@ -4,3 +4,7 @@ include /usr/share/cdbs/1/rules/debhelper.mk pre-build:: 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 diff --git a/hook-functions b/hook-functions index 4371962..bc21b5f 100644 --- a/hook-functions +++ b/hook-functions @@ -144,7 +144,7 @@ auto_add_modules() done # scsi - for x in 3w-9xxx 3w-xxxx a100u2x aacraid ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptscsih nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do + for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptscsih nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do manual_add_modules ${x} done diff --git a/init b/init index 6bf4be7..4193dcd 100644 --- a/init +++ b/init @@ -1,5 +1,7 @@ #!/bin/sh +echo "Loading, please wait..." + mkdir /sys mkdir /proc mkdir /tmp @@ -22,6 +24,7 @@ export readonly=y export ROOT= export resume=${RESUME} export rootmnt=/root +export debug= for x in $(cat /proc/cmdline); do case $x in init=*) @@ -48,15 +51,19 @@ for x in $(cat /proc/cmdline); do rw) readonly=n ;; + debug) + debug=y + exec >/tmp/initramfs.debug 2>&1 + set -x + ;; break) break=yes ;; esac done -log_begin_msg "Running /scripts/init-top" +# Don't do log messages here to avoid confusing usplash run_scripts /scripts/init-top -log_end_msg . /scripts/${BOOT} diff --git a/scripts/functions b/scripts/functions index 148dda7..de2268c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -23,12 +23,18 @@ log_warning_msg() log_begin_msg() { - _log_msg "Begin: $@ ..." + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TEXT $@" + fi + _log_msg "Begin: $@ ..." } log_end_msg() { - _log_msg "Done." + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "SUCCESS ok" + fi + _log_msg "Done." } # update_progress() # ToDo: NOP placeholder... what else for usplash? @@ -38,6 +44,9 @@ log_end_msg() panic() { + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "QUIT" + fi echo $@ FS1='(initramfs) ' exec /bin/sh /dev/console 2>&1 } @@ -228,8 +237,12 @@ load_modules() i2o_boot_events + # FIXME - need to start LVM here + + udevstart + if [ -e /sys/power/resume ]; then - if [ -e ${resume} ]; then + if [ -e "${resume}" ]; then major=$((0x$(stat -c%t ${resume}))) minor=$((0x$(stat -c%T ${resume}))) echo ${major}:${minor} >/sys/power/resume diff --git a/scripts/local-premount/suspend b/scripts/local-premount/suspend index 5791123..6aab596 100644 --- a/scripts/local-premount/suspend +++ b/scripts/local-premount/suspend @@ -19,7 +19,7 @@ if [ "x${resume}" = "x" ]; then exit fi -if [ ! -e ${resume} ]; then +if [ ! -e "${resume}" ]; then exit fi diff --git a/update-initramfs b/update-initramfs index f93fc97..bd5a4ab 100644 --- a/update-initramfs +++ b/update-initramfs @@ -115,11 +115,11 @@ get_sorted_versions() set_linked_version() { if [ -L /initrd.img ]; then - linktarget=$(readlink /initrd.img) + linktarget=$(basename $(readlink /initrd.img)) fi if [ -L /boot/initrd.img ]; then - linktarget=$(readlink /boot/initrd.img) + linktarget=$(basename $(readlink /boot/initrd.img)) fi if [ -z "${linktarget}" ]; then -- cgit v1.2.3 From 402fc00b3d7c55532f6e7408d6245783b909bd77 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 21 Oct 2005 18:11:52 +0200 Subject: new repo format v6 --- debian/rules | 0 hooks/acpid | 0 hooks/evms | 0 hooks/kernelextras | 0 hooks/udev | 0 init | 0 mkinitramfs | 0 scripts/init-premount/acpid | 0 scripts/local-premount/suspend | 0 scripts/local-top/evms | 0 scripts/local-top/lvm | 0 scripts/local-top/md | 0 12 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 debian/rules mode change 100644 => 100755 hooks/acpid mode change 100644 => 100755 hooks/evms mode change 100644 => 100755 hooks/kernelextras mode change 100644 => 100755 hooks/udev mode change 100644 => 100755 init mode change 100644 => 100755 mkinitramfs mode change 100644 => 100755 scripts/init-premount/acpid mode change 100644 => 100755 scripts/local-premount/suspend mode change 100644 => 100755 scripts/local-top/evms mode change 100644 => 100755 scripts/local-top/lvm mode change 100644 => 100755 scripts/local-top/md (limited to 'scripts') diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755 diff --git a/hooks/acpid b/hooks/acpid old mode 100644 new mode 100755 diff --git a/hooks/evms b/hooks/evms old mode 100644 new mode 100755 diff --git a/hooks/kernelextras b/hooks/kernelextras old mode 100644 new mode 100755 diff --git a/hooks/udev b/hooks/udev old mode 100644 new mode 100755 diff --git a/init b/init old mode 100644 new mode 100755 diff --git a/mkinitramfs b/mkinitramfs old mode 100644 new mode 100755 diff --git a/scripts/init-premount/acpid b/scripts/init-premount/acpid old mode 100644 new mode 100755 diff --git a/scripts/local-premount/suspend b/scripts/local-premount/suspend old mode 100644 new mode 100755 diff --git a/scripts/local-top/evms b/scripts/local-top/evms old mode 100644 new mode 100755 diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm old mode 100644 new mode 100755 diff --git a/scripts/local-top/md b/scripts/local-top/md old mode 100644 new mode 100755 -- cgit v1.2.3 From b96ed45312562bbfc976ce0c6cf32b7e704f1e2f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 21 Oct 2005 18:33:03 +0200 Subject: waldi udev fixes --- debian/changelog | 15 ++++++++++++++- init | 16 ++++++++++++---- mkinitramfs | 6 ++++-- scripts/functions | 22 ---------------------- 4 files changed, 30 insertions(+), 29 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 600d835..832a67d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,20 @@ initramfs-tools (0.31) UNRELEASED; urgency=low * mkinitramfs - Use cp instead of copy_exec. - Call mklibs-copy to collect necessary libs. - + * Use udevsynthesize. + * Add hotplug agents. + + * init udev fixes + - Start and kill udevd. + - Create /dev/.udevdb. + - Use udevsynthesize. + - Call depmod. + * mkinitramfs udev fixes + - Install udevd and udevsynthesize instead of udevstart. + - Install hotplug agents. + * scripts/functions (load_modules) + - Don't call depmod and udevstart. + - Don't crawl pci devices ourself. -- Bastian Blank Mon, 10 Oct 2005 18:27:12 +0000 diff --git a/init b/init index 4193dcd..113a224 100755 --- a/init +++ b/init @@ -67,15 +67,21 @@ run_scripts /scripts/init-top . /scripts/${BOOT} +depmod -a + +# Populate /dev tree +log_begin_msg "Initializing /dev" +mkdir /dev/.udevdb +UDEVD_EXPECTED_SEQNUM=$(($(cat /sys/kernel/hotplug_seqnum) + 1)) udevd --daemon +udevsynthesize +sleep 2 +log_end_msg + log_begin_msg "Loading modules" load_modules log_end_msg -# Populate /dev tree -log_begin_msg "Initializing /dev" parse_numeric ${ROOT} -udevstart -log_end_msg if [ x${break} = xyes ]; then panic "Spawning shell within the initramfs" @@ -85,6 +91,8 @@ log_begin_msg "Running /scripts/init-premount" run_scripts /scripts/init-premount log_end_msg +killall udevd + log_begin_msg "Mounting root file system" mountroot log_end_msg diff --git a/mkinitramfs b/mkinitramfs index 6ff9320..e870489 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -128,9 +128,11 @@ done cp ${CONFDIR}/initramfs.conf ${DESTDIR}/conf cp -a /etc/udev ${DESTDIR}/etc -# Hack until udev is built with klibc +# udev cp /sbin/udev ${DESTDIR}/sbin -cp /sbin/udevstart ${DESTDIR}/sbin +cp /sbin/udevd ${DESTDIR}/sbin +cp /sbin/udevsynthesize ${DESTDIR}/sbin +cp -a /lib/hotplug ${DESTDIR}/lib # Busybox cp ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/busybox diff --git a/scripts/functions b/scripts/functions index de2268c..68cfcea 100644 --- a/scripts/functions +++ b/scripts/functions @@ -203,8 +203,6 @@ i2o_boot_events() load_modules() { - depmod -a - # Load custom modules first if [ -e /conf/modules ]; then cat /conf/modules | while read m; do @@ -219,18 +217,6 @@ load_modules() done fi - for x in /sys/bus/pci/devices/*; do - if [ -e ${x}/class ]; then - case $(cat ${x}/class) in - 0x0100*|0x0101*) - if [ -e ${x}/modalias ]; then - modprobe -q $(cat ${x}/modalias) - fi - ;; - esac - fi - done - ide_boot_events scsi_boot_events @@ -239,8 +225,6 @@ load_modules() # FIXME - need to start LVM here - udevstart - if [ -e /sys/power/resume ]; then if [ -e "${resume}" ]; then major=$((0x$(stat -c%t ${resume}))) @@ -249,12 +233,6 @@ load_modules() fi fi - for x in /sys/bus/pci/devices/*; do - if [ -e ${x}/modalias ]; then - modprobe -q $(cat ${x}/modalias) - fi - done - # Give the USB bus a moment to catch up sleep 2 -- cgit v1.2.3 From bee1355e2c21a86751648b6f0df8a6e4e4e5a45d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 21 Oct 2005 18:38:32 +0200 Subject: added latest upstream fixes :-) --- debian/changelog | 19 ++++++++++++++++++- hook-functions | 4 ++-- init | 4 ++-- scripts/local | 12 ++++++------ scripts/nfs | 18 +++++++++++------- 5 files changed, 39 insertions(+), 18 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 7288dcf..00643e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,7 +24,24 @@ initramfs-tools (0.31) UNRELEASED; urgency=low * hook-functions: Add ibmvscsic to list of scsi modules. - -- Bastian Blank Mon, 10 Oct 2005 18:27:12 +0000 + [ maximilian attems ] + * Resynchronise with latest upstream release. + + [ Jeff Bailey ] + * scripts/nfs (mountroot): New variable: NFSOPTS, default to + -o retranfs=10. (Ubuntu 12942) + This can be overridden in the initramfs.conf file. + Thanks to Oliver Grawert for testing this! + + * hook-scripts (auto_add_modules): Add jfs + (dep_add_modules): Ditto. (Ubuntu #16742) + Thanks to Colin Watson for this fix! + + [ Adam Conrad ] + * Make us a bit more silent/tidy by default, unless "quiet" isn't on + the kernel's command line (then we're just as verbose as ever) + + -- maximilian attems Sun, 16 Oct 2005 19:22:55 +0200 initramfs-tools (0.31) unstable; urgency=low diff --git a/hook-functions b/hook-functions index c06d3e9..cb424d4 100644 --- a/hook-functions +++ b/hook-functions @@ -63,7 +63,7 @@ dep_add_modules() { # Things that are too hard to autodetect. - for x in md raid0 raid1 raid5 raid6 ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do + for x in md raid0 raid1 raid5 raid6 ext2 ext3 isofs jfs nfs reiserfs xfs af_packet dm_mod; do manual_add_modules ${x} done @@ -99,7 +99,7 @@ dep_add_modules() auto_add_modules() { # base - for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs nfs reiserfs xfs af_packet dm_mod; do + for x in md raid0 raid1 raid5 raid6 ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs jfs nfs reiserfs xfs af_packet dm_mod; do manual_add_modules ${x} done diff --git a/init b/init index 113a224..18d31ad 100755 --- a/init +++ b/init @@ -97,9 +97,9 @@ log_begin_msg "Mounting root file system" mountroot log_end_msg -log_begin_msg "Running /scripts/init-bottom" +[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom" run_scripts /scripts/init-bottom -log_end_msg +[ "$quiet" != "y" ] && log_end_msg # Move our /dev to the real filesystem. Do the setup that udev otherwise # would. diff --git a/scripts/local b/scripts/local index 539a2a4..aa2cbfb 100644 --- a/scripts/local +++ b/scripts/local @@ -3,9 +3,9 @@ # Parameter: Where to mount the filesystem mountroot () { - log_begin_msg "Running /scripts/local-top" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top - log_end_msg + [ "$quiet" != "y" ] && log_end_msg # Get the root filesystem type if [ ! -e "${ROOT}" ]; then @@ -14,9 +14,9 @@ mountroot () eval $(fstype < ${ROOT}) - log_begin_msg "Running /scripts/local-premount" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount - log_end_msg + [ "$quiet" != "y" ] && log_end_msg if [ ${readonly} = y ]; then roflag=-r @@ -31,7 +31,7 @@ mountroot () # Mount root mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} - log_begin_msg "Running /scripts/log-bottom" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/log-bottom" run_scripts /scripts/local-bottom - log_end_msg + [ "$quiet" != "y" ] && log_end_msg } diff --git a/scripts/nfs b/scripts/nfs index 10f8f1d..7166b08 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -5,9 +5,9 @@ # Paramter: Where the root should be mounted mountroot () { - log_begin_msg "Running /scripts/nfs-top" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top" run_scripts /scripts/nfs-top - log_end_msg + [ "$quiet" != "y" ] && log_end_msg modprobe nfs # For DHCP @@ -19,9 +19,13 @@ mountroot () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi - log_begin_msg "Running /scripts/nfs-premount" + if [ "x${NFSOPTS}" = "x" ]; then + NFSOPTS="-o retrans=10" + fi + + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount" run_scripts /scripts/nfs-premount - log_end_msg + [ "$quiet" != "y" ] && log_end_msg if [ ${readonly} = y ]; then roflag="-o ro" @@ -30,10 +34,10 @@ mountroot () fi sleep 3 - nfsmount ${roflag} ${NFSROOT} ${rootmnt} + nfsmount ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} - log_begin_msg "Running /scripts/nfs-bottom" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom - log_end_msg + [ "$quiet" != "y" ] && log_end_msg } -- cgit v1.2.3 From a62c8eadea176cc83f83cf1eeeca4aabe59e5a95 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 26 Oct 2005 09:05:53 +0200 Subject: fix stat usage, which is no longer available in newer busybox. use awk instead for determinig major_minor. great patch cures a hang observed on one of my laptops. :-) patch from Adrian Bridgett , #335801. --- debian/changelog | 8 ++++++++ scripts/functions | 6 +++--- scripts/local-premount/suspend | 5 ++--- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 6a608d1..b6eddfa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +initramfs-tools (0.37) unstable; urgency=low + + * scripts/functions, scripts/local-premount/suspend: Use of "stat" + which isn' any more provided by busybox (1.01-3). + Thanks to Adrian Bridgett for the patch using awk. + + -- maximilian attems Wed, 26 Oct 2005 08:43:36 +0200 + initramfs-tools (0.36) unstable; urgency=low "Sunny Autumn Release" diff --git a/scripts/functions b/scripts/functions index 68cfcea..8e82896 100644 --- a/scripts/functions +++ b/scripts/functions @@ -227,9 +227,9 @@ load_modules() if [ -e /sys/power/resume ]; then if [ -e "${resume}" ]; then - major=$((0x$(stat -c%t ${resume}))) - minor=$((0x$(stat -c%T ${resume}))) - echo ${major}:${minor} >/sys/power/resume + major_minor=$(ls -l ${resume} | \ + awk '{printf "0x%x:0x%x", $5, $6}') + echo $major_minor >/sys/power/resume fi fi diff --git a/scripts/local-premount/suspend b/scripts/local-premount/suspend index 6aab596..2e0b43f 100755 --- a/scripts/local-premount/suspend +++ b/scripts/local-premount/suspend @@ -24,7 +24,6 @@ if [ ! -e "${resume}" ]; then fi if [ -e /sys/power/resume ]; then - major=$((0x$(stat -c%t ${resume}))) - minor=$((0x$(stat -c%T ${resume}))) - echo ${major}:${minor} >/sys/power/resume + major_minor=$(ls -l ${resume} | awk '{printf "0x%x:0x%x", $5, $6}') + echo $major_minor >/sys/power/resume fi -- cgit v1.2.3 From 32b804ba08c6d1bbc08491bcb0d50c6e84a75b98 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 2 Nov 2005 07:15:49 +0100 Subject: fix suspend to disk: use decimal numbers. --- debian/changelog | 10 ++++++++-- scripts/functions | 2 +- scripts/local-premount/suspend | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 0c4b918..fea4793 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,9 +2,15 @@ initramfs-tools (0.38) unstable; urgency=low [ dann frazier ] - * Reference correct manpage in initramfs.conf. Closes: #336095 + * initramfs.conf: Reference correct manpage. Closes: #336095 - -- maximilian attems Wed, 2 Nov 2005 06:58:17 +0100 + [ maximilian attems ] + + * scripts/functions, scripts/local-premount/suspend: Fix suspend to disk + by using decimal numbers. Thanks to Adrian Bridgett + for the patch. (Closes: #336936) + + -- maximilian attems Wed, 2 Nov 2005 07:10:45 +0100 initramfs-tools (0.37) unstable; urgency=low diff --git a/scripts/functions b/scripts/functions index 8e82896..5147009 100644 --- a/scripts/functions +++ b/scripts/functions @@ -228,7 +228,7 @@ load_modules() if [ -e /sys/power/resume ]; then if [ -e "${resume}" ]; then major_minor=$(ls -l ${resume} | \ - awk '{printf "0x%x:0x%x", $5, $6}') + awk '{printf "%d:%d", $5, $6}') echo $major_minor >/sys/power/resume fi fi diff --git a/scripts/local-premount/suspend b/scripts/local-premount/suspend index 2e0b43f..0c88ccc 100755 --- a/scripts/local-premount/suspend +++ b/scripts/local-premount/suspend @@ -24,6 +24,6 @@ if [ ! -e "${resume}" ]; then fi if [ -e /sys/power/resume ]; then - major_minor=$(ls -l ${resume} | awk '{printf "0x%x:0x%x", $5, $6}') + major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') echo $major_minor >/sys/power/resume fi -- cgit v1.2.3 From ab06eb34e1a911432aa7c048927eb7e53b0571ee Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 23 Nov 2005 10:45:29 +0100 Subject: fix evms hook --- debian/changelog | 6 ++++-- hooks/evms | 5 +++-- scripts/local-top/evms | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index eac527c..8c92cc0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,11 +3,13 @@ initramfs-tools (0.40) unstable; urgency=high * High urgency upload as udev changed under our feet. Fix RC bugs. * Add needed bits under /lib/udev: udevsynthesize, udev_run_devd, - udev_run_hotplugd. + udev_run_hotplugd. * Pump udev dep on 0.074-3. - -- maximilian attems Wed, 23 Nov 2005 10:12:40 +0100 + * Fix evms hooks properly until they get merged into the evms itself. + + -- maximilian attems Wed, 23 Nov 2005 10:31:57 +0100 initramfs-tools (0.39) unstable; urgency=medium diff --git a/hooks/evms b/hooks/evms index 5affeef..1cbc832 100755 --- a/hooks/evms +++ b/hooks/evms @@ -21,15 +21,16 @@ if [ ! -x /sbin/evms_activate ]; then fi copy_exec /sbin/evms_activate /sbin +cp /etc/evms.conf ${DESTDIR}/etc EVMS_VERSION=$(/usr/sbin/evms_query info | grep "EVMS Version" | awk '{ print $3; }') mkdir -p ${DESTDIR}/lib/evms/${EVMS_VERSION} -for x in disk lvm2 dos multipath; do +for x in bbr bbr_seg bsd disk dos drivelink gpt lvm2 mac md multipath; do copy_exec /lib/evms/${EVMS_VERSION}/${x}* /lib/evms/${EVMS_VERSION} done -for x in dm_mod; do +for x in dm_mod linear raid0 raid1 raid10 raid5 raid6; do manual_add_modules ${x} done diff --git a/scripts/local-top/evms b/scripts/local-top/evms index 2ee7e80..8a99549 100755 --- a/scripts/local-top/evms +++ b/scripts/local-top/evms @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="lvm" +PREREQ="" prereqs() { @@ -26,6 +26,8 @@ case ${evms} in ;; esac -modprobe -q dm-mod +for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do + modprobe -q $module +done /sbin/evms_activate -- cgit v1.2.3 From 2ca278f1b3b60cad9170be85e5fa964f03107640 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 23 Nov 2005 22:56:21 +0100 Subject: evms=${ROOT#/dev/evms/} expression already sets it to . So, the proper behavior is to exit if the volume name starts with a /, and continue if the volume name does not. --- scripts/local-top/evms | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/local-top/evms b/scripts/local-top/evms index 8a99549..46fca5d 100755 --- a/scripts/local-top/evms +++ b/scripts/local-top/evms @@ -18,13 +18,12 @@ esac evms=${ROOT#/dev/evms/} case ${evms} in - /dev/root) - unset evms - ;; /*) exit 0 ;; esac + +unset evms for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do modprobe -q $module -- cgit v1.2.3 From efc90bbb5f64353714175bb4b2225422f3de86b2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Dec 2005 17:19:00 +0100 Subject: resync with latest ubuntu, split udev done by hand. --- break.txt | 4 ++ debian/changelog | 87 +++++++++++++++++++++++++++++++++++++- debian/initramfs-tools.postinst | 5 +++ hooks/acpid | 24 ----------- hooks/thermal | 28 +++++++++++++ hooks/udev | 35 ---------------- init | 69 +++++++++++-------------------- mkinitramfs | 1 + scripts/functions | 92 +++++++---------------------------------- scripts/init-premount/acpid | 19 --------- scripts/init-premount/thermal | 23 +++++++++++ scripts/local | 11 ++++- scripts/nfs | 1 - 13 files changed, 195 insertions(+), 204 deletions(-) create mode 100644 break.txt delete mode 100755 hooks/acpid create mode 100755 hooks/thermal delete mode 100755 hooks/udev delete mode 100755 scripts/init-premount/acpid create mode 100755 scripts/init-premount/thermal (limited to 'scripts') diff --git a/break.txt b/break.txt new file mode 100644 index 0000000..ff26d5b --- /dev/null +++ b/break.txt @@ -0,0 +1,4 @@ +if [ x${break} = xyes ]; then + panic "Spawning shell within the initramfs" +fi + diff --git a/debian/changelog b/debian/changelog index a76d5bd..6a95f20 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,92 @@ initramfs-tools (0.42) unstable; urgency=low that use the mptscsih. Thanks dann frazier for the patch. (Closes: #341162) - -- maximilian attems Thu, 1 Dec 2005 16:42:12 +0100 + * Resync with 0.40ubuntu7. + - Do the udev split by hand as we have a different udev invocation + supporting linux < 2.6.15. Increment udev dep to the version with + initramfs hooks. + - Debian's klibc hasn't yet the nanosleep, waiting for unbroken + linux-headers. + - Don't remove resume support from /etc/mkinitramfs/initramfs.conf + even if bootloader setting is preferred. + + -- maximilian attems Mon, 5 Dec 2005 12:59:59 +0100 + +initramfs-tools (0.40ubuntu7) dapper; urgency=low + + * remove "sleep 3" from the nfs script before the nfsmount command, + its a leftover from debugging in breezy and slows down thin client + booting unnecessary + + -- Oliver Grawert Fri, 2 Dec 2005 11:45:05 +0100 + +initramfs-tools (0.40ubuntu6) dapper; urgency=low + + * When panicking, fork an interactive subshell rather than execing it, so + that if the user fixes things up and exits, we continue rather than + panic the kernel. + * Call update-initramfs in postinst to regenerate the latest initramfs on + upgrades + + -- Matt Zimmerman Thu, 1 Dec 2005 22:23:09 -0800 + +initramfs-tools (0.40ubuntu5) dapper; urgency=low + + * Wait up to 10 seconds for the root device to appear before failing, + allowing SCSI and USB controllers time to settle. There's almost + certainly a more elegant way to do this generically for all mountroot + functions, but for now this will suffice. + + -- Scott James Remnant Thu, 1 Dec 2005 21:28:55 +0000 + +initramfs-tools (0.40ubuntu4) dapper; urgency=low + + * Mount /dev with mode 0755. + + -- Scott James Remnant Thu, 1 Dec 2005 19:30:06 +0000 + +initramfs-tools (0.40ubuntu3) dapper; urgency=low + + "A true friend stabs you in the front." + - Oscar Wilde + + * hooks/acpid: Rename to ... + * hooks/thermal: ... this. Add therm_pm72 for ppc64 systems. + + -- Jeff Bailey Wed, 30 Nov 2005 22:25:01 -0500 + +initramfs-tools (0.40ubuntu2) dapper; urgency=low + + * Rename scripts/init-premount/acpid to scripts/init-premount/thermal + and add therm_pm72 to avoid "vaccum cleaner mode" on ppc64 systems. + + -- Adam Conrad Thu, 1 Dec 2005 12:37:27 +1100 + +initramfs-tools (0.40ubuntu1) dapper; urgency=low + + * Use tmpfs for /dev, instead of ramfs; as tmpfs is swappable. + * Move /proc and /sys to the real filesystem, rather than unmounting them; + slightly reduces workload. + * Replace /root with ${rootmnt} in final usage of /dev/console + * Copy across modprobe blacklist as well as aliases + + * Change the panic/breaknow thing *again*. There's now a break= option + which can be any of top, modules, premount, mount, bottom, init and + causes the initramfs to break at that point. panic/breaknow is now + break=top, without an argument is equivalent to break=premount. + * Run depmod at the top of the init script, so init-top scripts can use + modprobe. + + * Remove udev-specific code: + - depend on the version of udev that includes all of these things itself + - remove udevstart from init + - remove code to move /dev to the real filesystem from init + - remove /sys-based module loading from load_modules + - remove boot_events functions from load_modules + - remove udev copy from mkinitramfs + - remove udev hook script + + -- Scott James Remnant Thu, 24 Nov 2005 21:21:12 +0000 initramfs-tools (0.41) unstable; urgency=high diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index 7d4eff6..c6025e5 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -39,5 +39,10 @@ if [ ! -e /etc/mkinitramfs/modules ]; then cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/ fi +# Regenerate initramfs on upgrade +if [ "$1" = "configure" -a -n "$2" ]; then + update-initramfs -u +fi + #DEBHELPER# diff --git a/hooks/acpid b/hooks/acpid deleted file mode 100755 index 0f3c84c..0000000 --- a/hooks/acpid +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Hooks for loading acpi bits into the initramfs - -. /usr/share/initramfs-tools/hook-functions - -for x in fan thermal; do - manual_add_modules ${x} -done diff --git a/hooks/thermal b/hooks/thermal new file mode 100755 index 0000000..4426de3 --- /dev/null +++ b/hooks/thermal @@ -0,0 +1,28 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Hooks for loading thermal bits into the initramfs + +. /usr/share/initramfs-tools/hook-functions + +# ACPI Systems +for x in fan thermal; do + manual_add_modules ${x} +done + +# PPC64 Systems +manual_add_modules therm_pm72 diff --git a/hooks/udev b/hooks/udev deleted file mode 100755 index 4776d85..0000000 --- a/hooks/udev +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# udev really wants to be able to do socket communications to udevd -# This means that there's a bit of a race condition as the events come -# flooding in and the kernels ability to autoload the 'unix' module. - -# We solve the problem thusly. Hopefully RIP Ubuntu# 12915 - -. /usr/share/initramfs-tools/hook-functions - -force_load unix - -cp -a /etc/udev ${DESTDIR}/etc - -# Hack until udev is built with klibc -copy_exec /sbin/udevd /sbin -copy_exec /sbin/udevsynthesize /sbin - -mkdir "${DESTDIR}/lib/udev" -copy_exec /lib/udev/udevsynthesize /lib/udev diff --git a/init b/init index f8853b1..1f6c732 100755 --- a/init +++ b/init @@ -6,9 +6,12 @@ mkdir /sys mkdir /proc mkdir /tmp mkdir -p /var/lock -mount -t sysfs sysfs /sys -mount -t proc proc /proc -mount -t ramfs none /dev +mount -t sysfs none /sys +mount -t proc 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 +mount -t tmpfs -o mode=0755 udev /dev touch /dev/.initramfs-tools mknod /dev/console c 5 1 mknod /dev/null c 1 3 @@ -56,74 +59,52 @@ for x in $(cat /proc/cmdline); do exec >/tmp/initramfs.debug 2>&1 set -x ;; - break) - break=yes + break=*) + break=${x#break=} ;; - breaknow) - panic "Spawning shell within the initramfs" + break) + break=premount ;; esac done +depmod -a +maybe_break top + # Don't do log messages here to avoid confusing usplash run_scripts /scripts/init-top . /scripts/${BOOT} +parse_numeric ${ROOT} -depmod -a - -# Populate /dev tree -log_begin_msg "Initializing /dev" -udevd_timeout=30 -echo > /proc/sys/kernel/hotplug -mkdir /dev/.udev /dev/.udev/db/ /dev/.udev/queue/ -udevd --daemon -udevsynthesize -while [ -d /dev/.udev/queue/ ]; do - sleep 1 - udevd_timeout=$(($udevd_timeout - 1)) - if [ $udevd_timeout -eq 0 ]; then - break - fi -done -log_end_msg - +maybe_break modules log_begin_msg "Loading modules" load_modules log_end_msg -parse_numeric ${ROOT} - -if [ x${break} = xyes ]; then - panic "Spawning shell within the initramfs" -fi - +maybe_break premount log_begin_msg "Running /scripts/init-premount" run_scripts /scripts/init-premount log_end_msg +maybe_break mount log_begin_msg "Mounting root file system" mountroot log_end_msg +maybe_break mount [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom" run_scripts /scripts/init-bottom [ "$quiet" != "y" ] && log_end_msg -# Move our /dev to the real filesystem. Do the setup that udev otherwise -# would. -killall udevd -mkdir -p /dev/.static/dev -chmod 700 /dev/.static/ -mount -n -o bind ${rootmnt}/dev /dev/.static/dev -mount -n -o move /dev ${rootmnt}/dev +# Move virtual filesystems over to the real filesystem +mount -n -o move /sys ${rootmnt}/sys +mount -n -o move /proc ${rootmnt}/proc -umount /sys -umount /proc - -if [ ! -x ${rootmnt}${init} ]; then +while [ ! -x ${rootmnt}${init} ]; do panic "Target filesystem doesn't have ${init}" -fi +done # Chain to real filesystem -exec run-init ${rootmnt} ${init} "$@" /root/dev/console +maybe_break init +exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console diff --git a/mkinitramfs b/mkinitramfs index 1cba5d5..9892a36 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -181,6 +181,7 @@ copy_exec /sbin/depmod /sbin copy_exec /sbin/rmmod /sbin mkdir -p "${DESTDIR}/etc/modprobe.d" copy_exec /etc/modprobe.d/aliases /etc/modprobe.d +copy_exec /etc/modprobe.d/blacklist /etc/modprobe.d run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks diff --git a/scripts/functions b/scripts/functions index 5147009..8a49c8e 100644 --- a/scripts/functions +++ b/scripts/functions @@ -48,7 +48,14 @@ panic() /sbin/usplash_write "QUIT" fi echo $@ - FS1='(initramfs) ' exec /bin/sh /dev/console 2>&1 + FS1='(initramfs) ' /bin/sh /dev/console 2>&1 +} + +maybe_break() +{ + if [ x$1 = x${break} ]; then + panic "Spawning shell within the initramfs" + fi } render() @@ -152,58 +159,9 @@ run_scripts() call_scripts } -ide_boot_events() { - - modprobe -q ide-generic - - [ -e /proc/ide ] || return - - for drive in /proc/ide/*; do - [ -e ${drive}/media ] || continue - # nothing to do if the device has already been took in charge - unit=${drive#/proc/ide/} - [ -d /sys/block/$unit ] && continue - - read media < $drive/media - case "$media" in - disk) MODULE=ide-disk ;; - cdrom) MODULE=ide-cd ;; - tape) MODULE=ide-tape ;; - floppy) MODULE=ide-floppy ;; - *) MODULE=ide-generic ;; - esac - - modprobe -q ${MODULE} - done -} - -scsi_boot_events() -{ - [ -e /sys/bus/scsi/devices/ ] || return - - for device in /sys/bus/scsi/devices/*; do - [ -e "${device}"/type ] || continue - read media < ${device}/type - case "$media" in - 0) modprobe -q sd_mod; - esac - - done - -} - -i2o_boot_events() -{ - [ -e /sys/bus/i2o/devices/ ] || return - - for device in /sys/bus/i2o/devices/*; do - [ -e ${device}/block ] && modprobe i2o_block - done -} - +# Load custom modules first load_modules() { - # Load custom modules first if [ -e /conf/modules ]; then cat /conf/modules | while read m; do if [ -z "$m" ] \ @@ -216,37 +174,15 @@ load_modules() fi done fi - - ide_boot_events - - scsi_boot_events - - i2o_boot_events - - # FIXME - need to start LVM here - + + # FIXME: wrong place, but it gets done ;) if [ -e /sys/power/resume ]; then if [ -e "${resume}" ]; then - major_minor=$(ls -l ${resume} | \ - awk '{printf "%d:%d", $5, $6}') - echo $major_minor >/sys/power/resume + major=$((0x$(stat -c%t ${resume}))) + minor=$((0x$(stat -c%T ${resume}))) + echo ${major}:${minor} >/sys/power/resume fi fi - - # Give the USB bus a moment to catch up - sleep 2 - - for x in /sys/bus/usb/devices/*; do - if [ -e ${x}/modalias ]; then - modprobe -q $(cat ${x}/modalias) - fi - done - - ide_boot_events - - scsi_boot_events - - i2o_boot_events } parse_numeric() { diff --git a/scripts/init-premount/acpid b/scripts/init-premount/acpid deleted file mode 100755 index 61d226a..0000000 --- a/scripts/init-premount/acpid +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -modprobe -q fan -modprobe -q thermal diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal new file mode 100755 index 0000000..e0d79c3 --- /dev/null +++ b/scripts/init-premount/thermal @@ -0,0 +1,23 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# For ACPI systems +modprobe -q fan +modprobe -q thermal + +# For ppc64 systems +modprobe -q therm_pm72 diff --git a/scripts/local b/scripts/local index aa2cbfb..df09298 100644 --- a/scripts/local +++ b/scripts/local @@ -7,10 +7,17 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg + # Wait for SCSI/USB/etc. devices for a bit + slumber=10 + while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + /bin/sleep 1 + slumber=$(( ${slumber} - 1 )) + done + # Get the root filesystem type - if [ ! -e "${ROOT}" ]; then + while [ ! -e "${ROOT}" ]; do panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" - fi + done eval $(fstype < ${ROOT}) diff --git a/scripts/nfs b/scripts/nfs index 7166b08..a2f6c3e 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -33,7 +33,6 @@ mountroot () roflag="-o rw" fi - sleep 3 nfsmount ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" -- cgit v1.2.3 From 94cdc6efb0303ed4d3db0c7ebd15d08dd935957c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Dec 2005 17:56:44 +0100 Subject: activate all lvm volumes --- debian/changelog | 5 ++++- scripts/local-top/lvm | 7 +------ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 52ac5da..48fd54b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,10 @@ initramfs-tools (0.43) unstable; urgency=low * initramfs.conf: Fix wording choice for resume option. (Closes: #337575) - -- maximilian attems Mon, 5 Dec 2005 17:38:50 +0100 + * local-top/lvm: Activate all lvm groups for future support of + lvm-crypt roots. (Closes: #339087) + + -- maximilian attems Mon, 5 Dec 2005 17:49:43 +0100 initramfs-tools (0.42) unstable; urgency=low diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 7ac81e6..9f608af 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -28,10 +28,5 @@ esac modprobe -q dm-mod -# 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} +vgchange -ay -- cgit v1.2.3 From edfcf7ea648bc07435064df4d8c603db7d26aa56 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 7 Dec 2005 13:27:57 +0100 Subject: remove dup suspend code --- debian/changelog | 4 +++- scripts/functions | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 07c6537..6080b93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,7 +17,9 @@ initramfs-tools (0.43) unstable; urgency=low * TODO: update to current state. - -- maximilian attems Tue, 6 Dec 2005 12:25:48 +0100 + * scripts/functions: remove old duplicate suspend support. + + -- maximilian attems Wed, 7 Dec 2005 13:26:33 +0100 initramfs-tools (0.42) unstable; urgency=low diff --git a/scripts/functions b/scripts/functions index 8a49c8e..cde870d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -174,15 +174,6 @@ load_modules() fi done fi - - # FIXME: wrong place, but it gets done ;) - if [ -e /sys/power/resume ]; then - if [ -e "${resume}" ]; then - major=$((0x$(stat -c%t ${resume}))) - minor=$((0x$(stat -c%T ${resume}))) - echo ${major}:${minor} >/sys/power/resume - fi - fi } parse_numeric() { -- cgit v1.2.3 From 7c5923bbc4ec57eb144b773c0abc8711ffda292a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 12 Dec 2005 11:21:27 +0100 Subject: merge ubuntu modprobe silence stuff and cp all /etc/modprobe.d :) --- debian/changelog | 14 ++++++++++++++ mkinitramfs | 3 +-- scripts/functions | 2 +- scripts/init-premount/thermal | 6 +++--- scripts/local | 9 +-------- scripts/local-top/evms | 2 +- scripts/local-top/lvm | 2 +- scripts/local-top/md | 2 +- scripts/nfs | 4 ++-- 9 files changed, 25 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 6080b93..8683c70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ initramfs-tools (0.43) unstable; urgency=low * scripts/functions: remove old duplicate suspend support. + * Sync with 0.40ubuntu8. (Closes: #337318) + -- maximilian attems Wed, 7 Dec 2005 13:26:33 +0100 initramfs-tools (0.42) unstable; urgency=low @@ -38,6 +40,18 @@ initramfs-tools (0.42) unstable; urgency=low -- maximilian attems Mon, 5 Dec 2005 12:59:59 +0100 +initramfs-tools (0.40ubuntu8) dapper; urgency=low + + * Call modprobe everywhere with "-Qb" to silence messages and allow user + blacklisting. + * Copy the entire /etc/modprobe.d directory to the initramfs, so we can + pick up all user blacklists and options. + * Remove the slumber for SCSI/USB devices from the local filesystem mount + script, udev's init-premount script will take care of this when + necessary. + + -- Scott James Remnant Wed, 7 Dec 2005 16:18:12 +0000 + initramfs-tools (0.40ubuntu7) dapper; urgency=low * remove "sleep 3" from the nfs script before the nfsmount command, diff --git a/mkinitramfs b/mkinitramfs index 9892a36..6855ff3 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -180,8 +180,7 @@ copy_exec /sbin/modprobe /sbin copy_exec /sbin/depmod /sbin copy_exec /sbin/rmmod /sbin mkdir -p "${DESTDIR}/etc/modprobe.d" -copy_exec /etc/modprobe.d/aliases /etc/modprobe.d -copy_exec /etc/modprobe.d/blacklist /etc/modprobe.d +cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d" run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks diff --git a/scripts/functions b/scripts/functions index cde870d..da77542 100644 --- a/scripts/functions +++ b/scripts/functions @@ -170,7 +170,7 @@ load_modules() then continue; else - modprobe -q $m + modprobe -Qb $m fi done fi diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index e0d79c3..64858af 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -16,8 +16,8 @@ prereqs) esac # For ACPI systems -modprobe -q fan -modprobe -q thermal +modprobe -Qb fan +modprobe -Qb thermal # For ppc64 systems -modprobe -q therm_pm72 +modprobe -Qb therm_pm72 diff --git a/scripts/local b/scripts/local index df09298..6c08f39 100644 --- a/scripts/local +++ b/scripts/local @@ -7,13 +7,6 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg - # Wait for SCSI/USB/etc. devices for a bit - slumber=10 - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do - /bin/sleep 1 - slumber=$(( ${slumber} - 1 )) - done - # Get the root filesystem type while [ ! -e "${ROOT}" ]; do panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" @@ -32,7 +25,7 @@ mountroot () fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe -Qb ${FSTYPE} # FIXME This has no error checking # Mount root diff --git a/scripts/local-top/evms b/scripts/local-top/evms index 46fca5d..563a9ae 100755 --- a/scripts/local-top/evms +++ b/scripts/local-top/evms @@ -26,7 +26,7 @@ esac unset evms for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do - modprobe -q $module + modprobe -Qb $module done /sbin/evms_activate diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 9f608af..40c4e9b 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -26,7 +26,7 @@ case ${vg} in ;; esac -modprobe -q dm-mod +modprobe -Qb dm-mod vgchange -ay diff --git a/scripts/local-top/md b/scripts/local-top/md index c7515fe..4132159 100755 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -25,7 +25,7 @@ for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do fi raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') if [ "$raidlvl" ]; then - modprobe -q ${raidlvl} 2>/dev/null + modprobe -Qb ${raidlvl} 2>/dev/null gotraid=y fi done diff --git a/scripts/nfs b/scripts/nfs index a2f6c3e..0205047 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -9,9 +9,9 @@ mountroot () run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg - modprobe nfs + modprobe -Qb nfs # For DHCP - modprobe af_packet + modprobe -Qb af_packet ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf -- cgit v1.2.3 From 1c8330542d7a5d35c10e02db4e210352517176b3 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 12 Dec 2005 11:52:57 +0100 Subject: debian's module-init-tools of testing doesn't have yet the modprobe -Qb interface, keep the change for next time. :( --- debian/changelog | 2 ++ scripts/functions | 2 +- scripts/init-premount/thermal | 6 +++--- scripts/local | 2 +- scripts/local-top/evms | 2 +- scripts/local-top/lvm | 2 +- scripts/local-top/md | 2 +- scripts/nfs | 4 ++-- 8 files changed, 12 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b04358b..1a61807 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,8 @@ initramfs-tools (0.43) unstable; urgency=high * scripts/functions: remove old duplicate suspend support. * Sync with 0.40ubuntu8. (Closes: #337318) + - Revert the modprobe changes for now as modules-init-tools of + testing doesn't have yet the wanted interface. -- maximilian attems Mon, 12 Dec 2005 11:22:15 +0100 diff --git a/scripts/functions b/scripts/functions index da77542..cde870d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -170,7 +170,7 @@ load_modules() then continue; else - modprobe -Qb $m + modprobe -q $m fi done fi diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index 64858af..e0d79c3 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -16,8 +16,8 @@ prereqs) esac # For ACPI systems -modprobe -Qb fan -modprobe -Qb thermal +modprobe -q fan +modprobe -q thermal # For ppc64 systems -modprobe -Qb therm_pm72 +modprobe -q therm_pm72 diff --git a/scripts/local b/scripts/local index 6c08f39..979f07d 100644 --- a/scripts/local +++ b/scripts/local @@ -25,7 +25,7 @@ mountroot () fi # FIXME This has no error checking - modprobe -Qb ${FSTYPE} + modprobe ${FSTYPE} # FIXME This has no error checking # Mount root diff --git a/scripts/local-top/evms b/scripts/local-top/evms index 563a9ae..46fca5d 100755 --- a/scripts/local-top/evms +++ b/scripts/local-top/evms @@ -26,7 +26,7 @@ esac unset evms for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do - modprobe -Qb $module + modprobe -q $module done /sbin/evms_activate diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 40c4e9b..9f608af 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -26,7 +26,7 @@ case ${vg} in ;; esac -modprobe -Qb dm-mod +modprobe -q dm-mod vgchange -ay diff --git a/scripts/local-top/md b/scripts/local-top/md index 4132159..c7515fe 100755 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -25,7 +25,7 @@ for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do fi raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') if [ "$raidlvl" ]; then - modprobe -Qb ${raidlvl} 2>/dev/null + modprobe -q ${raidlvl} 2>/dev/null gotraid=y fi done diff --git a/scripts/nfs b/scripts/nfs index 0205047..a2f6c3e 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -9,9 +9,9 @@ mountroot () run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg - modprobe -Qb nfs + modprobe nfs # For DHCP - modprobe -Qb af_packet + modprobe af_packet ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf -- cgit v1.2.3 From 05982a63b2425a309325ba7a945a4bb11fd6146d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 12 Dec 2005 16:03:17 +0100 Subject: revert activate all vg, may leed to data loss. --- debian/changelog | 5 +---- scripts/local-top/lvm | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 1a61807..8b14a93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -initramfs-tools (0.43) unstable; urgency=high +initramfs-tools (0.44) unstable; urgency=high "O partigiano portami via" @@ -6,9 +6,6 @@ initramfs-tools (0.43) unstable; urgency=high * initramfs.conf: Fix wording choice for resume option. (Closes: #337575) - * local-top/lvm: Activate all lvm groups for future support of - lvm-crypt roots. (Closes: #339087) - * hooks/kernelextras: Really fix #335505. Don't expand wildcase to current dir. (Closes: #342153) diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 9f608af..7ac81e6 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -28,5 +28,10 @@ esac modprobe -q dm-mod -vgchange -ay +# 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} -- cgit v1.2.3 From 0f9b079738bd9e63896735b80d1768e34fc0b8ea Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 29 Dec 2005 10:30:39 +0100 Subject: add hook ide depending on udev loads ide-disk and ide-generic on all needed ide cases. --- debian/changelog | 10 ++++++++-- scripts/init-premount/ide | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 scripts/init-premount/ide (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b53ff18..e054662 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ -initramfs-tools (0.45) unstable; urgency=low +initramfs-tools (0.45) unstable; urgency=high + + "Che mi sento di morir." * Unset debug before calling init, confuses /etc/init.d/rc. - -- maximilian attems Tue, 27 Dec 2005 19:12:31 +0100 + * scripts/init-premount/ide: Load uncondionally for ide boots ide-generic + and also ide-disk, as udev ignores them. High urgency upload for rc bugs. + (Closes: #332824, #342925, #344754, #337045, #338406) + + -- maximilian attems Thu, 29 Dec 2005 10:28:11 +0100 initramfs-tools (0.44) unstable; urgency=high diff --git a/scripts/init-premount/ide b/scripts/init-premount/ide new file mode 100644 index 0000000..03a3fdf --- /dev/null +++ b/scripts/init-premount/ide @@ -0,0 +1,38 @@ +#!/bin/sh + +PREREQ="udev" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +modprobe -q ide-generic + +[ -e /proc/ide ] || return + +for drive in /proc/ide/*; do + [ -e ${drive}/media ] || continue + # nothing to do if the device has already been took in charge + unit=${drive#/proc/ide/} + [ -d /sys/block/$unit ] && continue + + read media < $drive/media + case "$media" in + disk) MODULE=ide-disk ;; + cdrom) MODULE=ide-cd ;; + tape) MODULE=ide-tape ;; + floppy) MODULE=ide-floppy ;; + *) MODULE=ide-generic ;; + esac + + modprobe -q ${MODULE} +done -- cgit v1.2.3 From 8c914c8ced50b1eb8c62353bb73101347212a862 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 29 Dec 2005 14:12:28 +0100 Subject: upps had included the .bzr files due to newer dev machine. --- debian/changelog | 12 ++++++++++-- scripts/init-premount/ide | 0 2 files changed, 10 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/init-premount/ide (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index e054662..cef2ae6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.46) unstable; urgency=low + + * Don't include .bzr dirs in source upload. + Thanks Frederik Schler + + -- maximilian attems Thu, 29 Dec 2005 14:07:07 +0100 + initramfs-tools (0.45) unstable; urgency=high "Che mi sento di morir." @@ -6,9 +13,10 @@ initramfs-tools (0.45) unstable; urgency=high * scripts/init-premount/ide: Load uncondionally for ide boots ide-generic and also ide-disk, as udev ignores them. High urgency upload for rc bugs. - (Closes: #332824, #342925, #344754, #337045, #338406) + Thanks Frans Pop and Joey Hess for + testing! (Closes: #332824, #342925, #344754, #337045, #338406) - -- maximilian attems Thu, 29 Dec 2005 10:28:11 +0100 + -- maximilian attems Thu, 29 Dec 2005 10:34:32 +0100 initramfs-tools (0.44) unstable; urgency=high diff --git a/scripts/init-premount/ide b/scripts/init-premount/ide old mode 100644 new mode 100755 -- cgit v1.2.3 From bce0c73e77b777ef03894d703c727dbf4b0f4298 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 14 Jan 2006 17:34:00 +0100 Subject: evms took their own hooks. :) --- debian/changelog | 7 +++++++ hooks/evms | 36 ------------------------------------ scripts/local-top/evms | 32 -------------------------------- 3 files changed, 7 insertions(+), 68 deletions(-) delete mode 100755 hooks/evms delete mode 100755 scripts/local-top/evms (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index aee598d..79b7c9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.50) unstable; urgency=low + + * EVMS takes care of it's own hooks, rm: hooks/evms, scripts/local-top/evms. + Thanks Steinar H. Gunderson . (Closes: 340258) + + -- maximilian attems Sat, 14 Jan 2006 17:26:24 +0100 + initramfs-tools (0.49) unstable; urgency=low * Pump dephelper to 4.1.0 dependency as pointed out by linda. diff --git a/hooks/evms b/hooks/evms deleted file mode 100755 index a58b2a4..0000000 --- a/hooks/evms +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -prereqs) - prereqs - exit 0 - ;; -esac - -. /usr/share/initramfs-tools/hook-functions - -if [ ! -x /sbin/evms_activate ]; then - exit 0 -fi - -copy_exec /sbin/evms_activate /sbin -cp /etc/evms.conf ${DESTDIR}/etc - -EVMS_VERSION=$(/usr/sbin/evms_query info | grep "EVMS Version" | awk '{ print $3; }') - -mkdir -p ${DESTDIR}/lib/evms/${EVMS_VERSION} - -for x in bbr bbr_seg bsd disk dos drivelink gpt lvm2 mac md multipath; do - copy_exec /lib/evms/${EVMS_VERSION}/${x}-*.so /lib/evms/${EVMS_VERSION} -done - -for x in dm_mod linear raid0 raid1 raid10 raid5 raid6; do - manual_add_modules ${x} -done diff --git a/scripts/local-top/evms b/scripts/local-top/evms deleted file mode 100755 index 46fca5d..0000000 --- a/scripts/local-top/evms +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -evms=${ROOT#/dev/evms/} - -case ${evms} in - /*) - exit 0 - ;; -esac - -unset evms - -for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do - modprobe -q $module -done - -/sbin/evms_activate -- cgit v1.2.3 From 270657ae007b35223c57829bfa6ed2e331eed851 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 23 Jan 2006 21:39:16 +0100 Subject: Call panic on circular deps to get rescue shell. --- debian/changelog | 6 ++++++ scripts/functions | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 4d3195f..f354777 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +initramfs-tools (0.51) unstable; urgency=low + + * scripts/functions: Call panic on circular deps to get rescue shell. + + -- maximilian attems Mon, 23 Jan 2006 21:37:45 +0100 + initramfs-tools (0.50c) unstable; urgency=low "E so io muoio da partigiano" diff --git a/scripts/functions b/scripts/functions index cde870d..f9cad01 100644 --- a/scripts/functions +++ b/scripts/functions @@ -138,8 +138,7 @@ reduce_prereqs() fi done if [ ${i} -eq ${oldi} ]; then - echo "PANIC: Circular dependancy. Exiting." >&2 - exit 1 + panic "PANIC: Circular dependancy. Exiting." fi done } -- cgit v1.2.3 From 5ac8871bdc5093eb2b570937dcc37167b904cb8e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 24 Jan 2006 12:27:42 +0100 Subject: sync 0.40ubuntu16 --- debian/changelog | 72 ++++++++++++++++++++++++++++++++++++++++++- debian/control | 2 +- hook-functions | 10 +++++- hooks/thermal | 17 +++++----- init | 6 ++++ mkinitramfs | 4 +++ scripts/functions | 18 ++++++++--- scripts/init-premount/thermal | 16 ++++++---- update-initramfs | 12 ++++++++ 9 files changed, 137 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 1308f23..b82a343 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,12 @@ initramfs-tools (0.51) unstable; urgency=low * mkinitramfs: Use ${CONFDIR} everywhere. - -- maximilian attems Mon, 23 Jan 2006 21:46:45 +0100 + * Sync with 0.40ubuntu16: + - skip 0.40ubuntu15 udev gets fixed to only call update-initramfs + when /etc/mkinitramfs/initramfs.conf is there. + - 0.40ubuntu13 don't take over all initramfs images in Debian. + + -- maximilian attems Tue, 24 Jan 2006 11:12:18 +0100 initramfs-tools (0.50c) unstable; urgency=low @@ -109,6 +114,71 @@ initramfs-tools (0.42) unstable; urgency=low -- maximilian attems Mon, 5 Dec 2005 12:59:59 +0100 +initramfs-tools (0.40ubuntu16) dapper; urgency=low + + * Bump klibc-utils dependency to (>= 1.1.16-1), for hppa and ia64. + + -- Adam Conrad Thu, 19 Jan 2006 04:00:39 +1100 + +initramfs-tools (0.40ubuntu15) dapper; urgency=low + + * Drop the udev dependency, so we always get configured before udev. + We can get away with this now that udev hooks/scripts have been split + into the udev package proper. This should close Malone bug #28808. + + -- Adam Conrad Wed, 18 Jan 2006 22:50:27 +1100 + +initramfs-tools (0.40ubuntu14) dapper; urgency=low + + * If copy_exec is asked to copy to the same location twice, check if + we're copying the same file again. If so, do nothing and carry on, if + not, warn that we asked it for an impossibility, and don't overwrite. + + -- Adam Conrad Thu, 12 Jan 2006 18:00:12 +1100 + +initramfs-tools (0.40ubuntu13) dapper; urgency=low + + * Default to taking over other initramfs images in Ubuntu, as this is + more consistent with what our packaging expects to be able to do. + * Make "update-initramfs -u" try to find the running kernel before it + attempts to search the symbolic link list and its own sha1 list. + + -- Adam Conrad Wed, 11 Jan 2006 16:25:20 +1100 + +initramfs-tools (0.40ubuntu12) dapper; urgency=low + + * Oops, move the progress state file into the new directory too. + + -- Adam Conrad Mon, 9 Jan 2006 21:26:44 +1100 + +initramfs-tools (0.40ubuntu11) dapper; urgency=low + + * Move the state directory from /dev/initramfs to /dev/.initramfs + + -- Adam Conrad Mon, 9 Jan 2006 21:17:50 +1100 + +initramfs-tools (0.40ubuntu10) dapper; urgency=low + + * Create the /dev/initramfs directory as soon as we mount /dev, so other + packages that need a playground in /dev can do so in a uniform location. + * Update the usplash progress bar every time we are asked to output a + success or failure value from an init action, and write our progress to + /dev/initramfs for sysv-init to gather up and pick up where we left off. + * Export $DPKG_ARCH in both mkinitramfs (for use by hooks) and initramfs. + * Use $DPKG_ARCH in the thermal hook/script to divide the x86 stuff from + the powerpc stuff, not because we have to, but as an example to others. + + -- Adam Conrad Mon, 9 Jan 2006 10:51:51 +1100 + +initramfs-tools (0.40ubuntu9) dapper; urgency=low + + * Make some changes to cope with the new and improved klibc packaging: + - Add a force to the deletion of ${DESTDIR}/bin/sh, to avoid errors. + - Cope with libklibc moving from /usr/lib/klibc/lib to /lib. + - Bump dependency on klibc-utils to one new enough for the above. + + -- Adam Conrad Thu, 5 Jan 2006 15:13:15 +1100 + initramfs-tools (0.40ubuntu8) dapper; urgency=low * Call modprobe everywhere with "-Qb" to silence messages and allow user diff --git a/debian/control b/debian/control index 4e06b8e..b4124ab 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.6.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.1.14-2), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, udev (>= 0.076-5) +Depends: klibc-utils (>= 1.1.16-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, udev (>= 0.076-5) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged diff --git a/hook-functions b/hook-functions index d3fe0a3..000c701 100644 --- a/hook-functions +++ b/hook-functions @@ -54,7 +54,15 @@ manual_add_modules() # $1 is source # $2 is relative destination copy_exec() { - ln -s ${1} ${DESTDIR}/${2} + final_destination=${DESTDIR}/${2}/`basename ${1}` + if [ -L "$final_destination" ]; then + if ! [ `readlink ${final_destination}` = "${1}" ]; then + echo "W:copy_exec: Not copying ${1} to \$DESTDIR${2}/`basename ${1}`, which is already a copy of `readlink ${final_destination}`" >&2 + return + fi + else + ln -s ${1} ${DESTDIR}/${2} + fi # Copy the dependant libraries for x in $(ldd ${1} 2>/dev/null | sed -e ' diff --git a/hooks/thermal b/hooks/thermal index 4426de3..c27c957 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -19,10 +19,13 @@ esac . /usr/share/initramfs-tools/hook-functions -# ACPI Systems -for x in fan thermal; do - manual_add_modules ${x} -done - -# PPC64 Systems -manual_add_modules therm_pm72 +case "$DPKG_ARCH" in +# copy the right modules +powerpc|ppc64) + manual_add_modules therm_pm72 + ;; +i386|amd64|ia64) + manual_add_modules fan + manual_add_modules thermal + ;; +esac diff --git a/init b/init index db18f15..e983534 100755 --- a/init +++ b/init @@ -13,9 +13,15 @@ mount -t proc none /proc # are used; which they will be, but it's worth pointing out mount -t tmpfs -o mode=0755 udev /dev touch /dev/.initramfs-tools +mkdir /dev/.initramfs mknod /dev/console c 5 1 mknod /dev/null c 1 3 +# Export the dpkg architecture +export DPKG_ARCH= +. /conf/arch.conf + +# Bring in the main config . /conf/initramfs.conf . /scripts/functions diff --git a/mkinitramfs b/mkinitramfs index 9b9e734..d3d6504 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -126,12 +126,15 @@ fi DESTDIR="$(mktemp -t -d mkinitramfs_XXXXXX)" || exit 1 __TMPCPIOGZ="$(mktemp -t mkinitramfs-OL_XXXXXX)" || exit 1 +DPKG_ARCH=`dpkg --print-installation-architecture` + # Export environment for hook scripts. # export MODULESDIR export version export CONFDIR export DESTDIR +export DPKG_ARCH # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ @@ -168,6 +171,7 @@ for f in $(cd ${CONFDIR}/scripts && \ mkdir --parents "${DESTDIR}/scripts/$(dirname "${f}")" cp -p "${CONFDIR}/scripts/${f}" "${DESTDIR}/scripts/$(dirname "${f}")" done +echo "DPKG_ARCH=${DPKG_ARCH}" > ${DESTDIR}/conf/arch.conf copy_exec "${CONFDIR}/initramfs.conf" /conf # Busybox diff --git a/scripts/functions b/scripts/functions index f9cad01..7f8fa3c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -35,12 +35,22 @@ log_end_msg() /sbin/usplash_write "SUCCESS ok" fi _log_msg "Done." + update_progress } -# update_progress() # ToDo: NOP placeholder... what else for usplash? -# { -# : -# } +update_progress() +{ + if [ -z "$PROGRESS_STATE" ]; then + export PROGRESS_STATE=0 + fi + + PROGRESS_STATE=$(($PROGRESS_STATE + 1)) + echo "PROGRESS_STATE=${PROGRESS_STATE}" > /dev/.initramfs/progress_state + + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "PROGRESS $PROGRESS_STATE" + fi +} panic() { diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index e0d79c3..a41f6f3 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -15,9 +15,13 @@ prereqs) ;; esac -# For ACPI systems -modprobe -q fan -modprobe -q thermal - -# For ppc64 systems -modprobe -q therm_pm72 +case "$DPKG_ARCH" in +# load the right modules +powerpc|ppc64) + modprobe -q therm_pm72 + ;; +i386|amd64|ia64) + modprobe -q fan + modprobe -q thermal + ;; +esac diff --git a/update-initramfs b/update-initramfs index 644a1aa..0d757b1 100644 --- a/update-initramfs +++ b/update-initramfs @@ -112,6 +112,13 @@ get_sorted_versions() verbose "Available versions: ${version_list}" } +set_current_version() +{ + if [ -f /boot/vmlinu?-`uname -r` ]; then + version=`uname -r` + fi +} + set_linked_version() { if [ -L /initrd.img ]; then @@ -159,6 +166,10 @@ create() update() { + if [ -z "${version}" ]; then + set_current_version + fi + if [ -z "${version}" ]; then set_linked_version fi @@ -227,6 +238,7 @@ altered_check() # Defaults verbose=0 yes=0 +# We default to takeover=1 in Ubuntu, but not Debian takeover=0 ## -- cgit v1.2.3 From e31be60a62406ef81d949eb67ac2bc64e90bf4ad Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 24 Jan 2006 13:10:56 +0100 Subject: take care of modular atkb and i8042. seen on the Debian ppc .config!? --- debian/changelog | 7 ++++++- hook-functions | 2 +- scripts/functions | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b82a343..9704e27 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,8 +8,13 @@ initramfs-tools (0.51) unstable; urgency=low - skip 0.40ubuntu15 udev gets fixed to only call update-initramfs when /etc/mkinitramfs/initramfs.conf is there. - 0.40ubuntu13 don't take over all initramfs images in Debian. + + * hook-functions: auto_add_modules atkb and i8042. + + * scripts/functions: on panic modprobe atkb and i8042 - work around for + broken configs, where those are not build in. (Closes: #337497) - -- maximilian attems Tue, 24 Jan 2006 11:12:18 +0100 + -- maximilian attems Tue, 24 Jan 2006 13:04:40 +0100 initramfs-tools (0.50c) unstable; urgency=low diff --git a/hook-functions b/hook-functions index 000c701..bb44d9e 100644 --- a/hook-functions +++ b/hook-functions @@ -137,7 +137,7 @@ dep_add_modules() auto_add_modules() { # base - for x in ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs jfs nfs reiserfs xfs af_packet; do + for x in ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs jfs nfs reiserfs xfs af_packet atkbd i8042; do manual_add_modules "${x}" done diff --git a/scripts/functions b/scripts/functions index 7f8fa3c..2113745 100644 --- a/scripts/functions +++ b/scripts/functions @@ -57,6 +57,8 @@ panic() if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "QUIT" fi + modprobe -q i8042 + modprobe -q atkbd echo $@ FS1='(initramfs) ' /bin/sh /dev/console 2>&1 } -- cgit v1.2.3 From 0403b8bc09e6a4e499e3489ac24359a24e20d16a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 24 Jan 2006 13:13:56 +0100 Subject: check for /dev/.initramfs/ before writing into it, seen on an testboot with "break=init". --- debian/changelog | 7 +++++-- scripts/functions | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 9704e27..fb9f4ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,13 +8,16 @@ initramfs-tools (0.51) unstable; urgency=low - skip 0.40ubuntu15 udev gets fixed to only call update-initramfs when /etc/mkinitramfs/initramfs.conf is there. - 0.40ubuntu13 don't take over all initramfs images in Debian. - + * hook-functions: auto_add_modules atkb and i8042. * scripts/functions: on panic modprobe atkb and i8042 - work around for broken configs, where those are not build in. (Closes: #337497) - -- maximilian attems Tue, 24 Jan 2006 13:04:40 +0100 + * scripts/functions: update_progress check if /dev/.initramfs/ exists + before writing into it. + + -- maximilian attems Tue, 24 Jan 2006 13:11:24 +0100 initramfs-tools (0.50c) unstable; urgency=low diff --git a/scripts/functions b/scripts/functions index 2113745..c550123 100644 --- a/scripts/functions +++ b/scripts/functions @@ -44,8 +44,11 @@ update_progress() export PROGRESS_STATE=0 fi - PROGRESS_STATE=$(($PROGRESS_STATE + 1)) - echo "PROGRESS_STATE=${PROGRESS_STATE}" > /dev/.initramfs/progress_state + if [ -d /dev/.initramfs ]; then + PROGRESS_STATE=$(($PROGRESS_STATE + 1)) + echo "PROGRESS_STATE=${PROGRESS_STATE}" \ + > /dev/.initramfs/progress_state + fi if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "PROGRESS $PROGRESS_STATE" -- cgit v1.2.3 From 8281a8acd88b580a75585e254c068c01e70404a1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 6 Feb 2006 00:48:57 +0100 Subject: rename ide -> udev-helper as this is an debian udev workaround and will need more. --- debian/changelog | 8 +++++--- scripts/init-premount/ide | 38 -------------------------------------- scripts/init-premount/udev-helper | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 41 deletions(-) delete mode 100755 scripts/init-premount/ide create mode 100755 scripts/init-premount/udev-helper (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index ccc9223..67daa85 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,13 @@ initramfs-tools (0.52) unstable; urgency=low - * hooks/lvm: manual_add_modules dm_snapshot, allows to boot from a snapshot - of your root device. (ubuntu: #3842) + * hooks/lvm: manual_add_modules dm_snapshot, will allow boot from lvm + snapshot. (ubuntu: #3842) * init: Fix maybe_break test for the bottom stage. + + * scripts/init-premount/udev-helper: Renamed from scripts/init-premount/ide. - -- maximilian attems Mon, 30 Jan 2006 00:56:04 +0100 + -- maximilian attems Mon, 6 Feb 2006 00:47:53 +0100 initramfs-tools (0.51) unstable; urgency=low diff --git a/scripts/init-premount/ide b/scripts/init-premount/ide deleted file mode 100755 index 03a3fdf..0000000 --- a/scripts/init-premount/ide +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -PREREQ="udev" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -modprobe -q ide-generic - -[ -e /proc/ide ] || return - -for drive in /proc/ide/*; do - [ -e ${drive}/media ] || continue - # nothing to do if the device has already been took in charge - unit=${drive#/proc/ide/} - [ -d /sys/block/$unit ] && continue - - read media < $drive/media - case "$media" in - disk) MODULE=ide-disk ;; - cdrom) MODULE=ide-cd ;; - tape) MODULE=ide-tape ;; - floppy) MODULE=ide-floppy ;; - *) MODULE=ide-generic ;; - esac - - modprobe -q ${MODULE} -done diff --git a/scripts/init-premount/udev-helper b/scripts/init-premount/udev-helper new file mode 100755 index 0000000..03a3fdf --- /dev/null +++ b/scripts/init-premount/udev-helper @@ -0,0 +1,38 @@ +#!/bin/sh + +PREREQ="udev" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +modprobe -q ide-generic + +[ -e /proc/ide ] || return + +for drive in /proc/ide/*; do + [ -e ${drive}/media ] || continue + # nothing to do if the device has already been took in charge + unit=${drive#/proc/ide/} + [ -d /sys/block/$unit ] && continue + + read media < $drive/media + case "$media" in + disk) MODULE=ide-disk ;; + cdrom) MODULE=ide-cd ;; + tape) MODULE=ide-tape ;; + floppy) MODULE=ide-floppy ;; + *) MODULE=ide-generic ;; + esac + + modprobe -q ${MODULE} +done -- cgit v1.2.3 From 830fd3fa51658cf0398cbb037a8485439ae4ce2d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 27 Feb 2006 00:20:17 +0100 Subject: sync with ubuntu22 + some handmerges --- conf/initramfs.conf | 4 ++- debian/changelog | 63 ++++++++++++++++++++++++++++++++++++++++--- hook-functions | 59 +++++++++++++++++++++++----------------- init | 12 +++++++-- initramfs.conf.5 | 2 ++ mkinitramfs | 5 ++++ scripts/functions | 9 +++---- scripts/init-premount/thermal | 1 + scripts/nfs | 4 +-- 9 files changed, 121 insertions(+), 38 deletions(-) (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 38a0594..a9cadf7 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -4,12 +4,14 @@ # # -# MODULES: [ most | dep | list ] +# MODULES: [ most | netboot | dep | list ] # # most - Add all framebuffer, acpi, filesystem, and harddrive drivers. # # dep - Try and guess which modules to load. # +# netboot - Add the base modules, network modules, but skip block devices. +# # list - Only include modules from the 'additional modules' list # diff --git a/debian/changelog b/debian/changelog index a20ff37..74facf0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,20 @@ -initramfs-tools (0.52c) unstable; urgency=high +initramfs-tools (0.53) unstable; urgency=high * update-initramfs: set_current_version needs to check against - /boot/initrd-`uname -r` and not /boot/vmlinu?-`uname -r`. + /boot/initrd-`uname -r` and not /boot/vmlinu?-`uname -r`. Otherwise this builds initramfs for newer handbuild trees too. - -- maximilian attems Mon, 20 Feb 2006 15:46:54 +0100 + * Resync with 0.40ubuntu22: + - mptspi already included + - keep nfsmount for now, we don't want to add further busybox deps. + * Further reduce ubuntudiff: + - scripts/functions: remove duplicate dir check. + - scripts/nfs: add quiet to modules loading. + + * Add kernel-package compat stuff, behaves like mkinitramfs, + but adds the sha1sum for update-initramfs. + + -- maximilian attems Thu, 23 Feb 2006 16:59:56 +0100 initramfs-tools (0.52b) unstable; urgency=high @@ -155,6 +165,53 @@ initramfs-tools (0.42) unstable; urgency=low even if bootloader setting is preferred. -- maximilian attems Mon, 5 Dec 2005 12:59:59 +0100 +initramfs-tools (0.40ubuntu22) dapper; urgency=low + + * Add mptspi to the list of SCSI modules put in the initramfs by default, + which is required for some LSI Logic controllers and for the VMware SCSI + controller in recent VMware versions (See launchpad.net/{27187,31229}) + * Fix typo of /dev/disk/by-*, which I wrote as /dev/disks/by-{uuid,label} + * Load i2c-keywest before loading therm_pm72 in the PowerPC thermal hook, + since the latter sometimes needs the former (Closes launchpad.net/27269) + + -- Adam Conrad Tue, 14 Feb 2006 23:28:35 +1100 + +initramfs-tools (0.40ubuntu21) dapper; urgency=low + + * Don't update the progress bar once udev has taken /dev away; + after all, we can't contact usplash anyway at this point. + + -- Scott James Remnant Wed, 8 Feb 2006 14:34:10 +0000 + +initramfs-tools (0.40ubuntu20) dapper; urgency=low + + * Add ... to end of strings to match main boot sequence. + + -- Scott James Remnant Tue, 7 Feb 2006 11:07:50 +0000 + +initramfs-tools (0.40ubuntu19) dapper; urgency=low + + * Change the first of many "Loading modules" to "Loading essential drivers" + to improve debugging when people say it breaks at that stage. + + -- Scott James Remnant Tue, 7 Feb 2006 11:05:15 +0000 + +initramfs-tools (0.40ubuntu18) dapper; urgency=low + + * Add support for selecting root by UUID or LABEL with syntax such as: + root=LABEL=myrootfs or root=UUID=92addf34-0f02-4a0e-bfb2-cbaa1e907b77 + + -- Adam Conrad Fri, 3 Feb 2006 15:55:01 +0000 + +initramfs-tools (0.40ubuntu17) dapper; urgency=low + + * Make auto_add_modules take an argument, so you can use it to add only + some of the auto* modules (like "net" or "ide"), and create a "netboot" + option that only includes base and net (Closes launchpad.net/26426) + * Change the nfs script to use "mount -o nolock" instead of "nfsmount", + to fix some timeouts for ltsp NFS roots (Closes launchpad.net/19196) + + -- Adam Conrad Tue, 31 Jan 2006 11:55:11 +0000 initramfs-tools (0.40ubuntu16) dapper; urgency=low diff --git a/hook-functions b/hook-functions index bb44d9e..51e0a8d 100644 --- a/hook-functions +++ b/hook-functions @@ -136,31 +136,40 @@ dep_add_modules() # Modules that we always add to the initramfs auto_add_modules() { - # base - for x in ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs jfs nfs reiserfs xfs af_packet atkbd i8042; do - manual_add_modules "${x}" - done - - # Ethernet - for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi forcedeth hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do - manual_add_modules "${x}" - done - - # ide - for x in ide-cd ide-disk ide-generic aec62xx alim15x3 amd74xx atiixp atuuxo cmd64x cs5520 cs5530 cy82c693 generic hpt34x hpt366 ns87415 opti621 pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks siimage sis5513 slc82c105 slc90e66 triflex trm290 via82cxxx; do - manual_add_modules "${x}" - done - - # scsi - for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain ibmvscsic initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptscsih mptspi nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do - manual_add_modules "${x}" - done - - # i2o - for x in i2o_block; do - manual_add_modules "${x}" - done - + case "$1" in + base) + for x in ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 ext3 isofs jfs nfs reiserfs xfs af_packet atkbd i8042; do + manual_add_modules "${x}" + done + ;; + net) + for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx dl2k e1000 e100 epic100 eql fealnx famachi forcedeth hp100 mace mv643xx_eth natsemi ne2k-pci netconsole ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire sundance sungem sungem_phy sunhme tg3 tlan de2104x de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb typhon via-rhine via-velocity yellowfin; do + manual_add_modules "${x}" + done + ;; + ide) + for x in ide-cd ide-disk ide-generic aec62xx alim15x3 amd74xx atiixp atuuxo cmd64x cs5520 cs5530 cy82c693 generic hpt34x hpt366 ns87415 opti621 pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks siimage sis5513 slc82c105 slc90e66 triflex trm290 via82cxxx; do + manual_add_modules "${x}" + done + ;; + scsi) + for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic cciss ch dc395x dmx3191d dpt_i2o eata fdomain ibmvscsic initio ipr ips isp1020 lpfc max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptscsih mptspi nsp32 osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_promise sata_nv sata_qstor sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc scsi_mod scsi_transport_fc scsi_transport_iscsi scsi_transport_spi sd_mod sym53c8xx tmscsim; do + manual_add_modules "${x}" + done + ;; + i2o) + for x in i2o_block; do + manual_add_modules "${x}" + done + ;; + *) + auto_add_modules base + auto_add_modules net + auto_add_modules ide + auto_add_modules scsi + auto_add_modules i2o + ;; + esac } usage() diff --git a/init b/init index 61a8379..f4ec157 100755 --- a/init +++ b/init @@ -41,6 +41,14 @@ for x in $(cat /proc/cmdline); do ;; root=*) ROOT=${x#root=} + case $ROOT in + LABEL=*) + ROOT="/dev/disk/by-label/${ROOT#LABEL=}" + ;; + UUID=*) + ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" + ;; + esac ;; nfsroot=*) NFSROOT=${x#nfsroot=} @@ -84,7 +92,7 @@ run_scripts /scripts/init-top parse_numeric ${ROOT} maybe_break modules -log_begin_msg "Loading modules" +log_begin_msg "Loading essential drivers..." load_modules log_end_msg @@ -94,7 +102,7 @@ run_scripts /scripts/init-premount log_end_msg maybe_break mount -log_begin_msg "Mounting root file system" +log_begin_msg "Mounting root file system..." mountroot log_end_msg diff --git a/initramfs.conf.5 b/initramfs.conf.5 index a1cb341..c289ee2 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -22,6 +22,8 @@ The default setting is \fImost\fP. \fIdep\fP tries to guess which modules are necessary for the running box. +\fInetboot\fP adds the base modules, network modules, but skips block devices. + \fIlist\fP includes only modules from the additional modules list. .TP diff --git a/mkinitramfs b/mkinitramfs index d3d6504..6c2be32 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -158,6 +158,11 @@ if [ "${MODULES}" = "most" ]; then auto_add_modules fi +if [ "${MODULES}" = "netboot" ]; then + auto_add_modules base + auto_add_modules net +fi + # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. diff --git a/scripts/functions b/scripts/functions index c550123..6825519 100644 --- a/scripts/functions +++ b/scripts/functions @@ -40,15 +40,14 @@ log_end_msg() update_progress() { + [ -d /dev/.initramfs ] || return + if [ -z "$PROGRESS_STATE" ]; then export PROGRESS_STATE=0 fi - if [ -d /dev/.initramfs ]; then - PROGRESS_STATE=$(($PROGRESS_STATE + 1)) - echo "PROGRESS_STATE=${PROGRESS_STATE}" \ - > /dev/.initramfs/progress_state - fi + PROGRESS_STATE=$(($PROGRESS_STATE + 1)) + echo "PROGRESS_STATE=${PROGRESS_STATE}" > /dev/.initramfs/progress_state if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "PROGRESS $PROGRESS_STATE" diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index a41f6f3..d59af8a 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -18,6 +18,7 @@ esac case "$DPKG_ARCH" in # load the right modules powerpc|ppc64) + modprobe -q i2c-keywest modprobe -q therm_pm72 ;; i386|amd64|ia64) diff --git a/scripts/nfs b/scripts/nfs index a2f6c3e..89b5c20 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -9,9 +9,9 @@ mountroot () run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg - modprobe nfs + modprobe -q nfs # For DHCP - modprobe af_packet + modprobe -q af_packet ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf -- cgit v1.2.3 From 0d1c081c48fbfb69cbf6932e358971e7d29c45e1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 4 Mar 2006 00:20:03 +0100 Subject: merge ubunut udev hook. --- debian/changelog | 9 +++- scripts/init-premount/udev-helper | 38 ---------------- scripts/local-top/udev-helper | 95 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 39 deletions(-) delete mode 100755 scripts/init-premount/udev-helper create mode 100755 scripts/local-top/udev-helper (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 1f673bc..e2a24de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,14 @@ initramfs-tools (0.54) unstable; urgency=low * hook-function: Add dac960 scsi driver for alpha arch. (closes: #355162) - -- maximilian attems Sat, 4 Mar 2006 00:05:35 +0100 + * scripts/local-top/udev-helper: moved from + scripts/init-premount/udev-helper, add code by Scott James Remnant + from the ubuntu udev hook. We now wait on scsi + and usb devices to settle, load ide-generic on ide boot only if + no root device appeared. + The udev hook is adding ide.agent so no longer duplicate that code. + + -- maximilian attems Sat, 4 Mar 2006 00:14:00 +0100 initramfs-tools (0.53) unstable; urgency=high diff --git a/scripts/init-premount/udev-helper b/scripts/init-premount/udev-helper deleted file mode 100755 index 03a3fdf..0000000 --- a/scripts/init-premount/udev-helper +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -PREREQ="udev" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -modprobe -q ide-generic - -[ -e /proc/ide ] || return - -for drive in /proc/ide/*; do - [ -e ${drive}/media ] || continue - # nothing to do if the device has already been took in charge - unit=${drive#/proc/ide/} - [ -d /sys/block/$unit ] && continue - - read media < $drive/media - case "$media" in - disk) MODULE=ide-disk ;; - cdrom) MODULE=ide-cd ;; - tape) MODULE=ide-tape ;; - floppy) MODULE=ide-floppy ;; - *) MODULE=ide-generic ;; - esac - - modprobe -q ${MODULE} -done diff --git a/scripts/local-top/udev-helper b/scripts/local-top/udev-helper new file mode 100755 index 0000000..8ae47d2 --- /dev/null +++ b/scripts/local-top/udev-helper @@ -0,0 +1,95 @@ +#!/bin/sh + +PREREQ="udev" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Our job now is to make the block device for the root filesystem available. +# This is actually a bit trickier than it first appears because we first need +# to figure out which driver needs it, and to do that, we need to know what +# type of bus it's on. Fortunately we have all that information, this still +# feels like an ungodly hack though. +case "${ROOT}" in +/dev/root) + # An interesting case, this root device was specified as a + # major/minor pair. Fortunately we have that information + case "${major}" in + 3|22|33|34|56|57|88|89|90|91) + # traditional ide + root_type=ide + ;; + 80|81|82|83|84|85|86|87) + # ide on i2o + root_type=ide + ;; + 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) + # scsi + root_type=scsi + ;; + esac + ;; +/dev/hd*) + # Ahh, plain-old traditional ide + root_type=ide + ;; +/dev/sd*) + # SCSI, or an IDE controller dressed up in drag + root_type=scsi + ;; +/dev/disk/*) + # Specified by label; sadly there's no way to tell what bus + # this is on, so we'll just declare that we only support it + # for SCSI and removable devices + root_type=scsi + ;; +esac + +case "${root_type}" in +ide) + # If we're booting from IDE, it might not be a PCI controller, + # but might be an old fashioned ISA controller; in which case + # we need to load ide-generic. + if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then + /sbin/modprobe -Qb ide-generic + fi + ;; + +scsi) + # If we're booting from SCSI we should have done all we need, + # now it's just a matter of waiting for the devices to appear + # which could take a while... + [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" + + if type usplash_write >/dev/null 2>&1; then + usplash_write "TIMEOUT 30" || true + fi + + slumber=300 + while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + /bin/sleep 0.1 + slumber=$(( ${slumber} - 1 )) + done + + if type usplash_write >/dev/null 2>&1; then + usplash_write "TIMEOUT 15" || true + fi + + if [ ${slumber} -gt 0 ]; then + log_end_msg 0 + else + log_end_msg 1 || true + fi + ;; +esac +;; -- cgit v1.2.3 From 65391c38c52dcbc0fab11340fd59ed83089d5cd5 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 8 Mar 2006 17:36:52 +0100 Subject: add the 0.53[bc] changesets: where takeover=0 and no '-' in script names --- debian/changelog | 15 ++++++- scripts/local-top/udev-helper | 95 ------------------------------------------- scripts/local-top/udev_helper | 95 +++++++++++++++++++++++++++++++++++++++++++ update-initramfs | 2 +- 4 files changed, 110 insertions(+), 97 deletions(-) delete mode 100755 scripts/local-top/udev-helper create mode 100755 scripts/local-top/udev_helper (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b83cd21..f6db559 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,7 +27,20 @@ initramfs-tools (0.54) unstable; urgency=low * modules.d/ide: Add it821x. (closes #352460) - -- maximilian attems Tue, 7 Mar 2006 00:49:46 +0100 + -- maximilian attems Wed, 8 Mar 2006 17:34:25 +0100 + +initramfs-tools (0.53c) unstable; urgency=low + + * update-initramfs: Really reset takeover to zero. + + -- maximilian attems Mon, 6 Mar 2006 07:59:34 +0100 + +initramfs-tools (0.53b) unstable; urgency=low + + * scripts/init-premount/udev_helper: Renamed from udev-helper. + Thanks to Tollef Fog Heen (closes: #355235) + + -- maximilian attems Sat, 4 Mar 2006 15:26:13 +0100 initramfs-tools (0.53) unstable; urgency=high diff --git a/scripts/local-top/udev-helper b/scripts/local-top/udev-helper deleted file mode 100755 index 8ae47d2..0000000 --- a/scripts/local-top/udev-helper +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh - -PREREQ="udev" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Our job now is to make the block device for the root filesystem available. -# This is actually a bit trickier than it first appears because we first need -# to figure out which driver needs it, and to do that, we need to know what -# type of bus it's on. Fortunately we have all that information, this still -# feels like an ungodly hack though. -case "${ROOT}" in -/dev/root) - # An interesting case, this root device was specified as a - # major/minor pair. Fortunately we have that information - case "${major}" in - 3|22|33|34|56|57|88|89|90|91) - # traditional ide - root_type=ide - ;; - 80|81|82|83|84|85|86|87) - # ide on i2o - root_type=ide - ;; - 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) - # scsi - root_type=scsi - ;; - esac - ;; -/dev/hd*) - # Ahh, plain-old traditional ide - root_type=ide - ;; -/dev/sd*) - # SCSI, or an IDE controller dressed up in drag - root_type=scsi - ;; -/dev/disk/*) - # Specified by label; sadly there's no way to tell what bus - # this is on, so we'll just declare that we only support it - # for SCSI and removable devices - root_type=scsi - ;; -esac - -case "${root_type}" in -ide) - # If we're booting from IDE, it might not be a PCI controller, - # but might be an old fashioned ISA controller; in which case - # we need to load ide-generic. - if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - /sbin/modprobe -Qb ide-generic - fi - ;; - -scsi) - # If we're booting from SCSI we should have done all we need, - # now it's just a matter of waiting for the devices to appear - # which could take a while... - [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 30" || true - fi - - slumber=300 - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do - /bin/sleep 0.1 - slumber=$(( ${slumber} - 1 )) - done - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 15" || true - fi - - if [ ${slumber} -gt 0 ]; then - log_end_msg 0 - else - log_end_msg 1 || true - fi - ;; -esac -;; diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper new file mode 100755 index 0000000..8ae47d2 --- /dev/null +++ b/scripts/local-top/udev_helper @@ -0,0 +1,95 @@ +#!/bin/sh + +PREREQ="udev" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Our job now is to make the block device for the root filesystem available. +# This is actually a bit trickier than it first appears because we first need +# to figure out which driver needs it, and to do that, we need to know what +# type of bus it's on. Fortunately we have all that information, this still +# feels like an ungodly hack though. +case "${ROOT}" in +/dev/root) + # An interesting case, this root device was specified as a + # major/minor pair. Fortunately we have that information + case "${major}" in + 3|22|33|34|56|57|88|89|90|91) + # traditional ide + root_type=ide + ;; + 80|81|82|83|84|85|86|87) + # ide on i2o + root_type=ide + ;; + 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) + # scsi + root_type=scsi + ;; + esac + ;; +/dev/hd*) + # Ahh, plain-old traditional ide + root_type=ide + ;; +/dev/sd*) + # SCSI, or an IDE controller dressed up in drag + root_type=scsi + ;; +/dev/disk/*) + # Specified by label; sadly there's no way to tell what bus + # this is on, so we'll just declare that we only support it + # for SCSI and removable devices + root_type=scsi + ;; +esac + +case "${root_type}" in +ide) + # If we're booting from IDE, it might not be a PCI controller, + # but might be an old fashioned ISA controller; in which case + # we need to load ide-generic. + if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then + /sbin/modprobe -Qb ide-generic + fi + ;; + +scsi) + # If we're booting from SCSI we should have done all we need, + # now it's just a matter of waiting for the devices to appear + # which could take a while... + [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" + + if type usplash_write >/dev/null 2>&1; then + usplash_write "TIMEOUT 30" || true + fi + + slumber=300 + while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + /bin/sleep 0.1 + slumber=$(( ${slumber} - 1 )) + done + + if type usplash_write >/dev/null 2>&1; then + usplash_write "TIMEOUT 15" || true + fi + + if [ ${slumber} -gt 0 ]; then + log_end_msg 0 + else + log_end_msg 1 || true + fi + ;; +esac +;; diff --git a/update-initramfs b/update-initramfs index 2093220..2e39ed0 100644 --- a/update-initramfs +++ b/update-initramfs @@ -239,7 +239,7 @@ altered_check() verbose=0 yes=0 # We default to takeover=1 in Ubuntu, but not Debian -takeover=1 +takeover=0 ## -- cgit v1.2.3 From f5e3b39c44184f553d750ea889fb30eb3978375c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 8 Mar 2006 17:54:00 +0100 Subject: really add the dasd modules; remove superflous ';' --- hook-functions | 5 +++++ scripts/local-top/udev_helper | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/hook-functions b/hook-functions index 90986cb..03eb87d 100644 --- a/hook-functions +++ b/hook-functions @@ -188,6 +188,11 @@ auto_add_modules() manual_add_modules "${x}" done ;; + dasd) + for x in dasd_eckd_mod dasd_fba_mod; do + manual_add_modules "${x}" + done + ;; *) auto_add_modules base auto_add_modules net diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper index 8ae47d2..22cd9f7 100755 --- a/scripts/local-top/udev_helper +++ b/scripts/local-top/udev_helper @@ -92,4 +92,3 @@ scsi) fi ;; esac -;; -- cgit v1.2.3 From f835fe173312291924661646febed813cfeaaa4f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 8 Mar 2006 18:15:21 +0100 Subject: remove useless prerequs --- scripts/local-top/udev_helper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper index 22cd9f7..b501ec0 100755 --- a/scripts/local-top/udev_helper +++ b/scripts/local-top/udev_helper @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="udev" +PREREQ="" prereqs() { -- cgit v1.2.3 From ff26ba49cc41fae343e9acc9af486ee8d3e6b1ba Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 14 Mar 2006 10:19:55 +0100 Subject: fix wrong modprobe args --- debian/changelog | 7 +++++++ scripts/local-top/udev_helper | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index f6db559..d18c9d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.55) unstable; urgency=low + + * scripts/local-top/udev_helper: Fix modprobe args. + Thanks Frans Pop . + + -- maximilian attems Fri, 10 Mar 2006 01:13:33 +0100 + initramfs-tools (0.54) unstable; urgency=low * hooks/lvm: lvm10 has also an vgchange - exit if no lvm2 libs. diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper index b501ec0..8abcb2b 100755 --- a/scripts/local-top/udev_helper +++ b/scripts/local-top/udev_helper @@ -61,7 +61,7 @@ ide) # but might be an old fashioned ISA controller; in which case # we need to load ide-generic. if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - /sbin/modprobe -Qb ide-generic + modprobe -q ide-generic fi ;; -- cgit v1.2.3 From 161cd9fd2df641037edf53d72d096b0f87dd06f1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 14 Mar 2006 10:21:02 +0100 Subject: use quiet for fs module loading --- debian/changelog | 4 +++- scripts/local | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index d18c9d0..eec885d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,9 @@ initramfs-tools (0.55) unstable; urgency=low * scripts/local-top/udev_helper: Fix modprobe args. Thanks Frans Pop . - -- maximilian attems Fri, 10 Mar 2006 01:13:33 +0100 + * scripts/local: Use quiet to load the fs. (closes: #339092) + + -- maximilian attems Tue, 14 Mar 2006 10:20:03 +0100 initramfs-tools (0.54) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 979f07d..917528a 100644 --- a/scripts/local +++ b/scripts/local @@ -25,7 +25,7 @@ mountroot () fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe -q ${FSTYPE} # FIXME This has no error checking # Mount root -- cgit v1.2.3 From 9c42241824afb2759d22d2cf7962fb2ce534e0dd Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 14 Mar 2006 10:43:28 +0100 Subject: udev stuff needs to be in scripts/init-premount only do the block device hacks on local boot --- debian/changelog | 3 +- scripts/init-premount/udev_helper | 103 ++++++++++++++++++++++++++++++++++++++ scripts/local-top/udev_helper | 94 ---------------------------------- 3 files changed, 104 insertions(+), 96 deletions(-) create mode 100755 scripts/init-premount/udev_helper delete mode 100755 scripts/local-top/udev_helper (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 24506a6..8f2f7ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,8 +19,7 @@ initramfs-tools (0.54) unstable; urgency=low * hook-function: Add dac960 scsi driver. (closes: #355162) - * scripts/local-top/udev_helper: moved from - scripts/init-premount/udev_helper, add code by Scott James Remnant + * scripts/init-premount/udev_helper: add code by Scott James Remnant from the ubuntu udev hook. We now wait on scsi and usb devices to settle, load ide-generic on ide boot only if no root device appeared. diff --git a/scripts/init-premount/udev_helper b/scripts/init-premount/udev_helper new file mode 100755 index 0000000..f2bc204 --- /dev/null +++ b/scripts/init-premount/udev_helper @@ -0,0 +1,103 @@ +#!/bin/sh + +PREREQ="udev" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Nothing todo for nfs boot +case "${BOOT}" in +local) + ;; +*) + exit 0 + ;; +esac + +# Our job now is to make the block device for the root filesystem available. +# This is actually a bit trickier than it first appears because we first need +# to figure out which driver needs it, and to do that, we need to know what +# type of bus it's on. Fortunately we have all that information, this still +# feels like an ungodly hack though. +case "${ROOT}" in +/dev/root) + # An interesting case, this root device was specified as a + # major/minor pair. Fortunately we have that information + case "${major}" in + 3|22|33|34|56|57|88|89|90|91) + # traditional ide + root_type=ide + ;; + 80|81|82|83|84|85|86|87) + # ide on i2o + root_type=ide + ;; + 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) + # scsi + root_type=scsi + ;; + esac + ;; +/dev/hd*) + # Ahh, plain-old traditional ide + root_type=ide + ;; +/dev/sd*) + # SCSI, or an IDE controller dressed up in drag + root_type=scsi + ;; +/dev/disk/*) + # Specified by label; sadly there's no way to tell what bus + # this is on, so we'll just declare that we only support it + # for SCSI and removable devices + root_type=scsi + ;; +esac + +case "${root_type}" in +ide) + # If we're booting from IDE, it might not be a PCI controller, + # but might be an old fashioned ISA controller; in which case + # we need to load ide-generic. + if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then + modprobe -q ide-generic + fi + ;; + +scsi) + # If we're booting from SCSI we should have done all we need, + # now it's just a matter of waiting for the devices to appear + # which could take a while... + [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" + + if type usplash_write >/dev/null 2>&1; then + usplash_write "TIMEOUT 30" || true + fi + + slumber=300 + while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + /bin/sleep 0.1 + slumber=$(( ${slumber} - 1 )) + done + + if type usplash_write >/dev/null 2>&1; then + usplash_write "TIMEOUT 15" || true + fi + + if [ ${slumber} -gt 0 ]; then + log_end_msg 0 + else + log_end_msg 1 || true + fi + ;; +esac diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper deleted file mode 100755 index 8abcb2b..0000000 --- a/scripts/local-top/udev_helper +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Our job now is to make the block device for the root filesystem available. -# This is actually a bit trickier than it first appears because we first need -# to figure out which driver needs it, and to do that, we need to know what -# type of bus it's on. Fortunately we have all that information, this still -# feels like an ungodly hack though. -case "${ROOT}" in -/dev/root) - # An interesting case, this root device was specified as a - # major/minor pair. Fortunately we have that information - case "${major}" in - 3|22|33|34|56|57|88|89|90|91) - # traditional ide - root_type=ide - ;; - 80|81|82|83|84|85|86|87) - # ide on i2o - root_type=ide - ;; - 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) - # scsi - root_type=scsi - ;; - esac - ;; -/dev/hd*) - # Ahh, plain-old traditional ide - root_type=ide - ;; -/dev/sd*) - # SCSI, or an IDE controller dressed up in drag - root_type=scsi - ;; -/dev/disk/*) - # Specified by label; sadly there's no way to tell what bus - # this is on, so we'll just declare that we only support it - # for SCSI and removable devices - root_type=scsi - ;; -esac - -case "${root_type}" in -ide) - # If we're booting from IDE, it might not be a PCI controller, - # but might be an old fashioned ISA controller; in which case - # we need to load ide-generic. - if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe -q ide-generic - fi - ;; - -scsi) - # If we're booting from SCSI we should have done all we need, - # now it's just a matter of waiting for the devices to appear - # which could take a while... - [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 30" || true - fi - - slumber=300 - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do - /bin/sleep 0.1 - slumber=$(( ${slumber} - 1 )) - done - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 15" || true - fi - - if [ ${slumber} -gt 0 ]; then - log_end_msg 0 - else - log_end_msg 1 || true - fi - ;; -esac -- cgit v1.2.3 From aad10a3ce2e626e9ca66e08da5edb0ad17d9bd16 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 18 Mar 2006 09:24:43 +0100 Subject: * fix minor parsing * add linear module * manpage polishing * udev_helper needs some conf sourced --- debian/changelog | 24 ++++++++++++++++++++++++ hooks/md | 2 +- mkinitramfs.8 | 2 +- scripts/functions | 2 +- scripts/init-premount/udev_helper | 4 ++++ update-initramfs.8 | 3 ++- 6 files changed, 33 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 3edb850..c67e009 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +initramfs-tools (0.56) unstable; urgency=low + + * hooks/md: Add linear module - thanks to Moshe Yudkowsky . + + * scripts/functions: Fix numerical minor parsing - thanks for the patch to + Wolfgang Weisselberg. (closes: #357332) + + * mkinitramfs.8: Correct wrong referenced filename. + + * update-initramfs.8: Define the argument 'version' - thanks to "Susan G. + Kleinmann" . (closes: #357282) + + * scripts/init-premount/udev_helper: Source the relevant definition to get + it really run. Thanks to Maurice Massar . + (closes: #354458) + + -- maximilian attems Fri, 17 Mar 2006 19:09:11 +0100 + +initramfs-tools (0.55b) unstable; urgency=low + + * Thanks to Frederik Schüler for pointing to leftovers. + + -- maximilian attems Wed, 15 Mar 2006 13:23:51 +0100 + initramfs-tools (0.55) unstable; urgency=low * scripts/init-premount/udev_helper: Fix modprobe args. diff --git a/hooks/md b/hooks/md index 64b8f9e..c020c3a 100755 --- a/hooks/md +++ b/hooks/md @@ -23,6 +23,6 @@ fi copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin -for x in md raid0 raid1 raid5 raid6; do +for x in md linear raid0 raid1 raid5 raid6; do manual_add_modules ${x} done diff --git a/mkinitramfs.8 b/mkinitramfs.8 index b0da75e..539c4c0 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -53,7 +53,7 @@ Write the image to Override the .B ROOT setting in -.IR mkinitramfs.conf . +.IR initramfs.conf . .TP \fB\-\-supported-host-version=\fIhversion diff --git a/scripts/functions b/scripts/functions index 6825519..05b7779 100644 --- a/scripts/functions +++ b/scripts/functions @@ -202,7 +202,7 @@ parse_numeric() { major=${1%:*} ;; *) - minor=$((0x${1#??})) + minor=$((0x${1#?})) major=$((0x${1%??})) ;; esac diff --git a/scripts/init-premount/udev_helper b/scripts/init-premount/udev_helper index f2bc204..d2ef579 100755 --- a/scripts/init-premount/udev_helper +++ b/scripts/init-premount/udev_helper @@ -15,6 +15,10 @@ prereqs) ;; esac +# Source the relevant scripts for later decisions +. /conf/initramfs.conf +. /scripts/functions + # Nothing todo for nfs boot case "${BOOT}" in local) diff --git a/update-initramfs.8 b/update-initramfs.8 index 9e107e9..7ab8b3f 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -28,7 +28,8 @@ happens in this early userspace. .SH OPTIONS .TP \fB \-k \fI version -Set the kernel for whom the initramfs will be generated. +Set the kernel version for whom the initramfs will be generated. +For example the output of uname -r for your currently running kernel. .TP \fB \-c -- cgit v1.2.3 From 4b5cc6ce7567a7075802dd8c3e47dd7cf8e84627 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 26 Mar 2006 21:09:50 +0200 Subject: fix copyright module-init-tools dep gdth lilo minor parsing fixes --- debian/changelog | 28 ++++++++++++++++++++++++++-- debian/control | 2 +- debian/copyright | 13 ++++++++++--- hook-functions | 4 ++-- mkinitramfs-kpkg | 3 ++- scripts/functions | 7 ++++++- 6 files changed, 47 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index bfbd682..a2e8cef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,28 @@ -initramfs-tools (0.57) unstable; urgency=low +initramfs-tools (0.59) unstable; urgency=low + + * debian/copyright: Add years of copyright and authors. + + -- maximilian attems Sun, 26 Mar 2006 21:04:28 +0200 + +initramfs-tools (0.58) unstable; urgency=low + + * hook-functions: Be more carefull about the minor parsing. The fix of + #357332 works for 3 digit roots, but not for hdc6 aka root=1606. + Thanks Martijn Pieters for report + (closes: #358354, #358740). + + * hook-functions: Add gdth to the scsi modules. + + * mkinitramfs-kpkg: Use set -eu to capture full /boot. + Really (closes: #350875) + + * Add dependency on module-init-tools. (closes: #358632) + + * Don't include full path for man page reference. (closes: #358371) + + -- maximilian attems Sun, 26 Mar 2006 16:39:37 +0200 + +initramfs-tools (0.57b) unstable; urgency=low * mkinitramfs, update-initramfs, hook-functions: On verbose mode show, which modules gets added to the initramfs. @@ -7,7 +31,7 @@ initramfs-tools (0.57) unstable; urgency=low to Petter Reinholdtsen . (closes: #357980) * initramfs-tools.8: Document that `-' is not allowed to be used in a script - filename - the filenames get used as shell variable. (closes: #355235) + filename - the filenames get used as shell variable. (closes: #344639) * mkinitramfs: Don't exit succesfully in a case of a full fs. Leaves the linux-image unconfigured. Thanks martin f krafft diff --git a/debian/control b/debian/control index b4124ab..01ddf3b 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.6.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.1.16-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, udev (>= 0.076-5) +Depends: klibc-utils (>= 1.1.16-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.076-5) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged diff --git a/debian/copyright b/debian/copyright index d495248..3a3bc5b 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,7 @@ This package was debianized by Jeff Bailey on Thu, 27 Jan 2005 15:23:52 -0500. -Copyright: - -Author: Jeff Bailey +The current Debian maintainer is maximilian attems The source code up to 0.31 can be found by using "bzr" at: http://people.ubuntu.com/~jbailey/bzrtree/initramfs-tools @@ -14,6 +12,15 @@ http://archive.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/ The Debian tree is maintained with "bzr" at: http://debian.stro.at/bzr-test/initramfs-tools/ +Authors: Jeff Bailey , Adam Conrad , + Scott James Remnant , + maximilian attems + +Copyright: 2005 Jeff Bailey + 2005 - 2006 Adam Conrad + 2005 - 2006 Scott James Remnant + 2005 - 2006 maximilian attems + License: PUBLIC DOMAIN diff --git a/hook-functions b/hook-functions index efce32d..874d55f 100644 --- a/hook-functions +++ b/hook-functions @@ -170,7 +170,7 @@ auto_add_modules() for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci \ aic79xx aic7xxx ata_piix atari_scsi atp870u BusLogic \ cciss ch cpqarray dac960 dc395x dmx3191d dpt_i2o eata fdomain \ - ibmvscsic initio ipr ips isp1020 lpfc max_scsi mac53c94 \ + gdth ibmvscsic initio ipr ips isp1020 lpfc max_scsi mac53c94 \ megaraid megaraid_mbox megaraid_mm mesh mptfc mptscsih \ mptsas mptspi nsp32 osst qla1280 qla2100 qla2200 qla2300 \ qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_mv \ @@ -220,7 +220,7 @@ Options: -o outfile Write to outfile. -r root Override ROOT setting in mkinitrd.conf. -See ${0}(8) for further details. +See mkinitramfs(8) for further details. EOF exit 1 diff --git a/mkinitramfs-kpkg b/mkinitramfs-kpkg index d36710a..8d32005 100644 --- a/mkinitramfs-kpkg +++ b/mkinitramfs-kpkg @@ -1,4 +1,5 @@ #!/bin/sh +set -eu STATEDIR=/var/lib/initramfs-tools @@ -10,7 +11,7 @@ Usage: ${0} <-o outfile> [version] Please use update-initramfs(8): ${0} exists for compatibility by kernel-package(5) calls. -See ${0}(8) for further details. +See mkinitramfs-kpkg(8) for further details. EOF exit 1 } diff --git a/scripts/functions b/scripts/functions index 05b7779..8cf6ddc 100644 --- a/scripts/functions +++ b/scripts/functions @@ -189,6 +189,7 @@ load_modules() fi } +# lilo compatibility parse_numeric() { case $1 in "") @@ -201,10 +202,14 @@ parse_numeric() { minor=${1#*:} major=${1%:*} ;; - *) + [0-9][0-9][0-9]) minor=$((0x${1#?})) major=$((0x${1%??})) ;; + *) + minor=$((0x${1#??})) + major=$((0x${1%??})) + ;; esac mknod /dev/root b ${major} ${minor} -- cgit v1.2.3 From fac756fddb6da3efbbfe99c3c9b0644346ecc695 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 26 Mar 2006 22:37:51 +0200 Subject: Resynch with 0.40ubuntu28 add raid10 module move the loop waiting code to mountroot() leaves only ide-generic from scripts/local-top/udev_helper md pre-requesites the udev one --- debian/changelog | 12 ++++- hooks/md | 2 +- scripts/init-premount/udev_helper | 107 -------------------------------------- scripts/local | 26 ++++++++- scripts/local-top/md | 2 +- scripts/local-top/udev_helper | 23 ++++++++ 6 files changed, 61 insertions(+), 111 deletions(-) delete mode 100755 scripts/init-premount/udev_helper create mode 100755 scripts/local-top/udev_helper (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index a2e8cef..93b55c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,17 @@ initramfs-tools (0.59) unstable; urgency=low * debian/copyright: Add years of copyright and authors. - -- maximilian attems Sun, 26 Mar 2006 21:04:28 +0200 + * Resync with 0.40ubuntu28: + - hooks/md: Add raid10 module. + - scripts/local: Move the "loop waiting for the root filesystem" code from + the udev premount script to the local mountroot() function where it truly + belongs. + - scripts/local-top/udev_helper: Leave the remaining ide-generic part + there, should be taken over by udev itself. + - make the md local-top scripts pre-requisite the udev one. + thanks Scott James Remnant + + -- maximilian attems Sun, 26 Mar 2006 22:35:15 +0200 initramfs-tools (0.58) unstable; urgency=low diff --git a/hooks/md b/hooks/md index c020c3a..becaba1 100755 --- a/hooks/md +++ b/hooks/md @@ -23,6 +23,6 @@ fi copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin -for x in md linear raid0 raid1 raid5 raid6; do +for x in md linear raid0 raid1 raid5 raid6 raid10; do manual_add_modules ${x} done diff --git a/scripts/init-premount/udev_helper b/scripts/init-premount/udev_helper deleted file mode 100755 index d2ef579..0000000 --- a/scripts/init-premount/udev_helper +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -PREREQ="udev" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Source the relevant scripts for later decisions -. /conf/initramfs.conf -. /scripts/functions - -# Nothing todo for nfs boot -case "${BOOT}" in -local) - ;; -*) - exit 0 - ;; -esac - -# Our job now is to make the block device for the root filesystem available. -# This is actually a bit trickier than it first appears because we first need -# to figure out which driver needs it, and to do that, we need to know what -# type of bus it's on. Fortunately we have all that information, this still -# feels like an ungodly hack though. -case "${ROOT}" in -/dev/root) - # An interesting case, this root device was specified as a - # major/minor pair. Fortunately we have that information - case "${major}" in - 3|22|33|34|56|57|88|89|90|91) - # traditional ide - root_type=ide - ;; - 80|81|82|83|84|85|86|87) - # ide on i2o - root_type=ide - ;; - 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) - # scsi - root_type=scsi - ;; - esac - ;; -/dev/hd*) - # Ahh, plain-old traditional ide - root_type=ide - ;; -/dev/sd*) - # SCSI, or an IDE controller dressed up in drag - root_type=scsi - ;; -/dev/disk/*) - # Specified by label; sadly there's no way to tell what bus - # this is on, so we'll just declare that we only support it - # for SCSI and removable devices - root_type=scsi - ;; -esac - -case "${root_type}" in -ide) - # If we're booting from IDE, it might not be a PCI controller, - # but might be an old fashioned ISA controller; in which case - # we need to load ide-generic. - if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe -q ide-generic - fi - ;; - -scsi) - # If we're booting from SCSI we should have done all we need, - # now it's just a matter of waiting for the devices to appear - # which could take a while... - [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 30" || true - fi - - slumber=300 - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do - /bin/sleep 0.1 - slumber=$(( ${slumber} - 1 )) - done - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 15" || true - fi - - if [ ${slumber} -gt 0 ]; then - log_end_msg 0 - else - log_end_msg 1 || true - fi - ;; -esac diff --git a/scripts/local b/scripts/local index 917528a..dd5924d 100644 --- a/scripts/local +++ b/scripts/local @@ -7,7 +7,31 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg - # Get the root filesystem type + # If the root device hasn't shown up yet, give it a little while + # to deal with removable devices + if [ ! -e "${ROOT}" ]; then + log_begin_msg "Waiting for root file system..." + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TIMEOUT 180" || true + fi + + slumber=1800 + while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + /bin/sleep 0.1 + slumber=$(( ${slumber} - 1 )) + done + + if [ ${slumber} -gt 0 ]; then + log_end_msg 0 + else + log_end_msg 1 || true + fi + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TIMEOUT 15" || true + fi + fi + + # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done diff --git a/scripts/local-top/md b/scripts/local-top/md index c7515fe..aa48474 100755 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="" +PREREQ="udev_helper" prereqs() { diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper new file mode 100755 index 0000000..5a747ba --- /dev/null +++ b/scripts/local-top/udev_helper @@ -0,0 +1,23 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# If we're booting from IDE, it might not be a PCI controller, +# but might be an old fashioned ISA controller; in which case +# we need to load ide-generic. +if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then + modprobe -q ide-generic +fi -- cgit v1.2.3 From c29d49d84418075e1887c965d978c7cc0e07a95f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 18 Apr 2006 13:44:02 +0200 Subject: 0.60: - bug script - cryptoroot support - change exported variables - nfsopts, rootflags support - warn lilo+grub install - doc fixes --- debian/bug | 3 +++ debian/changelog | 32 ++++++++++++++++++++++++++++++++ debian/initramfs-tools.install | 1 + init | 18 ++++++++++++++---- initramfs-tools.8 | 9 ++++++++- mkinitramfs-kpkg.8 | 5 +++-- scripts/functions | 4 ++++ scripts/local | 2 +- update-initramfs | 11 +++++++++-- 9 files changed, 75 insertions(+), 10 deletions(-) create mode 100755 debian/bug mode change 100644 => 100755 update-initramfs (limited to 'scripts') diff --git a/debian/bug b/debian/bug new file mode 100755 index 0000000..fda2017 --- /dev/null +++ b/debian/bug @@ -0,0 +1,3 @@ +cat /proc/cmdline >&3 +grep -v nodev /proc/filesystems >&3 +lsmod >&3 diff --git a/debian/changelog b/debian/changelog index 757a015..4c773aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,35 @@ +initramfs-tools (0.60) unstable; urgency=low + + "E ho trovato l'invasor" + + * scripts/functions: Allow boot scripts to modify exported boot parameters. + Thanks David Härdeman for the patch. (closes: 348147) + This allows the inclusion of cryptoroot hooks to cryptsetup! + + * init: add cryptopts parsing and export. + + * init: Move parse_numeric down to the "mounting root" block. + + * init, scripts/local: Allow rootflags to be passed in kernel cmdline. + Thanks Thomas Luzat for the patch. (closes: #358917) + + * init: Allow passing nfs root mount option in kernel cmdline. Thanks + Brian Brunswick for the patch. (closes: #358649) + + * update-initramfs: s/ALL/all/, fix it to actually run on update in non + verbose mode. (closes: #362568) + + * update-initramfs: Warn in big letters about grub and lilo installs. + (closes: #362816) + + * debian/bug: Add reportbug script with info about cmdline, fs and lsmod. + + * initramfs-tools(8): Document the /conf/param.conf feature. + + * mkinitramfs-kpkg(8): Spell out, why the wrapper script is needed. + + -- maximilian attems Tue, 18 Apr 2006 13:33:18 +0200 + initramfs-tools (0.59b) unstable; urgency=low * mkinitramfs-kpkg: Intialialize the variables. diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index b722d90..9a4f31e 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -6,3 +6,4 @@ conf/initramfs.conf etc/mkinitramfs hooks usr/share/initramfs-tools hook-functions usr/share/initramfs-tools update-initramfs usr/sbin +debian/bug usr/share/bug/initramfs-tools diff --git a/init b/init index f69b3e8..04b7602 100755 --- a/init +++ b/init @@ -39,6 +39,8 @@ export readonly=y export resume=${RESUME} export rootmnt=/root export debug= +export cryptopts=${CRYPTOPTS} + for x in $(cat /proc/cmdline); do case $x in init=*) @@ -55,8 +57,17 @@ for x in $(cat /proc/cmdline); do ;; esac ;; + rootflags=*) + ROOTFLAGS="-o ${x#rootflags=}" + ;; + cryptopts=*) + cryptopts="${x#cryptopts=}" + ;; nfsroot=*) - NFSROOT=${x#nfsroot=} + NFSROOT="${x#nfsroot=}" + ;; + nfsopts=*) + NFSOPTS="-o ${x#nfsopts=}" ;; boot=*) BOOT=${x#boot=} @@ -93,9 +104,6 @@ maybe_break top # Don't do log messages here to avoid confusing usplash run_scripts /scripts/init-top -. /scripts/${BOOT} -parse_numeric ${ROOT} - maybe_break modules log_begin_msg "Loading essential drivers..." load_modules @@ -108,6 +116,8 @@ log_end_msg maybe_break mount log_begin_msg "Mounting root file system..." +. /scripts/${BOOT} +parse_numeric ${ROOT} mountroot log_end_msg diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 991cff9..f0077ec 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -118,7 +118,7 @@ adds a module (and any modules which it depends on) to the initramfs image. .RS .PP .B Example: -manual_add_modules reiserfs +manual_add_modules isofs .RE .TP @@ -314,6 +314,13 @@ are the last scripts to be executed before procfs and sysfs are moved to the real rootfs and execution is turned over to the init binary which should now be found in the mounted rootfs. +.SS Boot parameters +.TP +\fB \fI +/conf/param.conf +allows boot scripts to change exported variables that are listed on top of init. Write the new values to it. It will be sourced after an boot script run if it exists. + + .SH EXAMPLES .SS Hook script diff --git a/mkinitramfs-kpkg.8 b/mkinitramfs-kpkg.8 index 34f76db..0bdc1dc 100644 --- a/mkinitramfs-kpkg.8 +++ b/mkinitramfs-kpkg.8 @@ -19,9 +19,10 @@ The .B mkinitramfs-kpkg script calls .B mkinitramfs -for kernel-package. It's usage is not recommended. +as wrapper script for kernel-package. It preservers the old mkinitrd calling +conventions. It's usage is not recommended. See -.B update-initramfs +.B update-initramfs (8) for an better alternative. .SH OPTIONS diff --git a/scripts/functions b/scripts/functions index 8cf6ddc..96a5577 100644 --- a/scripts/functions +++ b/scripts/functions @@ -161,6 +161,10 @@ call_scripts() { for cs_x in ${runlist}; do ${initdir}/${cs_x} + # allow boot scripts to modify exported boot paramaters + if [ -e /conf/param.conf ]; then + . /conf/param.conf + fi done } diff --git a/scripts/local b/scripts/local index dd5924d..25aca70 100644 --- a/scripts/local +++ b/scripts/local @@ -53,7 +53,7 @@ mountroot () # FIXME This has no error checking # Mount root - mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} + mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/log-bottom" run_scripts /scripts/local-bottom diff --git a/update-initramfs b/update-initramfs old mode 100644 new mode 100755 index 9b69981..488806f --- a/update-initramfs +++ b/update-initramfs @@ -14,7 +14,7 @@ usage() Usage: ${0} [OPTION]... Options: - -k [version] Specify kernel version or ALL + -k [version] Specify kernel version or all -c Create a new initramfs -u Update an existing initramfs -d Remove an existing initramfs @@ -75,6 +75,13 @@ generate_initramfs() run_bootloader() { if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then + if [ -e /etc/lilo.conf ]; then + 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 + fi return 0 fi if [ -e /etc/lilo.conf ]; then @@ -205,7 +212,7 @@ update() fi # Don't stop if one version doesn't work. set +e - "${0}" "${vflag}" -u -k "${u_version}" + "${0}" -u -k "${u_version}" ${vflag} set -e done exit 0 -- cgit v1.2.3 From 16d9f24976ebbb165e5e8aae17a17ddaeca90a8d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 24 Jun 2006 11:15:58 +0200 Subject: lvm script patch activate root and resume volume group lvm script root on lilo woraround lvm hook add dm-mirror mkinitramfs cleanup old make-kpkg args update-initramfs show what's going on --- debian/changelog | 21 +++++++++++++++++++++ hooks/lvm | 2 +- mkinitramfs | 23 +---------------------- scripts/local-top/lvm | 48 +++++++++++++++++++++++++++++++++--------------- update-initramfs | 2 +- 5 files changed, 57 insertions(+), 39 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 83c5a46..2e939e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,24 @@ +initramfs-tools (0.65) unstable; urgency=low + + * scripts/local-top/lvm: Activate root and resume volume group. + The initialization got refractored in an function. (closes: #374891) + Thanks for the patch to David Härdeman . + + * scripts/local-top/lvm: Be carefull to activate volume group on lilo boot + too. Although in that case we don't know the precise volume group, we + activate them all. Matches behaviour of previous hook. + + * hooks/lvm: Add dm-mirror, allows to boot from an unfinished pvmove. + (closes: #374378) + + * mkinitramfs: Remove old kernel-package supported long param. + kernel-package uses since month make-kpkg. + + * update-initramfs: Show by default which initramfs gets generated. + (closes: #364301) + + -- maximilian attems Sat, 24 Jun 2006 10:46:40 +0200 + initramfs-tools (0.64) unstable; urgency=low RELEASE o bella, ciao! bella, ciao! diff --git a/hooks/lvm b/hooks/lvm index e29215e..98c0e0a 100755 --- a/hooks/lvm +++ b/hooks/lvm @@ -22,6 +22,6 @@ fi copy_exec /lib/lvm-200/vgchange /sbin -for x in dm_mod dm_snapshot; do +for x in dm_mod dm_snapshot dm_mirror; do manual_add_modules ${x} done diff --git a/mkinitramfs b/mkinitramfs index 05800bb..5fcc1fd 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -10,7 +10,7 @@ errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" BUSYBOXDIR="/bin" -OPTIONS=`getopt -o d:ko:r:v --long supported-host-version:,supported-target-version: -n "$0" -- "$@"` +OPTIONS=`getopt -o d:ko:r:v -n "$0" -- "$@"` # Check for non-GNU getopt if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -44,14 +44,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,19 +55,6 @@ while true; do esac done -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 - exit 0 -fi - # For dependency ordered mkinitramfs hook scripts. . /usr/share/initramfs-tools/scripts/functions . /usr/share/initramfs-tools/hook-functions diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 7ac81e6..8ff3b98 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -15,23 +15,41 @@ prereqs) ;; esac -vg=${ROOT#/dev/mapper/} +activate_vg() +{ + local vg="$1" + + # Make sure that we have a non-empty argument + if [ -z "${vg}" ]; then + return 0 + fi -case ${vg} in - /dev/root) - unset vg - ;; - /*) + # Take care of lilo boot arg, risky activating of all vg + vg_lilo=${vg:0:2} + if [ "${vg_lilo}" = fe ]; then + vgchange -ay exit 0 - ;; -esac - -modprobe -q dm-mod + fi + + # Make sure that we have a d-m path + vg=${vg#/dev/mapper/} + if [ "$vg" = "$1" ]; then + return 0 + 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') + # 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} + vgchange -ay ${vg} +} + +if [ ! -e /sbin/vgchange ]; then + exit 0 +fi + +modprobe -q dm-mod +activate_vg "$ROOT" +activate_vg "$resume" diff --git a/update-initramfs b/update-initramfs index 488806f..03bf5cf 100755 --- a/update-initramfs +++ b/update-initramfs @@ -62,7 +62,7 @@ set_initramfs() generate_initramfs() { - verbose "Generating ${initramfs}" + echo "update-initramfs: Generating ${initramfs}" OPTS="-o" if [ "${verbose}" = 1 ]; then OPTS="-v $OPTS" -- cgit v1.2.3 From b7618c8e038c6e9a671ef62578bf79327fbc00be Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 24 Jun 2006 13:22:44 +0200 Subject: - no longer need to remove initramfs-tools/modules on postrm ubuntu sync: - change prereqs policy - add check_minver - use it in update-initramfs - fix version to use in update-initramfs --- debian/changelog | 23 ++++++++++++++++++++++- debian/initramfs-tools.postrm | 1 - scripts/functions | 39 +++++++++++++++++++++++++++++++++++++++ update-initramfs | 19 ++++++++++++++----- 4 files changed, 75 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 2e939e9..82983ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,7 +17,28 @@ initramfs-tools (0.65) unstable; urgency=low * update-initramfs: Show by default which initramfs gets generated. (closes: #364301) - -- maximilian attems Sat, 24 Jun 2006 10:46:40 +0200 + * Resync with 0.40ubuntu32: + - Make prereqs conditional on the script/hook actually existing. From + now on, this means that 'PREREQ="udev"' means "run udev first, iff it + happens to be installed". Having the files exist on the filesystem if + you have a HARD dependency should be enforced with package dependencies. + (closes: #369617) + - Make "update-initramfs -u" try to find the running kernel *after* it + attempts to search the symbolic link list and its own sha1 list. + Using this as a fallback, rather than the default, should solve most + upgrade issues, where people found their initramfs was half-baked. + - Abstract out the kernel minversion checking stuff into the function + library, so we can reuse it to check minversion requirements for hook + scripts as well (such as udev, which requires >= 2.6.15 in dapper) + - Bump the kernel minversion to 2.6.15 on hppa and ia64, since they used + initrd-tools with their 2.6.12 kernels in breezy, not initramfs-tools. + - If mkinitramfs fails due to minversion not being met, don't bail out + of update-initramfs, but just exit 0, so upgrades don't halt on it. + + * debian/initramfs-tools.postrm: We no longer need to explicitly remove + /etc/initramfs-tools/modules. + + -- maximilian attems Sat, 24 Jun 2006 11:42:07 +0200 initramfs-tools (0.64) unstable; urgency=low diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm index b711f2c..b2f40bd 100644 --- a/debian/initramfs-tools.postrm +++ b/debian/initramfs-tools.postrm @@ -1,7 +1,6 @@ #!/bin/sh if [ "x${1}" = "xpurge" ]; then - rm -f /etc/initramfs-tools/modules rm -f /etc/initramfs-tools/conf.d/resume fi diff --git a/scripts/functions b/scripts/functions index 96a5577..35485c6 100644 --- a/scripts/functions +++ b/scripts/functions @@ -91,6 +91,14 @@ set_initlist() reduce_satisfied() { deplist="$(render array_${1})" + unset tmpdeplist + for rs_y in ${deplist}; do + if [ ! -f ${initdir}/${rs_y} ]; then + continue + fi + tmpdeplist="${tmpdeplist} ${rs_y}" + done + deplist=${tmpdeplist} for rs_x in ${runlist}; do pop_list_item ${rs_x} ${deplist} deplist=${tmppop} @@ -176,6 +184,37 @@ run_scripts() call_scripts } +check_minkver() +{ + curversion=${1} + initdir=${2} + set_initlist + if [ -z ${initdir} ]; then + DPKG_ARCH=`dpkg --print-installation-architecture` + case ${DPKG_ARCH} in + ia64|hppa) + minversion="2.6.15" + ;; + *) + minversion="2.6.12" + ;; + esac + if dpkg --compare-versions "${curversion}" lt "${minversion}"; then + echo "W: kernerl ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2 + echo "W: not generating requested initramfs for kernel ${curversion}" >&2 + exit 2 + fi + fi + [ -z ${initdir} ] || for cm_x in ${initlist}; do + tmp=$(eval echo $(grep ^MINKVER ${initdir}/${cm_x} | cut -d'=' -f2)) + if dpkg --compare-versions "${curversion}" lt "${tmp}"; then + echo "W: ${cm_x} hook script requires at least kernel version ${tmp}" >&2 + echo "W: not generating requested initramfs for kernel ${curversion}" >&2 + exit 2 + fi + done +} + # Load custom modules first load_modules() { diff --git a/update-initramfs b/update-initramfs index 03bf5cf..2f3ebcf 100755 --- a/update-initramfs +++ b/update-initramfs @@ -67,8 +67,17 @@ generate_initramfs() if [ "${verbose}" = 1 ]; then OPTS="-v $OPTS" fi - mkinitramfs $OPTS "${initramfs}" "${version}" - set_sha1 + if mkinitramfs $OPTS "${initramfs}" "${version}"; then + set_sha1 + else + mkinitramfs_return="$?" + if [ "$mkinitramfs_return" = "2" ]; then + # minversion wasn't met, exit 0 + exit 0 + fi + verbose "mkinitramfs failed for ${initramfs}" + exit $mkinitramfs_return + fi } # only run lilo if no grub is around @@ -192,15 +201,15 @@ create() update() { if [ -z "${version}" ]; then - set_current_version + set_linked_version fi if [ -z "${version}" ]; then - set_linked_version + set_highest_version fi if [ -z "${version}" ]; then - set_highest_version + set_current_version fi if [ "${version}" = "all" ]; then -- cgit v1.2.3 From c7ad939852fedfe308a643805df3d7e3a6549755 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 27 Jun 2006 12:02:38 +0200 Subject: fix lvm root load mirror and snapshot --- debian/changelog | 9 +++++++++ scripts/local-top/lvm | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index ad677f3..c39e1b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +initramfs-tools (0.65b) unstable; urgency=low + + * scripts/local-top/lvm: Load snapshot and mirror modules. (Closes: #375342) + + * scripts/local-top/lvm: Fix a wrong substitution for the lilo test. + (Closes: #375442) + + -- maximilian attems Mon, 26 Jun 2006 14:54:30 +0200 + initramfs-tools (0.65) unstable; urgency=low * scripts/local-top/lvm: Activate root and resume volume group. diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 8ff3b98..3b012ec 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -25,11 +25,12 @@ activate_vg() fi # Take care of lilo boot arg, risky activating of all vg - vg_lilo=${vg:0:2} - if [ "${vg_lilo}" = fe ]; then + case $vg in + fe[0-9]*) vgchange -ay exit 0 - fi + ;; + esac # Make sure that we have a d-m path vg=${vg#/dev/mapper/} @@ -50,6 +51,8 @@ if [ ! -e /sbin/vgchange ]; then fi modprobe -q dm-mod +modprobe -q dm-snapshot +modprobe -q dm-mirror activate_vg "$ROOT" activate_vg "$resume" -- cgit v1.2.3 From 42579f456b1a87627a1416b3f80c51d9f15fb09a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 27 Jun 2006 14:11:25 +0200 Subject: - fix typo on panic call - load the right i2c module for ppc g5 (windfarm needs more work) --- debian/changelog | 12 ++++++++++++ hooks/thermal | 1 + scripts/functions | 2 +- scripts/init-premount/thermal | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index c39e1b5..ed11e31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +initramfs-tools (0.66) unstable; urgency=low + + * hooks/thermal: Add i2c-powermac. + + * scripts/init-premount/thermal: Load i2c-powermac on ppc boot. + Fixes fan noises for Sven Luther + + * scripts/function: Fix typo s/FS1/PS1/ on panic call. (closes: #375624) + Thanks to Tim Phipps for the report. + + -- maximilian attems Tue, 27 Jun 2006 14:04:17 +0200 + initramfs-tools (0.65b) unstable; urgency=low * scripts/local-top/lvm: Load snapshot and mirror modules. (Closes: #375342) diff --git a/hooks/thermal b/hooks/thermal index c27c957..9bfd323 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -23,6 +23,7 @@ case "$DPKG_ARCH" in # copy the right modules powerpc|ppc64) manual_add_modules therm_pm72 + manual_add_modules i2c-powermac ;; i386|amd64|ia64) manual_add_modules fan diff --git a/scripts/functions b/scripts/functions index 35485c6..a4faaa8 100644 --- a/scripts/functions +++ b/scripts/functions @@ -62,7 +62,7 @@ panic() modprobe -q i8042 modprobe -q atkbd echo $@ - FS1='(initramfs) ' /bin/sh /dev/console 2>&1 + PS1='(initramfs) ' /bin/sh /dev/console 2>&1 } maybe_break() diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index d59af8a..3518e7c 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -18,7 +18,7 @@ esac case "$DPKG_ARCH" in # load the right modules powerpc|ppc64) - modprobe -q i2c-keywest + modprobe -q i2c-powermac modprobe -q therm_pm72 ;; i386|amd64|ia64) -- cgit v1.2.3 From 09276c4c9f7deb9a46cf162747b5749f94738c2b Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 29 Jun 2006 21:42:45 +0200 Subject: refix lilo root on lvm boot --- debian/changelog | 5 ++++- scripts/local-top/lvm | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index ed11e31..b1e3272 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,10 @@ initramfs-tools (0.66) unstable; urgency=low * scripts/function: Fix typo s/FS1/PS1/ on panic call. (closes: #375624) Thanks to Tim Phipps for the report. - -- maximilian attems Tue, 27 Jun 2006 14:04:17 +0200 + * scripts/local-top/lvm: Refix lilo check. (closes: #375786) + Thanks to the patch from Christian Weeks . + + -- maximilian attems Wed, 28 Jun 2006 12:11:49 +0200 initramfs-tools (0.65b) unstable; urgency=low diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 3b012ec..fc1036e 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -30,6 +30,11 @@ activate_vg() vgchange -ay exit 0 ;; + # FIXME: check major + /dev/root) + vgchange -ay + exit 0 + ;; esac # Make sure that we have a d-m path -- cgit v1.2.3 From 0d341b8d32810844ce035e89a9e60fb7a7dde4b6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 2 Jul 2006 18:57:07 +0200 Subject: woow pile of stuff turned up: - cleanup of activate_vg() in lvm boot script - use less of busybox utilities - conf.d for BUSYBOX=y usage for the packages - don't poke on conffile for RESUME - use printf instead of expr (ooh ash and dash are *fun*) - fix update-initramfs to use current_version when no other version exists around --- conf/initramfs.conf | 9 --------- debian/changelog | 37 +++++++++++++++++++++++++++++++++++++ debian/initramfs-tools.dirs | 1 + debian/initramfs-tools.preinst | 9 --------- initramfs-tools.8 | 5 +++-- initramfs.conf.5 | 7 ------- mkinitramfs | 2 +- scripts/functions | 16 +++++++++------- scripts/local | 2 +- scripts/local-top/lvm | 11 +++++++++-- update-initramfs | 12 ++++++++++-- 11 files changed, 71 insertions(+), 40 deletions(-) (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index a9cadf7..84d3b24 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -17,15 +17,6 @@ MODULES=most -# -# RESUME: [ /dev/hda2 | /dev/sdb2 ] -# -# optional - set the swap partition to resume from. -# "cat /proc/swaps | egrep ^/dev" should show possible candidates. -# The command line of your boot loader will override this setting. - -#RESUME= - # # NFS Section of the config. # diff --git a/debian/changelog b/debian/changelog index b1e3272..05140ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,40 @@ +initramfs-tools (0.67) unstable; urgency=high + + Release bella, ciao, ciao, ciao! + + * scripts/local: Fix typo in log_begin_msg. (closes: #375880) + + * update-initramfs: Generate initramfs for current version if there is no + sha1sum and no initrd exists yet - regression from 0.65. (closes: #375671) + Thanks martin f krafft for report. + + * conf/initramfs.conf, initramfs.conf(5): Drop RESUME section. + + * debian/initramfs-tools.preinst: Don't modify conffile initramfs.tools - + drop the corresponding code. (closes: #376008) + + * initramfs-tools(8): Document that RESUME is tried to be autodected and + written to /etc/initramfs-tools/conf.d/resume on install. + + * scripts/functions: Replace expr use with printf for skipping comments on + /etc/modules. Works on both busybox ash and klibc dash. Prefix space is + ignored by both. + + * scripts/local-top/lvm: Remove harmless warnings if a volumegroup is under + /dev/mapper but not an lvm device. (closes: 376311) + Thanks David Härdeman for the patch. + + * scripts/local-top/lvm: Change activate_vg() to return 1 if no volumegroup + is found. + + * debian/initramfs-tools.dirs: Add usr/share/initramfs-tools/conf.d entry. + + * mkinitramfs: Add stuff to the conf.d directory also from aboves directory. + + * Set urgency to high to get the RC bugfix into testing. + + -- maximilian attems Sun, 2 Jul 2006 18:35:34 +0200 + initramfs-tools (0.66) unstable; urgency=low * hooks/thermal: Add i2c-powermac. diff --git a/debian/initramfs-tools.dirs b/debian/initramfs-tools.dirs index 0a807a5..2c6a83a 100644 --- a/debian/initramfs-tools.dirs +++ b/debian/initramfs-tools.dirs @@ -9,5 +9,6 @@ etc/initramfs-tools/scripts/nfs-premount 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/modules.d /var/lib/initramfs-tools diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index 3ec83c6..f2b667e 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -19,13 +19,4 @@ case "$1" in ;; esac -[ -f /etc/initramfs-tools/initramfs.conf ] && . /etc/initramfs-tools/initramfs.conf -if [ -z ${RESUME} ]; then - exit 0 -else - mkdir -p /etc/initramfs-tools/conf.d - echo "RESUME=${RESUME}" > /etc/initramfs-tools/conf.d/resume - sed -i -e "s/RESUME=.*/#RESUME=/" /etc/initramfs-tools/initramfs.conf -fi - #DEBHELPER# diff --git a/initramfs-tools.8 b/initramfs-tools.8 index eb46827..5d7c105 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -48,8 +48,9 @@ either local or NFS (affects which initramfs scripts are run, see the "Subdirect .TP \fB \fI resume -device node which holds the result of a previous suspension using swsusp -(usually the swap partition). +On install initramfs-tools tries to autodetect the resume partition. On success +the RESUME variable is written to /etc/initramfs-tools/conf.d/resume. +The boot variable overrides it. .TP \fB \fI quiet diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 7fb79b1..2874fdb 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -32,13 +32,6 @@ The default setting is \fImost\fP. \fIlist\fP includes only modules from the additional modules list. -.TP -\fB RESUME -Optional setting of the swap partition to resume from. -The resume= passed on the command line of your boot loader -will override this setting. By default, this is set in -/etc/mkinitramfs/conf.d/resume. - .SH NFS VARIABLES .TP \fB BOOT diff --git a/mkinitramfs b/mkinitramfs index 5fcc1fd..f0ba606 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -61,7 +61,7 @@ done . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' -for i in ${CONFDIR}/conf.d/*; do +for i in ${CONFDIR}/conf.d/* /usr/share/initramfs-tools/conf.d/*; do EXTRA_CONF="${EXTRA_CONF} $(basename $i | grep '^[a-z0-9][a-z0-9\._-]*$' | grep -v '\.dpkg-.*$')"; done for i in ${EXTRA_CONF}; do diff --git a/scripts/functions b/scripts/functions index a4faaa8..fea6956 100644 --- a/scripts/functions +++ b/scripts/functions @@ -220,14 +220,16 @@ load_modules() { if [ -e /conf/modules ]; then cat /conf/modules | while read m; do - if [ -z "$m" ] \ - || expr "$m" : "#" >/dev/null \ - || expr "$m" : "[ \t]+#?" > /dev/null - then - continue; - else - modprobe -q $m + # Skip empty lines + if [ -z "$m" ]; then + continue fi + # Skip comments - d?ash removes whitespace prefix + com=$(printf "%.1s" "${m}") + if [ "$com" = "#" ]; then + continue + fi + modprobe -q $m done fi } diff --git a/scripts/local b/scripts/local index 25aca70..a565885 100644 --- a/scripts/local +++ b/scripts/local @@ -55,7 +55,7 @@ mountroot () # Mount root mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/log-bottom" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom" run_scripts /scripts/local-bottom [ "$quiet" != "y" ] && log_end_msg } diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index fc1036e..5323a7d 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -21,7 +21,7 @@ activate_vg() # Make sure that we have a non-empty argument if [ -z "${vg}" ]; then - return 0 + return 1 fi # Take care of lilo boot arg, risky activating of all vg @@ -40,7 +40,12 @@ activate_vg() # Make sure that we have a d-m path vg=${vg#/dev/mapper/} if [ "$vg" = "$1" ]; then - return 0 + 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. @@ -61,3 +66,5 @@ modprobe -q dm-mirror activate_vg "$ROOT" activate_vg "$resume" + +exit 0 diff --git a/update-initramfs b/update-initramfs index 2f3ebcf..1826233 100755 --- a/update-initramfs +++ b/update-initramfs @@ -125,8 +125,7 @@ get_sorted_versions() for gsv_x in "${STATEDIR}"/*; do gsv_x="$(basename "${gsv_x}")" if [ "${gsv_x}" = '*' ]; then - verbose "Nothing to do, exiting." - exit 0 + return 0 fi worklist="" for gsv_i in $version_list; do @@ -212,9 +211,18 @@ update() set_current_version fi + if [ -z "${version}" ]; then + verbose "Nothing to do, exiting." + exit 0 + fi + if [ "${version}" = "all" ]; then : FIXME check for --yes, and if not ask are you sure get_sorted_versions + if [ -z "${version_list}" ]; then + verbose "Nothing to do, exiting." + exit 0 + fi for u_version in ${version_list}; do if [ "${verbose}" = "1" ]; then vflag="-v" -- cgit v1.2.3 From af6f5f475221846f88a2bbda39a2a93d67556d07 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 2 Jul 2006 19:45:38 +0200 Subject: - move check_minkver() to hook-functions --- debian/changelog | 7 +++++++ hook-functions | 31 +++++++++++++++++++++++++++++++ scripts/functions | 31 ------------------------------- 3 files changed, 38 insertions(+), 31 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 05140ed..5035086 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.68) unstable; urgency=low + + * script/functions, hook-functions: Move check_minkver() to the second + file as it uses dpkg and is run by mkinitramfs and not on boot. + + -- maximilian attems Sun, 2 Jul 2006 19:44:45 +0200 + initramfs-tools (0.67) unstable; urgency=high Release bella, ciao, ciao, ciao! diff --git a/hook-functions b/hook-functions index 6d41f2e..fe10cfe 100644 --- a/hook-functions +++ b/hook-functions @@ -226,3 +226,34 @@ EOF } +# minimal supported kernel version +check_minkver() +{ + curversion=${1} + initdir=${2} + set_initlist + if [ -z ${initdir} ]; then + DPKG_ARCH=`dpkg --print-installation-architecture` + case ${DPKG_ARCH} in + ia64|hppa) + minversion="2.6.15" + ;; + *) + minversion="2.6.12" + ;; + esac + if dpkg --compare-versions "${curversion}" lt "${minversion}"; then + echo "W: kernerl ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2 + echo "W: not generating requested initramfs for kernel ${curversion}" >&2 + exit 2 + fi + fi + [ -z ${initdir} ] || for cm_x in ${initlist}; do + tmp=$(eval echo $(grep ^MINKVER ${initdir}/${cm_x} | cut -d'=' -f2)) + if dpkg --compare-versions "${curversion}" lt "${tmp}"; then + echo "W: ${cm_x} hook script requires at least kernel version ${tmp}" >&2 + echo "W: not generating requested initramfs for kernel ${curversion}" >&2 + exit 2 + fi + done +} diff --git a/scripts/functions b/scripts/functions index fea6956..c3a3e16 100644 --- a/scripts/functions +++ b/scripts/functions @@ -184,37 +184,6 @@ run_scripts() call_scripts } -check_minkver() -{ - curversion=${1} - initdir=${2} - set_initlist - if [ -z ${initdir} ]; then - DPKG_ARCH=`dpkg --print-installation-architecture` - case ${DPKG_ARCH} in - ia64|hppa) - minversion="2.6.15" - ;; - *) - minversion="2.6.12" - ;; - esac - if dpkg --compare-versions "${curversion}" lt "${minversion}"; then - echo "W: kernerl ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2 - echo "W: not generating requested initramfs for kernel ${curversion}" >&2 - exit 2 - fi - fi - [ -z ${initdir} ] || for cm_x in ${initlist}; do - tmp=$(eval echo $(grep ^MINKVER ${initdir}/${cm_x} | cut -d'=' -f2)) - if dpkg --compare-versions "${curversion}" lt "${tmp}"; then - echo "W: ${cm_x} hook script requires at least kernel version ${tmp}" >&2 - echo "W: not generating requested initramfs for kernel ${curversion}" >&2 - exit 2 - fi - done -} - # Load custom modules first load_modules() { -- cgit v1.2.3 From 50586c0818aa8de3ba3aa1c105acbe31537a9be1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 12 Jul 2006 18:21:16 +0200 Subject: - rename suspend boot script in resume - update-initramfs add -b bootdif flag document it - check for noresume arg in init --- debian/changelog | 25 ++++++++++++++++++++++--- init | 10 ++++++++-- scripts/local-premount/resume | 29 +++++++++++++++++++++++++++++ scripts/local-premount/suspend | 29 ----------------------------- update-initramfs | 10 +++++++++- update-initramfs.8 | 5 +++++ 6 files changed, 73 insertions(+), 35 deletions(-) create mode 100755 scripts/local-premount/resume delete mode 100755 scripts/local-premount/suspend (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index bbc2944..9623ae4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,22 @@ -initramfs-tools (0.68) unstable; urgency=high +initramfs-tools (0.69) unstable; urgency=low + + * scripts/local-premount/suspend, scripts/local-premount/resume: Rename + to the later as the script resumes from resume arg. + + * init: Parse for noresume and only export resume if it is not set. + Allows boot scripts to check for it's eventual existence. + Thanks David Härdeman for the suggestion. + + * update-initramfs: Add option "-b directory" to override BOOTDIR. + Allows the initramfs to be created in another dir without awkward + mkinitramfs invocation. Check that the passed arg is really a dir. + (ubuntu: 37690) Thanks Colin Watson + + * update-initramfs.8: Document -b switch. + + -- maximilian attems Wed, 12 Jul 2006 16:51:49 +0200 + +initramfs-tools (0.68b) unstable; urgency=high * script/functions, hook-functions: Move check_minkver() to the second file as it uses dpkg and is run by mkinitramfs and not on boot. @@ -19,11 +37,12 @@ initramfs-tools (0.68) unstable; urgency=high to the one we ship. This should minimize Sarge upgrade prompting if no relevant modules where added to /etc/mkinitrd/modules. - * conf/initramfs.conf: Make it more similar to /etc/mkinitrd/modules. + * conf/modules: Make it more similar to /etc/mkinitrd/modules. * Set urgency high for RC fixes upload. + Thanks Steinar H. Gunderson for the review. - -- maximilian attems Fri, 7 Jul 2006 11:45:56 +0200 + -- maximilian attems Mon, 10 Jul 2006 00:13:52 +0200 initramfs-tools (0.67) unstable; urgency=high diff --git a/init b/init index 2c25295..427b964 100755 --- a/init +++ b/init @@ -40,7 +40,6 @@ export break= export init=/sbin/init export quiet=n export readonly=y -export resume=${RESUME} export rootmnt=/root export debug= export cryptopts=${CRYPTOPTS} @@ -77,7 +76,10 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; resume=*) - resume=${x#resume=} + RESUME=${x#resume=} + ;; + noresume) + NORESUME=y ;; quiet) quiet=y @@ -102,6 +104,10 @@ for x in $(cat /proc/cmdline); do esac done +if [ -n ${NORESUME} ]; then + export resume=${RESUME} +fi + depmod -a maybe_break top diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume new file mode 100755 index 0000000..0c88ccc --- /dev/null +++ b/scripts/local-premount/resume @@ -0,0 +1,29 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +if [ "x${resume}" = "x" ]; then + exit +fi + +if [ ! -e "${resume}" ]; then + exit +fi + +if [ -e /sys/power/resume ]; then + major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') + echo $major_minor >/sys/power/resume +fi diff --git a/scripts/local-premount/suspend b/scripts/local-premount/suspend deleted file mode 100755 index 0c88ccc..0000000 --- a/scripts/local-premount/suspend +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -if [ "x${resume}" = "x" ]; then - exit -fi - -if [ ! -e "${resume}" ]; then - exit -fi - -if [ -e /sys/power/resume ]; then - major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') - echo $major_minor >/sys/power/resume -fi diff --git a/update-initramfs b/update-initramfs index 1826233..71cc90d 100755 --- a/update-initramfs +++ b/update-initramfs @@ -19,6 +19,7 @@ Options: -u Update an existing initramfs -d Remove an existing initramfs -t Take over a custom initramfs with this one + -b Set alternate boot directory -v Be verbose -h This message @@ -287,7 +288,7 @@ takeover=0 ## -while getopts "k:cudyvht?" flag; do +while getopts "k:cudyvtb:h?" flag; do case "${flag}" in k) version="${OPTARG}" @@ -310,6 +311,13 @@ while getopts "k:cudyvht?" flag; do t) takeover="1" ;; + b) + BOOTDIR="${OPTARG}" + if [ ! -d $BOOTDIR ]; then + echo "Error: ${BOOTDIR} is not a directory." + exit 1 + fi + ;; h|?) usage ;; diff --git a/update-initramfs.8 b/update-initramfs.8 index 71f2500..9590ca3 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -11,6 +11,7 @@ update-initramfs \- generate an initramfs image .RB [ \-u ] .RB [ \-t ] .RB [ \-v ] +.RB [ \-b ] .RB [ \-h ] .SH DESCRIPTION The @@ -52,6 +53,10 @@ Allows to take over an custom initramfs with a newer one. This option increases the amount of information you are given during the chosen action. +.TP +\fB \-b +Set an different bootdir for the image creation. + .TP \fB \-h Print a short help page describing the available options in -- cgit v1.2.3 From 8e9ecf2b5f9ced135e29d12fbe53c727a248934d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 16 Jul 2006 21:14:42 +0200 Subject: big ubuntu merge: - changelog - typos + whitespace + comments + quoting - vga16fb --- debian/changelog | 150 +++++++++++++++++++++++++++++++++++++++- debian/initramfs-tools.install | 2 +- debian/initramfs-tools.postinst | 4 ++ hook-functions | 2 +- hooks/kernelextras | 5 +- init | 8 +-- mkinitramfs | 13 ++-- scripts/local | 13 ++-- update-initramfs | 6 +- 9 files changed, 180 insertions(+), 23 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index ddecf2d..8a519b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,20 @@ +initramfs-tools (0.70) unstable; urgency=low + + * Reduce diff against 0.69ubuntu3: + - hook-functions: Fix kernel typo. + - hooks/kernelextras: Fix comment and add vga16fb too. + - init: Whitespace cleanup, add one more quiet check. + - mkinitramfs: Use check_minkver instead of dpkg itself. Whitespace + cleanup and add quoting. + - scripts/local: Whitespace cleanup and add a comment. + - update-initramfs: Add quoting + whitespace fix. + - changelog: for noise reduction add 0.69ubuntu{1,2,3}, all 0.40ubuntu*, + 0.36ubuntu1 and missing 0.29 + 0.28 entries. + - initramfs-tools.install, initramfs-tools.postinst and + initramfs-tools.preinst merge 0.69ubuntu3. + + -- maximilian attems Sun, 16 Jul 2006 20:23:41 +0200 + initramfs-tools (0.69b) unstable; urgency=high * debian/initramfs-tools.preinst: Don't depend upon shipped directories @@ -16,6 +33,30 @@ initramfs-tools (0.69b) unstable; urgency=high -- maximilian attems Fri, 14 Jul 2006 00:31:30 +0200 +initramfs-tools (0.69ubuntu3) edgy; urgency=low + + * debian/initramfs-tools.install, debian/initramfs-tools.preinst, + debian/initramfs-tools.postinst: Copy default modules file in the + postinst (when it's actually available) rather than in the preinst (when + it isn't). Copy it from /usr/share/initramfs-tools/ rather than from + /usr/share/doc/initramfs-tools/examples/, per policy. + + -- Colin Watson Thu, 13 Jul 2006 10:04:26 +0100 + +initramfs-tools (0.69ubuntu2) edgy; urgency=low + + * debian/initramfs-tools.preinst: Make sure /etc/initramfs-tools and + /etc/initramfs-tools/conf.d exist before trying to write to them. + + -- Colin Watson Thu, 13 Jul 2006 09:19:05 +0100 + +initramfs-tools (0.69ubuntu1) edgy; urgency=low + + [ Jeff Bailey ] + * Merge from debian unstable. + + -- Jeff Bailey Wed, 12 Jul 2006 19:22:22 -0400 + initramfs-tools (0.69) unstable; urgency=low * scripts/local-premount/suspend, scripts/local-premount/resume: Rename @@ -590,6 +631,84 @@ initramfs-tools (0.42) unstable; urgency=low -- maximilian attems Mon, 5 Dec 2005 12:59:59 +0100 +initramfs-tools (0.40ubuntu32) dapper; urgency=low + + * Revert 0.40ubuntu31. This isn't as trivial as it should be. + + -- Matt Zimmerman Sun, 21 May 2006 10:17:50 -0700 + +initramfs-tools (0.40ubuntu31) dapper; urgency=low + + * scripts/local-premount/resume: Print a message when a resume is about to + begin (LP#41137) + + -- Matt Zimmerman Fri, 19 May 2006 15:14:53 -0700 + +initramfs-tools (0.40ubuntu30) dapper; urgency=low + + * This release brought to you by Fujitsu hard drives, which have forced + me to rewrite all my most recent initramfs-tools changes from memory. + * Include arcmsr module in the scsi module list (launchpad.net/40075) + * Abstract out the kernel minversion checking stuff into the function + library, so we can reuse it to check minversion requirements for hook + scripts as well (such as udev, which requires >= 2.6.15 in dapper) + * Bump the kernel minversion to 2.6.15 on hppa and ia64, since they used + initrd-tools with their 2.6.12 kernels in breezy, not initramfs-tools. + * If mkinitramfs fails due to minversion not being met, don't bail out + of update-initramfs, but just exit 0, so upgrades don't halt on it. + * Conditionalise the use of lvm and md in mkinitramfs so it's a no-op if + you don't have those packages installed, but allows for smooth upgrades + if you have older versions that don't ship their own hooks yet. + * Make prereqs conditional on the script/hook actually existing. From + now on, this means that 'PREREQ="udev"' means "run udev first, iff it + happens to be installed". Having the files exist on the filesystem if + you have a HARD dependency should be enforced with package dependencies. + * Add ohci1394 and sbp2 to the scsi module list (launchpad.net/37479) + * Move framebuffer setup from usplash to scripts/local-top/framebuffer + so that people booting with vga=1234 but no splash will still get a + framebuffer instead of a useless black console (launchpad.net/27669) + + -- Adam Conrad Tue, 16 May 2006 19:51:08 +1000 + +initramfs-tools (0.40ubuntu29) dapper; urgency=low + + * Make "update-initramfs -u" try to find the running kernel *after* it + attempts to search the symbolic link list and its own sha1 list. + Using this as a fallback, rather than the default, should solve most + upgrade issues, where people found their initramfs was half-baked. + + -- Adam Conrad Wed, 19 Apr 2006 13:51:35 +1000 + +initramfs-tools (0.40ubuntu28) dapper; urgency=low + + * Add raid10 module to the generic module list (launchpad.net/28028) + * Add cpqarray to the scsi module list (launchpad.net/{26632,35202}) + * Unset debug before we run the real init (launchpad.net/24095) + * Add the gdth module to the default scsi list (launchpad.net/31542) + + -- Adam Conrad Fri, 24 Mar 2006 04:33:44 +1100 + +initramfs-tools (0.40ubuntu27) dapper; urgency=low + + * Drop the evms, lvm and md local-top scripts; they're all provided by + their own packages now. This makes the depdencies rather nicer. + + -- Scott James Remnant Thu, 23 Mar 2006 18:04:48 +0000 + +initramfs-tools (0.40ubuntu26) dapper; urgency=low + + * Make the md and evms local-top scripts pre-requisite the udev one. + + -- Scott James Remnant Thu, 23 Mar 2006 17:54:32 +0000 + +initramfs-tools (0.40ubuntu25) dapper; urgency=low + + * Move the "loop waiting for the root filesystem" code from the udev + premount script to the local mountroot() function where it truly + belongs. + + -- Scott James Remnant Wed, 22 Mar 2006 16:28:46 +0000 + initramfs-tools (0.40ubuntu24) dapper; urgency=low * Add support for LSI Logic's Fusion MPT SAS and FC controllers as well. @@ -879,7 +998,6 @@ initramfs-tools (0.36ubuntu5) dapper; urgency=low -- Scott James Remnant Mon, 21 Nov 2005 08:40:20 +0000 - initramfs-tools (0.36ubuntu4) dapper; urgency=low * Replace all occurances of /etc/mkinitramfs in mkinitramfs with $CONFDIR, @@ -935,6 +1053,15 @@ initramfs-tools (0.37) unstable; urgency=low -- maximilian attems Wed, 26 Oct 2005 09:22:58 +0200 +initramfs-tools (0.36ubuntu1) dapper; urgency=low + + * Forced version bump to minimise the scary until I have a chance to dig + through the ubuntu:debian diffs and do a proper merge of their changes. + * Remove the "Loading, please wait..." message from the top of init, as + we now have other fairly early visual feedback, and this is just ugly. + + -- Adam Conrad Wed, 26 Oct 2005 11:27:36 +1000 + initramfs-tools (0.36) unstable; urgency=low "Sunny Autumn Release" @@ -1054,6 +1181,27 @@ initramfs-tools (0.30) unstable; urgency=low -- maximilian attems Fri, 30 Sep 2005 19:34:55 +0200 +initramfs-tools (0.29) breezy; urgency=low + + "Beauty is a form of genius - is higher, indeed, than genius, as it + needs no explanation." + - Oscar Wilde + + * hook-functions (auto_add_modules): Add advansys. + + * debian/rules: Make sure hooks and scripts are chmod +x + + * init: Add start of debug command line option. + + -- Jeff Bailey Tue, 20 Sep 2005 15:47:42 -0400 + +initramfs-tools (0.28) breezy; urgency=low + + * Run udevstart after loading block drivers - should fix resume from + hibernate on non-LVM systems. + + -- Matthew Garrett Tue, 20 Sep 2005 01:13:31 +0100 + initramfs-tools (0.27) unstable; urgency=low * Remove unused BUSYBOX config option as we use busybox anyway. diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index add5a7f..5514c2e 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -3,8 +3,8 @@ mkinitramfs-kpkg usr/sbin init usr/share/initramfs-tools scripts usr/share/initramfs-tools conf/initramfs.conf etc/initramfs-tools -conf/modules etc/initramfs-tools hooks usr/share/initramfs-tools hook-functions usr/share/initramfs-tools +conf/modules usr/share/initramfs-tools update-initramfs usr/sbin debian/script usr/share/bug/initramfs-tools diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index a8df95e..5f46777 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -2,6 +2,10 @@ set -e +if [ ! -e /etc/initramfs-tools/modules ]; then + cp /usr/share/initramfs-tools/modules /etc/initramfs-tools/ +fi + # Regenerate initramfs on upgrade if [ "$1" = "configure" -a -n "$2" ]; then update-initramfs -u diff --git a/hook-functions b/hook-functions index fe10cfe..9b1bd24 100644 --- a/hook-functions +++ b/hook-functions @@ -243,7 +243,7 @@ check_minkver() ;; esac if dpkg --compare-versions "${curversion}" lt "${minversion}"; then - echo "W: kernerl ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2 + echo "W: kernel ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2 echo "W: not generating requested initramfs for kernel ${curversion}" >&2 exit 2 fi diff --git a/hooks/kernelextras b/hooks/kernelextras index 815dd25..6bbd6b9 100755 --- a/hooks/kernelextras +++ b/hooks/kernelextras @@ -15,7 +15,7 @@ prereqs) ;; esac -# Hooks for loading loading extra kernel bits into the initramfs +# Hooks for loading extra kernel bits into the initramfs . /usr/share/initramfs-tools/hook-functions @@ -36,6 +36,9 @@ for x in ${MODULESDIR}/initrd/*; do 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/init b/init index 2beb597..f66281c 100755 --- a/init +++ b/init @@ -31,7 +31,7 @@ export ROOT= # Bring in the main config . /conf/initramfs.conf for i in conf/conf.d/*; do - [ -f ${i} ] && . ${i} + [ -f ${i} ] && . ${i} done . /scripts/functions @@ -105,7 +105,7 @@ for x in $(cat /proc/cmdline); do done if [ -z ${NORESUME} ]; then - export resume=${RESUME} + export resume=${RESUME} fi depmod -a @@ -120,9 +120,9 @@ load_modules log_end_msg maybe_break premount -log_begin_msg "Running /scripts/init-premount" +[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount" run_scripts /scripts/init-premount -log_end_msg +[ "$quiet" != "y" ] && log_end_msg maybe_break mount log_begin_msg "Mounting root file system..." diff --git a/mkinitramfs b/mkinitramfs index a0bec9e..6c048df 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -84,7 +84,7 @@ fi . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' for i in ${CONFDIR}/conf.d/* /usr/share/initramfs-tools/conf.d/*; do - EXTRA_CONF="${EXTRA_CONF} $(basename $i | grep '^[a-z0-9][a-z0-9\._-]*$' | grep -v '\.dpkg-.*$')"; + EXTRA_CONF="${EXTRA_CONF} $(basename $i | grep '^[a-z0-9][a-z0-9\._-]*$' | grep -v '\.dpkg-.*$')"; done for i in ${EXTRA_CONF}; do . ${CONFDIR}/conf.d/${i} @@ -102,10 +102,11 @@ else version="${1}" fi -if dpkg --compare-versions "${version}" lt 2.6.12; then - echo "Kernel version too old. initramfs-tools requires at least 2.6.12." - exit 1 -fi +# Check that we're using a new enough kernel version, first for ourselves, +# then for each of the hooks, which can have a MINKVER variable defined +check_minkver ${version} +check_minkver ${version} /usr/share/initramfs-tools/hooks +check_minkver ${version} ${CONFDIR}/hooks case "${version}" in /lib/modules/*/[!/]*) @@ -195,7 +196,7 @@ done echo "DPKG_ARCH=${DPKG_ARCH}" > ${DESTDIR}/conf/arch.conf copy_exec "${CONFDIR}/initramfs.conf" /conf for i in ${EXTRA_CONF}; do - copy_exec ${CONFDIR}/conf.d/${i} /conf/conf.d + copy_exec "${CONFDIR}/conf.d/${i}" /conf/conf.d done echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root diff --git a/scripts/local b/scripts/local index a565885..8510088 100644 --- a/scripts/local +++ b/scripts/local @@ -25,17 +25,18 @@ mountroot () log_end_msg 0 else log_end_msg 1 || true - fi - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "TIMEOUT 15" || true - fi - fi + fi + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TIMEOUT 15" || true + fi + fi - # We've given up, but we'll let the user fix matters if they can + # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done + # Get the root filesystem type eval $(fstype < ${ROOT}) [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" diff --git a/update-initramfs b/update-initramfs index 71cc90d..866609e 100755 --- a/update-initramfs +++ b/update-initramfs @@ -68,7 +68,7 @@ generate_initramfs() if [ "${verbose}" = 1 ]; then OPTS="-v $OPTS" fi - if mkinitramfs $OPTS "${initramfs}" "${version}"; then + if mkinitramfs "${OPTS}" "${initramfs}" "${version}"; then set_sha1 else mkinitramfs_return="$?" @@ -312,8 +312,8 @@ while getopts "k:cudyvtb:h?" flag; do takeover="1" ;; b) - BOOTDIR="${OPTARG}" - if [ ! -d $BOOTDIR ]; then + BOOTDIR="${OPTARG}" + if [ ! -d "${BOOTDIR}" ]; then echo "Error: ${BOOTDIR} is not a directory." exit 1 fi -- cgit v1.2.3 From 17d01b3434dac54ace5991029ed069b3d185ffd2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 16 Jul 2006 21:54:14 +0200 Subject: massif whitespace cleanup --- break.txt | 2 +- debian/NEWS | 2 +- debian/changelog | 48 +++++++++++++++++++++++++------------------ debian/copyright | 2 +- docs/example_hook | 6 +++--- docs/example_hook_cpiogz | 2 +- docs/example_script | 4 ++-- hooks/lvm | 2 +- hooks/md | 2 +- init | 2 +- initramfs-tools.8 | 18 ++++++++-------- initramfs.conf.5 | 4 ++-- mkinitramfs | 20 +++++++++--------- mkinitramfs-kpkg | 16 +++++++-------- mkinitramfs-kpkg.8 | 6 +++--- mkinitramfs.8 | 30 +++++++++++++-------------- scripts/functions | 12 +++++------ scripts/local-top/udev_helper | 2 +- update-initramfs | 6 +++--- update-initramfs.8 | 26 +++++++++++------------ 20 files changed, 110 insertions(+), 102 deletions(-) (limited to 'scripts') diff --git a/break.txt b/break.txt index ff26d5b..64ecf84 100644 --- a/break.txt +++ b/break.txt @@ -1,4 +1,4 @@ -if [ x${break} = xyes ]; then +if [ x${break} = xyes ]; then panic "Spawning shell within the initramfs" fi diff --git a/debian/NEWS b/debian/NEWS index d4647d4..a6ae4bc 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -15,7 +15,7 @@ initramfs-tools (0.10) breezy; urgency=low This means two things in particular that are important: 1) the resulting initramfs will be huge. Like 10 megs huge. - I will shrink it down once it's correct. If you're on an + I will shrink it down once it's correct. If you're on an arch that doesn't like >4mb initramfs', then this won't boot. 2) Your network drivers are loaded in the initramfs, so hotplug diff --git a/debian/changelog b/debian/changelog index 8a519b4..b48be87 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,12 +8,20 @@ initramfs-tools (0.70) unstable; urgency=low cleanup and add quoting. - scripts/local: Whitespace cleanup and add a comment. - update-initramfs: Add quoting + whitespace fix. - - changelog: for noise reduction add 0.69ubuntu{1,2,3}, all 0.40ubuntu*, + - changelog: for noise reduction add 0.69ubuntu{1,2,3}, all 0.40ubuntu*, 0.36ubuntu1 and missing 0.29 + 0.28 entries. - initramfs-tools.install, initramfs-tools.postinst and initramfs-tools.preinst merge 0.69ubuntu3. - -- maximilian attems Sun, 16 Jul 2006 20:23:41 +0200 + * break.txt, debian/NEWS, debian/changelog, debian/copyright, + docs/example_hook, docs/example_hook_cpiogz, docs/example_script, + hooks/lvm, hooks/md, init, initramfs-tools.8, initramfs.conf.5, + mkinitramfs, mkinitramfs-kpkg, mkinitramfs-kpkg.8, mkinitramfs.8, + scripts/functions, scripts/local-top/udev_helper, update-initramfs, + update-initramfs.8: Whitespace policy cleanup trailing whitespace and + non tabular indents. + + -- maximilian attems Sun, 16 Jul 2006 21:50:34 +0200 initramfs-tools (0.69b) unstable; urgency=high @@ -68,7 +76,7 @@ initramfs-tools (0.69) unstable; urgency=low * update-initramfs: Add option "-b directory" to override BOOTDIR. Allows the initramfs to be created in another dir without awkward - mkinitramfs invocation. Check that the passed arg is really a dir. + mkinitramfs invocation. Check that the passed arg is really a dir. (ubuntu: 37690) Thanks Colin Watson * update-initramfs.8: Document -b switch. @@ -312,7 +320,7 @@ initramfs-tools (0.60) unstable; urgency=low initramfs-tools (0.59b) unstable; urgency=low - * mkinitramfs-kpkg: Intialialize the variables. + * mkinitramfs-kpkg: Intialialize the variables. (closes: #359355, #359620, #359613, #359666, #359681) -- maximilian attems Tue, 28 Mar 2006 16:30:59 +0200 @@ -329,7 +337,7 @@ initramfs-tools (0.59) unstable; urgency=low - scripts/local-top/udev_helper: Leave the remaining ide-generic part there, should be taken over by udev itself. - make the md local-top scripts pre-requisite the udev one. - thanks Scott James Remnant + thanks Scott James Remnant -- maximilian attems Sun, 26 Mar 2006 22:35:15 +0200 @@ -768,7 +776,7 @@ initramfs-tools (0.40ubuntu17) dapper; urgency=low * Make auto_add_modules take an argument, so you can use it to add only some of the auto* modules (like "net" or "ide"), and create a "netboot" - option that only includes base and net (Closes launchpad.net/26426) + option that only includes base and net (Closes launchpad.net/26426) * Change the nfs script to use "mount -o nolock" instead of "nfsmount", to fix some timeouts for ltsp NFS roots (Closes launchpad.net/19196) @@ -854,7 +862,7 @@ initramfs-tools (0.40ubuntu8) dapper; urgency=low initramfs-tools (0.40ubuntu7) dapper; urgency=low * remove "sleep 3" from the nfs script before the nfsmount command, - its a leftover from debugging in breezy and slows down thin client + its a leftover from debugging in breezy and slows down thin client booting unnecessary -- Oliver Grawert Fri, 2 Dec 2005 11:45:05 +0100 @@ -887,7 +895,7 @@ initramfs-tools (0.40ubuntu4) dapper; urgency=low initramfs-tools (0.40ubuntu3) dapper; urgency=low "A true friend stabs you in the front." - - Oscar Wilde + - Oscar Wilde * hooks/acpid: Rename to ... * hooks/thermal: ... this. Add therm_pm72 for ppc64 systems. @@ -933,7 +941,7 @@ initramfs-tools (0.41) unstable; urgency=high * High urgency upload to cope with newer udev upstream - bonus: condition to test against when udev is ready. (Closes: #341014) - Thanks Marco d'Itri for guidance and + Thanks Marco d'Itri for guidance and Heikki Henriksen for double check. * Pump udev dep on 0.076-3. @@ -978,7 +986,7 @@ initramfs-tools (0.39) unstable; urgency=medium * Pump udev dependency. * init: Pump timeout as there is currently no way to check which udevd - processes are still running and why. + processes are still running and why. Cures hopefully breakage of missing devices on boot. * Sync with latest Ubuntu. @@ -1048,7 +1056,7 @@ initramfs-tools (0.37) unstable; urgency=low Exit if it doesn't exist before including current dir. Thanks to Jean Charles Delepine (Closes: #335505) - * hooks/lvm, hooks/md: Remove FIXME's at second thought. You better want + * hooks/lvm, hooks/md: Remove FIXME's at second thought. You better want to check against the binaries for your not yet created raid/lvm. -- maximilian attems Wed, 26 Oct 2005 09:22:58 +0200 @@ -1065,7 +1073,7 @@ initramfs-tools (0.36ubuntu1) dapper; urgency=low initramfs-tools (0.36) unstable; urgency=low "Sunny Autumn Release" - + * Minor cleanups in mkiniramfs. * Remove manpage section about return values. Needs to be rephrased. @@ -1149,7 +1157,7 @@ initramfs-tools (0.30) unstable; urgency=low [ maximilian Attems ] * Resynconise with latest upstream now we are in unstable. - + [ Jeff Bailey ] * debian/rules: Make sure hooks and scripts are chmod +x @@ -1197,7 +1205,7 @@ initramfs-tools (0.29) breezy; urgency=low initramfs-tools (0.28) breezy; urgency=low - * Run udevstart after loading block drivers - should fix resume from + * Run udevstart after loading block drivers - should fix resume from hibernate on non-LVM systems. -- Matthew Garrett Tue, 20 Sep 2005 01:13:31 +0100 @@ -1228,7 +1236,7 @@ initramfs-tools (0.27) unstable; urgency=low initramfs-tools (0.26) breezy; urgency=low "Experience is one thing you can't get for nothing." - - Oscar Wilde + - Oscar Wilde * scripts/local-top/lvm: Reduce -- to - in VG strings for feeding to vgchange. (Ubuntu: #13387) @@ -1264,7 +1272,7 @@ initramfs-tools (0.26) breezy; urgency=low * debian/dirs: Add etc/mkinitramfs/hooks, move all scripts subdirs into etc/mkinitramfs/scripts. - * mkinitramfs: Set the umask. Copy the scripts from + * mkinitramfs: Set the umask. Copy the scripts from /etc/mkinitramfs/scripts into the image. Make sure that modules file lists is actually a regular file. @@ -1441,9 +1449,9 @@ initramfs-tools (0.17) breezy; urgency=low genius." - Oscar Wilde - * debian/initramfs-tools.postinst: Get the name of the config file + * debian/initramfs-tools.postinst: Get the name of the config file right when seeding RESUME=. Also fix the sed expression. - Thanks to Matthew Garrett for noticing this! + Thanks to Matthew Garrett for noticing this! -- Jeff Bailey Wed, 10 Aug 2005 11:54:07 -0400 @@ -1459,7 +1467,7 @@ initramfs-tools (0.16) breezy; urgency=low * scripts/functions: Be silent when adding non-detected modules. * conf/mkinitramfs.conf: MODULES=most by default, BUSYBOX=y - (Non-busybox isn't supported now. It's not clear that it ever + (Non-busybox isn't supported now. It's not clear that it ever will be). Add RESUME line for resuming from suspend-to-disk. * scripts/local-premount/suspend: New script for suspend-to-disk. @@ -1568,7 +1576,7 @@ initramfs-tools (0.13) breezy; urgency=low Use DESTDIR instead of TMPDIR Add ability to link in extra hunks into the cpio file Cosmetic cleanups - + * scripts/functions: Add lsb stype log_FOO_msg functions * scripts/local: Add logging diff --git a/debian/copyright b/debian/copyright index 3a3bc5b..2c681c2 100644 --- a/debian/copyright +++ b/debian/copyright @@ -13,7 +13,7 @@ The Debian tree is maintained with "bzr" at: http://debian.stro.at/bzr-test/initramfs-tools/ Authors: Jeff Bailey , Adam Conrad , - Scott James Remnant , + Scott James Remnant , maximilian attems Copyright: 2005 Jeff Bailey diff --git a/docs/example_hook b/docs/example_hook index de5392d..a0d015a 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -12,7 +12,7 @@ # 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 @@ -96,9 +96,9 @@ fi # 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 # diff --git a/docs/example_hook_cpiogz b/docs/example_hook_cpiogz index dcd1416..f3e44d9 100644 --- a/docs/example_hook_cpiogz +++ b/docs/example_hook_cpiogz @@ -50,7 +50,7 @@ esac # 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 diff --git a/docs/example_script b/docs/example_script index 221c888..d7f407f 100644 --- a/docs/example_script +++ b/docs/example_script @@ -70,12 +70,12 @@ echo "Got here!" 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 # diff --git a/hooks/lvm b/hooks/lvm index 98c0e0a..49a8887 100755 --- a/hooks/lvm +++ b/hooks/lvm @@ -23,5 +23,5 @@ fi copy_exec /lib/lvm-200/vgchange /sbin for x in dm_mod dm_snapshot dm_mirror; do - manual_add_modules ${x} + manual_add_modules ${x} done diff --git a/hooks/md b/hooks/md index becaba1..df2abc8 100755 --- a/hooks/md +++ b/hooks/md @@ -24,5 +24,5 @@ copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin for x in md linear raid0 raid1 raid5 raid6 raid10; do - manual_add_modules ${x} + manual_add_modules ${x} done diff --git a/init b/init index f66281c..eb14326 100755 --- a/init +++ b/init @@ -18,7 +18,7 @@ fi mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev > /dev/.initramfs-tools mkdir /dev/.initramfs -mknod /dev/console c 5 1 +mknod /dev/console c 5 1 mknod /dev/null c 1 3 # Export the dpkg architecture diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 5d7c105..5712bdd 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -4,19 +4,19 @@ initramfs-tools \- an introduction to writing scripts for mkinitramfs .SH DESCRIPTION -initramfs-tools has one main script and two different sets of subscripts which +initramfs-tools has one main script and two different sets of subscripts which 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. .SS Hook scripts -These are used when an initramfs image is created and not included in the +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 +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. +mounted. initramfs-tools uses shell variable names for handling dependencies. Notice that `-' is not a valid shell variable name and thus should @@ -40,7 +40,7 @@ the device node to mount as the rootfs. .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 +string of the form NFSSERVER:NFSPATH .TP \fB \fI boot @@ -79,7 +79,7 @@ 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 in the image itself. No guarantees are made as to the order in which the -different scripts are executed unless the prereqs are setup in the script. +different scripts are executed unless the prereqs are setup in the script. .SS Header In order to support prereqs, each script should begin with the following lines: @@ -113,7 +113,7 @@ the lvm hook script is run before your custom script. /usr/share/initramfs-tools/hook-functions contains a number of functions which deal with some common tasks in a hook script: .TP -\fB \fI +\fB \fI manual_add_modules adds a module (and any modules which it depends on) to the initramfs image. .RS @@ -389,7 +389,7 @@ if [ ! -e "/dev/mapper/frobb" ]; then panic "Frobnication device not found" fi -log_begin_msg "Starting frobnication" +log_begin_msg "Starting frobnication" /sbin/frobnicate "/dev/mapper/frobb" || panic "Frobnication failed" log_end_msg @@ -398,7 +398,7 @@ exit 0 .RE .SH DEBUG -It is easy to check the generated initramfs for its content. One may need +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: .RS .nf diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 2874fdb..afd799b 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -5,7 +5,7 @@ initramfs.conf \- configuration file for mkinitramfs .SH DESCRIPTION The behaviour of -.B mkinitramfs +.B mkinitramfs can be modified by its configuration file. Each line in the file can be a configuration variable, a blank line, @@ -35,7 +35,7 @@ The default setting is \fImost\fP. .SH NFS VARIABLES .TP \fB BOOT -Allows to use an nfs drive as the root of the drive. +Allows to use an nfs drive as the root of the drive. The default is to boot of an \fIlocal\fP media (harddrive, USB stick). Set to \fInfs\fP for an NFS root share. diff --git a/mkinitramfs b/mkinitramfs index 6c048df..81a859e 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -8,7 +8,7 @@ CONFDIR="/etc/initramfs-tools" verbose="n" errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" -BUSYBOXDIR="/bin" +BUSYBOXDIR="/bin" OPTIONS=`getopt -o d:ko:r:v --long supported-host-version:,supported-target-version: -n "$0" -- "$@"` @@ -110,18 +110,18 @@ check_minkver ${version} ${CONFDIR}/hooks case "${version}" in /lib/modules/*/[!/]*) - ;; + ;; /lib/modules/[!/]*) - version="${version#/lib/modules/}" - version="${version%%/*}" - ;; + version="${version#/lib/modules/}" + version="${version%%/*}" + ;; esac case "${version}" in */*) - echo "$PROG: ${version} is not a valid kernel version" >&2 - exit 1 - ;; + echo "$PROG: ${version} is not a valid kernel version" >&2 + exit 1 + ;; esac if [ -d "${outfile}" ]; then @@ -157,7 +157,7 @@ export verbose export __TMPCPIOGZ for d in bin conf/conf.d etc lib modules sbin scripts; do - mkdir -p "${DESTDIR}/${d}" + mkdir -p "${DESTDIR}/${d}" done # MODULES=list case. Always honour. @@ -228,7 +228,7 @@ fi (cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip -9 >"${outfile}") || exit 1 if [ -s "${__TMPCPIOGZ}" ]; then - cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 + cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 fi if [ "${keep}" = "y" ]; then diff --git a/mkinitramfs-kpkg b/mkinitramfs-kpkg index 437b0ac..df3dc0c 100755 --- a/mkinitramfs-kpkg +++ b/mkinitramfs-kpkg @@ -79,20 +79,20 @@ version="${1}" case "${version}" in /lib/modules/*/[!/]*) - ;; + ;; /lib/modules/[!/]*) - version="${version#/lib/modules/}" - version="${version%%/*}" - ;; + version="${version#/lib/modules/}" + version="${version%%/*}" + ;; esac case "${version}" in */*) - echo "$PROG: ${version} is not a valid kernel version" >&2 - exit 1 - ;; + echo "$PROG: ${version} is not a valid kernel version" >&2 + exit 1 + ;; esac -# linux-image installs latest version +# 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 0bdc1dc..871a0f4 100644 --- a/mkinitramfs-kpkg.8 +++ b/mkinitramfs-kpkg.8 @@ -5,8 +5,8 @@ mkinitramfs-kpkg \- generates an initramfs image for kernel-package .SH SYNOPSIS .B mkinitramfs -.RB [ \-o -.IR outfile ] +.RB [ \-o +.IR outfile ] .RI [ version ] .B mkinitramfs .RB [ \-\-supported-host-version= @@ -29,7 +29,7 @@ for an better alternative. .TP \fB \-o \fI outfile -Write the image to +Write the image to .IR outfile . .TP diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 5af552b..3dc2e2e 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -5,13 +5,13 @@ mkinitramfs \- generate an initramfs image .SH SYNOPSIS .B mkinitramfs -.RB [ \-d -.IR confdir ] -.RB [ \-k ] -.RB [ \-o -.IR outfile ] -.RB [ \-r -.IR root ] +.RB [ \-d +.IR confdir ] +.RB [ \-k ] +.RB [ \-o +.IR outfile ] +.RB [ \-r +.IR root ] .RI [ version ] .B mkinitramfs .RB [ \-\-supported-host-version= @@ -21,17 +21,17 @@ mkinitramfs \- generate an initramfs image .SH DESCRIPTION The -.B mkinitramfs +.B mkinitramfs script generates an initramfs image. The initramfs is a gzipped 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 +is meant for advanced usage. On your local box .B update-initramfs should do all necessary steps. -At boot time, the kernel unpacks that archive into RAM disk, mounts and -uses it as initial root file system. All finding of the root device +At boot time, the kernel unpacks that archive into RAM disk, mounts and +uses it as initial root file system. All finding of the root device happens in this early userspace. .SH OPTIONS @@ -45,14 +45,14 @@ Keep the temporary directory used to make the image. .TP \fB \-o \fI outfile -Write the image to +Write the image to .IR outfile . .TP \fB \-r \fI root -Override the -.B ROOT -setting in +Override the +.B ROOT +setting in .IR initramfs.conf . .TP diff --git a/scripts/functions b/scripts/functions index c3a3e16..53e07ca 100644 --- a/scripts/functions +++ b/scripts/functions @@ -2,23 +2,23 @@ _log_msg() { - if [ "$quiet" = "y" ]; then return; fi - echo "$@" + if [ "$quiet" = "y" ]; then return; fi + echo "$@" } log_success_msg() { - _log_msg "Success: $@" + _log_msg "Success: $@" } log_failure_msg() { - _log_msg "Failure: $@" + _log_msg "Failure: $@" } log_warning_msg() { - _log_msg "Warning: $@" + _log_msg "Warning: $@" } log_begin_msg() @@ -190,7 +190,7 @@ load_modules() if [ -e /conf/modules ]; then cat /conf/modules | while read m; do # Skip empty lines - if [ -z "$m" ]; then + if [ -z "$m" ]; then continue fi # Skip comments - d?ash removes whitespace prefix diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper index 5a747ba..2d4c209 100755 --- a/scripts/local-top/udev_helper +++ b/scripts/local-top/udev_helper @@ -19,5 +19,5 @@ esac # but might be an old fashioned ISA controller; in which case # we need to load ide-generic. if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe -q ide-generic + modprobe -q ide-generic fi diff --git a/update-initramfs b/update-initramfs index 866609e..85a5dd2 100755 --- a/update-initramfs +++ b/update-initramfs @@ -189,7 +189,7 @@ create() if version_exists "${version}"; then panic "Cannot create version ${version}: already exists" fi - + if [ -e "${initramfs}" ]; then panic "${initramfs} already exists, cannot create." fi @@ -257,7 +257,7 @@ delete() 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." fi @@ -291,7 +291,7 @@ takeover=0 while getopts "k:cudyvtb:h?" flag; do case "${flag}" in k) - version="${OPTARG}" + version="${OPTARG}" ;; c) mode="c" diff --git a/update-initramfs.8 b/update-initramfs.8 index 9590ca3..a36e83c 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -5,25 +5,25 @@ update-initramfs \- generate an initramfs image .SH SYNOPSIS .B update-initramfs -.RB [ \-k -.IR version ] -.RB [ \-c ] -.RB [ \-u ] -.RB [ \-t ] -.RB [ \-v ] -.RB [ \-b ] -.RB [ \-h ] +.RB [ \-k +.IR version ] +.RB [ \-c ] +.RB [ \-u ] +.RB [ \-t ] +.RB [ \-v ] +.RB [ \-b ] +.RB [ \-h ] .SH DESCRIPTION The -.B update-initramfs +.B update-initramfs script manages your initramfs images on your local box. It keeps track of the existing initramfs archives in /boot. There are three modes of operation create, update or delete. You must at least specify one of those modes. -The initramfs is a gzipped cpio archive. -At boot time, the kernel unpacks that archive into RAM disk, mounts and -uses it as initial root file system. All finding of the root device +The initramfs is a gzipped cpio archive. +At boot time, the kernel unpacks that archive into RAM disk, mounts and +uses it as initial root file system. All finding of the root device happens in this early userspace. .SH OPTIONS @@ -59,7 +59,7 @@ Set an different bootdir for the image creation. .TP \fB \-h -Print a short help page describing the available options in +Print a short help page describing the available options in .B update-initramfs. .SH AUTHOR -- cgit v1.2.3 From 475bcbc9d6eefe90de6efe424bfb5bcca999fbc7 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 20 Jul 2006 17:41:31 +0200 Subject: - drop md scripts - pump klibc dep - use resume klibc-utils bin - remove some klibc binaries - use nfsmount --- debian/changelog | 26 +++++++++++++++++++++++--- debian/control | 2 +- hooks/md | 28 ---------------------------- mkinitramfs | 3 +++ scripts/local-premount/resume | 3 +-- scripts/local-top/md | 35 ----------------------------------- scripts/nfs | 2 +- 7 files changed, 29 insertions(+), 70 deletions(-) delete mode 100755 hooks/md delete mode 100755 scripts/local-top/md (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b48be87..faaf90a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,16 @@ +initramfs-tools (0.70b) unstable; urgency=low + + * Be more careful about vi dot files, removed. + Thanks Frederik Schüler for review. + + -- maximilian attems Wed, 19 Jul 2006 16:00:47 +0200 + initramfs-tools (0.70) unstable; urgency=low + * mkinitramfs: Don't include static kinit, nor gzip. They are the biggest + klibc-utils binaries and we don't use them. Keep static gunzip, zcat and + shared kinit for now. + * Reduce diff against 0.69ubuntu3: - hook-functions: Fix kernel typo. - hooks/kernelextras: Fix comment and add vga16fb too. @@ -7,6 +18,8 @@ initramfs-tools (0.70) unstable; urgency=low - mkinitramfs: Use check_minkver instead of dpkg itself. Whitespace cleanup and add quoting. - scripts/local: Whitespace cleanup and add a comment. + - scripts/nfs: Use mount with nolock instead of nfsmount. + (closes: 359926) - update-initramfs: Add quoting + whitespace fix. - changelog: for noise reduction add 0.69ubuntu{1,2,3}, all 0.40ubuntu*, 0.36ubuntu1 and missing 0.29 + 0.28 entries. @@ -18,10 +31,17 @@ initramfs-tools (0.70) unstable; urgency=low hooks/lvm, hooks/md, init, initramfs-tools.8, initramfs.conf.5, mkinitramfs, mkinitramfs-kpkg, mkinitramfs-kpkg.8, mkinitramfs.8, scripts/functions, scripts/local-top/udev_helper, update-initramfs, - update-initramfs.8: Whitespace policy cleanup trailing whitespace and - non tabular indents. + update-initramfs.8: Cleanup trailing whitespace and non tabular indents. + + * scripts/local-premount/resume: Use new resume bin from klibc-utils. + Removes superflous stat and awk usage. + + * debian/control: Depend against newer klibc-utils 1.4.11-1. + + * hooks/md, scripts/local-top/md: Drop as mdadm > 2.5-1 features them. + (closes: #367567) - -- maximilian attems Sun, 16 Jul 2006 21:50:34 +0200 + -- maximilian attems Wed, 19 Jul 2006 11:09:52 +0200 initramfs-tools (0.69b) unstable; urgency=high diff --git a/debian/control b/debian/control index a5a1cee..53caa8f 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.1.16-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.11-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged diff --git a/hooks/md b/hooks/md deleted file mode 100755 index df2abc8..0000000 --- a/hooks/md +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -prereqs) - prereqs - exit 0 - ;; -esac - -if [ ! -x /sbin/mdadm ]; then - exit 0 -fi - -. /usr/share/initramfs-tools/hook-functions - -copy_exec /sbin/mdadm /sbin -copy_exec /sbin/mdrun /sbin - -for x in md linear raid0 raid1 raid5 raid6 raid10; do - manual_add_modules ${x} -done diff --git a/mkinitramfs b/mkinitramfs index 81a859e..0f1cb58 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -183,8 +183,11 @@ fi # 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 -a /usr/share/initramfs-tools/scripts/* "${DESTDIR}/scripts" for f in $(cd ${CONFDIR}/scripts && \ diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 0c88ccc..059e7a4 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -24,6 +24,5 @@ if [ ! -e "${resume}" ]; then fi if [ -e /sys/power/resume ]; then - major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') - echo $major_minor >/sys/power/resume + resume ${resume} fi diff --git a/scripts/local-top/md b/scripts/local-top/md deleted file mode 100755 index aa48474..0000000 --- a/scripts/local-top/md +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -PREREQ="udev_helper" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -unset raidlvl -gotraid=n - -# Detect raid level -for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do - if [ ! -e ${x} ]; then - continue - fi - raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') - if [ "$raidlvl" ]; then - modprobe -q ${raidlvl} 2>/dev/null - gotraid=y - fi -done - -[ "${gotraid}" = y ] || exit - -/sbin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index 89b5c20..47e9ac1 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -33,7 +33,7 @@ mountroot () roflag="-o rw" fi - nfsmount ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} + mount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom -- cgit v1.2.3 From 8761821795732a9755d673e92fb45ac9202270df Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 24 Jul 2006 09:13:28 +0200 Subject: - add BUSYBOX section to conf - add myri10ge, smc911x and hptiop modules - fix check_minkver() logic - escape resume variables - fix SEE ALSO section in all manpages - source /usr/share/initramfs-tools/conf.d/* - check against modules.dep before running depmod - more verbose output - open console with -i for dash interactive - fix resume param by LABEL or UUID - lvm has new prereq mdadm - update-initramfs fix -v calling - functions/scripts replace basename usage with shell expansion --- conf/initramfs.conf | 7 ++++++ debian/changelog | 50 +++++++++++++++++++++++++++++++++++++++++++ hook-functions | 17 ++++++++------- init | 4 ++-- initramfs-tools.8 | 5 +++-- initramfs.conf.5 | 16 +++++++++++--- mkinitramfs | 12 ++++++++--- mkinitramfs-kpkg.8 | 6 ++++-- mkinitramfs.8 | 9 ++++++-- scripts/functions | 8 +++++-- scripts/local-premount/resume | 9 ++++++++ scripts/local-top/lvm | 2 +- update-initramfs | 4 ++-- update-initramfs.8 | 6 ++++-- 14 files changed, 126 insertions(+), 29 deletions(-) (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 84d3b24..b0d1dc0 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -17,6 +17,13 @@ MODULES=most +# BUSYBOX: [ y | n ] +# +# Use busybox if available. +# + +BUSYBOX=y + # # NFS Section of the config. # diff --git a/debian/changelog b/debian/changelog index faaf90a..e6f271b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,46 @@ +initramfs-tools (0.71) unstable; urgency=low + + * initramfs.conf.5, initramfs-tools.8, mkinitramfs.8, mkinitramfs-kpkg.8, + update-initramfs.8: Fix spacing in the SEE ALSO section and have this + section everywhere as last. Fix linebreak in mkinitramfs.8 options. + Thanks Martin Michlmayr for the notice. + + * scripts/functions: Use shell parameter expansion to strip known dir + prefix instead of gratious basename call. + + * scripts/functions: On panic call open the rescue shell with -i to get + dash interactive features. ash from busybox ignores the param. + Thanks David Härdeman for the suggestion. + + * conf/initramfs.conf: Readd BUSYBOX=y section. Beware that a lot of boot + scripts need busybox and the current default image still does too. + + * initramfs.conf: Document BUSYBOX usage. + + * init: Add variable quoting around resume, NORESUME parsing and checks. + + * hook-functions: Add myri10ge and smc911x to the net section. Add hptiop to + the scsi section. + + * update-initramfs: Fix -v usage by not passing quoted ${OPTS} as one + option. Thanks Famelis George for the patch. + (closes: 379212) + + * mkinitramfs: Really source /usr/share/initramfs-tools/conf.d/ entries. + + * mkinitramfs: Check against modules.dep before invoking depmod. + + * hook-functions: check_minkver() only needs to call init_list(), + when a dir gets passed. Clean up check_minkver() logic. + + * scripts/function, mkinitramfs: Add output on verbose mode. + + * merge 0.69ubuntu4. + + * scripts/local-top/lvm: Prereqs s/md/mdadm/ for the new hooks. + + -- maximilian attems Mon, 24 Jul 2006 09:10:53 +0200 + initramfs-tools (0.70b) unstable; urgency=low * Be more careful about vi dot files, removed. @@ -61,6 +104,13 @@ initramfs-tools (0.69b) unstable; urgency=high -- maximilian attems Fri, 14 Jul 2006 00:31:30 +0200 +initramfs-tools (0.69ubuntu4) edgy; urgency=low + + * scripts/local-premount/suspend: Check for UUID= or LABEL= on the + start of $resume, and use /dev/disk/by-{uuid,label} if found. + + -- Scott James Remnant Fri, 21 Jul 2006 17:58:34 +0100 + initramfs-tools (0.69ubuntu3) edgy; urgency=low * debian/initramfs-tools.install, debian/initramfs-tools.preinst, diff --git a/hook-functions b/hook-functions index 9b1bd24..3175cba 100644 --- a/hook-functions +++ b/hook-functions @@ -149,8 +149,8 @@ auto_add_modules() net) for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx \ dl2k e1000 e100 epic100 eql fealnx famachi forcedeth \ - hp100 mace mv643xx_eth natsemi ne2k-pci netconsole \ - ns83820 pcnet32 r8169 s2io sis900 skge slhc starfire \ + hp100 mace mv643xx_eth myri10ge natsemi ne2k-pci netconsole \ + ns83820 pcnet32 r8169 s2io sis900 skge slhc smc911x starfire \ sundance sungem sungem_phy sunhme tg3 tlan de2104x \ de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb \ typhon via-rhine via-velocity yellowfin; do @@ -170,10 +170,10 @@ auto_add_modules() for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci \ aic79xx aic7xxx arcmsr ata_piix atari_scsi atp870u BusLogic \ cciss ch cpqarray dac960 dc395x dmx3191d dpt_i2o eata fdomain \ - gdth ibmvscsic initio ipr ips isp1020 lpfc max_scsi mac53c94 \ - megaraid megaraid_mbox megaraid_mm mesh mptfc mptscsih \ - mptsas mptspi nsp32 osst qla1280 qla2100 qla2200 qla2300 \ - qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_mv \ + gdth hptiop ibmvscsic initio ipr ips isp1020 lpfc max_scsi \ + mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptfc \ + mptscsih mptsas mptspi nsp32 osst qla1280 qla2100 qla2200 \ + qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_mv \ sata_nv sata_promise sata_qstor sata_sil sata_sis sata_svw \ sata_sx4 sata_uli sata_via sata_vsc scsi_mod \ scsi_transport_fc scsi_transport_iscsi scsi_transport_spi \ @@ -231,7 +231,6 @@ check_minkver() { curversion=${1} initdir=${2} - set_initlist if [ -z ${initdir} ]; then DPKG_ARCH=`dpkg --print-installation-architecture` case ${DPKG_ARCH} in @@ -247,8 +246,10 @@ check_minkver() echo "W: not generating requested initramfs for kernel ${curversion}" >&2 exit 2 fi + return 0 fi - [ -z ${initdir} ] || for cm_x in ${initlist}; do + set_initlist + for cm_x in ${initlist}; do tmp=$(eval echo $(grep ^MINKVER ${initdir}/${cm_x} | cut -d'=' -f2)) if dpkg --compare-versions "${curversion}" lt "${tmp}"; then echo "W: ${cm_x} hook script requires at least kernel version ${tmp}" >&2 diff --git a/init b/init index eb14326..69d9542 100755 --- a/init +++ b/init @@ -76,7 +76,7 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; resume=*) - RESUME=${x#resume=} + RESUME="${x#resume=}" ;; noresume) NORESUME=y @@ -104,7 +104,7 @@ for x in $(cat /proc/cmdline); do esac done -if [ -z ${NORESUME} ]; then +if [ -z "${NORESUME}" ]; then export resume=${RESUME} fi diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 5712bdd..0950b39 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -418,5 +418,6 @@ updated by Maximilian Attems . .SH SEE ALSO .BR -initramfs.conf (5), mkinitramfs (8), update-initramfs(8) - +.IR initramfs.conf (5), +.IR mkinitramfs (8), +.IR update-initramfs(8). diff --git a/initramfs.conf.5 b/initramfs.conf.5 index afd799b..8d6b621 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -32,6 +32,14 @@ The default setting is \fImost\fP. \fIlist\fP includes only modules from the additional modules list. +.TP +\fB BUSYBOX +Include busybox utilities for the boot scripts. +If set to 'n' +.B mkinitramfs +will build an initramfs whithout busybox. +Beware that many boot scripts need busybox utilities. + .SH NFS VARIABLES .TP \fB BOOT @@ -48,12 +56,14 @@ Specifies the network interface, like eth0. Defaults to \fIauto\fP in order to pick up value from DHCP server. Otherwise you need to specify \fIHOST:MOUNT\fP. -.SH SEE ALSO - -.BR initramfs-tools (8), mkinitramfs (8), update-initramfs (8) .SH AUTHOR The initramfs-tools are written by Jeff Bailey . This manual is maintained by Maximilian Attems . Loosely based on mkinitrd.conf by Herbert Xu. +.SH SEE ALSO +.BR +.IR initramfs-tools (8), +.IR mkinitramfs (8), +.IR update-initramfs (8). diff --git a/mkinitramfs b/mkinitramfs index 0f1cb58..52dea45 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -83,11 +83,16 @@ fi . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' -for i in ${CONFDIR}/conf.d/* /usr/share/initramfs-tools/conf.d/*; do +for i in ${CONFDIR}/conf.d/*; do EXTRA_CONF="${EXTRA_CONF} $(basename $i | grep '^[a-z0-9][a-z0-9\._-]*$' | grep -v '\.dpkg-.*$')"; done for i in ${EXTRA_CONF}; do -. ${CONFDIR}/conf.d/${i} + . ${CONFDIR}/conf.d/${i} +done +for i in /usr/share/initramfs-tools/conf.d/*; do + if [ -e $i ]; then + . ${i} + fi done if [ -z "${outfile}" ]; then @@ -135,7 +140,7 @@ if [ ! -e "${MODULESDIR}" ]; then echo "Cannot find ${MODULESDIR}" exit 1 fi -if [ ! -e "${MODULESDIR}/modules.depmod" ]; then +if [ ! -e "${MODULESDIR}/modules.dep" ]; then depmod ${version} fi @@ -228,6 +233,7 @@ if [ -e "${CONFDIR}/DSDT.aml" ]; then copy_exec "${CONFDIR}/DSDT.aml" / fi +[ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" (cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip -9 >"${outfile}") || exit 1 if [ -s "${__TMPCPIOGZ}" ]; then diff --git a/mkinitramfs-kpkg.8 b/mkinitramfs-kpkg.8 index 871a0f4..2a3072b 100644 --- a/mkinitramfs-kpkg.8 +++ b/mkinitramfs-kpkg.8 @@ -46,5 +46,7 @@ This option queries if mkinitramfs can create ramdisks for kernel version mkinitramfs-kpkg is maintained by Maximilian Attems . .SH SEE ALSO - -.BR initramfs.conf (5), initramfs-tools (8), update-initramfs (8) +.BR +.IR initramfs.conf (5), +.IR initramfs-tools (8), +.IR update-initramfs (8). diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 3dc2e2e..65f6203 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -13,9 +13,12 @@ mkinitramfs \- generate an initramfs image .RB [ \-r .IR root ] .RI [ version ] + .B mkinitramfs .RB [ \-\-supported-host-version= .IR hversion ] + +.B mkinitramfs .RB [ \-\-supported-target-version= .IR tversion ] @@ -90,5 +93,7 @@ The initramfs-tools are written by Jeff Bailey . This manual is maintained by Maximilian Attems . .SH SEE ALSO - -.BR initramfs.conf (5), initramfs-tools (8), update-initramfs (8) +.BR +.IR initramfs.conf (5), +.IR initramfs-tools (8), +.IR update-initramfs (8). diff --git a/scripts/functions b/scripts/functions index 53e07ca..9e578d7 100644 --- a/scripts/functions +++ b/scripts/functions @@ -62,7 +62,7 @@ panic() modprobe -q i8042 modprobe -q atkbd echo $@ - PS1='(initramfs) ' /bin/sh /dev/console 2>&1 + PS1='(initramfs) ' /bin/sh -i /dev/console 2>&1 } maybe_break() @@ -84,7 +84,7 @@ set_initlist() if [ ! -x ${si_x} ]; then continue fi - initlist="${initlist} $(basename ${si_x})" + initlist="${initlist} ${si_x#${initdir}/}" done } @@ -168,6 +168,10 @@ reduce_prereqs() call_scripts() { for cs_x in ${runlist}; do + # mkinitramfs verbose output + if [ "${verbose}" = "y" ]; then + echo "Calling hook ${cs_x}" + fi ${initdir}/${cs_x} # allow boot scripts to modify exported boot paramaters if [ -e /conf/param.conf ]; then diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 059e7a4..564d6f8 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -19,6 +19,15 @@ if [ "x${resume}" = "x" ]; then exit fi +case $resume in + LABEL=*) + resume="/dev/disk/by-label/${resume#LABEL=}" + ;; + UUID=*) + resume="/dev/disk/by-uuid/${resume#UUID=}" + ;; +esac + if [ ! -e "${resume}" ]; then exit fi diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 5323a7d..9a45220 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="md" +PREREQ="mdadm" prereqs() { diff --git a/update-initramfs b/update-initramfs index 85a5dd2..ea74136 100755 --- a/update-initramfs +++ b/update-initramfs @@ -66,9 +66,9 @@ generate_initramfs() echo "update-initramfs: Generating ${initramfs}" OPTS="-o" if [ "${verbose}" = 1 ]; then - OPTS="-v $OPTS" + OPTS="-v ${OPTS}" fi - if mkinitramfs "${OPTS}" "${initramfs}" "${version}"; then + if mkinitramfs ${OPTS} "${initramfs}" "${version}"; then set_sha1 else mkinitramfs_return="$?" diff --git a/update-initramfs.8 b/update-initramfs.8 index a36e83c..7cfc206 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -67,5 +67,7 @@ The initramfs-tools are written by Jeff Bailey . This manual is maintained by Maximilian Attems . .SH SEE ALSO - -.BR initramfs.conf (5), initramfs-tools (8), mkinitramfs (8) +.BR +.IR initramfs.conf (5), +.IR initramfs-tools (8), +.IR mkinitramfs (8). -- cgit v1.2.3 From 5d46a04527bd3023e4f34cc99029ffc281f42110 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 29 Jul 2006 14:49:39 +0200 Subject: - take care of partial mdadm/lvm Sarge upgrades this compat stuff can go once Etch is released - framebuffer stuff for usplash - don't leave modules file behind - thanks piuparts! --- debian/changelog | 38 ++++++++++++++++++++++++++++++++++++++ debian/initramfs-tools.postrm | 1 + hooks/lvm | 27 --------------------------- mkinitramfs | 17 +++++++++++++++++ scripts/init-top/framebuffer | 41 +++++++++++++++++++++++++++++++++++++++++ scripts/local-top/lvm | 6 +++++- scripts/local-top/mdraid | 41 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 143 insertions(+), 28 deletions(-) delete mode 100755 hooks/lvm create mode 100755 scripts/init-top/framebuffer create mode 100755 scripts/local-top/mdraid (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index e6f271b..a43c6b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,41 @@ +initramfs-tools (0.73) unstable; urgency=high + + * debian/initramfs-tools.postrm: Don't forget to remove config file + modules on purge. Thanks piuparts verification. + + * mkinitramfs: Add sections that deals with sarge mdadm and lvm2. + Does nothing if etch package hooks are installed, will be dropped + postetch as then we upgrade from mdadm and lvm2 packages with hooks. + Taken from Dapper initramfs-tools-0.40ubuntu32. Adapt to add more + modules and no need for mdrun. + + * hooks/lvm: Remove handled by mkinitramfs itself. + + * scripts/local-top/lvm: Add prereqs lvm2 + mdraid. Exit if lvm2 hook is + present. Eases transition of lvm hooks to lvm2. + + * scripts/local-top/mdraid: Enable all raid devices. Add mdadm as prereqs. + Only run if no mdadm hook is in initramfs. (closes: 380089) + + * urgency high upload to get RC fixes into testing. + + -- maximilian attems Sat, 29 Jul 2006 13:35:43 +0200 + +initramfs-tools (0.72) unstable; urgency=low + + * Add scripts/init-top/framebuffer, reduces ubuntu diff even more. + fb is only activated with splash or vga boot param. + * Upload sponsored by Petter Reinholdtsen. + + -- maximilian attems Tue, 25 Jul 2006 09:11:18 +0200 + +initramfs-tools (0.71b) unstable; urgency=low + + * This time caught on bzr dotfiles, removed. + Thanks a lot to Frederik Schüler for review. + + -- maximilian attems Mon, 24 Jul 2006 15:06:04 +0200 + initramfs-tools (0.71) unstable; urgency=low * initramfs.conf.5, initramfs-tools.8, mkinitramfs.8, mkinitramfs-kpkg.8, diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm index b2f40bd..6896636 100644 --- a/debian/initramfs-tools.postrm +++ b/debian/initramfs-tools.postrm @@ -2,6 +2,7 @@ if [ "x${1}" = "xpurge" ]; then rm -f /etc/initramfs-tools/conf.d/resume + rm -f /etc/initramfs-tools/modules fi #DEBHELPER# diff --git a/hooks/lvm b/hooks/lvm deleted file mode 100755 index 49a8887..0000000 --- a/hooks/lvm +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -prereqs) - prereqs - exit 0 - ;; -esac - -if [ ! -x /sbin/vgchange -a ! -d /lib/lvm-200 ]; then - exit 0 -fi - -. /usr/share/initramfs-tools/hook-functions - -copy_exec /lib/lvm-200/vgchange /sbin - -for x in dm_mod dm_snapshot dm_mirror; do - manual_add_modules ${x} -done diff --git a/mkinitramfs b/mkinitramfs index 52dea45..799b77e 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -228,6 +228,23 @@ cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d" run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks +# FIXME: Remove this Raid block after Etch releases +if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then + mdadm --examine --scan > $DESTDIR/conf/mdadm.conf + copy_exec /sbin/mdadm /sbin + for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do + manual_add_modules ${x} + done +fi + +# FIXME: Remove this LVM block after Etch releases +if [ -x /sbin/vgchange -a -d /lib/lvm-200 -a ! -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 + # Apply DSDT to initramfs if [ -e "${CONFDIR}/DSDT.aml" ]; then copy_exec "${CONFDIR}/DSDT.aml" / diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer new file mode 100755 index 0000000..4f0ab62 --- /dev/null +++ b/scripts/init-top/framebuffer @@ -0,0 +1,41 @@ +#!/bin/sh + +PREREQ="" +prereqs() +{ + echo "$PREREQ" +} +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +SPLASH=false; +VESA=false; + +for x in $(cat /proc/cmdline); do + case $x in + splash*) + SPLASH=true; + ;; + vga=*) + VESA=true; + ;; + esac +done + +if [ $SPLASH = "true" -o $VESA = "true" ]; then + modprobe -q fbcon + if [ $VESA = "true" ]; then + modprobe -q vesafb + else + modprobe -q vga16fb + fi + mknod /dev/fb0 c 29 0 + for i in 0 1 2 3 4 5 6 7 8; do + mknod /dev/tty$i c 4 $i + done +fi diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 9a45220..f9d1490 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="mdadm" +PREREQ="mdadm mdraid lvm2" prereqs() { @@ -56,6 +56,10 @@ activate_vg() vgchange -ay ${vg} } +if [ -e /scripts/local-top/lvm2 ]; then + exit 0 +fi + if [ ! -e /sbin/vgchange ]; then exit 0 fi diff --git a/scripts/local-top/mdraid b/scripts/local-top/mdraid new file mode 100755 index 0000000..2cf3b5d --- /dev/null +++ b/scripts/local-top/mdraid @@ -0,0 +1,41 @@ +#!/bin/sh + +PREREQ="udev_helper" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +if [ -e /scripts/local-top/mdadm ]; then + exit 0 +fi + +unset raidlvl +gotraid=n + +# Detect raid level +for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do + if [ ! -e ${x} ]; then + continue + fi + raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') + if [ "$raidlvl" ]; then + modprobe -q ${raidlvl} 2>/dev/null + gotraid=y + fi +done + +[ "${gotraid}" = y ] || exit + +# Assemble all raid devices +mkdir /dev/md +mdadm --assemble --config=/etc/mdadm.conf --scan --run --auto=yes -- cgit v1.2.3 From a44616dd8e197c348d6061db84c2a6893fae5a27 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Aug 2006 09:31:06 +0200 Subject: - revert s/mount/nfsmount debian busybux has no nfs support lately --- debian/changelog | 10 ++++++++++ scripts/nfs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index a43c6b0..028f0e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +initramfs-tools (0.73b) unstable; urgency=high + + * Revert nfs change in 0.70: Debian busybox is build with CONFIG_NFSMOUNT=n. + Reuse nfsmount from klibc. nfsroot parsing needs more care for the next + release. Now at least support those users where nfs previously worked. + Thanks Vagrant Cascadian for report. + (closes: 380686). High urgency to get this into testing. + + -- maximilian attems Fri, 4 Aug 2006 09:53:46 +0200 + initramfs-tools (0.73) unstable; urgency=high * debian/initramfs-tools.postrm: Don't forget to remove config file diff --git a/scripts/nfs b/scripts/nfs index 47e9ac1..5bfb03d 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -33,7 +33,7 @@ mountroot () roflag="-o rw" fi - mount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} + nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom -- cgit v1.2.3 From 317940266751218ffa46581a44260619ade32e0a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 8 Aug 2006 09:32:03 +0200 Subject: revert klibc-utils resume usage for now. --- debian/changelog | 8 ++++++++ debian/control | 2 +- scripts/local-premount/resume | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 028f0e6..b613529 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +initramfs-tools (0.73c) unstable; urgency=low + + * scripts/local-premount/resume: Revert klibc-utils resume usage until + breakage cause is known. Thus downgrade klibc dep to 1.4.8-0. Thanks + Steinar H. Gunderson for report. (closes: #381475) + + -- maximilian attems Sat, 5 Aug 2006 09:31:16 +0200 + initramfs-tools (0.73b) unstable; urgency=high * Revert nfs change in 0.70: Debian busybox is build with CONFIG_NFSMOUNT=n. diff --git a/debian/control b/debian/control index 53caa8f..a9d0e90 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.4.11-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.8-0), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for prepackaged diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 564d6f8..593df78 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -33,5 +33,8 @@ if [ ! -e "${resume}" ]; then fi if [ -e /sys/power/resume ]; then - resume ${resume} +# FIXME: klibc-utils resume needs more tests +# resume ${resume} + major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') + echo $major_minor >/sys/power/resume fi -- cgit v1.2.3 From 9bd9dc139d5001f7fce1245b2854080859fba9de Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 12 Aug 2006 09:18:39 +0200 Subject: - fix mdadm config path location --- debian/changelog | 7 +++++++ scripts/local-top/mdraid | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b613529..d930d08 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.73d) unstable; urgency=low + + * scripts/local-top/mdraid: Fix path of expected mdadm config file. + Thanks Daniel Dickinson for report. (closes: 382602) + + -- maximilian attems Sat, 12 Aug 2006 09:02:10 +0200 + initramfs-tools (0.73c) unstable; urgency=low * scripts/local-premount/resume: Revert klibc-utils resume usage until diff --git a/scripts/local-top/mdraid b/scripts/local-top/mdraid index 2cf3b5d..8649aa4 100755 --- a/scripts/local-top/mdraid +++ b/scripts/local-top/mdraid @@ -38,4 +38,4 @@ done # Assemble all raid devices mkdir /dev/md -mdadm --assemble --config=/etc/mdadm.conf --scan --run --auto=yes +mdadm --assemble --config=/conf/mdadm.conf --scan --run --auto=yes -- cgit v1.2.3 From 839572386f35bf4b4404dac5f976566bc155de94 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Aug 2006 17:14:01 +0200 Subject: Release 0.74: - scripts/functions: fix debug boot param - update-initramfs: checkout /etc/kernel-img.conf if lilo and grub is installed - rename mdraid to mdrun, readd mdrun as it seems to work much better with sarge systems - add an help message for rescue shell - better package desc --- debian/changelog | 25 +++++++++++++++++++++++++ debian/control | 12 ++++++------ mkinitramfs | 1 + scripts/functions | 6 +++--- scripts/local | 2 ++ scripts/local-premount/resume | 6 ++---- scripts/local-top/mdraid | 41 ----------------------------------------- scripts/local-top/mdrun | 41 +++++++++++++++++++++++++++++++++++++++++ update-initramfs | 22 ++++++++++++++++++---- 9 files changed, 98 insertions(+), 58 deletions(-) delete mode 100755 scripts/local-top/mdraid create mode 100755 scripts/local-top/mdrun (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 1686466..f089fe6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,28 @@ +initramfs-tools (0.74) unstable; urgency=low + + * scripts/local-premount/resume: Reuse klibc resume, hardcode path as + uswsusp shipps too an resume binary in initramfs-tools. Thus tighten + again klibc dep to 1.4.11-1. (closes: 381535) + + * mkinitramfs: Readd mdrun when around. + + * scripts/local-top/mdrun: Rename from mdraid. Use mdrun as previously, + there is no guarantee that the sarge mdadm works and that the sarge + mdadm.conf has any sense. + + * debian/control: Better package description. + + * scripts/local: mountroot add message what to check if root is not found + in 2 straight lines to keep as much of scrolling buffer. + + * scripts/functions: Use set ``--'' to change positional paramaters without + changing any options. This is useful for the debug bootparam on d?ash. + + * update-initramfs: Respect "do_bootloader = yes" from /etc/kernel-img.conf + to call lilo if both lilo and grub are installed. (closes: 382013) + + -- maximilian attems Thu, 17 Aug 2006 16:50:51 +0200 + initramfs-tools (0.73e) unstable; urgency=high * mkinitramfs: Fix if statement for conf.d. (closes: 382740) diff --git a/debian/control b/debian/control index a9d0e90..24d1bdc 100644 --- a/debian/control +++ b/debian/control @@ -8,13 +8,13 @@ Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.4.8-0), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.11-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs - This package contains tools to create and boot an initramfs for prepackaged - 2.6 Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the + 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. From there on the mounting of the real root file system occurs in user - space. klibc handles the boot-time networking setup. Having the root on NFS - is also supported. + 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. Any boot loader with initrd support is able to load an initramfs archive. diff --git a/mkinitramfs b/mkinitramfs index 3df30ec..67d9df0 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -235,6 +235,7 @@ run_scripts "${CONFDIR}"/hooks if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then mdadm --examine --scan > $DESTDIR/conf/mdadm.conf copy_exec /sbin/mdadm /sbin + copy_exec /sbin/mdrun /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do manual_add_modules ${x} done diff --git a/scripts/functions b/scripts/functions index 9e578d7..e9d7a07 100644 --- a/scripts/functions +++ b/scripts/functions @@ -117,7 +117,7 @@ get_prereqs() count_unsatisfied() { - set - ${@} + set -- ${@} return ${#} } @@ -126,7 +126,7 @@ pop_list_item() { item=${1} shift - set - ${@} + set -- ${@} unset tmppop # Iterate for pop in ${@}; do @@ -143,7 +143,7 @@ reduce_prereqs() { unset runlist set_initlist - set - ${initlist} + set -- ${initlist} i=$# # Loop until there's no more in the queue to loop through while [ ${i} -ne 0 ]; do diff --git a/scripts/local b/scripts/local index 8510088..0b9baab 100644 --- a/scripts/local +++ b/scripts/local @@ -33,6 +33,8 @@ mountroot () # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do + echo " Check root= bootarg cat /proc/cmdline" + echo " or missing modules, devices: cat /proc/modules ls /dev" panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 593df78..881af90 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -33,8 +33,6 @@ if [ ! -e "${resume}" ]; then fi if [ -e /sys/power/resume ]; then -# FIXME: klibc-utils resume needs more tests -# resume ${resume} - major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') - echo $major_minor >/sys/power/resume + # hardcode path, uswsusp ships an resume binary too + /bin/resume ${resume} fi diff --git a/scripts/local-top/mdraid b/scripts/local-top/mdraid deleted file mode 100755 index 8649aa4..0000000 --- a/scripts/local-top/mdraid +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -PREREQ="udev_helper" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -if [ -e /scripts/local-top/mdadm ]; then - exit 0 -fi - -unset raidlvl -gotraid=n - -# Detect raid level -for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do - if [ ! -e ${x} ]; then - continue - fi - raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') - if [ "$raidlvl" ]; then - modprobe -q ${raidlvl} 2>/dev/null - gotraid=y - fi -done - -[ "${gotraid}" = y ] || exit - -# Assemble all raid devices -mkdir /dev/md -mdadm --assemble --config=/conf/mdadm.conf --scan --run --auto=yes diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun new file mode 100755 index 0000000..1b6ca3e --- /dev/null +++ b/scripts/local-top/mdrun @@ -0,0 +1,41 @@ +#!/bin/sh + +PREREQ="udev_helper" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +if [ -e /scripts/local-top/mdadm ]; then + exit 0 +fi + +unset raidlvl +gotraid=n + +# Detect raid level +for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do + if [ ! -e ${x} ]; then + continue + fi + raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') + if [ "$raidlvl" ]; then + modprobe -q ${raidlvl} 2>/dev/null + gotraid=y + fi +done + +[ "${gotraid}" = y ] || exit + +# Assemble all raid devices +# FIXME: assemble root raid first due to initrd-tools compatibility +/sbin/mdrun /dev diff --git a/update-initramfs b/update-initramfs index ea74136..e7dc586 100755 --- a/update-initramfs +++ b/update-initramfs @@ -81,11 +81,28 @@ generate_initramfs() fi } +# lilo call +run_lilo() +{ + lilo -t > /dev/null + if [ $? -eq 0 ]; then + lilo + fi +} + # only run lilo if no grub is around +# or if "do_bootloader = yes" is set run_bootloader() { if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then + do_bootloader=$(awk '/bootloader/{print $2}' \ + /etc/kernel-img.conf) + if [ "${do_bootloader}" = "yes" ]; then + run_lilo + return 0 + fi + echo echo "WARNING: grub and lilo installed." echo "If you use grub as bootloader everything is fine." @@ -95,10 +112,7 @@ run_bootloader() return 0 fi if [ -e /etc/lilo.conf ]; then - lilo -t > /dev/null - if [ $? -eq 0 ]; then - lilo - fi + run_lilo fi } -- cgit v1.2.3 From d1d6763409a1260708423e0092d7bc4182275773 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 18 Aug 2006 15:59:40 +0200 Subject: - really add DAC960 + add megaraid_sas - update TODO - first take at the panic parsing - do_bootloader variable is not case sensitive, catch more cases - if panic is set to 0 reboot and don't open console, needs still work for all other values. --- debian/TODO | 6 +++--- debian/changelog | 20 ++++++++++++++++++++ hook-functions | 11 ++++++----- init | 4 ++++ scripts/functions | 4 ++++ update-initramfs | 5 +++-- 6 files changed, 40 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/debian/TODO b/debian/TODO index 2c2edc0..7b9bf0a 100644 --- a/debian/TODO +++ b/debian/TODO @@ -5,10 +5,10 @@ TODO o Eliminate ?udev?, ?klibc?, busybox (-> glibc). - o Support list and dep options + o Better heuristics for MODULES=dep option o Default to dep for PPC - Possibly to detect newworld? - o lilo timeouts handling + o udevsettle timeouts handling - o mdadm + lvm2 hooks to their respective packages + o lvm2 hooks to their respective packages diff --git a/debian/changelog b/debian/changelog index f089fe6..995d76d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.75) unstable; urgency=high + + * hook-functions: Add megaraid_sas to the scsi list. Thanks Kenshi Muto + . + + * init: Parse for "panic=" bootarg. + + * hook-functions: Immediately call reboot in the panic function if panic=0 + to disallow any console access for secured boxes. (closes: 378455) + + * debian/TODO: Update to current state + + * update-initramfs: do_bootloader can be set mixed case or upper case. + Catch the obvious Yes and YES too. + + * hook-functions: Really include DAC960 driver. Thanks Tim Small + . (closes: 383486) 2 module fixes thus urgency high. + + -- maximilian attems Fri, 18 Aug 2006 15:35:09 +0200 + initramfs-tools (0.74) unstable; urgency=low * scripts/local-premount/resume: Reuse klibc resume, hardcode path as diff --git a/hook-functions b/hook-functions index 3175cba..08f396d 100644 --- a/hook-functions +++ b/hook-functions @@ -169,12 +169,13 @@ auto_add_modules() scsi) for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci \ aic79xx aic7xxx arcmsr ata_piix atari_scsi atp870u BusLogic \ - cciss ch cpqarray dac960 dc395x dmx3191d dpt_i2o eata fdomain \ + cciss ch cpqarray DAC960 dc395x dmx3191d dpt_i2o eata fdomain \ gdth hptiop ibmvscsic initio ipr ips isp1020 lpfc max_scsi \ - mac53c94 megaraid megaraid_mbox megaraid_mm mesh mptfc \ - mptscsih mptsas mptspi nsp32 osst qla1280 qla2100 qla2200 \ - qla2300 qla2322 qla2xxx qla6312 qlogicfas408 qlogicfc sata_mv \ - sata_nv sata_promise sata_qstor sata_sil sata_sis sata_svw \ + mac53c94 megaraid megaraid_mbox megaraid_mm megaraid_sas \ + mesh mptfc mptscsih mptsas mptspi nsp32 osst qla1280 \ + qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 \ + qlogicfas408 qlogicfc sata_mv sata_nv sata_promise \ + sata_qstor sata_sil sata_sis sata_svw \ sata_sx4 sata_uli sata_via sata_vsc scsi_mod \ scsi_transport_fc scsi_transport_iscsi scsi_transport_spi \ sd_mod sym53c8xx tmscsim zfcp; do diff --git a/init b/init index 69d9542..ab679b5 100755 --- a/init +++ b/init @@ -43,6 +43,7 @@ export readonly=y export rootmnt=/root export debug= export cryptopts=${CRYPTOPTS} +export panic for x in $(cat /proc/cmdline); do case $x in @@ -81,6 +82,9 @@ for x in $(cat /proc/cmdline); do noresume) NORESUME=y ;; + panic=*) + panic="${x#panic=}" + ;; quiet) quiet=y ;; diff --git a/scripts/functions b/scripts/functions index e9d7a07..178ad5d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -59,6 +59,10 @@ panic() if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "QUIT" fi + # Disallow console access + if [ "${panic}" = 0 ]; then + reboot + fi modprobe -q i8042 modprobe -q atkbd echo $@ diff --git a/update-initramfs b/update-initramfs index e7dc586..3ce8f1f 100755 --- a/update-initramfs +++ b/update-initramfs @@ -96,9 +96,10 @@ run_bootloader() { if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then - do_bootloader=$(awk '/bootloader/{print $2}' \ + do_b=$(awk '/bootloader/{print $2}' \ /etc/kernel-img.conf) - if [ "${do_bootloader}" = "yes" ]; then + if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ + || [ "${do_b}" = "YES" ]; then run_lilo return 0 fi -- cgit v1.2.3 From fabe918dee7da26d177d67d4aa8fe3fd6e83e513 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 23 Aug 2006 09:22:54 +0200 Subject: - improved nfsroo parsing - added rootdelay and rootfstype bootargs - document this changes - initrd-tools backward compatible mdadm assembe and then run mdrun - update-initramfs really checkout use_bootloader from /etc/kernel-img.conf - tighter klibc deps --- debian/NEWS | 13 +++++++++++++ debian/changelog | 39 ++++++++++++++++++++++++++++++++++++++ debian/control | 2 +- init | 13 +++++++++++-- initramfs-tools.8 | 50 ++++++++++++++++++++++++++++++++++++++++--------- mkinitramfs | 19 +++++++++++++++++-- scripts/functions | 9 +++------ scripts/local | 19 +++++++++++++++---- scripts/local-top/mdrun | 9 +++++++-- scripts/nfs | 48 +++++++++++++++++++++++++++++++++++++++++++++-- update-initramfs | 5 +++-- 11 files changed, 196 insertions(+), 30 deletions(-) (limited to 'scripts') diff --git a/debian/NEWS b/debian/NEWS index a6ae4bc..9ac39f5 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,16 @@ +initramfs-tools (0.76) unstable; urgency=low + + * 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. + + The initramfs-tools(8) manpage documents the parsed boot parameter. + Note that the undocumented and non compliant nfsoption bootarg got + dropped. + + -- maximilian attems Wed, 23 Aug 2006 08:47:26 +0200 + initramfs-tools (0.61) unstable; urgency=low * This release moves the initramfs-tools confdir from /etc/mkinitramfs to diff --git a/debian/changelog b/debian/changelog index 995d76d..a5ac22f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +initramfs-tools (0.76) unstable; urgency=medium + + * debian/control: Tighten klibc to 1.4.19-2 for fixed nuke. (closes: 383730) + + * mkinitramfs: Only hard code root when root arg got passed. + + * init: Parse /proc/cmdline for rootfstype, initrd-tools did it too. + + * init: Parse /proc/cmdline for rootdelay. + + * scripts/local: Use eventual rootfstype and rootdelay info. + + * initramfs-tools.8: Add more docs about boot args, s/2.6.15/2.6.17/. + + * scripts/functions: Simplify parse_numeric() by arithmetic calculation, + instead of working on it's representation. Thanks to tarski. + (launchpad.net/21759) Much more elegant than the 0.58 version fix. + + * mkinitramfs: Parse rootraid for sarge compatibility and pass the info + to the initramfs if etch mdadm is not yet installed. + + * scripts/local-top/mdrun: Assemble the root raid first before mdrun. + Thanks martin f krafft . (closes: 383908, 384063) + + * update-initramfs: Check if /etc/kernel-img.conf is readable, + before attempting to parse also check for the right field. + + * init: Check for root=/dev/nfs. Parse ip kernel command line for nfsroot. + Drop undocumented and not compliant nfsopts. + + * scripts/nfs: Add ip parsing conforming to Documentation/nfsroot.txt. + Use the nfsroot bootparam in combination with eventual ip provided + device or server-ip. Do minor code cleanups. Both items based on patches + by Vagrant Cascadian . (closes: 380649) + + * Set urgency medium due to large number of serious bug fixes. + + -- maximilian attems Wed, 23 Aug 2006 08:17:51 +0200 + initramfs-tools (0.75) unstable; urgency=high * hook-functions: Add megaraid_sas to the scsi list. Thanks Kenshi Muto diff --git a/debian/control b/debian/control index 24d1bdc..dd4c3b3 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.4.11-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.19-2), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for packaged 2.6 diff --git a/init b/init index ab679b5..386ec37 100755 --- a/init +++ b/init @@ -59,19 +59,28 @@ for x in $(cat /proc/cmdline); do UUID=*) ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" ;; + /dev/nfs) + BOOT=nfs + ;; esac ;; rootflags=*) ROOTFLAGS="-o ${x#rootflags=}" ;; + rootfstype=*) + ROOTFSTYPE="${x#rootfstype=}" + ;; + rootdelay=*) + ROOTDELAY="${x#rootdelay=}" + ;; cryptopts=*) cryptopts="${x#cryptopts=}" ;; nfsroot=*) NFSROOT="${x#nfsroot=}" ;; - nfsopts=*) - NFSOPTS="-o ${x#nfsopts=}" + ip=*) + IPOPTS="${x#ip=}" ;; boot=*) BOOT=${x#boot=} diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 0950b39..7af09e1 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "Date: 2005/12/06" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "Date: 2006/08/19" "" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -29,18 +29,44 @@ 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. + .TP \fB \fI init the binary to hand over execution to on the root fs after the initramfs scripts are done. .TP \fB \fI root -the device node to mount as the rootfs. +the device node to mount as the root file system. + +.TP +\fB \fI rootdelay +set delay in seconds. Determines how long mountroot waits for root to appear. + +.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 +string of the form NFSSERVER:NFSPATH or NFSSERVER:NFSPATH:NFSOPTS. +Use root=/dev/nfs for NFS to kick to in. + +.TP +\fB \fI ip +tells how to configure the ip adress. 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. + +.TP +\fB \fI cryptopts +passes the args for cryptoroot. Set by the cryptsetup boot hooks. .TP \fB \fI boot @@ -50,27 +76,33 @@ either local or NFS (affects which initramfs scripts are run, see the "Subdirect \fB \fI resume On install initramfs-tools tries to autodetect the resume partition. On success the RESUME variable is written to /etc/initramfs-tools/conf.d/resume. -The boot variable overrides it. +The boot variable noresume overrides it. .TP \fB \fI quiet -reduces the amount of text output to the console during boot +reduces the amount of text output to the console during boot. .TP \fB \fI ro -mounts the rootfs read-only +mounts the rootfs read-only. .TP \fB \fI rw -mounts the rootfs read-write +mounts the rootfs read-write. + +.TP +\fB \fI panic +sets an timeout on panic. Currently only zero value supported. .TP \fB \fI debug -generates lots of output to /tmp/initramfs.debug +generates lots of output to /tmp/initramfs.debug. .TP \fB \fI break spawns a shell in the initramfs image at chosen run-time +(top, modules, premount, mount, bottom, init). +The default is premount without any arg. .SH HOOK SCRIPTS @@ -404,7 +436,7 @@ to double-check if it contains the relevant binaries, libs or modules: .nf mkdir tmp/initramfs cd tmp/initramfs -gunzip -c -9 /boot/initrd.img-2.6.15-1-686 | \\ +gunzip -c -9 /boot/initrd.img-2.6.17-2-686 | \\ cpio -i -d -H newc --no-absolute-filenames .fi .RE diff --git a/mkinitramfs b/mkinitramfs index 67d9df0..759d6cb 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -209,7 +209,11 @@ for i in ${EXTRA_CONF}; do copy_exec "/usr/share/initramfs-tools/conf.d/${i}" /conf/conf.d fi done -echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root + +# ROOT hardcoding +if [ -n "${ROOT}" ]; then + echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root +fi # Busybox if [ "x${BUSYBOX}" = "xn" ]; then @@ -233,7 +237,18 @@ run_scripts "${CONFDIR}"/hooks # FIXME: Remove this Raid block after Etch releases if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then - mdadm --examine --scan > $DESTDIR/conf/mdadm.conf + # use mkinitrd magic for Sarge backwards compat + rootraiddev="$(df / | sed -rne 's,^(/dev/[^[:space:]]+).*,\1,p')" + echo "rootraiddev=${rootraiddev}" > /conf/mdadm.conf + mdadm=$(mdadm --detail "${rootraiddev}") + echo "${mdadm}" | awk ' + $1 == "Number" && $2 == "Major" { start = 1; next } + $1 == "UUID" { print "uuid=" $3; next } + !start { next } + $2 == 0 && $3 == 0 { next } + { devices = devices " " $NF } + END { print "devices='\''" devices "'\''" }' \ + >> /conf/mdadm.conf copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do diff --git a/scripts/functions b/scripts/functions index 178ad5d..7e67771 100644 --- a/scripts/functions +++ b/scripts/functions @@ -224,13 +224,10 @@ parse_numeric() { minor=${1#*:} major=${1%:*} ;; - [0-9][0-9][0-9]) - minor=$((0x${1#?})) - major=$((0x${1%??})) - ;; *) - minor=$((0x${1#??})) - major=$((0x${1%??})) + value=$(( 0x${1} )) + minor=$(( ${value} % 256 )) + major=$(( ${value} / 256 )) ;; esac diff --git a/scripts/local b/scripts/local index 0b9baab..9d71a5e 100644 --- a/scripts/local +++ b/scripts/local @@ -11,11 +11,18 @@ mountroot () # to deal with removable devices if [ ! -e "${ROOT}" ]; then log_begin_msg "Waiting for root file system..." + + # Default delay is 180s + if [ -z "${ROOTDELAY}" ]; then + slumber=180 + else + slumber=${ROOTDELAY} + fi if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "TIMEOUT 180" || true + /sbin/usplash_write "TIMEOUT ${slumber}" || true fi - slumber=1800 + slumber=$(( ${slumber} * 10 )) while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) @@ -38,8 +45,12 @@ mountroot () panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done - # Get the root filesystem type - eval $(fstype < ${ROOT}) + # Get the root filesystem type if not set + if [ -z "${ROOTFSTYPE}" ]; then + eval $(fstype < ${ROOT}) + else + FSTYPE=${ROOTFSTYPE} + fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun index 1b6ca3e..3ed995c 100755 --- a/scripts/local-top/mdrun +++ b/scripts/local-top/mdrun @@ -36,6 +36,11 @@ done [ "${gotraid}" = y ] || exit -# Assemble all raid devices -# FIXME: assemble root raid first due to initrd-tools compatibility +# source the presumed root md and it's info +. ./conf/mdadm.conf + +# assemble root raid first due to initrd-tools compatibility +mdadm -A ${rootraiddev} -R -u $uuid $devices + +# assemble all raid devices /sbin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index 5bfb03d..844db70 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -13,13 +13,57 @@ mountroot () # For DHCP modprobe -q af_packet - ipconfig ${DEVICE} + # support ip options see linux sources Documentation/nfsroot.txt + case ${IPOPTS} in + none|off) + # Do nothing + ;; + ""|on|any) + # Bring up device + ipconfig ${DEVICE} + ;; + dhcp|bootb|rarp|both) + ipconfig -c ${IPOPTS} -d ${DEVICE} + ;; + *) + ipconfig -d $IPOPTS + + # grab device entry from full line + NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} + NEW_DEVICE=${NEW_DEVICE%:*} + if [ -n "${NEW_DEVICE}" ]; then + DEVICE="${NEW_DEVICE}" + fi + # grab server-ip + SERVER_IP=${IPOPTS#*:} + SERVER_IP=${SERVER_IP%:*:*:*:*:*:*} + ;; + esac + + # FIXME: who writes that? . /tmp/net-${DEVICE}.conf + + # get nfs root from dhcp if [ "x${NFSROOT}" = "xauto" ]; then NFSROOT=${ROOTSERVER}:${ROOTPATH} + # nfsroot=[:][,] + elif [ -n "${NFSROOT}" ]; then + # nfs options are an optional arg + if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then + NFSOPTS="-o ${NFSROOT#*,}" + fi + NFSROOT=${NFSROOT%%,*} + # server-ip could be passed by ip + if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then + if [ -n "${SERVER_IP}" ]; then + NFSROOT="${SERVER_IP}:${NFSROOT}" + else + NFSROOT=${ROOTSERVER}:${ROOTPATH} + fi + fi fi - if [ "x${NFSOPTS}" = "x" ]; then + if [ -z "${NFSOPTS}" ]; then NFSOPTS="-o retrans=10" fi diff --git a/update-initramfs b/update-initramfs index 3ce8f1f..1ec8c7d 100755 --- a/update-initramfs +++ b/update-initramfs @@ -2,6 +2,7 @@ STATEDIR=/var/lib/initramfs-tools BOOTDIR=/boot +KPKGCONF=/etc/kernel-img.conf set -e @@ -96,8 +97,8 @@ run_bootloader() { if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then - do_b=$(awk '/bootloader/{print $2}' \ - /etc/kernel-img.conf) + [ -r "${KPKGCONF}" ] && \ + do_b=$(awk '/bootloader/{print $3}' "${KPKGCONF}") if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ || [ "${do_b}" = "YES" ]; then run_lilo -- cgit v1.2.3 From 45989c9f37db0ef23e984ea559f2da784a028366 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 25 Aug 2006 17:04:33 +0200 Subject: - fix bashism - rename mdadm.conf in mdrun.conf - retry nfsmount - harden init - fix lvm boot script prereqs --- debian/changelog | 20 ++++++++++++++++++ debian/initramfs-tools.postinst | 2 +- hook-functions | 2 +- init | 6 ++++-- mkinitramfs | 11 +++++----- scripts/local | 2 +- scripts/local-top/lvm | 2 +- scripts/local-top/mdrun | 2 +- scripts/nfs | 45 ++++++++++++++++++++++++++++++----------- update-initramfs | 2 +- 10 files changed, 69 insertions(+), 25 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index a5ac22f..bc635a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.77) unstable; urgency=medium + + * mkinitramfs, scripts/local-top/mdrun: Use mdrun.conf as config file. + Ship mdrun unconditionally if around, should help in recovery situations. + + * debian/initramfs-tools.postinst, hook-functions, mkinitramfs, + scripts/local, update-initramfs: Cleanup the "-a" and "-o" bashism. + + * scripts/nfs: Retry to mount NFS on eventual failure. (closes: 377643) + Based on a patch by Vagrant Cascadian . + + * init: Make sure there is an /dev and /root. Usually passed by the kernel. + Also /dev/null or /dev/console might already be shipped. + Based on a patch by David Härdeman . (closes: 340494) + + * scripts/local-top/lvm: Fix prereqs s/mdraid/mdrun, thus urgency medium. + Thanks Rainer Gauweiler for the notice. + + -- maximilian attems Fri, 25 Aug 2006 16:55:56 +0200 + initramfs-tools (0.76) unstable; urgency=medium * debian/control: Tighten klibc to 1.4.19-2 for fixed nuke. (closes: 383730) diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index 5f46777..2f36f3f 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -7,7 +7,7 @@ if [ ! -e /etc/initramfs-tools/modules ]; then fi # Regenerate initramfs on upgrade -if [ "$1" = "configure" -a -n "$2" ]; then +if [ "$1" = "configure" ] && [ -n "$2" ]; then update-initramfs -u fi diff --git a/hook-functions b/hook-functions index 08f396d..bfbe56a 100644 --- a/hook-functions +++ b/hook-functions @@ -48,7 +48,7 @@ manual_add_modules() mkdir -p "${DESTDIR}/$(dirname "${mam_x}")" ln -s "${mam_x}" "${DESTDIR}/$(dirname "${mam_x}")" - if [ -n "${verbose}" -a "${verbose}" = "y" ]; then + if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then echo "Adding module ${mam_x}" fi done diff --git a/init b/init index 386ec37..a83dc39 100755 --- a/init +++ b/init @@ -2,6 +2,10 @@ echo "Loading, please wait..." +[ -d /dev ] || mkdir -m 0755 /dev +[ -d /root ] || mkdir --mode=0700 /root +[ -e /dev/console ] || mknod /dev/console c 5 1 +[ -e /dev/null ] || mknod /dev/null c 1 3 mkdir /sys mkdir /proc mkdir /tmp @@ -18,8 +22,6 @@ fi mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev > /dev/.initramfs-tools mkdir /dev/.initramfs -mknod /dev/console c 5 1 -mknod /dev/null c 1 3 # Export the dpkg architecture export DPKG_ARCH= diff --git a/mkinitramfs b/mkinitramfs index 759d6cb..d088efa 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -236,10 +236,10 @@ run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks # FIXME: Remove this Raid block after Etch releases -if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then +if [ -x /sbin/mdadm ] && [ ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then # use mkinitrd magic for Sarge backwards compat rootraiddev="$(df / | sed -rne 's,^(/dev/[^[:space:]]+).*,\1,p')" - echo "rootraiddev=${rootraiddev}" > /conf/mdadm.conf + echo "rootraiddev=${rootraiddev}" > /conf/mdrun.conf mdadm=$(mdadm --detail "${rootraiddev}") echo "${mdadm}" | awk ' $1 == "Number" && $2 == "Major" { start = 1; next } @@ -248,16 +248,17 @@ if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then $2 == 0 && $3 == 0 { next } { devices = devices " " $NF } END { print "devices='\''" devices "'\''" }' \ - >> /conf/mdadm.conf + >> /conf/mdrun.conf copy_exec /sbin/mdadm /sbin - copy_exec /sbin/mdrun /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do manual_add_modules ${x} done fi +[ -x /sbin/mdrun ] && copy_exec /sbin/mdrun /sbin # FIXME: Remove this LVM block after Etch releases -if [ -x /sbin/vgchange -a -d /lib/lvm-200 -a ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then +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} diff --git a/scripts/local b/scripts/local index 9d71a5e..e7bf23e 100644 --- a/scripts/local +++ b/scripts/local @@ -23,7 +23,7 @@ mountroot () fi slumber=$(( ${slumber} * 10 )) - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) done diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index f9d1490..27053de 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="mdadm mdraid lvm2" +PREREQ="mdadm mdrun lvm2" prereqs() { diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun index 3ed995c..da890c5 100755 --- a/scripts/local-top/mdrun +++ b/scripts/local-top/mdrun @@ -37,7 +37,7 @@ done [ "${gotraid}" = y ] || exit # source the presumed root md and it's info -. ./conf/mdadm.conf +. ./conf/mdrun.conf # assemble root raid first due to initrd-tools compatibility mdadm -A ${rootraiddev} -R -u $uuid $devices diff --git a/scripts/nfs b/scripts/nfs index 844db70..f42ed22 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -2,17 +2,9 @@ # FIXME This needs error checking -# Paramter: Where the root should be mounted -mountroot () +# parse nfs bootargs + launch ipconfig and nfsmount +do_nfsmount() { - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top" - run_scripts /scripts/nfs-top - [ "$quiet" != "y" ] && log_end_msg - - modprobe -q nfs - # For DHCP - modprobe -q af_packet - # support ip options see linux sources Documentation/nfsroot.txt case ${IPOPTS} in none|off) @@ -40,7 +32,7 @@ mountroot () ;; esac - # FIXME: who writes that? + # FIXME: source ipconfig output - might overwrite aboves . /tmp/net-${DEVICE}.conf # get nfs root from dhcp @@ -78,9 +70,38 @@ mountroot () fi nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} +} + +# NFS root mounting +mountroot() +{ + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top" + run_scripts /scripts/nfs-top + [ "$quiet" != "y" ] && log_end_msg + + modprobe -q nfs + # For DHCP + modprobe -q af_packet + + # Default delay is around 180s + # FIXME: add usplash info + if [ -z "${ROOTDELAY}" ]; then + delay=180 + else + delay=${ROOTDELAY} + fi + + # loop until nfsmount succeds + # FIXME: another place of init bin hardcoding + while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}/sbin/init ]; do + [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" + do_nfsmount + # FIXME: ipconfig loops every min at least - better param?? + delay=$(( ${delay} - 1 )) + [ "$quiet" != "y" ] && log_end_msg + done [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom [ "$quiet" != "y" ] && log_end_msg - } diff --git a/update-initramfs b/update-initramfs index 1ec8c7d..c1e42ab 100755 --- a/update-initramfs +++ b/update-initramfs @@ -95,7 +95,7 @@ run_lilo() # or if "do_bootloader = yes" is set run_bootloader() { - if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then + if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then [ -r "${KPKGCONF}" ] && \ do_b=$(awk '/bootloader/{print $3}' "${KPKGCONF}") -- cgit v1.2.3 From cf4bba337d69510c4551ba84e8c69562873ea93f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 4 Sep 2006 18:54:59 +0200 Subject: - better nfs handling: merge vagrant branch :) + local changes - cleanup stupid whitespace all over the place --- debian/changelog | 23 +++++++++++++++++++---- init | 4 ++-- initramfs.conf.5 | 4 ++-- mkinitramfs | 10 +++++----- scripts/local | 2 +- scripts/local-top/mdrun | 2 +- scripts/nfs | 35 ++++++++++++++++++----------------- update-initramfs.8 | 4 ++-- 8 files changed, 50 insertions(+), 34 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b46db63..1f00b6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,11 +8,26 @@ initramfs-tools (0.78) unstable; urgency=medium * debian/scripts: Add /etc/kernel-img.conf section, as update-initramfs needs to act according to it. - -- maximilian attems Thu, 31 Aug 2006 14:44:01 +0200 + * scripts/nfs: Fix parsing of etherboot ip options. Based on a patch by + to Vagrant Cascadian . (closes: 385252) + + * scripts/nfs: No need to duplicate work of ntfsmount. Thanks for the patch + to Vagrant Cascadian . (closes: 385226) + + * scripts/nfs: Add an sleep 0.1 in the retry loop to slow down retry + attempts. Only log "Retrying .." after first run. Use init variable. + (closes: 385624) + + * init: Reorder the early mknod after tmpfs mount. (closes: 385641) + + * initramfs.conf.5, mkinitramfs, scripts/local, scripts/local-top/mdrun, + scripts/nfs, update-initramfs.8, debian/changelog: Whitespace policy. + + -- maximilian attems Mon, 4 Sep 2006 17:38:13 +0200 initramfs-tools (0.77b) unstable; urgency=high - * mkinitramfs: Fix destination of mdrun.conf. Thanks for the report to + * mkinitramfs: Fix destination of mdrun.conf. Thanks for the report to Scott Glenn . Urgency high as broken in testing too and needed for partial mdadm upgrades. (closes: 385406) @@ -1347,7 +1362,7 @@ initramfs-tools (0.36ubuntu1) dapper; urgency=low initramfs-tools (0.36) unstable; urgency=low "Sunny Autumn Release" - + * Minor cleanups in mkiniramfs. * Remove manpage section about return values. Needs to be rephrased. @@ -1850,7 +1865,7 @@ initramfs-tools (0.13) breezy; urgency=low Use DESTDIR instead of TMPDIR Add ability to link in extra hunks into the cpio file Cosmetic cleanups - + * scripts/functions: Add lsb stype log_FOO_msg functions * scripts/local: Add logging diff --git a/init b/init index 0c336b3..85f6291 100755 --- a/init +++ b/init @@ -4,8 +4,6 @@ echo "Loading, please wait..." [ -d /dev ] || mkdir -m 0755 /dev [ -d /root ] || mkdir --mode=0700 /root -[ -e /dev/console ] || mknod /dev/console c 5 1 -[ -e /dev/null ] || mknod /dev/null c 1 3 [ -d /sys ] || mkdir /sys [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp @@ -20,6 +18,8 @@ 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 /dev/console c 5 1 +[ -e /dev/null ] || mknod /dev/null c 1 3 > /dev/.initramfs-tools mkdir /dev/.initramfs diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 8d6b621..89e9f4b 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "$Date: 2005/12/06 $" "" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "$Date: 2006/09/02 $" "" "initramfs.conf manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs @@ -35,7 +35,7 @@ The default setting is \fImost\fP. .TP \fB BUSYBOX Include busybox utilities for the boot scripts. -If set to 'n' +If set to 'n' .B mkinitramfs will build an initramfs whithout busybox. Beware that many boot scripts need busybox utilities. diff --git a/mkinitramfs b/mkinitramfs index c36e845..8d5911d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -242,11 +242,11 @@ if [ -x /sbin/mdadm ] && [ ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then echo "rootraiddev=${rootraiddev}" > ${DESTDIR}/conf/mdrun.conf mdadm=$(mdadm --detail "${rootraiddev}") echo "${mdadm}" | awk ' - $1 == "Number" && $2 == "Major" { start = 1; next } - $1 == "UUID" { print "uuid=" $3; next } - !start { next } - $2 == 0 && $3 == 0 { next } - { devices = devices " " $NF } + $1 == "Number" && $2 == "Major" { start = 1; next } + $1 == "UUID" { print "uuid=" $3; next } + !start { next } + $2 == 0 && $3 == 0 { next } + { devices = devices " " $NF } END { print "devices='\''" devices "'\''" }' \ >> ${DESTDIR}/conf/mdrun.conf copy_exec /sbin/mdadm /sbin diff --git a/scripts/local b/scripts/local index e7bf23e..299fc65 100644 --- a/scripts/local +++ b/scripts/local @@ -48,7 +48,7 @@ mountroot () # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then eval $(fstype < ${ROOT}) - else + else FSTYPE=${ROOTFSTYPE} fi diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun index da890c5..f733656 100755 --- a/scripts/local-top/mdrun +++ b/scripts/local-top/mdrun @@ -16,7 +16,7 @@ prereqs) esac if [ -e /scripts/local-top/mdadm ]; then - exit 0 + exit 0 fi unset raidlvl diff --git a/scripts/nfs b/scripts/nfs index f42ed22..c66e2a1 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -2,6 +2,8 @@ # FIXME This needs error checking +retry_nr=0 + # parse nfs bootargs + launch ipconfig and nfsmount do_nfsmount() { @@ -20,19 +22,21 @@ do_nfsmount() *) ipconfig -d $IPOPTS - # grab device entry from full line + # grab device entry from ip option NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} - NEW_DEVICE=${NEW_DEVICE%:*} + 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 - # grab server-ip - SERVER_IP=${IPOPTS#*:} - SERVER_IP=${SERVER_IP%:*:*:*:*:*:*} ;; esac - - # FIXME: source ipconfig output - might overwrite aboves + + # source relevant ipconfig output . /tmp/net-${DEVICE}.conf # get nfs root from dhcp @@ -45,13 +49,8 @@ do_nfsmount() NFSOPTS="-o ${NFSROOT#*,}" fi NFSROOT=${NFSROOT%%,*} - # server-ip could be passed by ip if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then - if [ -n "${SERVER_IP}" ]; then - NFSROOT="${SERVER_IP}:${NFSROOT}" - else - NFSROOT=${ROOTSERVER}:${ROOTPATH} - fi + NFSROOT=${ROOTSERVER}:${NFSROOT} fi fi @@ -92,13 +91,15 @@ mountroot() fi # loop until nfsmount succeds - # FIXME: another place of init bin hardcoding - while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}/sbin/init ]; do + while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}${init} ]; do + [ ${retry_nr} -gt 0 ] && \ [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" - do_nfsmount + do_nfsmount # FIXME: ipconfig loops every min at least - better param?? delay=$(( ${delay} - 1 )) - [ "$quiet" != "y" ] && log_end_msg + [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg + [ ! -e ${rootmnt}/sbin/init ] && /bin/sleep 0.1 + retry_nr=$(( ${retry_nr} + 1 )) done [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" diff --git a/update-initramfs.8 b/update-initramfs.8 index 7cfc206..fa1728a 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS 8 "$Date: 2006/02/17" $" "" "update-initramfs manual" +.TH UPDATE-INITRAMFS 8 "$Date: 2006/09/02" $" "" "update-initramfs manual" .SH NAME update-initramfs \- generate an initramfs image @@ -67,7 +67,7 @@ The initramfs-tools are written by Jeff Bailey . This manual is maintained by Maximilian Attems . .SH SEE ALSO -.BR +.BR .IR initramfs.conf (5), .IR initramfs-tools (8), .IR mkinitramfs (8). -- cgit v1.2.3 From 681dc7a7566afa2de5fa7d1edf8aa1c25ec451a6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 19 Sep 2006 23:56:24 +0200 Subject: - more nfs work (timeout, parsing, typo) - lilo codeflow - add lasi700 scsi module --- debian/changelog | 17 +++++++++++++++-- hook-functions | 10 +++++----- scripts/nfs | 14 ++++++-------- update-initramfs | 3 ++- 4 files changed, 28 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 51987c7..d4033ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,22 @@ -initramfs-tools (0.80) unstable; urgency=low +initramfs-tools (0.80) unstable; urgency=high + + Release "O partigiano, portami via, che mi sento di morir." * update-initramfs: Test for lilo executable earlier otherwise an warning would be issued with grub installed and left over lilo config. - -- maximilian attems Tue, 12 Sep 2006 15:59:14 +0200 + * hook-functions: Add lasi700 to the scsi modules. (closes: 387909) Thanks + Nagilum . Thus urgency high. + + * scripts/nfs: Fix typo in ipconfig protocol handling, fix dhcp server + passing ser-ip as part of root-path, retry every second to not hammer + an FAI'ed nfs initramfs network. Thanks for input and patches + Vagrant Cascadian . While we are there refactor + the loop. (closes: 387841, 387808, 387809) + + * update-initramfs: Check if /proc is mounted for ro_boot_check. + + -- maximilian attems Tue, 19 Sep 2006 07:56:47 +0200 initramfs-tools (0.79) unstable; urgency=high diff --git a/hook-functions b/hook-functions index bfbe56a..9f4d890 100644 --- a/hook-functions +++ b/hook-functions @@ -170,11 +170,11 @@ auto_add_modules() for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci \ aic79xx aic7xxx arcmsr ata_piix atari_scsi atp870u BusLogic \ cciss ch cpqarray DAC960 dc395x dmx3191d dpt_i2o eata fdomain \ - gdth hptiop ibmvscsic initio ipr ips isp1020 lpfc max_scsi \ - mac53c94 megaraid megaraid_mbox megaraid_mm megaraid_sas \ - mesh mptfc mptscsih mptsas mptspi nsp32 osst qla1280 \ - qla2100 qla2200 qla2300 qla2322 qla2xxx qla6312 \ - qlogicfas408 qlogicfc sata_mv sata_nv sata_promise \ + gdth hptiop ibmvscsic initio ipr ips isp1020 lasi700 lpfc \ + max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm \ + megaraid_sas mesh mptfc mptscsih mptsas mptspi nsp32 \ + osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx \ + qla6312 qlogicfas408 qlogicfc sata_mv sata_nv sata_promise \ sata_qstor sata_sil sata_sis sata_svw \ sata_sx4 sata_uli sata_via sata_vsc scsi_mod \ scsi_transport_fc scsi_transport_iscsi scsi_transport_spi \ diff --git a/scripts/nfs b/scripts/nfs index c66e2a1..b3ac06f 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -16,7 +16,7 @@ do_nfsmount() # Bring up device ipconfig ${DEVICE} ;; - dhcp|bootb|rarp|both) + dhcp|bootp|rarp|both) ipconfig -c ${IPOPTS} -d ${DEVICE} ;; *) @@ -49,7 +49,7 @@ do_nfsmount() NFSOPTS="-o ${NFSROOT#*,}" fi NFSROOT=${NFSROOT%%,*} - if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then + if [ "${NFSROOT#:*}" = "$NFSROOT" ]; then NFSROOT=${ROOTSERVER}:${NFSROOT} fi fi @@ -83,7 +83,7 @@ mountroot() modprobe -q af_packet # Default delay is around 180s - # FIXME: add usplash info + # FIXME: add usplash_write info if [ -z "${ROOTDELAY}" ]; then delay=180 else @@ -91,15 +91,13 @@ mountroot() fi # loop until nfsmount succeds - while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}${init} ]; do + while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do [ ${retry_nr} -gt 0 ] && \ [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" do_nfsmount - # FIXME: ipconfig loops every min at least - better param?? - delay=$(( ${delay} - 1 )) - [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg - [ ! -e ${rootmnt}/sbin/init ] && /bin/sleep 0.1 retry_nr=$(( ${retry_nr} + 1 )) + [ ! -e ${rootmnt}${init} ] && /bin/sleep 1 + [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg done [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" diff --git a/update-initramfs b/update-initramfs index d1b7026..4a03614 100755 --- a/update-initramfs +++ b/update-initramfs @@ -113,7 +113,7 @@ run_bootloader() fi return 0 fi - if [ -e /etc/lilo.conf ]; then + if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then run_lilo fi } @@ -138,6 +138,7 @@ delete_sha1() # ro /boot is not modified ro_boot_check() { + [ -d /proc ] || return 0 boot_opts=$(awk '/boot/{if (match($4, /ro/)) print "ro"}' /proc/mounts) if [ -n "${boot_opts}" ]; then echo "WARNING: /boot is ro mounted." -- cgit v1.2.3 From b8c8f676a5f0da208b27e4d9bac71ae3814a1b97 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 27 Sep 2006 16:03:30 +0200 Subject: - mkinitramfs: allow umask setting paranoid - revert an nfs changes small fixes over the place --- debian/changelog | 27 +++++++++++++++++++++++++++ debian/initramfs-tools.preinst | 6 ++++-- hook-functions | 20 +++++++++++--------- mkinitramfs | 10 ++++++++-- scripts/nfs | 2 +- update-initramfs | 4 ++-- 6 files changed, 53 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index d4033ac..6efe40c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,30 @@ +initramfs-tools (0.81) unstable; urgency=low + + Release quick and happy spin j = l + s + + * update-initramfs: Really check for mounted /proc on use. (closes: 388241) + Thanks Alex Owen . While beeing in this business, + check for mounted proc in initramfs-tools.preinst too. + + * hook-functions: Add new scsi drivers aic94xx and stex. Add new net drivers + ehea, ep93xx_eth and qla3xxx. Thus urgency high. + + * update-initramfs: Use set ``--'' to change positional paramaters. Thanks + Jörg Sommer . (closes: 389726) + + * scripts/nfs: Revert to previous handling of dhcp server passing server-ip. + (closes: 387808) + + * debian/initramfs-tools.preinst: Fix comment typo, thanks + shaulka@012.net.il for the patch. (closes: 389486) + + * mkinitramfs: Allow an hook script to set an paranoid umask, considered + useful for shipping gpg keys inside of initramfs. Thanks Max Vozeler + and Lionel Elie Mamane for the + patch. (closes: 381677) + + -- maximilian attems Wed, 27 Sep 2006 15:56:46 +0200 + initramfs-tools (0.80) unstable; urgency=high Release "O partigiano, portami via, che mi sento di morir." diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index b92d393..7b02612 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -8,9 +8,11 @@ case "$1" in mkdir -p /etc/initramfs-tools/conf.d # First time install. Can we autodetect the RESUME partition? - RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ') + 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 } ') + fi - # Inhertic initrd-tools settings if possible. + # Inherit initrd-tools settings if possible. if [ -e /etc/mkinitrd/mkinitrd.conf ]; then . /etc/mkinitrd/mkinitrd.conf fi diff --git a/hook-functions b/hook-functions index 9f4d890..9cb9712 100644 --- a/hook-functions +++ b/hook-functions @@ -148,9 +148,10 @@ auto_add_modules() ;; net) for x in 3c59x 8139cp 8139too 8390 b44 bmac bnx2 defxx \ - dl2k e1000 e100 epic100 eql fealnx famachi forcedeth \ - hp100 mace mv643xx_eth myri10ge natsemi ne2k-pci netconsole \ - ns83820 pcnet32 r8169 s2io sis900 skge slhc smc911x starfire \ + dl2k e1000 e100 ehea epic100 ep93xx_eth eql fealnx \ + famachi forcedeth hp100 mace mv643xx_eth myri10ge \ + natsemi ne2k-pci netconsole ns83820 pcnet32 qla3xxx \ + r8169 s2io sis900 skge slhc smc911x starfire \ sundance sungem sungem_phy sunhme tg3 tlan de2104x \ de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb \ typhon via-rhine via-velocity yellowfin; do @@ -168,17 +169,18 @@ auto_add_modules() ;; scsi) for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci \ - aic79xx aic7xxx arcmsr ata_piix atari_scsi atp870u BusLogic \ - cciss ch cpqarray DAC960 dc395x dmx3191d dpt_i2o eata fdomain \ - gdth hptiop ibmvscsic initio ipr ips isp1020 lasi700 lpfc \ - max_scsi mac53c94 megaraid megaraid_mbox megaraid_mm \ - megaraid_sas mesh mptfc mptscsih mptsas mptspi nsp32 \ + aic79xx aic7xxx aic94xx arcmsr ata_piix atari_scsi \ + atp870u BusLogic cciss ch cpqarray DAC960 dc395x \ + dmx3191d dpt_i2o eata fdomain gdth hptiop ibmvscsic \ + initio ipr ips isp1020 lasi700 lpfc max_scsi mac53c94 \ + megaraid megaraid_mbox megaraid_mm megaraid_sas \ + mesh mptfc mptscsih mptsas mptspi nsp32 \ osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx \ qla6312 qlogicfas408 qlogicfc sata_mv sata_nv sata_promise \ sata_qstor sata_sil sata_sis sata_svw \ sata_sx4 sata_uli sata_via sata_vsc scsi_mod \ scsi_transport_fc scsi_transport_iscsi scsi_transport_spi \ - sd_mod sym53c8xx tmscsim zfcp; do + sd_mod stex sym53c8xx tmscsim zfcp; do manual_add_modules "${x}" done ;; diff --git a/mkinitramfs b/mkinitramfs index 8d5911d..f667c53 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -28,8 +28,7 @@ while true; do fi ;; -o) - touch $2 - outfile="$(readlink -f "$2")" + outfile="$2" shift 2 ;; -k) @@ -94,6 +93,13 @@ for i in ${EXTRA_CONF}; do fi done +if [ -n "${UMASK}" ]; then + umask "${UMASK}" +fi + +touch $outfile +outfile="$(readlink -f "$outfile")" + if [ -z "${outfile}" ]; then usage fi diff --git a/scripts/nfs b/scripts/nfs index b3ac06f..fc869cc 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -49,7 +49,7 @@ do_nfsmount() NFSOPTS="-o ${NFSROOT#*,}" fi NFSROOT=${NFSROOT%%,*} - if [ "${NFSROOT#:*}" = "$NFSROOT" ]; then + if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then NFSROOT=${ROOTSERVER}:${NFSROOT} fi fi diff --git a/update-initramfs b/update-initramfs index 4a03614..45d4631 100755 --- a/update-initramfs +++ b/update-initramfs @@ -138,7 +138,7 @@ delete_sha1() # ro /boot is not modified ro_boot_check() { - [ -d /proc ] || return 0 + [ -r /proc/mounts ] || return 0 boot_opts=$(awk '/boot/{if (match($4, /ro/)) print "ro"}' /proc/mounts) if [ -n "${boot_opts}" ]; then echo "WARNING: /boot is ro mounted." @@ -201,7 +201,7 @@ set_linked_version() set_highest_version() { get_sorted_versions - set - ${version_list} + set -- ${version_list} version=${1} } -- cgit v1.2.3 From 849c7c5f29f3689a4879204c23a6e89e2e6c0d7e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 13 Oct 2006 08:52:12 +0200 Subject: - add backup handling to initramfs-tools - allow conservative settings for skipping updated initramfs. - debug output to screen - parse mbr for lilo + small fixes --- conf/update-initramfs.conf | 11 ++++++ debian/changelog | 38 ++++++++++++++++++++ debian/initramfs-tools.install | 1 + debian/initramfs-tools.manpages | 1 + debian/initramfs-tools.preinst | 2 +- hooks/kernelextras | 1 - init | 4 +++ initramfs-tools.8 | 9 +++-- initramfs.conf.5 | 6 ++-- mkinitramfs.8 | 6 ++-- scripts/init-top/framebuffer | 69 +++++++++++++++++++++++++++++++----- update-initramfs | 78 +++++++++++++++++++++++++++++++++++++---- update-initramfs.8 | 6 ++-- update-initramfs.conf.5 | 26 ++++++++++++++ 14 files changed, 228 insertions(+), 30 deletions(-) create mode 100644 conf/update-initramfs.conf create mode 100644 update-initramfs.conf.5 (limited to 'scripts') diff --git a/conf/update-initramfs.conf b/conf/update-initramfs.conf new file mode 100644 index 0000000..36c3dde --- /dev/null +++ b/conf/update-initramfs.conf @@ -0,0 +1,11 @@ +# +# Configuration file for update-initramfs(8) +# + +# +# update_initramfs [ yes | no ] +# +# Default is yes +# If set to no disables any update to initramfs beside kernel upgrade + +update_initramfs=yes diff --git a/debian/changelog b/debian/changelog index 2990625..1eaf2f9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,41 @@ +initramfs-tools (0.83) unstable; urgency=high + + Release "Ois was du verzapfst is a koida Kaffee" + + * update-initramfs: Keep an initramfs backup while we are running. Do also + keep the booted initramfs as .bak in /boot. First helps on power cut. + Second is a good conservative approach and demanded feature. + Thanks Thiemo Nagel for report. (closes: 387780) + + * init: When debug is invoked with an additional arg, write output to + console. Thanks Christian Aichinger for the idea. + Should ease remote debugging. + + * initramfs-tools.8: Document new debug= feature. + + * initramfs-tools.preinstall: Check for right arg. (closes: 391619) + + * update-initramfs: Try to guess harder if lilo might need to be run + if grub is also around. On old installs we get _zero_ information from + /etc/kernel.img. Parse mbr for lilo signature. (closes: 385949) + Thanks to Michael Prokop for finetuning. + + * scripts/init-top/framebuffer: Parse video bootarg and refactor script. + This add support for custom framebuffer modules. (closes: 386441) + Thanks for the patch by David Härdeman . + + * update.conf: Allow to make "update-initramfs -u" an noop. Useful for + conservative settings of a remote server. (closes: 362064) urgency high. + Thanks Manoj Srivastava for the tough testing. + + * update-initramfs.conf.5: Document the new update_initramfs variable. + + * update-initramfs: Kope with stupid mv of grub to /usr/sbin. + + * manpages: Get a banana and mark myself as author. + + -- maximilian attems Fri, 13 Oct 2006 08:12:40 +0200 + initramfs-tools (0.82) unstable; urgency=high * Merge 0.69ubuntu15, plus 0.69ubuntu14 and 0.69ubuntu11 changelog entries diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index 5514c2e..5b3d8a6 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -3,6 +3,7 @@ mkinitramfs-kpkg usr/sbin init usr/share/initramfs-tools scripts usr/share/initramfs-tools conf/initramfs.conf etc/initramfs-tools +conf/update-initramfs.conf etc/initramfs-tools hooks usr/share/initramfs-tools hook-functions usr/share/initramfs-tools conf/modules usr/share/initramfs-tools diff --git a/debian/initramfs-tools.manpages b/debian/initramfs-tools.manpages index f127e99..0c88045 100644 --- a/debian/initramfs-tools.manpages +++ b/debian/initramfs-tools.manpages @@ -3,3 +3,4 @@ mkinitramfs-kpkg.8 initramfs.conf.5 initramfs-tools.8 update-initramfs.8 +update-initramfs.conf.5 diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index 7b02612..fc1fd06 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -3,7 +3,7 @@ set -e case "$1" in - configure) + install) if [ -n "$2" ]; then mkdir -p /etc/initramfs-tools/conf.d diff --git a/hooks/kernelextras b/hooks/kernelextras index 6bbd6b9..714e9a9 100755 --- a/hooks/kernelextras +++ b/hooks/kernelextras @@ -42,4 +42,3 @@ manual_add_modules vga16fb if [ ${fbcon} = "y" ]; then force_load fbcon fi - diff --git a/init b/init index 85f6291..fbe32be 100755 --- a/init +++ b/init @@ -110,6 +110,10 @@ for x in $(cat /proc/cmdline); do exec >/tmp/initramfs.debug 2>&1 set -x ;; + debug=*) + debug=y + set -x + ;; break=*) break=${x#break=} ;; diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 7af09e1..4ce53d3 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "Date: 2006/08/19" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "Date: 2006/10/11" "" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -96,7 +96,9 @@ sets an timeout on panic. Currently only zero value supported. .TP \fB \fI debug -generates lots of output to /tmp/initramfs.debug. +generates lots of output. It writes a log to /tmp/initramfs.debug. +Instead when invoked with an arbitrary argument output is written to console. +Use for example "debug=vc". .TP \fB \fI break @@ -443,7 +445,8 @@ cpio -i -d -H newc --no-absolute-filenames .SH AUTHOR -The initramfs-tools are written by Jeff Bailey . +The initramfs-tools are written by Maximilian Attems , +Jeff Bailey and numerous others. .PP This manual was written by David H\[:a]rdeman , updated by Maximilian Attems . diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 89e9f4b..ca47a02 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "$Date: 2006/09/02 $" "" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "$Date: 2006/10/12 $" "" "initramfs.conf manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs @@ -58,8 +58,8 @@ Otherwise you need to specify \fIHOST:MOUNT\fP. .SH AUTHOR -The initramfs-tools are written by Jeff Bailey . -This manual is maintained by Maximilian Attems . +The initramfs-tools are written by Maximilian Attems , +Jeff Bailey and numerous others. Loosely based on mkinitrd.conf by Herbert Xu. .SH SEE ALSO diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 9041ba6..23e719f 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -1,4 +1,4 @@ -.TH MKINITRAMFS 8 "$Date: 2006/08/12 $" "" "mkinitramfs manual" +.TH MKINITRAMFS 8 "$Date: 2006/10/12 $" "" "mkinitramfs manual" .SH NAME mkinitramfs \- generate an initramfs image @@ -95,8 +95,8 @@ it to be loaded by ACPI. .SH AUTHOR -The initramfs-tools are written by Jeff Bailey . -This manual is maintained by Maximilian Attems . +The initramfs-tools are written by Maximilian Attems , +Jeff Bailey and numerous others. .SH SEE ALSO .BR diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 4f0ab62..bafbe19 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -13,27 +13,78 @@ prereqs) ;; esac + +# The options part of the kernel "video=" argument (i.e. everyting +# after "video=:") has very inconsistent rules. +# +# Generally the following applies: +# 1) options are comma-separated +# 2) options can be in either of these three forms: +# =, :, . +# 3) the "mode" option has the form x[M][R][-][@][i][m] +# and may or may not start with "mode=" +# +# When the options are used with modules, they need to be space-separated +# and the following conversions are needed: +# : -> = +# -> =1 +# -> mode= +parse_video_opts() +{ + local OPTS="$1" + local IFS="," + + # Must be a line like video=:,[opt2]... + if [ "$OPTS" = "${OPTS%%:*}" ]; then + return + fi + OPTS="${OPTS#*:}" + for opt in $OPTS; do + # Already in the "=" form + if [ "$opt" != "${opt#*=}" ]; then + echo -n "$opt " + # Presumably a modevalue without the "mode=" prefix + elif [ "$opt" != "${opt#[[:digit:]]*x[[:digit:]]}"; then + echo -n "mode=$opt " + # Presumably a boolean + else + echo -n "$opt=1 " + fi + done +} + +FB="" +OPTS="" + SPLASH=false; VESA=false; for x in $(cat /proc/cmdline); do case $x in splash*) - SPLASH=true; + FB="vga16fb"; + OPTS=""; ;; vga=*) - VESA=true; + FB="vesafb"; + OPTS=""; ;; + video=*) + FB=${x#*=} + FB="${FB%%:*}" + OPTS="$(parse_video_opts "$TMP")" esac done -if [ $SPLASH = "true" -o $VESA = "true" ]; then - modprobe -q fbcon - if [ $VESA = "true" ]; then - modprobe -q vesafb - else - modprobe -q vga16fb - fi +if [ -n "$FB" ]; then + modprobe -q $FB $OPTS +fi + +if [ -e /proc/fb ]; then + while read fbno desc; do + mknod /dev/fb$fbno 29 $fbno + done < /proc/fb + mknod /dev/fb0 c 29 0 for i in 0 1 2 3 4 5 6 7 8; do mknod /dev/tty$i c 4 $i diff --git a/update-initramfs b/update-initramfs index 45d4631..4995553 100755 --- a/update-initramfs +++ b/update-initramfs @@ -2,10 +2,13 @@ STATEDIR=/var/lib/initramfs-tools BOOTDIR=/boot +CONF=/etc/initramfs-tools/update-initramfs.conf KPKGCONF=/etc/kernel-img.conf set -e +[ -r ${CONF} ] && . ${CONF} + usage() { if [ -n "${1}" ]; then @@ -62,6 +65,46 @@ set_initramfs() initramfs="${BOOTDIR}/initrd.img-${version}" } + +# backup initramfs while running +backup_initramfs() +{ + [ ! -r "${initramfs}" ] && return 0 + initramfs_bak="${initramfs}.dpkg-bak" + [ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}" + mv -f "${initramfs}" "${initramfs_bak}" + verbose "Keeping ${initramfs_bak}" +} + +# keep booted initramfs +backup_booted_initramfs() +{ + # chroot + [ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0 + + # no backup yet + initramfs_bak="${initramfs}.dpkg-bak" + if [ ! -r "${initramfs}.bak" ]; then + mv -f ${initramfs_bak} "${initramfs}.bak" + verbose "Backup ${initramfs}.bak" + return 0 + fi + + + # keep booted initramfs + uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime) + if [ -n "$uptime_days" ]; then + boot_initramfs=$(find "${initramfs_bak}" -mtime +${uptime_days}) + fi + if [ -n "${boot_initramfs}" ]; then + mv -f "${initramfs_bak}" "${initramfs}.bak" + verbose "Backup ${initramfs}.bak" + return 0 + fi + verbose "Removing current backup ${initramfs_bak}" + rm -f ${initramfs_bak} +} + generate_initramfs() { echo "update-initramfs: Generating ${initramfs}" @@ -91,11 +134,27 @@ run_lilo() fi } +# check if lilo is on mbr +mbr_check() +{ + boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf) + [ -z "${boot}" ] && return 0 + [ ! -r "${boot}" ] && return 0 + dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO + [ $? -eq 0 ] && run_lilo && return 0 + 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 +} + # only run lilo if no grub is around # or if "do_bootloader = yes" is set run_bootloader() { - if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ]; then + 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 '/bootloader/{print $3}' "${KPKGCONF}") @@ -103,13 +162,10 @@ run_bootloader() || [ "${do_b}" = "YES" ]; then run_lilo return 0 + else + mbr_check + return 0 fi - - 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 fi return 0 fi @@ -228,6 +284,11 @@ create() update() { + if [ "${update_initramfs}" = "no" ]; then + echo "update-initramfs: Not updating initramfs." + exit 0 + fi + if [ -z "${version}" ]; then set_linked_version fi @@ -251,10 +312,13 @@ update() altered_check + backup_initramfs + generate_initramfs run_bootloader + backup_booted_initramfs } delete() diff --git a/update-initramfs.8 b/update-initramfs.8 index 871e9a5..a562349 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS 8 "$Date: 2006/09/06" $" "" "update\-initramfs manual" +.TH UPDATE-INITRAMFS 8 "$Date: 2006/10/12" $" "" "update\-initramfs manual" .SH NAME update\-initramfs \- generate an initramfs image @@ -85,8 +85,8 @@ Create the initramfs for a specific kernel: .B update\-initramfs -c -k 2.6.18-1-686 .SH AUTHOR -The initramfs-tools are written by Jeff Bailey . -This manual is maintained by Maximilian Attems . +The initramfs-tools are written by Maximilian Attems , +Jeff Bailey and numerous others. .SH SEE ALSO .BR diff --git a/update-initramfs.conf.5 b/update-initramfs.conf.5 new file mode 100644 index 0000000..551f6c9 --- /dev/null +++ b/update-initramfs.conf.5 @@ -0,0 +1,26 @@ +.TH UPDATE-INITRAMFS.CONF 5 "$Date: 2006/10/12 $" "" "update-initramfs.conf manual" + +.SH NAME +update-initramfs.conf \- configuration file for update-initramfs + +.SH DESCRIPTION +The configuration file allows to disable the update action from +.B update-initramfs. + +.SH GENERAL VARIABLES +.TP +\fB update_initramfs +Default is \fIyes\fP for running the latest initramfs-tools hooks in the +newest Linux image. +It is possible to set it to \fIno\fP for remote servers or boxes where +conservative manners needs to be applied. This disables +the \fBupdate_initramfs -u\fP call. + +.SH AUTHOR +The initramfs-tools are written by Maximilian Attems , +Jeff Bailey and numerous others. +.SH SEE ALSO +.BR +.IR initramfs-tools (8), +.IR mkinitramfs (8), +.IR update-initramfs (8). -- cgit v1.2.3 From dc67493c8b72ebb4a360194a13c74a13d06def52 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 18 Oct 2006 13:16:03 +0200 Subject: - improve run_bootloader (elilo, zipl) - fix preinst sed command - bunch of minor fixes --- debian/changelog | 40 ++++++++++++++++++++++++++++++++++++++++ debian/initramfs-tools.preinst | 4 +--- hook-functions | 3 ++- hooks/thermal | 11 +++++++++++ initramfs-tools.8 | 4 ++-- mkinitramfs | 2 +- scripts/init-top/framebuffer | 2 +- scripts/local | 4 ++++ update-initramfs | 15 ++++++++++++--- 9 files changed, 74 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 49d07a9..022e167 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,31 @@ +initramfs-tools (0.84) unstable; urgency=high + + Release "A-t-on pris à Saint-Périne, Tous ces dictateurs impotents ?" + + * hook-functions: Use modprobe --ignore-install arg to put all listed + modules on initramfs. Thanks Mario Izquierdo + for report. (closes: 384043) + + * update-initramfs: If elilo is around run it on initramfs update, add + zipl run. + + * scripts/local: Use vol_id too if around to set FSTYPE. Thanks for the + patch to "Alex Owen" (closes: 380004) + + * hooks/thermal: Add many of the windfarm modules for powerpc boxes. + + * initramfs-tools.preinst: merge bits of 0.69ubuntu16. (closes: 393773) + urgency high as fixes upgrade from sarge - thanks Federico Grau + . + + * scripts/init-top/framebuffer: Fix mknod call. (closes: 393543) + Thanks for the patch Kiro Zimmer . + + * mkinitramfs: Create modulesdir even on monolithic linux. (closes: 393688) + Thanks for the patch Ian Campbell . + + -- maximilian attems Wed, 18 Oct 2006 11:04:50 +0200 + initramfs-tools (0.83) unstable; urgency=high Release "Ois was du verzapfst is a koida Kaffee" @@ -438,6 +466,18 @@ initramfs-tools (0.69b) unstable; urgency=high -- maximilian attems Fri, 14 Jul 2006 00:31:30 +0200 +initramfs-tools (0.69ubuntu16) edgy; urgency=low + + * Bring in preinst fixes from Debian, including s/configure/install/ in + preinst, since preinst is never called with "configure", and checking + for /proc/swaps before we blindly try to read it to determine RESUME. + * Do away with the bogus '-n "$2"' test in preinst, since "install" can + be called without any arguments at all (and often is, on a clean setup) + * On upgrades, revert the RESUME mangling that dapper's d-i did to our + config file, avoiding spurious conffile prompts (launchpad.net/63693) + + -- Adam Conrad Mon, 16 Oct 2006 17:23:41 +1000 + initramfs-tools (0.69ubuntu15) edgy; urgency=low * Add jmicron module to ide list. diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index fc1fd06..aa8c8ca 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -4,7 +4,6 @@ set -e case "$1" in install) - if [ -n "$2" ]; then mkdir -p /etc/initramfs-tools/conf.d # First time install. Can we autodetect the RESUME partition? @@ -29,7 +28,7 @@ case "$1" in -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 's/^# wd io=0x300$/# sd_mod/' \ -e '/^ide-generic/d' \ -e '/^ide-disk/d' \ -e '/^ext2/d' \ @@ -40,7 +39,6 @@ case "$1" in if [ -e /etc/mkinitrd/DSDT ]; then cp /etc/mkinitrd/DSDT /etc/initramfs-tools/DSDT.aml fi - fi ;; upgrade) if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.61"; then diff --git a/hook-functions b/hook-functions index 98c88a2..8df30f2 100644 --- a/hook-functions +++ b/hook-functions @@ -40,7 +40,8 @@ add_modules_from_file() manual_add_modules() { - for mam_x in $(modprobe --set-version="${version}" --show-depends "${1}" 2>/dev/null | awk '/^insmod/ { print $2 }'); do + for mam_x in $(modprobe --set-version="${version}" --ignore-install \ + --show-depends "${1}" 2>/dev/null | awk '/^insmod/ { print $2 }'); do # Prune duplicates if [ -e "${DESTDIR}/${mam_x}" ]; then continue diff --git a/hooks/thermal b/hooks/thermal index 9bfd323..ece7243 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -23,6 +23,17 @@ case "$DPKG_ARCH" in # copy the right modules powerpc|ppc64) manual_add_modules therm_pm72 + manual_add_modules windfarm_core + manual_add_modules windfarm_cpufreq_clamp + manual_add_modules windfarm_lm75_sensor + manual_add_modules windfarm_max6690_sensor + manual_add_modules windfarm_pid + manual_add_modules windfarm_pm112 + manual_add_modules windfarm_pm81 + manual_add_modules windfarm_pm91 + manual_add_modules windfarm_smu_controls + manual_add_modules windfarm_smu_sat + manual_add_modules windfarm_smu_sensors manual_add_modules i2c-powermac ;; i386|amd64|ia64) diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 4ce53d3..690505f 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "Date: 2006/10/11" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "Date: 2006/10/14" "" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -438,7 +438,7 @@ to double-check if it contains the relevant binaries, libs or modules: .nf mkdir tmp/initramfs cd tmp/initramfs -gunzip -c -9 /boot/initrd.img-2.6.17-2-686 | \\ +gunzip -c -9 /boot/initrd.img-2.6.18-1-686 | \\ cpio -i -d -H newc --no-absolute-filenames .fi .RE diff --git a/mkinitramfs b/mkinitramfs index f667c53..2fd0cc8 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -166,7 +166,7 @@ export verbose # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ -for d in bin conf/conf.d etc lib modules sbin scripts; do +for d in bin conf/conf.d etc lib modules sbin scripts ${MODULESDIR}; do mkdir -p "${DESTDIR}/${d}" done diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index bafbe19..8382b20 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -82,7 +82,7 @@ fi if [ -e /proc/fb ]; then while read fbno desc; do - mknod /dev/fb$fbno 29 $fbno + mknod /dev/fb$fbno c 29 $fbno done < /proc/fb mknod /dev/fb0 c 29 0 diff --git a/scripts/local b/scripts/local index 299fc65..f4079d5 100644 --- a/scripts/local +++ b/scripts/local @@ -51,6 +51,10 @@ mountroot () else FSTYPE=${ROOTFSTYPE} fi + if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t ${ROOT}) + [ -z "$FSTYPE" ] && FSTYPE="unknown" + fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount diff --git a/update-initramfs b/update-initramfs index 151e47a..c112211 100755 --- a/update-initramfs +++ b/update-initramfs @@ -148,10 +148,11 @@ mbr_check() echo } -# only run lilo if no grub is around -# or if "do_bootloader = yes" is set +# Invoke bootloader run_bootloader() { + # only run lilo if no grub is around + # or if "do_bootloader = yes" is set if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ] \ || [ -x /usr/sbin/grub ]; then if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then @@ -168,8 +169,16 @@ run_bootloader() fi return 0 fi - if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then + if [ -r /etc/lilo.conf ] && [ -x /sbin/lilo ]; then run_lilo + return 0 + fi + if [ -x /sbin/elilo ]; then + elilo + return 0 + fi + if [ -r /etc/zipl.conf ]; then + zipl fi } -- cgit v1.2.3 From efa60794a8a0290ec3972aca23b3ab5f92c3175a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 2 Nov 2006 09:30:03 +0100 Subject: - enhance mbr_check() - fix /boot ro check - create fb devices unconditionaly --- debian/changelog | 32 ++++++++++++++++++++++++++++++++ hook-functions | 2 +- scripts/init-top/framebuffer | 17 +++++++++-------- update-initramfs | 40 +++++++++++++++++++++++++++++++++------- 4 files changed, 75 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 022e167..991ff6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,29 @@ +initramfs-tools (0.85) unstable; urgency=high + + Release "Nichts ist getan, wenn noch etwas zu tun übrig ist." + + * update-initramfs: Fix ro /boot check to not trigger on other mounts + having a /boot string. (closes: 393906) Thanks for the patch + Olli Helenius + + * init-top/framebuffer: Fix duplicate fbno0 device creation. Merge the + 0.69ubuntu10 solution. Thanks Benjamin Leipold + for the report. (closes: 393890) + + * update-initramfs: Fix mbr_check() for installed lilo and used grub. Thanks + for the patch by Michel Casabona . Also be + stricter about do_bootloader match, use negative info and add check for + grub on mbr before throwing error. (closes: 394559) urgency high. + + * hook-functions: Add sata_sil24 to scsi modules. (closes: 395907) + Thanks Vadim S. Solomi" for the patch. + + * update-initramfs: Fix lilo detection in mbr_check() for rootraid. + Based on a patch by Michael Prokop . Suppress lilo warning + messages on test run. + + -- maximilian attems Mon, 30 Oct 2006 10:12:58 +0100 + initramfs-tools (0.84) unstable; urgency=high Release "A-t-on pris à Saint-Périne, Tous ces dictateurs impotents ?" @@ -499,6 +525,12 @@ initramfs-tools (0.69ubuntu11) edgy; urgency=low -- Oliver Grawert Sun, 10 Sep 2006 11:50:14 +0200 +initramfs-tools (0.69ubuntu10) edgy; urgency=low + + * Create framebuffer device nodes unconditionally + + -- Matthew Garrett Tue, 5 Sep 2006 17:50:53 +0100 + initramfs-tools (0.69ubuntu4) edgy; urgency=low * scripts/local-premount/suspend: Check for UUID= or LABEL= on the diff --git a/hook-functions b/hook-functions index 8df30f2..c6a42a6 100644 --- a/hook-functions +++ b/hook-functions @@ -179,7 +179,7 @@ auto_add_modules() mesh mptfc mptscsih mptsas mptspi nsp32 \ osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx \ qla4xxx qla6312 qlogicfas408 qlogicfc sata_mv sata_nv \ - sata_promise sata_qstor sata_sil sata_sis sata_svw \ + sata_promise sata_qstor sata_sil sata_sil24 sata_sis sata_svw \ sata_sx4 sata_uli sata_via sata_vsc scsi_mod \ scsi_transport_fc scsi_transport_iscsi scsi_transport_spi \ sd_mod stex sym53c8xx tmscsim zfcp; do diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 8382b20..1d5e375 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -76,17 +76,18 @@ for x in $(cat /proc/cmdline); do esac done -if [ -n "$FB" ]; then - modprobe -q $FB $OPTS -fi - if [ -e /proc/fb ]; then while read fbno desc; do mknod /dev/fb$fbno c 29 $fbno done < /proc/fb - +else mknod /dev/fb0 c 29 0 - for i in 0 1 2 3 4 5 6 7 8; do - mknod /dev/tty$i c 4 $i - done +fi +for i in 0 1 2 3 4 5 6 7 8; do + mknod /dev/tty$i c 4 $i +done + +if [ -n "$FB" ]; then + modprobe -q fbcon + modprobe -q $FB $OPTS fi diff --git a/update-initramfs b/update-initramfs index c112211..0fea63c 100755 --- a/update-initramfs +++ b/update-initramfs @@ -127,7 +127,8 @@ generate_initramfs() # lilo call run_lilo() { - lilo -t > /dev/null + # suppress errors on test run + lilo -t > /dev/null 2>&1 if [ $? -eq 0 ]; then lilo fi @@ -136,11 +137,33 @@ run_lilo() # check if lilo is on mbr mbr_check() { + # 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/} + 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 - [ $? -eq 0 ] && run_lilo && return 0 + dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \ + && run_lilo && return 0 + + # 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 + + # no idea which bootloader is used echo echo "WARNING: grub and lilo installed." echo "If you use grub as bootloader everything is fine." @@ -151,17 +174,19 @@ mbr_check() # Invoke bootloader run_bootloader() { - # only run lilo if no grub is around - # or if "do_bootloader = yes" is set + # 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 '/bootloader/{print $3}' "${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 @@ -203,7 +228,8 @@ delete_sha1() ro_boot_check() { [ -r /proc/mounts ] || return 0 - boot_opts=$(awk '/boot/{if (match($4, /ro/)) print "ro"}' /proc/mounts) + boot_opts=$(awk '/boot/{if (match($4, /ro/) && $2 == "/boot") + print "ro"}' /proc/mounts) if [ -n "${boot_opts}" ]; then echo "WARNING: /boot is ro mounted." echo "update-initramfs: Not updating ${initramfs}" -- cgit v1.2.3 From 78fe68bcad9d0850e6b9877903719cab7c73b475 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 2 Dec 2006 18:51:54 +0100 Subject: - allow to disable backup - new bzr location - functional copy_dir_modules() - modprobe a bunch of ppc windfarm modules in thermal - provide output on error --- conf/update-initramfs.conf | 8 ++++++++ debian/changelog | 42 ++++++++++++++++++++++++++++++++++++++++++ debian/copyright | 2 +- hook-functions | 18 +++++++++++++++--- mkinitramfs | 6 +++--- scripts/init-premount/thermal | 9 +++++++++ scripts/init-top/framebuffer | 10 +++++----- update-initramfs | 12 ++++++++---- 8 files changed, 91 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/conf/update-initramfs.conf b/conf/update-initramfs.conf index 36c3dde..278c51c 100644 --- a/conf/update-initramfs.conf +++ b/conf/update-initramfs.conf @@ -9,3 +9,11 @@ # If set to no disables any update to initramfs beside kernel upgrade update_initramfs=yes + +# +# backup_initramfs [ yes | no ] +# +# Default is yes +# If set to no leaves no .bak backup files. + +backup_initramfs=yes diff --git a/debian/changelog b/debian/changelog index f6ef12c..acfa6f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,38 @@ +initramfs-tools (0.85c) unstable; urgency=medium + + Release "Pour être heureux vraiment Faut plus d'gouvernement" + + * hook-funcions: Show on verbose mode the added binaries and libraries. + + * update-initramfs: Don't silently fail, user won't be able to reboot. + Thanks Mario Aeby for his blog entry. + + * debian/copyright: Moved to bzr.d.o repo location. + + * hook-functions: Merge 0.69ubuntu22 copy_module_dir fixes, we'll use it + too postetch. Fix the bashism. Thanks to Jurij Smakov + + * scripts/init-premount/thermal: Load blindly a bunch of thermal modules + on powerpc as they are not hotpluggable. Might be ugly, but is a safe bet. + Kernel plattform fix is scheduled for 2.6.20. Push with medium urgency. + (closes: 401269) + + -- maximilian attems Sat, 2 Dec 2006 18:06:34 +0100 + +initramfs-tools (0.85b) unstable; urgency=medium + + * mkinitramfs: Test for ${outfile} before touching anything. (closes: 381677) + + * update-initramfs.conf, update-initramfs: Allow to disable backup strategy. + While we are it fix logic of backup_booted_initramfs(). (closes: 397787) + urgency medium. + + * scripts/init-top/framebuffer: Fix regression of /dev/fb0 creation, + modprobe fb before creating device. Thanks to Otavio Salvador + for patch. + + -- maximilian attems Tue, 14 Nov 2006 08:06:40 +0100 + initramfs-tools (0.85a) unstable; urgency=high * On first time run backup_booted_initramfs() has nothing to back up. @@ -498,6 +533,13 @@ initramfs-tools (0.69b) unstable; urgency=high -- maximilian attems Fri, 14 Jul 2006 00:31:30 +0200 +initramfs-tools (0.69ubuntu22) feisty; urgency=low + + * For copy_module_dir, actually call manual_module for each one, so deps are + taken care of. + + -- Ben Collins Thu, 23 Nov 2006 02:10:29 -0500 + initramfs-tools (0.69ubuntu16) edgy; urgency=low * Bring in preinst fixes from Debian, including s/configure/install/ in diff --git a/debian/copyright b/debian/copyright index 2c681c2..396499f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -10,7 +10,7 @@ The current ubuntu release can be found at: http://archive.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/ The Debian tree is maintained with "bzr" at: -http://debian.stro.at/bzr-test/initramfs-tools/ +http://bzr.debian.org/kernel/initramfs-tools/ Authors: Jeff Bailey , Adam Conrad , Scott James Remnant , diff --git a/hook-functions b/hook-functions index c6a42a6..b4cd58d 100644 --- a/hook-functions +++ b/hook-functions @@ -66,6 +66,9 @@ copy_exec() { fi else ln -s ${1} ${DESTDIR}/${2} + if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then + echo "Adding binary ${1}" + fi fi # Copy the dependant libraries @@ -89,6 +92,9 @@ copy_exec() { mkdir -p ${DESTDIR}/${dirname} if [ ! -e ${DESTDIR}/${dirname}/${libname} ]; then ln -s ${x} ${DESTDIR}/${dirname} + if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then + echo "Adding library ${x}" + fi fi done } @@ -96,9 +102,15 @@ copy_exec() { # Copy entire subtrees to the initramfs copy_modules_dir() { - tmpdir_modbase="${DESTDIR}/lib/modules/${version}" - mkdir -p "$(dirname "${tmpdir_modbase}/${1}")" - cp -a "${MODULESDIR}/${1}" "${tmpdir_modbase}/${1}" + if ! [ -d "${MODULESDIR}/${1}" ]; then + return; + fi + if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then + echo "Copying module directory ${1}" + fi + for x_mod in $(find "${MODULESDIR}/${1}" -name '*.ko' -print); do + manual_add_modules `basename ${x_mod} .ko` + done } dep_add_modules() diff --git a/mkinitramfs b/mkinitramfs index 2fd0cc8..694f423 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -97,13 +97,13 @@ if [ -n "${UMASK}" ]; then umask "${UMASK}" fi -touch $outfile -outfile="$(readlink -f "$outfile")" - if [ -z "${outfile}" ]; then usage fi +touch "$outfile" +outfile="$(readlink -f "$outfile")" + # And by "version" we really mean path to kernel modules # This is braindead, and exists to preserve the interface with mkinitrd if [ ${#} -ne 1 ]; then diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index 3518e7c..bfea1fc 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -20,6 +20,15 @@ case "$DPKG_ARCH" in powerpc|ppc64) modprobe -q i2c-powermac modprobe -q therm_pm72 + modprobe -q windfarm_cpufreq_clamp + modprobe -q windfarm_lm75_sensor + modprobe -q windfarm_max6690_sensor + modprobe -q windfarm_pm112 + modprobe -q windfarm_pm81 + modprobe -q windfarm_pm91 + modprobe -q windfarm_smu_controls + modprobe -q windfarm_smu_sat + modprobe -q windfarm_smu_sensors ;; i386|amd64|ia64) modprobe -q fan diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 1d5e375..044b247 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -76,6 +76,11 @@ for x in $(cat /proc/cmdline); do esac done +if [ -n "$FB" ]; then + modprobe -q fbcon + modprobe -q $FB $OPTS +fi + if [ -e /proc/fb ]; then while read fbno desc; do mknod /dev/fb$fbno c 29 $fbno @@ -86,8 +91,3 @@ fi for i in 0 1 2 3 4 5 6 7 8; do mknod /dev/tty$i c 4 $i done - -if [ -n "$FB" ]; then - modprobe -q fbcon - modprobe -q $FB $OPTS -fi diff --git a/update-initramfs b/update-initramfs index e694093..4b230d0 100755 --- a/update-initramfs +++ b/update-initramfs @@ -79,12 +79,16 @@ backup_initramfs() # keep booted initramfs backup_booted_initramfs() { + initramfs_bak="${initramfs}.dpkg-bak" + + # first time run thus no backup + [ ! -r "${initramfs_bak}" ] && return 0 + # chroot [ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0 - # first time run - initramfs_bak="${initramfs}.dpkg-bak" - [ ! -r "${initramfs_bak}" ] && return 0 + # no kept backup wanted + [ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0 # no backup yet if [ ! -r "${initramfs}.bak" ]; then @@ -122,7 +126,7 @@ generate_initramfs() # minversion wasn't met, exit 0 exit 0 fi - verbose "mkinitramfs failed for ${initramfs}" + echo "update-initramfs: failed for ${initramfs}" exit $mkinitramfs_return fi } -- cgit v1.2.3 From d21a00a23405d1db81ab05a12342145276ef2af0 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 21 Dec 2006 10:18:28 +0100 Subject: - revert busybox hardlinking it's utitilites - add drivers/ata - rework the framebuffer boot script - small docs changes --- debian/changelog | 24 ++++++++++++++++++++++++ hook-functions | 4 ++++ initramfs-tools.8 | 4 ++-- mkinitramfs | 8 ++------ scripts/init-top/framebuffer | 34 +++++++++++++++++++++++----------- 5 files changed, 55 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 394179a..c292a82 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +initramfs-tools (0.85e) unstable; urgency=high + + Release "Qu'ils soient rouges, bleus ou blancs Il faudrait mieux les pendre" + + * initramfs-tools.8: Correct copy_exec() example. (closes: 403122) + Add a better dir to copy_modules_dir() example. + + * mkinitramfs: Revert the sed magic busybox hardlinking for size reduction. + Go for functionality. The klibc binaries are better tested and superior + in some cases like sleep. Fixes several boot troubles. Thanks + Benjamí Villoslada for the report. (closes: 403224) + Thanks Jurij Smakov for pinpointing the trouble. + + * hook-functions: Add all drivers/ata drivers to initramfs that exist for + uname >= 2.6.19 (closes: 403309) urgency high. + + * scripts/init-top/framebuffer: Fix syntax by closing the brackets. Handle + options of the form key:value, map kernel bootarg to module name for + matroxfb. Thanks Rob Walker for the patches + (closes: 403667, 403669). Use posix regexes according to review by + Jurij Smakov . Also protect all variables. + + -- maximilian attems Wed, 20 Dec 2006 22:29:51 +0100 + initramfs-tools (0.85d) unstable; urgency=high Release "Le gros ventre qu'engraisse L'suffrage universel" diff --git a/hook-functions b/hook-functions index 67f5931..fe5d31e 100644 --- a/hook-functions +++ b/hook-functions @@ -198,6 +198,9 @@ auto_add_modules() manual_add_modules "${x}" done ;; + ata) + copy_modules_dir kernel/drivers/ata + ;; ieee1394) for x in ohci1394 sbp2; do manual_add_modules "${x}" @@ -218,6 +221,7 @@ auto_add_modules() auto_add_modules net auto_add_modules ide auto_add_modules scsi + auto_add_modules ata auto_add_modules i2o auto_add_modules dasd auto_add_modules ieee1394 diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 690505f..e280ba4 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -189,7 +189,7 @@ initramfs image. .RS .PP .B Example: -copy_modules_dir kernel/drivers/pci/foobar +copy_modules_dir kernel/drivers/ata .RE .SS Including binaries @@ -197,7 +197,7 @@ If you need to copy binaries to the initramfs module, a command like this should be used: .PP .RS -copy_exec /sbin/mdadm "${DESTDIR}/sbin" +copy_exec /sbin/mdadm /sbin .RE mkinitramfs will automatically detect which libraries the executable depends on diff --git a/mkinitramfs b/mkinitramfs index d187de0..0c278d5 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -227,13 +227,9 @@ if [ "x${BUSYBOX}" = "xn" ]; then echo "Warning: Busybox is required for successful boot!" else rm -f ${DESTDIR}/bin/sh - copy_exec ${BUSYBOXDIR}/busybox /bin/busybox rm -f ${DESTDIR}/bin/busybox - cp ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/busybox - for cmd in `busybox | sed -n '/functions:$/,$p' \ - | sed -e 's/[[:space:]]*//g; s/,$//; s/,/\n/g; /busybox/d'`; do - ln -f ${DESTDIR}/bin/busybox ${DESTDIR}/bin/${cmd} - done + copy_exec ${BUSYBOXDIR}/busybox /bin/busybox + ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh fi # Modutils diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 044b247..7c080f9 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -35,20 +35,23 @@ parse_video_opts() local IFS="," # Must be a line like video=:,[opt2]... - if [ "$OPTS" = "${OPTS%%:*}" ]; then + if [ "${OPTS}" = "${OPTS%%:*}" ]; then return fi OPTS="${OPTS#*:}" - for opt in $OPTS; do + for opt in ${OPTS}; do # Already in the "=" form - if [ "$opt" != "${opt#*=}" ]; then + if [ "${opt}" != "${opt#*=}" ]; then echo -n "$opt " + # In the ":" form + elif [ "${opt}" != "${opt#*:}" ]; then + echo -n "${opt%:*}=${opt#*:} " # Presumably a modevalue without the "mode=" prefix - elif [ "$opt" != "${opt#[[:digit:]]*x[[:digit:]]}"; then + elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then echo -n "mode=$opt " # Presumably a boolean else - echo -n "$opt=1 " + echo -n "${opt}=1 " fi done } @@ -60,7 +63,7 @@ SPLASH=false; VESA=false; for x in $(cat /proc/cmdline); do - case $x in + case ${x} in splash*) FB="vga16fb"; OPTS=""; @@ -72,22 +75,31 @@ for x in $(cat /proc/cmdline); do video=*) FB=${x#*=} FB="${FB%%:*}" - OPTS="$(parse_video_opts "$TMP")" + OPTS="$(parse_video_opts "${x}")" esac done -if [ -n "$FB" ]; then +# Map command line name to module name +case ${FB} in +matroxfb) + FB=matroxfb_base + ;; +*) + ;; +esac + +if [ -n "${FB}" ]; then modprobe -q fbcon - modprobe -q $FB $OPTS + modprobe -q ${FB} ${OPTS} fi if [ -e /proc/fb ]; then while read fbno desc; do - mknod /dev/fb$fbno c 29 $fbno + mknod /dev/fb${fbno} c 29 ${fbno} done < /proc/fb else mknod /dev/fb0 c 29 0 fi for i in 0 1 2 3 4 5 6 7 8; do - mknod /dev/tty$i c 4 $i + mknod /dev/tty${i} c 4 ${i} done -- cgit v1.2.3 From c4343742b3bf028e467ac8a58ead95c9bfefc628 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 2 Apr 2007 13:29:25 +0200 Subject: first prerelease 0.86 + merge 0.85f * kick mdrun script * update control for lenny + ubuntu * add _all_ ide, block and drivers * use MODPROBE_OPTIONS and kill any modprobed arg * small doc + whitespace fixes --- debian/changelog | 60 +++++++++++++++++++++++++++++++++++++++++-- debian/control | 4 +-- debian/script | 2 +- hook-functions | 28 +++++--------------- init | 13 +++++++--- initramfs.conf.5 | 6 ++--- mkinitramfs.8 | 7 ++++- scripts/functions | 8 +++--- scripts/init-premount/thermal | 26 +++++++++---------- scripts/init-top/framebuffer | 7 ++--- scripts/local | 8 +++--- scripts/local-top/lvm | 6 ++--- scripts/local-top/mdrun | 46 --------------------------------- scripts/local-top/udev_helper | 2 +- scripts/nfs | 4 +-- update-initramfs | 24 +++++++++-------- update-initramfs.conf.5 | 4 +-- 17 files changed, 130 insertions(+), 125 deletions(-) delete mode 100755 scripts/local-top/mdrun (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index c292a82..07d28d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,59 @@ +initramfs-tools (0.86) experimental; urgency=low + + * update-initramfs: Bound the mode and version variable. (closes: 403905) + Thanks "Nikita V. Youshchenko" for report. + + * init: Set once the MODPROBE_OPTIONS environment variable and export it. + Don't forget to set -b to have the modprobe.d blacklists respected. + Thus remove everywhere the -q modprobe switch. + Thanks Ben Collins for the suggestion. + + * small trailing whitespace cleanup, display full path of kernel-img.conf + in bug script. + + * debian/control: change maintainer entry to new DD mail. :) + Add busybox-initramfs as Ubuntu busybox alternative to depends. + Dropp the sarge busybox-cvs-static entry. + + * scripts/local-top/mdrun: Drop, existed for partial upgrades from sarge. + + * scripts/local: Improve panic message and printed order. (closes: 414640) + Thanks Vincent.McIntyre@csiro.au for patch. + + * scripts/functions: Check if panic is set befor using it. (closes: 406107) + Thanks martin f krafft for report. + + * hook-functions: Copy all kernel/drivers/{block,ide,scsi} subdir modules + instead of hardcoding the list of "supported" drivers. As consequence + the initramfs might be larger, but none of those should be missed. + As bonus syncs with Ubuntu. + + * init: Mount /sys and /proc nodev, noexec, nosuid - Ubuntu sync. + + -- maximilian attems Sat, 17 Mar 2007 21:39:13 +0100 + +initramfs-tools (0.85f) unstable; urgency=high + + Release "Au lieu d'aller voter Casse leur la margoulette" + + * update-initramfs: Grub _doesn't_ clear LILO string in mbr, but the inverse + is done. Fix mbr_check() to first check for GRUB. Fixes accidental lilo + call in the case that Grub is the used bootloader. (closes: 409820) + Thanks Michael Prokop for bringing up the case. + + * initramfs.conf.5, mkinitramfs.5: Fix typos. Document version. + (closes: 405157, 405190, 405194) + + * update-initramfs: Be more screamy about lilo error, people seem to + overlook recent lilo failures. + + * scripts/init-top/framebuffer: Remove unused variables. + + * init: Export ROOTDELAY to let udev boot script handle eventual rootdelay. + downgrades 401916 + + -- maximilian attems Wed, 7 Mar 2007 23:34:17 +0100 + initramfs-tools (0.85e) unstable; urgency=high Release "Qu'ils soient rouges, bleus ou blancs Il faudrait mieux les pendre" @@ -74,7 +130,7 @@ initramfs-tools (0.85b) unstable; urgency=medium urgency medium. * scripts/init-top/framebuffer: Fix regression of /dev/fb0 creation, - modprobe fb before creating device. Thanks to Otavio Salvador + modprobe fb before creating device. Thanks to Otavio Salvador for patch. -- maximilian attems Tue, 14 Nov 2006 08:06:40 +0100 @@ -93,7 +149,7 @@ initramfs-tools (0.85) unstable; urgency=high having a /boot string. (closes: 393906) Thanks for the patch Olli Helenius - * init-top/framebuffer: Fix duplicate fbno0 device creation. Merge the + * init-top/framebuffer: Fix duplicate fbno0 device creation. Merge the 0.69ubuntu10 solution. Thanks Benjamin Leipold for the report. (closes: 393890) diff --git a/debian/control b/debian/control index dd4c3b3..9294ee7 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,14 @@ Source: initramfs-tools Section: utils Priority: optional -Uploaders: Jeff Bailey , maximilian attems +Uploaders: Jeff Bailey , maximilian attems Maintainer: Debian kernel team Build-Depends: debhelper (>= 4.1.0), cdbs Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.4.19-2), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.19-2), busybox (>= 1:1.01-3) | busybox-initramfs, cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for packaged 2.6 diff --git a/debian/script b/debian/script index a8e3dd9..7cfac12 100755 --- a/debian/script +++ b/debian/script @@ -15,7 +15,7 @@ lsmod echo if [ -r /etc/kernel-img.conf ]; then - echo "-- kernel-img.conf" + echo "-- /etc/kernel-img.conf" cat /etc/kernel-img.conf echo fi diff --git a/hook-functions b/hook-functions index fe5d31e..f506b49 100644 --- a/hook-functions +++ b/hook-functions @@ -172,35 +172,20 @@ auto_add_modules() done ;; ide) - for x in ide-cd ide-disk ide-generic aec62xx alim15x3 \ - amd74xx atiixp atuuxo cmd64x cs5520 cs5530 cy82c693 \ - generic hpt34x hpt366 it821x jmicron ns87415 opti621 \ - pdc202xx_new pdc202xx_old piix rz1000 sc1200 serverworks \ - siimage sis5513 slc82c105 slc90e66 triflex trm290 \ - via82cxxx; do - manual_add_modules "${x}" - done + copy_modules_dir kernel/drivers/ide ;; scsi) - for x in 3w-9xxx 3w-xxxx a100u2x aacraid advansys ahci \ - aic79xx aic7xxx aic94xx arcmsr ata_piix atari_scsi \ - atp870u BusLogic cciss ch cpqarray DAC960 dc395x \ - dmx3191d dpt_i2o eata fdomain gdth hptiop ibmvscsic \ - initio ipr ips isp1020 lasi700 lpfc max_scsi mac53c94 \ - megaraid megaraid_mbox megaraid_mm megaraid_sas \ - mesh mptfc mptscsih mptsas mptspi nsp32 \ - osst qla1280 qla2100 qla2200 qla2300 qla2322 qla2xxx \ - qla4xxx qla6312 qlogicfas408 qlogicfc sata_mv sata_nv \ - sata_promise sata_qstor sata_sil sata_sil24 sata_sis sata_svw \ - sata_sx4 sata_uli sata_via sata_vsc scsi_mod \ - scsi_transport_fc scsi_transport_iscsi scsi_transport_spi \ - sd_mod stex sym53c8xx tmscsim zalon zfcp; do + copy_modules_dir kernel/drivers/scsi + for x in mptfc mptsas mptscsih mptspi; do manual_add_modules "${x}" done ;; ata) copy_modules_dir kernel/drivers/ata ;; + block) + copy_modules_dir kernel/drivers/block + ;; ieee1394) for x in ohci1394 sbp2; do manual_add_modules "${x}" @@ -221,6 +206,7 @@ auto_add_modules() auto_add_modules net auto_add_modules ide auto_add_modules scsi + auto_add_modules block auto_add_modules ata auto_add_modules i2o auto_add_modules dasd diff --git a/init b/init index fbe32be..4c09fd7 100755 --- a/init +++ b/init @@ -8,8 +8,8 @@ echo "Loading, please wait..." [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp mkdir -p /var/lock -mount -t sysfs none /sys -mount -t proc none /proc +mount -t sysfs none /sys -o nodev, noexec, nosuid +mount -t proc none /proc -o nodev, noexec, nosuid # 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 @@ -37,7 +37,10 @@ for i in conf/conf.d/*; do done . /scripts/functions -# Parse command line options +# Set modprobe env +export MODPROBE_OPTIONS="-qb" + +# Export relevant variables export break= export init=/sbin/init export quiet=n @@ -45,8 +48,10 @@ export readonly=y export rootmnt=/root export debug= export cryptopts=${CRYPTOPTS} -export panic +export ROOTDELAY= +export panic= +# Parse command line options for x in $(cat /proc/cmdline); do case $x in init=*) diff --git a/initramfs.conf.5 b/initramfs.conf.5 index ca47a02..e685298 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH INITRAMFS.CONF 5 "$Date: 2006/10/12 $" "" "initramfs.conf manual" +.TH INITRAMFS.CONF 5 "$Date: 2007/01/01 $" "" "initramfs.conf manual" .SH NAME initramfs.conf \- configuration file for mkinitramfs @@ -37,14 +37,14 @@ The default setting is \fImost\fP. Include busybox utilities for the boot scripts. If set to 'n' .B mkinitramfs -will build an initramfs whithout busybox. +will build an initramfs without busybox. Beware that many boot scripts need busybox utilities. .SH NFS VARIABLES .TP \fB BOOT Allows to use an nfs drive as the root of the drive. -The default is to boot of an \fIlocal\fP media (harddrive, USB stick). +The default is to boot from \fIlocal\fP media (harddrive, USB stick). Set to \fInfs\fP for an NFS root share. .TP diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 23e719f..6d81233 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -1,4 +1,4 @@ -.TH MKINITRAMFS 8 "$Date: 2006/10/12 $" "" "mkinitramfs manual" +.TH MKINITRAMFS 8 "$Date: 2007/01/02 $" "" "mkinitramfs manual" .SH NAME mkinitramfs \- generate an initramfs image @@ -58,6 +58,11 @@ Override the setting in .IR initramfs.conf . +.TP +\fI version +Set the kernel version of the initramfs image +(defaults to the running kernel). + .TP \fB\-\-supported-host-version=\fIhversion This option queries if mkinitramfs can create ramdisks on a running kernel of version diff --git a/scripts/functions b/scripts/functions index 7e67771..7ae9c78 100644 --- a/scripts/functions +++ b/scripts/functions @@ -60,11 +60,11 @@ panic() /sbin/usplash_write "QUIT" fi # Disallow console access - if [ "${panic}" = 0 ]; then + if [ -n "${panic}" ] && [ "${panic}" = 0 ]; then reboot fi - modprobe -q i8042 - modprobe -q atkbd + modprobe i8042 + modprobe atkbd echo $@ PS1='(initramfs) ' /bin/sh -i /dev/console 2>&1 } @@ -206,7 +206,7 @@ load_modules() if [ "$com" = "#" ]; then continue fi - modprobe -q $m + modprobe $m done fi } diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index bfea1fc..aa146ec 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -18,20 +18,20 @@ esac case "$DPKG_ARCH" in # load the right modules powerpc|ppc64) - modprobe -q i2c-powermac - modprobe -q therm_pm72 - modprobe -q windfarm_cpufreq_clamp - modprobe -q windfarm_lm75_sensor - modprobe -q windfarm_max6690_sensor - modprobe -q windfarm_pm112 - modprobe -q windfarm_pm81 - modprobe -q windfarm_pm91 - modprobe -q windfarm_smu_controls - modprobe -q windfarm_smu_sat - modprobe -q windfarm_smu_sensors + 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 -q fan - modprobe -q thermal + modprobe fan + modprobe thermal ;; esac diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 7c080f9..c680409 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -59,9 +59,6 @@ parse_video_opts() FB="" OPTS="" -SPLASH=false; -VESA=false; - for x in $(cat /proc/cmdline); do case ${x} in splash*) @@ -89,8 +86,8 @@ matroxfb) esac if [ -n "${FB}" ]; then - modprobe -q fbcon - modprobe -q ${FB} ${OPTS} + modprobe fbcon + modprobe ${FB} ${OPTS} fi if [ -e /proc/fb ]; then diff --git a/scripts/local b/scripts/local index f4079d5..4e01472 100644 --- a/scripts/local +++ b/scripts/local @@ -40,9 +40,9 @@ mountroot () # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do - echo " Check root= bootarg cat /proc/cmdline" - echo " or missing modules, devices: cat /proc/modules ls /dev" - panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" + echo "ALERT! ${ROOT} does not exist. Dropping to a shell!" + echo " Check your root= boot argument (cat /proc/cmdline)" + panic " Check for missing modules (cat /proc/modules), or device files (ls /dev)" done # Get the root filesystem type if not set @@ -67,7 +67,7 @@ mountroot () fi # FIXME This has no error checking - modprobe -q ${FSTYPE} + modprobe ${FSTYPE} # FIXME This has no error checking # Mount root diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 27053de..4cf48ad 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -64,9 +64,9 @@ if [ ! -e /sbin/vgchange ]; then exit 0 fi -modprobe -q dm-mod -modprobe -q dm-snapshot -modprobe -q dm-mirror +modprobe dm-mod +modprobe dm-snapshot +modprobe dm-mirror activate_vg "$ROOT" activate_vg "$resume" diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun deleted file mode 100755 index f733656..0000000 --- a/scripts/local-top/mdrun +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -PREREQ="udev_helper" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -if [ -e /scripts/local-top/mdadm ]; then - exit 0 -fi - -unset raidlvl -gotraid=n - -# Detect raid level -for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do - if [ ! -e ${x} ]; then - continue - fi - raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') - if [ "$raidlvl" ]; then - modprobe -q ${raidlvl} 2>/dev/null - gotraid=y - fi -done - -[ "${gotraid}" = y ] || exit - -# source the presumed root md and it's info -. ./conf/mdrun.conf - -# assemble root raid first due to initrd-tools compatibility -mdadm -A ${rootraiddev} -R -u $uuid $devices - -# assemble all raid devices -/sbin/mdrun /dev diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper index 2d4c209..c1694b7 100755 --- a/scripts/local-top/udev_helper +++ b/scripts/local-top/udev_helper @@ -19,5 +19,5 @@ esac # but might be an old fashioned ISA controller; in which case # we need to load ide-generic. if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe -q ide-generic + modprobe ide-generic fi diff --git a/scripts/nfs b/scripts/nfs index fc869cc..5eb17bf 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -78,9 +78,9 @@ mountroot() run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg - modprobe -q nfs + modprobe nfs # For DHCP - modprobe -q af_packet + modprobe af_packet # Default delay is around 180s # FIXME: add usplash_write info diff --git a/update-initramfs b/update-initramfs index 52e603b..a676fe9 100755 --- a/update-initramfs +++ b/update-initramfs @@ -4,6 +4,8 @@ STATEDIR=/var/lib/initramfs-tools BOOTDIR=/boot CONF=/etc/initramfs-tools/update-initramfs.conf KPKGCONF=/etc/kernel-img.conf +mode="" +version="" set -e @@ -136,7 +138,7 @@ run_lilo() { # show lilo errors on failure if ! lilo -t > /dev/null 2>&1 ; then - echo "update-initramfs: lilo run failed for ${initramfs}:" + echo "Error lilo fails for new ${initramfs}:" echo lilo -t fi @@ -146,6 +148,16 @@ run_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 @@ -162,16 +174,6 @@ mbr_check() dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \ && run_lilo && return 0 - # 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 - # no idea which bootloader is used echo echo "WARNING: grub and lilo installed." diff --git a/update-initramfs.conf.5 b/update-initramfs.conf.5 index 30ef6d0..50e1f95 100644 --- a/update-initramfs.conf.5 +++ b/update-initramfs.conf.5 @@ -1,4 +1,4 @@ -.TH UPDATE-INITRAMFS.CONF 5 "$Date: 2006/10/12 $" "" "update-initramfs.conf manual" +.TH UPDATE-INITRAMFS.CONF 5 "$Date: 2006/12/22 $" "" "update-initramfs.conf manual" .SH NAME update-initramfs.conf \- configuration file for update-initramfs @@ -13,7 +13,7 @@ The configuration file allows to disable the update action from Default is \fIyes\fP for running the latest initramfs-tools hooks in the newest Linux image. It is possible to set it to \fIno\fP for remote servers or boxes where -conservative manners needs to be applied. This disables +conservative manners needs to be applied. This disables the \fBupdate_initramfs -u\fP call. .SH AUTHOR -- cgit v1.2.3 From 60ee14df535436fc3dfc537017ba944f62e559ae Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 5 Apr 2007 21:48:20 +0200 Subject: scripts/functions, mkinitramfs: better backup file handling * don't panick on backup files on boot, just ignore them * don't include backup file in initramfs * cleanup changelog this is quite a fundamental change need to double check that it works on nfs root too.. :) --- debian/changelog | 20 +++++++++++++++----- mkinitramfs | 20 ++++++++++++++------ scripts/functions | 12 ++++++++++++ update-initramfs | 2 +- 4 files changed, 42 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 509e41b..1f972ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,6 @@ -initramfs-tools (0.86) experimental; urgency=low +initramfs-tools (0.86) UNRELEASED; urgency=low * update-initramfs: Bound the mode and version variable. (closes: 403905) - Thanks "Nikita V. Youshchenko" for report. * init: Set once the MODPROBE_OPTIONS environment variable and export it. Don't forget to set -b to have the modprobe.d blacklists respected. @@ -20,12 +19,12 @@ initramfs-tools (0.86) experimental; urgency=low * scripts/local: Improve panic message and printed order. (closes: 414640) Thanks Vincent.McIntyre@csiro.au for patch. - * scripts/functions: Check if panic is set befor using it. (closes: 406107) + * scripts/functions: Check if panic is set before using it. (closes: 406107) Thanks martin f krafft for report. * hook-functions: Copy all kernel/drivers/{block,ide,scsi} subdir modules instead of hardcoding the list of "supported" drivers. As consequence - the initramfs might be larger, but none of those should be missed. + the initramfs might be larger, but none of those should be missed! As bonus syncs with Ubuntu. * init: Mount /sys and /proc nodev, noexec, nosuid - Ubuntu sync. @@ -38,7 +37,18 @@ initramfs-tools (0.86) experimental; urgency=low fixes issue of UUID resume dev. (LP: #67932) While there remove the conffile mv handling of 0.61. - -- maximilian attems Mon, 2 Apr 2007 22:43:33 +0200 + * scripts/functions: set_initlist() needs to add only script names with + alphabetics, numerics and underscores - skip any other. Bad enough + backup scripts get added, but they shouldn't lead to a panic. Also skip + directories that might lay around. (closes: 398347) (LP: #76131) + + * mkinitramfs: Don't add backup scripts to initramfs. (closes: 378682) + (LP: #78348) + + * scripts/functions: run_scripts() return immediately if passed dir + does not exist. Empty dirs without boot script aren't created anymore. + + -- maximilian attems Thu, 5 Apr 2007 21:16:45 +0200 initramfs-tools (0.85f) unstable; urgency=high diff --git a/mkinitramfs b/mkinitramfs index 0c278d5..c348516 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -199,13 +199,21 @@ ln -s /lib/klibc-*.so ${DESTDIR}/lib rm -f ${DESTDIR}/bin/kinit ${DESTDIR}/bin/gzip copy_exec /usr/share/initramfs-tools/init /init -cp -a /usr/share/initramfs-tools/scripts/* "${DESTDIR}/scripts" -for f in $(cd ${CONFDIR}/scripts && \ - find . \( -name '*.dpkg*' -prune -o -name '*~' -prune \) \ - -o -type f -print); do - mkdir --parents "${DESTDIR}/scripts/$(dirname "${f}")" -cp -p "${CONFDIR}/scripts/${f}" "${DESTDIR}/scripts/$(dirname "${f}")" + +# add existant boot scripts +for b in $(cd /usr/share/initramfs-tools/scripts/ && find . \ + -regex '.*/[a-z0-9_]+$' -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 . -regex '.*/[a-z0-9_]+$' -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 for i in ${EXTRA_CONF}; do diff --git a/scripts/functions b/scripts/functions index 7ae9c78..d8e0411 100644 --- a/scripts/functions +++ b/scripts/functions @@ -85,9 +85,20 @@ set_initlist() { unset initlist for si_x in ${initdir}/*; do + # only allow variable name chars + case ${si_x#${initdir}/} in + *[!A-Za-z0-9_]*) + continue + ;; + esac + # skip non executable scripts if [ ! -x ${si_x} ]; then continue fi + # skip directories + if [ -d ${si_x} ]; then + continue + fi initlist="${initlist} ${si_x#${initdir}/}" done } @@ -187,6 +198,7 @@ call_scripts() run_scripts() { initdir=${1} + [ ! -d ${initdir} ] && return get_prereqs reduce_prereqs call_scripts diff --git a/update-initramfs b/update-initramfs index f4c637b..3c67f89 100755 --- a/update-initramfs +++ b/update-initramfs @@ -148,7 +148,7 @@ 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}:" echo lilo -t fi -- cgit v1.2.3 From b40436b200c024167cc289b63a2edb456a6cb258 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 6 Apr 2007 19:49:16 +0200 Subject: merge 0.85g security upload: fixes permissions of created device /dev/root for lilo boots: brw------- 1 root root 8, 1 2007-04-06 09:28 /dev/root note: this is on trunk aka master, need to create etch branch too. --- debian/changelog | 16 +++++++++++++--- scripts/functions | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 1f972ed..9e4031b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,9 +10,8 @@ initramfs-tools (0.86) UNRELEASED; urgency=low * small trailing whitespace cleanup, display full path of kernel-img.conf in bug script. - * debian/control: change maintainer entry to new DD mail. :) - Add busybox-initramfs as Ubuntu busybox alternative to depends. - Dropp the sarge busybox-cvs-static entry. + * debian/control: Add busybox-initramfs as Ubuntu busybox alternative + to depends. Drop the sarge busybox-cvs-static entry. * scripts/local-top/mdrun: Drop, existed for partial upgrades from sarge. @@ -50,6 +49,17 @@ initramfs-tools (0.86) UNRELEASED; urgency=low -- maximilian attems Thu, 5 Apr 2007 21:16:45 +0200 +initramfs-tools (0.85g) unstable; urgency=high + + * SECURITY scripts/functions: Set permission of created root dev in + parse_numeric() to 600. This bug only affects lilo boots. Thanks + Fabian Pietsch and Goswin von Brederlow + for patch input. (closes: 417995) + + * debian/control: Change Uploaders email. + + -- maximilian attems Fri, 6 Apr 2007 09:19:13 +0200 + initramfs-tools (0.85f) unstable; urgency=high Release "Au lieu d'aller voter Casse leur la margoulette" diff --git a/scripts/functions b/scripts/functions index d8e0411..183b9f2 100644 --- a/scripts/functions +++ b/scripts/functions @@ -244,5 +244,6 @@ parse_numeric() { esac mknod /dev/root b ${major} ${minor} + chmod 600 /dev/root ROOT=/dev/root } -- cgit v1.2.3 From fdbdb7193427633c6ac8574f5416058b3b70e305 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 11 Apr 2007 00:16:23 +0200 Subject: scripts/functions: fix cicular dep panic due to non-working prereqs check prereqs with the same set of checks for valid boot scripts --- debian/changelog | 8 ++++++++ scripts/functions | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 6aa6359..0da1fed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +initramfs-tools (0.87) UNRELEASED; urgency=low + + * scripts/functions: reduce_satisfied() needs to ignore the same set as + set_initlist() otherwise an script having a prereqs on a non-executable + boot script may cause circular panic. (closes: 418509) + + -- maximilian attems Wed, 11 Apr 2007 00:07:18 +0200 + initramfs-tools (0.86) unstable; urgency=low * update-initramfs: Bound the mode and version variable. (closes: 403905) diff --git a/scripts/functions b/scripts/functions index 183b9f2..00fcf3d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -108,7 +108,18 @@ reduce_satisfied() deplist="$(render array_${1})" unset tmpdeplist for rs_y in ${deplist}; do - if [ ! -f ${initdir}/${rs_y} ]; then + # only allow variable name chars + case ${rs_y} in + *[!A-Za-z0-9_]*) + continue + ;; + esac + # skip non executable scripts + if [ ! -x ${initdir}/${rs_y} ]; then + continue + fi + # skip directories + if [ -d ${initdir}/${rs_y} ]; then continue fi tmpdeplist="${tmpdeplist} ${rs_y}" -- cgit v1.2.3 From 1541218fe148cfae9c3a4ce84e7fd6692f3d2028 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Thu, 12 Apr 2007 21:56:32 +0200 Subject: Add support for loading keymaps. (closes: 337663) --- conf/initramfs.conf | 9 ++++++++ debian/changelog | 6 +++++- hooks/keymap | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ initramfs.conf.5 | 7 +++++++ mkinitramfs | 1 + scripts/init-top/keymap | 27 ++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 1 deletion(-) create mode 100755 hooks/keymap create mode 100755 scripts/init-top/keymap (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index b0d1dc0..0620d26 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -17,6 +17,7 @@ MODULES=most +# # BUSYBOX: [ y | n ] # # Use busybox if available. @@ -24,6 +25,14 @@ MODULES=most BUSYBOX=y +# +# KEYMAP: [ y | n ] +# +# Load a keymap during the initramfs stage. +# + +KEYMAP=n + # # NFS Section of the config. # diff --git a/debian/changelog b/debian/changelog index 0da1fed..f224405 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,14 @@ initramfs-tools (0.87) UNRELEASED; urgency=low + [ maximilian attems ] * scripts/functions: reduce_satisfied() needs to ignore the same set as set_initlist() otherwise an script having a prereqs on a non-executable boot script may cause circular panic. (closes: 418509) - -- maximilian attems Wed, 11 Apr 2007 00:07:18 +0200 + [ David Härdeman ] + * Add support for loading keymaps. (closes: 337663) + + -- David Härdeman Thu, 12 Apr 2007 21:28:45 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/hooks/keymap b/hooks/keymap new file mode 100755 index 0000000..749f24c --- /dev/null +++ b/hooks/keymap @@ -0,0 +1,55 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# Hook to load keymaps into the initramfs if requested by KEYMAP="y" +if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then + exit 0 +fi + +# Step 1 - Basic tools +if [ ! -x /bin/loadkeys ] || [ ! -r /etc/console/boottime.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 + +# Step 2 - Check for UTF8 console +if [ ! -x /usr/bin/kbd_mode ]; then + exit 0 +fi + +if [ -r /etc/environment ]; then + env="/etc/environment" +elif [ -r /etc/default/locale ]; then + env="/etc/default/locale" +else + exit 0 +fi + +for var in LANG LC_ALL LC_CTYPE; do + value=$(egrep "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2) + eval $var=$value +done + +charmap=$(LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap) +if [ "$charmap" = "UTF-8" ]; then + copy_exec /usr/bin/kbd_mode /bin +fi +exit 0 + diff --git a/initramfs.conf.5 b/initramfs.conf.5 index e685298..55d6629 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -40,6 +40,13 @@ If set to 'n' will build an initramfs without busybox. Beware that many boot scripts need busybox utilities. +.TP +\fB KEYMAP +If set to 'y', the console keymap will be loaded during the initramfs stage. +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. + .SH NFS VARIABLES .TP \fB BOOT diff --git a/mkinitramfs b/mkinitramfs index 17e1846..7d73ba1 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -163,6 +163,7 @@ export CONFDIR export DESTDIR export DPKG_ARCH export verbose +export KEYMAP # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ diff --git a/scripts/init-top/keymap b/scripts/init-top/keymap new file mode 100755 index 0000000..f011abf --- /dev/null +++ b/scripts/init-top/keymap @@ -0,0 +1,27 @@ +#!/bin/sh + +PREREQ="" +prereqs() +{ + echo "$PREREQ" +} +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +OPTS="-q" + +# Should terminal be in UTF8 mode? +if [ -x /bin/kbd_mode ]; then + /bin/kbd_mode -u + OPTS="${OPTS} -u" +fi + +# Load custom keymap +if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then + loadkeys ${OPTS} /etc/boottime.kmap.gz +fi -- cgit v1.2.3 From 878b47192bc92fcfe78f34134a8aea70afc161f5 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 13 Apr 2007 01:25:53 +0200 Subject: Add support for a blacklist boot parameter. disallows modules loading inside of the initramfs. --- debian/changelog | 5 ++++- init | 4 ++++ initramfs-tools.8 | 5 +++++ scripts/init-premount/blacklist | 25 +++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 scripts/init-premount/blacklist (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index f224405..d86408d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,11 +4,14 @@ initramfs-tools (0.87) UNRELEASED; urgency=low * scripts/functions: reduce_satisfied() needs to ignore the same set as set_initlist() otherwise an script having a prereqs on a non-executable boot script may cause circular panic. (closes: 418509) + * Add blacklist boot param, disabling the load of specific modules inside + the initramfs. Still needs to be passed via tmpfs to the rootfs. [ David Härdeman ] * Add support for loading keymaps. (closes: 337663) - -- David Härdeman Thu, 12 Apr 2007 21:28:45 +0200 + + -- maximilian attems Fri, 13 Apr 2007 01:22:56 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/init b/init index 00e0dcf..b115cd1 100755 --- a/init +++ b/init @@ -50,6 +50,7 @@ export debug= export cryptopts=${CRYPTOPTS} export ROOTDELAY= export panic= +export blacklist= # Parse command line options for x in $(cat /proc/cmdline); do @@ -125,6 +126,9 @@ for x in $(cat /proc/cmdline); do break) break=premount ;; + blacklist=*) + blacklist=${x#blacklist=} + ;; esac done diff --git a/initramfs-tools.8 b/initramfs-tools.8 index c102de0..526899f 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -89,6 +89,11 @@ mounts the rootfs read-only. \fB \fI rw mounts the rootfs read-write. +.TP +\fB \fI blacklist +disables load of specific modules. +Use blacklist=module1,module2,module3 bootparameter. + .TP \fB \fI panic sets an timeout on panic. Currently only zero value supported. diff --git a/scripts/init-premount/blacklist b/scripts/init-premount/blacklist new file mode 100755 index 0000000..1dd9dbc --- /dev/null +++ b/scripts/init-premount/blacklist @@ -0,0 +1,25 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# sanity check +[ -z "${blacklist}" ] && exit 0 + +# write blacklist to modprobe.d +IFS=',' +for b in ${blacklist}; do + echo "blacklist $b" >> /etc/modprobe.d/initramfs +done -- cgit v1.2.3 From 16fac6738535e973cfe1493f1b9b5c67c5150ffc Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 13 Apr 2007 20:11:21 +0200 Subject: Use -Qb for for module loading to honor blacklists. --- debian/changelog | 5 +++-- scripts/init-premount/thermal | 4 ++-- scripts/local | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index d86408d..c0f652b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,9 +9,10 @@ initramfs-tools (0.87) UNRELEASED; urgency=low [ David Härdeman ] * Add support for loading keymaps. (closes: 337663) + * Ubuntu merge + - Use -Qb for for module loading to honor blacklists. - - -- maximilian attems Fri, 13 Apr 2007 01:22:56 +0200 + -- David Härdeman Fri, 13 Apr 2007 20:08:26 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index aa146ec..e8a6ae4 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -31,7 +31,7 @@ powerpc|ppc64) modprobe windfarm_smu_sensors ;; i386|amd64|ia64) - modprobe fan - modprobe thermal + modprobe -Qb fan + modprobe -Qb thermal ;; esac diff --git a/scripts/local b/scripts/local index 4e01472..47ef7fa 100644 --- a/scripts/local +++ b/scripts/local @@ -67,7 +67,7 @@ mountroot () fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe -Qb ${FSTYPE} # FIXME This has no error checking # Mount root -- cgit v1.2.3 From 3f94f7f380f1a5fe9afd7e20d0796365c2da25c3 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 13 Apr 2007 20:38:06 +0200 Subject: Add PS3 module loading functionality. --- debian/changelog | 1 + hook-functions | 8 +++++++- scripts/init-premount/ps3 | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 scripts/init-premount/ps3 (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index c0f652b..1476018 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ initramfs-tools (0.87) UNRELEASED; urgency=low * Add support for loading keymaps. (closes: 337663) * Ubuntu merge - Use -Qb for for module loading to honor blacklists. + - Add PS3 module loading functionality. -- David Härdeman Fri, 13 Apr 2007 20:08:26 +0200 diff --git a/hook-functions b/hook-functions index f506b49..f33d323 100644 --- a/hook-functions +++ b/hook-functions @@ -146,6 +146,12 @@ dep_add_modules() if [ -e /sys/bus/i2o/devices/ ]; then manual_add_modules i2o_block fi + + if [ -e /sys/bus/ps3_system_bus/ ]; then + for x in ps3_storage gelic_net ohci-hcd ehci-hcd; do + manual_add_modules "${x}" + done + fi } @@ -167,7 +173,7 @@ auto_add_modules() r8169 s2io sis900 skge slhc smc911x starfire \ sundance sungem sungem_phy sunhme tg3 tlan de2104x \ de4x5 dmfe tulip winbond-840 xircom_cb xircom_tulip_cb \ - typhon via-rhine via-velocity yellowfin; do + typhon via-rhine via-velocity yellowfin gelic_net; do manual_add_modules "${x}" done ;; diff --git a/scripts/init-premount/ps3 b/scripts/init-premount/ps3 new file mode 100755 index 0000000..1fe65ae --- /dev/null +++ b/scripts/init-premount/ps3 @@ -0,0 +1,28 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +case "$DPKG_ARCH" in +powerpc|ppc64) + # For PS3's we know these devices will exist, and we'll need them + if grep -q PS3 /proc/cpuinfo; then + modprobe ps3_storage + modprobe gelic_net + modprobe ohci-hcd + modprobe ehci-hcd + fi + ;; +esac -- cgit v1.2.3 From 24973b26ba0b43594d6c2bdbc2680f51998b8294 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sat, 14 Apr 2007 10:57:12 +0200 Subject: Revert NACK'ed change --- debian/changelog | 3 +-- scripts/init-premount/thermal | 4 ++-- scripts/local | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index a20ad86..838da0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,10 +11,9 @@ initramfs-tools (0.87) UNRELEASED; urgency=low * Add support for loading keymaps. (closes: 337663) * Move legacy code from mkinitramfs to separate hooks. * Ubuntu merge - - Use -Qb for for module loading to honor blacklists. - Add PS3 module loading functionality. - -- David Härdeman Fri, 13 Apr 2007 21:01:11 +0200 + -- David Härdeman Sat, 14 Apr 2007 10:53:56 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index e8a6ae4..aa146ec 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -31,7 +31,7 @@ powerpc|ppc64) modprobe windfarm_smu_sensors ;; i386|amd64|ia64) - modprobe -Qb fan - modprobe -Qb thermal + modprobe fan + modprobe thermal ;; esac diff --git a/scripts/local b/scripts/local index 47ef7fa..4e01472 100644 --- a/scripts/local +++ b/scripts/local @@ -67,7 +67,7 @@ mountroot () fi # FIXME This has no error checking - modprobe -Qb ${FSTYPE} + modprobe ${FSTYPE} # FIXME This has no error checking # Mount root -- cgit v1.2.3 From cf98d0b5ba3eb20d7ca7c4404dd404bedd5fc22b Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sat, 14 Apr 2007 11:51:52 +0200 Subject: Replace grep use with shell equivalent --- scripts/init-premount/ps3 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/init-premount/ps3 b/scripts/init-premount/ps3 index 1fe65ae..d4b1609 100755 --- a/scripts/init-premount/ps3 +++ b/scripts/init-premount/ps3 @@ -17,12 +17,15 @@ esac case "$DPKG_ARCH" in powerpc|ppc64) - # For PS3's we know these devices will exist, and we'll need them - if grep -q PS3 /proc/cpuinfo; then - modprobe ps3_storage - modprobe gelic_net - modprobe ohci-hcd - modprobe ehci-hcd - fi + while read line; do + if [ "${line}" =! "${line#machine*PS3PF}" ]; then + # For PS3's we know these devices will exist, + # and that we'll need them + modprobe ps3_storage + modprobe gelic_net + modprobe ohci-hcd + modprobe ehci-hcd + fi + done < /proc/cpuinfo ;; esac -- cgit v1.2.3 From 2b382bf18e47765e9f3bb1963008f8ee1a46cf97 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 16 Apr 2007 20:33:52 +0200 Subject: fix regexes to always use posix char classes and release 0.87 needs the -regextype posix-extended switch for find, also it seems 0.86 disgarded uselessly uppercase scripts (they might be distasteful ;) --- debian/changelog | 7 +++++-- mkinitramfs | 8 +++++--- scripts/functions | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index c5a5e01..0d77ff9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -initramfs-tools (0.87) UNRELEASED; urgency=low +initramfs-tools (0.87) unstable; urgency=low [ maximilian attems ] * scripts/functions: reduce_satisfied() needs to ignore the same set as @@ -6,6 +6,9 @@ initramfs-tools (0.87) UNRELEASED; urgency=low boot script may cause circular panic. (closes: 418509) * Add blacklist boot param, disabling the load of specific modules inside the initramfs. Still needs to be passed via tmpfs to the rootfs. + * mkinitramfs, scripts/functions: Fix regexes to always use posix character + classes. Based on a patch by Meelis Roos . + (closes: 419062) [ David Härdeman ] * Add support for loading keymaps. (closes: 337663) @@ -16,7 +19,7 @@ initramfs-tools (0.87) UNRELEASED; urgency=low * Bump standards version, no changes necessary. * debian/scripts: Print settings from initramfs.conf in reportbug script. - -- maximilian attems Mon, 16 Apr 2007 19:54:04 +0200 + -- maximilian attems Mon, 16 Apr 2007 20:21:30 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/mkinitramfs b/mkinitramfs index b3514fc..e7b9b13 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -84,7 +84,8 @@ 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 | grep '^[a-z0-9][a-z0-9\._-]*$' | grep -v '\.dpkg-.*$')"; + EXTRA_CONF="${EXTRA_CONF} $(basename $i \ + | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -v '\.dpkg-.*$')"; done for i in ${EXTRA_CONF}; do if [ -e ${CONFDIR}/conf.d/${i} ]; then @@ -204,13 +205,14 @@ copy_exec /usr/share/initramfs-tools/init /init # add existant boot scripts for b in $(cd /usr/share/initramfs-tools/scripts/ && find . \ - -regex '.*/[a-z0-9_]+$' -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 . -regex '.*/[a-z0-9_]+$' -type f); do +for b in $(cd "${CONFDIR}/scripts" && find . \ + -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}")" diff --git a/scripts/functions b/scripts/functions index 00fcf3d..0b8d1e8 100644 --- a/scripts/functions +++ b/scripts/functions @@ -87,7 +87,7 @@ set_initlist() for si_x in ${initdir}/*; do # only allow variable name chars case ${si_x#${initdir}/} in - *[!A-Za-z0-9_]*) + *[![:alnum:]_]*) continue ;; esac @@ -110,7 +110,7 @@ reduce_satisfied() for rs_y in ${deplist}; do # only allow variable name chars case ${rs_y} in - *[!A-Za-z0-9_]*) + *[![:alnum:]_]*) continue ;; esac -- cgit v1.2.3 From 7e0470e3fe7ede0f846ff2e459aeec1650742e9b Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 16 Apr 2007 22:07:01 +0200 Subject: nice usplash experience tested both on my laptop as on qemu ubuntu merge --- debian/changelog | 7 +++++++ scripts/init-top/framebuffer | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 0d77ff9..62fef53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.88) UNRELEASED; urgency=low + + * scripts/init-top/framebuffer: Remove vga16fb loading on splash bootarg. + Newer usplash > 0.4 no longer needs that. + + -- maximilian attems Mon, 16 Apr 2007 22:05:18 +0200 + initramfs-tools (0.87) unstable; urgency=low [ maximilian attems ] diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index c680409..08e36d2 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -61,10 +61,6 @@ OPTS="" for x in $(cat /proc/cmdline); do case ${x} in - splash*) - FB="vga16fb"; - OPTS=""; - ;; vga=*) FB="vesafb"; OPTS=""; -- cgit v1.2.3 From 525008f4da3ddc32c83329dbb6322ae1660b8fc8 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sun, 27 May 2007 00:29:27 +0200 Subject: scripts/local: check for fs on rootnode some device node will exist before they can be safely used --- debian/changelog | 10 ++++++++-- scripts/local | 36 +++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 032fa85..042cf8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,8 +16,14 @@ initramfs-tools (0.88) UNRELEASED; urgency=low * hook-functions: Document how copy_exec determines the target path. * hook-functions: Add firmware loading support to manual_add_modules(). (closes: #355881) - - -- maximilian attems Thu, 03 May 2007 18:43:14 +0200 + * scripts/local: Ubuntu merge + - As well as waiting for the existance of the root device node, also check + to see whether we have a filesystem of some kind on it. Some devices + nodes (devmapper/LVM/EVMS, mdadm) will exist before they can be safely + used. Patch by Scott James Remnant . Changed to + support both fstype and vol_id. + + -- maximilian attems Sun, 27 May 2007 00:26:17 +0200 initramfs-tools (0.87b) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 4e01472..459ba8d 100644 --- a/scripts/local +++ b/scripts/local @@ -1,5 +1,29 @@ # 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 + if [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) + else + eval $(fstype < "${FS}" 2> /dev/null) + fi + RET=$? + + if [ -z "${FSTYPE}" ]; then + FSTYPE="unknown" + fi + + echo "${FSTYPE}" + return ${RET} +} + # Parameter: Where to mount the filesystem mountroot () { @@ -9,7 +33,7 @@ mountroot () # If the root device hasn't shown up yet, give it a little while # to deal with removable devices - if [ ! -e "${ROOT}" ]; then + if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then log_begin_msg "Waiting for root file system..." # Default delay is 180s @@ -23,9 +47,11 @@ mountroot () fi slumber=$(( ${slumber} * 10 )) - while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do + while [ ! -e "${ROOT}" ] \ + || ! $(get_fstype "${ROOT}" >/dev/null); do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) + [ ${slumber} -gt 0 ] || break done if [ ${slumber} -gt 0 ]; then @@ -47,14 +73,10 @@ mountroot () # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then - eval $(fstype < ${ROOT}) + FSTYPE=$(get_fstype "${ROOT}") else FSTYPE=${ROOTFSTYPE} fi - if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t ${ROOT}) - [ -z "$FSTYPE" ] && FSTYPE="unknown" - fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount -- cgit v1.2.3 From 0df638ec51ee9a8362f3c81ceb9070d8e2820381 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 27 May 2007 00:32:10 +0200 Subject: scripts/init-premount/ps3: typo fix --- debian/changelog | 3 ++- scripts/init-premount/ps3 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 042cf8d..86ba300 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ initramfs-tools (0.88) UNRELEASED; urgency=low * mkinitramfs.8: Add examples section, plus improve description of the low-level tool and how it fits with update-initramfs. * init: Ignore non-numerical panic and rootdelay bootarg. + * scripts/init-premount/ps3: Fix typo. (closes: #423469) [ David Härdeman ] * init: Remove cryptopts parsing, not official bootparam. cryptsetup scripts @@ -23,7 +24,7 @@ initramfs-tools (0.88) UNRELEASED; urgency=low used. Patch by Scott James Remnant . Changed to support both fstype and vol_id. - -- maximilian attems Sun, 27 May 2007 00:26:17 +0200 + -- maximilian attems Sun, 27 May 2007 00:31:13 +0200 initramfs-tools (0.87b) unstable; urgency=low diff --git a/scripts/init-premount/ps3 b/scripts/init-premount/ps3 index d4b1609..8f8ce1c 100755 --- a/scripts/init-premount/ps3 +++ b/scripts/init-premount/ps3 @@ -18,7 +18,7 @@ esac case "$DPKG_ARCH" in powerpc|ppc64) while read line; do - if [ "${line}" =! "${line#machine*PS3PF}" ]; then + if [ "${line}" != "${line#machine*PS3PF}" ]; then # For PS3's we know these devices will exist, # and that we'll need them modprobe ps3_storage -- cgit v1.2.3 From bb98536c4c1b597ed326c8729e048eac5526869b Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 27 May 2007 00:43:18 +0200 Subject: scripts/nfs: fix when root-path includes server-ip --- debian/changelog | 4 +++- scripts/nfs | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 86ba300..622b109 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ initramfs-tools (0.88) UNRELEASED; urgency=low low-level tool and how it fits with update-initramfs. * init: Ignore non-numerical panic and rootdelay bootarg. * scripts/init-premount/ps3: Fix typo. (closes: #423469) + * scripts/nfs: Fix when root-path includes server-ip. (closes: #387808) + Thanks Vagrant Cascadian for patch. [ David Härdeman ] * init: Remove cryptopts parsing, not official bootparam. cryptsetup scripts @@ -24,7 +26,7 @@ initramfs-tools (0.88) UNRELEASED; urgency=low used. Patch by Scott James Remnant . Changed to support both fstype and vol_id. - -- maximilian attems Sun, 27 May 2007 00:31:13 +0200 + -- maximilian attems Sun, 27 May 2007 00:41:08 +0200 initramfs-tools (0.87b) unstable; urgency=low diff --git a/scripts/nfs b/scripts/nfs index 5eb17bf..717dfe8 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -41,7 +41,13 @@ do_nfsmount() # get nfs root from dhcp if [ "x${NFSROOT}" = "xauto" ]; then - NFSROOT=${ROOTSERVER}:${ROOTPATH} + # check if server ip is part of dhcp root-path + if [ "${ROOTPATH#*:}" = "${ROOTPATH}" ]; then + NFSROOT=${ROOTSERVER}:${ROOTPATH} + else + NFSROOT=${ROOTPATH} + fi + # nfsroot=[:][,] elif [ -n "${NFSROOT}" ]; then # nfs options are an optional arg -- cgit v1.2.3 From ad5ae668b01884a4ef99d14bbfef7ce07f908801 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 11 Jun 2007 00:42:05 +0200 Subject: scripts/local: use simpler fstype invocation compatible with etch released klibc --- debian/changelog | 4 +++- scripts/local | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index d413936..be82239 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,9 @@ initramfs-tools (0.89) unstable; urgency=low * initramfs.conf.5: Document ROOT hardcoding. - -- maximilian attems Wed, 30 May 2007 13:25:36 +0200 + * scripts/local: Use simpler fstype invocation. + + -- maximilian attems Mon, 11 Jun 2007 00:40:29 +0200 initramfs-tools (0.88) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 459ba8d..429d1f6 100644 --- a/scripts/local +++ b/scripts/local @@ -12,7 +12,7 @@ get_fstype () if [ -x /lib/udev/vol_id ]; then FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) else - eval $(fstype < "${FS}" 2> /dev/null) + eval $(fstype "${FS}" 2> /dev/null) fi RET=$? -- cgit v1.2.3 From 087dc49f30e7d94db10c0f0cd89020a56a04a918 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 20 Jun 2007 20:58:41 +0200 Subject: scripts/local: add a q&d crude method to warn about renamed root dev maybe this will reduce ration of bug reports, as further device renaming is in the pipes. :) --- debian/changelog | 5 ++++- scripts/local | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index b1bacac..d506d71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,10 @@ initramfs-tools (0.89) unstable; urgency=low * initramfs-tools.8, initramfs.conf.5: Fix typos. (closes: #427837, #427838) Thanks "A. Costa" for the patch. - -- maximilian attems Wed, 20 Jun 2007 20:01:20 +0200 + * scripts/local: Try to warn for renamed root dev. (closes: #374611) + + + -- maximilian attems Wed, 20 Jun 2007 20:56:14 +0200 initramfs-tools (0.88) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 429d1f6..10e2f73 100644 --- a/scripts/local +++ b/scripts/local @@ -66,6 +66,25 @@ 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 + /dev/hd*) + suffix="${ROOT#/dev/hd}" + major="${suffix%[[:digit:]]}" + major="${major%[[:digit:]]}" + if [ -d "/sys/block/sd${major}" ]; then + echo "WARNING bootdevice may be renamed. Try root=/dev/sd${suffix}" + fi + ;; + /dev/sd*) + suffix="${ROOT#/dev/sd}" + major="${suffix%[[:digit:]]}" + major="${major%[[:digit:]]}" + if [ -d "/sys/block/hd${major}" ]; then + echo "WARNING bootdevice may be renamed. Try root=/dev/hd${suffix}" + fi + ;; + esac echo "ALERT! ${ROOT} does not exist. Dropping to a shell!" echo " Check your root= boot argument (cat /proc/cmdline)" panic " Check for missing modules (cat /proc/modules), or device files (ls /dev)" -- cgit v1.2.3 From 5ac61dd320ed9616a7e986fa824f804dbbd626af Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 4 Jul 2007 00:34:42 +0200 Subject: revert vol_id usage for now, when more matured this can be easily rechanged. --- debian/changelog | 17 +++++++++++------ scripts/local | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 6a17083..3141edf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,11 @@ initramfs-tools (0.89) unstable; urgency=low + + Release "L'lecteur c'est notoire N'a pas tout' sa raison" + + [ Joey Hess ] + * mkinitramfs: Include libgcc_s.so.1 on arm since glibc always tries to load + it for the SJLJ exception handling on that architecture. (closes: #426395) + Thanks to Aurelien Jarno for ack and review. [ maximilian attems ] * initramfs.conf.5: Document ROOT hardcoding. @@ -10,13 +17,11 @@ initramfs-tools (0.89) unstable; urgency=low MODULES setting is passed. Thanks Henning Sprang for report. (closes: #429144) * hook-functions: Fix variable typo. Thanks Emanuele Rocca . + * scripts/local: Revert change to use udev vol_id before fstype, + there are too many "wrongly" formated fs out there. fstype supports less, + but is more robust. - [ Joey Hess ] - * mkinitramfs: Include libgcc_s.so.1 on arm since glibc always tries to load - it for the SJLJ exception handling on that architecture. (closes: #426395) - Thanks to Aurelien Jarno for ack and review. - - -- maximilian attems Thu, 21 Jun 2007 11:57:20 +0200 + -- maximilian attems Wed, 04 Jul 2007 00:28:34 +0200 initramfs-tools (0.88) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 10e2f73..b06ca63 100644 --- a/scripts/local +++ b/scripts/local @@ -10,9 +10,9 @@ get_fstype () # vol_id has a more complete list of file systems if [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) - else eval $(fstype "${FS}" 2> /dev/null) + else + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) fi RET=$? -- cgit v1.2.3 From ee93d17783dc32d03faf99c29bdcd4fcc30abc43 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 4 Jul 2007 10:15:53 +0200 Subject: scripts/local: make sure that fstype is always invoked --- scripts/local | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index b06ca63..55d4c46 100644 --- a/scripts/local +++ b/scripts/local @@ -8,10 +8,10 @@ get_fstype () local FS FSTYPE FSSIZE RET FS="${1}" - # vol_id has a more complete list of file systems - if [ -x /lib/udev/vol_id ]; then - eval $(fstype "${FS}" 2> /dev/null) - else + # 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=$? -- cgit v1.2.3 From e23c0a34f51d053357fd6c171cd8edfd38bc3df0 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 7 Aug 2007 01:19:38 +0200 Subject: scripts/functions: Implement non-zero panic boot arg sleep the passed time and then call reboot. works as arg can only be numeric. --- debian/changelog | 3 ++- initramfs-tools.8 | 4 ++-- scripts/functions | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index c37028a..91f7ec9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,11 +4,12 @@ initramfs-tools (0.90) UNRELEASED; urgency=low * hook-functions: Fix xen i386 boots with optimized 2.5. (closes: 420754) Thanks Marco Nenciarini for patch. * debian/control: Bump dep on klibc-utils from etch. (closes: 435031) + * scripts/functions: Implement non-zero panic bootarg. [ David Härdeman ] * hook-functions: Protect all variable with local, plus coding style fixes. - -- maximilian attems Sat, 28 Jul 2007 19:03:35 +0200 + -- maximilian attems Tue, 07 Aug 2007 01:18:25 +0200 initramfs-tools (0.89) unstable; urgency=low diff --git a/initramfs-tools.8 b/initramfs-tools.8 index be4de54..3708575 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "Date: 2007/04/09" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "Date: 2007/07/07" "" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -96,7 +96,7 @@ Use blacklist=module1,module2,module3 bootparameter. .TP \fB \fI panic -sets an timeout on panic. Currently only zero value supported. +sets an timeout on panic. .TP \fB \fI debug diff --git a/scripts/functions b/scripts/functions index 0b8d1e8..e73874d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -62,6 +62,9 @@ panic() # Disallow console access if [ -n "${panic}" ] && [ "${panic}" = 0 ]; then reboot + elif [ -n "${panic}" ]; then + sleep ${panic} + reboot fi modprobe i8042 modprobe atkbd @@ -71,7 +74,7 @@ panic() maybe_break() { - if [ x$1 = x${break} ]; then + if [ -n "${break}" ]; then panic "Spawning shell within the initramfs" fi } -- cgit v1.2.3 From f917408f4bb541f44973be3f7ef4a48ba6528e9a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 7 Aug 2007 14:10:17 +0200 Subject: scripts/functions: style fix for maybe_break() recover func from previous bogus change.. --- debian/changelog | 5 +++-- scripts/functions | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 91f7ec9..60f216b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,12 +4,13 @@ initramfs-tools (0.90) UNRELEASED; urgency=low * hook-functions: Fix xen i386 boots with optimized 2.5. (closes: 420754) Thanks Marco Nenciarini for patch. * debian/control: Bump dep on klibc-utils from etch. (closes: 435031) - * scripts/functions: Implement non-zero panic bootarg. + * scripts/functions: Implement non-zero panic bootarg. Style fix for + maybe_break(). [ David Härdeman ] * hook-functions: Protect all variable with local, plus coding style fixes. - -- maximilian attems Tue, 07 Aug 2007 01:18:25 +0200 + -- maximilian attems Tue, 07 Aug 2007 14:09:18 +0200 initramfs-tools (0.89) unstable; urgency=low diff --git a/scripts/functions b/scripts/functions index e73874d..2914aea 100644 --- a/scripts/functions +++ b/scripts/functions @@ -74,7 +74,7 @@ panic() maybe_break() { - if [ -n "${break}" ]; then + if [ "${break}" = "$1" ]; then panic "Spawning shell within the initramfs" fi } -- cgit v1.2.3 From a951e89170510a6877aaa0fd281a30f08106008e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 8 Aug 2007 19:04:49 +0200 Subject: scripts/funtions: run_scripts() on verbose mode add error messages * add the error messages * fix double call to set_initlist * skip empty dirs at start --- debian/changelog | 6 +++++- scripts/functions | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 87ffed4..05b837b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,11 +10,15 @@ initramfs-tools (0.90~beta1) UNRELEASED; urgency=low (closes: #426917, #429237, #426446) * debian/scripts: Add /etc/crypttab to reportbug script. Add /sys/block list for MODULES=dep to reportbug script. + * scripts/functions: Add error message on verbose mode about ignored files + in boot/hooks dir. Thanks Kornilios Kourtis + for the initial patch. Fixes a double set_initlist call too. Ignore empty + dirs earlier too. (closes: #433459) [ David Härdeman ] * hook-functions: Protect all variable with local, plus coding style fixes. - -- maximilian attems Wed, 08 Aug 2007 01:22:00 +0200 + -- maximilian attems Wed, 08 Aug 2007 18:57:20 +0200 initramfs-tools (0.89) unstable; urgency=low diff --git a/scripts/functions b/scripts/functions index 2914aea..81174bf 100644 --- a/scripts/functions +++ b/scripts/functions @@ -88,20 +88,32 @@ set_initlist() { unset initlist for si_x in ${initdir}/*; do + # skip empty dirs without warning + [ "${si_x}" = "${initdir}/*" ] && return + # only allow variable name chars case ${si_x#${initdir}/} in *[![:alnum:]_]*) + [ "${verbose}" = "y" ] \ + && echo "$si_x ignored: not alphanumeric or '_' file" continue ;; esac + # skip non executable scripts if [ ! -x ${si_x} ]; then + [ "${verbose}" = "y" ] \ + && echo "$si_x ignored: not executable" continue fi + # skip directories if [ -d ${si_x} ]; then + [ "${verbose}" = "y" ] \ + && echo "$si_x ignored: a directory" continue fi + initlist="${initlist} ${si_x#${initdir}/}" done } @@ -171,7 +183,6 @@ pop_list_item() reduce_prereqs() { unset runlist - set_initlist set -- ${initlist} i=$# # Loop until there's no more in the queue to loop through -- cgit v1.2.3 From 7b0e6ab2ff392502d195de90536395189dc93856 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 15 Aug 2007 23:25:28 +0200 Subject: scripts/functions: simplify panic() sleep can take arg 0 --- scripts/functions | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 81174bf..db223cd 100644 --- a/scripts/functions +++ b/scripts/functions @@ -60,9 +60,7 @@ panic() /sbin/usplash_write "QUIT" fi # Disallow console access - if [ -n "${panic}" ] && [ "${panic}" = 0 ]; then - reboot - elif [ -n "${panic}" ]; then + if [ -n "${panic}" ]; then sleep ${panic} reboot fi -- cgit v1.2.3 From 0d04c24d798c34d00faf812cc82b80df5e6360c6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 25 Aug 2007 13:38:54 +0200 Subject: initramfs-tools: axe udev_helper --- debian/changelog | 7 +++++++ scripts/local-top/udev_helper | 23 ----------------------- 2 files changed, 7 insertions(+), 23 deletions(-) delete mode 100755 scripts/local-top/udev_helper (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index ed6b6d3..dc62b5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.91) UNRELEASED; urgency=low + + * udev_helper: Axe the modprobe ide-generic should no longer be needed + for kernel since Etch. + + -- maximilian attems Sat, 25 Aug 2007 13:37:15 +0200 + initramfs-tools (0.90a) unstable; urgency=high * scripts/functions: simplify panic() diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper deleted file mode 100755 index c1694b7..0000000 --- a/scripts/local-top/udev_helper +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# If we're booting from IDE, it might not be a PCI controller, -# but might be an old fashioned ISA controller; in which case -# we need to load ide-generic. -if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe ide-generic -fi -- cgit v1.2.3 From cd3e97b5b87380e8d1700c6f86d907ad40a1179d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 25 Aug 2007 19:11:44 +0200 Subject: scripts/local: small CodingStyle quote readonly variable --- debian/changelog | 3 ++- scripts/local | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 26a76aa..1031a50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low Add XS-Vcs-* fields. Mv busybox from Depends to Recommends. * mkinitramfs: Cope when no busybox is around warn on md/lvm root. * mkinitramfs: Kill kinit.shared too. + * scripts/local: Quote readonly variable. (LP: #115807) - -- maximilian attems Sat, 25 Aug 2007 14:35:38 +0200 + -- maximilian attems Sat, 25 Aug 2007 19:10:20 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/scripts/local b/scripts/local index 55d4c46..b55212e 100644 --- a/scripts/local +++ b/scripts/local @@ -101,7 +101,7 @@ mountroot () run_scripts /scripts/local-premount [ "$quiet" != "y" ] && log_end_msg - if [ ${readonly} = y ]; then + if [ "${readonly}" = "y" ]; then roflag=-r else roflag=-w -- cgit v1.2.3 From 971f6f778035b49afaea9be8408f90cccb6b548b Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 1 Sep 2007 10:56:59 +0200 Subject: init-top/framebuffer: Check that fb minor is below 32. you can only have up to 32 fb devices going from fb0 to fb31. --- debian/changelog | 3 ++- scripts/init-top/framebuffer | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 36a3b81..6a1d1f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * scripts/local: Quote readonly variable. (LP: #115807) * mkinitramfs, scripts/keymap: Add trailing slash on cp destination for dir. * init: Call panic for debug sh if run-init fails. + * init-top/framebuffer: Check that fb minor is below 32. - -- maximilian attems Sat, 01 Sep 2007 10:45:04 +0200 + -- maximilian attems Sat, 01 Sep 2007 10:55:33 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 08e36d2..9292024 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -88,7 +88,9 @@ fi if [ -e /proc/fb ]; then while read fbno desc; do - mknod /dev/fb${fbno} c 29 ${fbno} + if [ $(($fbnum < 32)) ]; then + mknod /dev/fb${fbno} c 29 ${fbno} + fi done < /proc/fb else mknod /dev/fb0 c 29 0 -- cgit v1.2.3 From 5ac8a35ffa7db1c1295f46c75e6b8cc7cd698546 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Tue, 4 Sep 2007 10:41:07 +0200 Subject: initramfs-tools: split networking code into separate function ltsp in ubuntu started using NBD+unionfs+squashfs instead of NFS, and debian-live uses has a network boot methods using cifs in addition to a different way of using NFS (i think it also uses unionfs and maybe squashfs, not just a plain NFS/cifs mount)... so splitting out the networking related code into a separate function would move towards not having forked code for all of these different network boot methods. at least, that's my hope. --- debian/changelog | 4 +++- scripts/functions | 35 +++++++++++++++++++++++++++++++++++ scripts/nfs | 33 ++------------------------------- 3 files changed, 40 insertions(+), 32 deletions(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 0bdb6b9..f5ace4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,8 +13,10 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * init: Export noresume if set. uswsusp and kdump need it. * init: Try harder to find a valid init on rootmnt. Fixes bootfailure on bogus init bootarg too. + * scripts/{functions,nfs}: Split networking code in separate function. + Thanks Vagrant Cascadian for the patch. - -- maximilian attems Mon, 03 Sep 2007 11:44:04 +0200 + -- maximilian attems Tue, 04 Sep 2007 10:39:07 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/scripts/functions b/scripts/functions index db223cd..fdd808f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -270,3 +270,38 @@ parse_numeric() { chmod 600 /dev/root ROOT=/dev/root } + +configure_networking() +{ + # support ip options see linux sources Documentation/nfsroot.txt + case ${IPOPTS} in + none|off) + # Do nothing + ;; + ""|on|any) + # Bring up device + ipconfig ${DEVICE} + ;; + dhcp|bootp|rarp|both) + ipconfig -c ${IPOPTS} -d ${DEVICE} + ;; + *) + ipconfig -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 + + # source relevant ipconfig output + . /tmp/net-${DEVICE}.conf +} diff --git a/scripts/nfs b/scripts/nfs index 717dfe8..b9c2522 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -4,40 +4,11 @@ retry_nr=0 -# parse nfs bootargs + launch ipconfig and nfsmount +# parse nfs bootargs and mount nfs do_nfsmount() { - # support ip options see linux sources Documentation/nfsroot.txt - case ${IPOPTS} in - none|off) - # Do nothing - ;; - ""|on|any) - # Bring up device - ipconfig ${DEVICE} - ;; - dhcp|bootp|rarp|both) - ipconfig -c ${IPOPTS} -d ${DEVICE} - ;; - *) - ipconfig -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 - - # source relevant ipconfig output - . /tmp/net-${DEVICE}.conf + configure_networking # get nfs root from dhcp if [ "x${NFSROOT}" = "xauto" ]; then -- cgit v1.2.3 From fd0b67f392bc351dacf6b29532fc478d1ff9f118 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 5 Sep 2007 22:22:20 +0200 Subject: scripts/init-top/framebuffer: fix variable name s/fbnum/fbno/ --- scripts/init-top/framebuffer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 9292024..2427b47 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -88,7 +88,7 @@ fi if [ -e /proc/fb ]; then while read fbno desc; do - if [ $(($fbnum < 32)) ]; then + if [ $(($fbno < 32)) ]; then mknod /dev/fb${fbno} c 29 ${fbno} fi done < /proc/fb -- cgit v1.2.3 From e9434de886aa77f0d8019c9e8bddc8b7883c9b4a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 26 Dec 2007 00:46:36 +0100 Subject: local-premount/resume: coding style fixes. --- scripts/local-premount/resume | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 881af90..d997f81 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -15,8 +15,8 @@ prereqs) ;; esac -if [ "x${resume}" = "x" ]; then - exit +if [ -z "${resume}" ]; then + exit 0 fi case $resume in @@ -29,7 +29,7 @@ case $resume in esac if [ ! -e "${resume}" ]; then - exit + exit 0 fi if [ -e /sys/power/resume ]; then -- cgit v1.2.3 From 4ad8c497de815693d06e94c77e1abd5fe5b6a2cb Mon Sep 17 00:00:00 2001 From: "debian@x.ray.net" Date: Fri, 15 Feb 2008 19:41:33 +0100 Subject: configure_network(): do nothing if device already configured This patch is part of three patches (initramfs-tools, cryptsetup, dropbear) which enable mkinitramfs to create initramfs that provide the ability to log in and unlock a cryptroot during the boot process from remote via ssh. Calling configure_networking from /scripts/functions might appear more than once, so just try if it hasn't been done/wasn't successful yet. Check that by testing for existence of /tmp/net-$DEVICE.conf which is created by ipconfig. --- scripts/functions | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index fdd808f..b4bd8cd 100644 --- a/scripts/functions +++ b/scripts/functions @@ -273,6 +273,9 @@ parse_numeric() { configure_networking() { + # networking already configured thus bail out + [ -e /tmp/net-${DEVICE}.conf ] && return 0 + # support ip options see linux sources Documentation/nfsroot.txt case ${IPOPTS} in none|off) -- cgit v1.2.3 From 0aec8b0c22b7622841c4ab7a3b492b4d2657456f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 25 Mar 2008 14:40:45 +0100 Subject: framebuffer: Let udev create fb devices. nuke fb device mknod creation as udev creates the fb device nodes. suggested by waldi. positive test on qemu with usplash. let's see if we get a bad interaction with usplash and vga=XXX boots. --- scripts/init-top/framebuffer | 9 --------- 1 file changed, 9 deletions(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 2427b47..cb1ea2c 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -86,15 +86,6 @@ if [ -n "${FB}" ]; then modprobe ${FB} ${OPTS} fi -if [ -e /proc/fb ]; then - while read fbno desc; do - if [ $(($fbno < 32)) ]; then - mknod /dev/fb${fbno} c 29 ${fbno} - fi - done < /proc/fb -else - mknod /dev/fb0 c 29 0 -fi for i in 0 1 2 3 4 5 6 7 8; do mknod /dev/tty${i} c 4 ${i} done -- cgit v1.2.3 From d377e38823d06d8e79341fba44ce8ea9c42daff6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 25 Mar 2008 14:47:17 +0100 Subject: framebuffer: Leave tty devices for udev too. udev creates tty devices too, in the case of not using udev, we need to ship more anyway, so no need to worry about that right now. --- scripts/init-top/framebuffer | 4 ---- 1 file changed, 4 deletions(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index cb1ea2c..21a6b19 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -85,7 +85,3 @@ if [ -n "${FB}" ]; then modprobe fbcon modprobe ${FB} ${OPTS} fi - -for i in 0 1 2 3 4 5 6 7 8; do - mknod /dev/tty${i} c 4 ${i} -done -- cgit v1.2.3 From 24031b44c4862f557a634eadbe532757a797de8f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 30 Mar 2008 04:02:10 +0200 Subject: scripts/function: Use mknod directly. No need to call chmod later on, now that klibc mknod can set permissions. --- scripts/functions | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index b4bd8cd..0648701 100644 --- a/scripts/functions +++ b/scripts/functions @@ -266,8 +266,7 @@ parse_numeric() { ;; esac - mknod /dev/root b ${major} ${minor} - chmod 600 /dev/root + mknod -m 600 /dev/root b ${major} ${minor} ROOT=/dev/root } -- cgit v1.2.3 From 2506a84db53eb95e5616c5b572f82ef4760a773a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 31 Mar 2008 22:38:15 +0200 Subject: scripts/functions: fix configure_networking() for multiple interfaces. IPOPTS can be assumed to get passed :::::: and thus configure any possible interface. we have thus also to source the relevant ipconfig output :) based on a patch by Michal Sojka : "If I want several computers to boot from the same ramdisk (with NFS root) and some computers have multiple network interfaces, the DEVICE variable can't be set to a specific value (e.g. eth0). Ipconfig from klibc supports a mode, where DHCP request is sent to all interfaces and the one receiving the first DHCP offer is used. This perfectly suits my needs, but it can't be used with initramfs scripts because the interface name in not known in advance and the DEVICE variable is set to something like ::::::." --- scripts/functions | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 0648701..588e324 100644 --- a/scripts/functions +++ b/scripts/functions @@ -304,6 +304,12 @@ configure_networking() ;; esac - # source relevant ipconfig output - . /tmp/net-${DEVICE}.conf + # source ipconfig output + if [ -n "${DEVICE}" ]; then + # source specific bootdevice + . /tmp/net-${DEVICE}.conf + else + # source any interface as not exaclty specified + . /tmp/net-*.conf + fi } -- cgit v1.2.3 From a5a87b52156774a2c01039e80ad2f7706ac8f7e4 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 31 Mar 2008 22:47:58 +0200 Subject: ps3: load the newer modules. based on a patch by Luke Yelavich . --- scripts/init-premount/ps3 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/init-premount/ps3 b/scripts/init-premount/ps3 index 8f8ce1c..97fc662 100755 --- a/scripts/init-premount/ps3 +++ b/scripts/init-premount/ps3 @@ -17,14 +17,20 @@ esac case "$DPKG_ARCH" in powerpc|ppc64) + # For PS3's we know these devices will exist,and that we'll need them while read line; do if [ "${line}" != "${line#machine*PS3PF}" ]; then - # For PS3's we know these devices will exist, - # and that we'll need them + # New style + modprobe ps3disk + modprobe ps3rom + modprobe ps3-gelic + + # Old style modprobe ps3_storage modprobe gelic_net modprobe ohci-hcd modprobe ehci-hcd + modprobe sys-manager fi done < /proc/cpuinfo ;; -- cgit v1.2.3 From e5f8a9faad64438852a6657ed1afcc0d45f30926 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 2 Apr 2008 03:18:10 +0200 Subject: ps3 nuke useless hardcoded initramfs script. udev takes care to load the relevant modules. also PS3PF never had landed in debian thus pretty useless to take care of it just nuke it and be happy that udev loading is fixed since 2.6.23-rc1. --- scripts/init-premount/ps3 | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100755 scripts/init-premount/ps3 (limited to 'scripts') diff --git a/scripts/init-premount/ps3 b/scripts/init-premount/ps3 deleted file mode 100755 index 97fc662..0000000 --- a/scripts/init-premount/ps3 +++ /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 -powerpc|ppc64) - # For PS3's we know these devices will exist,and that we'll need them - while read line; do - if [ "${line}" != "${line#machine*PS3PF}" ]; then - # New style - modprobe ps3disk - modprobe ps3rom - modprobe ps3-gelic - - # Old style - modprobe ps3_storage - modprobe gelic_net - modprobe ohci-hcd - modprobe ehci-hcd - modprobe sys-manager - fi - done < /proc/cpuinfo - ;; -esac -- cgit v1.2.3 From c1fd9aa6213613fed140da7fe68c67a91f478509 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 2 Apr 2008 22:19:59 +0200 Subject: configure_networking(): guard against unset "${DEVICE}" found on testing that configure_networking() shouldn't make assumption that ${DEVICE} is really already set. this still allows to bail out if device is passed and set. --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 588e324..d36884c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -273,7 +273,7 @@ parse_numeric() { configure_networking() { # networking already configured thus bail out - [ -e /tmp/net-${DEVICE}.conf ] && return 0 + [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0 # support ip options see linux sources Documentation/nfsroot.txt case ${IPOPTS} in -- cgit v1.2.3 From aaf9b600c8ed9055b4e283e6cf1394b6f9f6ac8e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 7 Apr 2008 11:51:00 +0200 Subject: resume: Add support for resume_offset swap file suspend to disk. Parse cmdline for resume_offset, export it and pass it to the klibc resume binary. Based on a patch by Alan Jenkins . Bonus small codingstyle clean up of local-premount/resume. --- init | 4 ++++ scripts/local-premount/resume | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/init b/init index 3a93ef8..70f4384 100755 --- a/init +++ b/init @@ -50,6 +50,7 @@ export rootmnt=/root export debug= export panic= export blacklist= +export resume_offset= # Parse command line options for x in $(cat /proc/cmdline); do @@ -97,6 +98,9 @@ for x in $(cat /proc/cmdline); do resume=*) RESUME="${x#resume=}" ;; + resume_offset=*) + resume_offset="${x#resume_offset=}" + ;; noresume) noresume=y ;; diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index d997f81..6bf95e5 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -28,11 +28,13 @@ case $resume in ;; esac -if [ ! -e "${resume}" ]; then - exit 0 -fi +[ ! -e "${resume}" ] && exit 0 + +[ ! -e /sys/power/resume ] && exit 0 -if [ -e /sys/power/resume ]; then - # hardcode path, uswsusp ships an resume binary too +# hardcode path, uswsusp ships an resume binary too +if [ -n "${resume_offset}" ]; then + /bin/resume ${resume} ${resume_offset} +else /bin/resume ${resume} fi -- cgit v1.2.3 From 7e5cad4b55f4e3ca20bb0f4dbaeaf3d6b9e7b8d7 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 2 Jul 2008 16:50:14 +0200 Subject: init: Remove extra ellipses log_begin_msg already puts ... at the end of the stuff it prints, so no need to have it in there explicitly. Signed-off-by: martin f. krafft Signed-off-by: maximilian attems --- init | 4 ++-- scripts/local | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/init b/init index 885f240..4c72eab 100755 --- a/init +++ b/init @@ -157,7 +157,7 @@ maybe_break top run_scripts /scripts/init-top maybe_break modules -log_begin_msg "Loading essential drivers..." +log_begin_msg "Loading essential drivers" load_modules log_end_msg @@ -167,7 +167,7 @@ run_scripts /scripts/init-premount [ "$quiet" != "y" ] && log_end_msg maybe_break mount -log_begin_msg "Mounting root file system..." +log_begin_msg "Mounting root file system" . /scripts/${BOOT} parse_numeric ${ROOT} mountroot diff --git a/scripts/local b/scripts/local index b55212e..d28917b 100644 --- a/scripts/local +++ b/scripts/local @@ -34,7 +34,7 @@ mountroot () # 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..." + log_begin_msg "Waiting for root file system" # Default delay is 180s if [ -z "${ROOTDELAY}" ]; then -- cgit v1.2.3 From fc24059a296ecba82475debde0eff2330c92a2cd Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 2 Jul 2008 16:50:15 +0200 Subject: Wait for udevsettle after $BOOT-top scripts ran udev may be busy creating links for the root device by the time mountroot is called. udevsettle makes sure these are processed. I thus call udevsettle with a timeout of 10 seconds after the $BOOT-top scripts have run and before the ROOTDELAY hack kicks in. I thought about doing this with a local-top script instead, but there is no way to ensure that it'll run last; cryptsetup uses a hack to make sure it runs last, if we also use the same hack, there'll be a dependency loop. Signed-off-by: martin f. krafft Signed-off-by: maximilian attems --- scripts/functions | 9 +++++++++ scripts/local | 2 ++ scripts/nfs | 2 ++ 3 files changed, 13 insertions(+) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index d36884c..558f521 100644 --- a/scripts/functions +++ b/scripts/functions @@ -313,3 +313,12 @@ configure_networking() . /tmp/net-*.conf fi } + +wait_for_udev() +{ + if [ -x "$(command -v udevsettle)" ]; then + [ "$quiet" != "y" ] && log_begin_msg "Waiting for udev to process events" + udevsettle ${1:+--timeout=$1} + [ "$quiet" != "y" ] && log_end_msg + fi +} diff --git a/scripts/local b/scripts/local index d28917b..dc0745d 100644 --- a/scripts/local +++ b/scripts/local @@ -31,6 +31,8 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg + wait_for_udev 10 + # 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 diff --git a/scripts/nfs b/scripts/nfs index b9c2522..435d2d0 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -59,6 +59,8 @@ mountroot() # For DHCP modprobe af_packet + wait_for_udev 10 + # Default delay is around 180s # FIXME: add usplash_write info if [ -z "${ROOTDELAY}" ]; then -- cgit v1.2.3 From b12197b4d9f01575b897e7a3b653363d926927b8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 00:29:46 +0200 Subject: wait_for_udev(): simplify, no need for logging. add small comment on top, what for we need it. Signed-off-by: maximilian attems --- scripts/functions | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 558f521..c29a314 100644 --- a/scripts/functions +++ b/scripts/functions @@ -314,11 +314,9 @@ configure_networking() fi } +# Wait for queued kernel/udev events wait_for_udev() { - if [ -x "$(command -v udevsettle)" ]; then - [ "$quiet" != "y" ] && log_begin_msg "Waiting for udev to process events" - udevsettle ${1:+--timeout=$1} - [ "$quiet" != "y" ] && log_end_msg - fi + [ -x "$(command -v udevsettle)" ] && return 0 + udevsettle ${1:+--timeout=$1} } -- cgit v1.2.3 From b1c5ca97da3bf6053412f1e159db09a48b44a6c5 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 01:46:31 +0200 Subject: Merge more meaningful text for no root device panic from Ubuntu. Debian users were pasting that without getting the real trouble, thanks for the better rephrasing. --- scripts/local | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index dc0745d..85d62af 100644 --- a/scripts/local +++ b/scripts/local @@ -87,9 +87,12 @@ mountroot () fi ;; esac - echo "ALERT! ${ROOT} does not exist. Dropping to a shell!" - echo " Check your root= boot argument (cat /proc/cmdline)" - panic " Check for missing modules (cat /proc/modules), or device files (ls /dev)" + echo "Gave up waiting for root device. Common problems:" + echo " - Boot args (cat /proc/cmdline)" + echo " - Check rootdelay= (did the system wait long enough?)" + echo " - Check root= (did the system wait for the right device?)" + echo " - Missing modules (cat /proc/modules; ls /dev)" + panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done # Get the root filesystem type if not set -- cgit v1.2.3 From 72a013043b785642d125bcba6698b460f82e97f2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 02:03:23 +0200 Subject: add boot script loading ide-generic on all_generic_ide cmdline thanks to Frans Pop for report, idea stolen from Ubuntu, adapted their boot script same boot param. closes: #485786 Signed-off-by: maximilian attems --- scripts/init-top/all_generic_ide | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/init-top/all_generic_ide (limited to 'scripts') diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide new file mode 100644 index 0000000..28b519a --- /dev/null +++ b/scripts/init-top/all_generic_ide @@ -0,0 +1,22 @@ +#!/bin/sh + +PREREQ="" +prereqs() +{ + echo "$PREREQ" +} +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +for x in $(cat /proc/cmdline); do + case ${x} in + all_generic_ide) + modprobe ide-generic + ;; + esac +done -- cgit v1.2.3 From 02def425ba404c5cde8c8e59207961d6b3fddd8f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 02:10:10 +0200 Subject: usplash pulsates: drop code to increment a progress bar after each message. ubuntu sync --- scripts/functions | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index c29a314..a004c9e 100644 --- a/scripts/functions +++ b/scripts/functions @@ -35,23 +35,6 @@ log_end_msg() /sbin/usplash_write "SUCCESS ok" fi _log_msg "Done." - update_progress -} - -update_progress() -{ - [ -d /dev/.initramfs ] || return - - if [ -z "$PROGRESS_STATE" ]; then - export PROGRESS_STATE=0 - fi - - PROGRESS_STATE=$(($PROGRESS_STATE + 1)) - echo "PROGRESS_STATE=${PROGRESS_STATE}" > /dev/.initramfs/progress_state - - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "PROGRESS $PROGRESS_STATE" - fi } panic() -- cgit v1.2.3 From 6244406a9cd195d2867c72662ce632c2a2d2f653 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 02:46:04 +0200 Subject: release 0.92d --- debian/changelog | 17 +++++++++++++++++ scripts/init-top/all_generic_ide | 0 2 files changed, 17 insertions(+) mode change 100644 => 100755 scripts/init-top/all_generic_ide (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index 90e50a6..2d8029b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,20 @@ +initramfs-tools (0.92d) unstable; urgency=low + + * Ubuntu merge + - More meaningful text for no root device panic from Ubuntu. + - Add virtio_pci, udf for MODULES=most root device support. + - usplash pulsates: drop code to increment a progress bar after + 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 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) + * debian/initramfs-tools.preinst: try with different vol_id pathes. + + -- maximilian attems Sat, 05 Jul 2008 02:36:10 +0200 + initramfs-tools (0.92c) unstable; urgency=low [ maximilian attems ] diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide old mode 100644 new mode 100755 -- cgit v1.2.3 From 6b01325aadd949b451dd201667a3f0d088337208 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Fri, 8 Aug 2008 03:49:51 +0100 Subject: make log_begin_msg not emit trailing newline Please make log_begin_msg not emit a trailing newline - this makes the non- "quiet" output cleaner and results in half as many lines being emitted. For example: Begin: Finding root filesytem ... Done. Becomes: Begin: Finding root filesytem ... done. Patch attached - it also adds a space and alters the case of "done" for symmetry. This would be especially useful in Debian Live where we show a large number of these messages by default. (closes: #494257) --- scripts/functions | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index a004c9e..5a896f1 100644 --- a/scripts/functions +++ b/scripts/functions @@ -3,22 +3,22 @@ _log_msg() { if [ "$quiet" = "y" ]; then return; fi - echo "$@" + printf "$@" } log_success_msg() { - _log_msg "Success: $@" + _log_msg "Success: $@\n" } log_failure_msg() { - _log_msg "Failure: $@" + _log_msg "Failure: $@\n" } log_warning_msg() { - _log_msg "Warning: $@" + _log_msg "Warning: $@\n" } log_begin_msg() @@ -26,7 +26,7 @@ log_begin_msg() if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "TEXT $@" fi - _log_msg "Begin: $@ ..." + _log_msg "Begin: $@ ... " } log_end_msg() @@ -34,7 +34,7 @@ log_end_msg() if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "SUCCESS ok" fi - _log_msg "Done." + _log_msg "done.\n" } panic() -- cgit v1.2.3 From 88643d542f0be841f840d749d11f5e969b2cb0fe Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 15 Aug 2008 18:51:00 +0200 Subject: wait_for_udev: s/udevsettle/udevadm/ for upgrades after Lenny after lenny the symlink of udev is meant to be gone, support partial upgrades from lenny. --- scripts/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 5a896f1..5d81afd 100644 --- a/scripts/functions +++ b/scripts/functions @@ -300,6 +300,6 @@ configure_networking() # Wait for queued kernel/udev events wait_for_udev() { - [ -x "$(command -v udevsettle)" ] && return 0 - udevsettle ${1:+--timeout=$1} + [ -x "$(command -v udevadm)" ] && return 0 + udevadm settle ${1:+--timeout=$1} } -- cgit v1.2.3 From 115d0aa6a71e89888765fac12c5135c97aef12c6 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 1 Sep 2008 11:22:34 -0400 Subject: Fix parse_numeric() to ignore non hex root string prefixes On OLPC machines, root is a nand device that is mounted as mtd0 (it is neither a block device nor a char device). The arguments passed to the kernel are "ro root=mtd0 rootfstype=jffs2". Unfortunately, attempting to use an initrd based upon initramfs-tools on such a machine results in a kernel panic and a syntax error. Begin: Mounting root file system ... /init: line 172: syntax error: 0xmtd0 The probably appears to be in parse_numeric(); the init scripts assume that normal devices are always prefixed with /, and root= strings that aren't are raw device numbers (prefixing them with 0x). I'm not sure if there are other devices similar to mtd that don't begin with a /. How about something like the following patch? It's not foolproof, but it at least ignores things that can't possibly be hex strings. fixes partially #497133 --- scripts/functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 5d81afd..299c29c 100644 --- a/scripts/functions +++ b/scripts/functions @@ -242,11 +242,14 @@ parse_numeric() { minor=${1#*:} major=${1%:*} ;; - *) + [A-Fa-f0-9]*) value=$(( 0x${1} )) minor=$(( ${value} % 256 )) major=$(( ${value} / 256 )) ;; + *) + return + ;; esac mknod -m 600 /dev/root b ${major} ${minor} -- cgit v1.2.3 From f15c3530c08e95f3270cbd073b5f83df81f06bbf Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 14 Dec 2008 18:59:49 +0100 Subject: scripts/functions: Call ipconfig with a one-minute timeout rather than waiting forever (LP: #182940). --- scripts/functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 299c29c..560184b 100644 --- a/scripts/functions +++ b/scripts/functions @@ -268,13 +268,13 @@ configure_networking() ;; ""|on|any) # Bring up device - ipconfig ${DEVICE} + ipconfig -t 60 ${DEVICE} ;; dhcp|bootp|rarp|both) - ipconfig -c ${IPOPTS} -d ${DEVICE} + ipconfig -t 60 -c ${IPOPTS} -d ${DEVICE} ;; *) - ipconfig -d $IPOPTS + ipconfig -t 60 -d $IPOPTS # grab device entry from ip option NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} -- cgit v1.2.3 From ca53be13ebbb8e00ead2d170c10e66cdb6fc91f3 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 14 Dec 2008 19:11:41 +0100 Subject: scripts/functions: Wrong check for udevadm in functions --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 560184b..758dd4f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -303,6 +303,6 @@ configure_networking() # Wait for queued kernel/udev events wait_for_udev() { - [ -x "$(command -v udevadm)" ] && return 0 + [ -x "$(command -v udevadm)" ] || return 0 udevadm settle ${1:+--timeout=$1} } -- cgit v1.2.3 From e0ff2bedbd4da0c0638c21b2c2736d9a47415f73 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 14 Dec 2008 19:19:32 +0100 Subject: scripts/functions: fix not set break variable thanks martin f krafft closes: #502058 --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 758dd4f..85a5138 100644 --- a/scripts/functions +++ b/scripts/functions @@ -55,7 +55,7 @@ panic() maybe_break() { - if [ "${break}" = "$1" ]; then + if [ "${break:-}" = "$1" ]; then panic "Spawning shell within the initramfs" fi } -- cgit v1.2.3 From 87461ea463b943a9ccff96b2b36fcfbd66691a1a Mon Sep 17 00:00:00 2001 From: Michal Pokrywka Date: Mon, 13 Oct 2008 02:08:52 +0200 Subject: framebuffer: Add support for uvesafb Uvesafb framebuffer driver needs v86d userspace program but when fb driver is modprobed at init-top stage of initrd, /dev/zero and /dev/mem are missing because udev have not been run yet. --- scripts/init-top/framebuffer | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 21a6b19..4375dca 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -72,11 +72,16 @@ for x in $(cat /proc/cmdline); do esac done -# Map command line name to module name +# Map command line name to module name and other tweaks case ${FB} in matroxfb) FB=matroxfb_base ;; +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 + [ -e /dev/mem ] || mknod -m 0640 /dev/mem c 1 1 + ;; *) ;; esac -- cgit v1.2.3 From 7e82cbb4ff425ef0201e215566f17826311197c1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 15 Dec 2008 11:31:15 +0100 Subject: Revert "framebuffer: Let udev create fb devices." udev isn't started at this point and therefore can't create framebuffer devices. This causes usplash not to run on PS3. set sane permissions will making the char files. This reverts commit 0aec8b0c22b7622841c4ab7a3b492b4d2657456f. --- scripts/init-top/framebuffer | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 4375dca..0ed798e 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -90,3 +90,13 @@ if [ -n "${FB}" ]; then modprobe fbcon modprobe ${FB} ${OPTS} fi + +if [ -e /proc/fb ]; then + while read fbno desc; do + if [ $(($fbno < 32)) ]; then + mknod -m 0640 /dev/fb${fbno} c 29 ${fbno} + fi + done < /proc/fb +else + mknod -m 0640 /dev/fb0 c 29 0 +fi -- cgit v1.2.3 From 6eac119e508d7de61dcfd8c1214ab834a8ce8075 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 15 Dec 2008 14:52:31 +0100 Subject: scripts/functions: comment fix path to moved linux-2.6 Documentation. --- scripts/functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 85a5138..697ce89 100644 --- a/scripts/functions +++ b/scripts/functions @@ -261,7 +261,8 @@ configure_networking() # networking already configured thus bail out [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0 - # support ip options see linux sources Documentation/nfsroot.txt + # support ip options see linux sources + # Documentation/filesystems/nfsroot.txt case ${IPOPTS} in none|off) # Do nothing -- cgit v1.2.3 From bda6f1ad11516683dc6cac2bc1196c590bd38806 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Fri, 17 Oct 2008 17:56:22 -0400 Subject: fix redboot partition support Fix buglet in parse_numeric where *:* would match mtd:root. We only want to match numbers. This fixes redboot partition support. Signed-off-by: Andres Salomon --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 697ce89..ca2b831 100644 --- a/scripts/functions +++ b/scripts/functions @@ -238,7 +238,7 @@ parse_numeric() { /*) return ;; - *:*) + [0-9]*:[0-9]*) minor=${1#*:} major=${1%:*} ;; -- cgit v1.2.3 From b11f308d10ff9de4bb2a8fef44e1ec98d5e950e7 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 18 Dec 2008 00:40:36 +0100 Subject: all_generic_ide: Also parse boolean bootoption d-i uses to pass it with the value 1 Reported-by: Frans Pop --- scripts/init-top/all_generic_ide | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide index 28b519a..3274ee8 100755 --- a/scripts/init-top/all_generic_ide +++ b/scripts/init-top/all_generic_ide @@ -18,5 +18,10 @@ for x in $(cat /proc/cmdline); do all_generic_ide) modprobe ide-generic ;; + all_generic_ide=*) + if [ ${x#all_generic_ide=} ]; then + modprobe ide-generic + fi + ;; esac done -- cgit v1.2.3 From 115134f07a0dd042355a2a6fb5a5ca987b000f5d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 7 Jan 2009 15:12:05 +0100 Subject: configure_networking: Raise ipconfig timeout to 180 seconds. in 0.92m, the timeout for ipconfig in scripts/functions was set to 60 seconds. This broke our iscsi-rootfs setups. It took me a while to debug this, but it seems that 60 seconds is not enough for switches which have spanning-tree enabled, they need some more time before they take up a port, in our case between 62 and 65 seconds. (closes: #511085) --- scripts/functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index ca2b831..f715e68 100644 --- a/scripts/functions +++ b/scripts/functions @@ -269,13 +269,13 @@ configure_networking() ;; ""|on|any) # Bring up device - ipconfig -t 60 ${DEVICE} + ipconfig -t 180 ${DEVICE} ;; dhcp|bootp|rarp|both) - ipconfig -t 60 -c ${IPOPTS} -d ${DEVICE} + ipconfig -t 180 -c ${IPOPTS} -d ${DEVICE} ;; *) - ipconfig -t 60 -d $IPOPTS + ipconfig -t 180 -d $IPOPTS # grab device entry from ip option NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} -- cgit v1.2.3 From 69f3bc844364feff08f6e5ccdfc0599f9f4088cb Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 5 Feb 2009 19:59:17 +0100 Subject: nuke old lvm hook scripts since Lenny lvm2 ships it's own hooks scripts, no need to dup. --- hooks/legacylvm | 28 ------------------- scripts/local-top/lvm | 74 --------------------------------------------------- 2 files changed, 102 deletions(-) delete mode 100755 hooks/legacylvm delete mode 100755 scripts/local-top/lvm (limited to 'scripts') 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/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 -- cgit v1.2.3 From d144b88e29e390c43d7ce15f8cb0548c0ae576e1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 13 Feb 2009 17:18:59 +0100 Subject: thermal boot script: Don't load thermal+fan on acpi=off (closes: #514997) Reported-by: Michael Prokop --- scripts/init-premount/thermal | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts') diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index aa146ec..0215edb 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -31,6 +31,13 @@ powerpc|ppc64) modprobe windfarm_smu_sensors ;; i386|amd64|ia64) + for x in $(cat /proc/cmdline); do + case ${x} in + acpi=off) + exit 0 + ;; + esac + done modprobe fan modprobe thermal ;; -- cgit v1.2.3 From 13df18822a697053e10e8f42397e5237a15590f6 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 14 Oct 2008 18:04:09 -0400 Subject: allow root=mtd0 to be used; skip root checks if ROOT doesn't start with /dev. The attached patch is needed for booting with root=mtd0. Basically, the init scripts assume the root device should have a special device file somewhere, and if not will wait for it to appear. This patch changes it so that it only waits for a device file to appear if $ROOT starts with "/dev". In the case of things like ROOT=LABEL=foo, the init scripts will translate that to a device. With ROOT=mtd0, the init scripts will not check for a device, and will successfully mount the root filesystem. Signed-off-by: Andres Salomon --- scripts/local | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index 85d62af..b6bd192 100644 --- a/scripts/local +++ b/scripts/local @@ -24,8 +24,7 @@ get_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,6 +32,12 @@ mountroot () wait_for_udev 10 + # 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 @@ -94,6 +99,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 -- cgit v1.2.3 From 9e5ff69508479c10548e0fcf4d6f3ee043cff1fe Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 17 Feb 2009 18:12:56 +0100 Subject: scripts/local-premount/resume: Fix resume with LABEL containing '/'. do the same dance here, same code, just slightly renamed variables. --- scripts/local-premount/resume | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 6bf95e5..b2b0e1d 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -20,10 +20,37 @@ 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 [ -x "$(command -v sed)" ]; 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 + if [ -z "${newresume}" ]; then + newresume="${s}" + else + newresume="${newresume}\\x2f${s}" + fi + done + unset IFS + resume="${newresume}" + fi + esac + resume="/dev/disk/by-label/${resume}" ;; - UUID=*) +UUID=*) resume="/dev/disk/by-uuid/${resume#UUID=}" ;; esac -- cgit v1.2.3 From b458a270b7335b9a8b137ec0ac69b21a33bf58c3 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 23 Feb 2009 15:10:21 +0100 Subject: init: export ip root param for configure_networking() while at it cleanup the variable name that came due to legacy naming nfsopts in a very early initramfs-tools release. "The local-top/iscsi initramfs integration script uses the configure_networking function, which depends on the IPOPTS environmental variable set by the init script. However, this variable is not available, because it's not exported from init, and local-top/iscsi is not sourced but executed. Thus static IP configuration on the kernel command line is not communicated to the script." (closes: #516746) Reported-by: Ferenc Wagner --- init | 4 +++- scripts/functions | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/init b/init index ee006b5..a149c2b 100755 --- a/init +++ b/init @@ -35,6 +35,7 @@ export ROOT= export ROOTDELAY= export ROOTFLAGS= export ROOTFSTYPE= +export IP= export break= export init=/sbin/init export quiet=n @@ -117,7 +118,7 @@ for x in $(cat /proc/cmdline); do NFSROOT="${x#nfsroot=}" ;; ip=*) - IPOPTS="${x#ip=}" + IP="${x#ip=}" ;; boot=*) BOOT=${x#boot=} @@ -242,6 +243,7 @@ unset ROOTFLAGS unset ROOTFSTYPE unset ROOTDELAY unset ROOT +unset IP unset blacklist unset break unset noresume diff --git a/scripts/functions b/scripts/functions index f715e68..c024eeb 100644 --- a/scripts/functions +++ b/scripts/functions @@ -263,7 +263,7 @@ configure_networking() # support ip options see linux sources # Documentation/filesystems/nfsroot.txt - case ${IPOPTS} in + case ${IP} in none|off) # Do nothing ;; @@ -272,14 +272,14 @@ configure_networking() ipconfig -t 180 ${DEVICE} ;; dhcp|bootp|rarp|both) - ipconfig -t 180 -c ${IPOPTS} -d ${DEVICE} + ipconfig -t 180 -c ${IP} -d ${DEVICE} ;; *) - ipconfig -t 180 -d $IPOPTS + ipconfig -t 180 -d $IP # grab device entry from ip option - NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} - if [ "${NEW_DEVICE}" != "${IPOPTS}" ]; then + NEW_DEVICE=${IP#*:*:*:*:*:*} + if [ "${NEW_DEVICE}" != "${IP}" ]; then NEW_DEVICE=${NEW_DEVICE%:*} else # wrong parse, possibly only a partial string -- cgit v1.2.3 From 7e3f1f2ef6477cf9ab93793d12168ee9ae8c5571 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Tue, 18 Mar 2008 11:46:44 -0400 Subject: init-top/framebuffer: ignore blacklist for forced vga= usage. DO NOT USE -Qb for framebuffer. Blank ttys when using vesafb (vga=xxx) LP: #129910 [ s/-Q/-q/ for modprobe options -maks ] --- scripts/init-top/framebuffer | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 0ed798e..c5c18b9 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -87,8 +87,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 -- cgit v1.2.3 From e184c8c2a9ad4520cf0cf4536301c6ae6206e911 Mon Sep 17 00:00:00 2001 From: Maik Zumstrull Date: Sat, 24 Mar 2007 23:48:16 +0100 Subject: init-top/framebuffer: Load intel-agp for intelfb After further experimentation, I discovered additional problems that my first patch did not address, namely that 1) Some FB drivers need the AGP subsystem up and running before they are loaded and 2) intelfb needs intel-agp.ko, but does not have a dependency on it. intelfb does not actually *work* on my testsystem after this (it crashes), but unlike with plain initramfs-tools, it loads (and prints something useful if loaded with the probeonly option). I'll try to find out why it fails to work tomorrow; it's probably an unrelated issue. [ make the patch applyable, probably whitespace damaged, fix comments, no need to pass -q to modprobe that is set globaly -maks ] (closes: #416063, #455876) Signed-off-by: maximilian attems --- scripts/init-top/framebuffer | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index c5c18b9..37456ae 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -72,11 +72,15 @@ 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) + # 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 -- cgit v1.2.3 From f3049298fec182252dc76c75202454bb324bc682 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 2 Apr 2009 01:54:46 +0200 Subject: init-top/framebuffer: syntax fix. fix wrong merge of e184c8c2a9ad4520cf0cf4536301c6ae6206e911 scripts/init-top/framebuffer: 84: Syntax error: ")" unexpected (expecting ";;") --- scripts/init-top/framebuffer | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index 37456ae..e0028f7 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -81,6 +81,7 @@ matroxfb) intelfb|i810fb) # 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 -- cgit v1.2.3 From 97f26c6e0d61a4ff700b8f79c61a41320f317e2e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 2 Apr 2009 12:41:17 +0200 Subject: mkinitramfs: Allow dots in boot and script filenames. the regex was overly severe not allowing dots althoug they are useful as word ending. based on a patch in launchpad, that didn't get all occurences right, but was a good start. (LP: #305837) --- mkinitramfs | 4 ++-- scripts/functions | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/mkinitramfs b/mkinitramfs index 5d38f16..8f8e428 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -208,14 +208,14 @@ 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}")/" diff --git a/scripts/functions b/scripts/functions index c024eeb..b813529 100644 --- a/scripts/functions +++ b/scripts/functions @@ -74,7 +74,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 @@ -106,7 +106,7 @@ reduce_satisfied() for rs_y in ${deplist}; do # only allow variable name chars case ${rs_y} in - *[![:alnum:]_]*) + *[![:alnum:]_.]*) continue ;; esac -- cgit v1.2.3 From d703b8ca26ac5230d7ffeae1891334791d8dab31 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 3 Apr 2009 14:48:44 +0200 Subject: cleanup LABEL handling code make it more concise: * use POSIX ${parameter:+word} * replace *[/]*) by just */*) * test exit code of command -v rather then running test -x on it while we are at it fix another command -v usage in scripts/functions. Reviewed-by: Colin Watson Signed-off-by: maximilian attems --- init | 10 +++------- scripts/functions | 2 +- scripts/local-premount/resume | 10 +++------- 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'scripts') diff --git a/init b/init index a149c2b..e8c97a5 100755 --- a/init +++ b/init @@ -67,8 +67,8 @@ for x in $(cat /proc/cmdline); do # support any / in LABEL= path (escape to \x2f) case "${ROOT}" in - *[/]*) - if [ -x "$(command -v sed)" ]; then + */*) + if command -v sed >/dev/null 2>&1; then ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')" else if [ "${ROOT}" != "${ROOT#/}" ]; then @@ -80,11 +80,7 @@ for x in $(cat /proc/cmdline); do IFS='/' newroot= for s in $ROOT; do - if [ -z "${newroot}" ]; then - newroot="${s}" - else - newroot="${newroot}\\x2f${s}" - fi + newroot="${newroot:+${newroot}\\x2f}${s}" done unset IFS ROOT="${newroot}" diff --git a/scripts/functions b/scripts/functions index b813529..77de8f3 100644 --- a/scripts/functions +++ b/scripts/functions @@ -304,6 +304,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/local-premount/resume b/scripts/local-premount/resume index b2b0e1d..11acfc7 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -25,8 +25,8 @@ LABEL=*) # support any / in LABEL= path (escape to \x2f) case "${resume}" in - *[/]*) - if [ -x "$(command -v sed)" ]; then + */*) + if command -v sed >/dev/null 2>&1; then resume="$(echo ${resume} | sed 's,/,\\x2f,g')" else if [ "${resume}" != "${resume#/}" ]; then @@ -38,11 +38,7 @@ LABEL=*) IFS='/' newresume= for s in $resume; do - if [ -z "${newresume}" ]; then - newresume="${s}" - else - newresume="${newresume}\\x2f${s}" - fi + newresume="${newresume:+${newresume}\\x2f}${s}" done unset IFS resume="${newresume}" -- cgit v1.2.3 From 4a4dda7aff43b9fdb52633c1af877fa69884fc33 Mon Sep 17 00:00:00 2001 From: "Aaron M. Ucko" Date: Mon, 15 Jun 2009 19:14:00 -0400 Subject: scripts/init-top/framebuffer: i915 needs intel-agp too The i915 DRM module doubles as a framebuffer of sorts, at least in kernel mode-setting setups; like its cousins intelfb and i810fb, it effectively requires intel-agp despite not actually using any of its symbols. As such, could you please arrange for scripts/init-top/framebuffer to give it the same treatment, per the following patch?: (closes: #533258) Signed-off-by: maximilian attems --- scripts/init-top/framebuffer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index e0028f7..678ffdf 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -78,7 +78,7 @@ matroxfb) # Map command line name to module name FB=matroxfb_base ;; -intelfb|i810fb) +intelfb|i810fb|i915) # Needs AGP driver loaded modprobe intel-agp ;; -- cgit v1.2.3 From c5e39cd1cb1dc9f6a18de07e137ef47ecc8f8cc6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 29 Jul 2009 15:05:48 +0200 Subject: nuke thermal hooks thrive for a smaller initramfs, were loading of the modules is so fast that acpi should be loaeded by udev after init(8) call. Signed-off-by: maximilian attems --- hooks/thermal | 46 ------------------------------------------- scripts/init-premount/thermal | 44 ----------------------------------------- 2 files changed, 90 deletions(-) delete mode 100755 hooks/thermal delete mode 100755 scripts/init-premount/thermal (limited to 'scripts') diff --git a/hooks/thermal b/hooks/thermal deleted file mode 100755 index aa10ebf..0000000 --- a/hooks/thermal +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Hooks for loading thermal bits into the initramfs - -. /usr/share/initramfs-tools/hook-functions - -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 - manual_add_modules windfarm_lm75_sensor - manual_add_modules windfarm_max6690_sensor - manual_add_modules windfarm_pid - manual_add_modules windfarm_pm112 - manual_add_modules windfarm_pm81 - manual_add_modules windfarm_pm91 - manual_add_modules windfarm_smu_controls - manual_add_modules windfarm_smu_sat - manual_add_modules windfarm_smu_sensors - manual_add_modules i2c-powermac - ;; -i386|amd64|ia64) - manual_add_modules fan - manual_add_modules thermal - ;; -esac diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal deleted file mode 100755 index 0215edb..0000000 --- a/scripts/init-premount/thermal +++ /dev/null @@ -1,44 +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) - for x in $(cat /proc/cmdline); do - case ${x} in - acpi=off) - exit 0 - ;; - esac - done - modprobe fan - modprobe thermal - ;; -esac -- cgit v1.2.3 From db24ed6ec7887631c05ce0d51c53c8c2cb9c507a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 29 Jul 2009 15:46:48 +0200 Subject: nuke framebuffer boot script fb should be loaded after initramfs by init to have a beautiful userland. allows faster boot not to try parsing crazy things with only posix sh at our hands. this will need a README.DEBIAN section as noone is now currently loading fbcon. Signed-off-by: maximilian attems --- scripts/init-top/framebuffer | 108 ------------------------------------------- 1 file changed, 108 deletions(-) delete mode 100755 scripts/init-top/framebuffer (limited to 'scripts') diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer deleted file mode 100755 index 678ffdf..0000000 --- a/scripts/init-top/framebuffer +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh - -PREREQ="" -prereqs() -{ - echo "$PREREQ" -} -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - - -# The options part of the kernel "video=" argument (i.e. everyting -# after "video=:") has very inconsistent rules. -# -# Generally the following applies: -# 1) options are comma-separated -# 2) options can be in either of these three forms: -# =, :, . -# 3) the "mode" option has the form x[M][R][-][@][i][m] -# and may or may not start with "mode=" -# -# When the options are used with modules, they need to be space-separated -# and the following conversions are needed: -# : -> = -# -> =1 -# -> mode= -parse_video_opts() -{ - local OPTS="$1" - local IFS="," - - # Must be a line like video=:,[opt2]... - if [ "${OPTS}" = "${OPTS%%:*}" ]; then - return - fi - OPTS="${OPTS#*:}" - for opt in ${OPTS}; do - # Already in the "=" form - if [ "${opt}" != "${opt#*=}" ]; then - echo -n "$opt " - # In the ":" form - elif [ "${opt}" != "${opt#*:}" ]; then - echo -n "${opt%:*}=${opt#*:} " - # Presumably a modevalue without the "mode=" prefix - elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then - echo -n "mode=$opt " - # Presumably a boolean - else - echo -n "${opt}=1 " - fi - done -} - -FB="" -OPTS="" - -for x in $(cat /proc/cmdline); do - case ${x} in - vga=*) - FB="vesafb"; - OPTS=""; - ;; - video=*) - FB=${x#*=} - FB="${FB%%:*}" - OPTS="$(parse_video_opts "${x}")" - esac -done - -# 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 - [ -e /dev/mem ] || mknod -m 0640 /dev/mem c 1 1 - ;; -*) - ;; -esac - -if [ -n "${FB}" ]; then - unset MODPROBE_OPTIONS - modprobe -q fbcon - modprobe -q ${FB} ${OPTS} -fi - -if [ -e /proc/fb ]; then - while read fbno desc; do - if [ $(($fbno < 32)) ]; then - mknod -m 0640 /dev/fb${fbno} c 29 ${fbno} - fi - done < /proc/fb -else - mknod -m 0640 /dev/fb0 c 29 0 -fi -- cgit v1.2.3 From 919c099e12308729a9a6bc141eab1f05532c93f8 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sun, 16 Aug 2009 21:08:40 +0200 Subject: blacklist boot hook write to /etc/modprobe.d/initramfs.conf Newer modprobe will only look at .conf files. (closes: #541864) Signed-off-by: maximilian attems --- scripts/init-premount/blacklist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/init-premount/blacklist b/scripts/init-premount/blacklist index 1dd9dbc..2164906 100755 --- a/scripts/init-premount/blacklist +++ b/scripts/init-premount/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 -- cgit v1.2.3 From 90c19d7bac748efdaab0355d4aa3a25b579bc0f2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 26 Jan 2010 21:05:35 -0500 Subject: scripts/local: avoid mount -t unknown Since fstype does not support btrfs (#548047), and since udev 150, vol_id no longer exists, get_fstype sets FSTYPE to "unknown", and then the root filesystem is mounted using "mount -t unknown /dev/hda2 /root". Of course, that fails, and with a really unhelpful error message ("mount: device doesnot exist") Why not just skip the -t parameter if FSTYPE=unknown? Mounting the root fs was going to fail, so letting mount autodetect the fs type can't be worse. Attached patch does that and got my root on btrfs working. Workaround: boot with rootfstype=btrfs Signed-off-by: maximilian attems --- scripts/local | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index b6bd192..7bc740f 100644 --- a/scripts/local +++ b/scripts/local @@ -127,7 +127,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 -- cgit v1.2.3 From 49337bdc94ed5bc176338cfa793a868fcd33784c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 30 Jan 2010 19:54:13 +0100 Subject: scripts/local: Use blkid as backup fstype detection if blkid is on initramfs use it. Thanks to Joey Hess for calling syntax. Signed-off-by: maximilian attems --- scripts/local | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index 7bc740f..feead1c 100644 --- a/scripts/local +++ b/scripts/local @@ -11,7 +11,9 @@ get_fstype () # 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 + 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=$? -- cgit v1.2.3 From 323005e4b8468ab9f7151d883d3df7b75f130911 Mon Sep 17 00:00:00 2001 From: Ferenc Wagner Date: Tue, 9 Feb 2010 17:16:04 +0100 Subject: initramfs-tools: make the panic argument available in the rescue shell Sometimes one misses the error message printed by the panic helper function, for example when attaching a serial console after the fact, or if kernel messages resulting from udev activity obscure or scroll it away. Please consider adding some facility like the attached patch. Thanks, Feri. (closes: #569033) Signed-off-by: maximilian attems --- initramfs-tools.8 | 4 ++++ scripts/functions | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 2ba022a..55d413a 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -504,6 +504,10 @@ set according relevant boot option. \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 diff --git a/scripts/functions b/scripts/functions index 77de8f3..c34dd4a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -50,7 +50,7 @@ panic() modprobe i8042 modprobe atkbd echo $@ - PS1='(initramfs) ' /bin/sh -i /dev/console 2>&1 + REASON="$@" PS1='(initramfs) ' /bin/sh -i /dev/console 2>&1 } maybe_break() -- cgit v1.2.3 From 1bf31aaa5bc8bf53bf123d8d75a927c1a358171c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 22 Feb 2010 23:36:53 +0100 Subject: blacklist earlier at init-top stage as udev will start earlier, care to blacklist before it loads. Signed-off-by: maximilian attems --- scripts/init-premount/blacklist | 25 ------------------------- scripts/init-top/blacklist | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) delete mode 100755 scripts/init-premount/blacklist create mode 100755 scripts/init-top/blacklist (limited to 'scripts') diff --git a/scripts/init-premount/blacklist b/scripts/init-premount/blacklist deleted file mode 100755 index 2164906..0000000 --- a/scripts/init-premount/blacklist +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# sanity check -[ -z "${blacklist}" ] && exit 0 - -# write blacklist to modprobe.d -IFS=',' -for b in ${blacklist}; do - echo "blacklist $b" >> /etc/modprobe.d/initramfs.conf -done diff --git a/scripts/init-top/blacklist b/scripts/init-top/blacklist new file mode 100755 index 0000000..2164906 --- /dev/null +++ b/scripts/init-top/blacklist @@ -0,0 +1,25 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# sanity check +[ -z "${blacklist}" ] && exit 0 + +# write blacklist to modprobe.d +IFS=',' +for b in ${blacklist}; do + echo "blacklist $b" >> /etc/modprobe.d/initramfs.conf +done -- cgit v1.2.3 From 673abb77821433a67add61ac79d739c6cee9eee0 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Wed, 3 Feb 2010 22:48:07 -0800 Subject: configure_networking: support BOOTIF variable set by pxelinux updated patch against current master, using only shell, and with a cleaner method to convert BOOTF to a typical mac address. (closes: #567540) Signed-off-by: maximilian attems --- scripts/functions | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index c34dd4a..60cfc11 100644 --- a/scripts/functions +++ b/scripts/functions @@ -258,6 +258,42 @@ parse_numeric() { 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="$x:$bootif_mac" + 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 -- cgit v1.2.3 From df43f67500c9f3f1d9ad1e310173cf6babd85a61 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 25 Feb 2010 00:56:29 +0100 Subject: scripts/local: fix blkid invocation 49337bd looks bogus. It adds the test "[ command ... ]" but I think that should be just "command ..." Reporte-by: Ben Hutchings Signed-off-by: maximilian attems --- scripts/local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index feead1c..1474073 100644 --- a/scripts/local +++ b/scripts/local @@ -11,7 +11,7 @@ get_fstype () # vol_id 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 + 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) -- cgit v1.2.3 From 40b99bb35a81066aadbd13e663ffdf9d1a3ba2ad Mon Sep 17 00:00:00 2001 From: Anna Jonna Armannsdottir Date: Mon, 22 Mar 2010 14:51:55 +0000 Subject: configure_networking: Try repeatedly ipconfig with increasing timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here is a bug description and a patch. Please consider it. The patch solves a an LTSP client problem that arises when the clients are connected to Cisco switches that have spanning-tree calculations enabled. Also related to: http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=9c3ec61b1a5e2feaa8d9c6de737eaa00eb446a9c And http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=115134f07a0dd042355a2a6fb5a5ca987b000f5d Here in an extensive explaination: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/181258 Also in the following: I can report the same problem. A number of diskless clients go flawlessly through a PXE boot, then the net interface is brought down when the Linux kernel boots and suddenly, dhcp does not work anymore. Background research on the network: The clients are connected to Cisco switches. The configuration of the switches makes them run spanning-tree calculations. This usually takes some seconds but for large networks it can take up to 30 40 seconds. The network port on the switch is turned on, when this calculation has been finished. This is primarily a security measure. See also: http://networkers-online.com/blog/2008/08/what-is-bpdu-filter/ If this security measure is turned off, the client boots without problems. :) To debug the problem, the following boot line was used: kernel amd64/vmlinuz append ro initrd=amd64/initrd.img nbdport=2000 debug=100 break=1 ip=dhcp In my case, this causes a timeout as can be seen on the attached screenshots. The kernel loads the NIC module e1000e and reports the type of NIC et.c. The kernel time reported is 5.927 . The debug shows the following: configure_networking [ -n eth0 ] [-e /tmp/net-eth0.conf ] ipconfig -t 60 eth0 At about 6.4 in kernel time, the NIC module reports further about it's IRQ configuration. Two seconds (2 sec) later at about 8.56 the NIC module reports that the Link is up at 100 Mbps full duplex. Some milliseconds later it signals ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready . At this point in time, ipconfig is just waiting for an answer to the DHCP-discover that really was choked by the switch. Now this is an obvious flaw in the script. It would be much more reasonable to try repeatedly with increasing timouts. This would also be much more efficent. may I suggest the following timeouts: 4 8 16 30 60 The sum of this timeout is about 120 seconds. I did some testing with exponential timeout with 1 2 4 8 16 30 ... and it solved the problem, but it seems that ipconfig runs once additionally after it has actually done the job. I am running tests now with an exponent of n/1.5 instead of n. That would give a sequence of (ca) 2 3 4 6 9 16 25 36 64 100 Attached are a jpeg screenshot of the boot sequence and of course the patch. The patch is relative to the present git snapshot. -- Kindest Regards, Anna Jonna Ármannsdóttir, %& A: Because people read from top to bottom. Unix System Aministration, Computing Services, %& Q: Why is top posting bad? University of Iceland. Signed-off-by: maximilian attems --- scripts/functions | 64 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 26 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 60cfc11..f99cba4 100644 --- a/scripts/functions +++ b/scripts/functions @@ -299,33 +299,45 @@ configure_networking() # support ip options see linux sources # Documentation/filesystems/nfsroot.txt - case ${IP} in - none|off) - # Do nothing - ;; - ""|on|any) - # Bring up device - ipconfig -t 180 ${DEVICE} - ;; - dhcp|bootp|rarp|both) - ipconfig -t 180 -c ${IP} -d ${DEVICE} - ;; - *) - ipconfig -t 180 -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}" + # 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. + if [ -e /tmp/net-"${DEVICE}".conf ]; then + break; fi - ;; - esac + + 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 -- cgit v1.2.3 From c713fd9872c4b917d89df89ddbc6c471d52c67d8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 26 Mar 2010 20:35:13 +0100 Subject: panic: quote variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-by: Loïc Grenié Signed-off-by: maximilian attems --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index f99cba4..0ecb1d6 100644 --- a/scripts/functions +++ b/scripts/functions @@ -49,7 +49,7 @@ panic() fi modprobe i8042 modprobe atkbd - echo $@ + echo "$@" REASON="$@" PS1='(initramfs) ' /bin/sh -i /dev/console 2>&1 } -- cgit v1.2.3 From 7ea605d62c6fca441a40820a573a2e0ef704f183 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 4 Apr 2010 02:15:17 +0200 Subject: Use ata_generic driver on all_generic_ide bootarg [ merge from 0.92bubuntu1 ] Reported-by: Ben Hutchings Signed-off-by: maximilian attems --- scripts/init-top/all_generic_ide | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') 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 -- cgit v1.2.3 From 9d6567169ea95ffad8a3c9a95218851821d147b8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 4 Apr 2010 05:30:31 +0200 Subject: scripts/functions: add get_fstype() from scripts/local allows wider usage. (closes: #487409) Reported-by: Christoph Anton Mitterer Signed-off-by: maximilian attems --- scripts/functions | 26 ++++++++++++++++++++++++++ scripts/local | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 0ecb1d6..9b864ae 100644 --- a/scripts/functions +++ b/scripts/functions @@ -256,6 +256,32 @@ 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}" + + # vol_id 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 diff --git a/scripts/local b/scripts/local index 1474073..cca5e8d 100644 --- a/scripts/local +++ b/scripts/local @@ -1,31 +1,5 @@ # 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" ] && 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} -} - pre_mountroot() { [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" -- cgit v1.2.3 From 553aa3742ca43b4ba4e87b2dea2c5d31cc43a124 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 16 Dec 2009 17:47:49 +0000 Subject: mkinitramfs: generate pre-cached boot order file if tsort is available, use it instead of custom sorting code if a pre-cached order file is available, use that instead [ move cache_run_scripts from scripts/functions to hook-scripts as only used on mkinitramfs build and not on boot ] Signed-off-by: maximilian attems --- hook-functions | 16 ++++++++++++++++ mkinitramfs | 5 +++++ scripts/functions | 27 ++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/hook-functions b/hook-functions index ab2f486..cf41e42 100644 --- a/hook-functions +++ b/hook-functions @@ -485,6 +485,22 @@ 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() { diff --git a/mkinitramfs b/mkinitramfs index f7e484d..6eed876 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -269,6 +269,11 @@ fi run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks +# cache boot run order +for b in $(cd "${DESTDIR}/scripts" && find . -mindepth 1 -type d); do + cache_run_scripts "${DESTDIR}" "/scripts/${b#./}" +done + # generate module deps depmod -a -b "${DESTDIR}" ${version} rm "${DESTDIR}/lib/modules/${version}"/modules.*map diff --git a/scripts/functions b/scripts/functions index 9b864ae..7b68255 100644 --- a/scripts/functions +++ b/scripts/functions @@ -186,9 +186,22 @@ 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() { for cs_x in ${runlist}; do + [ -f ${initdir}/${cs_x} ] || continue # mkinitramfs verbose output if [ "${verbose}" = "y" ]; then echo "Calling hook ${cs_x}" @@ -205,9 +218,17 @@ 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 -- cgit v1.2.3 From f9db3f7bcbad79bdb1817aa53eb27a46b5951381 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 7 Apr 2010 07:24:19 +0200 Subject: mkinitramfs: Fix several unbound variables might not be all, but a first go in stricter mkinitramfs. as bonus remove old amusing unused varialbe from day 2.. Signed-off-by: maximilian attems --- hook-functions | 14 +++++++------- mkinitramfs | 7 +++---- scripts/functions | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/hook-functions b/hook-functions index 5f00f17..76cbba9 100644 --- a/hook-functions +++ b/hook-functions @@ -175,10 +175,10 @@ copy_modules_dir() fi fi while [ $# -ge 1 ]; do - exclude="$exclude -name $1 -prune -o " + exclude="${exclude:-} -name $1 -prune -o " shift done - for x_mod in $(find "${MODULESDIR}/${dir}" ${exclude} -name '*.ko' -print); do + for x_mod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' -print); do manual_add_modules $(basename ${x_mod} .ko) done } @@ -367,7 +367,7 @@ 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 btrfs ext2 \ ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs af_packet \ @@ -479,10 +479,10 @@ check_minkver() { local curversion initdir DPKG_ARCH minversion cm_x tmp - curversion="${1}" - initdir="${2}" + curversion="${1:-}" + initdir="${2:-}" if [ -z "${initdir}" ]; then - case ${DPKG_ARCH} in + case ${DPKG_ARCH:-} in ia64|hppa) minversion="2.6.15" ;; @@ -498,7 +498,7 @@ check_minkver() return 0 fi set_initlist - for cm_x in ${initlist}; do + 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}") diff --git a/mkinitramfs b/mkinitramfs index be983cf..045e73d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -7,7 +7,6 @@ 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/" export BUSYBOXDIR="/bin" @@ -86,7 +85,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 @@ -128,7 +127,7 @@ case "${version}" in esac # Check userspace and kernel support for compressed initramfs images -if [ -z "${compress}" ]; then +if [ -z "${compress:-}" ]; then compress=${COMPRESS} else COMPRESS=${compress} @@ -252,7 +251,7 @@ 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 diff --git a/scripts/functions b/scripts/functions index 7b68255..ec8a44b 100644 --- a/scripts/functions +++ b/scripts/functions @@ -189,7 +189,7 @@ reduce_prereqs() get_prereq_pairs() { set_initlist - for gp_x in ${initlist}; do + for gp_x in ${initlist:-}; do echo ${gp_x} ${gp_x} prereqs=$(${initdir}/${gp_x} prereqs) for prereq in ${prereqs}; do @@ -223,7 +223,7 @@ run_scripts() . ${initdir}/ORDER elif command -v tsort >/dev/null 2>&1; then runlist=$(get_prereq_pairs | tsort) - call_scripts $2 + call_scripts ${2:-} else get_prereqs reduce_prereqs -- cgit v1.2.3 From 5db5becc85059e56075de5a331ed7c5a4cc2de0c Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Fri, 9 Apr 2010 20:32:23 -0700 Subject: configure_networking: pxelinux BOOTIF fixes looks like i missed a few things on implementing BOOTIF support properly. somehow i managed to get the order of the mac address backwards. i know i tested it many times.. Signed-off-by: maximilian attems --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index ec8a44b..88f1bbd 100644 --- a/scripts/functions +++ b/scripts/functions @@ -323,7 +323,7 @@ configure_networking() if [ -z "$bootif_mac" ]; then bootif_mac="$x" else - bootif_mac="$x:$bootif_mac" + bootif_mac="$bootif_mac:$x" fi done unset IFS -- cgit v1.2.3 From 24875289070511b1039b690e72cf241b5d554688 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 10 Apr 2010 07:04:05 +0200 Subject: configure_networking(): work with empty DEVICE string initramfs-tools currently requires a device to be hard-coded, but this is not much use if the network device is not known ahead of time. If the device specified in either /etc/initramfs-tools/initramfs.conf or on the ip=xxx kernel command line. usefull for multiple net devices. Based on patch by Tim Small Closes: #566295, #575766 Reviewed-by: Vagrant Cascadian Signed-off-by: maximilian attems --- conf/initramfs.conf | 5 +++-- scripts/functions | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 2aa380f..0a108a8 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -58,10 +58,11 @@ BOOT=local # # DEVICE: ... # -# Specify the network interface, like eth0 +# Specify a specific network interface, like eth0 +# Overriden by optional ip= bootarg # -DEVICE=eth0 +DEVICE= # # NFSROOT: [ auto | HOST:MOUNT ] diff --git a/scripts/functions b/scripts/functions index 88f1bbd..1cc9be6 100644 --- a/scripts/functions +++ b/scripts/functions @@ -363,10 +363,10 @@ configure_networking() ;; ""|on|any) # Bring up device - ipconfig -t ${ROUNDTTT} ${DEVICE} + ipconfig -t ${ROUNDTTT} "${DEVICE}" ;; dhcp|bootp|rarp|both) - ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE} + ipconfig -t ${ROUNDTTT} -c ${IP} -d "${DEVICE}" ;; *) ipconfig -t ${ROUNDTTT} -d $IP @@ -391,7 +391,8 @@ configure_networking() # 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 } -- cgit v1.2.3 From 90d76d566f7597d9826606b8b5cec62b50c44096 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 8 Jun 2010 11:10:01 +0200 Subject: Support dashes inside scripts names. [Closes: #566056] Signed-off-by: Michael Prokop --- initramfs-tools.8 | 4 ++-- mkinitramfs | 4 ++-- scripts/functions | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 0a15574..fd00429 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -9,8 +9,8 @@ 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. +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 diff --git a/mkinitramfs b/mkinitramfs index e54c77f..04eae42 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -229,14 +229,14 @@ 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}")/" diff --git a/scripts/functions b/scripts/functions index 1cc9be6..8730d52 100644 --- a/scripts/functions +++ b/scripts/functions @@ -74,7 +74,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 @@ -106,7 +106,7 @@ reduce_satisfied() for rs_y in ${deplist}; do # only allow variable name chars case ${rs_y} in - *[![:alnum:]_.]*) + *[![:alnum:]\._-]*) continue ;; esac -- cgit v1.2.3 From 60afd2a944cf36a5bce6ca3b4c07a422e98efeba Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 14 Jun 2010 12:10:28 +0200 Subject: code cleanup: drop trailing whitespaces. Signed-off-by: Michael Prokop --- conf/update-initramfs.conf | 2 +- debian/changelog | 6 +++--- debian/copyright | 2 +- docs/example_hook | 2 +- hook-functions | 2 +- init | 6 +++--- initramfs.conf.5 | 12 ++++++------ mkinitramfs | 2 +- scripts/functions | 2 +- scripts/local | 2 +- scripts/nfs | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/conf/update-initramfs.conf b/conf/update-initramfs.conf index 3c27473..31823e2 100644 --- a/conf/update-initramfs.conf +++ b/conf/update-initramfs.conf @@ -1,4 +1,4 @@ -# +# # Configuration file for update-initramfs(8) # diff --git a/debian/changelog b/debian/changelog index b3ae973..901222a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -247,7 +247,7 @@ initramfs-tools (0.93.4) unstable; urgency=medium * 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 + * hook-functions: Fix loading of entries without newline in /etc/initramfs-tools/modules. (closes: #532745) * MODULES=most: Add virtio_net to initramfs. (closes: #533894) @@ -537,7 +537,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 for report. (closes: #485786) + Thanks Frans Pop 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) @@ -744,7 +744,7 @@ initramfs-tools (0.90) unstable; urgency=low -- maximilian attems 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/copyright b/debian/copyright index f84910d..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 , Ben Collins , David Härdeman , - Jeff Bailey , + Jeff Bailey , maximilian attems , Scott James Remnant diff --git a/docs/example_hook b/docs/example_hook index 683ddad..1f35352 100644 --- a/docs/example_hook +++ b/docs/example_hook @@ -12,7 +12,7 @@ # command line. # # DESTDIR -- The staging directory where we are building the image. -# +# # see initramfs-tools(8) # diff --git a/hook-functions b/hook-functions index f5da1c4..8b6a89c 100644 --- a/hook-functions +++ b/hook-functions @@ -183,7 +183,7 @@ 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/module)" diff --git a/init b/init index 142eb14..a614d89 100755 --- a/init +++ b/init @@ -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 @@ -184,7 +184,7 @@ done if [ -n "${noresume}" ]; then export noresume unset resume -else +else resume=${RESUME:-} fi diff --git a/initramfs.conf.5 b/initramfs.conf.5 index bb01f58..92c3a6d 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -48,12 +48,12 @@ 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 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 diff --git a/mkinitramfs b/mkinitramfs index 58e4c11..70e5c13 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -315,7 +315,7 @@ exec 3>&1 eval ` # http://cfaj.freeshell.org/shell/cus-faq-2.html exec 4>&1 >&3 3>&- - cd "${DESTDIR}" + cd "${DESTDIR}" { find . 4>&-; echo "ec1=$?;" >&4 } | { diff --git a/scripts/functions b/scripts/functions index 8730d52..685642e 100644 --- a/scripts/functions +++ b/scripts/functions @@ -218,7 +218,7 @@ run_scripts() { initdir=${1} [ ! -d ${initdir} ] && return - + if [ -f ${initdir}/ORDER ]; then . ${initdir}/ORDER elif command -v tsort >/dev/null 2>&1; then diff --git a/scripts/local b/scripts/local index cca5e8d..98464f9 100644 --- a/scripts/local +++ b/scripts/local @@ -50,7 +50,7 @@ pre_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:]]}" diff --git a/scripts/nfs b/scripts/nfs index 435d2d0..5c41573 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() { -- cgit v1.2.3 From 5b565beaeaf605ba72b43c15e59ec85ca524728b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 15 Jun 2010 18:56:00 +0200 Subject: scripts/functions: allow hooks to abort build Execute call_scripts() under "set -e" so hook scripts can exit initrd build iff necessary. Closes: #396388 Signed-off-by: Michael Prokop --- scripts/functions | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 685642e..641e678 100644 --- a/scripts/functions +++ b/scripts/functions @@ -200,6 +200,8 @@ get_prereq_pairs() call_scripts() { + # allow hooks to abort build: + set -e for cs_x in ${runlist}; do [ -f ${initdir}/${cs_x} ] || continue # mkinitramfs verbose output @@ -212,6 +214,7 @@ call_scripts() . /conf/param.conf fi done + set +e } run_scripts() -- cgit v1.2.3 From bb66fc2a8b40d6c8ecd093cf1b358d4476ab1e1c Mon Sep 17 00:00:00 2001 From: Martin Michlmayr Date: Sun, 13 Jun 2010 17:23:14 +0100 Subject: hook-functions/init/scripts/local: add support for ubifs. MODULES=dep fails when / is ubifs. This patch adds support for something like root=ubi0:rootfs when ubi is modular. Quoting Martin: It essentially does three things: - adds the correct modules to the ramdisk (for MODULES=dep and MODULES=most) - reads ubi.mtd= from the command line - loads ubi with the ubi.mtd info and ignores the "Waiting for root" check I've successfully tested this with a kernel with modular ubi and with the following boot variants: console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs console=ttyS0,115200 ubi.mtd=2 root=ubi0_0 rootfstype=ubifs With console=ttyS0,115200 ubi.mtd=2 root=/dev/ubi0_0 rootfstype=ubifs I get an error that it cannot mount root but I suspect this is an ubifs error and has nothing to do with i-t (since at this point I can manually mount it with -t ubifs ubi0_0 whereas the /dev/ variant doesn't work). Tested with MODULES=dep and MODULES=most as well as with a kernel that has ubifs built in. Closes: #582858 Thanks: Martin Michlmayr Signed-off-by: Martin Michlmayr Reviewed-by: Michael Prokop --- hook-functions | 10 ++++++++++ init | 5 +++++ scripts/local | 7 +++++++ 3 files changed, 22 insertions(+) (limited to 'scripts') diff --git a/hook-functions b/hook-functions index 1a0e097..3ce081d 100644 --- a/hook-functions +++ b/hook-functions @@ -237,6 +237,10 @@ dep_add_modules() # 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 @@ -415,6 +419,11 @@ auto_add_modules() block) copy_modules_dir kernel/drivers/block ;; + 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}" @@ -447,6 +456,7 @@ auto_add_modules() auto_add_modules ata auto_add_modules i2o auto_add_modules dasd + auto_add_modules ubi auto_add_modules ieee1394 auto_add_modules firewire auto_add_modules mmc diff --git a/init b/init index 397a8c2..467a562 100755 --- a/init +++ b/init @@ -43,6 +43,7 @@ export ROOTFSTYPE= export IP= export BOOT= export BOOTIF= +export UBIMTD= export break= export init=/sbin/init export quiet=n @@ -127,6 +128,9 @@ for x in $(cat /proc/cmdline); do boot=*) BOOT=${x#boot=} ;; + ubi.mtd=*) + UBIMTD=${x#ubi.mtd=} + ;; resume=*) RESUME="${x#resume=}" ;; @@ -258,6 +262,7 @@ unset ROOT unset IP unset BOOT unset BOOTIF +unset UBIMTD unset blacklist unset break unset noresume diff --git a/scripts/local b/scripts/local index 98464f9..9b51174 100644 --- a/scripts/local +++ b/scripts/local @@ -8,6 +8,13 @@ pre_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 -- cgit v1.2.3 From b1f74e697820d878a15e430e4ce1b74cd7fad2d3 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 16 Jun 2010 17:29:11 +0200 Subject: get_fstype: reference blkid in comment the removal of vol_id compat code as requested in #585419 is to early as we need it for Lenny upgrades. Nevertheless have the comment point to the newer tool. :) Thanks: Christoph Anton Mitterer Signed-off-by: maximilian attems --- scripts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 641e678..de8c1b2 100644 --- a/scripts/functions +++ b/scripts/functions @@ -288,7 +288,7 @@ get_fstype () local FS FSTYPE FSSIZE RET FS="${1}" - # vol_id has a more complete list of file systems, + # 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 -- cgit v1.2.3 From eb93a7e7d11da7789fa357c763ce2bc76245c8a8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Jun 2010 11:22:01 +0200 Subject: pre_mountroot(): reduce timeout to 30 seconds giant disk arrays, clusters will need to provide their own rootdelay= boot arg, they should have capable admins. 3 minutes wait is just too long for regular users. sync from ubuntu 0.96.1ubuntu1. Acked-by: Michael Prokop Signed-off-by: maximilian attems --- scripts/local | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/local b/scripts/local index 9b51174..8cb279a 100644 --- a/scripts/local +++ b/scripts/local @@ -26,12 +26,9 @@ pre_mountroot() 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 -- cgit v1.2.3 From 38563fedd5e9058c9ec164031df300dd2c2d31ad Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 16 Jun 2010 18:19:08 +0200 Subject: scripts/functions: On panic change to tty1 if chvt around To make sure the user can read any error messages displayed. (LP: #243226) usplash and other may cause the user to land somewhere, where nothing is displayed. merge from Ubuntu with adding conditional chvt invocation, as it may not be around. Thanks: Luke Yelavich Thanks: Colin Watson Signed-off-by: maximilian attems --- scripts/functions | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index de8c1b2..ac77972 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} -- cgit v1.2.3 From 68c87cd042ce2819625b2f067cf67e690d8b2ce8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Jun 2010 14:29:23 +0200 Subject: mkinitramfs: check syntax of boot and hook scripts only run them when sytax is good. Idea from LP: #570243. important now that we have errexit on for them. Signed-off-by: maximilian attems --- scripts/functions | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index ac77972..8177216 100644 --- a/scripts/functions +++ b/scripts/functions @@ -100,6 +100,13 @@ set_initlist() continue fi + # 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 } @@ -123,6 +130,10 @@ reduce_satisfied() if [ -d ${initdir}/${rs_y} ]; then continue fi + # skip bad syntax + if [ ! sh -n ${initdir}/${rs_y} ]; then + continue + fi tmpdeplist="${tmpdeplist} ${rs_y}" done deplist=${tmpdeplist} -- cgit v1.2.3 From ae02e4b51c1b138994d0c6f199862f0cb82d78f8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Jun 2010 14:34:23 +0200 Subject: scripts/functions: beautify a bit reduce_satisfied() shorten code, no code change. function easier to read. Signed-off-by: maximilian attems --- scripts/functions | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 8177216..883df0d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -123,17 +123,12 @@ reduce_satisfied() ;; 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 - if [ ! sh -n ${initdir}/${rs_y} ]; then - continue - fi + [ ! sh -n ${initdir}/${rs_y} ] && continue + tmpdeplist="${tmpdeplist} ${rs_y}" done deplist=${tmpdeplist} -- cgit v1.2.3 From 2ff4ba20c4629961373e78eb8d07f1221236802b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 17 Jun 2010 15:00:50 +0200 Subject: scripts/functions: fix usage of test for script execution Signed-off-by: Michael Prokop --- scripts/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 883df0d..42fafa8 100644 --- a/scripts/functions +++ b/scripts/functions @@ -94,14 +94,14 @@ set_initlist() fi # skip directories - if [ -d ${si_x} ]; then + if [ -d ${si_x} ; then [ "${verbose}" = "y" ] \ && echo "$si_x ignored: a directory" continue fi # skip bad syntax - if [ ! sh -n ${si_x} ]; then + if ! sh -n ${si_x} ; then [ "${verbose}" = "y" ] \ && echo "$si_x ignored: bad syntax" continue -- cgit v1.2.3 From 74f71c9697d7dd7b25a7014320a7366027149fee Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 17 Jun 2010 15:05:31 +0200 Subject: scripts/functions: fix another sh -n usage and fix typo Signed-off-by: Michael Prokop --- scripts/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 42fafa8..56ae1e1 100644 --- a/scripts/functions +++ b/scripts/functions @@ -94,7 +94,7 @@ set_initlist() fi # skip directories - if [ -d ${si_x} ; then + if [ -d ${si_x} ]; then [ "${verbose}" = "y" ] \ && echo "$si_x ignored: a directory" continue @@ -127,7 +127,7 @@ reduce_satisfied() # skip directories [ -d ${initdir}/${rs_y} ] && continue # skip bad syntax - [ ! sh -n ${initdir}/${rs_y} ] && continue + sh -n ${initdir}/${rs_y} || continue tmpdeplist="${tmpdeplist} ${rs_y}" done -- cgit v1.2.3 From 1d66ae1f03358b221d67aaf65fbda0ff3c6071fc Mon Sep 17 00:00:00 2001 From: Ferenc Wagner Date: Thu, 17 Jun 2010 18:49:54 +0200 Subject: scripts/nfs: cleanup retry logic The condition of log_end_msg was always true. Calling do_nfsmount before the loop lets us drop two other checks. Signed-off-by: Ferenc Wagner Signed-off-by: maximilian attems --- scripts/nfs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/nfs b/scripts/nfs index 5c41573..02b3830 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -69,14 +69,14 @@ mountroot() delay=${ROOTDELAY} fi - # 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" -- cgit v1.2.3 From 6147641d9129db51421ef0706972e21ceb36c801 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 18 Jun 2010 11:14:14 +0200 Subject: nfsmount: more small cleanups code up the nfs rootdelay in a more efficient way. here people need the time it takes, so stay on 180s. Signed-off-by: maximilian attems --- scripts/nfs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/nfs b/scripts/nfs index 02b3830..6fa0c43 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -62,12 +62,7 @@ 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 succeeds do_nfsmount -- cgit v1.2.3 From 7faeb32bd8c61244d1fd47522133c04cd24445f8 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 18 Jun 2010 15:45:51 +0200 Subject: fix typos in manpage, scripts/functions and conf/initramfs.conf - thanks lintian * paramater -> parameter * adress -> address * adress -> address * overriden -> overridden * correponds -> corresponds * correponds -> corresponds * Overriden -> Overridden * usualy -> usually Signed-off-by: Michael Prokop --- conf/initramfs.conf | 4 ++-- initramfs-tools.8 | 16 ++++++++-------- scripts/functions | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index 0a108a8..bc9060b 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -2,7 +2,7 @@ # 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. # @@ -59,7 +59,7 @@ BOOT=local # DEVICE: ... # # Specify a specific network interface, like eth0 -# Overriden by optional ip= bootarg +# Overridden by optional ip= bootarg # DEVICE= diff --git a/initramfs-tools.8 b/initramfs-tools.8 index fd00429..d0d904c 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -66,12 +66,12 @@ Use root=/dev/nfs for NFS to kick to in. NFSOPTS can be looked up in \fB\fI ip tells how to configure the ip address. Allows to specify an different NFS server than the DHCP server. See Documentation/filesystems/nfsroot.txt -in any recent Linux source for details. Optional paramater for NFS root. +in any recent Linux source for details. Optional parameter for NFS root. .TP \fB\fI BOOTIF -is a mac adress in pxelinux format with leading "01-" and "-" as separations. -pxelinux passes mac adress of network card used to PXE boot on with this +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 @@ -259,7 +259,7 @@ 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 overriden by hook script, but can guide them +This setting shouldn't be overridden by hook script, but can guide them on how much they need to include on initramfs. @@ -496,12 +496,12 @@ init sets several variables for the boot scripts environment. .TP \fB\fI ROOT -correponds to the root boot option. +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 -correponds to the rootdelay, rootflags, rootfstype or ip boot option. +corresponds to the rootdelay, rootflags, rootfstype or ip boot option. .TP \fB\fI DPKG_ARCH allows arch specific boot actions. @@ -521,10 +521,10 @@ 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. -Overriden by rw bootarg. +Overridden by rw bootarg. .TP \fB\fI rootmnt -is the path where root gets mounted usualy /root. +is the path where root gets mounted usually /root. .TP \fB\fI debug indicates that a debug log is captured for further investigation. diff --git a/scripts/functions b/scripts/functions index 56ae1e1..068e901 100644 --- a/scripts/functions +++ b/scripts/functions @@ -220,7 +220,7 @@ call_scripts() echo "Calling hook ${cs_x}" fi ${initdir}/${cs_x} - # allow boot scripts to modify exported boot paramaters + # allow boot scripts to modify exported boot parameters if [ -e /conf/param.conf ]; then . /conf/param.conf fi -- cgit v1.2.3 From 837f2614f79e8ea66385e6dcb2a6072ddb5ec186 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 19 Jun 2010 18:08:15 +0200 Subject: mkinitramfs: set nounset and errexit Better catch both early than stupid mistakes cropping in. Signed-off-by: maximilian attems --- hook-functions | 2 +- mkinitramfs | 2 ++ scripts/functions | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/hook-functions b/hook-functions index d860bc7..9d63d58 100644 --- a/hook-functions +++ b/hook-functions @@ -532,7 +532,7 @@ check_minkver() # 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/mkinitramfs b/mkinitramfs index e49e01c..bccdbed 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,5 +1,7 @@ #!/bin/sh +set -eu + umask 0022 export PATH='/usr/bin:/sbin:/bin' diff --git a/scripts/functions b/scripts/functions index 068e901..364cc27 100644 --- a/scripts/functions +++ b/scripts/functions @@ -107,7 +107,7 @@ set_initlist() continue fi - initlist="${initlist} ${si_x#${initdir}/}" + initlist="${initlist:-} ${si_x#${initdir}/}" done } -- cgit v1.2.3 From 0b5ce7cd3e4655af03133718f0a92883425b9c6c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 6 Jul 2010 12:48:56 +0200 Subject: initramfs-tools: output name of script that errexits. this should make bug reports concerning bogus hook scripts easier to handle, like the *loooong* iscan story. Closes: 586554 Signed-off-by: maximilian attems --- scripts/functions | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 364cc27..d42a3cf 100644 --- a/scripts/functions +++ b/scripts/functions @@ -211,7 +211,6 @@ get_prereq_pairs() call_scripts() { - # allow hooks to abort build: set -e for cs_x in ${runlist}; do [ -f ${initdir}/${cs_x} ] || continue @@ -219,7 +218,12 @@ call_scripts() if [ "${verbose}" = "y" ]; then echo "Calling hook ${cs_x}" fi - ${initdir}/${cs_x} + ${initdir}/${cs_x} && ec=$? || ec=$? + # allow hooks to abort build: + if [ "$ec" -ne 0 ]; then + echo "E: ${initdir}/${cs_x} failed with return $ec." + exit $ec + fi # allow boot scripts to modify exported boot parameters if [ -e /conf/param.conf ]; then . /conf/param.conf -- cgit v1.2.3 From a4e1a9ea7321799da65a11bb96413d66b7cb07eb Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 6 Aug 2010 23:59:07 +0200 Subject: initramfs-tools: only allow hook scripts to errexit on mkinitramfs version is "the" essential exported variable by mkinitramfs. Use it's string length to determine that we are on mkinitramfs stage and not trying to boot a not precached initramfs image. hook scripts on boot can exit due to random failures and shouldn't interrupt boot there. Signed-off-by: maximilian attems --- scripts/functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index d42a3cf..1e2aeee 100644 --- a/scripts/functions +++ b/scripts/functions @@ -222,7 +222,8 @@ call_scripts() # allow hooks to abort build: if [ "$ec" -ne 0 ]; then echo "E: ${initdir}/${cs_x} failed with return $ec." - exit $ec + # only errexit on mkinitramfs + [ -n "${version}" ] && exit $ec fi # allow boot scripts to modify exported boot parameters if [ -e /conf/param.conf ]; then -- cgit v1.2.3 From 85fbb23edd4eb450f3180e3bfb51245e4da4d56d Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Fri, 20 Aug 2010 12:35:43 -0700 Subject: configure_networking(): Look for presence of /tmp/net-*.conf files when $DEVICE is not set (which is now default), otherwise ipconfig may receive a valid DHCP response, but fails to break out of the loop and is called repeatedly. thanks to Petter Reinholdtsen, i think i've figured out the initramfs-tools portion of this problem (there may still be outstanding issues with ipconfig). tested the attached patch, which seems to address the issue for me at least. Closes: #584583 Signed-off-by: maximilian attems --- scripts/functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 1e2aeee..419203a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -372,9 +372,9 @@ configure_networking() # 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. - if [ -e /tmp/net-"${DEVICE}".conf ]; then - break; - fi + for x in /tmp/net-"${DEVICE}".conf /tmp/net-*.conf ; do + [ -e "$x" ] && break 2 + done case ${IP} in none|off) -- cgit v1.2.3