SVN: geninitrd/branches/devel: . geninitrd
czarny
czarny at pld-linux.org
Sat Dec 9 23:33:58 CET 2006
Author: czarny
Date: Sat Dec 9 23:33:52 2006
New Revision: 8090
Added:
geninitrd/branches/devel/
- copied from rev 8089, geninitrd/trunk/
Modified:
geninitrd/branches/devel/geninitrd
Log:
- added initramfs support
- script now can mount proper root
- uses root kernel parameter
- works both with udev and without
- some simple setup for fbsplash support
Modified: geninitrd/branches/devel/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd (original)
+++ geninitrd/branches/devel/geninitrd Sat Dec 9 23:33:52 2006
@@ -41,6 +41,8 @@
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
# is /dev on tmpfs. internal variable
tmpfs_dev=
@@ -59,7 +61,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 +784,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 +824,9 @@
--without-bootsplash)
BOOT_SPLASH="no"
;;
+ --without-fbsplash)
+ FB_SPLASH="no"
+ ;;
--without-suspend)
USE_SUSPEND="no";
;;
@@ -915,8 +925,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"
@@ -1047,6 +1056,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
@@ -1464,8 +1476,34 @@
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"
+ echo "mount -t proc none /proc" >> "$s"
+ # the worst part if we don't have udev
+ if [ "$USE_UDEV" != "yes" ]; then
+ # We either have root passed into kernel as /dev/something or as a maj-min number
+ # we parse acordingly
+ cat << 'EOF' >> "$s"
+root="$(busybox awk ' /root=/ { gsub(/.*root=/,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ' /proc/cmdline )"
+if [[ "$root" == +(/+([A-z0-9])) ]]; then
+ rootnr="$(busybox awk -v root="$root" ' { if ($4 == root) { print $1 $2; } } ' /proc/partitions)"
+else
+ rootnr="${root#??} ${root%??}"
+ root="$(busybox awk " \
+ BEGIN { maj=${root#??}; min=${root%??}; } \
+ { if ( (\$1 == maj) && (\$2 == min) ) { print \$4; } } " \
+ /proc/partitions )"
+fi
+mknod $root b $rootnr
+EOF
+ fi
+ cat << EOF >> "$s"
+mount -t $rootFs \$root /newroot
+init="\$(busybox awk ' /init=\// { gsub(/.*init=/,NIL,\$0); gsub(/ .*/,NIL,\$0); print \$0; } ' /proc/cmdline )"
+if [ -z "\$init" -o ! -n "/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
More information about the pld-cvs-commit
mailing list