blob: b2885ab8f9c367849ef547a6dad0bc812c4424ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
From 2e1b258ad16da7bb825a70038eb91564fdf33a8d Mon Sep 17 00:00:00 2001
From: Carlo Landmeter <clandmeter@alpinelinux.org>
Date: Thu, 28 Jun 2018 19:14:20 +0000
Subject: [PATCH] init: use swclock when no rtc is found
---
initramfs-init.in | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/initramfs-init.in b/initramfs-init.in
index d6f90a2..8233af4 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -269,6 +269,14 @@ setup_nbd() {
[ "$n" != 0 ] || return 1
}
+rtc_exists() {
+ local rtc=
+ for rtc in /dev/rtc /dev/rtc[0-9]*; do
+ [ -e "$rtc" ] && break
+ done
+ [ -e "$rtc" ]
+}
+
# read the kernel options. we need surve things like:
# acpi_osi="!Windows 2006" xen-pciback.hide=(01:00.0)
set -- $(cat /proc/cmdline)
@@ -541,7 +549,6 @@ if [ -f "$sysroot/etc/.default_boot_services" -o ! -f "$ovl" ]; then
rc_add hwdrivers sysinit
rc_add modloop sysinit
- rc_add hwclock boot
rc_add modules boot
rc_add sysctl boot
rc_add hostname boot
@@ -642,6 +649,13 @@ if [ -n "$KOPT_ssh_key" ]; then
rc_add sshd default
fi
+# use swclock if no RTC is found
+if rtc_exists; then
+ rc_add hwclock boot
+else
+ rc_add swclock boot
+fi
+
apkflags="--initramfs-diskless-boot --progress"
if [ -z "$ALPINE_REPO" ]; then
apkflags="$apkflags --no-network"
--
2.18.0
|