From e9ba8aa85f6fe42e7fe1c8815431702c07fe9172 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Mon, 16 Jan 2012 18:34:31 +0000 Subject: [PATCH] Change bootscripts to use devtmpfs for /dev. Move mounting of /dev to mountvirtfs and ensure /dev gets placed in /etc/mtab. Change fstab and kernel configuration sections to reflect these changes. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9710 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- bootscripts/lfs/init.d/mountfs | 1 + bootscripts/lfs/init.d/mountvirtfs | 15 +++++++++++++-- bootscripts/lfs/init.d/udev | 26 -------------------------- chapter01/changelog.xml | 12 ++++++++++++ chapter08/fstab.xml | 18 ++++++++++-------- chapter08/kernel.xml | 11 +++++++++-- general.ent | 4 ++-- packages.ent | 2 +- 8 files changed, 48 insertions(+), 41 deletions(-) diff --git a/bootscripts/lfs/init.d/mountfs b/bootscripts/lfs/init.d/mountfs index 4503836e1..d51b013e5 100644 --- a/bootscripts/lfs/init.d/mountfs +++ b/bootscripts/lfs/init.d/mountfs @@ -46,6 +46,7 @@ case "${1}" in mount -f /proc || failed=1 mount -f /sys || failed=1 mount -f /run || failed=1 + mount -f /dev || failed=1 (exit ${failed}) evaluate_retval diff --git a/bootscripts/lfs/init.d/mountvirtfs b/bootscripts/lfs/init.d/mountvirtfs index f7f9505a4..6f9df8d14 100644 --- a/bootscripts/lfs/init.d/mountvirtfs +++ b/bootscripts/lfs/init.d/mountvirtfs @@ -41,14 +41,25 @@ case "${1}" in if ! mountpoint /proc >/dev/null; then log_info_msg2 " ${INFO}/proc" - mount -n /proc || failed=1 + mount -n -o nosuid,noexec,nodev /proc || failed=1 fi if ! mountpoint /sys >/dev/null; then log_info_msg2 " ${INFO}/sys" - mount -n /sys || failed=1 + mount -n -o nosuid,noexec,nodev /sys || failed=1 fi + if ! mountpoint /dev >/dev/null; then + log_info_msg2 " ${INFO}/dev" + mount -n -o mode=0755,nosuid /dev || failed=1 + fi + + ln -s /run/shm /dev/shm + + # Copy the only static device node that Udev >= 155 doesn't + # handle to /dev + cp -a /lib/udev/devices/null /dev + (exit ${failed}) evaluate_retval exit $failed diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev index 6b7a79bc6..643ed80dc 100644 --- a/bootscripts/lfs/init.d/udev +++ b/bootscripts/lfs/init.d/udev @@ -43,36 +43,10 @@ case "${1}" in /etc/rc.d/init.d/halt stop fi - # Mount a temporary file system over /dev, so that any devices - # made or removed during this boot don't affect the next one. - # The reason we don't write to mtab is because we don't ever - # want /dev to be unavailable (such as by `umount -a'). - if ! mountpoint /dev > /dev/null; then - mount -n -t tmpfs tmpfs /dev -o mode=755 - fi - - if [ ${?} != 0 ]; then - log_failure_msg2 - msg="FAILURE:\n\nCannot mount a tmpfs " - msg="${msg}onto /dev, this system will be halted.\n\n" - msg="${msg}After you press Enter, this system " - msg="${msg}will be halted and powered off.\n\n" - log_failure_msg "$msg" - log_info_msg "Press Enter to continue..." - wait_for_user - /etc/rc.d/init.d/halt stop - fi - - ln -s /run/shm /dev/shm - # Udev handles uevents itself, so we don't need to have # the kernel call out to any binary in response to them echo > /proc/sys/kernel/hotplug - # Copy the only static device node that Udev >= 155 doesn't - # handle to /dev - cp -a /lib/udev/devices/null /dev - # Start the udev daemon to continually watch for, and act on, # uevents /sbin/udevd --daemon diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 92fd57dc3..77d22fe16 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -37,6 +37,18 @@ --> + + 2012-01-16 + + + [bdubbs] - Change bootscripts to use devtmpfs for /dev. + Move mounting of /dev to mountvirtfs and ensure /dev gets + placed in /etc/mtab. Change fstab and kernel configuration + sections to reflect these changes. + + + + 2012-01-11 diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index 7972886c0..e859851e9 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -22,15 +22,17 @@ cat > /etc/fstab << "EOF" # Begin /etc/fstab -# file system mount-point type options dump fsck -# order +# file system mount-point type options dump fsck +# order + +/dev/<xxx> / <fff> defaults 1 1 +/dev/<yyy> swap swap pri=1 0 0 +proc /proc proc nosuid,noexec,nodev 0 0 +sysfs /sys sysfs nosuid,noexec,nodev 0 0 +devpts /dev/pts devpts gid=4,mode=620 0 0 +tmpfs /run tmpfs defaults 0 0 +devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 -/dev/<xxx> / <fff> defaults 1 1 -/dev/<yyy> swap swap pri=1 0 0 -proc /proc proc defaults 0 0 -sysfs /sys sysfs defaults 0 0 -devpts /dev/pts devpts gid=4,mode=620 0 0 -tmpfs /run tmpfs defaults 0 0 # End /etc/fstab EOF diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml index 7c31806c3..a448f88e6 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -58,10 +58,17 @@ Configure the kernel via a menu-driven interface. For general information on kernel configuration see . BLFS has some information + url="&hints-root;kernel-configuration.txt"/>. BLFS has some information regarding particular kernel configuration requirements of packages outside of LFS at : + url="&blfs-root;view/svn/longindex.html#kernel-config-index"/>. + + Due to recent changes in udev, be sure to + select: + + Device Drivers ---> + Generic Driver Options ---> + Maintain a devtmpfs filesystem to mount at /dev make LANG=<host_LANG_value> LC_ALL= menuconfig diff --git a/general.ent b/general.ent index 31663409d..293ca4929 100644 --- a/general.ent +++ b/general.ent @@ -1,5 +1,5 @@ - - + + diff --git a/packages.ent b/packages.ent index a55a6d71a..47e56722a 100644 --- a/packages.ent +++ b/packages.ent @@ -297,7 +297,7 @@ - +