Hi, This is a preparation patch for actually adding the kernel integrity checking to mkinitrd. Note to reviewers: the code in the new function is 100% identical to the code as it was, it was cut -> pasted and the indented using block indent. Regards, Hans
diff -up mkinitrd-5.1.19.6/mkinitrd~ mkinitrd-5.1.19.6/mkinitrd --- mkinitrd-5.1.19.6/mkinitrd~ 2009-04-17 12:41:12.000000000 +0200 +++ mkinitrd-5.1.19.6/mkinitrd 2009-04-17 13:13:25.000000000 +0200 @@ -802,6 +802,101 @@ handlenfs() { addnetdev $netdev } +emit_modules() +{ + scsi="" + usb_mounted="prep" + for MODULE in "$@"; do + text="" + + if [[ "$MODULE" =~ "^iscsi_device_" ]] ; then + emit_iscsi_device "${MODULE##iscsi_device_}" + continue + elif [[ "$MODULE" =~ "^network_device_" ]] ; then + netdev="${MODULE##network_device_}" + emit "echo Bringing up $netdev" + handlenetdev "$netdev" + if [ -n "$prenetwork" ]; then + emit $prenetwork + fi + emit $network + if [ -n "$postnetwork" ]; then + emit $postnetwork + fi + continue + fi + + module=`echo $MODULE | sed -e "s|.*/||" -e "s/.k\?o$//"` + fullmodule=`echo $MODULE | sed "s|.*/||"` + + options=`sed -n -e ':a' -e '/\\\\$/N; s/\\\\\n//; ta' -e "s/^options[ ][ ]*$module[ ][ ]*//p" $modulefile 2>/dev/null` + + if [ -n "$options" ]; then + vecho "Adding module $module$text with options $options" + else + vecho "Adding module $module$text" + fi + + # we mount usbfs before the first module *after* the HCDs + if [ "$usb_mounted" == "prep" ]; then + if [[ "$module" =~ ".hci[_-]hcd" ]]; then + usb_mounted="no" + fi + elif [ "$usb_mounted" == "no" ]; then + if [[ ! "$module" =~ ".hci[_-]hcd" ]]; then + usb_mounted=yes + emit "mount -t usbfs /proc/bus/usb /proc/bus/usb" + fi + fi + + emit "echo \"Loading $fullmodule module\"" + emit "insmod /lib/$fullmodule $options" + + # Hack - we need a delay after loading usb-storage to give things + # time to settle down before we start looking a block devices + if [ "$module" = "usb-storage" -o "$module" = "ub" ]; then + emit "echo Waiting for driver initialization." + emit "stabilized /proc/bus/usb/devices" + fi + if [ "$module" = "sbp2" ]; then + emit "echo Waiting for driver initialization." + emit "stabilized /sys/bus/ieee1394/drivers/sbp2" + fi + if [ "$module" = "scsi_mod" ]; then + scsi="yes" + fi + if [ "$module" = "zfcp" -a -f /etc/zfcp.conf ]; then + emit "echo Waiting 2 seconds for driver initialization." + emit "sleep 2" + cat /etc/zfcp.conf | grep -v "^#" | tr "A-Z" "a-z" | while read DEVICE TWO THREE FOUR FIVE; do + if [ -z "$FIVE" ]; then + WWPN=$TWO + FCPLUN=$THREE + else + WWPN=$THREE + FCPLUN=$FIVE + fi + cemit <<EOF +echo -n $WWPN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/port_add +echo -n $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/$WWPN/unit_add +echo -n 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/online +EOF + done + fi + done + unset usb_mounted + + if [ -n "$scsi" ]; then + emit "echo Waiting for driver initialization." + emit "stabilized --hash --interval 1000 /proc/scsi/scsi" + fi + + # HACK: module loading + device creation isn't necessarily synchronous... + # this will make sure that we have all of our devices before trying + # things like RAID or LVM + emit "mkblkdevs" +} + while [ $# -gt 0 ]; do case $1 in --fstab*) @@ -1567,97 +1662,7 @@ emit "hotplug" emit "echo Creating block device nodes." emit "mkblkdevs" -usb_mounted="prep" -scsi="" -for MODULE in $MODULES; do - text="" - - if [[ "$MODULE" =~ "^iscsi_device_" ]] ; then - emit_iscsi_device "${MODULE##iscsi_device_}" - continue - elif [[ "$MODULE" =~ "^network_device_" ]] ; then - netdev="${MODULE##network_device_}" - emit "echo Bringing up $netdev" - handlenetdev "$netdev" - if [ -n "$prenetwork" ]; then - emit $prenetwork - fi - emit $network - if [ -n "$postnetwork" ]; then - emit $postnetwork - fi - continue - fi - - module=`echo $MODULE | sed -e "s|.*/||" -e "s/.k\?o$//"` - fullmodule=`echo $MODULE | sed "s|.*/||"` - - options=`sed -n -e ':a' -e '/\\\\$/N; s/\\\\\n//; ta' -e "s/^options[ ][ ]*$module[ ][ ]*//p" $modulefile 2>/dev/null` - - if [ -n "$options" ]; then - vecho "Adding module $module$text with options $options" - else - vecho "Adding module $module$text" - fi - - # we mount usbfs before the first module *after* the HCDs - if [ "$usb_mounted" == "prep" ]; then - if [[ "$module" =~ ".hci[_-]hcd" ]]; then - usb_mounted="no" - fi - elif [ "$usb_mounted" == "no" ]; then - if [[ ! "$module" =~ ".hci[_-]hcd" ]]; then - usb_mounted=yes - emit "mount -t usbfs /proc/bus/usb /proc/bus/usb" - fi - fi - - emit "echo \"Loading $fullmodule module\"" - emit "insmod /lib/$fullmodule $options" - - # Hack - we need a delay after loading usb-storage to give things - # time to settle down before we start looking a block devices - if [ "$module" = "usb-storage" -o "$module" = "ub" ]; then - emit "echo Waiting for driver initialization." - emit "stabilized /proc/bus/usb/devices" - fi - if [ "$module" = "sbp2" ]; then - emit "echo Waiting for driver initialization." - emit "stabilized /sys/bus/ieee1394/drivers/sbp2" - fi - if [ "$module" = "scsi_mod" ]; then - scsi="yes" - fi - if [ "$module" = "zfcp" -a -f /etc/zfcp.conf ]; then - emit "echo Waiting 2 seconds for driver initialization." - emit "sleep 2" - cat /etc/zfcp.conf | grep -v "^#" | tr "A-Z" "a-z" | while read DEVICE TWO THREE FOUR FIVE; do - if [ -z "$FIVE" ]; then - WWPN=$TWO - FCPLUN=$THREE - else - WWPN=$THREE - FCPLUN=$FIVE - fi - cemit <<EOF -echo -n $WWPN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/port_add -echo -n $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/$WWPN/unit_add -echo -n 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/online -EOF - done - fi -done -unset usb_mounted - -if [ -n "$scsi" ]; then - emit "echo Waiting for driver initialization." - emit "stabilized --hash --interval 1000 /proc/scsi/scsi" -fi - -# HACK: module loading + device creation isn't necessarily synchronous... -# this will make sure that we have all of our devices before trying -# things like RAID or LVM -emit "mkblkdevs" +emit_modules $MODULES #if [ -n "$vg_list" ]; then # emit "echo Making device-mapper control node"
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list