From 12574f2c42069a8d63ebc3ae63b9db084536163a Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sat, 13 Oct 2012 16:14:09 +0000 Subject: Add boot/shutdown script customization instructions git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10016 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- bootscripts/ChangeLog | 6 +++ bootscripts/lfs/init.d/checkfs | 10 ++++- bootscripts/lfs/lib/services/init-functions | 4 -- bootscripts/lfs/sysconfig/rc.site | 16 ++++++- chapter01/changelog.xml | 10 +++++ chapter07/site.xml | 67 +++++++++++++++++++++++++++++ packages.ent | 2 +- udev-lfs/55-lfs.txt | 20 +++++++++ udev-lfs/81-cdrom.rules | 3 ++ udev-lfs/83-cdrom-symlinks.rules | 13 ++++++ udev-lfs/Makefile.lfs | 7 +-- udev-lfs/README | 4 +- udev-lfs/doc/55-lfs.txt | 20 --------- udev-lfs/doc/README | 6 --- 14 files changed, 148 insertions(+), 40 deletions(-) create mode 100644 udev-lfs/55-lfs.txt create mode 100644 udev-lfs/81-cdrom.rules create mode 100644 udev-lfs/83-cdrom-symlinks.rules delete mode 100644 udev-lfs/doc/55-lfs.txt delete mode 100644 udev-lfs/doc/README diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index 5ff5efcf7..bc64c304a 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -1,3 +1,9 @@ +2012-10-13 Bruce Dubbs + * 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 * Add udevadm trigger --action=change line to udev script to support initramfs better diff --git a/bootscripts/lfs/init.d/checkfs b/bootscripts/lfs/init.d/checkfs index ef96aaf0f..cd7904b5b 100644 --- a/bootscripts/lfs/init.d/checkfs +++ b/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 diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions index e898826aa..29ff26270 100644 --- a/bootscripts/lfs/lib/services/init-functions +++ b/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 diff --git a/bootscripts/lfs/sysconfig/rc.site b/bootscripts/lfs/sysconfig/rc.site index 3b58035b2..207bc90fe 100644 --- a/bootscripts/lfs/sysconfig/rc.site +++ b/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 diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index d8cd81fca..f403b8d16 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -36,6 +36,16 @@ --> + + 2012-09-27 + + + [bdubbs] - Add boot/shutdown script customization + instructions. + + + + 2012-10-02 diff --git a/chapter07/site.xml b/chapter07/site.xml index 47b327eee..dcb2c5532 100644 --- a/chapter07/site.xml +++ b/chapter07/site.xml @@ -32,5 +32,72 @@ &site; + + Customizing the Boot and Shutdown Scripts + + 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 /etc/sysconfig/rc.site file above. + + + + During the boot script udev, there is + a call to udev settle 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. + + The boot script udev_retry also runs + udev settle by default. This command is only needed by + default if the /var directory is + separately mounted. This is because the clock needs the file + /var/lib/hwclock/adjtime. 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. + + + By default, the file system checks are silent. This can + appear to be a delay during the bootup process. To turn on the + fsck output, set the variable VERBOSE_FSCK=y. + + + When rebooting, you may want to skip the filesystem check, + fsck, completely. To do this, either create the file + /fastboot or reboot the system with the command + /sbin/shutdown -f -r now. On the other hand, you can + force all file systems to be checked by creating + /forcefsck or running shutdown with + the -F parameter instead of -f. + + + Setting the variable FASTBOOT=y will disable fsck + during the boot process until it is removed. This is not recommended + on a permanent basis. + + Normally, all files in the /tmp 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. + + During shutdown, the init 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 sendsignals + script for any processes that are not shut down by their own scripts. The + delay for init can be set by passing a parameter. For + example to remove the delay in init, pass the -t0 + parameter when shutting down or rebooting (e.g. /sbin/shutdown + -t0 -r now). The delay for the sendsignals + script can be skipped by setting the parameter + KILLDELAY=0. + + + + + diff --git a/packages.ent b/packages.ent index 091369a79..1a3903c28 100644 --- a/packages.ent +++ b/packages.ent @@ -302,7 +302,7 @@ - + diff --git a/udev-lfs/55-lfs.txt b/udev-lfs/55-lfs.txt new file mode 100644 index 000000000..5f116f9b7 --- /dev/null +++ b/udev-lfs/55-lfs.txt @@ -0,0 +1,20 @@ +Purpose of rules file: + +Most of the rules installed by Udev itself create devices with the correct +properties. This file contains rules that have not been merged upstream yet. + +Description of rules: + +By default, Udev creates device nodes with UID 0, GID 0, and permissions 0660. + +ISDN-related devices should be owned by the 'dialout' group, hence the following +rule (and similar): + +KERNEL=="ippp[0-9]*", GROUP="dialout" + +The RTC-related rules cause the setclock bootscript to be run as soon as the +RTC device has been created by Udev, meaning that times in log files, for +example, are as accurate as possible as quickly as possible. + +A final word of caution: Any particular rule must be written on one line, and a +comma must separate each part of the rule. diff --git a/udev-lfs/81-cdrom.rules b/udev-lfs/81-cdrom.rules new file mode 100644 index 000000000..cb7ea5748 --- /dev/null +++ b/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" diff --git a/udev-lfs/83-cdrom-symlinks.rules b/udev-lfs/83-cdrom-symlinks.rules new file mode 100644 index 000000000..5d6b60078 --- /dev/null +++ b/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" diff --git a/udev-lfs/Makefile.lfs b/udev-lfs/Makefile.lfs index 1bb8f1bf0..bda131402 100644 --- a/udev-lfs/Makefile.lfs +++ b/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 diff --git a/udev-lfs/README b/udev-lfs/README index 18e3b881f..d9e39c159 100644 --- a/udev-lfs/README +++ b/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 diff --git a/udev-lfs/doc/55-lfs.txt b/udev-lfs/doc/55-lfs.txt deleted file mode 100644 index 5f116f9b7..000000000 --- a/udev-lfs/doc/55-lfs.txt +++ /dev/null @@ -1,20 +0,0 @@ -Purpose of rules file: - -Most of the rules installed by Udev itself create devices with the correct -properties. This file contains rules that have not been merged upstream yet. - -Description of rules: - -By default, Udev creates device nodes with UID 0, GID 0, and permissions 0660. - -ISDN-related devices should be owned by the 'dialout' group, hence the following -rule (and similar): - -KERNEL=="ippp[0-9]*", GROUP="dialout" - -The RTC-related rules cause the setclock bootscript to be run as soon as the -RTC device has been created by Udev, meaning that times in log files, for -example, are as accurate as possible as quickly as possible. - -A final word of caution: Any particular rule must be written on one line, and a -comma must separate each part of the rule. diff --git a/udev-lfs/doc/README b/udev-lfs/doc/README deleted file mode 100644 index 01216694c..000000000 --- a/udev-lfs/doc/README +++ /dev/null @@ -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. - -- cgit v1.2.3-54-g00ecf