From de9c780f57ae626f05ec1c971c56648250cba03c Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 8 Jun 2005 21:13:41 +0000 Subject: Initial checkin --- scripts/local | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/local (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local new file mode 100644 index 0000000..572f185 --- /dev/null +++ b/scripts/local @@ -0,0 +1,15 @@ +# Local filesystem mounting + +# Parameter: Where to mount the filesystem +mountroot () +{ + # Get the root filesystem type + if [ ! -e ${ROOT} ]; then + panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" + fi + + eval $(fstype < ${ROOT}) + + # Mount root + mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} +} -- cgit v1.2.3 From ac222142f849ed340c3b7a0300a57cc3153e0436 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 9 Jun 2005 17:23:35 +0000 Subject: Add hookscripts --- debian/changelog | 7 ++- debian/initramfs-tools.examples | 1 + docs/example_script | 21 +++++++ init | 4 ++ scripts/functions | 121 ++++++++++++++++++++++++++++++++++++++++ scripts/init-top/test | 18 ++++++ scripts/local | 6 ++ scripts/nfs | 8 +++ 8 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 docs/example_script create mode 100644 scripts/init-top/test (limited to 'scripts/local') 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 'scripts/local') diff --git a/debian/control b/debian/control index fe8d332..89c37e4 100644 --- a/debian/control +++ b/debian/control @@ -2,11 +2,11 @@ Source: initramfs-tools Section: utils Priority: optional Maintainer: Jeff Bailey -Build-Depends-Indep: debhelper (>= 4.0.0), cdbs, busybox-cvs-static +Build-Depends-Indep: debhelper (>= 4.0.0), cdbs Standards-Version: 3.6.1 Package: initramfs-tools Architecture: all -Depends: klibc-utils +Depends: klibc-utils, busybox-cvs-static Description: tools for generting an Ubuntu-style initramfs This package generates an initramfs for an Ubuntu system. diff --git a/init b/init index c09074f..733e7fd 100644 --- a/init +++ b/init @@ -1,4 +1,14 @@ #!/bin/sh -x + +/bin/busybox ln -s /bin/busybox /bin/[ +/bin/busybox ln -s /bin/busybox /bin/basename +/bin/busybox ln -s /bin/busybox /bin/mount +/bin/busybox ln -s /bin/busybox /bin/mkdir +/bin/busybox ln -s /bin/busybox /bin/umount +/bin/busybox ln -s /bin/busybox /bin/sed +/bin/busybox ln -s /bin/busybox /bin/grep +/bin/busybox ln -s /bin/busybox /bin/cat + mkdir /sys mkdir /proc mkdir /tmp @@ -40,7 +50,7 @@ for x in $(cat /proc/cmdline); do esac done -run_scripts /scripts/init_top +run_scripts /scripts/init-top . /scripts/${BOOT} @@ -59,7 +69,7 @@ fi mountroot -run_scripts /scripts/init_bottom +run_scripts /scripts/init-bottom umount /sys umount /proc diff --git a/mkinitramfs b/mkinitramfs index 359ecd2..e1c9a6b 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -99,7 +99,7 @@ done ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init -ln -s /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts +cp -a /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts ln -s ${CONFDIR}/initramfs.conf ${TMPDIR}/conf ln -s /etc/udev ${TMPDIR}/etc @@ -112,14 +112,16 @@ rm ${TMPDIR}/lib/*lsb* # Busybox if [ "x${BUSYBOX}" = "xy" ]; then + rm ${TMPDIR}/bin/sh ln -s /bin/busybox ${TMPDIR}/bin + ln -s /bin/busybox ${TMPDIR}/bin/sh fi # Raid ln -s /sbin/mdadm ${TMPDIR}/bin ln -s /sbin/mdrun ${TMPDIR}/bin -ln -s /bin/grep ${TMPDIR}/bin -ln -s /bin/sed ${TMPDIR}/bin +#ln -s /bin/grep ${TMPDIR}/bin +#ln -s /bin/sed ${TMPDIR}/bin (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) diff --git a/scripts/functions b/scripts/functions index 4a92011..a2ffd54 100644 --- a/scripts/functions +++ b/scripts/functions @@ -8,124 +8,104 @@ panic() fi } -# this function finds scripts with empty depends and adds them -# to the ordered list -dep_reduce() +render() { - i=0 - j=0 - unset neworder - - for entry in "${array[@]}"; do - set - ${entry} + eval "echo -n \${$@}" +} - if [ "$#" -eq "0" ]; then +set_initlist() +{ + unset initlist + for si_x in ${initdir}/*; do + if [ ! -x ${si_x} ]; then continue - elif [ "$#" -eq "1" ]; then - if [ $end -eq 0 ] || - [ x"${order[$((end-1))]}" != x"$1" ]; then - order[$((end))]=$1 - end=$((end+1)) - neworder[$((j))]=$1 - j=$((j+1)) - fi - - array[$((i))]= fi - - i=$((i+1)) + initlist="${initlist} $(basename ${si_x})" done } -dep_remove() +reduce_satisfied() { - i=0 - - # for each row in the array - for entry in "${array[@]}"; do - unset newentry - - set - ${entry} - - # for each dependency of the script - for dep in "$@"; do - new=1 - - # for each new dependency - for tmp in "${order[@]}"; do - if [ x"$dep" = x"$tmp" ]; then - new=0 - fi - done - - if [ x"$new" = x"1" ]; then - newentry="$newentry $dep" - fi - done + deplist="$(render array_${1})" + for rs_x in ${runlist}; do + pop_list_item ${rs_x} ${deplist} + deplist=${tmppop} + done + eval array_${1}=\"${deplist}\" +} - array[$((i))]="$newentry" - i=$((i+1)) +get_prereqs() +{ + set_initlist + for gp_x in ${initlist}; do + tmp=$(${initdir}/${gp_x} prereqs) + eval array_${gp_x}=\"${tmp}\" done } -run_scripts() +count_unsatisfied() { - initdir=${1} - scripts=$(ls ${initdir}) - order= - end=0 - array= + set - ${@} + return ${#} +} - # FIXME: New algorithm - # array of strings: "$file $prereqs" - # iterate over all strings; find empty strings (just $file) - # add to order, delete from all strings and zero out entry - # repeat until all strings are empty - - i=0 - for file in $scripts; do - # if it's not a regular file, or if it's not executable, skip it - if ! [ -f ${initdir}/${file} ] || ! [ -x ${initdir}/${file} ]; then +# Removes $1 from initlist +pop_list_item() +{ + item=${1} + shift + set - ${@} + unset tmppop + # Iterate + for pop in ${@}; do + if [ ${pop} = ${item} ]; then continue fi - - array[$((i))]="$file $(${initdir}/${file} prereqs)" - i=$((i+1)) + tmppop="${tmppop} ${pop}" done - # No scripts in directory, bail. - if [ ${i} -eq 0 ]; then - return 0 - fi - - while /bin/true; do - set - ${array[@]} - - if [ "$#" -eq "0" ]; then - break - fi - - dep_reduce - - dep_remove - - if [ "${#neworder}" -eq "0" ]; then - for x in "${array[@]}"; do - if [ x"$x" != x"" ]; then - printf "could not reduce further; " - printf "circular dependencies\n" - return 1 - fi - done - - # we're done! - break +} + +# This function generates the runlist, so we clear it first. +reduce_prereqs() +{ + unset runlist + set_initlist + set - ${initlist} + i=$# + # Loop until there's no more in the queue to loop through + while [ ${i} -ne 0 ]; do + oldi=${i} + for rp_x in ${initlist}; do + reduce_satisfied ${rp_x} + count_unsatisfied $(render array_${rp_x}) + cnt=${?} + if [ ${cnt} -eq 0 ]; then + runlist="${runlist} ${rp_x}" + pop_list_item ${rp_x} ${initlist} + initlist=${tmppop} + i=$((${i} - 1)) + fi + done + if [ ${i} -eq ${oldi} ]; then + echo "PANIC: Circular dependancy. Exiting." >&2 + exit 1 fi done - - # run the initscripts - for script in "${order[@]}"; do - ${initdir}/${script} +} + +call_scripts() +{ + echo ${runlist} + for cs_x in ${runlist}; do + ${initdir}/${cs_x} done -} +} +run_scripts() +{ + initdir=${1} + get_prereqs + reduce_prereqs + call_scripts +} diff --git a/scripts/init-top/test b/scripts/init-top/test deleted file mode 100644 index e4d59fb..0000000 --- a/scripts/init-top/test +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -PREREQ="" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -echo "Got here!" diff --git a/scripts/local b/scripts/local index ffbd230..b322f09 100644 --- a/scripts/local +++ b/scripts/local @@ -3,7 +3,7 @@ # Parameter: Where to mount the filesystem mountroot () { - run_scripts /scripts/local_top + run_scripts /scripts/local-top # Get the root filesystem type if [ ! -e ${ROOT} ]; then @@ -12,10 +12,10 @@ mountroot () eval $(fstype < ${ROOT}) - run_scripts /scripts/local_premount + run_scripts /scripts/local-premount # Mount root mount ${ro} -t ${FSTYPE} ${ROOT} ${rootmnt} - run_scripts /scripts/local_bottom + run_scripts /scripts/local-bottom } diff --git a/scripts/local-top/md b/scripts/local-top/md new file mode 100644 index 0000000..d6f7e94 --- /dev/null +++ b/scripts/local-top/md @@ -0,0 +1,18 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +/bin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index d0f1600..9860ea7 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -2,7 +2,7 @@ # Paramter: Where the root should be mounted mountroot () { - run_scripts /scripts/nfs_top + run_scripts /scripts/nfs-top ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf @@ -10,10 +10,10 @@ mountroot () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi - run_scripts /scripts/nfs_premount + run_scripts /scripts/nfs-premount nfsmount ${NFSROOT} ${rootmnt} - run_scripts /scripts/nfs_bottom + run_scripts /scripts/nfs-bottom } -- cgit v1.2.3 From 43528be821f50d8676ba29d7e51be6915d74cfae Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Tue, 14 Jun 2005 21:39:18 +0000 Subject: export command line parameters to run scripts. honour commandline readonly/readwrite parameters for nfs. Release initramfs 0.8 --- debian/changelog | 11 +++++++---- init | 14 +++++++------- scripts/local | 8 +++++++- scripts/nfs | 8 +++++++- 4 files changed, 28 insertions(+), 13 deletions(-) (limited to 'scripts/local') 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 bf8d6100fb13127151c309d842185b3a250ecfff Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Fri, 17 Jun 2005 12:17:42 +0000 Subject: Integrate Matt Zimmerman's changes to initramfs --- debian/changelog | 15 +++++++++++++-- init | 10 +++------- mkinitramfs | 25 +++++++++++++++++++++++-- scripts/functions | 20 ++++++++++++++++++++ scripts/local | 2 ++ 5 files changed, 61 insertions(+), 11 deletions(-) (limited to 'scripts/local') 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 f12ad818ffc10d8243cd75d552226273df3d65a0 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Tue, 21 Jun 2005 01:31:54 +0000 Subject: * Default to currently running kernel version. Based on a patch from maximilian attems, thanks! * Handle module arguments in /etc/mkinitramfs/modules * Do hookscripts at generation time. Drop things into /usr/share/initramfs-tools/hooks or /etc/mkinitramfs/hooks * Make sure local-bottom and nfs-bottom get created Thanks to Karl Hegbloom for these three patches! * Prune stray echo from call_scripts * Load raid1 for now so that md setups will work. * Detect ide modules load Thanks to Jeff Waugh for initial testing of this! --- conf/modules | 4 ++++ debian/changelog | 20 ++++++++++++++++++++ debian/dirs | 6 ++++-- mkinitramfs | 38 ++++++++++++++++++++++++++------------ scripts/functions | 49 ++++++++++++++++++++++++++++++++++++++++--------- scripts/local | 2 +- scripts/local-top/md | 3 +++ scripts/nfs | 1 + 8 files changed, 99 insertions(+), 24 deletions(-) (limited to 'scripts/local') diff --git a/conf/modules b/conf/modules index 8f12189..0067831 100644 --- a/conf/modules +++ b/conf/modules @@ -1,4 +1,8 @@ # List of modules that you want to include in your initramfs. +# +# Syntax: module_name [args ...] +# +# # This might be good choices: # # raid1 diff --git a/debian/changelog b/debian/changelog index 07d6a4e..54d3fcd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,31 @@ initramfs-tools (0.12) breezy; urgency=low + "I am not young enough to know everything." - Oscar Wilde + * Don't complain if /etc/mkinitramfs/modules doesn't exist. * Make sure that raid1 is pulled in. * Include /etc/modprobe.d/aliases in the initramfs + * Default to currently running kernel version. + Based on a patch from maximilian attems, thanks! + + * Handle module arguments in /etc/mkinitramfs/modules + + * Do hookscripts at generation time. Drop things into + /usr/share/initramfs-tools/hooks or /etc/mkinitramfs/hooks + + * Make sure local-bottom and nfs-bottom get created + Thanks to Karl Hegbloom for these three patches! + + * Prune stray echo from call_scripts + + * Load raid1 for now so that md setups will work. + + * Detect ide modules load + Thanks to Jeff Waugh for initial testing of this! + -- Jeff Bailey Mon, 20 Jun 2005 23:05:04 +0000 initramfs-tools (0.11) breezy; urgency=low diff --git a/debian/dirs b/debian/dirs index ef40692..94484bb 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,7 +1,9 @@ etc/mkinitramfs/init-bottom etc/mkinitramfs/init-top -etc/mkinitramfs/local-premount etc/mkinitramfs/local-top -etc/mkinitramfs/nfs-premount +etc/mkinitramfs/local-premount +etc/mkinitramfs/local-bottom etc/mkinitramfs/nfs-top +etc/mkinitramfs/nfs-premount +etc/mkinitramfs/nfs-bottom usr/share/initramfs-tools/modules.d diff --git a/mkinitramfs b/mkinitramfs index f06811e..4dabfce 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,7 +1,17 @@ #!/bin/sh +# For dependency ordered mkinitramfs hook scripts. +. /usr/share/initramfs-tools/scripts/functions + # Takes a file containing a list of modules to be added as an argument # Figures out dependancies and adds it in. +# +# File syntax: +# +# # comment +# modprobe_module_name [args ...] +# [...] +# manual_add_modules() { # Sanity check @@ -9,8 +19,8 @@ manual_add_modules() return fi - for x in $(sed -e '/^#/d' ${1}); do - for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do + sed -e '/^#/d' ${1} | while read module rest; do + for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then continue @@ -18,7 +28,7 @@ manual_add_modules() mkdir -p ${TMPDIR}/$(dirname ${y}) ln -s ${y} ${TMPDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) >>${TMPDIR}/conf/modules + echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules done done } @@ -51,7 +61,7 @@ auto_add_modules() copy_modules_dir kernel/fs/xfs # These aren't caught by the above but really need to be there: - for x in mbcache nfs af_packet raid1; do + for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then @@ -99,9 +109,6 @@ while getopts "d:ko:r:" flag; do o) outfile="${OPTARG}" ;; - v) - version="${OPTARG}" - ;; k) keep="y" ;; @@ -112,14 +119,18 @@ shift $((${OPTIND} - 1)) . ${CONFDIR}/initramfs.conf -if [ x${outfile} = x ] || [ ${#} -ne 1 ]; then +if [ x${outfile} = x ]; then usage fi # And by "version" we really mean path to kernel modules # This is braindead, and exists to preserve the interface with mkinitrd -version=${1} -[ $# -gt 0 ] || unset version +if [ ${#} -ne 1 ]; then + version=$(uname -r) +else + version="${1}" +fi + case ${version} in /lib/modules/*/[!/]*) ;; @@ -136,8 +147,6 @@ case ${version} in ;; esac -version="${version-$(uname -r)}" - if [ -d ${outfile} ]; then echo "${outfile} is a directory" exit 1 @@ -193,6 +202,11 @@ ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d ln -s /sbin/mdadm ${TMPDIR}/sbin ln -s /sbin/mdrun ${TMPDIR}/sbin +run_scripts /usr/share/initramfs-tools/hooks +run_scripts /etc/mkinitramfs/hooks + +# FIXME catenate extra cpio.gz here >>${outfile} + (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) if [ "${keep}" = "y" ]; then diff --git a/scripts/functions b/scripts/functions index 73b773a..5fb8c04 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,3 +1,5 @@ +# -*- shell-script -*- + panic() { echo $@ @@ -92,7 +94,6 @@ reduce_prereqs() call_scripts() { - echo ${runlist} for cs_x in ${runlist}; do ${initdir}/${cs_x} done @@ -106,9 +107,44 @@ run_scripts() call_scripts } +ide_boot_events() { + [ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return + + for drive in /proc/ide/*/media; do + # nothing to do if the device has already been took in charge + unit=${drive#/proc/ide/}; unit=${unit%/media} + [ -d /sys/block/$unit ] && continue + + read media < $drive + case "$media" in + disk) MODULE=ide-disk ;; + cdrom) MODULE=ide-cd ;; + tape) MODULE=ide-tape ;; + floppy) MODULE=ide-floppy ;; + *) MODULE=ide-generic ;; + esac + + modprobe -q ${MODULE} + done +} + load_modules() { - depmod + depmod -a + + # Load custom modules first + if [ -e /conf/modules ]; then + cat /conf/modules | while read m; do + if [ -z "$m" ] \ + || expr "$m" : "#" >/dev/null \ + || expr "$m" : "[ \t]+#?" > /dev/null + then + continue; + else + modprobe -v $m + fi + done + fi for x in /sys/bus/pci/devices/*; do if [ -e ${x}/modalias ]; then @@ -125,11 +161,6 @@ load_modules() fi done - # Load the modules - # FIXME - do module options here - if [ -e /conf/modules ]; then - for x in $(cat /conf/modules); do - modprobe -v $x - done - fi + ide_boot_events + } diff --git a/scripts/local b/scripts/local index 99eea77..4a17abb 100644 --- a/scripts/local +++ b/scripts/local @@ -1,4 +1,4 @@ -# Local filesystem mounting +# Local filesystem mounting -*- shell-script -*- # Parameter: Where to mount the filesystem mountroot () diff --git a/scripts/local-top/md b/scripts/local-top/md index 864ffe4..062852f 100644 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -15,4 +15,7 @@ prereqs) ;; esac +# FIXME detect this! +modprobe raid1 + /sbin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index 11c61f8..1e2be2c 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -1,3 +1,4 @@ +# NFS filesystem mounting *- shell-script -*- # Paramter: Where the root should be mounted mountroot () -- cgit v1.2.3 From 2c72958bfc090b046e21e9eaad9134235095ad30 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 30 Jun 2005 00:05:01 +0000 Subject: * Use detailed logging now for debian/changelog. We have at least three people hacking now, and details would probably be useful. * debian/TODO: Update * debian/dirs: Sort and add usr/share/initramfs-tools/hooks * debian/initramfs-tools.examples: Add docs/example_hook and docs/example_hook_cpiogz * debian/initramfs-tools.install: Pretty Print. * debian/rules: Ensure that mkinitramfs is executable * docs/example_script: New file * init: Add concept of 'quiet', be verbose if not specified * mkinitramfs: Do not load script functions until needed Clear up comments / documentation Use DESTDIR instead of TMPDIR Add ability to link in extra hunks into the cpio file Cosmetic cleanups * scripts/functions: Add lsb stype log_FOO_msg functions * scripts/local: Add logging * scripts/nfs: Add logging --- debian/TODO | 2 + debian/changelog | 39 +++++++++++++++ debian/dirs | 9 ++-- debian/initramfs-tools.examples | 2 + debian/initramfs-tools.install | 8 +-- debian/rules | 2 +- docs/example_script | 73 ++++++++++++++++++++++++++- mkinitramfs | 106 +++++++++++++++++++++++----------------- scripts/functions | 39 ++++++++++++++- scripts/local | 8 +++ scripts/nfs | 10 +++- 11 files changed, 240 insertions(+), 58 deletions(-) (limited to 'scripts/local') diff --git a/debian/TODO b/debian/TODO index bf7e07d..d080de3 100644 --- a/debian/TODO +++ b/debian/TODO @@ -1,6 +1,8 @@ TODO ==== + o Grep for TODO and FIXME and do those. =) + o Get udev compiled against klibc o Integrate hotplug-ng diff --git a/debian/changelog b/debian/changelog index 54d3fcd..6c37206 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +initramfs-tools (0.13) breezy; urgency=low + + "We live in age when unnecessary things are our only necessities." + - Oscar Wilde + + * Use detailed logging now for debian/changelog. We have at least + three people hacking now, and details would probably be useful. + + * debian/TODO: Update + + * debian/dirs: Sort and add usr/share/initramfs-tools/hooks + + * debian/initramfs-tools.examples: Add docs/example_hook and + docs/example_hook_cpiogz + + * debian/initramfs-tools.install: Pretty Print. + + * debian/rules: Ensure that mkinitramfs is executable + + * docs/example_script: New file + + * init: Add concept of 'quiet', be verbose if not specified + + * mkinitramfs: Do not load script functions until needed + Clear up comments / documentation + Use DESTDIR instead of TMPDIR + Add ability to link in extra hunks into the cpio file + Cosmetic cleanups + + * scripts/functions: Add lsb stype log_FOO_msg functions + + * scripts/local: Add logging + + * scripts/nfs: Add logging + + Thanks to Karl Hegbloom for most of these patches! + + -- Jeff Bailey Wed, 29 Jun 2005 23:50:56 +0000 + initramfs-tools (0.12) breezy; urgency=low "I am not young enough to know everything." - Oscar Wilde diff --git a/debian/dirs b/debian/dirs index 94484bb..ac6210e 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,9 +1,10 @@ etc/mkinitramfs/init-bottom etc/mkinitramfs/init-top -etc/mkinitramfs/local-top -etc/mkinitramfs/local-premount etc/mkinitramfs/local-bottom -etc/mkinitramfs/nfs-top -etc/mkinitramfs/nfs-premount +etc/mkinitramfs/local-premount +etc/mkinitramfs/local-top etc/mkinitramfs/nfs-bottom +etc/mkinitramfs/nfs-premount +etc/mkinitramfs/nfs-top +usr/share/initramfs-tools/hooks usr/share/initramfs-tools/modules.d diff --git a/debian/initramfs-tools.examples b/debian/initramfs-tools.examples index 0e8472b..9f67297 100644 --- a/debian/initramfs-tools.examples +++ b/debian/initramfs-tools.examples @@ -1,2 +1,4 @@ conf/modules docs/example_script +docs/example_hook +docs/example_hook_cpiogz diff --git a/debian/initramfs-tools.install b/debian/initramfs-tools.install index e76186f..a2a78f5 100644 --- a/debian/initramfs-tools.install +++ b/debian/initramfs-tools.install @@ -1,4 +1,4 @@ -mkinitramfs usr/sbin -init usr/share/initramfs-tools -scripts usr/share/initramfs-tools -conf/initramfs.conf etc/mkinitramfs +mkinitramfs usr/sbin +init usr/share/initramfs-tools +scripts usr/share/initramfs-tools +conf/initramfs.conf etc/mkinitramfs diff --git a/debian/rules b/debian/rules index 0a1575f..a1b8695 100644 --- a/debian/rules +++ b/debian/rules @@ -3,4 +3,4 @@ include /usr/share/cdbs/1/rules/debhelper.mk common-build-arch:: - chmod +x init + chmod +x init mkinitramfs diff --git a/docs/example_script b/docs/example_script index 111b0d8..221c888 100644 --- a/docs/example_script +++ b/docs/example_script @@ -1,7 +1,52 @@ #!/bin/sh -# List the soft prerequisites here. So if there's something you know -# should be run first iff it exists. +# +# This script is run inside of the initramfs environment during the +# system boot process. It is installed there by 'mkinitramfs'. The +# package that owns it may opt to install it in either an appropriate +# location under "/usr/share/initramfs-tools/scripts/", or a similar +# location under "/etc/mkinitramfs/scripts/", depending upon whether +# it should be considered to be a user modifiable conffile or not. +# +# TODO: How do we deal with the case where the package that installed +# this has been removed but not purged, if we always arbitrarily +# copy all of these scripts into the initramfs? +# +# * The available toolset is limited inside this environment... +# +# TODO: document that toolset in the man page. +# +# * /dev, /proc, and /sys are already mounted. / is a ?? ro/rw +# filesystem... etc. more documentation. +# +# * It is expected that /proc and /sys will be umounted before +# changing over to the real root file system, so you must not keep +# any files open on them beyond these scripts. +# +# * You may like to strip these documentation comments from this +# example if you take it for a template, to save a little space in +# the initramfs, since nobody will ever read it from inside of +# there anyhow. +# + +# +# The environment contains at least the following variables: +# +# TODO: Decide what environment variables are meaningful and defined +# in this context, then document them as part of the interface. +# +# Because this script will be run as a full separate process, rather +# than sourced inside the context of the driver script, if it needs to +# pass information to another script that may run after it, it must do +# so by writing data to a file location known to both scripts. Simply +# setting an environment variable will not work. +# + +# +# List the soft prerequisites here. This is a space separated list of +# names, of scripts that are in the same directory as this one, that +# must be run before this one can be. +# PREREQ="" prereqs() @@ -18,4 +63,28 @@ prereqs) esac # Do the work here. + echo "Got here!" + +# Handle an error: + +if [ -n "$an_error_occured" ]; +then + # + # TODO: Do we need 'warn()', 'error()', and/or 'fatal()' for this? + # I think we ultimately do, and that they need to be in their own + # well-documented location so that an overlay can override them. + # Think 'usplash' progress updates. + # + echo "An error occured in $0: $an_error_occured" >&2 + exit 1 + # + # TODO: Decide if different error codes are meaningful, what they + # mean, and what the semantics of them are wrt 'init' pass + # or panic. Consider naming the error values with mnemonic + # symbols rather than magic numbers. + # +fi + +exit 0 + diff --git a/mkinitramfs b/mkinitramfs index 4dabfce..c05fa47 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,12 +1,9 @@ #!/bin/sh -# For dependency ordered mkinitramfs hook scripts. -. /usr/share/initramfs-tools/scripts/functions - -# Takes a file containing a list of modules to be added as an argument -# Figures out dependancies and adds it in. +# Takes a file containing a list of modules to be added as an +# argument, figures out dependancies, and adds them. # -# File syntax: +# Input file syntax: # # # comment # modprobe_module_name [args ...] @@ -22,13 +19,13 @@ manual_add_modules() sed -e '/^#/d' ${1} | while read module rest; do for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do # Prune duplicates - if [ -e ${TMPDIR}/${y} ]; then + if [ -e ${DESTDIR}/${y} ]; then continue fi - mkdir -p ${TMPDIR}/$(dirname ${y}) - ln -s ${y} ${TMPDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules + mkdir -p ${DESTDIR}/$(dirname ${y}) + ln -s ${y} ${DESTDIR}/$(dirname ${y}) + echo $(basename ${y} .ko) "${rest}" >>${DESTDIR}/conf/modules done done } @@ -36,7 +33,7 @@ manual_add_modules() # Copy entire subtrees to the initramfs copy_modules_dir() { - tmpdir_modbase=${TMPDIR}/lib/modules/${version} + tmpdir_modbase=${DESTDIR}/lib/modules/${version} mkdir -p $(dirname ${tmpdir_modbase}/${1}) cp -a /lib/modules/${version}/${1} ${tmpdir_modbase}/${1} } @@ -64,13 +61,13 @@ auto_add_modules() for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates - if [ -e ${TMPDIR}/${y} ]; then + if [ -e ${DESTDIR}/${y} ]; then continue fi - mkdir -p ${TMPDIR}/$(dirname ${y}) - ln -s ${y} ${TMPDIR}/$(dirname ${y}) - depmod -b ${TMPDIR} ${version} + mkdir -p ${DESTDIR}/$(dirname ${y}) + ln -s ${y} ${DESTDIR}/$(dirname ${y}) + depmod -b ${DESTDIR} ${version} done done } @@ -96,6 +93,8 @@ EOF # Defaults keep="n" CONFDIR="/etc/mkinitramfs" +verbose="n" +errors_to="2>/dev/null" while getopts "d:ko:r:" flag; do case $flag in @@ -117,6 +116,9 @@ done shift $((${OPTIND} - 1)) +# For dependency ordered mkinitramfs hook scripts. +. /usr/share/initramfs-tools/scripts/functions + . ${CONFDIR}/initramfs.conf if [ x${outfile} = x ]; then @@ -157,10 +159,21 @@ if [ ! -e /lib/modules/${version} ]; then exit 1 fi -TMPDIR=$(mktemp -d) || exit 1 -mkdir -p ${TMPDIR}/modules ${TMPDIR}/conf ${TMPDIR}/etc -mkdir -p ${TMPDIR}/bin ${TMPDIR}/lib ${TMPDIR}/scripts -mkdir -p ${TMPDIR}/sbin +DESTDIR=$(mktemp -t -d mkinitramfs_XXXXXX) || exit 1 +__TMPCPIOGZ=$(mktemp -t mkinitramfs-OL_XXXXXX) || exit 1 + +# Export environment for hook scripts. +# +export version +export CONFDIR +export DESTDIR + +# Private, used by 'catenate_cpiogz'. +export __TMPCPIOGZ + +for d in bin conf etc lib modules sbin scripts; do + mkdir -p ${DESTDIR}/${d} +done for x in ${CONFDIR}/modules /usr/share/initramfs-tools/modules.d/*; do manual_add_modules ${x} @@ -171,46 +184,51 @@ auto_add_modules # Have to do each file, because cpio --dereference doesn't recurse down # symlinks. -ln -s /usr/lib/klibc/bin/* ${TMPDIR}/bin -ln -s /usr/lib/klibc/lib/* ${TMPDIR}/lib -ln -s /usr/share/initramfs-tools/init ${TMPDIR}/init -cp -a /usr/share/initramfs-tools/scripts/* ${TMPDIR}/scripts -ln -s ${CONFDIR}/initramfs.conf ${TMPDIR}/conf -ln -s /etc/udev ${TMPDIR}/etc +ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin +ln -s /usr/lib/klibc/lib/* ${DESTDIR}/lib +ln -s /usr/share/initramfs-tools/init ${DESTDIR}/init +cp -a /usr/share/initramfs-tools/scripts/* ${DESTDIR}/scripts +ln -s ${CONFDIR}/initramfs.conf ${DESTDIR}/conf +ln -s /etc/udev ${DESTDIR}/etc # Hack until udev is built with klibc -ln -s /sbin/udev ${TMPDIR}/bin -ln -s /sbin/udevstart ${TMPDIR}/bin -ln -s /lib/libc.so.* ${TMPDIR}/lib -ln -s /lib/ld*.so.* ${TMPDIR}/lib -rm ${TMPDIR}/lib/*lsb* +ln -s /sbin/udev ${DESTDIR}/bin +ln -s /sbin/udevstart ${DESTDIR}/bin +ln -s /lib/libc.so.* ${DESTDIR}/lib +ln -s /lib/ld*.so.* ${DESTDIR}/lib +rm ${DESTDIR}/lib/*lsb* # Busybox -rm ${TMPDIR}/bin/sh -ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/sh +rm ${DESTDIR}/bin/sh +ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/sh # This is ugly, but needed atm to make the builtins work =( -ln -s /usr/lib/initramfs-tools/bin/busybox ${TMPDIR}/bin/busybox +ln -s /usr/lib/initramfs-tools/bin/busybox ${DESTDIR}/bin/busybox # Modutils -ln -s /sbin/modprobe ${TMPDIR}/sbin -ln -s /sbin/depmod ${TMPDIR}/sbin -ln -s /sbin/rmmod ${TMPDIR}/sbin -mkdir -p ${TMPDIR}/etc/modprobe.d -ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d +ln -s /sbin/modprobe ${DESTDIR}/sbin +ln -s /sbin/depmod ${DESTDIR}/sbin +ln -s /sbin/rmmod ${DESTDIR}/sbin +mkdir -p ${DESTDIR}/etc/modprobe.d +ln -s /etc/modprobe.d/aliases ${DESTDIR}/etc/modprobe.d # Raid -ln -s /sbin/mdadm ${TMPDIR}/sbin -ln -s /sbin/mdrun ${TMPDIR}/sbin +ln -s /sbin/mdadm ${DESTDIR}/sbin +ln -s /sbin/mdrun ${DESTDIR}/sbin run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks -# FIXME catenate extra cpio.gz here >>${outfile} +(cd ${DESTDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) -(cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) +if [ -s ${__TMPCPIOGZ} ]; then + cat ${__TMPCPIOGZ} >>${outfile} +fi if [ "${keep}" = "y" ]; then - echo "Working files in ${TMPDIR}" + echo "Working files in ${DESTDIR} and overlay in ${__TMPCPIOGZ}" else - rm -rf "${TMPDIR}" + rm -rf "${DESTDIR}" + rm -rf "${__TMPCPIOGZ}" fi + +exit 0 diff --git a/scripts/functions b/scripts/functions index 5fb8c04..1899a14 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,9 +1,45 @@ # -*- shell-script -*- +_log_msg() +{ + if [ "$quiet" = "y" ]; then return; fi + echo "$@" +} + +log_success_msg() +{ + _log_msg "Success: $@" +} + +log_failure_msg() +{ + _log_msg "Failure: $@" +} + +log_warning_msg() +{ + _log_msg "Warning: $@" +} + +log_begin_msg() +{ + _log_msg "Begin: $@ ..." +} + +log_end_msg() +{ + _log_msg "Done." +} + +# update_progress() # ToDo: NOP placeholder... what else for usplash? +# { +# : +# } + panic() { echo $@ - FS1='(initramfs) ' exec /bin/sh + FS1='(initramfs) ' exec /bin/sh /dev/console 2>&1 } render() @@ -162,5 +198,4 @@ load_modules() done ide_boot_events - } diff --git a/scripts/local b/scripts/local index 4a17abb..bcc96ad 100644 --- a/scripts/local +++ b/scripts/local @@ -3,7 +3,9 @@ # Parameter: Where to mount the filesystem mountroot () { + log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top + log_end_msg # Get the root filesystem type if [ ! -e ${ROOT} ]; then @@ -12,7 +14,9 @@ mountroot () eval $(fstype < ${ROOT}) + log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount + log_end_msg if [ ${readonly} = y ]; then roflag=-r @@ -20,10 +24,14 @@ mountroot () roflag=-w fi + # FIXME This has no error checking modprobe ${FSTYPE} + # FIXME This has no error checking # Mount root mount ${roflag} -t ${FSTYPE} ${ROOT} ${rootmnt} + log_begin_msg "Running /scripts/log-bottom" run_scripts /scripts/local-bottom + log_end_msg } diff --git a/scripts/nfs b/scripts/nfs index 1e2be2c..8149e86 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -1,9 +1,13 @@ -# NFS filesystem mounting *- shell-script -*- +# NFS filesystem mounting -*- shell-script -*- + +# FIXME This needs error checking # Paramter: Where the root should be mounted mountroot () { + log_begin_msg "Running /scripts/nfs-top" run_scripts /scripts/nfs-top + log_end_msg modprobe nfs # For DHCP @@ -15,7 +19,9 @@ mountroot () NFSROOT=${ROOTSERVER}:${ROOTPATH} fi + log_begin_msg "Running /scripts/nfs-premount" run_scripts /scripts/nfs-premount + log_end_msg if [ ${readonly} = y ]; then roflag="-o ro" @@ -25,6 +31,8 @@ mountroot () nfsmount ${roflag} ${NFSROOT} ${rootmnt} + log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom + log_end_msg } -- cgit v1.2.3 From f0a04306ac01b22e80cbd1d2a7578a1a3efa6e5f Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Thu, 25 Aug 2005 16:21:19 -0400 Subject: initramfs-tools (0.23) breezy; urgency=low "This suspense is terrible. I hope it will last." - Oscar Wilde * scripts/local: Quote ${ROOT} so that an empty value causes us to drop to a shell. Thanks to Matt Zimmerman for this fix! - hook-functions (auto_add_modules): Add atiixp and opti621 to the IDE set. - hook-functions (dep_add_modules): Detect i2o and add i2o_block (auto_add_modules): Include i2o_block. - scripts/functions (i2o_boot_events): New function (load_modules): Call it. (Ubuntu# 13806) Thanks to Tollef Fog Heen for the i2o patch! - debian/control: Depend on udev. Thanks to Alexander Butenko for troubleshooting this with me. - init: Move the /dev directory to the root filesystem. Handle all the udev bind mounts as needed. Make sure input and output is associated with dev/console. - scripts/functions (parse_numeric): Exit if we're refering to a path. Otherwise override root setting to be /dev/root. - init: Call parse_numeric when setting the root variable. - scripts/local-top/lvm: When using a numeric root, call vgchange -ay Don't attempt to start LVM on regular partitions. (Ubuntu #13365, #13778, and some of #13399) - scripts/local-top/lvm: Cope with -'s in the Volume Group and logical volume names. (Ubuntu #13387) Thanks to Stephen Shirley for the patch! -- Jeff Bailey Thu, 25 Aug 2005 11:48:15 -0400 initramfs-tools (0.22) breezy; urgency=low * Fix argument handling in force_load hook-function * Add "sleep 3" to scripts/nfs as a nasty hack around bug #12942 -- Matt Zimmerman Fri, 19 Aug 2005 23:50:16 -0700 --- debian/changelog | 48 ++++++++++++++++++++++++++++++++++++++++- debian/control | 2 +- debian/initramfs-tools.postinst | 1 + hook-functions | 13 +++++++++-- init | 12 ++++++++++- scripts/functions | 15 +++++++++++++ scripts/local | 2 +- scripts/local-top/lvm | 17 ++++++++++++--- scripts/nfs | 1 + 9 files changed, 102 insertions(+), 9 deletions(-) (limited to 'scripts/local') 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 bee1355e2c21a86751648b6f0df8a6e4e4e5a45d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 21 Oct 2005 18:38:32 +0200 Subject: added latest upstream fixes :-) --- debian/changelog | 19 ++++++++++++++++++- hook-functions | 4 ++-- init | 4 ++-- scripts/local | 12 ++++++------ scripts/nfs | 18 +++++++++++------- 5 files changed, 39 insertions(+), 18 deletions(-) (limited to 'scripts/local') 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 efc90bbb5f64353714175bb4b2225422f3de86b2 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 5 Dec 2005 17:19:00 +0100 Subject: resync with latest ubuntu, split udev done by hand. --- break.txt | 4 ++ debian/changelog | 87 +++++++++++++++++++++++++++++++++++++- debian/initramfs-tools.postinst | 5 +++ hooks/acpid | 24 ----------- hooks/thermal | 28 +++++++++++++ hooks/udev | 35 ---------------- init | 69 +++++++++++-------------------- mkinitramfs | 1 + scripts/functions | 92 +++++++---------------------------------- scripts/init-premount/acpid | 19 --------- scripts/init-premount/thermal | 23 +++++++++++ scripts/local | 11 ++++- scripts/nfs | 1 - 13 files changed, 195 insertions(+), 204 deletions(-) create mode 100644 break.txt delete mode 100755 hooks/acpid create mode 100755 hooks/thermal delete mode 100755 hooks/udev delete mode 100755 scripts/init-premount/acpid create mode 100755 scripts/init-premount/thermal (limited to 'scripts/local') 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 7c5923bbc4ec57eb144b773c0abc8711ffda292a Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 12 Dec 2005 11:21:27 +0100 Subject: merge ubuntu modprobe silence stuff and cp all /etc/modprobe.d :) --- debian/changelog | 14 ++++++++++++++ mkinitramfs | 3 +-- scripts/functions | 2 +- scripts/init-premount/thermal | 6 +++--- scripts/local | 9 +-------- scripts/local-top/evms | 2 +- scripts/local-top/lvm | 2 +- scripts/local-top/md | 2 +- scripts/nfs | 4 ++-- 9 files changed, 25 insertions(+), 19 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index 6080b93..8683c70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ initramfs-tools (0.43) unstable; urgency=low * scripts/functions: remove old duplicate suspend support. + * Sync with 0.40ubuntu8. (Closes: #337318) + -- maximilian attems Wed, 7 Dec 2005 13:26:33 +0100 initramfs-tools (0.42) unstable; urgency=low @@ -38,6 +40,18 @@ initramfs-tools (0.42) unstable; urgency=low -- maximilian attems Mon, 5 Dec 2005 12:59:59 +0100 +initramfs-tools (0.40ubuntu8) dapper; urgency=low + + * Call modprobe everywhere with "-Qb" to silence messages and allow user + blacklisting. + * Copy the entire /etc/modprobe.d directory to the initramfs, so we can + pick up all user blacklists and options. + * Remove the slumber for SCSI/USB devices from the local filesystem mount + script, udev's init-premount script will take care of this when + necessary. + + -- Scott James Remnant Wed, 7 Dec 2005 16:18:12 +0000 + initramfs-tools (0.40ubuntu7) dapper; urgency=low * remove "sleep 3" from the nfs script before the nfsmount command, diff --git a/mkinitramfs b/mkinitramfs index 9892a36..6855ff3 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -180,8 +180,7 @@ copy_exec /sbin/modprobe /sbin copy_exec /sbin/depmod /sbin copy_exec /sbin/rmmod /sbin mkdir -p "${DESTDIR}/etc/modprobe.d" -copy_exec /etc/modprobe.d/aliases /etc/modprobe.d -copy_exec /etc/modprobe.d/blacklist /etc/modprobe.d +cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d" run_scripts /usr/share/initramfs-tools/hooks run_scripts /etc/mkinitramfs/hooks diff --git a/scripts/functions b/scripts/functions index cde870d..da77542 100644 --- a/scripts/functions +++ b/scripts/functions @@ -170,7 +170,7 @@ load_modules() then continue; else - modprobe -q $m + modprobe -Qb $m fi done fi diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index e0d79c3..64858af 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -16,8 +16,8 @@ prereqs) esac # For ACPI systems -modprobe -q fan -modprobe -q thermal +modprobe -Qb fan +modprobe -Qb thermal # For ppc64 systems -modprobe -q therm_pm72 +modprobe -Qb therm_pm72 diff --git a/scripts/local b/scripts/local index df09298..6c08f39 100644 --- a/scripts/local +++ b/scripts/local @@ -7,13 +7,6 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg - # Wait for SCSI/USB/etc. devices for a bit - slumber=10 - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do - /bin/sleep 1 - slumber=$(( ${slumber} - 1 )) - done - # Get the root filesystem type while [ ! -e "${ROOT}" ]; do panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" @@ -32,7 +25,7 @@ mountroot () fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe -Qb ${FSTYPE} # FIXME This has no error checking # Mount root diff --git a/scripts/local-top/evms b/scripts/local-top/evms index 46fca5d..563a9ae 100755 --- a/scripts/local-top/evms +++ b/scripts/local-top/evms @@ -26,7 +26,7 @@ esac unset evms for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do - modprobe -q $module + modprobe -Qb $module done /sbin/evms_activate diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 9f608af..40c4e9b 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -26,7 +26,7 @@ case ${vg} in ;; esac -modprobe -q dm-mod +modprobe -Qb dm-mod vgchange -ay diff --git a/scripts/local-top/md b/scripts/local-top/md index c7515fe..4132159 100755 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -25,7 +25,7 @@ for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do fi raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') if [ "$raidlvl" ]; then - modprobe -q ${raidlvl} 2>/dev/null + modprobe -Qb ${raidlvl} 2>/dev/null gotraid=y fi done diff --git a/scripts/nfs b/scripts/nfs index a2f6c3e..0205047 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -9,9 +9,9 @@ mountroot () run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg - modprobe nfs + modprobe -Qb nfs # For DHCP - modprobe af_packet + modprobe -Qb af_packet ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf -- cgit v1.2.3 From 1c8330542d7a5d35c10e02db4e210352517176b3 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 12 Dec 2005 11:52:57 +0100 Subject: debian's module-init-tools of testing doesn't have yet the modprobe -Qb interface, keep the change for next time. :( --- debian/changelog | 2 ++ scripts/functions | 2 +- scripts/init-premount/thermal | 6 +++--- scripts/local | 2 +- scripts/local-top/evms | 2 +- scripts/local-top/lvm | 2 +- scripts/local-top/md | 2 +- scripts/nfs | 4 ++-- 8 files changed, 12 insertions(+), 10 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index b04358b..1a61807 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,8 @@ initramfs-tools (0.43) unstable; urgency=high * scripts/functions: remove old duplicate suspend support. * Sync with 0.40ubuntu8. (Closes: #337318) + - Revert the modprobe changes for now as modules-init-tools of + testing doesn't have yet the wanted interface. -- maximilian attems Mon, 12 Dec 2005 11:22:15 +0100 diff --git a/scripts/functions b/scripts/functions index da77542..cde870d 100644 --- a/scripts/functions +++ b/scripts/functions @@ -170,7 +170,7 @@ load_modules() then continue; else - modprobe -Qb $m + modprobe -q $m fi done fi diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index 64858af..e0d79c3 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -16,8 +16,8 @@ prereqs) esac # For ACPI systems -modprobe -Qb fan -modprobe -Qb thermal +modprobe -q fan +modprobe -q thermal # For ppc64 systems -modprobe -Qb therm_pm72 +modprobe -q therm_pm72 diff --git a/scripts/local b/scripts/local index 6c08f39..979f07d 100644 --- a/scripts/local +++ b/scripts/local @@ -25,7 +25,7 @@ mountroot () fi # FIXME This has no error checking - modprobe -Qb ${FSTYPE} + modprobe ${FSTYPE} # FIXME This has no error checking # Mount root diff --git a/scripts/local-top/evms b/scripts/local-top/evms index 563a9ae..46fca5d 100755 --- a/scripts/local-top/evms +++ b/scripts/local-top/evms @@ -26,7 +26,7 @@ esac unset evms for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do - modprobe -Qb $module + modprobe -q $module done /sbin/evms_activate diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index 40c4e9b..9f608af 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -26,7 +26,7 @@ case ${vg} in ;; esac -modprobe -Qb dm-mod +modprobe -q dm-mod vgchange -ay diff --git a/scripts/local-top/md b/scripts/local-top/md index 4132159..c7515fe 100755 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -25,7 +25,7 @@ for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do fi raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') if [ "$raidlvl" ]; then - modprobe -Qb ${raidlvl} 2>/dev/null + modprobe -q ${raidlvl} 2>/dev/null gotraid=y fi done diff --git a/scripts/nfs b/scripts/nfs index 0205047..a2f6c3e 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -9,9 +9,9 @@ mountroot () run_scripts /scripts/nfs-top [ "$quiet" != "y" ] && log_end_msg - modprobe -Qb nfs + modprobe nfs # For DHCP - modprobe -Qb af_packet + modprobe af_packet ipconfig ${DEVICE} . /tmp/net-${DEVICE}.conf -- cgit v1.2.3 From 161cd9fd2df641037edf53d72d096b0f87dd06f1 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 14 Mar 2006 10:21:02 +0100 Subject: use quiet for fs module loading --- debian/changelog | 4 +++- scripts/local | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index d18c9d0..eec885d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,9 @@ initramfs-tools (0.55) unstable; urgency=low * scripts/local-top/udev_helper: Fix modprobe args. Thanks Frans Pop . - -- maximilian attems Fri, 10 Mar 2006 01:13:33 +0100 + * scripts/local: Use quiet to load the fs. (closes: #339092) + + -- maximilian attems Tue, 14 Mar 2006 10:20:03 +0100 initramfs-tools (0.54) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 979f07d..917528a 100644 --- a/scripts/local +++ b/scripts/local @@ -25,7 +25,7 @@ mountroot () fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe -q ${FSTYPE} # FIXME This has no error checking # Mount root -- cgit v1.2.3 From fac756fddb6da3efbbfe99c3c9b0644346ecc695 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 26 Mar 2006 22:37:51 +0200 Subject: Resynch with 0.40ubuntu28 add raid10 module move the loop waiting code to mountroot() leaves only ide-generic from scripts/local-top/udev_helper md pre-requesites the udev one --- debian/changelog | 12 ++++- hooks/md | 2 +- scripts/init-premount/udev_helper | 107 -------------------------------------- scripts/local | 26 ++++++++- scripts/local-top/md | 2 +- scripts/local-top/udev_helper | 23 ++++++++ 6 files changed, 61 insertions(+), 111 deletions(-) delete mode 100755 scripts/init-premount/udev_helper create mode 100755 scripts/local-top/udev_helper (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index a2e8cef..93b55c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,17 @@ initramfs-tools (0.59) unstable; urgency=low * debian/copyright: Add years of copyright and authors. - -- maximilian attems Sun, 26 Mar 2006 21:04:28 +0200 + * Resync with 0.40ubuntu28: + - hooks/md: Add raid10 module. + - scripts/local: Move the "loop waiting for the root filesystem" code from + the udev premount script to the local mountroot() function where it truly + belongs. + - scripts/local-top/udev_helper: Leave the remaining ide-generic part + there, should be taken over by udev itself. + - make the md local-top scripts pre-requisite the udev one. + thanks Scott James Remnant + + -- maximilian attems Sun, 26 Mar 2006 22:35:15 +0200 initramfs-tools (0.58) unstable; urgency=low diff --git a/hooks/md b/hooks/md index c020c3a..becaba1 100755 --- a/hooks/md +++ b/hooks/md @@ -23,6 +23,6 @@ fi copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin -for x in md linear raid0 raid1 raid5 raid6; do +for x in md linear raid0 raid1 raid5 raid6 raid10; do manual_add_modules ${x} done diff --git a/scripts/init-premount/udev_helper b/scripts/init-premount/udev_helper deleted file mode 100755 index d2ef579..0000000 --- a/scripts/init-premount/udev_helper +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -PREREQ="udev" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -# Source the relevant scripts for later decisions -. /conf/initramfs.conf -. /scripts/functions - -# Nothing todo for nfs boot -case "${BOOT}" in -local) - ;; -*) - exit 0 - ;; -esac - -# Our job now is to make the block device for the root filesystem available. -# This is actually a bit trickier than it first appears because we first need -# to figure out which driver needs it, and to do that, we need to know what -# type of bus it's on. Fortunately we have all that information, this still -# feels like an ungodly hack though. -case "${ROOT}" in -/dev/root) - # An interesting case, this root device was specified as a - # major/minor pair. Fortunately we have that information - case "${major}" in - 3|22|33|34|56|57|88|89|90|91) - # traditional ide - root_type=ide - ;; - 80|81|82|83|84|85|86|87) - # ide on i2o - root_type=ide - ;; - 8|11|65|66|67|68|69|70|71|128|129|130|131|132|133|134|135) - # scsi - root_type=scsi - ;; - esac - ;; -/dev/hd*) - # Ahh, plain-old traditional ide - root_type=ide - ;; -/dev/sd*) - # SCSI, or an IDE controller dressed up in drag - root_type=scsi - ;; -/dev/disk/*) - # Specified by label; sadly there's no way to tell what bus - # this is on, so we'll just declare that we only support it - # for SCSI and removable devices - root_type=scsi - ;; -esac - -case "${root_type}" in -ide) - # If we're booting from IDE, it might not be a PCI controller, - # but might be an old fashioned ISA controller; in which case - # we need to load ide-generic. - if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then - modprobe -q ide-generic - fi - ;; - -scsi) - # If we're booting from SCSI we should have done all we need, - # now it's just a matter of waiting for the devices to appear - # which could take a while... - [ -e "${ROOT}" ] || log_begin_msg "Waiting for root file system" - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 30" || true - fi - - slumber=300 - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do - /bin/sleep 0.1 - slumber=$(( ${slumber} - 1 )) - done - - if type usplash_write >/dev/null 2>&1; then - usplash_write "TIMEOUT 15" || true - fi - - if [ ${slumber} -gt 0 ]; then - log_end_msg 0 - else - log_end_msg 1 || true - fi - ;; -esac diff --git a/scripts/local b/scripts/local index 917528a..dd5924d 100644 --- a/scripts/local +++ b/scripts/local @@ -7,7 +7,31 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg - # Get the root filesystem type + # If the root device hasn't shown up yet, give it a little while + # to deal with removable devices + if [ ! -e "${ROOT}" ]; then + log_begin_msg "Waiting for root file system..." + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TIMEOUT 180" || true + fi + + slumber=1800 + while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + /bin/sleep 0.1 + slumber=$(( ${slumber} - 1 )) + done + + if [ ${slumber} -gt 0 ]; then + log_end_msg 0 + else + log_end_msg 1 || true + fi + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TIMEOUT 15" || true + fi + fi + + # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done diff --git a/scripts/local-top/md b/scripts/local-top/md index c7515fe..aa48474 100755 --- a/scripts/local-top/md +++ b/scripts/local-top/md @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="" +PREREQ="udev_helper" prereqs() { diff --git a/scripts/local-top/udev_helper b/scripts/local-top/udev_helper new file mode 100755 index 0000000..5a747ba --- /dev/null +++ b/scripts/local-top/udev_helper @@ -0,0 +1,23 @@ +#!/bin/sh + +PREREQ="" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +# If we're booting from IDE, it might not be a PCI controller, +# but might be an old fashioned ISA controller; in which case +# we need to load ide-generic. +if [ ! -e "${ROOT}" -o "${ROOT}" = "/dev/root" ]; then + modprobe -q ide-generic +fi -- cgit v1.2.3 From c29d49d84418075e1887c965d978c7cc0e07a95f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Tue, 18 Apr 2006 13:44:02 +0200 Subject: 0.60: - bug script - cryptoroot support - change exported variables - nfsopts, rootflags support - warn lilo+grub install - doc fixes --- debian/bug | 3 +++ debian/changelog | 32 ++++++++++++++++++++++++++++++++ debian/initramfs-tools.install | 1 + init | 18 ++++++++++++++---- initramfs-tools.8 | 9 ++++++++- mkinitramfs-kpkg.8 | 5 +++-- scripts/functions | 4 ++++ scripts/local | 2 +- update-initramfs | 11 +++++++++-- 9 files changed, 75 insertions(+), 10 deletions(-) create mode 100755 debian/bug mode change 100644 => 100755 update-initramfs (limited to 'scripts/local') 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 0d341b8d32810844ce035e89a9e60fb7a7dde4b6 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 2 Jul 2006 18:57:07 +0200 Subject: woow pile of stuff turned up: - cleanup of activate_vg() in lvm boot script - use less of busybox utilities - conf.d for BUSYBOX=y usage for the packages - don't poke on conffile for RESUME - use printf instead of expr (ooh ash and dash are *fun*) - fix update-initramfs to use current_version when no other version exists around --- conf/initramfs.conf | 9 --------- debian/changelog | 37 +++++++++++++++++++++++++++++++++++++ debian/initramfs-tools.dirs | 1 + debian/initramfs-tools.preinst | 9 --------- initramfs-tools.8 | 5 +++-- initramfs.conf.5 | 7 ------- mkinitramfs | 2 +- scripts/functions | 16 +++++++++------- scripts/local | 2 +- scripts/local-top/lvm | 11 +++++++++-- update-initramfs | 12 ++++++++++-- 11 files changed, 71 insertions(+), 40 deletions(-) (limited to 'scripts/local') diff --git a/conf/initramfs.conf b/conf/initramfs.conf index a9cadf7..84d3b24 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -17,15 +17,6 @@ MODULES=most -# -# RESUME: [ /dev/hda2 | /dev/sdb2 ] -# -# optional - set the swap partition to resume from. -# "cat /proc/swaps | egrep ^/dev" should show possible candidates. -# The command line of your boot loader will override this setting. - -#RESUME= - # # NFS Section of the config. # diff --git a/debian/changelog b/debian/changelog index b1e3272..05140ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,40 @@ +initramfs-tools (0.67) unstable; urgency=high + + Release bella, ciao, ciao, ciao! + + * scripts/local: Fix typo in log_begin_msg. (closes: #375880) + + * update-initramfs: Generate initramfs for current version if there is no + sha1sum and no initrd exists yet - regression from 0.65. (closes: #375671) + Thanks martin f krafft for report. + + * conf/initramfs.conf, initramfs.conf(5): Drop RESUME section. + + * debian/initramfs-tools.preinst: Don't modify conffile initramfs.tools - + drop the corresponding code. (closes: #376008) + + * initramfs-tools(8): Document that RESUME is tried to be autodected and + written to /etc/initramfs-tools/conf.d/resume on install. + + * scripts/functions: Replace expr use with printf for skipping comments on + /etc/modules. Works on both busybox ash and klibc dash. Prefix space is + ignored by both. + + * scripts/local-top/lvm: Remove harmless warnings if a volumegroup is under + /dev/mapper but not an lvm device. (closes: 376311) + Thanks David Härdeman for the patch. + + * scripts/local-top/lvm: Change activate_vg() to return 1 if no volumegroup + is found. + + * debian/initramfs-tools.dirs: Add usr/share/initramfs-tools/conf.d entry. + + * mkinitramfs: Add stuff to the conf.d directory also from aboves directory. + + * Set urgency to high to get the RC bugfix into testing. + + -- maximilian attems Sun, 2 Jul 2006 18:35:34 +0200 + initramfs-tools (0.66) unstable; urgency=low * hooks/thermal: Add i2c-powermac. diff --git a/debian/initramfs-tools.dirs b/debian/initramfs-tools.dirs index 0a807a5..2c6a83a 100644 --- a/debian/initramfs-tools.dirs +++ b/debian/initramfs-tools.dirs @@ -9,5 +9,6 @@ etc/initramfs-tools/scripts/nfs-premount etc/initramfs-tools/scripts/nfs-top etc/initramfs-tools/hooks etc/initramfs-tools/conf.d +usr/share/initramfs-tools/conf.d usr/share/initramfs-tools/modules.d /var/lib/initramfs-tools diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index 3ec83c6..f2b667e 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -19,13 +19,4 @@ case "$1" in ;; esac -[ -f /etc/initramfs-tools/initramfs.conf ] && . /etc/initramfs-tools/initramfs.conf -if [ -z ${RESUME} ]; then - exit 0 -else - mkdir -p /etc/initramfs-tools/conf.d - echo "RESUME=${RESUME}" > /etc/initramfs-tools/conf.d/resume - sed -i -e "s/RESUME=.*/#RESUME=/" /etc/initramfs-tools/initramfs.conf -fi - #DEBHELPER# diff --git a/initramfs-tools.8 b/initramfs-tools.8 index eb46827..5d7c105 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -48,8 +48,9 @@ either local or NFS (affects which initramfs scripts are run, see the "Subdirect .TP \fB \fI resume -device node which holds the result of a previous suspension using swsusp -(usually the swap partition). +On install initramfs-tools tries to autodetect the resume partition. On success +the RESUME variable is written to /etc/initramfs-tools/conf.d/resume. +The boot variable overrides it. .TP \fB \fI quiet diff --git a/initramfs.conf.5 b/initramfs.conf.5 index 7fb79b1..2874fdb 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -32,13 +32,6 @@ The default setting is \fImost\fP. \fIlist\fP includes only modules from the additional modules list. -.TP -\fB RESUME -Optional setting of the swap partition to resume from. -The resume= passed on the command line of your boot loader -will override this setting. By default, this is set in -/etc/mkinitramfs/conf.d/resume. - .SH NFS VARIABLES .TP \fB BOOT diff --git a/mkinitramfs b/mkinitramfs index 5fcc1fd..f0ba606 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -61,7 +61,7 @@ done . "${CONFDIR}/initramfs.conf" EXTRA_CONF='' -for i in ${CONFDIR}/conf.d/*; do +for i in ${CONFDIR}/conf.d/* /usr/share/initramfs-tools/conf.d/*; do EXTRA_CONF="${EXTRA_CONF} $(basename $i | grep '^[a-z0-9][a-z0-9\._-]*$' | grep -v '\.dpkg-.*$')"; done for i in ${EXTRA_CONF}; do diff --git a/scripts/functions b/scripts/functions index a4faaa8..fea6956 100644 --- a/scripts/functions +++ b/scripts/functions @@ -220,14 +220,16 @@ load_modules() { if [ -e /conf/modules ]; then cat /conf/modules | while read m; do - if [ -z "$m" ] \ - || expr "$m" : "#" >/dev/null \ - || expr "$m" : "[ \t]+#?" > /dev/null - then - continue; - else - modprobe -q $m + # Skip empty lines + if [ -z "$m" ]; then + continue fi + # Skip comments - d?ash removes whitespace prefix + com=$(printf "%.1s" "${m}") + if [ "$com" = "#" ]; then + continue + fi + modprobe -q $m done fi } diff --git a/scripts/local b/scripts/local index 25aca70..a565885 100644 --- a/scripts/local +++ b/scripts/local @@ -55,7 +55,7 @@ mountroot () # Mount root mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/log-bottom" + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom" run_scripts /scripts/local-bottom [ "$quiet" != "y" ] && log_end_msg } diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index fc1036e..5323a7d 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -21,7 +21,7 @@ activate_vg() # Make sure that we have a non-empty argument if [ -z "${vg}" ]; then - return 0 + return 1 fi # Take care of lilo boot arg, risky activating of all vg @@ -40,7 +40,12 @@ activate_vg() # Make sure that we have a d-m path vg=${vg#/dev/mapper/} if [ "$vg" = "$1" ]; then - return 0 + return 1 + fi + + # Make sure that the device includes at least one dash + if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then + return 1 fi # Split volume group from logical volume. @@ -61,3 +66,5 @@ modprobe -q dm-mirror activate_vg "$ROOT" activate_vg "$resume" + +exit 0 diff --git a/update-initramfs b/update-initramfs index 2f3ebcf..1826233 100755 --- a/update-initramfs +++ b/update-initramfs @@ -125,8 +125,7 @@ get_sorted_versions() for gsv_x in "${STATEDIR}"/*; do gsv_x="$(basename "${gsv_x}")" if [ "${gsv_x}" = '*' ]; then - verbose "Nothing to do, exiting." - exit 0 + return 0 fi worklist="" for gsv_i in $version_list; do @@ -212,9 +211,18 @@ update() set_current_version fi + if [ -z "${version}" ]; then + verbose "Nothing to do, exiting." + exit 0 + fi + if [ "${version}" = "all" ]; then : FIXME check for --yes, and if not ask are you sure get_sorted_versions + if [ -z "${version_list}" ]; then + verbose "Nothing to do, exiting." + exit 0 + fi for u_version in ${version_list}; do if [ "${verbose}" = "1" ]; then vflag="-v" -- cgit v1.2.3 From 8e9ecf2b5f9ced135e29d12fbe53c727a248934d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 16 Jul 2006 21:14:42 +0200 Subject: big ubuntu merge: - changelog - typos + whitespace + comments + quoting - vga16fb --- debian/changelog | 150 +++++++++++++++++++++++++++++++++++++++- debian/initramfs-tools.install | 2 +- debian/initramfs-tools.postinst | 4 ++ hook-functions | 2 +- hooks/kernelextras | 5 +- init | 8 +-- mkinitramfs | 13 ++-- scripts/local | 13 ++-- update-initramfs | 6 +- 9 files changed, 180 insertions(+), 23 deletions(-) (limited to 'scripts/local') 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 839572386f35bf4b4404dac5f976566bc155de94 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Aug 2006 17:14:01 +0200 Subject: Release 0.74: - scripts/functions: fix debug boot param - update-initramfs: checkout /etc/kernel-img.conf if lilo and grub is installed - rename mdraid to mdrun, readd mdrun as it seems to work much better with sarge systems - add an help message for rescue shell - better package desc --- debian/changelog | 25 +++++++++++++++++++++++++ debian/control | 12 ++++++------ mkinitramfs | 1 + scripts/functions | 6 +++--- scripts/local | 2 ++ scripts/local-premount/resume | 6 ++---- scripts/local-top/mdraid | 41 ----------------------------------------- scripts/local-top/mdrun | 41 +++++++++++++++++++++++++++++++++++++++++ update-initramfs | 22 ++++++++++++++++++---- 9 files changed, 98 insertions(+), 58 deletions(-) delete mode 100755 scripts/local-top/mdraid create mode 100755 scripts/local-top/mdrun (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index 1686466..f089fe6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,28 @@ +initramfs-tools (0.74) unstable; urgency=low + + * scripts/local-premount/resume: Reuse klibc resume, hardcode path as + uswsusp shipps too an resume binary in initramfs-tools. Thus tighten + again klibc dep to 1.4.11-1. (closes: 381535) + + * mkinitramfs: Readd mdrun when around. + + * scripts/local-top/mdrun: Rename from mdraid. Use mdrun as previously, + there is no guarantee that the sarge mdadm works and that the sarge + mdadm.conf has any sense. + + * debian/control: Better package description. + + * scripts/local: mountroot add message what to check if root is not found + in 2 straight lines to keep as much of scrolling buffer. + + * scripts/functions: Use set ``--'' to change positional paramaters without + changing any options. This is useful for the debug bootparam on d?ash. + + * update-initramfs: Respect "do_bootloader = yes" from /etc/kernel-img.conf + to call lilo if both lilo and grub are installed. (closes: 382013) + + -- maximilian attems Thu, 17 Aug 2006 16:50:51 +0200 + initramfs-tools (0.73e) unstable; urgency=high * mkinitramfs: Fix if statement for conf.d. (closes: 382740) diff --git a/debian/control b/debian/control index a9d0e90..24d1bdc 100644 --- a/debian/control +++ b/debian/control @@ -8,13 +8,13 @@ Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.4.8-0), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.11-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs - This package contains tools to create and boot an initramfs for prepackaged - 2.6 Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the + This package contains tools to create and boot an initramfs for packaged 2.6 + Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the kernel unpacks that archive into RAM, mounts and uses it as initial root file - system. From there on the mounting of the real root file system occurs in user - space. klibc handles the boot-time networking setup. Having the root on NFS - is also supported. + system. The mounting of the real root file system occurs in early user space. + klibc provides utilities to setup root. Having the root on EVMS, MD, LVM2, + LUKS or NFS is also supported. Any boot loader with initrd support is able to load an initramfs archive. diff --git a/mkinitramfs b/mkinitramfs index 3df30ec..67d9df0 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -235,6 +235,7 @@ run_scripts "${CONFDIR}"/hooks if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then mdadm --examine --scan > $DESTDIR/conf/mdadm.conf copy_exec /sbin/mdadm /sbin + copy_exec /sbin/mdrun /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do manual_add_modules ${x} done diff --git a/scripts/functions b/scripts/functions index 9e578d7..e9d7a07 100644 --- a/scripts/functions +++ b/scripts/functions @@ -117,7 +117,7 @@ get_prereqs() count_unsatisfied() { - set - ${@} + set -- ${@} return ${#} } @@ -126,7 +126,7 @@ pop_list_item() { item=${1} shift - set - ${@} + set -- ${@} unset tmppop # Iterate for pop in ${@}; do @@ -143,7 +143,7 @@ reduce_prereqs() { unset runlist set_initlist - set - ${initlist} + set -- ${initlist} i=$# # Loop until there's no more in the queue to loop through while [ ${i} -ne 0 ]; do diff --git a/scripts/local b/scripts/local index 8510088..0b9baab 100644 --- a/scripts/local +++ b/scripts/local @@ -33,6 +33,8 @@ mountroot () # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do + echo " Check root= bootarg cat /proc/cmdline" + echo " or missing modules, devices: cat /proc/modules ls /dev" panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume index 593df78..881af90 100755 --- a/scripts/local-premount/resume +++ b/scripts/local-premount/resume @@ -33,8 +33,6 @@ if [ ! -e "${resume}" ]; then fi if [ -e /sys/power/resume ]; then -# FIXME: klibc-utils resume needs more tests -# resume ${resume} - major_minor=$(ls -l ${resume} | awk '{printf "%d:%d", $5, $6}') - echo $major_minor >/sys/power/resume + # hardcode path, uswsusp ships an resume binary too + /bin/resume ${resume} fi diff --git a/scripts/local-top/mdraid b/scripts/local-top/mdraid deleted file mode 100755 index 8649aa4..0000000 --- a/scripts/local-top/mdraid +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -PREREQ="udev_helper" - -prereqs() -{ - echo "$PREREQ" -} - -case $1 in -# get pre-requisites -prereqs) - prereqs - exit 0 - ;; -esac - -if [ -e /scripts/local-top/mdadm ]; then - exit 0 -fi - -unset raidlvl -gotraid=n - -# Detect raid level -for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do - if [ ! -e ${x} ]; then - continue - fi - raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') - if [ "$raidlvl" ]; then - modprobe -q ${raidlvl} 2>/dev/null - gotraid=y - fi -done - -[ "${gotraid}" = y ] || exit - -# Assemble all raid devices -mkdir /dev/md -mdadm --assemble --config=/conf/mdadm.conf --scan --run --auto=yes diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun new file mode 100755 index 0000000..1b6ca3e --- /dev/null +++ b/scripts/local-top/mdrun @@ -0,0 +1,41 @@ +#!/bin/sh + +PREREQ="udev_helper" + +prereqs() +{ + echo "$PREREQ" +} + +case $1 in +# get pre-requisites +prereqs) + prereqs + exit 0 + ;; +esac + +if [ -e /scripts/local-top/mdadm ]; then + exit 0 +fi + +unset raidlvl +gotraid=n + +# Detect raid level +for x in /dev/hd[a-z][0-9]* /dev/sd[a-z][0-9]*; do + if [ ! -e ${x} ]; then + continue + fi + raidlvl=$(mdadm --examine ${x} 2>/dev/null | grep "Level" | sed -e 's/.*Raid Level : \(.*\)/\1/') + if [ "$raidlvl" ]; then + modprobe -q ${raidlvl} 2>/dev/null + gotraid=y + fi +done + +[ "${gotraid}" = y ] || exit + +# Assemble all raid devices +# FIXME: assemble root raid first due to initrd-tools compatibility +/sbin/mdrun /dev diff --git a/update-initramfs b/update-initramfs index ea74136..e7dc586 100755 --- a/update-initramfs +++ b/update-initramfs @@ -81,11 +81,28 @@ generate_initramfs() fi } +# lilo call +run_lilo() +{ + lilo -t > /dev/null + if [ $? -eq 0 ]; then + lilo + fi +} + # only run lilo if no grub is around +# or if "do_bootloader = yes" is set run_bootloader() { if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then + do_bootloader=$(awk '/bootloader/{print $2}' \ + /etc/kernel-img.conf) + if [ "${do_bootloader}" = "yes" ]; then + run_lilo + return 0 + fi + echo echo "WARNING: grub and lilo installed." echo "If you use grub as bootloader everything is fine." @@ -95,10 +112,7 @@ run_bootloader() return 0 fi if [ -e /etc/lilo.conf ]; then - lilo -t > /dev/null - if [ $? -eq 0 ]; then - lilo - fi + run_lilo fi } -- cgit v1.2.3 From fabe918dee7da26d177d67d4aa8fe3fd6e83e513 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 23 Aug 2006 09:22:54 +0200 Subject: - improved nfsroo parsing - added rootdelay and rootfstype bootargs - document this changes - initrd-tools backward compatible mdadm assembe and then run mdrun - update-initramfs really checkout use_bootloader from /etc/kernel-img.conf - tighter klibc deps --- debian/NEWS | 13 +++++++++++++ debian/changelog | 39 ++++++++++++++++++++++++++++++++++++++ debian/control | 2 +- init | 13 +++++++++++-- initramfs-tools.8 | 50 ++++++++++++++++++++++++++++++++++++++++--------- mkinitramfs | 19 +++++++++++++++++-- scripts/functions | 9 +++------ scripts/local | 19 +++++++++++++++---- scripts/local-top/mdrun | 9 +++++++-- scripts/nfs | 48 +++++++++++++++++++++++++++++++++++++++++++++-- update-initramfs | 5 +++-- 11 files changed, 196 insertions(+), 30 deletions(-) (limited to 'scripts/local') diff --git a/debian/NEWS b/debian/NEWS index a6ae4bc..9ac39f5 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,16 @@ +initramfs-tools (0.76) unstable; urgency=low + + * This release features nfs auto detection in the initramfs. + The boot paramaters are parsed according to the linux source + Documentation/kernel-parameters.txt and more specifically + Documentation/nfsroot.txt. + + The initramfs-tools(8) manpage documents the parsed boot parameter. + Note that the undocumented and non compliant nfsoption bootarg got + dropped. + + -- maximilian attems Wed, 23 Aug 2006 08:47:26 +0200 + initramfs-tools (0.61) unstable; urgency=low * This release moves the initramfs-tools confdir from /etc/mkinitramfs to diff --git a/debian/changelog b/debian/changelog index 995d76d..a5ac22f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +initramfs-tools (0.76) unstable; urgency=medium + + * debian/control: Tighten klibc to 1.4.19-2 for fixed nuke. (closes: 383730) + + * mkinitramfs: Only hard code root when root arg got passed. + + * init: Parse /proc/cmdline for rootfstype, initrd-tools did it too. + + * init: Parse /proc/cmdline for rootdelay. + + * scripts/local: Use eventual rootfstype and rootdelay info. + + * initramfs-tools.8: Add more docs about boot args, s/2.6.15/2.6.17/. + + * scripts/functions: Simplify parse_numeric() by arithmetic calculation, + instead of working on it's representation. Thanks to tarski. + (launchpad.net/21759) Much more elegant than the 0.58 version fix. + + * mkinitramfs: Parse rootraid for sarge compatibility and pass the info + to the initramfs if etch mdadm is not yet installed. + + * scripts/local-top/mdrun: Assemble the root raid first before mdrun. + Thanks martin f krafft . (closes: 383908, 384063) + + * update-initramfs: Check if /etc/kernel-img.conf is readable, + before attempting to parse also check for the right field. + + * init: Check for root=/dev/nfs. Parse ip kernel command line for nfsroot. + Drop undocumented and not compliant nfsopts. + + * scripts/nfs: Add ip parsing conforming to Documentation/nfsroot.txt. + Use the nfsroot bootparam in combination with eventual ip provided + device or server-ip. Do minor code cleanups. Both items based on patches + by Vagrant Cascadian . (closes: 380649) + + * Set urgency medium due to large number of serious bug fixes. + + -- maximilian attems Wed, 23 Aug 2006 08:17:51 +0200 + initramfs-tools (0.75) unstable; urgency=high * hook-functions: Add megaraid_sas to the scsi list. Thanks Kenshi Muto diff --git a/debian/control b/debian/control index 24d1bdc..dd4c3b3 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.7.2.0 Package: initramfs-tools Architecture: all -Depends: klibc-utils (>= 1.4.11-1), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) +Depends: klibc-utils (>= 1.4.19-2), busybox (>= 1:1.01-3) | busybox-cvs-static (>= 20040623-1), cpio, module-init-tools, udev (>= 0.086-1) Provides: linux-initramfs-tool Description: tools for generating an initramfs This package contains tools to create and boot an initramfs for packaged 2.6 diff --git a/init b/init index ab679b5..386ec37 100755 --- a/init +++ b/init @@ -59,19 +59,28 @@ for x in $(cat /proc/cmdline); do UUID=*) ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" ;; + /dev/nfs) + BOOT=nfs + ;; esac ;; rootflags=*) ROOTFLAGS="-o ${x#rootflags=}" ;; + rootfstype=*) + ROOTFSTYPE="${x#rootfstype=}" + ;; + rootdelay=*) + ROOTDELAY="${x#rootdelay=}" + ;; cryptopts=*) cryptopts="${x#cryptopts=}" ;; nfsroot=*) NFSROOT="${x#nfsroot=}" ;; - nfsopts=*) - NFSOPTS="-o ${x#nfsopts=}" + ip=*) + IPOPTS="${x#ip=}" ;; boot=*) BOOT=${x#boot=} diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 0950b39..7af09e1 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "Date: 2005/12/06" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "Date: 2006/08/19" "" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -29,18 +29,44 @@ arguments which influence the boot procedure: .SS Boot options +The init and root are usually passed by the boot loader for local boot. +The other parameters are optional. + .TP \fB \fI init the binary to hand over execution to on the root fs after the initramfs scripts are done. .TP \fB \fI root -the device node to mount as the rootfs. +the device node to mount as the root file system. + +.TP +\fB \fI rootdelay +set delay in seconds. Determines how long mountroot waits for root to appear. + +.TP +\fB \fI rootflags +set the file system mount option string. + +.TP +\fB \fI rootfstype +set the root file system type. .TP \fB \fI nfsroot can be either "auto" to try to get the relevant information from DHCP or a -string of the form NFSSERVER:NFSPATH +string of the form NFSSERVER:NFSPATH or NFSSERVER:NFSPATH:NFSOPTS. +Use root=/dev/nfs for NFS to kick to in. + +.TP +\fB \fI ip +tells how to configure the ip adress. Allows to specify an different +NFS server than the DHCP server. See Documentation/nfsroot.txt in +any recent linux source for details. Optional paramater for NFS root. + +.TP +\fB \fI cryptopts +passes the args for cryptoroot. Set by the cryptsetup boot hooks. .TP \fB \fI boot @@ -50,27 +76,33 @@ either local or NFS (affects which initramfs scripts are run, see the "Subdirect \fB \fI resume On install initramfs-tools tries to autodetect the resume partition. On success the RESUME variable is written to /etc/initramfs-tools/conf.d/resume. -The boot variable overrides it. +The boot variable noresume overrides it. .TP \fB \fI quiet -reduces the amount of text output to the console during boot +reduces the amount of text output to the console during boot. .TP \fB \fI ro -mounts the rootfs read-only +mounts the rootfs read-only. .TP \fB \fI rw -mounts the rootfs read-write +mounts the rootfs read-write. + +.TP +\fB \fI panic +sets an timeout on panic. Currently only zero value supported. .TP \fB \fI debug -generates lots of output to /tmp/initramfs.debug +generates lots of output to /tmp/initramfs.debug. .TP \fB \fI break spawns a shell in the initramfs image at chosen run-time +(top, modules, premount, mount, bottom, init). +The default is premount without any arg. .SH HOOK SCRIPTS @@ -404,7 +436,7 @@ to double-check if it contains the relevant binaries, libs or modules: .nf mkdir tmp/initramfs cd tmp/initramfs -gunzip -c -9 /boot/initrd.img-2.6.15-1-686 | \\ +gunzip -c -9 /boot/initrd.img-2.6.17-2-686 | \\ cpio -i -d -H newc --no-absolute-filenames .fi .RE diff --git a/mkinitramfs b/mkinitramfs index 67d9df0..759d6cb 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -209,7 +209,11 @@ for i in ${EXTRA_CONF}; do copy_exec "/usr/share/initramfs-tools/conf.d/${i}" /conf/conf.d fi done -echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root + +# ROOT hardcoding +if [ -n "${ROOT}" ]; then + echo "ROOT=${ROOT}" > ${DESTDIR}/conf/conf.d/root +fi # Busybox if [ "x${BUSYBOX}" = "xn" ]; then @@ -233,7 +237,18 @@ run_scripts "${CONFDIR}"/hooks # FIXME: Remove this Raid block after Etch releases if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then - mdadm --examine --scan > $DESTDIR/conf/mdadm.conf + # use mkinitrd magic for Sarge backwards compat + rootraiddev="$(df / | sed -rne 's,^(/dev/[^[:space:]]+).*,\1,p')" + echo "rootraiddev=${rootraiddev}" > /conf/mdadm.conf + mdadm=$(mdadm --detail "${rootraiddev}") + echo "${mdadm}" | awk ' + $1 == "Number" && $2 == "Major" { start = 1; next } + $1 == "UUID" { print "uuid=" $3; next } + !start { next } + $2 == 0 && $3 == 0 { next } + { devices = devices " " $NF } + END { print "devices='\''" devices "'\''" }' \ + >> /conf/mdadm.conf copy_exec /sbin/mdadm /sbin copy_exec /sbin/mdrun /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do diff --git a/scripts/functions b/scripts/functions index 178ad5d..7e67771 100644 --- a/scripts/functions +++ b/scripts/functions @@ -224,13 +224,10 @@ parse_numeric() { minor=${1#*:} major=${1%:*} ;; - [0-9][0-9][0-9]) - minor=$((0x${1#?})) - major=$((0x${1%??})) - ;; *) - minor=$((0x${1#??})) - major=$((0x${1%??})) + value=$(( 0x${1} )) + minor=$(( ${value} % 256 )) + major=$(( ${value} / 256 )) ;; esac diff --git a/scripts/local b/scripts/local index 0b9baab..9d71a5e 100644 --- a/scripts/local +++ b/scripts/local @@ -11,11 +11,18 @@ mountroot () # to deal with removable devices if [ ! -e "${ROOT}" ]; then log_begin_msg "Waiting for root file system..." + + # Default delay is 180s + if [ -z "${ROOTDELAY}" ]; then + slumber=180 + else + slumber=${ROOTDELAY} + fi if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "TIMEOUT 180" || true + /sbin/usplash_write "TIMEOUT ${slumber}" || true fi - slumber=1800 + slumber=$(( ${slumber} * 10 )) while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) @@ -38,8 +45,12 @@ mountroot () panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done - # Get the root filesystem type - eval $(fstype < ${ROOT}) + # Get the root filesystem type if not set + if [ -z "${ROOTFSTYPE}" ]; then + eval $(fstype < ${ROOT}) + else + FSTYPE=${ROOTFSTYPE} + fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun index 1b6ca3e..3ed995c 100755 --- a/scripts/local-top/mdrun +++ b/scripts/local-top/mdrun @@ -36,6 +36,11 @@ done [ "${gotraid}" = y ] || exit -# Assemble all raid devices -# FIXME: assemble root raid first due to initrd-tools compatibility +# source the presumed root md and it's info +. ./conf/mdadm.conf + +# assemble root raid first due to initrd-tools compatibility +mdadm -A ${rootraiddev} -R -u $uuid $devices + +# assemble all raid devices /sbin/mdrun /dev diff --git a/scripts/nfs b/scripts/nfs index 5bfb03d..844db70 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -13,13 +13,57 @@ mountroot () # For DHCP modprobe -q af_packet - ipconfig ${DEVICE} + # support ip options see linux sources Documentation/nfsroot.txt + case ${IPOPTS} in + none|off) + # Do nothing + ;; + ""|on|any) + # Bring up device + ipconfig ${DEVICE} + ;; + dhcp|bootb|rarp|both) + ipconfig -c ${IPOPTS} -d ${DEVICE} + ;; + *) + ipconfig -d $IPOPTS + + # grab device entry from full line + NEW_DEVICE=${IPOPTS#*:*:*:*:*:*} + NEW_DEVICE=${NEW_DEVICE%:*} + if [ -n "${NEW_DEVICE}" ]; then + DEVICE="${NEW_DEVICE}" + fi + # grab server-ip + SERVER_IP=${IPOPTS#*:} + SERVER_IP=${SERVER_IP%:*:*:*:*:*:*} + ;; + esac + + # FIXME: who writes that? . /tmp/net-${DEVICE}.conf + + # get nfs root from dhcp if [ "x${NFSROOT}" = "xauto" ]; then NFSROOT=${ROOTSERVER}:${ROOTPATH} + # nfsroot=[:][,] + elif [ -n "${NFSROOT}" ]; then + # nfs options are an optional arg + if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then + NFSOPTS="-o ${NFSROOT#*,}" + fi + NFSROOT=${NFSROOT%%,*} + # server-ip could be passed by ip + if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then + if [ -n "${SERVER_IP}" ]; then + NFSROOT="${SERVER_IP}:${NFSROOT}" + else + NFSROOT=${ROOTSERVER}:${ROOTPATH} + fi + fi fi - if [ "x${NFSOPTS}" = "x" ]; then + if [ -z "${NFSOPTS}" ]; then NFSOPTS="-o retrans=10" fi diff --git a/update-initramfs b/update-initramfs index 3ce8f1f..1ec8c7d 100755 --- a/update-initramfs +++ b/update-initramfs @@ -2,6 +2,7 @@ STATEDIR=/var/lib/initramfs-tools BOOTDIR=/boot +KPKGCONF=/etc/kernel-img.conf set -e @@ -96,8 +97,8 @@ run_bootloader() { if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then - do_b=$(awk '/bootloader/{print $2}' \ - /etc/kernel-img.conf) + [ -r "${KPKGCONF}" ] && \ + do_b=$(awk '/bootloader/{print $3}' "${KPKGCONF}") if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \ || [ "${do_b}" = "YES" ]; then run_lilo -- cgit v1.2.3 From 45989c9f37db0ef23e984ea559f2da784a028366 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 25 Aug 2006 17:04:33 +0200 Subject: - fix bashism - rename mdadm.conf in mdrun.conf - retry nfsmount - harden init - fix lvm boot script prereqs --- debian/changelog | 20 ++++++++++++++++++ debian/initramfs-tools.postinst | 2 +- hook-functions | 2 +- init | 6 ++++-- mkinitramfs | 11 +++++----- scripts/local | 2 +- scripts/local-top/lvm | 2 +- scripts/local-top/mdrun | 2 +- scripts/nfs | 45 ++++++++++++++++++++++++++++++----------- update-initramfs | 2 +- 10 files changed, 69 insertions(+), 25 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index a5ac22f..bc635a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +initramfs-tools (0.77) unstable; urgency=medium + + * mkinitramfs, scripts/local-top/mdrun: Use mdrun.conf as config file. + Ship mdrun unconditionally if around, should help in recovery situations. + + * debian/initramfs-tools.postinst, hook-functions, mkinitramfs, + scripts/local, update-initramfs: Cleanup the "-a" and "-o" bashism. + + * scripts/nfs: Retry to mount NFS on eventual failure. (closes: 377643) + Based on a patch by Vagrant Cascadian . + + * init: Make sure there is an /dev and /root. Usually passed by the kernel. + Also /dev/null or /dev/console might already be shipped. + Based on a patch by David Härdeman . (closes: 340494) + + * scripts/local-top/lvm: Fix prereqs s/mdraid/mdrun, thus urgency medium. + Thanks Rainer Gauweiler for the notice. + + -- maximilian attems Fri, 25 Aug 2006 16:55:56 +0200 + initramfs-tools (0.76) unstable; urgency=medium * debian/control: Tighten klibc to 1.4.19-2 for fixed nuke. (closes: 383730) diff --git a/debian/initramfs-tools.postinst b/debian/initramfs-tools.postinst index 5f46777..2f36f3f 100644 --- a/debian/initramfs-tools.postinst +++ b/debian/initramfs-tools.postinst @@ -7,7 +7,7 @@ if [ ! -e /etc/initramfs-tools/modules ]; then fi # Regenerate initramfs on upgrade -if [ "$1" = "configure" -a -n "$2" ]; then +if [ "$1" = "configure" ] && [ -n "$2" ]; then update-initramfs -u fi diff --git a/hook-functions b/hook-functions index 08f396d..bfbe56a 100644 --- a/hook-functions +++ b/hook-functions @@ -48,7 +48,7 @@ manual_add_modules() mkdir -p "${DESTDIR}/$(dirname "${mam_x}")" ln -s "${mam_x}" "${DESTDIR}/$(dirname "${mam_x}")" - if [ -n "${verbose}" -a "${verbose}" = "y" ]; then + if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then echo "Adding module ${mam_x}" fi done diff --git a/init b/init index 386ec37..a83dc39 100755 --- a/init +++ b/init @@ -2,6 +2,10 @@ echo "Loading, please wait..." +[ -d /dev ] || mkdir -m 0755 /dev +[ -d /root ] || mkdir --mode=0700 /root +[ -e /dev/console ] || mknod /dev/console c 5 1 +[ -e /dev/null ] || mknod /dev/null c 1 3 mkdir /sys mkdir /proc mkdir /tmp @@ -18,8 +22,6 @@ fi mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev > /dev/.initramfs-tools mkdir /dev/.initramfs -mknod /dev/console c 5 1 -mknod /dev/null c 1 3 # Export the dpkg architecture export DPKG_ARCH= diff --git a/mkinitramfs b/mkinitramfs index 759d6cb..d088efa 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -236,10 +236,10 @@ run_scripts /usr/share/initramfs-tools/hooks run_scripts "${CONFDIR}"/hooks # FIXME: Remove this Raid block after Etch releases -if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then +if [ -x /sbin/mdadm ] && [ ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then # use mkinitrd magic for Sarge backwards compat rootraiddev="$(df / | sed -rne 's,^(/dev/[^[:space:]]+).*,\1,p')" - echo "rootraiddev=${rootraiddev}" > /conf/mdadm.conf + echo "rootraiddev=${rootraiddev}" > /conf/mdrun.conf mdadm=$(mdadm --detail "${rootraiddev}") echo "${mdadm}" | awk ' $1 == "Number" && $2 == "Major" { start = 1; next } @@ -248,16 +248,17 @@ if [ -x /sbin/mdadm -a ! -f /usr/share/initramfs-tools/hooks/mdadm ]; then $2 == 0 && $3 == 0 { next } { devices = devices " " $NF } END { print "devices='\''" devices "'\''" }' \ - >> /conf/mdadm.conf + >> /conf/mdrun.conf copy_exec /sbin/mdadm /sbin - copy_exec /sbin/mdrun /sbin for x in md linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do manual_add_modules ${x} done fi +[ -x /sbin/mdrun ] && copy_exec /sbin/mdrun /sbin # FIXME: Remove this LVM block after Etch releases -if [ -x /sbin/vgchange -a -d /lib/lvm-200 -a ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then +if [ -x /sbin/vgchange ] && [ -d /lib/lvm-200 ] \ + && [ ! -f /usr/share/initramfs-tools/hooks/lvm2 ]; then copy_exec /lib/lvm-200/vgchange /sbin for x in dm_mod dm_snapshot dm_mirror; do manual_add_modules ${x} diff --git a/scripts/local b/scripts/local index 9d71a5e..e7bf23e 100644 --- a/scripts/local +++ b/scripts/local @@ -23,7 +23,7 @@ mountroot () fi slumber=$(( ${slumber} * 10 )) - while [ ${slumber} -gt 0 -a ! -e "${ROOT}" ]; do + while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) done diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm index f9d1490..27053de 100755 --- a/scripts/local-top/lvm +++ b/scripts/local-top/lvm @@ -1,6 +1,6 @@ #!/bin/sh -PREREQ="mdadm mdraid lvm2" +PREREQ="mdadm mdrun lvm2" prereqs() { diff --git a/scripts/local-top/mdrun b/scripts/local-top/mdrun index 3ed995c..da890c5 100755 --- a/scripts/local-top/mdrun +++ b/scripts/local-top/mdrun @@ -37,7 +37,7 @@ done [ "${gotraid}" = y ] || exit # source the presumed root md and it's info -. ./conf/mdadm.conf +. ./conf/mdrun.conf # assemble root raid first due to initrd-tools compatibility mdadm -A ${rootraiddev} -R -u $uuid $devices diff --git a/scripts/nfs b/scripts/nfs index 844db70..f42ed22 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -2,17 +2,9 @@ # FIXME This needs error checking -# Paramter: Where the root should be mounted -mountroot () +# parse nfs bootargs + launch ipconfig and nfsmount +do_nfsmount() { - [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top" - run_scripts /scripts/nfs-top - [ "$quiet" != "y" ] && log_end_msg - - modprobe -q nfs - # For DHCP - modprobe -q af_packet - # support ip options see linux sources Documentation/nfsroot.txt case ${IPOPTS} in none|off) @@ -40,7 +32,7 @@ mountroot () ;; esac - # FIXME: who writes that? + # FIXME: source ipconfig output - might overwrite aboves . /tmp/net-${DEVICE}.conf # get nfs root from dhcp @@ -78,9 +70,38 @@ mountroot () fi nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt} +} + +# NFS root mounting +mountroot() +{ + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top" + run_scripts /scripts/nfs-top + [ "$quiet" != "y" ] && log_end_msg + + modprobe -q nfs + # For DHCP + modprobe -q af_packet + + # Default delay is around 180s + # FIXME: add usplash info + if [ -z "${ROOTDELAY}" ]; then + delay=180 + else + delay=${ROOTDELAY} + fi + + # loop until nfsmount succeds + # FIXME: another place of init bin hardcoding + while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}/sbin/init ]; do + [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount" + do_nfsmount + # FIXME: ipconfig loops every min at least - better param?? + delay=$(( ${delay} - 1 )) + [ "$quiet" != "y" ] && log_end_msg + done [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom" run_scripts /scripts/nfs-bottom [ "$quiet" != "y" ] && log_end_msg - } diff --git a/update-initramfs b/update-initramfs index 1ec8c7d..c1e42ab 100755 --- a/update-initramfs +++ b/update-initramfs @@ -95,7 +95,7 @@ run_lilo() # or if "do_bootloader = yes" is set run_bootloader() { - if [ -x /sbin/grub -o -e /boot/grub/menu.lst ]; then + if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ]; then if [ -e /etc/lilo.conf ]; then [ -r "${KPKGCONF}" ] && \ do_b=$(awk '/bootloader/{print $3}' "${KPKGCONF}") -- cgit v1.2.3 From cf4bba337d69510c4551ba84e8c69562873ea93f Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 4 Sep 2006 18:54:59 +0200 Subject: - better nfs handling: merge vagrant branch :) + local changes - cleanup stupid whitespace all over the place --- debian/changelog | 23 +++++++++++++++++++---- init | 4 ++-- initramfs.conf.5 | 4 ++-- mkinitramfs | 10 +++++----- scripts/local | 2 +- scripts/local-top/mdrun | 2 +- scripts/nfs | 35 ++++++++++++++++++----------------- update-initramfs.8 | 4 ++-- 8 files changed, 50 insertions(+), 34 deletions(-) (limited to 'scripts/local') 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 dc67493c8b72ebb4a360194a13c74a13d06def52 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 18 Oct 2006 13:16:03 +0200 Subject: - improve run_bootloader (elilo, zipl) - fix preinst sed command - bunch of minor fixes --- debian/changelog | 40 ++++++++++++++++++++++++++++++++++++++++ debian/initramfs-tools.preinst | 4 +--- hook-functions | 3 ++- hooks/thermal | 11 +++++++++++ initramfs-tools.8 | 4 ++-- mkinitramfs | 2 +- scripts/init-top/framebuffer | 2 +- scripts/local | 4 ++++ update-initramfs | 15 ++++++++++++--- 9 files changed, 74 insertions(+), 11 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index 49d07a9..022e167 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,31 @@ +initramfs-tools (0.84) unstable; urgency=high + + Release "A-t-on pris à Saint-Périne, Tous ces dictateurs impotents ?" + + * hook-functions: Use modprobe --ignore-install arg to put all listed + modules on initramfs. Thanks Mario Izquierdo + for report. (closes: 384043) + + * update-initramfs: If elilo is around run it on initramfs update, add + zipl run. + + * scripts/local: Use vol_id too if around to set FSTYPE. Thanks for the + patch to "Alex Owen" (closes: 380004) + + * hooks/thermal: Add many of the windfarm modules for powerpc boxes. + + * initramfs-tools.preinst: merge bits of 0.69ubuntu16. (closes: 393773) + urgency high as fixes upgrade from sarge - thanks Federico Grau + . + + * scripts/init-top/framebuffer: Fix mknod call. (closes: 393543) + Thanks for the patch Kiro Zimmer . + + * mkinitramfs: Create modulesdir even on monolithic linux. (closes: 393688) + Thanks for the patch Ian Campbell . + + -- maximilian attems Wed, 18 Oct 2006 11:04:50 +0200 + initramfs-tools (0.83) unstable; urgency=high Release "Ois was du verzapfst is a koida Kaffee" @@ -438,6 +466,18 @@ initramfs-tools (0.69b) unstable; urgency=high -- maximilian attems Fri, 14 Jul 2006 00:31:30 +0200 +initramfs-tools (0.69ubuntu16) edgy; urgency=low + + * Bring in preinst fixes from Debian, including s/configure/install/ in + preinst, since preinst is never called with "configure", and checking + for /proc/swaps before we blindly try to read it to determine RESUME. + * Do away with the bogus '-n "$2"' test in preinst, since "install" can + be called without any arguments at all (and often is, on a clean setup) + * On upgrades, revert the RESUME mangling that dapper's d-i did to our + config file, avoiding spurious conffile prompts (launchpad.net/63693) + + -- Adam Conrad Mon, 16 Oct 2006 17:23:41 +1000 + initramfs-tools (0.69ubuntu15) edgy; urgency=low * Add jmicron module to ide list. diff --git a/debian/initramfs-tools.preinst b/debian/initramfs-tools.preinst index fc1fd06..aa8c8ca 100644 --- a/debian/initramfs-tools.preinst +++ b/debian/initramfs-tools.preinst @@ -4,7 +4,6 @@ set -e case "$1" in install) - if [ -n "$2" ]; then mkdir -p /etc/initramfs-tools/conf.d # First time install. Can we autodetect the RESUME partition? @@ -29,7 +28,7 @@ case "$1" in -e '/# This file should/,/one per line\./d' \ -e 's/Comments begin with.*/Syntax: module_name [args ...]/' \ -e 's/^# ext2$/# raid1/' \ - -e 's/^# wd io=0x300$/# sd_mod/' + -e 's/^# wd io=0x300$/# sd_mod/' \ -e '/^ide-generic/d' \ -e '/^ide-disk/d' \ -e '/^ext2/d' \ @@ -40,7 +39,6 @@ case "$1" in if [ -e /etc/mkinitrd/DSDT ]; then cp /etc/mkinitrd/DSDT /etc/initramfs-tools/DSDT.aml fi - fi ;; upgrade) if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.61"; then diff --git a/hook-functions b/hook-functions index 98c88a2..8df30f2 100644 --- a/hook-functions +++ b/hook-functions @@ -40,7 +40,8 @@ add_modules_from_file() manual_add_modules() { - for mam_x in $(modprobe --set-version="${version}" --show-depends "${1}" 2>/dev/null | awk '/^insmod/ { print $2 }'); do + for mam_x in $(modprobe --set-version="${version}" --ignore-install \ + --show-depends "${1}" 2>/dev/null | awk '/^insmod/ { print $2 }'); do # Prune duplicates if [ -e "${DESTDIR}/${mam_x}" ]; then continue diff --git a/hooks/thermal b/hooks/thermal index 9bfd323..ece7243 100755 --- a/hooks/thermal +++ b/hooks/thermal @@ -23,6 +23,17 @@ case "$DPKG_ARCH" in # copy the right modules powerpc|ppc64) manual_add_modules therm_pm72 + manual_add_modules windfarm_core + manual_add_modules windfarm_cpufreq_clamp + manual_add_modules windfarm_lm75_sensor + manual_add_modules windfarm_max6690_sensor + manual_add_modules windfarm_pid + manual_add_modules windfarm_pm112 + manual_add_modules windfarm_pm81 + manual_add_modules windfarm_pm91 + manual_add_modules windfarm_smu_controls + manual_add_modules windfarm_smu_sat + manual_add_modules windfarm_smu_sensors manual_add_modules i2c-powermac ;; i386|amd64|ia64) diff --git a/initramfs-tools.8 b/initramfs-tools.8 index 4ce53d3..690505f 100644 --- a/initramfs-tools.8 +++ b/initramfs-tools.8 @@ -1,4 +1,4 @@ -.TH INITRAMFS-TOOLS 8 "Date: 2006/10/11" "" "mkinitramfs script overview" +.TH INITRAMFS-TOOLS 8 "Date: 2006/10/14" "" "mkinitramfs script overview" .SH NAME initramfs-tools \- an introduction to writing scripts for mkinitramfs @@ -438,7 +438,7 @@ to double-check if it contains the relevant binaries, libs or modules: .nf mkdir tmp/initramfs cd tmp/initramfs -gunzip -c -9 /boot/initrd.img-2.6.17-2-686 | \\ +gunzip -c -9 /boot/initrd.img-2.6.18-1-686 | \\ cpio -i -d -H newc --no-absolute-filenames .fi .RE diff --git a/mkinitramfs b/mkinitramfs index f667c53..2fd0cc8 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -166,7 +166,7 @@ export verbose # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ -for d in bin conf/conf.d etc lib modules sbin scripts; do +for d in bin conf/conf.d etc lib modules sbin scripts ${MODULESDIR}; do mkdir -p "${DESTDIR}/${d}" done diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer index bafbe19..8382b20 100755 --- a/scripts/init-top/framebuffer +++ b/scripts/init-top/framebuffer @@ -82,7 +82,7 @@ fi if [ -e /proc/fb ]; then while read fbno desc; do - mknod /dev/fb$fbno 29 $fbno + mknod /dev/fb$fbno c 29 $fbno done < /proc/fb mknod /dev/fb0 c 29 0 diff --git a/scripts/local b/scripts/local index 299fc65..f4079d5 100644 --- a/scripts/local +++ b/scripts/local @@ -51,6 +51,10 @@ mountroot () else FSTYPE=${ROOTFSTYPE} fi + if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t ${ROOT}) + [ -z "$FSTYPE" ] && FSTYPE="unknown" + fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount diff --git a/update-initramfs b/update-initramfs index 151e47a..c112211 100755 --- a/update-initramfs +++ b/update-initramfs @@ -148,10 +148,11 @@ mbr_check() echo } -# only run lilo if no grub is around -# or if "do_bootloader = yes" is set +# Invoke bootloader run_bootloader() { + # only run lilo if no grub is around + # or if "do_bootloader = yes" is set if [ -x /sbin/grub ] || [ -e /boot/grub/menu.lst ] \ || [ -x /usr/sbin/grub ]; then if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then @@ -168,8 +169,16 @@ run_bootloader() fi return 0 fi - if [ -e /etc/lilo.conf ] && [ -x /sbin/lilo ]; then + if [ -r /etc/lilo.conf ] && [ -x /sbin/lilo ]; then run_lilo + return 0 + fi + if [ -x /sbin/elilo ]; then + elilo + return 0 + fi + if [ -r /etc/zipl.conf ]; then + zipl fi } -- cgit v1.2.3 From c4343742b3bf028e467ac8a58ead95c9bfefc628 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 2 Apr 2007 13:29:25 +0200 Subject: first prerelease 0.86 + merge 0.85f * kick mdrun script * update control for lenny + ubuntu * add _all_ ide, block and drivers * use MODPROBE_OPTIONS and kill any modprobed arg * small doc + whitespace fixes --- debian/changelog | 60 +++++++++++++++++++++++++++++++++++++++++-- debian/control | 4 +-- debian/script | 2 +- hook-functions | 28 +++++--------------- init | 13 +++++++--- initramfs.conf.5 | 6 ++--- mkinitramfs.8 | 7 ++++- scripts/functions | 8 +++--- scripts/init-premount/thermal | 26 +++++++++---------- scripts/init-top/framebuffer | 7 ++--- scripts/local | 8 +++--- scripts/local-top/lvm | 6 ++--- scripts/local-top/mdrun | 46 --------------------------------- scripts/local-top/udev_helper | 2 +- scripts/nfs | 4 +-- update-initramfs | 24 +++++++++-------- update-initramfs.conf.5 | 4 +-- 17 files changed, 130 insertions(+), 125 deletions(-) delete mode 100755 scripts/local-top/mdrun (limited to 'scripts/local') 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 16fac6738535e973cfe1493f1b9b5c67c5150ffc Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 13 Apr 2007 20:11:21 +0200 Subject: Use -Qb for for module loading to honor blacklists. --- debian/changelog | 5 +++-- scripts/init-premount/thermal | 4 ++-- scripts/local | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index d86408d..c0f652b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,9 +9,10 @@ initramfs-tools (0.87) UNRELEASED; urgency=low [ David Härdeman ] * Add support for loading keymaps. (closes: 337663) + * Ubuntu merge + - Use -Qb for for module loading to honor blacklists. - - -- maximilian attems Fri, 13 Apr 2007 01:22:56 +0200 + -- David Härdeman Fri, 13 Apr 2007 20:08:26 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index aa146ec..e8a6ae4 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -31,7 +31,7 @@ powerpc|ppc64) modprobe windfarm_smu_sensors ;; i386|amd64|ia64) - modprobe fan - modprobe thermal + modprobe -Qb fan + modprobe -Qb thermal ;; esac diff --git a/scripts/local b/scripts/local index 4e01472..47ef7fa 100644 --- a/scripts/local +++ b/scripts/local @@ -67,7 +67,7 @@ mountroot () fi # FIXME This has no error checking - modprobe ${FSTYPE} + modprobe -Qb ${FSTYPE} # FIXME This has no error checking # Mount root -- cgit v1.2.3 From 24973b26ba0b43594d6c2bdbc2680f51998b8294 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sat, 14 Apr 2007 10:57:12 +0200 Subject: Revert NACK'ed change --- debian/changelog | 3 +-- scripts/init-premount/thermal | 4 ++-- scripts/local | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index a20ad86..838da0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,10 +11,9 @@ initramfs-tools (0.87) UNRELEASED; urgency=low * Add support for loading keymaps. (closes: 337663) * Move legacy code from mkinitramfs to separate hooks. * Ubuntu merge - - Use -Qb for for module loading to honor blacklists. - Add PS3 module loading functionality. - -- David Härdeman Fri, 13 Apr 2007 21:01:11 +0200 + -- David Härdeman Sat, 14 Apr 2007 10:53:56 +0200 initramfs-tools (0.86) unstable; urgency=low diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal index e8a6ae4..aa146ec 100755 --- a/scripts/init-premount/thermal +++ b/scripts/init-premount/thermal @@ -31,7 +31,7 @@ powerpc|ppc64) modprobe windfarm_smu_sensors ;; i386|amd64|ia64) - modprobe -Qb fan - modprobe -Qb thermal + modprobe fan + modprobe thermal ;; esac diff --git a/scripts/local b/scripts/local index 47ef7fa..4e01472 100644 --- a/scripts/local +++ b/scripts/local @@ -67,7 +67,7 @@ mountroot () fi # FIXME This has no error checking - modprobe -Qb ${FSTYPE} + modprobe ${FSTYPE} # FIXME This has no error checking # Mount root -- cgit v1.2.3 From 525008f4da3ddc32c83329dbb6322ae1660b8fc8 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sun, 27 May 2007 00:29:27 +0200 Subject: scripts/local: check for fs on rootnode some device node will exist before they can be safely used --- debian/changelog | 10 ++++++++-- scripts/local | 36 +++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 9 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index 032fa85..042cf8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,8 +16,14 @@ initramfs-tools (0.88) UNRELEASED; urgency=low * hook-functions: Document how copy_exec determines the target path. * hook-functions: Add firmware loading support to manual_add_modules(). (closes: #355881) - - -- maximilian attems Thu, 03 May 2007 18:43:14 +0200 + * scripts/local: Ubuntu merge + - As well as waiting for the existance of the root device node, also check + to see whether we have a filesystem of some kind on it. Some devices + nodes (devmapper/LVM/EVMS, mdadm) will exist before they can be safely + used. Patch by Scott James Remnant . Changed to + support both fstype and vol_id. + + -- maximilian attems Sun, 27 May 2007 00:26:17 +0200 initramfs-tools (0.87b) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 4e01472..459ba8d 100644 --- a/scripts/local +++ b/scripts/local @@ -1,5 +1,29 @@ # Local filesystem mounting -*- shell-script -*- +# Parameter: device node to check +# Echos fstype to stdout +# Return value: indicates if an fs could be recognized +get_fstype () +{ + local FS FSTYPE FSSIZE RET + FS="${1}" + + # vol_id has a more complete list of file systems + if [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) + else + eval $(fstype < "${FS}" 2> /dev/null) + fi + RET=$? + + if [ -z "${FSTYPE}" ]; then + FSTYPE="unknown" + fi + + echo "${FSTYPE}" + return ${RET} +} + # Parameter: Where to mount the filesystem mountroot () { @@ -9,7 +33,7 @@ mountroot () # If the root device hasn't shown up yet, give it a little while # to deal with removable devices - if [ ! -e "${ROOT}" ]; then + if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then log_begin_msg "Waiting for root file system..." # Default delay is 180s @@ -23,9 +47,11 @@ mountroot () fi slumber=$(( ${slumber} * 10 )) - while [ ${slumber} -gt 0 ] && [ ! -e "${ROOT}" ]; do + while [ ! -e "${ROOT}" ] \ + || ! $(get_fstype "${ROOT}" >/dev/null); do /bin/sleep 0.1 slumber=$(( ${slumber} - 1 )) + [ ${slumber} -gt 0 ] || break done if [ ${slumber} -gt 0 ]; then @@ -47,14 +73,10 @@ mountroot () # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then - eval $(fstype < ${ROOT}) + FSTYPE=$(get_fstype "${ROOT}") else FSTYPE=${ROOTFSTYPE} fi - if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t ${ROOT}) - [ -z "$FSTYPE" ] && FSTYPE="unknown" - fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount" run_scripts /scripts/local-premount -- cgit v1.2.3 From ad5ae668b01884a4ef99d14bbfef7ce07f908801 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 11 Jun 2007 00:42:05 +0200 Subject: scripts/local: use simpler fstype invocation compatible with etch released klibc --- debian/changelog | 4 +++- scripts/local | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index d413936..be82239 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,9 @@ initramfs-tools (0.89) unstable; urgency=low * initramfs.conf.5: Document ROOT hardcoding. - -- maximilian attems Wed, 30 May 2007 13:25:36 +0200 + * scripts/local: Use simpler fstype invocation. + + -- maximilian attems Mon, 11 Jun 2007 00:40:29 +0200 initramfs-tools (0.88) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 459ba8d..429d1f6 100644 --- a/scripts/local +++ b/scripts/local @@ -12,7 +12,7 @@ get_fstype () if [ -x /lib/udev/vol_id ]; then FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) else - eval $(fstype < "${FS}" 2> /dev/null) + eval $(fstype "${FS}" 2> /dev/null) fi RET=$? -- cgit v1.2.3 From 087dc49f30e7d94db10c0f0cd89020a56a04a918 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 20 Jun 2007 20:58:41 +0200 Subject: scripts/local: add a q&d crude method to warn about renamed root dev maybe this will reduce ration of bug reports, as further device renaming is in the pipes. :) --- debian/changelog | 5 ++++- scripts/local | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index b1bacac..d506d71 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,10 @@ initramfs-tools (0.89) unstable; urgency=low * initramfs-tools.8, initramfs.conf.5: Fix typos. (closes: #427837, #427838) Thanks "A. Costa" for the patch. - -- maximilian attems Wed, 20 Jun 2007 20:01:20 +0200 + * scripts/local: Try to warn for renamed root dev. (closes: #374611) + + + -- maximilian attems Wed, 20 Jun 2007 20:56:14 +0200 initramfs-tools (0.88) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 429d1f6..10e2f73 100644 --- a/scripts/local +++ b/scripts/local @@ -66,6 +66,25 @@ mountroot () # We've given up, but we'll let the user fix matters if they can while [ ! -e "${ROOT}" ]; do + # give hint about renamed root + case "${ROOT}" in + /dev/hd*) + suffix="${ROOT#/dev/hd}" + major="${suffix%[[:digit:]]}" + major="${major%[[:digit:]]}" + if [ -d "/sys/block/sd${major}" ]; then + echo "WARNING bootdevice may be renamed. Try root=/dev/sd${suffix}" + fi + ;; + /dev/sd*) + suffix="${ROOT#/dev/sd}" + major="${suffix%[[:digit:]]}" + major="${major%[[:digit:]]}" + if [ -d "/sys/block/hd${major}" ]; then + echo "WARNING bootdevice may be renamed. Try root=/dev/hd${suffix}" + fi + ;; + esac echo "ALERT! ${ROOT} does not exist. Dropping to a shell!" echo " Check your root= boot argument (cat /proc/cmdline)" panic " Check for missing modules (cat /proc/modules), or device files (ls /dev)" -- cgit v1.2.3 From 5ac61dd320ed9616a7e986fa824f804dbbd626af Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 4 Jul 2007 00:34:42 +0200 Subject: revert vol_id usage for now, when more matured this can be easily rechanged. --- debian/changelog | 17 +++++++++++------ scripts/local | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index 6a17083..3141edf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,11 @@ initramfs-tools (0.89) unstable; urgency=low + + Release "L'électeur c'est notoire N'a pas tout' sa raison" + + [ Joey Hess ] + * mkinitramfs: Include libgcc_s.so.1 on arm since glibc always tries to load + it for the SJLJ exception handling on that architecture. (closes: #426395) + Thanks to Aurelien Jarno for ack and review. [ maximilian attems ] * initramfs.conf.5: Document ROOT hardcoding. @@ -10,13 +17,11 @@ initramfs-tools (0.89) unstable; urgency=low MODULES setting is passed. Thanks Henning Sprang for report. (closes: #429144) * hook-functions: Fix variable typo. Thanks Emanuele Rocca . + * scripts/local: Revert change to use udev vol_id before fstype, + there are too many "wrongly" formated fs out there. fstype supports less, + but is more robust. - [ Joey Hess ] - * mkinitramfs: Include libgcc_s.so.1 on arm since glibc always tries to load - it for the SJLJ exception handling on that architecture. (closes: #426395) - Thanks to Aurelien Jarno for ack and review. - - -- maximilian attems Thu, 21 Jun 2007 11:57:20 +0200 + -- maximilian attems Wed, 04 Jul 2007 00:28:34 +0200 initramfs-tools (0.88) unstable; urgency=low diff --git a/scripts/local b/scripts/local index 10e2f73..b06ca63 100644 --- a/scripts/local +++ b/scripts/local @@ -10,9 +10,9 @@ get_fstype () # vol_id has a more complete list of file systems if [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) - else eval $(fstype "${FS}" 2> /dev/null) + else + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) fi RET=$? -- cgit v1.2.3 From ee93d17783dc32d03faf99c29bdcd4fcc30abc43 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Wed, 4 Jul 2007 10:15:53 +0200 Subject: scripts/local: make sure that fstype is always invoked --- scripts/local | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index b06ca63..55d4c46 100644 --- a/scripts/local +++ b/scripts/local @@ -8,10 +8,10 @@ get_fstype () local FS FSTYPE FSSIZE RET FS="${1}" - # vol_id has a more complete list of file systems - if [ -x /lib/udev/vol_id ]; then - eval $(fstype "${FS}" 2> /dev/null) - else + # vol_id has a more complete list of file systems, + # but fstype is more robust + eval $(fstype "${FS}" 2> /dev/null) + if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) fi RET=$? -- cgit v1.2.3 From cd3e97b5b87380e8d1700c6f86d907ad40a1179d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 25 Aug 2007 19:11:44 +0200 Subject: scripts/local: small CodingStyle quote readonly variable --- debian/changelog | 3 ++- scripts/local | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts/local') diff --git a/debian/changelog b/debian/changelog index 26a76aa..1031a50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low Add XS-Vcs-* fields. Mv busybox from Depends to Recommends. * mkinitramfs: Cope when no busybox is around warn on md/lvm root. * mkinitramfs: Kill kinit.shared too. + * scripts/local: Quote readonly variable. (LP: #115807) - -- maximilian attems Sat, 25 Aug 2007 14:35:38 +0200 + -- maximilian attems Sat, 25 Aug 2007 19:10:20 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/scripts/local b/scripts/local index 55d4c46..b55212e 100644 --- a/scripts/local +++ b/scripts/local @@ -101,7 +101,7 @@ mountroot () run_scripts /scripts/local-premount [ "$quiet" != "y" ] && log_end_msg - if [ ${readonly} = y ]; then + if [ "${readonly}" = "y" ]; then roflag=-r else roflag=-w -- cgit v1.2.3 From 7e5cad4b55f4e3ca20bb0f4dbaeaf3d6b9e7b8d7 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 2 Jul 2008 16:50:14 +0200 Subject: init: Remove extra ellipses log_begin_msg already puts ... at the end of the stuff it prints, so no need to have it in there explicitly. Signed-off-by: martin f. krafft Signed-off-by: maximilian attems --- init | 4 ++-- scripts/local | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/local') diff --git a/init b/init index 885f240..4c72eab 100755 --- a/init +++ b/init @@ -157,7 +157,7 @@ maybe_break top run_scripts /scripts/init-top maybe_break modules -log_begin_msg "Loading essential drivers..." +log_begin_msg "Loading essential drivers" load_modules log_end_msg @@ -167,7 +167,7 @@ run_scripts /scripts/init-premount [ "$quiet" != "y" ] && log_end_msg maybe_break mount -log_begin_msg "Mounting root file system..." +log_begin_msg "Mounting root file system" . /scripts/${BOOT} parse_numeric ${ROOT} mountroot diff --git a/scripts/local b/scripts/local index b55212e..d28917b 100644 --- a/scripts/local +++ b/scripts/local @@ -34,7 +34,7 @@ mountroot () # If the root device hasn't shown up yet, give it a little while # to deal with removable devices if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then - log_begin_msg "Waiting for root file system..." + log_begin_msg "Waiting for root file system" # Default delay is 180s if [ -z "${ROOTDELAY}" ]; then -- cgit v1.2.3 From fc24059a296ecba82475debde0eff2330c92a2cd Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 2 Jul 2008 16:50:15 +0200 Subject: Wait for udevsettle after $BOOT-top scripts ran udev may be busy creating links for the root device by the time mountroot is called. udevsettle makes sure these are processed. I thus call udevsettle with a timeout of 10 seconds after the $BOOT-top scripts have run and before the ROOTDELAY hack kicks in. I thought about doing this with a local-top script instead, but there is no way to ensure that it'll run last; cryptsetup uses a hack to make sure it runs last, if we also use the same hack, there'll be a dependency loop. Signed-off-by: martin f. krafft Signed-off-by: maximilian attems --- scripts/functions | 9 +++++++++ scripts/local | 2 ++ scripts/nfs | 2 ++ 3 files changed, 13 insertions(+) (limited to 'scripts/local') diff --git a/scripts/functions b/scripts/functions index d36884c..558f521 100644 --- a/scripts/functions +++ b/scripts/functions @@ -313,3 +313,12 @@ configure_networking() . /tmp/net-*.conf fi } + +wait_for_udev() +{ + if [ -x "$(command -v udevsettle)" ]; then + [ "$quiet" != "y" ] && log_begin_msg "Waiting for udev to process events" + udevsettle ${1:+--timeout=$1} + [ "$quiet" != "y" ] && log_end_msg + fi +} diff --git a/scripts/local b/scripts/local index d28917b..dc0745d 100644 --- a/scripts/local +++ b/scripts/local @@ -31,6 +31,8 @@ mountroot () run_scripts /scripts/local-top [ "$quiet" != "y" ] && log_end_msg + wait_for_udev 10 + # If the root device hasn't shown up yet, give it a little while # to deal with removable devices if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then diff --git a/scripts/nfs b/scripts/nfs index b9c2522..435d2d0 100644 --- a/scripts/nfs +++ b/scripts/nfs @@ -59,6 +59,8 @@ mountroot() # For DHCP modprobe af_packet + wait_for_udev 10 + # Default delay is around 180s # FIXME: add usplash_write info if [ -z "${ROOTDELAY}" ]; then -- cgit v1.2.3 From b1c5ca97da3bf6053412f1e159db09a48b44a6c5 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 5 Jul 2008 01:46:31 +0200 Subject: Merge more meaningful text for no root device panic from Ubuntu. Debian users were pasting that without getting the real trouble, thanks for the better rephrasing. --- scripts/local | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index dc0745d..85d62af 100644 --- a/scripts/local +++ b/scripts/local @@ -87,9 +87,12 @@ mountroot () fi ;; esac - echo "ALERT! ${ROOT} does not exist. Dropping to a shell!" - echo " Check your root= boot argument (cat /proc/cmdline)" - panic " Check for missing modules (cat /proc/modules), or device files (ls /dev)" + echo "Gave up waiting for root device. Common problems:" + echo " - Boot args (cat /proc/cmdline)" + echo " - Check rootdelay= (did the system wait long enough?)" + echo " - Check root= (did the system wait for the right device?)" + echo " - Missing modules (cat /proc/modules; ls /dev)" + panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done # Get the root filesystem type if not set -- cgit v1.2.3 From 13df18822a697053e10e8f42397e5237a15590f6 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Tue, 14 Oct 2008 18:04:09 -0400 Subject: allow root=mtd0 to be used; skip root checks if ROOT doesn't start with /dev. The attached patch is needed for booting with root=mtd0. Basically, the init scripts assume the root device should have a special device file somewhere, and if not will wait for it to appear. This patch changes it so that it only waits for a device file to appear if $ROOT starts with "/dev". In the case of things like ROOT=LABEL=foo, the init scripts will translate that to a device. With ROOT=mtd0, the init scripts will not check for a device, and will successfully mount the root filesystem. Signed-off-by: Andres Salomon --- scripts/local | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index 85d62af..b6bd192 100644 --- a/scripts/local +++ b/scripts/local @@ -24,8 +24,7 @@ get_fstype () return ${RET} } -# Parameter: Where to mount the filesystem -mountroot () +pre_mountroot() { [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" run_scripts /scripts/local-top @@ -33,6 +32,12 @@ mountroot () wait_for_udev 10 + # Don't wait for a root device that doesn't have a corresponding + # device in /dev (ie, mtd0) + if [ "${ROOT#/dev}" = "${ROOT}" ]; then + return + fi + # If the root device hasn't shown up yet, give it a little while # to deal with removable devices if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then @@ -94,6 +99,11 @@ mountroot () echo " - Missing modules (cat /proc/modules; ls /dev)" panic "ALERT! ${ROOT} does not exist. Dropping to a shell!" done +} + +mountroot() +{ + pre_mountroot # Get the root filesystem type if not set if [ -z "${ROOTFSTYPE}" ]; then -- cgit v1.2.3 From 90c19d7bac748efdaab0355d4aa3a25b579bc0f2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 26 Jan 2010 21:05:35 -0500 Subject: scripts/local: avoid mount -t unknown Since fstype does not support btrfs (#548047), and since udev 150, vol_id no longer exists, get_fstype sets FSTYPE to "unknown", and then the root filesystem is mounted using "mount -t unknown /dev/hda2 /root". Of course, that fails, and with a really unhelpful error message ("mount: device doesnot exist") Why not just skip the -t parameter if FSTYPE=unknown? Mounting the root fs was going to fail, so letting mount autodetect the fs type can't be worse. Attached patch does that and got my root on btrfs working. Workaround: boot with rootfstype=btrfs Signed-off-by: maximilian attems --- scripts/local | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index b6bd192..7bc740f 100644 --- a/scripts/local +++ b/scripts/local @@ -127,7 +127,11 @@ mountroot() # FIXME This has no error checking # Mount root - mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} + if [ "${FSTYPE}" != "unknown" ]; then + mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt} + else + mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt} + fi [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom" run_scripts /scripts/local-bottom -- cgit v1.2.3 From 49337bdc94ed5bc176338cfa793a868fcd33784c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 30 Jan 2010 19:54:13 +0100 Subject: scripts/local: Use blkid as backup fstype detection if blkid is on initramfs use it. Thanks to Joey Hess for calling syntax. Signed-off-by: maximilian attems --- scripts/local | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index 7bc740f..feead1c 100644 --- a/scripts/local +++ b/scripts/local @@ -11,7 +11,9 @@ get_fstype () # vol_id has a more complete list of file systems, # but fstype is more robust eval $(fstype "${FS}" 2> /dev/null) - if [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then + if [ "$FSTYPE" = "unknown" ] && [ command -v blkid >/dev/null 2>&1 ]; then + FSTYPE=$(blkid -o value -s TYPE "${FS}") + elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) fi RET=$? -- cgit v1.2.3 From df43f67500c9f3f1d9ad1e310173cf6babd85a61 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 25 Feb 2010 00:56:29 +0100 Subject: scripts/local: fix blkid invocation 49337bd looks bogus. It adds the test "[ command ... ]" but I think that should be just "command ..." Reporte-by: Ben Hutchings Signed-off-by: maximilian attems --- scripts/local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index feead1c..1474073 100644 --- a/scripts/local +++ b/scripts/local @@ -11,7 +11,7 @@ get_fstype () # vol_id has a more complete list of file systems, # but fstype is more robust eval $(fstype "${FS}" 2> /dev/null) - if [ "$FSTYPE" = "unknown" ] && [ command -v blkid >/dev/null 2>&1 ]; then + if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then FSTYPE=$(blkid -o value -s TYPE "${FS}") elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) -- cgit v1.2.3 From 9d6567169ea95ffad8a3c9a95218851821d147b8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 4 Apr 2010 05:30:31 +0200 Subject: scripts/functions: add get_fstype() from scripts/local allows wider usage. (closes: #487409) Reported-by: Christoph Anton Mitterer Signed-off-by: maximilian attems --- scripts/functions | 26 ++++++++++++++++++++++++++ scripts/local | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'scripts/local') diff --git a/scripts/functions b/scripts/functions index 0ecb1d6..9b864ae 100644 --- a/scripts/functions +++ b/scripts/functions @@ -256,6 +256,32 @@ parse_numeric() { ROOT=/dev/root } +# Parameter: device node to check +# Echos fstype to stdout +# Return value: indicates if an fs could be recognized +get_fstype () +{ + local FS FSTYPE FSSIZE RET + FS="${1}" + + # vol_id has a more complete list of file systems, + # but fstype is more robust + eval $(fstype "${FS}" 2> /dev/null) + if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then + FSTYPE=$(blkid -o value -s TYPE "${FS}") + elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then + FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) + fi + RET=$? + + if [ -z "${FSTYPE}" ]; then + FSTYPE="unknown" + fi + + echo "${FSTYPE}" + return ${RET} +} + configure_networking() { if [ -n "${BOOTIF}" ]; then diff --git a/scripts/local b/scripts/local index 1474073..cca5e8d 100644 --- a/scripts/local +++ b/scripts/local @@ -1,31 +1,5 @@ # Local filesystem mounting -*- shell-script -*- -# Parameter: device node to check -# Echos fstype to stdout -# Return value: indicates if an fs could be recognized -get_fstype () -{ - local FS FSTYPE FSSIZE RET - FS="${1}" - - # vol_id has a more complete list of file systems, - # but fstype is more robust - eval $(fstype "${FS}" 2> /dev/null) - if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then - FSTYPE=$(blkid -o value -s TYPE "${FS}") - elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) - fi - RET=$? - - if [ -z "${FSTYPE}" ]; then - FSTYPE="unknown" - fi - - echo "${FSTYPE}" - return ${RET} -} - pre_mountroot() { [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top" -- cgit v1.2.3 From 60afd2a944cf36a5bce6ca3b4c07a422e98efeba Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 14 Jun 2010 12:10:28 +0200 Subject: code cleanup: drop trailing whitespaces. Signed-off-by: Michael Prokop --- conf/update-initramfs.conf | 2 +- debian/changelog | 6 +++--- debian/copyright | 2 +- docs/example_hook | 2 +- hook-functions | 2 +- init | 6 +++--- initramfs.conf.5 | 12 ++++++------ mkinitramfs | 2 +- scripts/functions | 2 +- scripts/local | 2 +- scripts/nfs | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) (limited to 'scripts/local') 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 'scripts/local') 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 eb93a7e7d11da7789fa357c763ce2bc76245c8a8 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 17 Jun 2010 11:22:01 +0200 Subject: pre_mountroot(): reduce timeout to 30 seconds giant disk arrays, clusters will need to provide their own rootdelay= boot arg, they should have capable admins. 3 minutes wait is just too long for regular users. sync from ubuntu 0.96.1ubuntu1. Acked-by: Michael Prokop Signed-off-by: maximilian attems --- scripts/local | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'scripts/local') diff --git a/scripts/local b/scripts/local index 9b51174..8cb279a 100644 --- a/scripts/local +++ b/scripts/local @@ -26,12 +26,9 @@ pre_mountroot() if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then log_begin_msg "Waiting for root file system" - # Default delay is 180s - if [ -z "${ROOTDELAY}" ]; then - slumber=180 - else - slumber=${ROOTDELAY} - fi + # Default delay is 30s + slumber=${ROOTDELAY:-30} + if [ -x /sbin/usplash_write ]; then /sbin/usplash_write "TIMEOUT ${slumber}" || true fi -- cgit v1.2.3