From de9c780f57ae626f05ec1c971c56648250cba03c Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 8 Jun 2005 21:13:41 +0000 Subject: Initial checkin --- init | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 init (limited to 'init') diff --git a/init b/init new file mode 100644 index 0000000..c3e4887 --- /dev/null +++ b/init @@ -0,0 +1,64 @@ +#!/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} "$@" -- 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 'init') 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 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 'init') 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 'init') 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 'init') 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 9c603dd111d019e87d0135459d3b15c996565e14 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 16 Jun 2005 20:26:16 +0000 Subject: Use modprobe instead of insmod --- init | 2 +- mkinitramfs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/init b/init index a338889..73981a5 100644 --- a/init +++ b/init @@ -48,7 +48,7 @@ run_scripts /scripts/init-top # Load the modules # FIXME - do module options here for x in $(cat /conf/modules); do - insmod /modules/$x + modprobe $x done # Populate /dev tree diff --git a/mkinitramfs b/mkinitramfs index 94cf4c5..bfb0007 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -12,11 +12,13 @@ manual_add_modules() 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 + if [ -e ${TMPDIR}/${y} ]; then continue fi - ln -s ${y} ${TMPDIR}/modules + mkdir -p ${TMPDIR}/$(dirname ${y}) + ln -s ${y} ${TMPDIR}/$(dirname ${y}) + depmod -b ${TMPDIR} ${version} echo $(basename ${y}) >>${TMPDIR}/conf/modules done done @@ -113,9 +115,10 @@ rm ${TMPDIR}/lib/*lsb* # Busybox rm ${TMPDIR}/bin/sh ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/sh +# This is ugly, but needed atm to make the builtins work =( +ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox # Modutils -ln -s /sbin/insmod ${TMPDIR}/bin ln -s /sbin/modprobe ${TMPDIR}/bin # Raid -- 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 'init') 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 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 'init') 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 af3ccf91e2ca354c65e45e34abd0f48fe11d7d39 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 30 Jun 2005 00:04:16 +0000 Subject: We --- init | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/init b/init index 8c5c53e..6486139 100644 --- a/init +++ b/init @@ -10,10 +10,11 @@ mount -t proc proc /proc . /scripts/functions # Parse command line options +export break= export init=/sbin/init -export root= +export quiet=n export readonly=y -export break= +export root= export rootmnt=/root for x in $(cat /proc/cmdline); do case $x in @@ -29,6 +30,9 @@ for x in $(cat /proc/cmdline); do boot=*) BOOT=${x#boot=} ;; + quiet) + quiet=y + ;; ro) readonly=y ;; @@ -41,22 +45,32 @@ for x in $(cat /proc/cmdline); do esac done +log_begin_msg "Running /script/init-top" run_scripts /scripts/init-top +log_end_msg . /scripts/${BOOT} +log_begin_msg "Loading modules" load_modules +log_end_msg # Populate /dev tree +log_begin_msg "Initializing /dev" udevstart +log_end_msg if [ x${break} = xyes ]; then panic "Spawning shell within the initramfs" fi +log_begin_msg "Mounting root file system" mountroot +log_end_msg +log_begin_msg "Running /scripts/init-bottom" run_scripts /scripts/init-bottom +log_end_msg umount /sys umount /proc -- cgit v1.2.3 From 56fb010842d4ffa9bd5ff7491eeb8e12ee475006 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 27 Jul 2005 00:44:32 -0400 Subject: initramfs-tools (0.14) breezy; urgency=low The --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/init b/init index 6486139..b2a89e1 100644 --- a/init +++ b/init @@ -14,12 +14,12 @@ export break= export init=/sbin/init export quiet=n export readonly=y -export root= +export ROOT= export rootmnt=/root for x in $(cat /proc/cmdline); do case $x in init=*) - INIT=${x#init=} + init=${x#init=} ;; root=*) ROOT=${x#root=} -- cgit v1.2.3 From 3d319f70b29f804234fa5eb6e93c1168b0d2dddf Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 5 Aug 2005 11:46:54 -0400 Subject: DSDT, init-premount, and add sata_nv --- debian/changelog | 16 ++++++++++++++++ debian/dirs | 1 + init | 4 ++++ mkinitramfs | 7 ++++++- 4 files changed, 27 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index e083ff1..06f40e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +initramfs-tools (0.15) breezy; urgency=low + + "Nothing looks so like innocence as an indiscretion." + - Oscar Wilde + + * mkinitramfs: Handle putting DSDT.aml into the initramfs + Add sata_nv to list of modules to import for main mode. + + * init: New scripts directory, init-premount for generic premount + handling (like usplash) + + * debian/dirs: Make the /etc version of this directory for user + addons. + + -- Jeff Bailey Fri, 5 Aug 2005 11:39:26 -0400 + initramfs-tools (0.14) breezy; urgency=low "The world is a stage, but the play is badly cast." diff --git a/debian/dirs b/debian/dirs index ac6210e..6de384e 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,4 +1,5 @@ etc/mkinitramfs/init-bottom +etc/mkinitramfs/init-premount etc/mkinitramfs/init-top etc/mkinitramfs/local-bottom etc/mkinitramfs/local-premount diff --git a/init b/init index b2a89e1..e1fee77 100644 --- a/init +++ b/init @@ -64,6 +64,10 @@ if [ x${break} = xyes ]; then panic "Spawning shell within the initramfs" fi +log_begin_msg "Running /scripts/init-premount" +run_scripts /scripts/init-premount +log_end_msg + log_begin_msg "Mounting root file system" mountroot log_end_msg diff --git a/mkinitramfs b/mkinitramfs index cbc1f82..8092a14 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -83,7 +83,7 @@ auto_add_modules() 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 + 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 @@ -235,6 +235,11 @@ copy_exec /lib/lvm-200/vgchange /sbin run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks +# Apply DSDT to initramfs +if [ -e ${CONFDIR}/DSDT.aml ]; then + copy_exec ${CONFDIR}/DSDT.aml / +fi + (cd ${DESTDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) if [ -s ${__TMPCPIOGZ} ]; then -- 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 'init') 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 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 'init') 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 841a533b3b11b4a41f2eb8e6849fbd4ace0217fb Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 1 Sep 2005 00:14:03 -0400 Subject: initramfs-tools (0.25) breezy; urgency=low "If there was less sympathy in the world, there would be less trouble in the world." - Oscar Wilde * init: Module the /dev tmpfs earlier. Make /dev/console, and /dev/null on it at the beginning, just in case. * debian/initramfs-tools.postinst: When copying the modules file over from initrd-tools installations, filter out ext2, ext3, ide-generic and ide-disk. These are leftovers from Warty. (Ubuntu #14242) * hooks/udev: New File (Ubuntu #12915) * init: panic if ${init} doesn't exist on the target filesystem. -- Jeff Bailey Thu, 1 Sep 2005 00:13:47 -0400 --- debian/changelog | 20 ++++++++++++++++++++ debian/initramfs-tools.postinst | 8 +++++++- init | 10 ++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 06292ff..38ec69f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.25) breezy; urgency=low + + "If there was less sympathy in the world, there would be less + trouble in the world." + - Oscar Wilde + + * init: Module the /dev tmpfs earlier. Make /dev/console, and + /dev/null on it at the beginning, just in case. + + * debian/initramfs-tools.postinst: When copying the modules file over + from initrd-tools installations, filter out ext2, ext3, ide-generic + and ide-disk. These are leftovers from Warty. + (Ubuntu #14242) + + * hooks/udev: New File (Ubuntu #12915) + + * init: panic if ${init} doesn't exist on the target filesystem. + + -- Jeff Bailey Thu, 1 Sep 2005 00:13:47 -0400 + initramfs-tools (0.24) breezy; urgency=low "Experience is simply the name we give out mistakes." diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index 6e61803..7d4eff6 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -15,7 +15,13 @@ 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 + sed -i \ + -e 's/mkinitrd/mkinitramfs/g' \ + -e '/^ide-generic/d' \ + -e '/^ide-disk/d' \ + -e '/^ext2/d' \ + -e '/^ext3/d' \ + /etc/mkinitramfs/modules fi if [ -e ${RESUME} ]; then diff --git a/init b/init index f3aa221..f11908d 100644 --- a/init +++ b/init @@ -5,6 +5,10 @@ mkdir /proc mkdir /tmp mount -t sysfs sysfs /sys mount -t proc proc /proc +mount -t ramfs none /dev +touch /dev/.initramfs-tools +mknod /dev/console c 5 1 +mknod /dev/null c 1 3 . /conf/initramfs.conf . /scripts/functions @@ -61,8 +65,6 @@ 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 @@ -93,5 +95,9 @@ mount -o move /dev /root/dev umount /sys umount /proc +if [ ! -x ${rootmnt}${init} ]; then + panic "Target filesystem doesn't have ${init}" +fi + # Chain to real filesystem exec run-init ${rootmnt} ${init} "$@" /root/dev/console -- 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 'init') 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 'init') 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 'init') 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 'init') 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 'init') 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 b69379d8aba5cb2cf30f1786c547385e1d401cd8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Nov 2005 20:45:34 +0100 Subject: use higher timeout, so that lesser people ends without devices. future udevd should have condition to test against so that this timeout is no longer needed. --- debian/changelog | 4 ++++ init | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 0bc4e36..1cf51c0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,10 @@ initramfs-tools (0.39) unstable; urgency=low * Pump udev dependency. + * init: Pump timeout as there is currently no way to check which udevd + processes are still running and why. Cures hopefully breakage of missing + devices. + -- maximilian attems Thu, 17 Nov 2005 19:59:47 +0100 initramfs-tools (0.38) unstable; urgency=low diff --git a/init b/init index 18d31ad..a1d6923 100755 --- a/init +++ b/init @@ -74,7 +74,8 @@ log_begin_msg "Initializing /dev" mkdir /dev/.udevdb UDEVD_EXPECTED_SEQNUM=$(($(cat /sys/kernel/hotplug_seqnum) + 1)) udevd --daemon udevsynthesize -sleep 2 +# FIXME: future udevd should have condition to test against +sleep 5 log_end_msg log_begin_msg "Loading modules" -- cgit v1.2.3 From 5952a2fe8e6484b1813faaab93783764ff9026e8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 28 Nov 2005 17:47:23 +0100 Subject: fix for newest upstream udev: udev has no a queue, which we can test (loop) against. :) --- debian/changelog | 13 +++++++++++++ debian/control | 2 +- init | 15 +++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index ee6a61f..099c3a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +initramfs-tools (0.41) unstable; urgency=low + + "Una mattina mi sono svegliato" + + * High urgency upload to cope with newer udev upstream - bonus: + condition to test against when udev is ready. (Closes: #341014) + + * Pump udev dep on 0.076-2. + + * Special thanks to Paul Traina for previous udev / emvs work. + + -- maximilian attems Mon, 28 Nov 2005 17:26:40 +0100 + initramfs-tools (0.40) unstable; urgency=high * High urgency upload as udev changed under our feet. Fix RC bugs. diff --git a/debian/control b/debian/control index 70c2641..2a90d0d 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.0.14-1ubuntu2), busybox (>= 1:1.01-3), cpio, udev (>= 0.074-3) +Depends: klibc-utils (>= 1.0.14-1ubuntu2), busybox (>= 1:1.01-3), cpio, udev (>= 0.076-2) 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/init b/init index a1d6923..8b00234 100755 --- a/init +++ b/init @@ -71,11 +71,18 @@ depmod -a # Populate /dev tree log_begin_msg "Initializing /dev" -mkdir /dev/.udevdb -UDEVD_EXPECTED_SEQNUM=$(($(cat /sys/kernel/hotplug_seqnum) + 1)) udevd --daemon +udevd_timeout=30 +echo > /proc/sys/kernel/hotplug +mkdir /dev/.udev /dev/.udev/db/ /dev/.udev/queue/ +udevd --daemon udevsynthesize -# FIXME: future udevd should have condition to test against -sleep 5 +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 log_begin_msg "Loading modules" -- cgit v1.2.3 From 57732aa03ef035c09cfcea98086fff11670e7470 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 28 Nov 2005 17:50:24 +0100 Subject: sync ubuntu: breaknow --- debian/changelog | 16 ++++++++++++++++ init | 3 +++ 2 files changed, 19 insertions(+) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 099c3a8..aa337a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ initramfs-tools (0.41) unstable; urgency=low * Special thanks to Paul Traina for previous udev / emvs work. + * Sync with Ubuntu (0.36ubuntu6). + -- maximilian attems Mon, 28 Nov 2005 17:26:40 +0100 initramfs-tools (0.40) unstable; urgency=high @@ -49,6 +51,20 @@ initramfs-tools (0.39) unstable; urgency=medium -- maximilian attems Thu, 17 Nov 2005 19:59:47 +0100 +initramfs-tools (0.36ubuntu6) dapper; urgency=low + + * Rename "panic" to "breaknow" + + -- Scott James Remnant Wed, 23 Nov 2005 10:23:54 +0000 + +initramfs-tools (0.36ubuntu5) dapper; urgency=low + + * Abort the boot sequence as early as possible if "panic" is placed on the + kernel command-line, allowing debugging of scripts in init-top. + + -- 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, diff --git a/init b/init index 8b00234..2d9683e 100755 --- a/init +++ b/init @@ -59,6 +59,9 @@ for x in $(cat /proc/cmdline); do break) break=yes ;; + breaknow) + panic "Spawning shell within the initramfs" + ;; esac done -- cgit v1.2.3 From 31cb69967fcd2cb034b0ef68e648e9a43fdd32a3 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 28 Nov 2005 17:54:12 +0100 Subject: kill udev as late as possible. --- debian/changelog | 7 +++++-- init | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index aa337a8..323affc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ initramfs-tools (0.41) unstable; urgency=low - "Una mattina mi sono svegliato" + "Una mattina mi sono svegliato" * High urgency upload to cope with newer udev upstream - bonus: condition to test against when udev is ready. (Closes: #341014) @@ -11,7 +11,10 @@ initramfs-tools (0.41) unstable; urgency=low * Sync with Ubuntu (0.36ubuntu6). - -- maximilian attems Mon, 28 Nov 2005 17:26:40 +0100 + * Kill udevd as late as possible. Thanks David Härdeman + for the patch. (Closes: #339093) + + -- maximilian attems Mon, 28 Nov 2005 17:53:24 +0100 initramfs-tools (0.40) unstable; urgency=high diff --git a/init b/init index 2d9683e..f8853b1 100755 --- a/init +++ b/init @@ -102,8 +102,6 @@ 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 @@ -114,6 +112,7 @@ run_scripts /scripts/init-bottom # 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 -- 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 'init') 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 e0de055ba1a1c32acb70f92ec65bf23139b73b8f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 28 Dec 2005 01:28:31 +0100 Subject: fix passing of the debug param to init. --- debian/changelog | 6 ++++++ init | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 8b14a93..b53ff18 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +initramfs-tools (0.45) unstable; urgency=low + + * Unset debug before calling init, confuses /etc/init.d/rc. + + -- maximilian attems Tue, 27 Dec 2005 19:12:31 +0100 + initramfs-tools (0.44) unstable; urgency=high "O partigiano portami via" diff --git a/init b/init index 1f6c732..db18f15 100755 --- a/init +++ b/init @@ -105,6 +105,11 @@ while [ ! -x ${rootmnt}${init} ]; do panic "Target filesystem doesn't have ${init}" done +# Confuses /etc/init.d/rc +if [ -n ${debug} ]; then + unset debug +fi + # Chain to real filesystem maybe_break init exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console -- 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 'init') 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 9c19e494cea61a5b89ab0ef87ba5cbc1da362c81 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 30 Jan 2006 00:57:15 +0100 Subject: fix stage checking --- debian/changelog | 4 +++- init | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index e783755..ccc9223 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,9 @@ 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) - -- maximilian attems Tue, 24 Jan 2006 19:40:25 +0100 + * init: Fix maybe_break test for the bottom stage. + + -- maximilian attems Mon, 30 Jan 2006 00:56:04 +0100 initramfs-tools (0.51) unstable; urgency=low diff --git a/init b/init index e983534..61a8379 100755 --- a/init +++ b/init @@ -98,7 +98,7 @@ log_begin_msg "Mounting root file system" mountroot log_end_msg -maybe_break mount +maybe_break bottom [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom" run_scripts /scripts/init-bottom [ "$quiet" != "y" ] && log_end_msg -- 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 'init') 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 b32ee94abe4682241d1b00f430858c5f1ac5d955 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 27 Feb 2006 01:08:13 +0100 Subject: resync ubuntu24 aka nice conf.d --- debian/changelog | 25 +++++++++++++++++++++++-- debian/initramfs-tools.dirs | 1 + debian/initramfs-tools.postinst | 2 +- debian/initramfs-tools.postrm | 1 + debian/initramfs-tools.preinst | 14 ++++++++++++++ hook-functions | 2 +- init | 3 +++ initramfs.conf.5 | 9 ++++++++- mkinitramfs | 12 +++++++++++- 9 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 debian/initramfs-tools.preinst (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 74facf0..bef47a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,15 +4,18 @@ initramfs-tools (0.53) unstable; urgency=high /boot/initrd-`uname -r` and not /boot/vmlinu?-`uname -r`. Otherwise this builds initramfs for newer handbuild trees too. - * Resync with 0.40ubuntu22: + * Resync with 0.40ubuntu24: - mptspi already included - keep nfsmount for now, we don't want to add further busybox deps. + - adds mptfc and mptsas modules (closes: #341930) + - adds MODULES=netboot support (closes: #352669) * 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. + but adds the sha1sum for update-initramfs. Reset takeover=0. + (closes: #353809) -- maximilian attems Thu, 23 Feb 2006 16:59:56 +0100 @@ -165,6 +168,24 @@ 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.40ubuntu24) dapper; urgency=low + + * Add support for LSI Logic's Fusion MPT SAS and FC controllers as well. + + -- Adam Conrad Thu, 23 Feb 2006 23:27:16 +1100 + +initramfs-tools (0.40ubuntu23) dapper; urgency=low + + * Grow a conf.d directory for config snippets, and toss the RESUME option + in there, to stop editing our own conffile in our maintainer scripts. + * Add a cleverly hackish preinst that will pull the RESUME setting from + old config files, migrate it to conf.d/resume, and reset that part of the + conffile to a factory fresh state. This should fix the unwanted conffile + prompt in breezy->dapper upgrades for people who made no local changes. + + -- Adam Conrad Fri, 17 Feb 2006 15:34:53 +1100 + initramfs-tools (0.40ubuntu22) dapper; urgency=low * Add mptspi to the list of SCSI modules put in the initramfs by default, diff --git a/debian/initramfs-tools.dirs b/debian/initramfs-tools.dirs index ba4ac4d..9325057 100644 --- a/debian/initramfs-tools.dirs +++ b/debian/initramfs-tools.dirs @@ -8,5 +8,6 @@ etc/mkinitramfs/scripts/nfs-bottom etc/mkinitramfs/scripts/nfs-premount etc/mkinitramfs/scripts/nfs-top etc/mkinitramfs/hooks +etc/mkinitramfs/conf.d usr/share/initramfs-tools/modules.d /var/lib/initramfs-tools diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index c6025e5..63ceef8 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -25,7 +25,7 @@ if [ "$1" = configure ]; then fi if [ -e ${RESUME} ]; then - sed -i -e "s@#RESUME=@RESUME=${RESUME}@" /etc/mkinitramfs/initramfs.conf + echo "RESUME=${RESUME}" > /etc/mkinitramfs/conf.d/resume fi if [ -e /etc/mkinitrd/DSDT ]; then diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm index 2af9945..0c2d39a 100644 --- a/debian/initramfs-tools.postrm +++ b/debian/initramfs-tools.postrm @@ -2,6 +2,7 @@ if [ "x${1}" = "xpurge" ]; then rm -f /etc/mkinitramfs/modules + rm -f /etc/mkinitramfs/conf.d/resume fi #DEBHELPER# diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst new file mode 100644 index 0000000..3582290 --- /dev/null +++ b/debian/initramfs-tools.preinst @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +[ -f /etc/mkinitramfs/initramfs.conf ] && . /etc/mkinitramfs/initramfs.conf +if [ -z ${RESUME} ]; then + exit 0 +else + mkdir -p /etc/mkinitramfs/conf.d + echo "RESUME=${RESUME}" > /etc/mkinitramfs/conf.d/resume + sed -i -e "s/RESUME=.*/#RESUME=/" /etc/mkinitramfs/initramfs.conf +fi + +#DEBHELPER# diff --git a/hook-functions b/hook-functions index 51e0a8d..9b0d949 100644 --- a/hook-functions +++ b/hook-functions @@ -153,7 +153,7 @@ auto_add_modules() 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 + 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 mptfc mptscsih mptsas 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 ;; diff --git a/init b/init index f4ec157..1e4e2fd 100755 --- a/init +++ b/init @@ -23,6 +23,9 @@ export DPKG_ARCH= # Bring in the main config . /conf/initramfs.conf +for i in conf/conf.d/*; do + [ -f ${i} ] && . ${i} +done . /scripts/functions # Parse command line options diff --git a/initramfs.conf.5 b/initramfs.conf.5 index c289ee2..7fb79b1 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -12,6 +12,12 @@ 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] +Configuration options can be broken out into configuration snippets and +placed in individual files in the /etc/mkinitramfs/conf.d directory. Files +in this directory are always read \fBafter\fP the main configuration file, +so you can override the settings in the main config file without editing it +directly. + .SH GENERAL VARIABLES .TP \fB MODULES @@ -30,7 +36,8 @@ The default setting is \fImost\fP. \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. +will override this setting. By default, this is set in +/etc/mkinitramfs/conf.d/resume. .SH NFS VARIABLES .TP diff --git a/mkinitramfs b/mkinitramfs index 6c2be32..06e892d 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -77,6 +77,13 @@ fi . /usr/share/initramfs-tools/hook-functions . "${CONFDIR}/initramfs.conf" +EXTRA_CONF='' +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} +done if [ -z "${outfile}" ]; then usage @@ -139,7 +146,7 @@ export DPKG_ARCH # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ -for d in bin conf etc lib modules sbin scripts; do +for d in bin conf/conf.d etc lib modules sbin scripts; do mkdir -p "${DESTDIR}/${d}" done @@ -178,6 +185,9 @@ 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 +for i in ${EXTRA_CONF}; do + copy_exec ${CONFDIR}/conf.d/${i} /conf/conf.d +done # Busybox rm -f ${DESTDIR}/bin/sh -- cgit v1.2.3 From 236d8183a72e0de357a743bc909ea25e8bd1995e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 27 Feb 2006 09:39:30 +0100 Subject: hardcoded root support --- debian/changelog | 11 +++++++++-- init | 4 +++- mkinitramfs | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index bef47a5..d4858ff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,8 @@ initramfs-tools (0.53) unstable; urgency=high Otherwise this builds initramfs for newer handbuild trees too. * Resync with 0.40ubuntu24: - - mptspi already included + - New conf.d dir for config snippet. + - mptspi already included. - keep nfsmount for now, we don't want to add further busybox deps. - adds mptfc and mptsas modules (closes: #341930) - adds MODULES=netboot support (closes: #352669) @@ -17,7 +18,13 @@ initramfs-tools (0.53) unstable; urgency=high but adds the sha1sum for update-initramfs. Reset takeover=0. (closes: #353809) - -- maximilian attems Thu, 23 Feb 2006 16:59:56 +0100 + * init: Move the ROOT export up, so we actually source the hardcoded device + in initramfs.conf. (closes: #352958) + + * mkinitramfs: When invoked with -r switch pass the hardcoded root device to + /etc/mkinitramfs/conf.d/root inside the initramfs. + + -- maximilian attems Mon, 27 Feb 2006 01:45:56 +0100 initramfs-tools (0.52b) unstable; urgency=high diff --git a/init b/init index 1e4e2fd..f69b3e8 100755 --- a/init +++ b/init @@ -21,6 +21,9 @@ mknod /dev/null c 1 3 export DPKG_ARCH= . /conf/arch.conf +# Export it for root hardcoding +export ROOT= + # Bring in the main config . /conf/initramfs.conf for i in conf/conf.d/*; do @@ -33,7 +36,6 @@ export break= export init=/sbin/init export quiet=n export readonly=y -export ROOT= export resume=${RESUME} export rootmnt=/root export debug= diff --git a/mkinitramfs b/mkinitramfs index 06e892d..a72865b 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -37,7 +37,7 @@ while true; do shift ;; -r) - # ignore (FIXME: manpage says differently?!?) + ROOT="$2" shift 2 ;; --supported-host-version) @@ -188,6 +188,7 @@ copy_exec "${CONFDIR}/initramfs.conf" /conf for i in ${EXTRA_CONF}; do copy_exec ${CONFDIR}/conf.d/${i} /conf/conf.d done +echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root # Busybox rm -f ${DESTDIR}/bin/sh -- 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 'init') 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 02b32f0a24c8e0724bca66ef57f144c4d708dce2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 20 May 2006 12:14:44 +0200 Subject: - mv /etc/mkinitramfs /etc/initramfs-tools upgrade handling on preinst - update TODO - update bug script --- debian/TODO | 6 +++--- debian/bug | 18 +++++++++++++++--- debian/changelog | 32 ++++++++++++++++++++++++++++++++ debian/control | 4 ++-- debian/initramfs-tools.dirs | 22 +++++++++++----------- debian/initramfs-tools.install | 2 +- debian/initramfs-tools.postinst | 12 ++++++------ debian/initramfs-tools.postrm | 4 ++-- debian/initramfs-tools.preinst | 25 +++++++++++++++++++++---- init | 6 +++++- initramfs-tools.8 | 20 ++++++++++---------- mkinitramfs | 2 +- mkinitramfs.8 | 6 +++--- 13 files changed, 112 insertions(+), 47 deletions(-) (limited to 'init') diff --git a/debian/TODO b/debian/TODO index 1f187ae..2c2edc0 100644 --- a/debian/TODO +++ b/debian/TODO @@ -3,12 +3,12 @@ TODO o Grep for TODO and FIXME and do those. =) - o Eliminate ?udev?, klibc. + o Eliminate ?udev?, ?klibc?, busybox (-> glibc). o Support list and dep options o Default to dep for PPC - Possibly to detect newworld? - o External hooks support for evms + o lilo timeouts handling - o Support cryptoroot + o mdadm + lvm2 hooks to their respective packages diff --git a/debian/bug b/debian/bug index fda2017..b1b477d 100755 --- a/debian/bug +++ b/debian/bug @@ -1,3 +1,15 @@ -cat /proc/cmdline >&3 -grep -v nodev /proc/filesystems >&3 -lsmod >&3 +#!/bin/sh + +exec >&3 + +echo "-- /proc/cmdline" +cat /proc/cmdline +echo + +echo "-- /proc/filesystems" +grep -v nodev /proc/filesystems +echo + +echo "-- lsmod" +lsmod +echo diff --git a/debian/changelog b/debian/changelog index 4c773aa..4a02bdc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,35 @@ +initramfs-tools (0.61) unstable; urgency=low + + Release "O partigiano portami via" + + * debian/TODO: update to latest state. + + * debian/bug: Fix reportbug script shebang line, add some descriptive echos. + + * debian/control: Pump to 3.7.2 standard version without changes. + + * init: Use 10M as tmpfs_size for the udev /dev. (closes: #352434) + + * /etc/initramfs-tools: Use the much more intituive conf dir location. + Thanks for the idea to Andres Salomon . + + * debian/initramfs-tools.preinst: mv /etc/mkinitramfs /etc/initramfs-tools + on upgrade as this should work even with drive space issues. + Thanks to Jeff Bailey for the posix atomic + mv hint and Daniel Blaschke for testing. + + * mkinitramfs: Set CONFDIR to /etc/initramfs-tools. + + * mkinitramfs.8, initramfs-tools.8: Document the new pathes. + + * debian/control: Change Build-depends-indep to Build-depends as we need + debhelper and cdbs for the clean target, fulfills policy 7.6. + + * debian/initramfs-tools.preinst: Warn and bail out if /etc/initramfs-tools + already exists. + + -- maximilian attems Thu, 18 May 2006 17:27:44 +0200 + initramfs-tools (0.60) unstable; urgency=low "E ho trovato l'invasor" diff --git a/debian/control b/debian/control index 01ddf3b..bf022d9 100644 --- a/debian/control +++ b/debian/control @@ -3,8 +3,8 @@ Section: utils Priority: optional Uploaders: Jeff Bailey , maximilian attems Maintainer: Debian kernel team -Build-Depends-Indep: debhelper (>= 4.1.0), cdbs -Standards-Version: 3.6.2.0 +Build-Depends: debhelper (>= 4.1.0), cdbs +Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all diff --git a/debian/initramfs-tools.dirs b/debian/initramfs-tools.dirs index 9325057..0a807a5 100644 --- a/debian/initramfs-tools.dirs +++ b/debian/initramfs-tools.dirs @@ -1,13 +1,13 @@ -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 -etc/mkinitramfs/conf.d +etc/initramfs-tools/scripts/init-bottom +etc/initramfs-tools/scripts/init-premount +etc/initramfs-tools/scripts/init-top +etc/initramfs-tools/scripts/local-bottom +etc/initramfs-tools/scripts/local-premount +etc/initramfs-tools/scripts/local-top +etc/initramfs-tools/scripts/nfs-bottom +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/modules.d /var/lib/initramfs-tools diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index 9a4f31e..a5b87df 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -2,7 +2,7 @@ mkinitramfs usr/sbin mkinitramfs-kpkg usr/sbin init usr/share/initramfs-tools scripts usr/share/initramfs-tools -conf/initramfs.conf etc/mkinitramfs +conf/initramfs.conf etc/initramfs-tools hooks usr/share/initramfs-tools hook-functions usr/share/initramfs-tools update-initramfs usr/sbin diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index 63ceef8..94c5c1b 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -14,29 +14,29 @@ if [ "$1" = configure ]; then fi if [ -e /etc/mkinitrd/modules ]; then - cp /etc/mkinitrd/modules /etc/mkinitramfs + cp /etc/mkinitrd/modules /etc/initramfs-tools sed -i \ -e 's/mkinitrd/mkinitramfs/g' \ -e '/^ide-generic/d' \ -e '/^ide-disk/d' \ -e '/^ext2/d' \ -e '/^ext3/d' \ - /etc/mkinitramfs/modules + /etc/initramfs-tools/modules fi if [ -e ${RESUME} ]; then - echo "RESUME=${RESUME}" > /etc/mkinitramfs/conf.d/resume + echo "RESUME=${RESUME}" > /etc/initramfs-tools/conf.d/resume fi if [ -e /etc/mkinitrd/DSDT ]; then - cp /etc/mkinitrd/DSDT /etc/mkinitramfs/DSDT.aml + cp /etc/mkinitrd/DSDT /etc/initramfs-tools/DSDT.aml fi fi fi -if [ ! -e /etc/mkinitramfs/modules ]; then - cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/ +if [ ! -e /etc/initramfs-tools/modules ]; then + cp /usr/share/doc/initramfs-tools/examples/modules /etc/initramfs-tools/ fi # Regenerate initramfs on upgrade diff --git a/debian/initramfs-tools.postrm b/debian/initramfs-tools.postrm index 0c2d39a..b711f2c 100644 --- a/debian/initramfs-tools.postrm +++ b/debian/initramfs-tools.postrm @@ -1,8 +1,8 @@ #!/bin/sh if [ "x${1}" = "xpurge" ]; then - rm -f /etc/mkinitramfs/modules - rm -f /etc/mkinitramfs/conf.d/resume + rm -f /etc/initramfs-tools/modules + rm -f /etc/initramfs-tools/conf.d/resume fi #DEBHELPER# diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index 3582290..3ec83c6 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -2,13 +2,30 @@ set -e -[ -f /etc/mkinitramfs/initramfs.conf ] && . /etc/mkinitramfs/initramfs.conf +case "$1" in + upgrade) + if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.61"; then + if [ -d /etc/initramfs-tools ]; then + echo + echo "Warning: /etc/initramfs-tools already exists." + echo " Please remove it for upgrade." + echo + exit 1 + fi + if [ -d /etc/mkinitramfs ]; then + mv /etc/mkinitramfs /etc/initramfs-tools + fi + fi + ;; +esac + +[ -f /etc/initramfs-tools/initramfs.conf ] && . /etc/initramfs-tools/initramfs.conf if [ -z ${RESUME} ]; then exit 0 else - mkdir -p /etc/mkinitramfs/conf.d - echo "RESUME=${RESUME}" > /etc/mkinitramfs/conf.d/resume - sed -i -e "s/RESUME=.*/#RESUME=/" /etc/mkinitramfs/initramfs.conf + 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/init b/init index 04b7602..5e2084f 100755 --- a/init +++ b/init @@ -11,7 +11,11 @@ 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 +tmpfs_size="10M" +if [ -e /etc/udev/udev.conf ]; then + . /etc/udev/udev.conf +fi +mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev touch /dev/.initramfs-tools mkdir /dev/.initramfs mknod /dev/console c 5 1 diff --git a/initramfs-tools.8 b/initramfs-tools.8 index f0077ec..b0a9f32 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -75,7 +75,7 @@ spawns a shell in the initramfs image at chosen run-time .SH HOOK SCRIPTS Hooks can be found in two places: /usr/share/initramfs-tools/hooks and -/etc/mkinitramfs/hooks. They are executed during generation of the +/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. @@ -174,9 +174,9 @@ increase its size by several hundred kilobytes. .SH BOOT SCRIPTS Similarly to hook scripts, boot scripts can be found in two places -/usr/share/initramfs-tools/scripts/ and /etc/mkinitramfs/scripts/. There are a -number of subdirectories to these two directories which control the boot stage -at which the scripts are executed. +/usr/share/initramfs-tools/scripts/ and /etc/initramfs-tools/scripts/. There +are a number of subdirectories to these two directories which control the boot +stage at which the scripts are executed. .SS Header Like for hook scripts, there are no guarantees as to the order in which the @@ -271,8 +271,8 @@ panic "Frobnication failed" .RE .SS Subdirectories -Both /usr/share/initramfs-tools/scripts and /etc/mkinitramfs/scripts contains -the following subdirectories. +Both /usr/share/initramfs-tools/scripts and /etc/initramfs-tools/scripts +contains the following subdirectories. .TP \fB \fI @@ -285,8 +285,8 @@ No other device files are present yet. \fB \fI init-premount runs the udev hooks for populating the /dev tree (udev will keep running until -init-bottom) after modules specified by hooks and /etc/mkinitramfs/modules have -been loaded. +init-bottom) after modules specified by hooks and /etc/initramfs-tools/modules +have been loaded. .TP \fB \fI @@ -325,7 +325,7 @@ allows boot scripts to change exported variables that are listed on top of init. .SS Hook script An example hook script would look something like this (and would usually be -placed in /etc/mkinitramfs/hooks/frobnicate): +placed in /etc/initramfs-tools/hooks/frobnicate): .RS .nf @@ -359,7 +359,7 @@ exit 0 .RE .SS Boot script -An example boot script would look something like this (and would usually be placed in /etc/mkinitramfs/scripts/local-top/frobnicate): +An example boot script would look something like this (and would usually be placed in /etc/initramfs-tools/scripts/local-top/frobnicate): .RS .nf diff --git a/mkinitramfs b/mkinitramfs index b7de71b..05800bb 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -4,7 +4,7 @@ umask 0022 # Defaults keep="n" -CONFDIR="/etc/mkinitramfs" +CONFDIR="/etc/initramfs-tools" verbose="n" errors_to="2>/dev/null" # BUSYBOXDIR="/usr/lib/initramfs-tools/bin/" diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 539c4c0..49b606f 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -67,20 +67,20 @@ This option queries if mkinitramfs can create ramdisks for kernel version .SH FILES .TP -.I /etc/mkinitramfs/initramfs.conf +.I /etc/initramfs-tools/initramfs.conf The default configuration file for the script. See .BR initramfs.conf (5) for a description of the available configuration parameter. .TP -.I /etc/mkinitramfs/modules +.I /etc/initramfs-tools/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 +.I /etc/initramfs-tools/DSDT.aml If this file exists, it will be appended to the initramfs in a way that causes it to be loaded by ACPI. -- cgit v1.2.3 From 0754335a68ecc127f73dd5c42fa042928952b579 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 22 Jun 2006 20:50:14 +0200 Subject: rephrase docs remove cp modules from postinstall, install confdir lots of small polishing thanks to Sesse review don't use touch on init --- debian/changelog | 40 ++++++++++++++++++++++++++++++++-------- debian/control | 9 +++++---- debian/initramfs-tools.install | 1 + debian/initramfs-tools.postinst | 9 --------- init | 2 +- initramfs-tools.8 | 8 ++++---- mkinitramfs.8 | 6 +++--- update-initramfs.8 | 4 ++-- 8 files changed, 48 insertions(+), 31 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index ba0fe4f..83c5a46 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,34 @@ -initramfs-tools (0.62) unstable; urgency=low +initramfs-tools (0.64) unstable; urgency=low + + RELEASE o bella, ciao! bella, ciao! + + * debian/initramfs-tools.install: Add /etc/initramfs-tools/modules conffile, + instead of a cp from postinstall. (closes: #368043) + + * debian/control, update-initramfs.8, mkinitramfs.8: Capitalize RAM + NFS. + Rephrase nfs root support. + + Thanks to Jeff Bailey and + Steinar H. Gunderson for the review. + + -- maximilian attems Thu, 22 Jun 2006 20:45:59 +0200 - * debian/control: Tighten dep on udev. udev 0.086-1 loads ide-disk. - Can't lower to sarge version anyway as no coldplugg support there. - (closes: #358360, #362816) +initramfs-tools (0.63) unstable; urgency=low + + * init: Use redirection '>' for touching /dev/.initramfs-tools. + + * debian/control, update-initramfs.8, mkinitramfs.8: + s/an (cpio archive)/a gzipped \1/. + Thanks to Andy Somerville . + + -- maximilian attems Thu, 22 Jun 2006 01:11:17 +0200 + +initramfs-tools (0.62) unstable; urgency=low - * debian/initramfs-tools.postinst: Check if modules example is available - under doc before copying if not touch $CONFDIR/modules. - (closes: #368043) + * debian/control: We need at least udev 0.086-1, since earlier versions + had hooks, which don't load ide-disk automatically for 2.6.15 kernels. + Can't lower dependency to sarge version as it has no coldplug support + to escape udev dependency loop on upgrade. (closes: #358360, #362816) * hook-functions: Add arcmsr to the scsi modules list. @@ -21,10 +43,12 @@ initramfs-tools (0.61) unstable; urgency=low * debian/TODO: update to latest state. * debian/bug: Fix reportbug script shebang line, add some descriptive echos. + Use exec to open file descriptor 3 for reportbug. * debian/control: Pump to 3.7.2 standard version without changes. - * init: Use 10M as tmpfs_size for the udev /dev. (closes: #352434) + * init: Use 10M as tmpfs_size for the udev /dev, that can be overriden in + /etc/udev/udev.conf. (closes: #352434) * /etc/initramfs-tools: Use the much more intituive conf dir location. Thanks for the idea to Andres Salomon . diff --git a/debian/control b/debian/control index 6c59d5e..a5a1cee 100644 --- a/debian/control +++ b/debian/control @@ -12,8 +12,9 @@ Depends: klibc-utils (>= 1.1.16-1), busybox (>= 1:1.01-3) | busybox-cvs-static ( 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 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. + 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. Any boot loader with initrd support is able to load an initramfs archive. diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index a5b87df..84cde80 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/modules etc/initramfs-tools hooks usr/share/initramfs-tools hook-functions usr/share/initramfs-tools update-initramfs usr/sbin diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index f1cfcfa..9a0b555 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -35,15 +35,6 @@ if [ "$1" = configure ]; then fi fi -if [ ! -e /etc/initramfs-tools/modules ]; then - if [ -e /usr/share/doc/initramfs-tools/examples/modules ]; then - cp /usr/share/doc/initramfs-tools/examples/modules \ - /etc/initramfs-tools/ - else - touch /etc/initramfs-tools/modules - fi -fi - # Regenerate initramfs on upgrade if [ "$1" = "configure" -a -n "$2" ]; then update-initramfs -u diff --git a/init b/init index 5e2084f..2c25295 100755 --- a/init +++ b/init @@ -16,7 +16,7 @@ if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev -touch /dev/.initramfs-tools +> /dev/.initramfs-tools mkdir /dev/.initramfs mknod /dev/console c 5 1 mknod /dev/null c 1 3 diff --git a/initramfs-tools.8 b/initramfs-tools.8 index b0a9f32..eb46827 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -44,7 +44,7 @@ string of the form NFSSERVER:NFSPATH .TP \fB \fI boot -either local or nfs (affects which initramfs scripts are run, see the "Subdirectories" section under boot scripts). +either local or NFS (affects which initramfs scripts are run, see the "Subdirectories" section under boot scripts). .TP \fB \fI resume @@ -292,19 +292,19 @@ have been loaded. \fB \fI local-top OR nfs-top After these scripts have been executed, the root device node is expected to be -present (local) or the network interface is expected to be usable (nfs). +present (local) or the network interface is expected to be usable (NFS). .TP \fB \fI local-premount OR nfs-premount are run after the sanity of the root device has been verified (local) or the -network interface has been brought up (nfs), but before the actual root fs has +network interface has been brought up (NFS), but before the actual root fs has been mounted. .TP \fB \fI local-bottom OR nfs-bottom -are run after the rootfs has been mounted (local) or the nfs root share has +are run after the rootfs has been mounted (local) or the NFS root share has been mounted. udev is stopped. .TP diff --git a/mkinitramfs.8 b/mkinitramfs.8 index 49b606f..5af552b 100644 --- a/mkinitramfs.8 +++ b/mkinitramfs.8 @@ -23,14 +23,14 @@ mkinitramfs \- generate an initramfs image The .B mkinitramfs script generates an initramfs image. -The initramfs is an cpio archive. The archive can be used on a different -box of the same arch with the corresponding Linux kernel. +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 .B update-initramfs should do all necessary steps. -At boot time, the kernel unpacks that archive into ram disk, mounts and +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. diff --git a/update-initramfs.8 b/update-initramfs.8 index 7ab8b3f..71f2500 100644 --- a/update-initramfs.8 +++ b/update-initramfs.8 @@ -20,8 +20,8 @@ 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 an cpio archive. -At boot time, the kernel unpacks that archive into ram disk, mounts and +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. -- 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 'init') 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 62bb60b509b62e6ce68d067b7f293019ed102b9a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 13 Jul 2006 23:33:32 +0200 Subject: - fix noresume exporting - readd plain upgly kernel-package interface to mkinitramfs with depreciation warning - nice fixes in preinst by Kamion --- debian/changelog | 15 +++++++++++++++ debian/initramfs-tools.preinst | 4 +++- init | 2 +- mkinitramfs | 24 +++++++++++++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 9623ae4..056ccb2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +initramfs-tools (0.69b) unstable; urgency=high + + * debian/initramfs-tools.preinst: Don't depend upon shipped directories + to be existing. Thanks Colin Watson for patch. + Add trailing slash to copy command. (closes: 378089) + + * mkinitramfs: Revert the removal of kernel-package supported lonng param + of 0.65. Readd that plain ugly interface. Warn users they should use + ramdisk=mkinitramfs-kpkg. As kernel-package doesn't yet support + update-initramfs. Thanks Frans Pop for report. + + * Thus high urgency upload. + + -- maximilian attems Thu, 13 Jul 2006 23:20:49 +0200 + initramfs-tools (0.69) unstable; urgency=low * scripts/local-premount/suspend, scripts/local-premount/resume: Rename diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index dca832f..b92d393 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -5,6 +5,8 @@ set -e case "$1" in configure) if [ -n "$2" ]; then + 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 } ') @@ -18,7 +20,7 @@ case "$1" in # Add initrd-tools modules, while trying to minimize prompting if [ -e /etc/mkinitrd/modules ]; then - cp /etc/mkinitrd/modules /etc/initramfs-tools + cp /etc/mkinitrd/modules /etc/initramfs-tools/ sed -i \ -e 's/\/etc\/mkinitrd\/modules: Kernel modules to load for initrd./List of modules that you want to include in your initramfs./g' \ -e 's/mkinitrd/update-initramfs/g' \ diff --git a/init b/init index 427b964..2beb597 100755 --- a/init +++ b/init @@ -104,7 +104,7 @@ for x in $(cat /proc/cmdline); do esac done -if [ -n ${NORESUME} ]; then +if [ -z ${NORESUME} ]; then export resume=${RESUME} fi diff --git a/mkinitramfs b/mkinitramfs index f532228..a0bec9e 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 -n "$0" -- "$@"` +OPTIONS=`getopt -o d:ko:r:v --long supported-host-version:,supported-target-version: -n "$0" -- "$@"` # Check for non-GNU getopt if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -44,6 +44,14 @@ 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 @@ -55,6 +63,20 @@ 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 + echo "Depreciation warning: use ramdisk=mkinitramfs-kpkg." + exit 0 +fi + # For dependency ordered mkinitramfs hook scripts. . /usr/share/initramfs-tools/scripts/functions . /usr/share/initramfs-tools/hook-functions -- 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 'init') 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 'init') 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 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 'init') 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 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 'init') 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 'init') 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 'init') 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 8ae9783215c2845b50dfb70b919df0753c2b0dd9 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 1 Sep 2006 16:18:29 +0200 Subject: - fix destination of the mdrun.conf for partial sarge upgrades - checkout if /sbin/lilo is really there - guard more dirs against creation - add /etc/kernel-img.conf to reportbug output --- debian/changelog | 20 ++++++++++++++++++++ debian/script | 6 ++++++ init | 6 +++--- mkinitramfs | 4 ++-- update-initramfs | 3 +++ 5 files changed, 34 insertions(+), 5 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index bc635a3..b46db63 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.78) unstable; urgency=medium + + * update-initramfs: Check in call_lilo() if /sbin/lilo is executable, + when /etc/lilo.conf exists (closes: 384967) - thus urgency medium. + + * init: Guard all dirs against creation. (closes: 385281) + + * 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 + +initramfs-tools (0.77b) unstable; urgency=high + + * 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) + + -- maximilian attems Thu, 31 Aug 2006 13:20:51 +0200 + initramfs-tools (0.77) unstable; urgency=medium * mkinitramfs, scripts/local-top/mdrun: Use mdrun.conf as config file. diff --git a/debian/script b/debian/script index b1b477d..a8e3dd9 100755 --- a/debian/script +++ b/debian/script @@ -13,3 +13,9 @@ echo echo "-- lsmod" lsmod echo + +if [ -r /etc/kernel-img.conf ]; then + echo "-- kernel-img.conf" + cat /etc/kernel-img.conf + echo +fi diff --git a/init b/init index a83dc39..0c336b3 100755 --- a/init +++ b/init @@ -6,9 +6,9 @@ echo "Loading, please wait..." [ -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 +[ -d /sys ] || mkdir /sys +[ -d /proc ] || mkdir /proc +[ -d /tmp ] || mkdir /tmp mkdir -p /var/lock mount -t sysfs none /sys mount -t proc none /proc diff --git a/mkinitramfs b/mkinitramfs index d088efa..c36e845 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -239,7 +239,7 @@ run_scripts "${CONFDIR}"/hooks 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/mdrun.conf + echo "rootraiddev=${rootraiddev}" > ${DESTDIR}/conf/mdrun.conf mdadm=$(mdadm --detail "${rootraiddev}") echo "${mdadm}" | awk ' $1 == "Number" && $2 == "Major" { start = 1; next } @@ -248,7 +248,7 @@ if [ -x /sbin/mdadm ] && [ ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then $2 == 0 && $3 == 0 { next } { devices = devices " " $NF } END { print "devices='\''" devices "'\''" }' \ - >> /conf/mdrun.conf + >> ${DESTDIR}/conf/mdrun.conf copy_exec /sbin/mdadm /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do manual_add_modules ${x} diff --git a/update-initramfs b/update-initramfs index c1e42ab..5cd1e2e 100755 --- a/update-initramfs +++ b/update-initramfs @@ -85,6 +85,9 @@ generate_initramfs() # lilo call run_lilo() { + if [ ! -x /sbin/lilo ]; then + return 1 + fi lilo -t > /dev/null if [ $? -eq 0 ]; then lilo -- 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 'init') 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 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 'init') 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 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 'init') 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 1eaf8424e56e3f52c60420ce68efdef5301a47d8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 2 Apr 2007 20:21:34 +0200 Subject: bootfixes: mount args don't like spaces restore_initramfs(): verbose output before action --- debian/changelog | 2 +- init | 4 ++-- update-initramfs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 3c7cdb8..e4c7b70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,7 +34,7 @@ initramfs-tools (0.86) experimental; urgency=low Useful if a MINKVER set is not fulfilled. (LP: #101844) Thanks Soren Hansen for patch. - -- maximilian attems Mon, 2 Apr 2007 15:01:59 +0200 + -- maximilian attems Mon, 2 Apr 2007 20:20:29 +0200 initramfs-tools (0.85f) unstable; urgency=high diff --git a/init b/init index 4c09fd7..00e0dcf 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 -o nodev, noexec, nosuid -mount -t proc none /proc -o nodev, noexec, nosuid +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 diff --git a/update-initramfs b/update-initramfs index 9d2b03e..f4c637b 100755 --- a/update-initramfs +++ b/update-initramfs @@ -117,8 +117,8 @@ backup_booted_initramfs() restore_initramfs() { [ -z "${initramfs_bak}" ] && return 0 - mv -f "${initramfs_bak}" "${initramfs}" verbose "Restoring ${initramfs_bak}" + mv -f "${initramfs_bak}" "${initramfs}" } -- 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 'init') 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 8800b09a519db23e0fefd32868a57c45c0a013e8 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Tue, 1 May 2007 18:59:39 +0200 Subject: init: Remove cryptopts parsing the cryptsetup scripts parse /proc/cmdline themselves (even in the Etch version). --- debian/changelog | 7 ++++++- init | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index b5eff37..8932889 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ initramfs-tools (0.88) UNRELEASED; urgency=low + [ maximilian attems ] * debian/changelog: Fix missing colons in closes. * hook-functions: Add a proper /sys walking dep_add_modules() for a minimal @@ -8,7 +9,11 @@ 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. - -- maximilian attems Tue, 01 May 2007 18:48:03 +0200 + [ David Härdeman ] + * init: Remove cryptopts parsing, not official bootparam. cryptsetup scripts + parse /proc/cmdline themselves (even in the Etch version). + + -- maximilian attems Tue, 01 May 2007 18:56:40 +0200 initramfs-tools (0.87b) unstable; urgency=low diff --git a/init b/init index b115cd1..7de409a 100755 --- a/init +++ b/init @@ -47,7 +47,6 @@ export quiet=n export readonly=y export rootmnt=/root export debug= -export cryptopts=${CRYPTOPTS} export ROOTDELAY= export panic= export blacklist= @@ -81,9 +80,6 @@ for x in $(cat /proc/cmdline); do rootdelay=*) ROOTDELAY="${x#rootdelay=}" ;; - cryptopts=*) - cryptopts="${x#cryptopts=}" - ;; nfsroot=*) NFSROOT="${x#nfsroot=}" ;; -- cgit v1.2.3 From 6fd917d49cd09c5124df25c48e1458e1a87f2365 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 1 May 2007 19:35:45 +0200 Subject: init: ignore non-numeric rootdelay, panic bootargs they cause funny sleep error messages: aka you can't sleep "bar" time ;) take into account that subsecond sleeps are ok. thanks david for the idea, gone for the q&d regex check. --- debian/changelog | 3 ++- init | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 40363ad..b436b0a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ initramfs-tools (0.88) UNRELEASED; urgency=low initramfs on MODULES=dep. (closes: #395526) * 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. [ David Härdeman ] * init: Remove cryptopts parsing, not official bootparam. cryptsetup scripts @@ -14,7 +15,7 @@ initramfs-tools (0.88) UNRELEASED; urgency=low destination path if only one argument is given. * hook-funcions: document how copy_exec determines the target path. - -- maximilian attems Tue, 01 May 2007 19:23:10 +0200 + -- maximilian attems Tue, 01 May 2007 19:31:41 +0200 initramfs-tools (0.87b) unstable; urgency=low diff --git a/init b/init index 7de409a..0da01d4 100755 --- a/init +++ b/init @@ -79,6 +79,11 @@ for x in $(cat /proc/cmdline); do ;; rootdelay=*) ROOTDELAY="${x#rootdelay=}" + case ${ROOTDELAY} in + *[![:digit:].]*) + ROOTDELAY= + ;; + esac ;; nfsroot=*) NFSROOT="${x#nfsroot=}" @@ -97,6 +102,11 @@ for x in $(cat /proc/cmdline); do ;; panic=*) panic="${x#panic=}" + case ${panic} in + *[![:digit:].]*) + panic= + ;; + esac ;; quiet) quiet=y -- cgit v1.2.3 From 5489c2f911a1259e9ad7ccdb5b90af529f912ffa Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 21 Aug 2007 17:09:32 +0200 Subject: init: Fix mount options invocation for klibc mount. --- debian/changelog | 3 ++- init | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index da0b63e..5d42ec6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ initramfs-tools (0.91) unstable; urgency=low * scripts/functions: simplify panic() * mkinitramfs: Kick empty dir modules. * hook-functions: Factor sys_walk_mod_add() out of dep_add_modules(). + * init: Fix mount options invocation for klibc mount. - -- maximilian attems Thu, 16 Aug 2007 10:06:09 +0200 + -- maximilian attems Tue, 21 Aug 2007 17:08:48 +0200 initramfs-tools (0.90) unstable; urgency=low diff --git a/init b/init index 0da01d4..3ea9ef4 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 -o nodev,noexec,nosuid -mount -t proc none /proc -o nodev,noexec,nosuid +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 -- cgit v1.2.3 From 928ed0689705f52a757e23478783b4ade1423944 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 1 Sep 2007 10:48:03 +0200 Subject: init: call panic if run-init fails --- debian/changelog | 3 ++- init | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 07bf916..36a3b81 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,8 +8,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * mkinitramfs: Kill kinit.shared too. * 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. - -- maximilian attems Mon, 27 Aug 2007 10:09:25 +0200 + -- maximilian attems Sat, 01 Sep 2007 10:45:04 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/init b/init index 3ea9ef4..53c228a 100755 --- a/init +++ b/init @@ -186,3 +186,4 @@ fi # Chain to real filesystem maybe_break init exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console +panic "Could not execute run-init." -- cgit v1.2.3 From f2f808cfeaf4350f4f300c689eccea88a327793d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 1 Sep 2007 13:42:16 +0200 Subject: init: export noresume fo uswsusp and kdump --- debian/changelog | 3 ++- init | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 6a1d1f3..66dceea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,8 +10,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * 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. + * init: Export noresume if set. uswsusp and kdump need it. - -- maximilian attems Sat, 01 Sep 2007 10:55:33 +0200 + -- maximilian attems Sat, 01 Sep 2007 13:40:24 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/init b/init index 53c228a..72b59f2 100755 --- a/init +++ b/init @@ -95,10 +95,10 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; resume=*) - RESUME="${x#resume=}" + resume="${x#resume=}" ;; noresume) - NORESUME=y + noresume=y ;; panic=*) panic="${x#panic=}" @@ -138,8 +138,10 @@ for x in $(cat /proc/cmdline); do esac done -if [ -z "${NORESUME}" ]; then - export resume=${RESUME} +if [ -z "${noresume}" ]; then + export resume=${resume} +else + export noresume fi depmod -a -- cgit v1.2.3 From a2086c2f2344f3db4fbcbfb707317655e173058a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 3 Sep 2007 11:41:55 +0200 Subject: init: s/i/conf/ i is a bad name for a conf, rename. --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/init b/init index 72b59f2..6d06bc1 100755 --- a/init +++ b/init @@ -32,8 +32,8 @@ export ROOT= # Bring in the main config . /conf/initramfs.conf -for i in conf/conf.d/*; do - [ -f ${i} ] && . ${i} +for conf in conf/conf.d/*; do + [ -f ${conf} ] && . ${conf} done . /scripts/functions -- cgit v1.2.3 From 748cff514e9033e1a7984f26ece7ed25079e3535 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 3 Sep 2007 11:45:39 +0200 Subject: init: search for valid init Fixes bootfailure on bogus init bootarg too. Plus there may be a rootfs without init, but with sh. --- debian/changelog | 4 +++- init | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 66dceea..0bdb6b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,10 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * init: Call panic for debug sh if run-init fails. * init-top/framebuffer: Check that fb minor is below 32. * 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. - -- maximilian attems Sat, 01 Sep 2007 13:40:24 +0200 + -- maximilian attems Mon, 03 Sep 2007 11:44:04 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/init b/init index 6d06bc1..e66cac2 100755 --- a/init +++ b/init @@ -176,9 +176,26 @@ run_scripts /scripts/init-bottom mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc -while [ ! -x ${rootmnt}${init} ]; do - panic "Target filesystem doesn't have ${init}" -done +# Check init bootarg +if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then + init= + echo "Target filesystem doesn't have ${init}." +fi + +# Search for valid init +if [ -z "${init}" ] ; then + for init in /sbin/init /etc/init /bin/init /bin/sh; do + if [ ! -x "${rootmnt}${i}" ]; then + continue + fi + break + done +fi + +# No init on rootmount +if [ ! -x "${rootmnt}${init}" ]; then + panic "No init found. Try passing init= bootarg." +fi # Confuses /etc/init.d/rc if [ -n ${debug} ]; then -- cgit v1.2.3 From e2094587495879e34285018ff6f2b9f46c34ca45 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 3 Sep 2007 11:48:20 +0200 Subject: init: fix typo from initial implementation --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index e66cac2..df4e181 100755 --- a/init +++ b/init @@ -185,7 +185,7 @@ fi # Search for valid init if [ -z "${init}" ] ; then for init in /sbin/init /etc/init /bin/init /bin/sh; do - if [ ! -x "${rootmnt}${i}" ]; then + if [ ! -x "${rootmnt}${init}" ]; then continue fi break -- cgit v1.2.3 From 6303982cbb523988b95fd79a10534ba7de81e703 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 8 Sep 2007 19:53:01 +0200 Subject: fix init error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You’ll notice a strange error message due to an empty $init if the rootfs can’t be found. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index df4e181..845bac1 100755 --- a/init +++ b/init @@ -178,8 +178,8 @@ mount -n -o move /proc ${rootmnt}/proc # Check init bootarg if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then - init= echo "Target filesystem doesn't have ${init}." + init= fi # Search for valid init -- cgit v1.2.3 From d85d8755ce0d8a84524a64cf32887fd9bd21e65f Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 8 Sep 2007 19:53:01 +0200 Subject: disable quiet on debug bootarg If you have quiet in your /proc/cmdline you can never reach any debug bootoption anymore. --- init | 2 ++ 1 file changed, 2 insertions(+) (limited to 'init') diff --git a/init b/init index 845bac1..9afc87a 100755 --- a/init +++ b/init @@ -119,11 +119,13 @@ for x in $(cat /proc/cmdline); do ;; debug) debug=y + quiet=n exec >/tmp/initramfs.debug 2>&1 set -x ;; debug=*) debug=y + quiet=n set -x ;; break=*) -- cgit v1.2.3 From 1c2d02dc513346876464434ae422d499642e6a16 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 12 Sep 2007 19:07:36 +0200 Subject: init: fix RESUME hardcoding --- debian/changelog | 7 +++++++ init | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/debian/changelog b/debian/changelog index 499d316..bf48bff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +initramfs-tools (0.91a) unstable; urgency=low + + * init: Fix resuming with hardcoded uppercase RESUME variable. + Thanks Raphael Hertzog for the report. + + -- maximilian attems Wed, 12 Sep 2007 19:06:19 +0200 + initramfs-tools (0.91) unstable; urgency=low * udev_helper: Axe the modprobe ide-generic should no longer be needed diff --git a/init b/init index 9afc87a..52e3f45 100755 --- a/init +++ b/init @@ -95,7 +95,7 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; resume=*) - resume="${x#resume=}" + RESUME="${x#resume=}" ;; noresume) noresume=y @@ -141,7 +141,7 @@ for x in $(cat /proc/cmdline); do done if [ -z "${noresume}" ]; then - export resume=${resume} + export resume=${RESUME} else export noresume fi -- cgit v1.2.3 From bcb1a3ef0c165bb80838415ea484babe10081dc1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 28 Nov 2007 19:45:02 +0100 Subject: init: Don't overwrite boot cmdline arg (closes: #453294) root nfs needs to check that the boot is not set before setting it. Thanks Thomas Lange for report! --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 52e3f45..607d2c7 100755 --- a/init +++ b/init @@ -67,7 +67,7 @@ for x in $(cat /proc/cmdline); do ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" ;; /dev/nfs) - BOOT=nfs + [ -z "${BOOT}" ] && BOOT=nfs ;; esac ;; -- cgit v1.2.3 From 3c8ba4b38085157d0c54c02ba9d3edf56aaf26c1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 16 Mar 2008 18:37:57 +0100 Subject: init: export ROOTFLAGS + ROOTFSTYPE. be more consistent on exporting *all* relevant ROOT* variables, thanks to Sten Spans for pointing that out. --- init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/init b/init index 607d2c7..0ec0d00 100755 --- a/init +++ b/init @@ -27,9 +27,6 @@ mkdir /dev/.initramfs export DPKG_ARCH= . /conf/arch.conf -# Export it for root hardcoding -export ROOT= - # Bring in the main config . /conf/initramfs.conf for conf in conf/conf.d/*; do @@ -41,13 +38,16 @@ done export MODPROBE_OPTIONS="-qb" # Export relevant variables +export ROOT= +export ROOTDELAY= +export ROOTFLAGS= +export ROOTFSTYPE= export break= export init=/sbin/init export quiet=n export readonly=y export rootmnt=/root export debug= -export ROOTDELAY= export panic= export blacklist= -- cgit v1.2.3 From 6c25b07c692fb34f735b049be6cac4da33125b6d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 30 Mar 2008 03:57:45 +0200 Subject: init: fix mkdir usage. klibc mkdir has only the short option, use that. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 0ec0d00..bb61bb6 100755 --- a/init +++ b/init @@ -3,7 +3,7 @@ echo "Loading, please wait..." [ -d /dev ] || mkdir -m 0755 /dev -[ -d /root ] || mkdir --mode=0700 /root +[ -d /root ] || mkdir -m 0700 /root [ -d /sys ] || mkdir /sys [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp -- cgit v1.2.3 From 0da6088ae11f77ef6fc2a9180c805d491f8bb8c4 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 30 Mar 2008 04:01:06 +0200 Subject: init: Set proper permissions of /dev/console mknod fallback. if /dev/console doesn't yet exist it should be created with proper permissions. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index bb61bb6..3a93ef8 100755 --- a/init +++ b/init @@ -18,7 +18,7 @@ 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/console ] || mknod -m 0600 /dev/console c 5 1 [ -e /dev/null ] || mknod /dev/null c 1 3 > /dev/.initramfs-tools mkdir /dev/.initramfs -- 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 'init') 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 74be87d35841eae3c3febf00b568df5232c85f06 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Thu, 10 Apr 2008 14:25:47 +0200 Subject: init: Add 2>&1 to the run-init exec, fixes init without stderr. long outstanding bug. [ note: seems fixed in fedora mkinitrd, but not in opensuse. they simply call run-init like anyone else. -maks] --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 70f4384..7f1d348 100755 --- a/init +++ b/init @@ -210,5 +210,5 @@ fi # Chain to real filesystem maybe_break init -exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console +exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1 panic "Could not execute run-init." -- cgit v1.2.3 From da6b1999565d8d7d6504b21cb26f786166509f7a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 29 Apr 2008 20:29:36 +0200 Subject: init: Fix hardcoded ROOT bootcase. grave bug as makes a Debian slug unbootable. Thanks Kevin Price for report and Martin Michlmayr for debugging. The cause was the reordering of the ROOT export *after* it had been sourced in init. Fix it by allowing all exported variables to be ovverriden aka hardcoded. --- init | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'init') diff --git a/init b/init index 7f1d348..3fe1fab 100755 --- a/init +++ b/init @@ -27,13 +27,6 @@ mkdir /dev/.initramfs export DPKG_ARCH= . /conf/arch.conf -# Bring in the main config -. /conf/initramfs.conf -for conf in conf/conf.d/*; do - [ -f ${conf} ] && . ${conf} -done -. /scripts/functions - # Set modprobe env export MODPROBE_OPTIONS="-qb" @@ -52,6 +45,13 @@ export panic= export blacklist= export resume_offset= +# Bring in the main config +. /conf/initramfs.conf +for conf in conf/conf.d/*; do + [ -f ${conf} ] && . ${conf} +done +. /scripts/functions + # Parse command line options for x in $(cat /proc/cmdline); do case $x in -- cgit v1.2.3 From 61f005efdb6f3b182fd12c365b1dd5d8e77f9e40 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 29 Apr 2008 20:31:35 +0200 Subject: Revert "init: Add 2>&1 to the run-init exec, fixes init without stderr." This reverts commit 74be87d35841eae3c3febf00b568df5232c85f06. talked to hpa and he seemed quite unconvinced about that report. the run-init code doesn't also seem to backup that claim. so nuke it for now until better analysis shows up. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 3fe1fab..885f240 100755 --- a/init +++ b/init @@ -210,5 +210,5 @@ fi # Chain to real filesystem maybe_break init -exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1 +exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console panic "Could not execute run-init." -- 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 'init') 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 08fe39090957b17a395691914d31ff90ec722689 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 02:19:28 +0200 Subject: add possible mountroot break useful for debug cases closes: #488963 --- init | 1 + initramfs-tools.8 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 4c72eab..e287739 100755 --- a/init +++ b/init @@ -170,6 +170,7 @@ maybe_break mount log_begin_msg "Mounting root file system" . /scripts/${BOOT} parse_numeric ${ROOT} +maybe_break mountroot mountroot log_end_msg diff --git a/initramfs-tools.8 b/initramfs-tools.8 index b564e2c..75c7827 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -113,7 +113,7 @@ Use for example "debug=vc". .TP \fB \fI break spawns a shell in the initramfs image at chosen run-time -(top, modules, premount, mount, bottom, init). +(top, modules, premount, mount, mountroot, bottom, init). The default is premount without any arg. Beware that if both "panic" and "break" are present, initramfs will not spawn any shells but reboot instead. -- cgit v1.2.3 From 6e5eab4ecdba250653b1572f09624c20bf98a09e Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 15 Dec 2008 11:23:03 +0100 Subject: Make debug option write to /dev/.initramfs/initramfs.debug rather than /tmp/initramfs.debug, so that it can be retrieved after boot. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index e287739..5b9dfb1 100755 --- a/init +++ b/init @@ -124,7 +124,7 @@ for x in $(cat /proc/cmdline); do debug) debug=y quiet=n - exec >/tmp/initramfs.debug 2>&1 + exec >/dev/.initramfs/initramfs.debug 2>&1 set -x ;; debug=*) -- cgit v1.2.3 From 54c28b9c9a7ed7b97db9161cd047735ae160d319 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 16 Dec 2008 15:52:32 +0100 Subject: init: Don't leak initramfs-tools exported variables. no need to check if the string of the corresponding variable exists, just unset all of them, but 2 that we need to pass on for calling init. --- init | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/init b/init index 5b9dfb1..102eda2 100755 --- a/init +++ b/init @@ -204,10 +204,23 @@ if [ ! -x "${rootmnt}${init}" ]; then panic "No init found. Try passing init= bootarg." fi -# Confuses /etc/init.d/rc -if [ -n ${debug} ]; then - unset debug -fi +# don't leak too much of env - some init(8) don't clear it +# (keep init, rootmnt) +unset debug +unset MODPROBE_OPTIONS +unset DPKG_ARCH +unset ROOTFLAGS +unset ROOTFSTYPE +unset ROOTDELAY +unset ROOT +unset blacklist +unset break +unset noresume +unset panic +unset quiet +unset readonly +unset resume +unset resume_offset # Chain to real filesystem maybe_break init -- cgit v1.2.3 From 90ad6ff31f66112e863ea86c9960b9770a0a245e Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 19 Dec 2008 18:44:34 +0100 Subject: init: Try to use old style sda1 if no root cmldine got specified. with bad luck that might still be on hda1, but then you get a warning about missing root boot param. --- init | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'init') diff --git a/init b/init index 102eda2..69cbeed 100755 --- a/init +++ b/init @@ -70,6 +70,10 @@ for x in $(cat /proc/cmdline); do /dev/nfs) [ -z "${BOOT}" ] && BOOT=nfs ;; + "") + ROOT="/dev/sda1" + log_warning_msg "No root specified - trying /dev/sda1." + ;; esac ;; rootflags=*) -- cgit v1.2.3 From ce17342cc5d0395108c8fe4150ad8849104029e7 Mon Sep 17 00:00:00 2001 From: Kel Modderman Date: Wed, 24 Dec 2008 09:56:07 +1000 Subject: init: variable `break' unset before `maybe_break init' is evaluated The cmdline parameter `break=init' failed to work. It looks like the variable `break' is unset before `maybe_break init' is evaluated. (closes: #509637) --- init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 69cbeed..4e7fdd3 100755 --- a/init +++ b/init @@ -208,6 +208,8 @@ if [ ! -x "${rootmnt}${init}" ]; then panic "No init found. Try passing init= bootarg." fi +maybe_break init + # don't leak too much of env - some init(8) don't clear it # (keep init, rootmnt) unset debug @@ -227,6 +229,5 @@ unset resume unset resume_offset # Chain to real filesystem -maybe_break init exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console panic "Could not execute run-init." -- cgit v1.2.3 From 79c0badcec17942a869ef992ceda2335cfa1d7b2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 9 Jan 2009 12:44:30 +0100 Subject: Revert "init: Try to use old style sda1 if no root cmldine got specified." we have boot scripts that search for root if none is passed. usage by grml.org and debian-live. This reverts commit 90ad6ff31f66112e863ea86c9960b9770a0a245e. Reported-by: Michael Prokop --- init | 4 ---- 1 file changed, 4 deletions(-) (limited to 'init') diff --git a/init b/init index 4e7fdd3..072d82c 100755 --- a/init +++ b/init @@ -70,10 +70,6 @@ for x in $(cat /proc/cmdline); do /dev/nfs) [ -z "${BOOT}" ] && BOOT=nfs ;; - "") - ROOT="/dev/sda1" - log_warning_msg "No root specified - trying /dev/sda1." - ;; esac ;; rootflags=*) -- cgit v1.2.3 From 70ff74f8b3d378d7153f9211bbe0e73713a87259 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 17 Feb 2009 18:00:16 +0100 Subject: Fix boot with LABEL containting one or several '/' As there is no /dev/disk/by-label//, we need to follow udev on escape the '/' character with \x2f don't rely on sed, as we might not have it in initramfs. (closes: #489008) Reported-by: Josh Triplett Tested-by: Andres Salomon thanks for dilinger to pushing the first easy solution to a complete, so we don't have to revisit the case. --- init | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 072d82c..7f549b1 100755 --- a/init +++ b/init @@ -62,7 +62,34 @@ for x in $(cat /proc/cmdline); do ROOT=${x#root=} case $ROOT in LABEL=*) - ROOT="/dev/disk/by-label/${ROOT#LABEL=}" + ROOT="${ROOT#LABEL=}" + + # support / in LABEL= paths (escape to \x2f) + case "${ROOT}" in + *[/]*) + if [ -x "$(command -v sed)" ]; then + ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')" + else + if [ "${ROOT}" != "${ROOT#/}" ]; then + ROOT="\x2f${ROOT#/}" + fi + if [ "${ROOT}" != "${ROOT%/}" ]; then + ROOT="${ROOT%/}\x2f" + fi + IFS='/' + newroot= + for s in $ROOT; do + if [ -z "${newroot}" ]; then + newroot="${s}" + else + newroot="${newroot}\\x2f${s}" + fi + done + unset IFS + ROOT="${newroot}" + fi + esac + ROOT="/dev/disk/by-label/${ROOT}" ;; UUID=*) ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" -- cgit v1.2.3 From f91fdf2b9763f2774ff237d3fd04e8cc7b8aaa10 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 17 Feb 2009 18:12:25 +0100 Subject: init: slightly reword comment --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 7f549b1..ee006b5 100755 --- a/init +++ b/init @@ -64,7 +64,7 @@ for x in $(cat /proc/cmdline); do LABEL=*) ROOT="${ROOT#LABEL=}" - # support / in LABEL= paths (escape to \x2f) + # support any / in LABEL= path (escape to \x2f) case "${ROOT}" in *[/]*) if [ -x "$(command -v sed)" ]; then -- 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 'init') 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 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 'init') 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 d3de22eda550c41d0e262a0140a33a5979c772fd Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 28 Feb 2010 13:59:41 +0100 Subject: init: export and unset BOOTIF enhances 673abb77821433a67add61ac79d739c6cee9eee0, to allow scripts to make use of the variable. Reported-by: Vagrant Cascadian Signed-off-by: maximilian attems --- init | 2 ++ 1 file changed, 2 insertions(+) (limited to 'init') diff --git a/init b/init index e8c97a5..234c3e5 100755 --- a/init +++ b/init @@ -36,6 +36,7 @@ export ROOTDELAY= export ROOTFLAGS= export ROOTFSTYPE= export IP= +export BOOTIF= export break= export init=/sbin/init export quiet=n @@ -240,6 +241,7 @@ unset ROOTFSTYPE unset ROOTDELAY unset ROOT unset IP +unset BOOTIF unset blacklist unset break unset noresume -- cgit v1.2.3 From 1277b2e7590a3a1354440472da497b68e8ba5385 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 8 Mar 2010 22:06:39 +0100 Subject: init: rexport resume to reallow it's hardcoded usage as bonus also simplify the noresume case, just unset it in that case. this should fix #572858 and friends, looks broken to me in Lenny too. Signed-off-by: maximilian attems --- init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'init') diff --git a/init b/init index 234c3e5..e1d4151 100755 --- a/init +++ b/init @@ -45,6 +45,7 @@ export rootmnt=/root export debug= export panic= export blacklist= +export resume= export resume_offset= # Bring in the main config @@ -121,7 +122,7 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; resume=*) - RESUME="${x#resume=}" + resume="${x#resume=}" ;; resume_offset=*) resume_offset="${x#resume_offset=}" @@ -169,10 +170,9 @@ for x in $(cat /proc/cmdline); do esac done -if [ -z "${noresume}" ]; then - export resume=${RESUME} -else +if [ -n "${noresume}" ]; then export noresume + unset resume fi depmod -a -- cgit v1.2.3 From 61375f9d9a76a0771b00a32412b7afd296551454 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Mon, 21 Dec 2009 23:06:53 +0000 Subject: init: Mount devtmpfs on /dev falling back to a tmpfs if not supported by the kernel. [ merge of 0.92bubuntu61 ] Signed-off-by: maximilian attems --- init | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'init') diff --git a/init b/init index e1d4151..68ceac7 100755 --- a/init +++ b/init @@ -17,9 +17,11 @@ tmpfs_size="10M" if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi -mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev -[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 -[ -e /dev/null ] || mknod /dev/null c 1 3 +if ! mount -t devtmpfs -o mode=0755 none /dev; then + mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev + [ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 + [ -e /dev/null ] || mknod /dev/null c 1 3 +fi > /dev/.initramfs-tools mkdir /dev/.initramfs -- cgit v1.2.3 From 1d3037b49b68ed615fb60d8f2a3c0e7e78c857d0 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 16 Dec 2009 17:47:49 +0000 Subject: mkinitramfs: Call depmod before packing the initramfs. init: thus drop depmod call. Don't quote modules.*map, so we actually expand it. (closes: #465760, #562561) [ merge from 0.92bubuntu57 and 0.92bubuntu58 ] Signed-off-by: maximilian attems --- init | 1 - mkinitramfs | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 68ceac7..05853b4 100755 --- a/init +++ b/init @@ -177,7 +177,6 @@ if [ -n "${noresume}" ]; then unset resume fi -depmod -a maybe_break top # Don't do log messages here to avoid confusing usplash diff --git a/mkinitramfs b/mkinitramfs index 30a19d1..58082cf 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -247,6 +247,10 @@ fi run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks +# generate module deps +depmod -a -b "${DESTDIR}" ${version} +rm "${DESTDIR}/lib/modules/${version}"/modules.*map + # Apply DSDT to initramfs if [ -e "${CONFDIR}/DSDT.aml" ]; then copy_exec "${CONFDIR}/DSDT.aml" / -- cgit v1.2.3 From 72f9d99901161b02513153eb3e587553fb21165e Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Fri, 26 Mar 2010 14:33:44 +0000 Subject: init: load the netconsole module with netconsole bootarg [ merge from 0.92bubuntu71 ] Signed-off-by: maximilian attems --- init | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'init') diff --git a/init b/init index 05853b4..f5b0646 100755 --- a/init +++ b/init @@ -169,6 +169,9 @@ for x in $(cat /proc/cmdline); do blacklist=*) blacklist=${x#blacklist=} ;; + netconsole=*) + netconsole=${x#netconsole=} + ;; esac done @@ -177,6 +180,8 @@ if [ -n "${noresume}" ]; then unset resume fi +[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}" + maybe_break top # Don't do log messages here to avoid confusing usplash -- cgit v1.2.3 From 261811b5d0524c7fe579bf4ca22915c2dc4b636f Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Fri, 26 Mar 2010 14:33:13 +0000 Subject: init: mount /dev/pts as well as /dev Allows to redirect the console early. [ merge from 0.92bubuntu71 ] Signed-off-by: maximilian attems --- init | 2 ++ 1 file changed, 2 insertions(+) (limited to 'init') diff --git a/init b/init index f5b0646..0c9719d 100755 --- a/init +++ b/init @@ -22,6 +22,8 @@ if ! mount -t devtmpfs -o mode=0755 none /dev; then [ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 [ -e /dev/null ] || mknod /dev/null c 1 3 fi +mkdir /dev/pts +mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts || true > /dev/.initramfs-tools mkdir /dev/.initramfs -- cgit v1.2.3 From 755f0033cd5775e1d17c58965143b1b6001d3478 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Apr 2010 04:23:20 +0200 Subject: init: Silence "Loading essential drivers..." on quiet boot. no point in spamming that for quiet boot. Signed-off-by: maximilian attems --- init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/init b/init index 0c9719d..c3cfc0b 100755 --- a/init +++ b/init @@ -190,9 +190,9 @@ maybe_break top run_scripts /scripts/init-top maybe_break modules -log_begin_msg "Loading essential drivers" +[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers" load_modules -log_end_msg +[ "$quiet" != "y" ] && log_end_msg maybe_break premount [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount" -- cgit v1.2.3 From 56c017ce7d7103857f4043b29320156edee66bb0 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Apr 2010 04:51:05 +0200 Subject: init: export BOOT for casper and friends merge from 0.92bubuntu9 Signed-off-by: maximilian attems --- init | 2 ++ 1 file changed, 2 insertions(+) (limited to 'init') diff --git a/init b/init index c3cfc0b..8083128 100755 --- a/init +++ b/init @@ -40,6 +40,7 @@ export ROOTDELAY= export ROOTFLAGS= export ROOTFSTYPE= export IP= +export BOOT= export BOOTIF= export break= export init=/sbin/init @@ -249,6 +250,7 @@ unset ROOTFSTYPE unset ROOTDELAY unset ROOT unset IP +unset BOOT unset BOOTIF unset blacklist unset break -- cgit v1.2.3 From a46c26e0a01a83f41d7e491f1f1a747d5f000c85 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 8 Apr 2010 05:59:04 +0200 Subject: init: fix hardcoded resume handling got confused in course of #572858, uppercase is for hardcoded device strings as here, pick up RESUME and not resume from config file. Closes: #576700 Signed-off-by: maximilian attems --- init | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'init') diff --git a/init b/init index 8083128..7d0db07 100755 --- a/init +++ b/init @@ -127,7 +127,7 @@ for x in $(cat /proc/cmdline); do BOOT=${x#boot=} ;; resume=*) - resume="${x#resume=}" + RESUME="${x#resume=}" ;; resume_offset=*) resume_offset="${x#resume_offset=}" @@ -181,6 +181,8 @@ done if [ -n "${noresume}" ]; then export noresume unset resume +else + resume=${RESUME:-} fi [ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}" -- cgit v1.2.3 From 4b7ef011bf8d2e532a1944f0ff423163588a6878 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Fri, 9 Apr 2010 20:32:23 -0700 Subject: init: add BOOTIF bootarg as mentioned by Christoph Bussenius in #535008, it does appear that setting BOOTIF from the value in /proc/cmdline is needed. at the time i wrote the patch, i'm not sure it was, but it definitely is now. with these patchese applied, it seems to work. at least for the moment. Signed-off-by: maximilian attems --- init | 3 +++ 1 file changed, 3 insertions(+) (limited to 'init') diff --git a/init b/init index 7d0db07..142eb14 100755 --- a/init +++ b/init @@ -175,6 +175,9 @@ for x in $(cat /proc/cmdline); do netconsole=*) netconsole=${x#netconsole=} ;; + BOOTIF=*) + BOOTIF=${x#BOOTIF=} + ;; esac done -- cgit v1.2.3 From 04b86198ef7d32d3f4ae700fcf34a2539876f0a7 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 14 Jun 2010 12:06:13 +0200 Subject: init: display warning message if devtmpfs could not be mounted. Older kernel versions (like the one shipped with Lenny) don't support devtmpfs. Therefore display a warning message when falling back to tmpfs. See #501359. Thanks: Ferenc Wagner Signed-off-by: Michael Prokop --- init | 1 + 1 file changed, 1 insertion(+) (limited to 'init') diff --git a/init b/init index 142eb14..c838049 100755 --- a/init +++ b/init @@ -18,6 +18,7 @@ if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi if ! mount -t devtmpfs -o mode=0755 none /dev; then + echo "W: devtmpfs not available, falling back to tmpfs for /dev" mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev [ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1 [ -e /dev/null ] || mknod /dev/null c 1 3 -- 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 'init') 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 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 'init') 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 e7daaf7fdf80ba63626515ca3e3e3054aaac0417 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 29 Jul 2010 23:28:54 -0400 Subject: init: provide validate_init() wrapper to support absolute symlinks. If /sbin/init is an absolute symlink (e.g. to /bin/systemd) the readlink check doesn't work as $rootmnt is involved. The validate_init() shell function takes care of this fact, as well as when guessing the init binary points to a directory. For example Ubuntu's upstart has its configuration inside /etc/init whereas this is considered a valid run_init_process() binary by the Linux kernel and `test -x' returns true when checking for executables. Therefore be more conservative with providing full backwards compability as well as new added support for absolute symlinks at the same time. Closes: #590744 --- init | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'init') diff --git a/init b/init index 467a562..dee5625 100755 --- a/init +++ b/init @@ -227,24 +227,48 @@ run_scripts /scripts/init-bottom mount -n -o move /sys ${rootmnt}/sys mount -n -o move /proc ${rootmnt}/proc +validate_init() { + checktarget="${1}" + + # Work around absolute symlinks + if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${checktarget}" ]; then + case $(readlink "${rootmnt}${checktarget}") in /*) + checktarget="$(chroot ${rootmnt} readlink ${checktarget})" + ;; + esac + fi + + # Make sure the specified init can be executed + if [ ! -x "${rootmnt}${checktarget}" ]; then + return 1 + fi + + # Upstart uses /etc/init as configuration directory :-/ + if [ -d "${rootmnt}${checktarget}" ]; then + return 1 + fi +} + # Check init bootarg -if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then - echo "Target filesystem doesn't have ${init}." - init= +if [ -n "${init}" ]; then + if ! validate_init "$init"; then + echo "Target filesystem doesn't have requested ${init}." + init= + fi fi # Search for valid init if [ -z "${init}" ] ; then - for init in /sbin/init /etc/init /bin/init /bin/sh; do - if [ ! -x "${rootmnt}${init}" ]; then - continue + for inittest in /sbin/init /etc/init /bin/init /bin/sh; do + if validate_init "${inittest}"; then + init="$inittest" + break fi - break done fi # No init on rootmount -if [ ! -x "${rootmnt}${init}" ]; then +if ! validate_init "${init}" ; then panic "No init found. Try passing init= bootarg." fi -- cgit v1.2.3 From a0c314053b1818a370e6a6aca21dd2594e75ca31 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 31 Jul 2010 14:20:21 -0400 Subject: init: provide fastforward path for the common case when validating init binary. --- init | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'init') diff --git a/init b/init index dee5625..abe3c9b 100755 --- a/init +++ b/init @@ -257,19 +257,22 @@ if [ -n "${init}" ]; then fi fi -# Search for valid init -if [ -z "${init}" ] ; then - for inittest in /sbin/init /etc/init /bin/init /bin/sh; do - if validate_init "${inittest}"; then - init="$inittest" - break - fi - done -fi +# Common case: /sbin/init is present +if [ ! -x "${rootmnt}/sbin/init" ]; then + # ... if it's not available search for valid init + if [ -z "${init}" ] ; then + for inittest in /sbin/init /etc/init /bin/init /bin/sh; do + if validate_init "${inittest}"; then + init="$inittest" + break + fi + done + fi -# No init on rootmount -if ! validate_init "${init}" ; then - panic "No init found. Try passing init= bootarg." + # No init on rootmount + if ! validate_init "${init}" ; then + panic "No init found. Try passing init= bootarg." + fi fi maybe_break init -- cgit v1.2.3