自動開機

  1. 檢查核心是否支援 RTC,顯示說明如下:
    1. rtc_time:目前格林威治標準時間 (GMT: Greenwich Mean Time),台灣必須加 8 小時;
    2. rtc_date:目前的 rtc 日期;
    3. alarm_time:設定開機的時間;
    4. alarm_date:設定開機的日期;
    5. alarm_IRQ:是否有設定鬧鐘,目前為 no,表示沒有設定自動開機,若有設定成功,這項會變成 yes。
    [root@dywH ~]# cat /proc/driver/rtc
    rtc_time	: 08:28:40
    rtc_date	: 2015-04-04
    alrm_time	: 14:52:17
    alrm_date	: ****-**-**
    alarm_IRQ	: no
    alrm_pending	: no
    24hr		: yes
    periodic_IRQ	: no
    update_IRQ	: no
    HPET_emulated	: yes
    DST_enable	: no
    periodic_freq	: 1024
    batt_status	: okay
    
  2. 將自動開機時間的時間戳 (timestamp) 寫入 /sys/class/rtc/rtc0/wakealarm。
    [root@dywH ~]# date +%s -d "now + 30minutes" | tee /sys/class/rtc/rtc0/wakealarm
    1428139354
    
  3. 查看 /sys/class/rtc/rtc0/wakealarm。
    [root@dywH ~]# cat /sys/class/rtc/rtc0/wakealarm
    1428139354
    
  4. 再查看 RTC,自動開機時間為 09:22:34 (台灣加 8 小時),日期為 2015-04-04,alarm_IRQ 已變成 yes,
    [root@dywH ~]# cat /proc/driver/rtc
    rtc_time	: 08:54:24
    rtc_date	: 2015-04-04
    alrm_time	: 09:22:34
    alrm_date	: 2015-04-04
    alarm_IRQ	: yes
    alrm_pending	: no
    24hr		: yes
    periodic_IRQ	: no
    update_IRQ	: no
    HPET_emulated	: yes
    DST_enable	: no
    periodic_freq	: 1024
    batt_status	: okay
    
  5. 準備關機,當然是正常關機,不要直接關掉電源,看看時間到會不會自動開機。