OSDN Git Service

init: fix localtime_r not work in /init
authorMa Jian <majian@jidemail.com>
Sun, 12 Jun 2016 07:25:43 +0000 (15:25 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 27 Jun 2016 09:10:20 +0000 (17:10 +0800)
There is no ANDROID_ROOT environment variable set in /init so that
localtime_r doesn't work because it cannot find the correct tzdata
file under /system.

NO_REF_TASK
Tested:
1) make sure persist.rtc_local_time is 1
2) make sure sysclktz 1 in init.rc
3) set local time in android and reboot to bios, bios should have
   local time
4) reboot back to android, the system time should be correct in
   local time (even network time sync is not available)

Change-Id: I762b8d9a8923e4a4bf58fcafe347b2708a1c8736

initrd/init

index ad2f3f4..6c7adc8 100755 (executable)
@@ -208,6 +208,8 @@ fi
 # since it conflicts with Android's init
 echo > /proc/sys/kernel/hotplug
 
+export ANDROID_ROOT=/system
+
 exec ${SWITCH:-switch_root} /android /init
 
 # avoid kernel panic