SVN: geninitrd/trunk: geninitrd geninitrd.8.xml geninitrd.sysconfig
czarny
czarny at pld-linux.org
Thu Dec 14 17:03:13 CET 2006
Author: czarny
Date: Thu Dec 14 17:03:12 2006
New Revision: 8103
Modified:
geninitrd/trunk/geninitrd
geninitrd/trunk/geninitrd.8.xml
geninitrd/trunk/geninitrd.sysconfig
Log:
- merged from branches/devel
- tweaked geninitrd.sysconfig for default options
- some documentation added
Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd (original)
+++ geninitrd/trunk/geninitrd Thu Dec 14 17:03:12 2006
@@ -5,6 +5,13 @@
# by PLD Linux Team
#
# based on mkinitrd from RedHat
+#
+# TODO:
+# - make udev start before insomds
+# - make proper use of USE_UDEV - don't copy fules if USE_UDEV is off no!
+# - sanitize - one mounting of /proc and /sys at the begining and one umount at the end!
+# - chekup and test and ready to go!
+#
RCSID='$Id$'
PATH=/sbin:$PATH
@@ -41,6 +48,11 @@
rootdev_nr=0
# default bootsplash is off, if it have to be on, install bootsplash package
BOOT_SPLASH=no
+# default same as bootsplash, if on install splashutils and some splashutils theme
+FB_SPLASH=no
+# defualt we don't use udev to make nodes for static modules, as per default
+# PLD loads the modules needed to mount and boot
+PROBESTATICMODULES=no
# is /dev on tmpfs. internal variable
tmpfs_dev=
@@ -59,7 +71,8 @@
echo " [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
echo " [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]"
echo " [--with-raidstart] [--without-raidstart] [--with-insmod-static]"
- echo " [--without-bootsplash] [--lvmtoolsversion=1|2] [--with-udev] [--without-udev]"
+ echo " [--without-bootsplash] [--without-fbsplash]"
+ echo " [--lvmtoolsversion=1|2] [--with-udev] [--without-udev]"
echo " [--without-suspend] [--without-suspend2] [--without-dmraid]"
echo " <initrd-image> <kernel-version>"
echo " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)"
@@ -781,6 +794,10 @@
. /etc/sysconfig/bootsplash
fi
+if [ -r /etc/sysconfig/fbsplash ] ; then
+ . /etc/sysconfig/fbsplash
+fi
+
if [ ! -x /bin/initrd-busybox ] ; then
echo "/bin/initrd-busybox is missing !"
exit 1
@@ -817,6 +834,9 @@
--without-bootsplash)
BOOT_SPLASH="no"
;;
+ --without-fbsplash)
+ FB_SPLASH="no"
+ ;;
--without-suspend)
USE_SUSPEND="no";
;;
@@ -915,8 +935,7 @@
if [ "x" = "x$INITRDFS" ] ; then
if [ "x" = "x$FS" ] ; then
# default value
- # XXX: initramfs blocked for now
- if [ "1" = " 0" -a "$pack_version" -ge "002005" ] ; then
+ if [ "$pack_version" -ge "002005" ] ; then
INITRDFS="initramfs"
else
INITRDFS="rom"
@@ -1005,6 +1024,16 @@
fi
fi
+if is_yes "$FB_SPLASH"; then
+ if is_yes "$BOOT_SPLASH"; then
+ echo >&2 "You can't use both bootsplash and fbsplash! Please choose one."
+ exit 1
+ elif [ "$INITRDFS" != "initramfs" ]; then
+ echo >&2 "FB_SPLASH works only if INITRDFS is initramfs!."
+ exit 1
+ fi
+fi
+
if [ ! -f /proc/mounts ]; then
echo >&2 "WARNING: /proc filesystem not mounted, may cause wrong results or failure."
fi
@@ -1047,6 +1076,9 @@
findmodule "-lzf"
fi
+if is_yes "$FB_SPLASH"; then
+ findmodule "-evdev"
+fi
if [ -n "$ifneeded" -a -z "$MODULES" ]; then
debug "No modules are needed -- not building initrd image."
exit 0
@@ -1172,22 +1204,29 @@
mkdir -p $MNTIMAGE/sys
inst /sbin/initrd-udev $MNTIMAGE/sbin/udev
- ln -s udev $MNTIMAGE/sbin/udevstart
inst /etc/udev/udev.conf $MNTIMAGE/etc/udev/udev.conf
- ln -s udev $MNTIMAGE/sbin/hotplug
-
if is_yes "$USE_UDEV"; then
initrd_gen_tmpfs_dev >> "$s"
- cat >> "$s" <<-EOF
-mount -t proc none /proc
-mount -t sysfs none /sys
-: 'Starting udev'
-/sbin/udevstart
-echo -n /sbin/hotplug > /proc/sys/kernel/hotplug
-umount /proc
-umount /sys
-EOF
+ cat >> "$s" <<- 'EOF'
+ mount -t proc none /proc
+ mount -t sysfs none /sys
+ : 'Starting udev'
+ /sbin/udev
+ echo -n /sbin/hotplug > /proc/sys/kernel/hotplug
+ EOF
+ if is_yes "$PROBESTATICMODS"; then
+ inst /sbin/initrd-udevtrigger $MNTIMAGE/sbin/udevtrigger
+ inst /sbin/initrd-udevsettle $MNTIMAGE/sbin/udevsettle
+ cat >> "$s" <<- 'EOF'
+ /sbin/udevtrigger
+ /sbin/udevsettle
+ EOF
+ fi
+ cat >> "$s" <<- 'EOF'
+ umount /proc
+ umount /sys
+ EOF
fi
}
@@ -1464,8 +1503,58 @@
if [ "$INITRDFS" = "initramfs" ]; then
mkdir -p $MNTIMAGE/newroot
cp -HR $org_rootdev $MNTIMAGE/dev
- echo "mount -t $rootFs $org_rootdev /newroot" >> "$s"
- echo "switch_root /newroot /sbin/init" >> "$s"
+ # Parsing root parameter
+ # We support passing root as hda3 /dev/hda3 0303 0x0303
+ cat << 'EOF' >> "$s"
+set +x
+mount -t proc none /proc
+root="$(busybox awk -v prefix="root=" ' \
+function separate_root ( txt ) \
+{ \
+ gsub(/.*root=/,NIL,txt); \
+ gsub(/ .*/,NIL,txt); \
+ return txt \
+} \
+BEGIN { \
+ num_pattern = "[0-9][0-9][0-9][0-9]"; \
+ dev_pattern = "[hms][a-z][a-z]([0-9])+"; \
+ partition = "Metallica rocks!"; \
+ min = -1; maj = -1; \
+} \
+$0 ~ prefix "0x" num_pattern { sub(/root=0x/,"root="); } \
+$0 ~ prefix num_pattern { \
+ gsub(/.*root=/,NIL,partition); \
+ gsub(/ .*/,NIL,partition); \
+ partition = separate_root( $0 ); \
+ maj = sprintf("%d",substr(partition,1,2)); \
+ min = sprintf("%d",substr(partition,3)); \
+} \
+$0 ~ prefix "\/dev\/" dev_pattern { sub(/root=\/dev\//,"root="); } \
+$0 ~ prefix dev_pattern { \
+ partition = separate_root( $0 ); \
+} \
+$4 ~ partition { maj = $1; min = $2; } \
+$1 ~ maj && $2 ~ min { partition = $4; } \
+END { print sprintf("/dev/%s %d %d", partition, maj, min); }
+' /proc/cmdline /proc/partitions)"
+device=${root% * *}
+maj=${root#* }
+maj=${maj% *}
+min=${root#* * }
+set -x
+if [ ! -b $device ]; then
+ mknod $device b $maj $min
+fi
+EOF
+ cat << EOF >> "$s"
+mount -t $rootFs \$device /newroot
+init="\$(busybox awk ' /init=\// { gsub(/.*init=/,NIL,\$0); gsub(/ .*/,NIL,\$0); print \$0; } ' /proc/cmdline )"
+if [ -z "\$init" -o ! -x "/newroot\$init" ]; then
+ init=/sbin/init
+fi
+umount /proc
+exec switch_root /newroot \$init
+EOF
# we need real file, not symlink
rm -f $MNTIMAGE/init
cp -a $MNTIMAGE/linuxrc $MNTIMAGE/init
@@ -1536,6 +1625,29 @@
fi
fi
+if is_yes "$FB_SPLASH"; then
+ if [ ! -x /usr/bin/splash_geninitramfs ]; then
+ echo >&2 "Failed to execute /usr/bin/splash_geninitramfs. Is splashutils package installed?"
+ elif [ -z "$SPLASH_THEME" ]; then
+ echo >&2 "Please configure your /etc/sysconfig/fbsplash first."
+ echo >&2 "Generating fbsplashes skipped."
+ else
+ if [ -n "$FB_SPLASH_RESOLUTIONS" ]; then
+ for res in $FB_SPLASH_RESOLUTIONS; do
+ if [ -f "/etc/splash/$SPLASH_THEME/$res.cfg" ]; then
+ /usr/bin/splash_geninitramfs -a $target -r $res $SPLASH_THEME && \
+ debug "Added $res $SPLASH_THEME theme to initramfs."
+ else
+ echo >&2 "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
+ fi
+ done
+ else
+ echo >&2 "No FB_SPLASH_RESOLUTIONS specified in /etc/sysconfig/fbsplash."
+ echo >&2 "Not adding fbsplash to initramfs."
+ fi
+ fi
+fi
+
rm -rf "$MNTIMAGE" "$MNTPOINT" "$IMAGE"
# vim:ts=4:sw=4:noet:fdm=marker
Modified: geninitrd/trunk/geninitrd.8.xml
==============================================================================
--- geninitrd/trunk/geninitrd.8.xml (original)
+++ geninitrd/trunk/geninitrd.8.xml Thu Dec 14 17:03:12 2006
@@ -181,6 +181,18 @@
<para>For eg. if you have Promise FastTrack controler then add "alias ataraid_hostadapter pdcraid" to /etc/modules.conf.</para>
</refsect1>
<refsect1>
+ <title>Splash support</title>
+ <para>
+ Geninitrd supports both <application>bootsplash</application> and <application>fbsplash</application> (<application>splashutils</application>) incorpororation into boot proces.
+ </para>
+ <para>
+ For both <application>fbsplash</application> and <application>bootsplash</application> to work, the kernel needs to be patched respectivly.
+ </para>
+ <para>
+ Additionally, for <application>fbsplash</application> and <application>bootsplash</application> you need to pass special kernel parameters during boot. Use <application>rc-boot</application>, <application>lilo</application> or <application>grub</application> to pass the parameters. For details on parameters please consult <application>fbsplash</application> or <application>bootsplash</application> documentation.
+ </para>
+</refsect1>
+<refsect1>
<title>Linux 2.6.x support</title>
<para>To bulild initrd for Linux 2.6.x kernels you must have module-init-tools and use --with-insmod-static switch or use initrd version of recent busybox that comes in busybox-initrd package.
</para>
@@ -278,6 +290,7 @@
<member>Artur Frysiak <email>wiget(at)pld-linux.org</email>, </member>
<member>Dariusz Karolczak <email>inglod(at)pld-linux.org</email>, </member>
<member>Tomasz Kloczko <email>kloczek(at)pld.org.pl</email>, </member>
+ <member>Cezary KrzyĂĹĄÄšĹanowski <email>czarny(at)pld-linux.org</email>, </member>
<member>Arkadiusz Miskiewicz <email>arekm(at)pld-linux.org</email>, </member>
<member>Michal Moskal <email>malekith(at)pld-linux.org</email>, </member>
<member>Jan Rekorajski <email>baggins(at)pld-linux.org</email>, </member>
Modified: geninitrd/trunk/geninitrd.sysconfig
==============================================================================
--- geninitrd/trunk/geninitrd.sysconfig (original)
+++ geninitrd/trunk/geninitrd.sysconfig Thu Dec 14 17:03:12 2006
@@ -14,12 +14,18 @@
## Use udev to create /dev?
#USE_UDEV=no
+## Should udev make device nodes for staticly linked devices as well?
+#PROBSTATICMODULES=yes
+
## Use suspend to disk?
USE_SUSPEND=no
-# Do install software suspend2 modules?
+## Do install software suspend2 modules?
USE_SUSPEND2=no
+## Should we use splash image?
+# FB_SPLASH=yes
+
# sleep after module loading
#MODULE_qla2xxx_USLEEP="2000000"
More information about the pld-cvs-commit
mailing list