You are here

Alarms - scheduled CPU wake-up fix for Motorola Milestone + Alarm Tester

Not needed anymore for SHOLS_U2_02.34.3/SHOLS_U2_02.36.0 and newer FW

The kernel of most of the Milestone 2.1 firmware versions has a bug - scheduled alarms are not able to wake the CPU from sleep. When the CPU stops as it enters the sleep state, any scheduled alarm will not wake the CPU at the specified time. All alarms are fired off later, only when another interrupt (other than RTC) wakes the CPU.
Known affected firmware versions: at least SHOLS_U2_02.31, SHOLS_U2_02.34.0
My bug report and the bug confirmation by Motorola: AlarmManager: ELAPSED_REALTIME_WAKEUP & RTC_WAKEUP won't wake up Milestone (system 2.1)

The solution:
It's the boot.img (kernel+init) from the Canadian Telus SHOLS_U2_03.10.0 firmware.
Kernel version: 2.6.29-omap1 rkg683@ca25rhe56 #1

Tested and confirmed to be working perfectly on SHOLS_U2_02.31 and SHOLS_U2_02.34.0 systems.

Known side effects of this fix: When you turn your phone off, it can power-up by itself after some time. Use the Airplane or Silent mode, when you need the phone to not disturb you. Or remove the battery after you power it down. (It's a new bug introduced by the new kernel, but it's much less severe than to have non-reliable alarms and calendar notifications).

UPDATE: The SHOLS_U2_02.34.3/SHOLS_U2_02.36.0 FW update also fixes the wake-up problem (but its kernel is not compatible with the 2.31/2.34.0 system or BPSW).

Method 1 - via ADBRecovery:
Download the boot.img here:
Copy the downloaded boot.img to the root folder of your SDcard, boot to the ADBRecovery and in the ADB shell use:
flash_image boot /sdcard/boot.img

Method 2 - via RSD Lite:
Download the custom SBF containing only the boot.img here:
(here is the link to RSD Lite 4.6)
Boot to Bootloader (D-pad up + power) and flash the SBF using RSD Lite or similar tool.

Everything else than the boot.img (kernel+init) will remain untouched on the phone.
Made with SBF Recalc and hexedit.

This application can be used to check the scheduled CPU wake-up functions.
After installation and reboot, it will schedule two services. One (W) that should wake the CPU from sleep every 30s, and a second one (A) that is not set to wake the CPU, to be run every 10s. The second one checks whether the CPU goes to sleep at all. Both services log every run to AlarmLog.txt created in the root folder of the SD card. If you allow the service to use the su permissions, it will log also the currently active wake-locks to the log file.
If the W entries in the log file are not exactly 30s apart in time, then there is a kernel problem.
Best way to test is to put the phone in the Flight/Airplane mode to eliminate the interrupts from radio, bluetooth or Wi-Fi which could wake the CPU accidentally during testing.

I've used and slightly altered this source code:

Binary Data AlarmTester.apk6.8 KB