refactoring rc.sysinit

Josh Aas josha at sgi.com
Tue Feb 22 16:17:29 UTC 2005


Bill Nottingham wrote:
> Nils Philippsen (nphilipp at redhat.com) said: 
> 
>>In the past, I found myself in some situations where I would have loved
>>to do things before or after a certain stage in rc.sysinit. How things
>>were, I had to change the file itself which either made me retrofit
>>these changes to a new rc.sysinit or lead to surprises when updating
>>initscripts.
> 
> 
> Got example usage cases? I'm just skeptical of making things more
> complicated and slower if the only usage cases are theoretical.

Here are some of the things SGI does now, which requires us to respin 
the initscripts RPM. This is not a complete list, but a quick look at 
some of the small patches should give you an idea of what we're doing:

diff -Nur initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit
--- initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 10:45:56.000000000 -0600
+++ initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 10:46:49.000000000 -0600
@@ -348,6 +348,11 @@
  fi
  mount --bind /hwgfs/hw /dev/hw

+# Mount the PCI Hot-Plug virtual filesystem
+if [ -d /proc/bus/pci/slots ]; then
+       mount -t pcihpfs none /proc/bus/pci/slots
+fi
+
  # LVM initialization
  if [ -f /etc/lvmtab ]; then
      [ -e /proc/lvm ] || modprobe lvm-mod > /dev/null 2>&1
diff -Nur initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit
--- initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 09:52:42.000000000 -0600
+++ initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 10:04:04.000000000 -0600
@@ -333,6 +333,21 @@
  [ "$state" != "rw" ] && \
    action $"Remounting root filesystem in read-write mode: " mount -n 
-o remount,rw /

+if [ ! -d /hwgfs ]; then
+       mkdir /hwgfs
+fi
+
+mount -t hwgfs none /hwgfs
+if [ ! -d /hw ]; then
+       mkdir /hw
+fi
+mount --bind /hwgfs/hw /hw
+
+if [ ! -d /dev/hw ]; then
+       mkdir /dev/hw
+fi
+mount --bind /hwgfs/hw /dev/hw
+
  # LVM initialization
  if [ -f /etc/lvmtab ]; then
      [ -e /proc/lvm ] || modprobe lvm-mod > /dev/null 2>&1
diff -Nur initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit
--- initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 10:38:04.000000000 -0600
+++ initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 10:38:36.000000000 -0600
@@ -598,6 +598,20 @@
     RHGB_STARTED=1
  fi

+#
+# Configure lkcd dump driver based on parameters in:
+#        /etc/sysconfig/dump
+# and save crash dump data (if any).
+#
+if [ -x /sbin/lkcd ]; then
+       # Don't use last 1024 KBytes of disk during dump.
+       tmp=`(. /etc/sysconfig/dump && mktemp $DUMPDIR/tmp.XXXXXX) 
2>/dev/null`
+       test -f "$tmp" && dd </dev/zero >"$tmp" bs=1k count=1024 2>/dev/null
+       action "Saving crash dump data (if any)" /sbin/lkcd save
+       rm -f "$tmp"
+       action "Configuring system to save crash dumps" /sbin/lkcd config
+fi
+
  # Start up swapping.
  update_boot_stage RCswap
  action $"Activating swap partitions: " swapon -a -e
@@ -834,6 +848,16 @@
         ln -s -f System.map-$unamer /boot/System.map
  fi

+# Adjust symlinks as necessary in /boot to capture Kerntypes for
+# crash dumps
+if [ -L /boot/Kerntypes -a -r /boot/Kerntypes-`uname -r` -a \
+       ! /boot/Kerntypes -ef /boot/Kerntypes-`uname -r` ] ; then
+       ln -s -f Kerntypes-`uname -r` /boot/Kerntypes
+fi
+if [ ! -e /boot/Kerntypes -a -r /boot/Kerntypes-`uname -r` ] ; then
+       ln -s -f Kerntypes-`uname -r` /boot/Kerntypes
+fi
+
  # The special Red Hat kernel library symlink must point to the right 
library
  # We need to deal with cases where there is no library, and we need to
  # deal with any version numbers that show up.
diff -Nur initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit
--- initscripts-sgi/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 09:44:26.000000000 -0600
+++ initscripts-work/initscripts-7.31.13.EL/rc.d/rc.sysinit 
2004-01-17 09:47:48.000000000 -0600
@@ -83,6 +83,17 @@

  # Configure kernel parameters
  update_boot_stage RCkernelparam
+# Set shmmax to reasonable value (70% of main memory), before
+# sysctl.conf is read, so any settings in sysctl.conf override
+# normally.
+
+awk < /proc/meminfo '
+    $1 == "MemTotal:" && $3 == "kB" {
+        shmmax = int($2 * 1024 * 0.7)
+        printf "sysctl -w kernel.shmmax=%d\n", shmmax
+    }
+' | bash >/dev/null 2>&1
+
  action $"Configuring kernel parameters: " sysctl -e -p /etc/sysctl.conf

  # Set the system clock.

-- 
Josh Aas
Silicon Graphics, Inc. (SGI)
Linux System Software
651-683-3068




More information about the fedora-devel-list mailing list