initramfs-tools: update to 0.99.111.

- Removed NFS/network boot, it never worked anyway.
- Removed support for booting from UBIFS and exotic platforms.
- Create busybox links at initramfs creation time.
- Panic if mounting devtmpfs fails, udev requires this now.
- Mount devpts filesystem once udev has been started.
- Move all mounted filesystemd to the real root before switching root.
This commit is contained in:
Juan RP 2012-01-13 15:10:43 +01:00
parent e8be9f5d62
commit a7d67a2b5a
11 changed files with 26 additions and 364 deletions

View file

@ -6,14 +6,12 @@
# by config files in the /etc/initramfs-tools/conf.d directory.
#
# MODULES: [ most | netboot | dep | list ]
# MODULES: [ most | 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
#
@ -32,33 +30,3 @@ KEYMAP=n
#
COMPRESS=xz
#
# 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

View file

@ -243,13 +243,6 @@ dep_add_modules()
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}"
return
fi
if [ "${root}" = "/dev/root" ] ; then
root="/dev/disk/by-uuid/"$(blkid -o value -s UUID ${root}) 2>/dev/null
fi
@ -337,15 +330,6 @@ dep_add_modules()
block=${root#/dev/}
block=${block%%p[0-9]*}
# DAC960 - good old mylex raid - root dev format /dev/rd/cXdXpX
elif [ "${root#/dev/rd/c}" != "${root}" ]; then
block="rd!c${root#/dev/rd/c}"
block=${block%%p[0-9]*}
# etherd device
elif [ "${root#/dev/etherd/}" != "${root}" ]; then
block=${root#/dev/etherd/*}
block="etherd!${block%p*}"
# classical root device
else
block=${root#/dev/}
@ -387,18 +371,6 @@ dep_add_modules()
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
}
@ -409,16 +381,11 @@ auto_add_modules()
base)
for x in ehci-hcd ohci-hcd uhci-hcd usbhid xhci xhci-hcd \
hid-apple hid-cherry hid-logitech hid-microsoft hid-sunplus \
btrfs ext2 ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs \
btrfs ext2 ext3 ext4 ext4dev isofs jfs 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
;;
@ -437,11 +404,6 @@ 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}"
@ -467,7 +429,6 @@ auto_add_modules()
;;
*)
auto_add_modules base
auto_add_modules net
auto_add_modules ide
auto_add_modules scsi
auto_add_modules block
@ -488,7 +449,7 @@ auto_add_modules()
# fixed, we need to handle those hidden dependencies.
hidden_dep_add_modules()
{
for dep in "lib/libcrc32c crc32c" "fs/ubifs/ubifs deflate zlib lzo"; do
for dep in "lib/libcrc32c crc32c" "deflate zlib lzo"; do
set -- $dep
if [ -f "${DESTDIR}/lib/modules/${version}/kernel/$1.ko" ]; then
shift

View file

@ -17,5 +17,10 @@ esac
. ${ROOTDIR}/usr/share/initramfs-tools/hook-functions
copy_exec ${ROOTDIR}/bin/busybox
# Create required busybox symlinks
for f in $(/bin/busybox --list); do
[ "$f" = "modprobe" ] && continue
ln -sf /bin/busybox ${DESTDIR}/bin/${f}
done
exit 0

View file

@ -2,12 +2,6 @@
echo "Starting up the initramfs, please wait..."
# Create required busybox symlinks
for f in $(/bin/busybox --list); do
[ "$f" = "modprobe" ] && continue
/bin/busybox ln -s /bin/busybox /bin/${f}
done
[ -d /run ] || mkdir -m 0755 /run
[ -d /dev ] || mkdir -m 0755 -p /dev/pts
[ -d /root ] || mkdir -m 0700 /root
@ -22,15 +16,9 @@ mount -t proc -o nodev,noexec,nosuid proc /proc
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
tmpfs_size="10M"
# Mount devtmpfs for /dev, fallback to tmpfs if not supported.
if ! mount -t devtmpfs -o size=$tmpfs_size,mode=0755 devtmpfs /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
# Mount devpts to make plymouth happy
mount -t devpts devpts /dev/pts
if ! mount -t devtmpfs -o size=10M,mode=0755 devtmpfs /dev; then
panic "Failed to mount devtmpfs on /dev!"
fi
# Also mount a tmpfs for /run directory.
mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
@ -46,10 +34,7 @@ export ROOT=
export ROOTDELAY=
export ROOTFLAGS=
export ROOTFSTYPE=
export IP=
export BOOT=
export BOOTIF=
export UBIMTD=
export BOOT=local
export break=
export init=/sbin/init
export quiet=n
@ -106,9 +91,6 @@ for x in $(cat /proc/cmdline); do
UUID=*)
ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
;;
/dev/nfs)
[ -z "${BOOT}" ] && BOOT=nfs
;;
esac
;;
rootflags=*)
@ -125,18 +107,9 @@ for x in $(cat /proc/cmdline); do
;;
esac
;;
nfsroot=*)
NFSROOT="${x#nfsroot=}"
;;
ip=*)
IP="${x#ip=}"
;;
boot=*)
BOOT=${x#boot=}
;;
ubi.mtd=*)
UBIMTD=${x#ubi.mtd=}
;;
resume=*)
RESUME="${x#resume=}"
;;
@ -183,12 +156,6 @@ for x in $(cat /proc/cmdline); do
blacklist=*)
blacklist=${x#blacklist=}
;;
netconsole=*)
netconsole=${x#netconsole=}
;;
BOOTIF=*)
BOOTIF=${x#BOOTIF=}
;;
esac
done
@ -199,13 +166,15 @@ else
resume=${RESUME:-}
fi
[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
maybe_break top
log_begin_msg "Running /scripts/init-top"
run_scripts /scripts/init-top
log_end_msg
# Mount devpts to make plymouth happy
[ -d /dev/pts ] || mkdir -m0755 /dev/pts
mount -t devpts devpts /dev/pts
maybe_break modules
log_begin_msg "Loading essential drivers"
load_modules
@ -285,10 +254,7 @@ unset ROOTFLAGS
unset ROOTFSTYPE
unset ROOTDELAY
unset ROOT
unset IP
unset BOOT
unset BOOTIF
unset UBIMTD
unset blacklist
unset break
unset noresume
@ -298,10 +264,11 @@ unset readonly
unset resume
unset resume_offset
# Umount misc filesystems, they will be mounted by the init scripts.
umount /sys
umount /proc
# move mounted filesystems to real root.
[ -d ${rootmnt}/dev/pts ] || mkdir -m0755 -p ${rootmnt}/dev/pts
[ -d /dev/pts ] && mount -o move /dev/pts ${rootmnt}/dev/pts
mount -o move /sys ${rootmnt}/sys
mount -o move /proc ${rootmnt}/proc
mount -o move /run ${rootmnt}/run
# Chain to real filesystem

View file

@ -1,4 +1,4 @@
.TH INITRAMFS-TOOLS 8 "2010/09/23" "Linux" "mkinitramfs script overview"
.TH INITRAMFS-TOOLS 8 "2012/01/13" "Linux" "mkinitramfs script overview"
.SH NAME
initramfs-tools \- an introduction to writing scripts for mkinitramfs
@ -41,29 +41,6 @@ The default is 180 seconds.
\fB\fI rootflags
set the file system mount option string.
.TP
\fB\fI nfsroot
can be either "auto" to try to get the relevant information from DHCP or a
string of the form NFSSERVER:NFSPATH or NFSSERVER:NFSPATH:NFSOPTS.
Use root=/dev/nfs for NFS to kick to in. NFSOPTS can be looked up in
\fInfs(5)\fP.
.TP
\fB\fI ip
tells how to configure the ip address. Allows one to specify an different
NFS server than the DHCP server. See Documentation/filesystems/nfsroot.txt
in any recent Linux source for details. Optional parameter for NFS root.
.TP
\fB\fI BOOTIF
is a mac address in pxelinux format with leading "01-" and "-" as separations.
pxelinux passes mac address of network card used to PXE boot on with this
bootarg.
.TP
\fB\fI boot
either local or NFS (affects which initramfs scripts are run, see the "Subdirectories" section under boot scripts).
.TP
\fB\fI resume
On install initramfs-tools tries to autodetect the resume partition. On success
@ -112,10 +89,6 @@ The default is premount without any arg.
Beware that if both "panic" and "break" are present,
initramfs will not spawn any shells but reboot instead.
.TP
\fB\fI netconsole
loads netconsole linux modules with the chosen args.
.TP
\fB\fI all_generic_ide
loads generic IDE/ATA chipset support on boot.
@ -505,9 +478,6 @@ Otherwise keep it alone.
\fB\fI ROOTDELAY, ROOTFLAGS, ROOTFSTYPE, IP
corresponds to the rootdelay, rootflags, rootfstype or ip boot option.
.TP
\fB\fI DPKG_ARCH
allows arch specific boot actions.
.TP
\fB\fI blacklist, panic, quiet, resume, noresume, resume_offset
set according relevant boot option.
.TP

View file

@ -1,4 +1,4 @@
.TH INITRAMFS.CONF 5 "2011/07/22" "Linux" "initramfs.conf manual"
.TH INITRAMFS.CONF 5 "2012/01/13" "Linux" "initramfs.conf manual"
.SH NAME
initramfs.conf \- configuration file for mkinitramfs
@ -36,9 +36,6 @@ listed in the above files.
\fIdep\fP tries to guess which modules are necessary for the running box and
only adds those modules.
\fInetboot\fP adds the base and network modules, but skips block devices.
The default setting is \fImost\fP.
.TP
@ -60,27 +57,6 @@ corresponding userspace utility is not present.
Set the umask value of the generated initramfs file.
Useful to not disclose eventual keys.
.SH NFS VARIABLES
.TP
\fB BOOT
Allows one to use an nfs drive as the root of the drive.
The default is to boot from \fIlocal\fP media (hard drive, USB stick).
Set to \fInfs\fP for an NFS root share.
.TP
\fB DEVICE
Specifies the network interface, like eth0.
.TP
\fB ROOT
Allows optional root bootarg hardcoding, when no root bootarg can be passed.
A root bootarg overrides that special setting.
.TP
\fB NFSROOT
Defaults to \fIauto\fP in order to pick up value from DHCP server.
Otherwise you need to specify \fIHOST:MOUNT\fP.
.SH FILES
.TP
.I /etc/initramfs-tools/initramfs.conf

View file

@ -218,10 +218,6 @@ dep)
most)
auto_add_modules
;;
netboot)
auto_add_modules base
auto_add_modules net
;;
list)
# nothing to add
;;

View file

@ -280,100 +280,6 @@ get_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()
{

View file

@ -8,13 +8,6 @@ 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

View file

@ -1,80 +0,0 @@
# 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=[<server-ip>:]<root-dir>[,<nfs-options>]
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
}

View file

@ -1,6 +1,6 @@
# Template file for 'initramfs-tools'
pkgname=initramfs-tools
_localver=110 # This is the XBPS version
_localver=111 # This is the XBPS version
_distver=0.99 # This should match debian version
version=${_distver}.${_localver}
short_desc="Tools for generating an initramfs"
@ -12,8 +12,8 @@ long_desc="
Linux kernel. The initramfs is a gzipped cpio archive. At boot time, the
kernel unpacks that archive into RAM, mounts and uses it as initial root
file system. The mounting of the real root file system occurs in early user
space. 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."
space. Any boot loader with initrd support is able to load an
initramfs archive."
noextract=yes
noarch=yes
@ -61,7 +61,7 @@ do_install()
# Data
vinstall $FILESDIR/init 744 usr/share/$pkgname
for f in functions local nfs; do
for f in functions local; do
vinstall $FILESDIR/scripts/$f 644 usr/share/$pkgname/scripts
done
vmkdir usr/share/$pkgname/scripts/init-top