Dnia 10-12-2006, nie o godzinie 00:41 +0100, Cezary Krzyzanowski napisał(a): > Ok these changes *should* make possible proper initramfs start with both > udev on and off (I'm using udev, but I've also tested without and it > seems to work) >
Ok - so finished - works. I've replaced a mix of awk and sh to clean awk parsing and then I do what I must in sh (like making a device node). The device will be created if there is no device in /dev passed by root (regardless of udev). So if there is no udev or udev fails to make a device and s/b passed it as a parameter - it will be made as long it exists in /proc/partitions Full support for fbsplash incorporated as well. Some sanity checks (as not both bootsplash and fbslash, or no fbsplash other then in initramfs). Should work nicely. I've also modified the sysconfig geninitrd file and splashutils sysconfig fbsplash file to show options needed to be set for fbplash to work correctly. The only remaining problem is udev. Gonna toy with it later. For now please wrie any comments. On resolving all comments I'm commiting back to trunk and sending to buildres. [EMAIL PROTECTED]
Index: geninitrd =================================================================== --- geninitrd (.../trunk/geninitrd) (wersja 8099) +++ geninitrd (.../branches/devel/geninitrd) (wersja 8099) @@ -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" @@ -1005,6 +1014,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 +1066,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 +1486,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 +1608,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
_______________________________________________ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en