Merge branches 'warthog9' and 'master' of http://etherboot.org/share/warthog9/BKO
authorPravin Shinde <pravin@black-perl.(none)>
Sat, 4 Jul 2009 15:28:15 +0000 (17:28 +0200)
committerPravin Shinde <pravin@black-perl.(none)>
Sat, 4 Jul 2009 15:28:15 +0000 (17:28 +0200)
21 files changed:
pxeknife/pxeknife.conf
pxeknife/red_hat/fedora_11_live_cd/generate_initrd.sh [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/httpfs/server/fusermount [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/httpfs/server/httpfs [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc.sh [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/initrd0.img_orig [new file with mode: 0644]
pxeknife/red_hat/fedora_11_live_cd/modules/8139too.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/8390.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/e100.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/e1000.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/mii.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/ne2k-pci.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/pcnet32.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/r8169.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/sis900.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/modules/via-rhine.ko [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/mount_http_iso.sh [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/real-init [new file with mode: 0755]
pxeknife/red_hat/fedora_11_live_cd/vmlinuz0 [new file with mode: 0644]
pxeknife/red_hat/red_hat.conf [new file with mode: 0755]

index 23adcdc..1e6b5ee 100644 (file)
@@ -15,6 +15,11 @@ LABEL pxeknife-knoppix
        kernel menu.c32
        append pxeknife/knoppix/knoppix.conf
 
+LABEL pxeknife-red-hat
+       MENU LABEL Red Hat --->
+       kernel menu.c32
+       append pxeknife/red_hat/red_hat.conf
+
 LABEL pxeknife-ubuntu
        MENU LABEL Ubuntu --->
        kernel menu.c32
diff --git a/pxeknife/red_hat/fedora_11_live_cd/generate_initrd.sh b/pxeknife/red_hat/fedora_11_live_cd/generate_initrd.sh
new file mode 100755 (executable)
index 0000000..4d9e8ff
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+#cleanup the old mess
+echo "Removing the old files"
+rm -rf initrd0 initrd0.img initrd0.gz mpoint
+
+
+
+# create a copy of image to modify
+cp initrd0.img_orig initrd0.gz
+gunzip initrd0.gz
+mkdir mpoint
+
+echo "extracting filesystem filesystem"
+cd mpoint 
+cpio -ivu --no-absolute-filename  < ../initrd0
+cd ..
+
+echo "coping the needed files..."
+
+cp httpfs/static/udhcpc mpoint/bin/
+chmod 777 mpoint/bin/udhcpc
+
+cp httpfs/static/udhcpc.sh mpoint/bin/
+chmod 777 mpoint/bin/udhcpc.sh
+
+cp mount_http_iso.sh mpoint/bin/
+chmod 777 mpoint/bin/mount_http_iso.sh
+
+cp httpfs/server/httpfs mpoint/bin/
+chmod 777 mpoint/bin/httpfs
+
+cp httpfs/server/fusermount mpoint/bin/
+chmod 777 mpoint/bin/fusermount
+
+mkdir mpoint/modules
+cp modules/* mpoint/modules/
+
+
+cp real-init mpoint/sbin/
+chmod 0777 mpoint/sbin/real-init 
+
+
+
+cd mpoint
+echo "creating initrd from new system filesystem"
+
+echo "Compressing the filesystem"
+find . | cpio -oH newc | gzip -9 > ../initrd0.img
+cd ..
+
+rm -rf mpoint initrd0
+
+
+echo "Done, you can use initrd0.gz"
diff --git a/pxeknife/red_hat/fedora_11_live_cd/httpfs/server/fusermount b/pxeknife/red_hat/fedora_11_live_cd/httpfs/server/fusermount
new file mode 100755 (executable)
index 0000000..c37325c
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/httpfs/server/fusermount differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/httpfs/server/httpfs b/pxeknife/red_hat/fedora_11_live_cd/httpfs/server/httpfs
new file mode 100755 (executable)
index 0000000..df1b078
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/httpfs/server/httpfs differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc b/pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc
new file mode 100755 (executable)
index 0000000..2d408a5
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc.sh b/pxeknife/red_hat/fedora_11_live_cd/httpfs/static/udhcpc.sh
new file mode 100755 (executable)
index 0000000..9a8437a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/static/sh
+
+case "$1" in
+       renew|bound)
+               ifconfig $interface $ip up
+
+               if [ -n "$router" ] ; then
+                       for i in $router ; do
+                               route add -net 0.0.0.0 netmask 0.0.0.0 gw $i dev $interface
+                       done
+               fi
+               ;;
+       * )
+               ifconfig $interface 0.0.0.0
+               ;;
+esac
+
+exit 0
diff --git a/pxeknife/red_hat/fedora_11_live_cd/initrd0.img_orig b/pxeknife/red_hat/fedora_11_live_cd/initrd0.img_orig
new file mode 100644 (file)
index 0000000..31164d5
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/initrd0.img_orig differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/8139too.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/8139too.ko
new file mode 100755 (executable)
index 0000000..63ff9a5
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/8139too.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/8390.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/8390.ko
new file mode 100755 (executable)
index 0000000..521b56b
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/8390.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/e100.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/e100.ko
new file mode 100755 (executable)
index 0000000..c116c93
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/e100.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/e1000.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/e1000.ko
new file mode 100755 (executable)
index 0000000..05ec222
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/e1000.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/mii.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/mii.ko
new file mode 100755 (executable)
index 0000000..0318301
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/mii.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/ne2k-pci.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/ne2k-pci.ko
new file mode 100755 (executable)
index 0000000..191ad0c
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/ne2k-pci.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/pcnet32.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/pcnet32.ko
new file mode 100755 (executable)
index 0000000..63a79ad
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/pcnet32.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/r8169.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/r8169.ko
new file mode 100755 (executable)
index 0000000..ce32055
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/r8169.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/sis900.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/sis900.ko
new file mode 100755 (executable)
index 0000000..f8d1e6e
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/sis900.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/modules/via-rhine.ko b/pxeknife/red_hat/fedora_11_live_cd/modules/via-rhine.ko
new file mode 100755 (executable)
index 0000000..a1ab9ed
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/modules/via-rhine.ko differ
diff --git a/pxeknife/red_hat/fedora_11_live_cd/mount_http_iso.sh b/pxeknife/red_hat/fedora_11_live_cd/mount_http_iso.sh
new file mode 100755 (executable)
index 0000000..b795a65
--- /dev/null
@@ -0,0 +1,43 @@
+#!/static/sh
+
+# objectives: 
+# Enable networking.
+# Setup networking.
+# Find the location from which we need to get the ISO.
+# Mount the ISO.
+
+echo "HTTP Boot: inserting network modules"
+#insmod /modules/crc32c.ko   
+insmod /modules/8390.ko   
+insmod /modules/mii.ko   
+insmod /modules/ne2k-pci.ko   
+insmod /modules/pcnet32.ko   
+insmod /modules/r8169.ko   
+insmod /modules/e100.ko   
+insmod /modules/e1000.ko  
+insmod /modules/sis900.ko   
+insmod /modules/via-rhine.ko   
+insmod /modules/8139too.ko   
+#insmod /modules/af_packet.ko >/dev/null 2>&1 
+#insmod /modules/loop.ko >/dev/null 2>&1 
+
+ifconfig lo 127.0.0.1 up
+ifconfig eth0 up
+udhcpc -s /static/udhcpc.sh  >/dev/null 2>&1 
+
+ISO_PATH=$1
+echo "The location of fedora.iso is $ISO_PATH"
+echo "mounting CDROM"
+mkdir /iso
+httpfs $ISO_PATH /iso
+FILEPATH=`ls /iso/*.iso`
+busybox mount -t iso9660 $FILEPATH /sysroot -o loop -o ro
+
+
+# test if knoppix is there
+if test -f /sysroot/LiveOS/squashfs.img
+then
+echo -n "successfully mounted the Image"
+return 0
+fi
+return 1
diff --git a/pxeknife/red_hat/fedora_11_live_cd/real-init b/pxeknife/red_hat/fedora_11_live_cd/real-init
new file mode 100755 (executable)
index 0000000..ac47611
--- /dev/null
@@ -0,0 +1,635 @@
+#!/bin/bash
+
+emergency_shell()
+{
+    plymouth --hide-splash || :
+    echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
+    echo
+    bash < /dev/console
+}
+trap "emergency_shell" 0 2
+
+# exit immediately if a command fails
+set -e
+
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+export TERM=linux
+
+exec > /dev/console 2>&1
+
+echo "" > /proc/sys/kernel/hotplug
+
+# Declare all variables here.. mostly for housekeeping
+#
+init="/sbin/init"
+root_ro=0
+root_rw=0
+root=""
+rootflags=""
+rootfstype=""
+quiet=0
+shell=0
+eshell=0
+live_ram=0
+check_iso=0
+live_locale=""
+live_dir="LiveOS"
+overlay="off"
+HTTPFS=""
+
+echo "here in 40"
+# Parse kernel commandline options
+#
+for o in `cat /proc/cmdline` ; do
+    case $o in
+    init=*)
+        init=${o#init=}
+        ;;
+    ro)
+        root_ro=1
+        ;;
+    rw)
+        root_rw=1
+        ;;
+    quiet)
+        quiet=1
+        ;;
+    shell)
+        shell=1
+        ;;
+    eshell)
+        eshell=1
+        ;;
+    live_ram)
+        live_ram=1
+        ;;
+    live_locale=*)
+        live_locale=${o#live_locale=}
+        ;;
+    live_keytable=*)
+        live_keytable=${o#live_keytable=}
+        ;;
+    live_dir=*)
+        live_dir=${o#live_dir=}
+        ;;
+    overlay)
+        overlay=auto
+        ;;
+    overlay=*)
+        overlay=${o#overlay=}
+        ;;
+    reset_overlay)
+        reset_overlay=1
+        ;;
+    check)
+        check_iso=1
+        ;;
+    httpfs=*)
+        HTTPFS=${o#httpfs=}
+        ;;
+    blacklist=*)
+        blacklist=${o#blacklist=}
+        echo "blacklist $blacklist" >> /etc/modprobe.conf
+        ;;
+    *)
+        m=$(echo $o |cut -s -d . -f 1)
+        opt=$(echo $o |cut -s -d . -f 2-)
+        if [ -z "$m" -o -z "$opt" ]; then
+          continue
+        fi
+        p=$(echo $opt |cut -s -d = -f 1)
+        v=$(echo $opt |cut -s -d = -f 2-)
+        if [ -z "$p" -o -z "$v" ]; then
+          continue
+        fi
+        echo "options $m $p=$v" >> /etc/modprobe.conf
+        ;;
+    esac
+done
+
+if [ "$quiet" != "1" ] ; then
+    echo "kernel commandline: `cat /proc/cmdline`"
+fi
+
+echo "here in 113"
+# Users can override rootfs target on the kernel commandline
+#
+for o in `cat /proc/cmdline` ; do
+    case $o in
+    root=*)
+        root=${o#root=}
+        ;;
+    rootflags=*)
+        rootflags=${o#rootflags=}
+        ;;
+    rootfstype=*)
+        rootfstype=${o#rootfstype=}
+        ;;
+    esac
+done
+
+# Print out what we are going to do
+#
+if [ "$quiet" != "1" ] ; then
+    echo "init=$init"
+    echo "root=$root"
+    echo "rootflags=$rootflags"
+    echo "rootfstype=$rootfstype"
+    echo "root_ro=$root_ro"
+    echo "root_rw=$root_rw"
+fi
+
+waitforsymlink=0
+# generate udev rules to generate /dev/root symlink
+if [ -z $root ] ; then
+    root=/dev/something
+else
+    case $root in
+        /dev/disk/by-label/*)
+            LABEL=${root#/dev/disk/by-label/}
+            echo "SUBSYSTEM==\"block\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"root\"" > /etc/udev/rules.d/00-label.rules
+            if [ "$quiet" != "1" ] ; then
+                echo "Added udev rule 00-label.rules:"
+                cat /etc/udev/rules.d/00-label.rules
+            fi
+            waitforsymlink=1
+            thingtomount=/dev/root
+            ;;
+        CDLABEL=*)
+            CDLABEL=${root#CDLABEL=}
+            echo "KERNEL==\"hd[a-z]\", BUS==\"ide\", SYSFS{removable}==\"1\", ATTRS{media}==\"cdrom\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"root\"" > /etc/udev/rules.d/00-cdlabel.rules
+            echo "KERNEL==\"sr[0-9]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"root\"" >> /etc/udev/rules.d/00-cdlabel.rules
+            echo "KERNEL==\"scd[0-9]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"root\"" >> /etc/udev/rules.d/00-cdlabel.rules
+            echo "KERNEL==\"pcd[0-9]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"root\"" >> /etc/udev/rules.d/00-cdlabel.rules
+            if [ "$quiet" != "1" ] ; then
+                echo "Added udev rule 00-cdlabel.rules:"
+                cat /etc/udev/rules.d/00-cdlabel.rules
+            fi
+            waitforsymlink=1
+            thingtomount=/dev/root
+            ;;
+        LABEL=*)
+            LABEL=${root#LABEL=}
+            echo "SUBSYSTEM==\"block\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"root\"" > /etc/udev/rules.d/00-label.rules
+            if [ "$quiet" != "1" ] ; then
+                echo "Added udev rule 00-label.rules:"
+                cat /etc/udev/rules.d/00-label.rules
+            fi
+            waitforsymlink=1
+            thingtomount=/dev/root
+            ;;
+        /dev/disk/by-id/*)
+            UUID=${root#/dev/disk/by-id/}
+            echo "SUBSYSTEM==\"block\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"root\"" > /etc/udev/rules.d/01-uuid.rules
+            if [ "$quiet" != "1" ] ; then
+                echo "Added udev rule 01-uuid.rules:"
+                cat /etc/udev/rules.d/01-uuid.rules
+            fi
+            waitforsymlink=1
+            thingtomount=/dev/root
+            ;;
+        UUID=*)
+            UUID=${root#UUID=}
+            echo "SUBSYSTEM==\"block\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"root\"" > /etc/udev/rules.d/01-uuid.rules
+            if [ "$quiet" != "1" ] ; then
+                echo "Added udev rule 01-uuid.rules:"
+                cat /etc/udev/rules.d/01-uuid.rules
+            fi
+            waitforsymlink=1
+            thingtomount=/dev/root
+            ;;
+        /dev/*)
+            ln -s $root /dev/root
+            thingtomount=$root
+            ;;
+        *)
+            thingtomount=$root
+            ;;
+    esac
+fi
+
+echo "udev_log=\"error\"" >> /etc/udev/udev.conf
+
+# rules for loading modules
+#
+echo -n "ACTION==\"add\", SUBSYSTEM==\"?*\", ENV{MODALIAS}==\"?*\", RUN+=\"/sbin/modprobe $" >> /etc/udev/rules.d/10-modprobe.rules
+echo "env{MODALIAS}\"" >> /etc/udev/rules.d/10-modprobe.rules
+echo "ACTION==\"add\", SUBSYSTEM==\"scsi_device\" RUN+=\"/sbin/modprobe sg\"" >> /etc/udev/rules.d/10-modprobe.rules
+echo "ACTION==\"add\", SUBSYSTEM==\"scsi_device\", SYSFS{type}==\"0|7|14\", RUN+=\"/sbin/modprobe sd_mod\"" >> /etc/udev/rules.d/10-modprobe.rules
+echo "ACTION==\"add\", SUBSYSTEM==\"scsi_device\", SYSFS{type}==\"[45]\", RUN+=\"/sbin/modprobe sr_mod\"" >> /etc/udev/rules.d/10-modprobe.rules
+echo "SUBSYSTEM==\"mmc\", RUN+=\"/sbin/modprobe mmc_block\"" >> /etc/udev/rules.d/10-modprobe.rules
+
+echo "ACTION==\"add\", SUBSYSTEM==\"graphics\", KERNEL==\"fb[0-9]*\", RUN+=\"/bin/plymouth --show-splash\"" > /etc/udev/rules.d/20-show-plymouth.rules
+
+# FIXME: hack since sr_mod seems to fail to get loaded sometimes (#239657)
+/sbin/modprobe sr_mod 2>/dev/null || :
+
+/sbin/modprobe loop max_loop=16 2>/dev/null || :
+
+if [ "$quiet" != "1" ] ; then
+    echo "starting udevd"
+fi
+/sbin/udevd --daemon
+
+if [ "$quiet" != "1" ] ; then
+    echo "creating devices"
+fi
+/sbin/udevadm trigger
+
+if [ "$shell" == "1" ] ; then
+    plymouth --hide-splash || :
+    echo "Shell requested on kernel commandline. Exit to continue booting."
+    echo
+    bash < /dev/console
+    plymouth --show-splash || :
+fi
+
+# don't wait for "mtd0" as no device file will appear
+# and don't worry about this if $thingtomount is a regular file
+if [ "$root" != "mtd0" -a ! -f "$thingtomount" ] ; then
+
+    # If we don't have the /dev/root link.. ask the user to create..
+    if [ "$waitforsymlink" != "1" ] ; then
+        if [ ! -L /dev/root ] ; then
+            plymouth --hide-splash || :
+            echo
+            echo "--------------------------------------"
+            echo "WARNING: Cannot find root file system!"
+            echo "--------------------------------------"
+            echo
+            echo "Create symlink /dev/root and then exit this shell to continue"
+            echo "the boot sequence."
+            echo
+            bash < /dev/console
+            plymouth --show-splash || :
+        fi
+    fi
+
+    if [ ! -b /dev/root ] ; then
+        if [ "$quiet" != "1" ] ; then
+            echo "Waiting for root to appear"
+        fi
+        COUNTDOWN=90
+        while [ "x$COUNTDOWN" != "x0" ] ; do
+            if [ "$quiet" != "1" ] ; then
+                echo -n "."
+            fi
+            COUNTDOWN=$(($COUNTDOWN - 1))
+            /bin/sleep 1
+            if [ -e /dev/root ] ; then
+               COUNTDOWN=0
+                continue
+            fi
+            # this is kind of lame, but we could have had a situation
+            # where we were unable to read the volume id.  so trigger
+            # another run through the block devs
+            if [ "x$COUNTDOWN" = "x30" ]; then
+                /sbin/udevadm trigger --subsystem-match=block
+            fi
+        done
+    fi
+
+    if [ ! -b /dev/root ] ; then
+        plymouth --hide-splash || :
+        echo
+        echo "--------------------------------------"
+        echo "WARNING: Cannot find root file system!"
+        echo "--------------------------------------"
+        echo
+        echo "Create symlink /dev/root and then exit this shell to continue"
+        echo "the boot sequence."
+        echo
+        bash < /dev/console
+        plymouth --show-splash || :
+    fi
+
+    if [ "$quiet" != "1" ] ; then
+        echo "mounting /dev/root"
+        ls -l /dev/root
+    fi
+
+    if [ -z $rootfstype ] ; then
+        rootfstype=auto
+    fi
+
+fi
+
+[ -e /dev/root ] && fs=$(/lib/udev/vol_id -t /dev/root)
+if [ "x$fs" == "xiso9660" -o "x$fs" == "xudf" ]; then checkfs=1 ; fi
+if [ "x$check_iso" == "x1" -a -x /bin/checkisomd5 -a "x$checkfs" == "x1" ]; then
+   plymouth --hide-splash || :
+   echo "Verifying ISO image..."
+   /bin/checkisomd5 --verbose /dev/root
+   if [ $? -ne 0 ]; then
+       echo "Are you SURE you want to continue?"
+       echo "Press Enter to continue or ctrl-alt-del to reboot."
+       read < /dev/console
+   fi
+   plymouth --show-splash || :
+fi
+
+if [ "x$root_ro" == "x1" ] ; then
+   if [ -z $rootflags ] ; then
+       rootflags="ro"
+   else
+       rootflags="$rootflags,ro"
+   fi
+fi
+
+if [ "x$root_rw" == "x1" ] ; then
+   if [ -z $rootflags ] ; then
+       rootflags="rw"
+   else
+       rootflags="$rootflags,rw"
+   fi
+fi
+
+if [ -z $rootflags ] ; then
+    mountoptions=""
+else
+    mountoptions=" -o$rootflags"
+fi
+
+if [ -z ${HTTPFS} ] ; then
+    echo " mounting httpfs filesystem from ${HTTPFS}"
+    mount_http_iso.sh ${HTTPFS}
+    RES=$?
+else
+    echo " no httpfs provided, booting normal filesystem"
+    mount -n -t $rootfstype $mountoptions $thingtomount /sysroot
+    RES=$?
+fi
+
+
+if [ "$RES" != "0" ] ; then
+    plymouth --hide-splash || :
+    echo "---------------------------------"
+    echo "WARNING: Cannot mount rootfs!"
+    echo "---------------------------------"
+    echo
+    echo "Dropping to a shell. "
+    echo "Mount rootfs at /sysroot and exit shell to continue. Good luck!"
+    echo
+    bash < /dev/console
+    plymouth --hide-splash || :
+fi
+
+# Now get ready to leave the initramfs
+#
+
+# only pass kernel command line if we're launching /sbin/init
+if [ "$init" == "/sbin/init" ] ; then
+    initargs=$(cat /proc/cmdline)
+else
+    initargs=""
+fi
+
+# overlay setup helper function
+do_live_overlay() {
+    # create a sparse file for the overlay
+    # overlay: if non-ram overlay searching is desired, do it,
+    #              otherwise, create traditional overlay in ram
+    OVERLAY_LOOPDEV=$( losetup -f )
+
+    l=$(/lib/udev/vol_id -l /dev/root) || l=""
+    u=$(/lib/udev/vol_id -u /dev/root) || u=""
+
+    if ( echo $overlay | grep -q ":" ); then
+        # pathspec specified, extract
+        pathspec=$( echo $overlay | sed -e 's/^.*://' )
+    elif [ "x${overlay}" != "xoff" ]; then
+        pathspec="/${live_dir}/overlay-$l-$u"
+    fi
+
+    if [ -z "$pathspec" -o "$pathspec" == "auto" ]; then
+        pathspec="/${live_dir}/overlay-$l-$u"
+    fi
+    devspec=$( echo $overlay | sed -e 's/:.*$//' )
+
+    # need to know where to look for the overlay
+    setup=""
+    if [ -n "$devspec" -a -n "$pathspec" -a "${overlay}" != "off" ]; then
+        mkdir /overlayfs
+        mount -n -t auto $devspec /overlayfs || :
+        if [ -f /overlayfs$pathspec -a -w /overlayfs$pathspec ]; then
+            losetup $OVERLAY_LOOPDEV /overlayfs$pathspec
+            if [ -n "$reset_overlay" ]; then
+               dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
+            fi
+            setup="yes"
+        fi
+        umount -l /overlayfs || :
+    fi
+
+    if [ -z "$setup" ]; then
+        if [ -n "$devspec" -a -n "$pathspec" ]; then
+           echo "Unable to find persistent overlay; using temporary"
+           sleep 5
+        fi
+
+        dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
+        losetup $OVERLAY_LOOPDEV /overlay
+    fi
+
+    # set up the snapshot
+    echo 0 `blockdev --getsize $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create live-rw
+}
+
+# live cd helper function
+do_live_from_base_loop() {
+    do_live_overlay
+
+    # set up new /dev/root symlink
+    rm -f /dev/root
+    ln -s /dev/mapper/live-rw /dev/root
+
+    mount -n  /dev/mapper/live-rw /sysroot
+    # here you can modify the rw ext3 fs for testing if you don't want to
+    # respin the entire rootfs (which takes ages). Example
+    #
+    #  echo foo > /sysroot/etc/bar.conf
+    #
+    # We also use it to dynamically set the system locale from the boot
+    # menu on live cd's.
+    #
+    if [ "$live_locale" != "" ] ; then
+        echo "LANG=$live_locale" > /sysroot/etc/sysconfig/i18n
+    fi
+    if [ "$live_keytable" != "" ] ; then
+        echo "KEYTABLE=$live_keytable" > /sysroot/etc/sysconfig/keyboard
+    fi
+
+    # copy over module options
+    [ -f /etc/modprobe.conf ] && cat /etc/modprobe.conf >> /sysroot/etc/modprobe.conf
+
+    # create rule so udev creates /dev/live symlink on real rootfs
+    if [ -d /sysroot/lib/udev/rules.d ] ;then
+      udevrulefn=$(ls /sysroot/lib/udev/rules.d/50-udev* |grep -v rpmsave |grep -v rpmnew)
+    else
+      udevrulefn=$(ls /sysroot/etc/udev/rules.d/50-udev* |grep -v rpmsave |grep -v rpmnew)
+    fi
+    if [ -n "$CDLABEL" ]; then
+       echo "KERNEL==\"hd[a-z]\", BUS==\"ide\", SYSFS{removable}==\"1\", ATTRS{media}==\"cdrom\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"sr[0-9]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"scd[0-9]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"pcd[0-9]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$CDLABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+    elif [ -n "$LABEL" ]; then
+       echo "KERNEL==\"hd[a-z]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"hd[a-z][0-9]*\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"sd[a-z]\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"sd[a-z][0-9]*\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"mmcblk[0-9]*\", PROGRAM=\"/lib/udev/vol_id -l %N\", RESULT==\"$LABEL\", SYMLINK+=\"live\"" >> $udevrulefn
+    elif [ -n "$UUID" ]; then
+       echo "KERNEL==\"hd[a-z]\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"hd[a-z][0-9]*\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"sd[a-z]\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"sd[a-z][0-9]*\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"live\"" >> $udevrulefn
+       echo "KERNEL==\"mmcblk[0-9]*\", PROGRAM=\"/lib/udev/vol_id -u %N\", RESULT==\"$UUID\", SYMLINK+=\"live\"" >> $udevrulefn
+    fi
+
+    # add rules for loop devices created by this mayflower generated init
+    # i.e. /dev/live-osimg, /dev/live-osmin, /dev/live-overlay,
+    #      and /dev/live-squashed
+    if [ -b "$SQUASHED_LOOPDEV" ]; then
+        echo "KERNEL==\"${SQUASHED_LOOPDEV#/dev/}\", SYMLINK+=\"live-squashed\"" >> $udevrulefn
+    fi
+    if [ -b "$OSMIN_SQUASHED_LOOPDEV" ]; then
+        echo "KERNEL==\"${OSMIN_SQUASHED_LOOPDEV#/dev/}\", SYMLINK+=\"live-squashed-osmin\"" >> $udevrulefn
+    fi
+    if [ -b "$OSMIN_LOOPDEV" ]; then
+        echo "KERNEL==\"${OSMIN_LOOPDEV#/dev/}\", SYMLINK+=\"live-osmin\"" >> $udevrulefn
+        echo "ENV{DM_NAME}==\"live-osimg-min\", ENV{DKD_PRESENTATION_HIDE}=\"1\"" >> $udevrulefn
+    fi
+    echo "KERNEL==\"${BASE_LOOPDEV#/dev/}\", SYMLINK+=\"live-osimg\"" >> $udevrulefn
+    echo "KERNEL==\"${OVERLAY_LOOPDEV#/dev/}\", SYMLINK+=\"live-overlay\"" >> $udevrulefn
+
+    mount -n -o ro,remount /dev/mapper/live-rw /sysroot
+}
+
+# we might have a genMinInstDelta delta file for anaconda to take advantage of
+if [ -e /sysroot/${live_dir}/osmin.img ]; then
+    OSMINSQFS=/sysroot/${live_dir}/osmin.img
+fi
+
+if [ -n "$OSMINSQFS" ]; then
+    # decompress the delta data
+    dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
+    OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
+    losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
+    mkdir -p /squashfs.osmin
+    mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /squashfs.osmin
+    OSMIN_LOOPDEV=$( losetup -f )
+    losetup -r $OSMIN_LOOPDEV /squashfs.osmin/osmin
+    umount -l /squashfs.osmin
+fi
+
+# we might have an uncompressed embedded ext3  to use as rootfs (uncompressed live)
+#
+if [ -e /sysroot/${live_dir}/ext3fs.img ]; then
+  EXT3FS="/sysroot/${live_dir}/ext3fs.img"
+fi
+
+if [ -n "$EXT3FS" ] ; then
+    if [ "$quiet" != "1" ] ; then
+        echo "setting up embedded ext3 fs "
+    fi
+
+    mkdir -p /dev/mapper
+    mknod /dev/mapper/control c 10 63
+    modprobe dm_snapshot 2>/dev/null || :
+
+    BASE_LOOPDEV=$( losetup -f )
+    losetup -r $BASE_LOOPDEV $EXT3FS
+    umount -l /sysroot
+
+    do_live_from_base_loop
+fi
+
+# we might have an embedded ext3 on squashfs to use as rootfs (compressed live)
+#
+if [ -e /sysroot/${live_dir}/squashfs.img ]; then
+  SQUASHED="/sysroot/${live_dir}/squashfs.img"
+fi
+
+if [ -e "$SQUASHED" ] ; then
+
+    if [ "$quiet" != "1" ] ; then
+        echo "setting up embedded squash -> ext3 fs "
+    fi
+
+    mkdir -p /dev/mapper
+    mknod /dev/mapper/control c 10 63
+    modprobe dm_snapshot 2>/dev/null || :
+
+    if [ "$live_ram" == "1" ] ; then
+        echo "Copying live image to RAM..."
+        echo "(this may take a few minutes)"
+        dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
+        umount -n /sysroot
+        echo "Done copying live image to RAM."
+        eject -p /dev/root || :
+        SQUASHED="/squashed.img"
+    fi
+
+    SQUASHED_LOOPDEV=$( losetup -f )
+    losetup -r $SQUASHED_LOOPDEV $SQUASHED
+    mkdir -p /squashfs
+    mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /squashfs
+
+    BASE_LOOPDEV=$( losetup -f )
+    losetup -r $BASE_LOOPDEV /squashfs/LiveOS/ext3fs.img
+
+    umount -l /squashfs
+    if [ "$live_ram" == "0" ] ; then
+        umount -l /sysroot
+    fi
+
+    do_live_from_base_loop
+fi
+
+if [ -b "$OSMIN_LOOPDEV" ]; then
+    # set up the devicemapper snapshot device, which will merge
+    # the normal live fs image, and the delta, into a minimzied fs image
+    echo "0 $( blockdev --getsize $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV p 8" | dmsetup create --readonly live-osimg-min
+fi
+
+if [ "$eshell" == "1" ] ; then
+    plymouth --hide-splash || :
+    echo "Shell requested on kernel commandline."
+    echo "Rootfs is mounted ro on /sysroot. Exit to continue booting."
+    echo
+    bash < /dev/console
+    plymouth --show-splash || :
+fi
+
+if [ -x /sysroot$init ] ; then
+
+    # Leave initramfs and transition to rootfs
+    kill `pidof udevd`
+    if [ "$quiet" != "1" ] ; then
+        echo "transfering control to $init"
+    fi
+
+    # If the udev rule doesn't get triggered make sure to
+    # show a splash
+    plymouth --show-splash
+    exec /sbin/run-init
+    plymouth --hide-splash || :
+    echo "---------------------------------"
+    echo "WARNING: Error switching to real rootfs!"
+    echo "---------------------------------"
+    echo
+    echo "Dropping to a shell. Good luck!"
+    echo
+    bash < /dev/console
+else
+    plymouth --hide-splash || :
+    echo "---------------------------------------------------------"
+    echo "WARNING: Requested $init binary does not exist on rootfs."
+    echo "---------------------------------------------------------"
+    echo
+    echo "Dropping to a shell. Good luck!"
+    echo
+    bash < /dev/console
+fi
+
diff --git a/pxeknife/red_hat/fedora_11_live_cd/vmlinuz0 b/pxeknife/red_hat/fedora_11_live_cd/vmlinuz0
new file mode 100644 (file)
index 0000000..7fb3884
Binary files /dev/null and b/pxeknife/red_hat/fedora_11_live_cd/vmlinuz0 differ
diff --git a/pxeknife/red_hat/red_hat.conf b/pxeknife/red_hat/red_hat.conf
new file mode 100755 (executable)
index 0000000..b2d55b7
--- /dev/null
@@ -0,0 +1,22 @@
+MENU TITLE --== Red Hat (Fedora Live CD) ==--
+LABEL rootmenu
+       MENU LABEL <---- PXE Knife
+       kernel menu.c32
+       append pxeknife/pxeknife.conf
+
+
+label fedora_11_live_cd_rom
+       MENU LABEL Fedora 11 Live CD - from rom (for US)
+       kernel pxeknife/red_hat/fedora_11_live_cd/vmlinuz0
+       append root=CDLABEL=Fedora-11-i686-Live httpfs=http://140.211.167.171/share/pravin/Fedora-11-i686-Live.iso initrd=pxeknife/red_hat/fedora_11_live_cd/initrd0.img  rootfstype=auto ro liveimg rhgb 
+
+label fedora_11_live_cd_alien
+       MENU LABEL Fedora 11 Live CD - from alien (for EU)
+       kernel pxeknife/red_hat/fedora_11_live_cd/vmlinuz0
+       append root=CDLABEL=Fedora-11-i686-Live httpfs=http://145.116.233.189/Fedora-11-i686-Live.iso initrd=pxeknife/red_hat/fedora_11_live_cd/initrd0.img  rootfstype=auto ro liveimg rhgb 
+
+label fedora_11_live_cd_local
+       MENU LABEL Fedora 11 Live CD - localhost (for me)
+       kernel pxeknife/red_hat/fedora_11_live_cd/vmlinuz0
+       append root=CDLABEL=Fedora-11-i686-Live httpfs=http://192.168.0.1/Fedora-11-i686-Live.iso initrd=pxeknife/red_hat/fedora_11_live_cd/initrd0.img  rootfstype=auto ro liveimg selinux=0 rhgb 
+