Browse Source

busybox: fix hwclock compile with musl, from busybox ml

Waldemar Brodkorb 2 weeks ago
parent
commit
f20249d4a7
1 changed files with 31 additions and 0 deletions
  1. 31 0
      package/busybox/patches/002-hwclock-musl.patch

+ 31 - 0
package/busybox/patches/002-hwclock-musl.patch

@@ -0,0 +1,31 @@
+diff -Nur busybox-1.36.1.orig/util-linux/hwclock.c busybox-1.36.1/util-linux/hwclock.c
+--- busybox-1.36.1.orig/util-linux/hwclock.c	2021-01-01 11:52:27.000000000 +0100
++++ busybox-1.36.1/util-linux/hwclock.c	2024-04-10 11:18:06.569673535 +0200
+@@ -136,10 +136,24 @@
+ 	 * because "it's deprecated by POSIX, therefore it's fine
+ 	 * if we gratuitously break stuff" :(
+ 	 */
+-#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
+-# define SYS_settimeofday SYS_settimeofday_time32
+-#endif
++# if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
++#  define SYS_settimeofday SYS_settimeofday_time32
++# endif
++# if defined(SYS_settimeofday)
+ 	int ret = syscall(SYS_settimeofday, NULL, tz);
++# else
++	/* Some new architectures have neither settimeofday nor
++	 * settimeofday_time32, and the whole kernel timezone handling appears
++	 * to have been dropped due to some oddities in the API.  See:
++	 *
++	 *   - glibc's commit c3f9aef063 ("Use clock_settime to implement settimeofday.")
++	 *   - https://github.com/systemd/systemd/issues/13305
++	 *   - https://inbox.sourceware.org/libc-alpha/cb015d0d1d29e4b948c7118c5b12ff2bed83a6ec.1561421042.git.alistair.francis@wdc.com/
++	 *
++	 * So instead just silently drop these calls.
++	 */
++	int ret = -ENOSYS;
++# endif
+ #else
+ 	int ret = settimeofday(NULL, tz);
+ #endif