瀏覽代碼

Add boot/shutdown script customization instructions

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10016 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Bruce Dubbs 11 年之前
父節點
當前提交
12574f2c42

+ 6 - 0
bootscripts/ChangeLog

@@ -1,3 +1,9 @@
+2012-10-13 Bruce Dubbs <bdubbs@linuxfromscratch.org>
+   * Remove unneeded sleep in killproc
+   * Add option for verbose fsck
+   * Flatten directory structure of tarball
+   * Remove /fastboot or /forcecheck if set
+
 2012-09-05 Bruce Dubbs <bdubbs@linuxfromscratch.org>
    * Add udevadm trigger --action=change line to udev script
      to support initramfs better

+ 9 - 1
bootscripts/lfs/init.d/checkfs

@@ -46,6 +46,7 @@ case "${1}" in
          msg="/fastboot found, will omit "
          msg="${msg} file system checks as requested.\n"
          log_info_msg "${msg}"
+         rm /fastboot
          exit 0
       fi
 
@@ -73,13 +74,20 @@ case "${1}" in
          msg="${msg} system checks as requested."
          log_success_msg "$msg"
          options="-f"
+         rm /forcefsck
       else
          options=""
       fi
 
       log_info_msg "Checking file systems..."
+      
       # Note: -a option used to be -p; but this fails e.g. on fsck.minix
-      fsck ${options} -a -A -C -T >/dev/null
+      if is_true "$VERBOSE_FSCK"; then
+         fsck ${options} -a -A -C -T
+      else
+         fsck ${options} -a -A -C -T >/dev/null
+      fi
+
       error_value=${?}
 
       if [ "${error_value}" = 0 ]; then

+ 0 - 4
bootscripts/lfs/lib/services/init-functions

@@ -344,10 +344,6 @@ killproc()
                         sleep 1
                         # Check again, and fail if still running
                         kill -0 "${pid}" 2> /dev/null && return 1
-                    else
-                        # just check one last time and if still alive, fail
-                        sleep 1
-                        kill -0 "${pid}" 2> /dev/null && return 1
                     fi
                 fi
             done

+ 14 - 2
bootscripts/lfs/sysconfig/rc.site

@@ -50,8 +50,20 @@
 # Skip reading from the console
 #HEADLESS=yes
 
-# Skip cleaning /tmp
-#SKIPTMPCLEAN=yes
+# Speed up boot without waiting for settle in udev_retry
+#OMIT_UDEV_RETRY_SETTLE=yes
+
+# Write out fsck progress if yes
+#VERBOSE_FSCK=no
+
+# Speed up boot without waiting for settle in udev
+#OMIT_UDEV_SETTLE=y
+
+# Speed up boot without waiting for settle in udev_retry
+#OMIT_UDEV_RETRY_SETTLE=yes
+
+# Skip cleaning /tmp if yes
+#SKIPTMPCLEAN=no
 
 # For setclock
 #UTC=1

+ 10 - 0
chapter01/changelog.xml

@@ -36,6 +36,16 @@
     </listitem>
 -->
 
+    <listitem>
+      <para>2012-09-27</para>
+      <itemizedlist>
+        <listitem>
+          <para>[bdubbs] - Add boot/shutdown script customization
+          instructions.</para> 
+        </listitem>
+      </itemizedlist>
+    </listitem>
+
     <listitem>
       <para>2012-10-02</para>
       <itemizedlist>

+ 67 - 0
chapter07/site.xml

@@ -32,5 +32,72 @@
   <!-- Use role to fix a pdf generation problem -->
   <screen role="auto">&site;</screen>
 
+  <sect2>
+    <title>Customizing the Boot and Shutdown Scripts</title>
+
+    <para>The LFS boot scripts boot and shut down a system in a fairly
+    efficient manner, but there are a few tweaks that you can make in the
+    rc.site file to improve speed even more and to adjust messages accoring
+    to your preferences. To do this, adjust the settings in
+    the <filename>/etc/sysconfig/rc.site</filename> file above.</para>
+
+    <itemizedlist>
+
+    <listitem><para>During the boot script <filename>udev</filename>, there is
+    a call to <command>udev settle</command> that requires some time to
+    complete. This time may or may not be required depending on devices present
+    in the system.  If you only have simple partitions and a single ethernet
+    card, the boot process will probably not need to wait for this command.  To
+    skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem>
+
+    <listitem><para>The boot script <filename>udev_retry</filename> also runs
+    <command>udev settle</command> by default.  This command is only needed by
+    default if the <filename class='directory'>/var</filename> directory is
+    separately mounted.  This is because the clock needs the file
+    <filename>/var/lib/hwclock/adjtime</filename>.  Other customizations may
+    also need to wait for udev to complete, but in many installations it is not
+    needed.  Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y.
+    </para></listitem>
+
+    <listitem><para>By default, the file system checks are silent.  This can
+    appear to be a delay during the bootup process.  To turn on the
+    <command>fsck</command> output, set the variable VERBOSE_FSCK=y.
+    </para></listitem>
+
+    <listitem><para>When rebooting, you may want to skip the filesystem check,
+    <command>fsck</command>, completely.  To do this, either create the file
+    <filename>/fastboot</filename> or reboot the system with the command
+    <command>/sbin/shutdown -f -r now</command>.  On the other hand, you can
+    force all file systems to be checked by creating
+    <filename>/forcefsck</filename> or running <command>shutdown</command> with
+    the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>.  
+    </para>
+    
+    <para>Setting the variable FASTBOOT=y will disable <command>fsck</command>
+    during the boot process until it is removed.  This is not recommended 
+    on a permanent basis.</para></listitem>
+
+    <listitem><para>Normally, all files in the <filename
+    class='directory'>/tmp</filename> directory are deleted at boot time.
+    Depending on the number of files or directories present, this can cause a
+    noticible delay in the boot process.  To skip removing these files set the
+    variable SKIPTMPCLEAN=y.</para></listitem>
+
+    <listitem><para>During shutdown, the <command>init</command> program sends
+    a TERM signal to each program it has started (e.g. agetty), waits for a set
+    time (default 3 seconds), and sends each process a KILL signal and waits
+    again.  This process is repeated in the <command>sendsignals</command>
+    script for any processes that are not shut down by their own scripts.  The
+    delay for <command>init</command> can be set by passing a parameter.  For
+    example to remove the delay in <command>init</command>, pass the -t0
+    parameter when shutting down or rebooting (e.g.  <command>/sbin/shutdown
+    -t0 -r now</command>).  The delay for the  <command>sendsignals</command>
+    script can be skipped by setting the parameter
+    KILLDELAY=0.</para></listitem>
+
+    </itemizedlist>
+
+  </sect2>
+
 </sect1>
 

+ 1 - 1
packages.ent

@@ -302,7 +302,7 @@
 <!ENTITY less-ch6-du "3.8 MB">
 <!ENTITY less-ch6-sbu "less than 0.1 SBU">
 
-<!ENTITY lfs-bootscripts-version "20120905">                 <!-- Scripts depend on this format -->
+<!ENTITY lfs-bootscripts-version "20121013">                 <!-- Scripts depend on this format -->
 <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">         <!-- Updated in Makefile -->
 <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
 <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">           <!-- Updated in Makefile -->

+ 0 - 0
udev-lfs/doc/55-lfs.txt → udev-lfs/55-lfs.txt


+ 3 - 0
udev-lfs/81-cdrom.rules

@@ -0,0 +1,3 @@
+# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities
+
+ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", IMPORT{program}="cdrom_id --export $tempnode", GROUP="cdrom"

+ 13 - 0
udev-lfs/83-cdrom-symlinks.rules

@@ -0,0 +1,13 @@
+# /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability.
+
+ACTION!="add",          GOTO="cd_aliases_generator_end"
+SUBSYSTEM!="block",     GOTO="cd_aliases_generator_end"
+ENV{GENERATED}=="?*",   GOTO="cd_aliases_generator_end"
+
+# Fail the uevent if the autogenerated rules cannot be saved
+ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", \
+  RESULT!="2", RUN+="/bin/false", GOTO="cd_aliases_generator_end"
+
+ENV{ID_CDROM}=="?*", PROGRAM="write_cd_rules", SYMLINK+="%c"
+
+LABEL="cd_aliases_generator_end"

+ 4 - 3
udev-lfs/Makefile.lfs

@@ -278,13 +278,14 @@ install: udev
    # Create null device and copy rules
 	@cp -v rules/*                        $(DESTDIR)/lib/udev/rules.d
 	@rm -v                                $(DESTDIR)/lib/udev/rules.d/99*
-	@cp -v udev-lfs-$(VERSION)/*lfs.rules $(DESTDIR)/etc/udev/rules.d
+	@cp -v udev-lfs-$(VERSION)/*.rules    $(DESTDIR)/etc/udev/rules.d
 
    # Copy documentation
 	@cp -v man/udev.7                     $(DESTDIR)/usr/share/man/man7
 	@cp -v man/udevadm.8                  $(DESTDIR)/usr/share/man/man8
-	@cp -v udev-lfs-$(VERSION)/udevd.8    $(DESTDIR)/usr/share/man/man8/udevd.8
-	@cp -v udev-lfs-$(VERSION)/doc/*      $(DESTDIR)/usr/share/doc/udev/lfs
+	@cp -v udev-lfs-$(VERSION)/udevd.8    $(DESTDIR)/usr/share/man/man8
+	@cp -v udev-lfs-$(VERSION)/README     $(DESTDIR)/usr/share/doc/udev/lfs
+	@cp -v udev-lfs-$(VERSION)/*.txt      $(DESTDIR)/usr/share/doc/udev/lfs
 
    # Copy misc
 	@cp -v udev-lfs-$(VERSION)/init-net-rules.sh  $(DESTDIR)/lib/udev

+ 1 - 3
udev-lfs/README

@@ -29,9 +29,7 @@ write_net_rules      - Scripts for LFS rules
 write_cd_rules
 rule_generator.functions
 
-doc                  - Documentation for LFS installed rules
-doc/55-lfs.txt
-doc/README
+55-lfs.txt           - Documentation for LFS installed rules
 
 cfg.h                - Basic info needed for udev compilation
 

+ 0 - 6
udev-lfs/doc/README

@@ -1,6 +0,0 @@
-This directory contains documentation for each rule file used in LFS.
-
-Each .rules file should contain a corresponding .txt file in this directory,
-which explains both the overall purpose of the rules file, and each type of
-rule contained therein.
-