[arch-general] [PATCH 28/48] Use bash-style conditionals when setting up the hardware clock.

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Thu Aug 19 11:08:03 EDT 2010


Am 2010-08-19 10:19, schrieb Jan de Groot:
> On Thu, 2010-08-19 at 00:56 -0400, Dave Reisner wrote:
>> Couldn't we avoid all this by just flipping a switch in the kernel?
>>
>> CONFIG_RTC_DRV_CMOS=y
>>
>> If it's compiled into the kernel, udev picks it up and creates
>> the /dev
>> nodes for us.
>
> Which still locks out the people who use a custom kernel with this
> driver compiled as module. IMHO the init scripts should work with both
> module and built-in.
>

So why not let udev do the job? Patch below. I modified my initcpio to 
get rid of the devtmpfs. A ls -l /dev/rtc* added between the new 
/sbin/udevadm settle and the initial clock setting showed /dev/rtc0 and 
/dev/rtc -> rtc0. So I think this should work.

I did *not* move the sysinit_udevlaunched hook together with udev start 
to avoid insane creation times of dev nodes because this hook is used 
for some early udev triggering in fbsplash-extras (AUR).

Patch against bashification-redux:

 From 22d410a2566964d58752d443a1312a6eb552660a Mon Sep 17 00:00:00 2001
From: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de>
Date: Thu, 19 Aug 2010 16:46:23 +0200
Subject: [PATCH 17/17] Correct rtc dev nodes creation using udev

---
  rc.sysinit |   22 +++++++---------------
  1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 4421def..2415967 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -46,6 +46,12 @@ else
  	/bin/dmesg -n 3
  fi

+echo > /proc/sys/kernel/hotplug
+
+stat_busy "Starting UDev Daemon"
+/sbin/udevd --daemon
+stat_done
+
  HWCLOCK_PARAMS="--hctosys"
  case $HARDWARECLOCK in
      UTC) HWCLOCK_PARAMS+=" --utc";;
@@ -56,15 +62,7 @@ esac
  if [[ $HWCLOCK_PARAMS ]]; then
  	# enable rtc access
  	/sbin/modprobe -q -a rtc-cmos rtc genrtc
-	# If devtmpfs is used, the required RTC device already exists now
-	# Otherwise, create whatever device is available
-	if ! [[ -c /dev/rtc || -c /dev/rtc0 ]]; then
-            for dev in /sys/class/rtc/rtc0/dev /sys/class/misc/rtc/dev; do
-                [[ -e $dev ]] || continue
-		IFS=: read -r major minor < "$dev"
-		/bin/mknod /dev/rtc c $major $minor
-	    done
-	fi
+	/sbin/udevadm settle

  	# Do a clock set here for a few reasons:
  	# 1. Make creation time on udev nodes sane (FS#8665)
@@ -79,12 +77,6 @@ if [[ $HWCLOCK_PARAMS ]]; then
  	fi
  fi

-echo > /proc/sys/kernel/hotplug
-
-stat_busy "Starting UDev Daemon"
-/sbin/udevd --daemon
-stat_done
-
  run_hook sysinit_udevlaunched

  # Trigger udev uevents
-- 
1.7.2.1




More information about the arch-general mailing list