diff options
author | Thomas Bächler <thomas@archlinux.org> | 2010-06-09 09:41:40 +0200 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2010-06-09 09:41:40 +0200 |
commit | 37b55308f19b7743673842581469b8379ec8525b (patch) | |
tree | e6af4013e2623cc8d98cfeb3f05784226c93175b /rc.sysinit | |
parent | 78f148879c136227714dd88ad15fcf0481ddaca6 (diff) | |
download | initscripts-37b55308f19b7743673842581469b8379ec8525b.tar.xz |
Rewrite early RTC device creation
Creating the RTC device will result in an error if devtmpfs is used,
as it already exists after loading the module. The new code skips
the mknod if the device is already present.
Additionally to rtc-cmos, we now also try to load rtc and genrtc,
as some custom kernels use the "old" misc RTC device instead of
the newer RTC class. In this case, the created device is also
different. This should fix FS#18078.
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-x | rc.sysinit | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -56,12 +56,20 @@ fi if [ -n "$HWCLOCK_PARAMS" ]; then # enable rtc access - /sbin/modprobe rtc-cmos >/dev/null 2>&1 - RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null) - RTC_MAJOR="${RTC_MAJOR%% *}" - if [ -n "$RTC_MAJOR" ]; then - /bin/mknod /dev/rtc0 c $RTC_MAJOR 0 - /bin/ln -s /dev/rtc0 /dev/rtc + /sbin/modprobe -q rtc-cmos + # some custom kernels use rtc/genrtc, try to load those too + /sbin/modprobe -q rtc + /sbin/modprobe -q genrtc + # If devtmpfs is used, the required RTC device already exists now + # Otherwise, create whatever device is available + if [ ! -c /dev/rtc -a ! -c /dev/rtc0 ]; then + if [ -f /sys/class/rtc/rtc0/dev ]; then + IFS=: read -r major minor < /sys/class/rtc/rtc0/dev + /bin/mknod /dev/rtc0 c $major $minor + elif [ -f /sys/class/misc/rtc/dev ]; then + IFS=: read -r major minor < /sys/class/misc/rtc/dev + /bin/mknod /dev/rtc c $major $minor + fi fi # Do a clock set here for a few reasons: |