mc146818rtc: Update the Day of Week in CMOS in the right way.
The range of weekday in CMOS is 01-07, while the Sunday is 1, and Saturday is 7. The comand date in coreutils defines %u day of week (1..7); 1 is Monday %w day of week (0..6); 0 is Sunday There are 1 day offset for each week day. So we use "%w" and plus 1 before we update the weekday in CMOS. Change-Id: I3fab4e95f04924ff0ba10a7012b57da1d3f0d1a5 Signed-off-by: Zheng Bao <zheng.bao@amd.com> Signed-off-by: zbao <fishbaozi@gmail.com> Reviewed-on: http://review.coreboot.org/1802 Tested-by: build bot (Jenkins) Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
parent
2799e3f750
commit
094920ddd3
|
@ -182,7 +182,7 @@ $(obj)/build.h: .xcompile
|
|||
printf "#define COREBOOT_BUILD_YEAR `LANG= date +"%-y"`\n" >> $(obj)/build.ht
|
||||
printf "#define COREBOOT_BUILD_MONTH `LANG= date +"%-m"`\n" >> $(obj)/build.ht
|
||||
printf "#define COREBOOT_BUILD_DAY `LANG= date +"%-d"`\n" >> $(obj)/build.ht
|
||||
printf "#define COREBOOT_BUILD_WEEKDAY `LANG= date +"%-u"`\n" >> $(obj)/build.ht
|
||||
printf "#define COREBOOT_BUILD_WEEKDAY `LANG= date +"%-w"`\n" >> $(obj)/build.ht
|
||||
printf "#define COREBOOT_DMI_DATE \"`LANG= date +"%m/%d/%Y"`\"\n" >> $(obj)/build.ht
|
||||
printf "\n" >> $(obj)/build.ht
|
||||
printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.ht
|
||||
|
|
|
@ -87,7 +87,7 @@ static void rtc_update_cmos_date(u8 has_century)
|
|||
cmos_write(0, RTC_CLK_SECOND);
|
||||
cmos_write(0, RTC_CLK_MINUTE);
|
||||
cmos_write(1, RTC_CLK_HOUR);
|
||||
cmos_write(RTC_TO_BCD(COREBOOT_BUILD_WEEKDAY), RTC_CLK_DAYOFWEEK);
|
||||
cmos_write(RTC_TO_BCD(COREBOOT_BUILD_WEEKDAY) + 1, RTC_CLK_DAYOFWEEK);
|
||||
cmos_write(RTC_TO_BCD(COREBOOT_BUILD_DAY), RTC_CLK_DAYOFMONTH);
|
||||
cmos_write(RTC_TO_BCD(COREBOOT_BUILD_MONTH), RTC_CLK_MINUTE);
|
||||
cmos_write(RTC_TO_BCD(COREBOOT_BUILD_YEAR), RTC_CLK_YEAR);
|
||||
|
|
Loading…
Reference in New Issue