Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
modules 0000666 00000000366 15077014425 0006155 0 ustar 00 # List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
# Syntax: module_name [args ...]
#
# You must run update-initramfs(8) to effect this change.
#
# Examples:
#
# raid1
# sd_mod
update-initramfs.conf 0000666 00000000572 15077014425 0010704 0 ustar 00 #
# Configuration file for update-initramfs(8)
#
#
# update_initramfs [ yes | all | no ]
#
# Default is yes
# If set to all update-initramfs will update all initramfs
# If set to no disables any update to initramfs beside kernel upgrade
update_initramfs=yes
#
# backup_initramfs [ yes | no ]
#
# Default is no
# If set to no leaves no .bak backup files.
backup_initramfs=no
initramfs.conf 0000666 00000002117 15077014425 0007421 0 ustar 00 #
# initramfs.conf
# Configuration file for mkinitramfs(8). See initramfs.conf(5).
#
# Note that configuration options from this file can be overridden
# by config files in the /etc/initramfs-tools/conf.d directory.
#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list
#
MODULES=most
#
# BUSYBOX: [ y | n ]
#
# Use busybox if available.
#
BUSYBOX=y
#
# KEYMAP: [ y | n ]
#
# Load a keymap during the initramfs stage.
#
KEYMAP=n
#
# COMPRESS: [ gzip | bzip2 | lzma | lzop ]
#
COMPRESS=gzip
#
# NFS Section of the config.
#
#
# BOOT: [ local | nfs ]
#
# local - Boot off of local media (harddrive, USB stick).
#
# nfs - Boot using an NFS drive as the root of the drive.
#
BOOT=local
#
# DEVICE: ...
#
# Specify a specific network interface, like eth0
# Overridden by optional ip= bootarg
#
DEVICE=
#
# NFSROOT: [ auto | HOST:MOUNT ]
#
NFSROOT=auto
etc/bash_completion.d/initramfs-tools 0000666 00000001311 15077110746 0013774 0 ustar 00 # update-initramfs(8) completion
_update_initramfs()
{
local cur prev valid_options
# TODO: this can be "_get_comp_words_by_ref cur prev" once
# bash-completion >= 1.2 is available, see #537139
cur=$(_get_cword)
prev=${COMP_WORDS[COMP_CWORD-1]}
# The only option that takes an argument is -k
if [[ "$prev" == '-k' ]]; then
# Complete with kernel versions
_kernel_versions
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all' -- "$cur" ) )
return;
fi
# Complete with available options (obtained from -h)
valid_options=$( update-initramfs -h 2>&1 | \
sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' )
COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) )
}
complete -F _update_initramfs update-initramfs
init 0000666 00000013503 15077204445 0005450 0 ustar 00 #!/bin/sh
echo "Loading, please wait..."
[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -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
# 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
tmpfs_size="10M"
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
if ! mount -t devtmpfs -o mode=0755 none /dev; then
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev
[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
[ -e /dev/null ] || mknod /dev/null c 1 3
fi
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 none /dev/pts || true
> /dev/.initramfs-tools
mkdir /dev/.initramfs
# Export the dpkg architecture
export DPKG_ARCH=
. /conf/arch.conf
# Set modprobe env
export MODPROBE_OPTIONS="-qb"
# Export relevant variables
export ROOT=
export ROOTDELAY=
export ROOTFLAGS=
export ROOTFSTYPE=
export IP=
export BOOT=
export BOOTIF=
export UBIMTD=
export break=
export init=/sbin/init
export quiet=n
export readonly=y
export rootmnt=/root
export debug=
export panic=
export blacklist=
export resume=
export resume_offset=
# Bring in the main config
. /conf/initramfs.conf
for conf in conf/conf.d/*; do
[ -f ${conf} ] && . ${conf}
done
. /scripts/functions
# Parse command line options
for x in $(cat /proc/cmdline); do
case $x in
init=*)
init=${x#init=}
;;
root=*)
ROOT=${x#root=}
case $ROOT in
LABEL=*)
ROOT="${ROOT#LABEL=}"
# support any / in LABEL= path (escape to \x2f)
case "${ROOT}" in
*/*)
if command -v sed >/dev/null 2>&1; then
ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')"
else
if [ "${ROOT}" != "${ROOT#/}" ]; then
ROOT="\x2f${ROOT#/}"
fi
if [ "${ROOT}" != "${ROOT%/}" ]; then
ROOT="${ROOT%/}\x2f"
fi
IFS='/'
newroot=
for s in $ROOT; do
newroot="${newroot:+${newroot}\\x2f}${s}"
done
unset IFS
ROOT="${newroot}"
fi
esac
ROOT="/dev/disk/by-label/${ROOT}"
;;
UUID=*)
ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
;;
/dev/nfs)
[ -z "${BOOT}" ] && BOOT=nfs
;;
esac
;;
rootflags=*)
ROOTFLAGS="-o ${x#rootflags=}"
;;
rootfstype=*)
ROOTFSTYPE="${x#rootfstype=}"
;;
rootdelay=*)
ROOTDELAY="${x#rootdelay=}"
case ${ROOTDELAY} in
*[![:digit:].]*)
ROOTDELAY=
;;
esac
;;
nfsroot=*)
NFSROOT="${x#nfsroot=}"
;;
ip=*)
IP="${x#ip=}"
;;
boot=*)
BOOT=${x#boot=}
;;
ubi.mtd=*)
UBIMTD=${x#ubi.mtd=}
;;
resume=*)
RESUME="${x#resume=}"
;;
resume_offset=*)
resume_offset="${x#resume_offset=}"
;;
noresume)
noresume=y
;;
panic=*)
panic="${x#panic=}"
case ${panic} in
*[![:digit:].]*)
panic=
;;
esac
;;
quiet)
quiet=y
;;
ro)
readonly=y
;;
rw)
readonly=n
;;
debug)
debug=y
quiet=n
exec >/dev/.initramfs/initramfs.debug 2>&1
set -x
;;
debug=*)
debug=y
quiet=n
set -x
;;
break=*)
break=${x#break=}
;;
break)
break=premount
;;
blacklist=*)
blacklist=${x#blacklist=}
;;
netconsole=*)
netconsole=${x#netconsole=}
;;
BOOTIF=*)
BOOTIF=${x#BOOTIF=}
;;
esac
done
if [ -n "${noresume}" ]; then
export noresume
unset resume
else
resume=${RESUME:-}
fi
[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
maybe_break top
# Don't do log messages here to avoid confusing usplash
run_scripts /scripts/init-top
maybe_break modules
[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
load_modules
[ "$quiet" != "y" ] && log_end_msg
maybe_break premount
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
run_scripts /scripts/init-premount
[ "$quiet" != "y" ] && log_end_msg
maybe_break mount
log_begin_msg "Mounting root file system"
. /scripts/${BOOT}
parse_numeric ${ROOT}
maybe_break mountroot
mountroot
log_end_msg
maybe_break bottom
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
run_scripts /scripts/init-bottom
[ "$quiet" != "y" ] && log_end_msg
# Move virtual filesystems over to the real filesystem
mount -n -o move /sys ${rootmnt}/sys
mount -n -o move /proc ${rootmnt}/proc
validate_init() {
checktarget="${1}"
# Work around absolute symlinks
if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${checktarget}" ]; then
case $(readlink "${rootmnt}${checktarget}") in /*)
checktarget="$(chroot ${rootmnt} readlink ${checktarget})"
;;
esac
fi
# Make sure the specified init can be executed
if [ ! -x "${rootmnt}${checktarget}" ]; then
return 1
fi
# Upstart uses /etc/init as configuration directory :-/
if [ -d "${rootmnt}${checktarget}" ]; then
return 1
fi
}
# Check init bootarg
if [ -n "${init}" ]; then
if ! validate_init "$init"; then
echo "Target filesystem doesn't have requested ${init}."
init=
fi
fi
# Common case: /sbin/init is present
if [ ! -x "${rootmnt}/sbin/init" ]; then
# ... if it's not available search for valid init
if [ -z "${init}" ] ; then
for inittest in /sbin/init /etc/init /bin/init /bin/sh; do
if validate_init "${inittest}"; then
init="$inittest"
break
fi
done
fi
# No init on rootmount
if ! validate_init "${init}" ; then
panic "No init found. Try passing init= bootarg."
fi
fi
maybe_break init
# don't leak too much of env - some init(8) don't clear it
# (keep init, rootmnt)
unset debug
unset MODPROBE_OPTIONS
unset DPKG_ARCH
unset ROOTFLAGS
unset ROOTFSTYPE
unset ROOTDELAY
unset ROOT
unset IP
unset BOOT
unset BOOTIF
unset UBIMTD
unset blacklist
unset break
unset noresume
unset panic
unset quiet
unset readonly
unset resume
unset resume_offset
# Chain to real filesystem
exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console
panic "Could not execute run-init."
hooks/keymap 0000666 00000002212 15077204445 0007111 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# Hook to load keymaps into the initramfs if requested by KEYMAP="y"
if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then
exit 0
fi
# Step 1 - Basic tools
if [ ! -x /bin/loadkeys ] ||
! ( [ -r /etc/console/boottime.kmap.gz ] \
|| [ -r /etc/console-setup/cached.kmap.gz ] ); then
exit 0
fi
. /usr/share/initramfs-tools/hook-functions
copy_exec /bin/loadkeys /bin
if [ -e /etc/console-setup/cached.kmap.gz ]; then
cp /etc/console-setup/cached.kmap.gz ${DESTDIR}/etc/boottime.kmap.gz
else
cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/
fi
# Step 2 - Check for UTF8 console
if [ ! -x /usr/bin/kbd_mode ]; then
exit 0
fi
if [ -r /etc/environment ]; then
env="/etc/environment"
elif [ -r /etc/default/locale ]; then
env="/etc/default/locale"
else
exit 0
fi
for var in LANG LC_ALL LC_CTYPE; do
value=$(egrep "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2)
eval $var=$value
done
charmap=$(LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap)
if [ "$charmap" = "UTF-8" ]; then
copy_exec /usr/bin/kbd_mode /bin
fi
exit 0
hooks/klibc 0000666 00000000564 15077204445 0006717 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# klibc
ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin
ln -s /lib/klibc-*.so ${DESTDIR}/lib
rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/zcat
if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then
mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh
fi
hooks/busybox 0000666 00000001120 15077204445 0007313 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# busybox
if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then
# those root need busybox
eval "$(mount | awk '/ \/ / {print "r_dev=" $1; exit}')"
if [ "${r_dev#/dev/mapper/}" != "${r_dev}" ]; then
echo "W: Busybox is required for successful boot!"
fi
else
. /usr/share/initramfs-tools/hook-functions
rm -f ${DESTDIR}/bin/sh
rm -f ${DESTDIR}/bin/busybox
copy_exec ${BUSYBOXDIR}/busybox /bin/busybox
ln -s ${BUSYBOXDIR}/busybox ${DESTDIR}/bin/sh
fi
hooks/thermal 0000666 00000002373 15077204445 0007267 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# Hooks for loading thermal bits into the initramfs
. /usr/share/initramfs-tools/hook-functions
case "$DPKG_ARCH" in
# copy the right modules
powerpc|ppc64)
# Only G5 Mac machines need to load
# therm_pm72 or one of the windfarm_pm* modules.
[ -r /proc/cpuinfo ] || exit 0
MODEL="`grep model /proc/cpuinfo`"
MODEL="${MODEL##*: }"
case "$MODEL" in
RackMac3,1|PowerMac7,2|PowerMac7,3)
force_load therm_pm72
;;
PowerMac8,1|PowerMac8,2)
force_load windfarm_pm81
;;
PowerMac9,1)
force_load windfarm_pm91
;;
PowerMac11,2)
force_load windfarm_pm112
;;
PowerMac12,1)
force_load windfarm_pm121
;;
*)
# No other machine needs windfarm_* modules on initrd.
exit 0
;;
esac
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_smu_controls
manual_add_modules windfarm_smu_sat
manual_add_modules windfarm_smu_sensors
;;
i386|amd64|ia64)
manual_add_modules fan
manual_add_modules thermal
;;
esac
hooks/dmsetup 0000666 00000000730 15077204445 0007307 0 ustar 00 #!/bin/sh
case $1 in
prereqs)
echo "udev"
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
mkdir -p $DESTDIR/lib/udev/rules.d/
for rules in 55-dm.rules 60-persistent-storage-dm.rules; do
if [ -e /etc/udev/rules.d/$rules ]; then
cp -p /etc/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
elif [ -e /lib/udev/rules.d/$rules ]; then
cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
fi
done
copy_exec /sbin/dmsetup
manual_add_modules dm_mod
hooks/udev 0000666 00000003720 15077204445 0006573 0 ustar 00 #!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
root_over_the_network() {
if egrep -q '^/dev/(nbd|nd[a-z]|etherd/e)[^[:space:]]+[[:space:]]+/[[:space:]]' /etc/fstab; then
return 0
elif egrep -q '^[^[:space:]#]+[[:space:]]+/[[:space:]]+nfs[234]?[[:space:]]' /etc/fstab; then
return 0
fi
return 1 # false
}
. /usr/share/initramfs-tools/hook-functions
# udevd uses unix domain sockets for communication
force_load unix
copy_exec /sbin/udevd /sbin
copy_exec /sbin/udevadm /sbin
mkdir -p $DESTDIR/etc/udev
cp -p /etc/udev/udev.conf $DESTDIR/etc/udev/
mkdir -p $DESTDIR/lib/udev/rules.d/
for rules in 50-udev-default.rules 60-persistent-storage.rules \
80-drivers.rules 91-permissions.rules \
64-md-raid.rules 60-persistent-storage-lvm.rules \
55-dm.rules 60-persistent-storage-dm.rules; do
if [ -e /etc/udev/rules.d/$rules ]; then
cp -p /etc/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
elif [ -e /lib/udev/rules.d/$rules ]; then
cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
fi
done
# try to autodetect the value of this configuration option
if [ -z "$NEED_PERSISTENT_NET" ] && root_over_the_network; then
NEED_PERSISTENT_NET='yes'
fi
# Copy the rules for persistent network interface names for the benefit of
# systems which need to boot over the network. If this is enabled then the
# initramfs must be rebuilt every time a new network interface is added.
# See #414287 for details.
case "$NEED_PERSISTENT_NET" in
YES|yes|Yes|Y|y)
if [ -e /etc/udev/rules.d/70-persistent-net.rules ]; then
cp -p /etc/udev/rules.d/70-persistent-net.rules $DESTDIR/lib/udev/rules.d/
fi
;;
esac
cp /lib/udev/hotplug.functions $DESTDIR/lib/udev/
for program in firmware.agent ata_id edd_id path_id scsi_id usb_id; do
copy_exec /lib/udev/$program /lib/udev
done
copy_exec /sbin/blkid /sbin
if [ -x /lib/udev/vio_type ]; then
copy_exec /lib/udev/vio_type /lib/udev
fi
scripts/local 0000666 00000006020 15077204445 0007262 0 ustar 00 # Local filesystem mounting -*- shell-script -*-
pre_mountroot()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
run_scripts /scripts/local-top
[ "$quiet" != "y" ] && log_end_msg
wait_for_udev 10
# Load ubi with the correct MTD partition and return since fstype
# doesn't work with a char device like ubi.
if [ -n "$UBIMTD" ]; then
modprobe ubi mtd=$UBIMTD
return
fi
# Don't wait for a root device that doesn't have a corresponding
# device in /dev (ie, mtd0)
if [ "${ROOT#/dev}" = "${ROOT}" ]; then
return
fi
# If the root device hasn't shown up yet, give it a little while
# to deal with removable devices
if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then
log_begin_msg "Waiting for root file system"
# Default delay is 30s
slumber=${ROOTDELAY:-30}
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TIMEOUT ${slumber}" || true
fi
slumber=$(( ${slumber} * 10 ))
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
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
# 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 "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
}
mountroot()
{
pre_mountroot
# Get the root filesystem type if not set
if [ -z "${ROOTFSTYPE}" ]; then
FSTYPE=$(get_fstype "${ROOT}")
else
FSTYPE=${ROOTFSTYPE}
fi
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
run_scripts /scripts/local-premount
[ "$quiet" != "y" ] && log_end_msg
if [ "${readonly}" = "y" ]; then
roflag=-r
else
roflag=-w
fi
# FIXME This has no error checking
modprobe ${FSTYPE}
# FIXME This has no error checking
# Mount root
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
[ "$quiet" != "y" ] && log_end_msg
}
scripts/init-bottom/udev 0000666 00000001347 15077204445 0011407 0 ustar 00 #!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
# Stop udevd, we'll miss a few events while we run init, but we catch up
for proc in /proc/[0-9]*; do
[ -x $proc/exe ] || continue
if [ "$(readlink $proc/exe)" = /sbin/udevd ]; then
# errors must be ignored due to a race with udevd child processes
# naturally terminating
kill ${proc#/proc/} 2> /dev/null || true
fi
done
udev_root="/dev"
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
# move the /dev tmpfs to the rootfs
mount -n -o move /dev ${rootmnt}${udev_root}
# create a temporary symlink to the final /dev for other initramfs scripts
nuke /dev
ln -s ${rootmnt}${udev_root} /dev
scripts/functions 0000666 00000020001 15077204445 0010173 0 ustar 00 # -*- shell-script -*-
_log_msg()
{
if [ "$quiet" = "y" ]; then return; fi
printf "$@"
}
log_success_msg()
{
_log_msg "Success: $@\n"
}
log_failure_msg()
{
_log_msg "Failure: $@\n"
}
log_warning_msg()
{
_log_msg "Warning: $@\n"
}
log_begin_msg()
{
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TEXT $@"
fi
_log_msg "Begin: $@ ... "
}
log_end_msg()
{
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "SUCCESS ok"
fi
_log_msg "done.\n"
}
panic()
{
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "QUIT"
fi
if command -v chvt >/dev/null 2>&1; then
chvt 1
fi
# Disallow console access
if [ -n "${panic}" ]; then
sleep ${panic}
reboot
fi
modprobe i8042
modprobe atkbd
echo "$@"
REASON="$@" PS1='(initramfs) ' /bin/sh -i /dev/console 2>&1
}
maybe_break()
{
if [ "${break:-}" = "$1" ]; then
panic "Spawning shell within the initramfs"
fi
}
render()
{
eval "echo -n \${$@}"
}
set_initlist()
{
unset initlist
for si_x in ${initdir}/*; do
# skip empty dirs without warning
[ "${si_x}" = "${initdir}/*" ] && return
# only allow variable name chars
case ${si_x#${initdir}/} in
*[![:alnum:]\._-]*)
[ "${verbose}" = "y" ] \
&& echo "$si_x ignored: not alphanumeric or '_' file"
continue
;;
esac
# skip non executable scripts
if [ ! -x ${si_x} ]; then
[ "${verbose}" = "y" ] \
&& echo "$si_x ignored: not executable"
continue
fi
# skip directories
if [ -d ${si_x} ]; then
[ "${verbose}" = "y" ] \
&& echo "$si_x ignored: a directory"
continue
fi
# skip bad syntax
if ! sh -n ${si_x} ; then
[ "${verbose}" = "y" ] \
&& echo "$si_x ignored: bad syntax"
continue
fi
initlist="${initlist:-} ${si_x#${initdir}/}"
done
}
reduce_satisfied()
{
deplist="$(render array_${1})"
unset tmpdeplist
for rs_y in ${deplist}; do
# only allow variable name chars
case ${rs_y} in
*[![:alnum:]\._-]*)
continue
;;
esac
# skip non executable scripts
[ ! -x ${initdir}/${rs_y} ] && continue
# skip directories
[ -d ${initdir}/${rs_y} ] && continue
# skip bad syntax
sh -n ${initdir}/${rs_y} || continue
tmpdeplist="${tmpdeplist} ${rs_y}"
done
deplist=${tmpdeplist}
for rs_x in ${runlist}; do
pop_list_item ${rs_x} ${deplist}
deplist=${tmppop}
done
eval array_${1}=\"${deplist}\"
}
get_prereqs()
{
set_initlist
for gp_x in ${initlist}; do
tmp=$(${initdir}/${gp_x} prereqs)
eval array_${gp_x}=\"${tmp}\"
done
}
count_unsatisfied()
{
set -- ${@}
return ${#}
}
# Removes $1 from initlist
pop_list_item()
{
item=${1}
shift
set -- ${@}
unset tmppop
# Iterate
for pop in ${@}; do
if [ ${pop} = ${item} ]; then
continue
fi
tmppop="${tmppop} ${pop}"
done
}
# This function generates the runlist, so we clear it first.
reduce_prereqs()
{
unset runlist
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
panic "PANIC: Circular dependancy. Exiting."
fi
done
}
get_prereq_pairs()
{
set_initlist
for gp_x in ${initlist:-}; do
echo ${gp_x} ${gp_x}
prereqs=$(${initdir}/${gp_x} prereqs)
for prereq in ${prereqs}; do
echo ${prereq} ${gp_x}
done
done
}
call_scripts()
{
set -e
for cs_x in ${runlist}; do
[ -f ${initdir}/${cs_x} ] || continue
# mkinitramfs verbose output
if [ "${verbose}" = "y" ]; then
echo "Calling hook ${cs_x}"
fi
${initdir}/${cs_x} && ec=$? || ec=$?
# allow hooks to abort build:
if [ "$ec" -ne 0 ]; then
echo "E: ${initdir}/${cs_x} failed with return $ec."
# only errexit on mkinitramfs
[ -n "${version}" ] && exit $ec
fi
# allow boot scripts to modify exported boot parameters
if [ -e /conf/param.conf ]; then
. /conf/param.conf
fi
done
set +e
}
run_scripts()
{
initdir=${1}
[ ! -d ${initdir} ] && return
if [ -f ${initdir}/ORDER ]; then
. ${initdir}/ORDER
elif command -v tsort >/dev/null 2>&1; then
runlist=$(get_prereq_pairs | tsort)
call_scripts ${2:-}
else
get_prereqs
reduce_prereqs
call_scripts
fi
}
# Load custom modules first
load_modules()
{
if [ -e /conf/modules ]; then
cat /conf/modules | while read m; do
# 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 $m
done
fi
}
# lilo compatibility
parse_numeric() {
case $1 in
"")
return
;;
/*)
return
;;
[0-9]*:[0-9]*)
minor=${1#*:}
major=${1%:*}
;;
[A-Fa-f0-9]*)
value=$(( 0x${1} ))
minor=$(( ${value} % 256 ))
major=$(( ${value} / 256 ))
;;
*)
return
;;
esac
mknod -m 600 /dev/root b ${major} ${minor}
ROOT=/dev/root
}
# Parameter: device node to check
# Echos fstype to stdout
# Return value: indicates if an fs could be recognized
get_fstype ()
{
local FS FSTYPE FSSIZE RET
FS="${1}"
# blkid has a more complete list of file systems,
# but fstype is more robust
eval $(fstype "${FS}" 2> /dev/null)
if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then
FSTYPE=$(blkid -o value -s TYPE "${FS}")
elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then
FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null)
fi
RET=$?
if [ -z "${FSTYPE}" ]; then
FSTYPE="unknown"
fi
echo "${FSTYPE}"
return ${RET}
}
configure_networking()
{
if [ -n "${BOOTIF}" ]; then
# pxelinux sets BOOTIF to a value based on the mac address of the
# network card used to PXE boot, so use this value for DEVICE rather
# than a hard-coded device name from initramfs.conf. this facilitates
# network booting when machines may have multiple network cards.
# pxelinux sets BOOTIF to 01-$mac_address
# strip off the leading "01-", which isn't part of the mac
# address
temp_mac=${BOOTIF#*-}
# convert to typical mac address format by replacing "-" with ":"
bootif_mac=""
IFS='-'
for x in $temp_mac ; do
if [ -z "$bootif_mac" ]; then
bootif_mac="$x"
else
bootif_mac="$bootif_mac:$x"
fi
done
unset IFS
# look for devices with matching mac address, and set DEVICE to
# appropriate value if match is found.
for device in /sys/class/net/* ; do
if [ -f "$device/address" ]; then
current_mac=$(cat "$device/address")
if [ "$bootif_mac" = "$current_mac" ]; then
DEVICE=${device##*/}
break
fi
fi
done
fi
# networking already configured thus bail out
[ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0
# support ip options see linux sources
# Documentation/filesystems/nfsroot.txt
# Documentation/frv/booting.txt
for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
# The NIC is to be configured if this file does not exist.
# Ip-Config tries to create this file and when it succeds
# creating the file, ipconfig is not run again.
for x in /tmp/net-"${DEVICE}".conf /tmp/net-*.conf ; do
[ -e "$x" ] && break 2
done
case ${IP} in
none|off)
# Do nothing
;;
""|on|any)
# Bring up device
ipconfig -t ${ROUNDTTT} "${DEVICE}"
;;
dhcp|bootp|rarp|both)
ipconfig -t ${ROUNDTTT} -c ${IP} -d "${DEVICE}"
;;
*)
ipconfig -t ${ROUNDTTT} -d $IP
# grab device entry from ip option
NEW_DEVICE=${IP#*:*:*:*:*:*}
if [ "${NEW_DEVICE}" != "${IP}" ]; then
NEW_DEVICE=${NEW_DEVICE%:*}
else
# wrong parse, possibly only a partial string
NEW_DEVICE=
fi
if [ -n "${NEW_DEVICE}" ]; then
DEVICE="${NEW_DEVICE}"
fi
;;
esac
done
# source ipconfig output
if [ -n "${DEVICE}" ]; then
# source specific bootdevice
. /tmp/net-${DEVICE}.conf
else
# source any interface...
# ipconfig should have quit after first response
. /tmp/net-*.conf
fi
}
# Wait for queued kernel/udev events
wait_for_udev()
{
command -v udevadm >/dev/null 2>&1 || return 0
udevadm settle ${1:+--timeout=$1}
}
scripts/nfs 0000666 00000003362 15077204445 0006764 0 ustar 00 # NFS filesystem mounting -*- shell-script -*-
# FIXME This needs error checking
retry_nr=0
# parse nfs bootargs and mount nfs
do_nfsmount()
{
configure_networking
# get nfs root from dhcp
if [ "x${NFSROOT}" = "xauto" ]; then
# check if server ip is part of dhcp root-path
if [ "${ROOTPATH#*:}" = "${ROOTPATH}" ]; then
NFSROOT=${ROOTSERVER}:${ROOTPATH}
else
NFSROOT=${ROOTPATH}
fi
# nfsroot=[:][,]
elif [ -n "${NFSROOT}" ]; then
# nfs options are an optional arg
if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then
NFSOPTS="-o ${NFSROOT#*,}"
fi
NFSROOT=${NFSROOT%%,*}
if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
NFSROOT=${ROOTSERVER}:${NFSROOT}
fi
fi
if [ -z "${NFSOPTS}" ]; then
NFSOPTS="-o retrans=10"
fi
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount"
run_scripts /scripts/nfs-premount
[ "$quiet" != "y" ] && log_end_msg
if [ ${readonly} = y ]; then
roflag="-o ro"
else
roflag="-o rw"
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 nfs
# For DHCP
modprobe af_packet
wait_for_udev 10
# Default delay is around 180s
delay=${ROOTDELAY:-180}
# loop until nfsmount succeeds
do_nfsmount
while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
/bin/sleep 1
do_nfsmount
retry_nr=$(( ${retry_nr} + 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
}
scripts/local-premount/resume 0000666 00000002021 15077204445 0012426 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
if [ -z "${resume}" ]; then
exit 0
fi
case $resume in
LABEL=*)
resume="${resume#LABEL=}"
# support any / in LABEL= path (escape to \x2f)
case "${resume}" in
*/*)
if command -v sed >/dev/null 2>&1; then
resume="$(echo ${resume} | sed 's,/,\\x2f,g')"
else
if [ "${resume}" != "${resume#/}" ]; then
resume="\x2f${resume#/}"
fi
if [ "${resume}" != "${resume%/}" ]; then
resume="${resume%/}\x2f"
fi
IFS='/'
newresume=
for s in $resume; do
newresume="${newresume:+${newresume}\\x2f}${s}"
done
unset IFS
resume="${newresume}"
fi
esac
resume="/dev/disk/by-label/${resume}"
;;
UUID=*)
resume="/dev/disk/by-uuid/${resume#UUID=}"
;;
esac
[ ! -e "${resume}" ] && exit 0
[ ! -e /sys/power/resume ] && exit 0
# hardcode path, uswsusp ships an resume binary too
if [ -n "${resume_offset}" ]; then
/bin/resume ${resume} ${resume_offset}
else
/bin/resume ${resume}
fi
scripts/init-top/keymap 0000666 00000000546 15077204445 0011230 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
OPTS="-q"
# Should terminal be in UTF8 mode?
if [ -x /bin/kbd_mode ]; then
/bin/kbd_mode -u
OPTS="${OPTS} -u"
fi
# Load custom keymap
if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then
loadkeys ${OPTS} /etc/boottime.kmap.gz
fi
scripts/init-top/blacklist 0000666 00000000447 15077204445 0011712 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# sanity check
[ -z "${blacklist}" ] && exit 0
# write blacklist to modprobe.d
IFS=','
for b in ${blacklist}; do
echo "blacklist $b" >> /etc/modprobe.d/initramfs.conf
done
scripts/init-top/all_generic_ide 0000666 00000000537 15077204445 0013027 0 ustar 00 #!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
for x in $(cat /proc/cmdline); do
case ${x} in
all_generic_ide)
modprobe ata_generic all_generic_ide=1
;;
all_generic_ide=*)
if [ ${x#all_generic_ide=} ]; then
modprobe ata_generic all_generic_ide=1
fi
;;
esac
done
scripts/init-top/udev 0000666 00000001436 15077204445 0010704 0 ustar 00 #!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
echo > /sys/kernel/uevent_helper
UDEV_ROOT=/dev \
udevd --daemon --resolve-names=never
udevadm trigger --action=add
udevadm settle || true
if [ -d /sys/bus/scsi ]; then
modprobe -q scsi_wait_scan && modprobe -r scsi_wait_scan || true
udevadm settle || true
fi
# If the rootdelay parameter has been set, we wait a bit for devices
# like usb/firewire disks to settle.
if [ "$ROOTDELAY" ]; then
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TIMEOUT $(($ROOTDELAY + 5))"
fi
sleep $ROOTDELAY
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TIMEOUT 15"
fi
fi
# Leave udev running to process events that come in out-of-band (like USB
# connections)
hook-functions 0000666 00000035570 15077204445 0007463 0 ustar 00 # -*- shell-script -*-
catenate_cpiogz() {
# Sanity check
if [ ! -e "${1}" ]; then
echo "W: catenate_cpiogz: arg1='${1}' does not exist." >&2
return
fi
cat "${1}" >>"${__TMPCPIOGZ}"
}
force_load()
{
manual_add_modules ${@}
echo "${@}" >>"${DESTDIR}/conf/modules"
}
# Takes a file containing a list of modules to be added as an
# argument, figures out dependancies, and adds them.
#
# Input file syntax:
#
# # comment
# modprobe_module_name [args ...]
# [...]
#
add_modules_from_file()
{
# Sanity check
if [ ! -e "${1}" ]; then
echo "W: add_modules_from_file: arg1='${1}' does not exist." >&2
return
fi
grep '^[^#]' ${1} | while read module args; do
[ -n "$module" ] || continue
force_load "${module}" "${args}"
done
}
# Add dependent modules + eventual firmware
manual_add_modules()
{
local kmod firmware
for kmod in $(modprobe --set-version="${version}" --ignore-install \
--quiet --show-depends "${1}" | awk '/^insmod/ { print $2 }'); do
# Prune duplicates
if [ -e "${DESTDIR}/${kmod}" ]; then
continue
fi
mkdir -p "${DESTDIR}/$(dirname "${kmod}")"
ln -s "${kmod}" "${DESTDIR}/$(dirname "${kmod}")"
if [ "${verbose}" = "y" ]; then
echo "Adding module ${kmod}"
fi
# Add required firmware
for firmware in $(modinfo -F firmware "${kmod}"); do
if [ -e "${DESTDIR}/lib/firmware/${firmware}" ] \
|| [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ]; then
continue
fi
# Only print warning for missing fw of loaded module
# or forced loaded module
if [ ! -e "/lib/firmware/${firmware}" ] \
&& [ ! -e "/lib/firmware/${version}/${firmware}" ] ; then
# Only warn about missing firmware if
# /proc/modules exists
if [ ! -e /proc/modules ] ; then
continue
fi
if grep -q "^$(basename "${kmod}" .ko)[[:space:]]" \
/proc/modules \
|| grep -q "^$(basename "${kmod}" .ko)" \
"${CONFDIR}/modules"; then
echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${kmod} .ko)" >&2
fi
continue
fi
if [ ! -e "${DESTDIR}/lib/udev/firmware.agent" ] \
&& [ -e "/lib/udev/firmware.agent" ]; then
copy_exec /lib/udev/firmware.agent
fi
if [ -e "/lib/firmware/${version}/${firmware}" ]; then
copy_exec "/lib/firmware/${version}/${firmware}"
else
copy_exec "/lib/firmware/${firmware}"
fi
if [ "${verbose}" = "y" ]; then
echo "Adding firmware ${firmware}"
fi
done
done
}
# $1 = file to copy to ramdisk
# $2 (optional) Name for the file on the ramdisk
# Location of the image dir is assumed to be $DESTDIR
# We never overwrite the target if it exists.
copy_exec() {
local src target x nonoptlib
local libname dirname
src="${1}"
target="${2:-$1}"
[ -f "${src}" ] || return 1
if [ -d "${DESTDIR}/${target}" ]; then
# check if already copied
[ -e "${DESTDIR}/$target/${src##*/}" ] && return 0
else
[ -e "${DESTDIR}/$target" ] && return 0
#FIXME: inst_dir
mkdir -p "${DESTDIR}/${target%/*}"
fi
[ "${verbose}" = "y" ] && echo "Adding binary ${src}"
ln -s "${src}" "${DESTDIR}/${target}"
# Copy the dependant libraries
for x in $(ldd ${src} 2>/dev/null | sed -e '
/\//!d;
/linux-gate/d;
/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};
s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' 2>/dev/null); do
# Try to use non-optimised libraries where possible.
# We assume that all HWCAP libraries will be in tls,
# sse2, vfp or neon.
nonoptlib=$(echo "${x}" | sed -e 's#/lib/\(tls\|i686\|sse2\|neon\|vfp\).*/\(lib.*\)#/lib/\2#')
if [ -e "${nonoptlib}" ]; then
x="${nonoptlib}"
fi
libname=$(basename "${x}")
dirname=$(dirname "${x}")
# FIXME inst_lib
mkdir -p "${DESTDIR}/${dirname}"
if [ ! -e "${DESTDIR}/${dirname}/${libname}" ]; then
ln -s "${x}" "${DESTDIR}/${dirname}"
[ "${verbose}" = "y" ] && echo "Adding library ${x}" || true
fi
done
}
# Copy entire subtrees to the initramfs
copy_modules_dir()
{
local kmod exclude
local dir="$1"
shift
if ! [ -d "${MODULESDIR}/${dir}" ]; then
return;
fi
if [ "${verbose}" = "y" ]; then
echo "Copying module directory ${dir}"
if [ $# -ge 1 ]; then
echo "(excluding $*)"
fi
fi
while [ $# -ge 1 ]; do
exclude="${exclude:-} -name $1 -prune -o "
shift
done
for kmod in $(find "${MODULESDIR}/${dir}" ${exclude:-} -name '*.ko' -print); do
manual_add_modules $(basename ${kmod} .ko)
done
}
# walk /sys for relevant modules
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)"
if [ -e "$driver_path" ]; then
module="$(basename $(readlink -f $driver_path))"
if [ -n "${module}" ]; then
force_load "${module}"
fi
fi
device_path="$(dirname ${device_path})"
done
}
# walk /sys for relevant modalias
sys_walk_modalias()
{
local device_path modalias
device_path="$(dirname "${1}")"
device_path="$(dirname "${device_path}")"
if [ -e "${device_path}/modalias" ]; then
modalias=$(cat "${device_path}/modalias")
fi
if [ -n "${modalias}" ]; then
force_load "${modalias}"
fi
}
# find and only copy root relevant modules
dep_add_modules()
{
local block minor root FSTYPE root_dev_path x
# require mounted sysfs
if [ ! -d /sys/devices/ ]; then
echo "mkinitramfs: MODULES dep requires mounted sysfs on /sys" >&2
exit 1
fi
# findout root block device + fstype
eval "$(mount | awk '/\/dev\// {if ($3 == "/") {print "root=" $1 "\nFSTYPE=" $5; exit}}')"
# On failure fallback to /proc/mounts if readable
if [ -z "$root" ] && [ -r /proc/mounts ]; then
eval "$(awk '!/^rootfs / {if ($2 == "/") {print "root=" $1 "\nFSTYPE=" $3; exit}}' /proc/mounts)"
fi
# recheck root device
if [ -z "$root" ]; then
echo "mkinitramfs: failed to determine root device" >&2
echo "mkinitramfs: workaround is MODULES=most" >&2
echo "Error please report bug on initramfs-tools" >&2
echo "Include the output of 'mount' and 'cat /proc/mounts'" >&2
exit 1
fi
# handle ubifs and return since ubifs root is a char device but
# most of the commands below only work with block devices.
if [ "${FSTYPE}" = "ubifs" ]; then
manual_add_modules "${FSTYPE}"
# add some modules required by ubifs on which it doesn's depend
manual_add_modules deflate
manual_add_modules zlib
manual_add_modules lzo
return
fi
if [ "${root}" = "/dev/root" ] ; then
root="/dev/disk/by-uuid/"$(blkid -o value -s UUID ${root}) 2>/dev/null
fi
root="$(readlink -f ${root})"
# do not trust mount, check superblock
eval "$(/usr/lib/klibc/bin/fstype ${root})"
# check that fstype rootfs recognition
if [ "${FSTYPE}" = "unknown" ]; then
FSTYPE=$(blkid -o value -s TYPE "${root}")
if [ -z "${FSTYPE}" ]; then
echo "mkinitramfs: unknown fstype on root ${root}" >&2
echo "mkinitramfs: workaround is MODULES=most" >&2
echo "Error please report bug on initramfs-tools" >&2
exit 1
fi
fi
# Add rootfs
manual_add_modules "${FSTYPE}"
# lvm or luks root
if [ "${root#/dev/mapper/}" != "${root}" ] \
|| [ "${root#/dev/dm-}" != "${root}" ]; then
minor=$((0x$(stat --format "%T" ${root}) % 256))
block=$(ls -1 /sys/block/dm-${minor}/slaves | head -n 1)
# lvm on luks or luks on lvm, possibly lvm snapshots
while [ "${block#dm-}" != "${block}" ]; do
block=$(ls -1 /sys/block/${block}/slaves | head -n 1)
done
# lvm on md or luks on md
if [ "${block#md}" != "${block}" ]; then
block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^'${block}' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p' &2
echo "mkinitramfs: workaround is MODULES=most" >&2
echo "mkinitramfs: Error please report the bug" >&2
exit 1
fi
# sys walk ATA
root_dev_path=$(readlink -f /sys/block/${block}/device)
sys_walk_mod_add ${root_dev_path}
# catch old-style IDE
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/ide" ]; then
sys_walk_modalias ${root_dev_path}
manual_add_modules ide-gd_mod
# FIXME: remove post Squeeze
manual_add_modules ide-disk
manual_add_modules ide-cd
fi
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi" ]; then
manual_add_modules sd_mod
fi
if [ -e /sys/bus/mmc/devices/ ]; then
manual_add_modules mmc_block
fi
if [ -e /sys/bus/virtio ] ; then
manual_add_modules virtio_pci
fi
if [ -e /sys/bus/i2o/devices/ ]; then
force_load i2o_block
force_load i2o_config
fi
if [ -e /sys/bus/ps3_system_bus/ ]; then
for x in ps3disk ps3rom ps3-gelic ps3_sys_manager; do
manual_add_modules "${x}"
done
fi
if [ -e /sys/bus/vio/ ]; then
for x in sunvnet sunvdc; do
manual_add_modules "${x}"
done
fi
}
# The modules "most" classes added per default to the initramfs
auto_add_modules()
{
case "${1:-}" in
base)
for x in ehci-hcd ohci-hcd uhci-hcd usbhid xhci hid-apple \
hid-cherry hid-logitech hid-microsoft \
btrfs ext2 ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs \
af_packet atkbd i8042 virtio_pci; do
manual_add_modules "${x}"
done
;;
net)
copy_modules_dir kernel/drivers/net \
appletalk arcnet bonding can hamradio irda pcmcia \
tokenring usb wan wimax wireless
;;
ide)
copy_modules_dir kernel/drivers/ide
;;
mmc)
copy_modules_dir kernel/drivers/mmc
;;
scsi)
copy_modules_dir kernel/drivers/scsi
for x in mptfc mptsas mptscsih mptspi zfcp; do
manual_add_modules "${x}"
done
;;
ata)
copy_modules_dir kernel/drivers/ata
;;
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}"
done
;;
firewire)
for x in firewire-ohci firewire-sbp2; do
manual_add_modules "${x}"
done
;;
i2o)
for x in i2o_block; do
manual_add_modules "${x}"
done
;;
dasd)
for x in dasd_diag_mod dasd_eckd_mod dasd_fba_mod; do
manual_add_modules "${x}"
done
;;
usb_storage)
copy_modules_dir kernel/drivers/usb/storage
;;
*)
auto_add_modules base
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
auto_add_modules ieee1394
auto_add_modules firewire
auto_add_modules mmc
auto_add_modules usb_storage
;;
esac
}
# 'depmod' only looks at symbol dependencies; there is no way for
# modules to declare explicit dependencies through module information,
# so dependencies on e.g. crypto providers are hidden. Until this is
# fixed, we need to handle those hidden dependencies.
hidden_dep_add_modules()
{
for dep in "lib/libcrc32c crc32c"; do
set -- $dep
if [ -f "${DESTDIR}/lib/modules/${version}/kernel/$1.ko" ]; then
manual_add_modules "$2"
fi
done
}
# mkinitramfs help message
usage()
{
cat >&2 << EOF
Usage: ${0} [OPTION]... -o outfile [version]
Options:
-c compress Override COMPRESS setting in initramfs.conf.
-d confdir Specify an alternative configuration directory.
-k Keep temporary directory used to make the image.
-o outfile Write to outfile.
-r root Override ROOT setting in initramfs.conf.
See mkinitramfs(8) for further details.
EOF
exit 1
}
# cache boot scripts order
cache_run_scripts()
{
DESTDIR=${1}
scriptdir=${2}
initdir=${DESTDIR}${scriptdir}
[ ! -d ${initdir} ] && return
runlist=$(get_prereq_pairs | tsort)
for crs_x in ${runlist}; do
[ -f ${initdir}/${crs_x} ] || continue
echo "${scriptdir}/${crs_x}" >> ${initdir}/ORDER
echo "[ -e /conf/param.conf ] && . /conf/param.conf" >> ${initdir}/ORDER
done
}
# minimal supported kernel version
check_minkver()
{
local curversion initdir DPKG_ARCH minversion cm_x tmp
curversion="${1:-}"
initdir="${2:-}"
if [ -z "${initdir}" ]; then
case ${DPKG_ARCH:-} in
ia64|hppa)
minversion="2.6.15"
;;
*)
minversion="2.6.12"
;;
esac
if dpkg --compare-versions "${curversion}" lt "${minversion}"; then
echo "W: kernel ${curversion} too old for initramfs on ${DPKG_ARCH}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2
fi
return 0
fi
set_initlist
for cm_x in ${initlist:-}; do
# sed: keep last line starting with MINKVER=,
# remove MINKVER= and trailing space
minver=$(sed '/^MINKVER=/!d;$!d;s/^MINKVER=//;s/[[:space:]]*$//' "${initdir}/${cm_x}")
if [ -z "${tmp:-}" ]; then
continue
elif dpkg --compare-versions "${curversion}" lt "${minver}"; then
echo "W: ${cm_x} hook script requires at least kernel version ${minver}" >&2
echo "W: not generating requested initramfs for kernel ${curversion}" >&2
exit 2
fi
done
}
etc/kernel/postrm.d/initramfs-tools 0000666 00000001067 15077260634 0013444 0 ustar 00 #!/bin/sh
version="$1"
bootopt=""
# passing the kernel version is required
[ -z "${version}" ] && exit 0
# kernel-package passes an extra arg
if [ -n "$2" ]; then
if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
bootdir=$(dirname "$2")
bootopt="-b ${bootdir}"
else
# official linux-images take care themself
exit 0
fi
fi
# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
eval set -- "$DEB_MAINT_PARAMS"
if [ -z "$1" ] || [ "$1" != "remove" ]; then
exit 0
fi
fi
# delete initramfs
update-initramfs -d -t -k "${version}" ${bootopt} >&2