




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
fs2410 Linux-2.6.35 内核移植中的 RTC 问题 -drivers/rtc/hctosys.c: unable to open rtc device (rtc0) linux-2.6.35 在 fs2410 开发板启动后,通过 nfs 挂载文件系统,但是 rtc 不能用, 也会在挂载文件系统之前打印如下提示信息: TCP cubic registered NET: Registered protocol family 1 RPC: Registered udp transport module. RPC: Registered tcp transport module. drivers/rtc/hctosys.c: unable to open rtc device (rtc0) IP-Config: Complete: device=eth0, addr=192.168.20.253, mask=255.255.255.0, gw=192.168.20.1, host=thomas_fs2410, domain=, nis-domain=(none), bootserver=192.168.20.192, rootserver=192.168.20.192, rootpath= Looking up port of RPC 100003/2 on 192.168.20.192 Looking up port of RPC 100005/1 on 192.168.20.192 VFS: Mounted root (nfs filesystem). Mounted devfs on /dev Freeing init memory: 184K 解决方案: 1. 内核配置选项 - Real Time Clock * Set system time from RTC on startup and resume (rtc0) RTC used to set the system time RTC debug support * RTC interfaces * * /sys/class/rtc/rtcN (sysfs) * /dev/rtcN (character devices) RTC UIE emulation on dev interface * on-CPU RTC drivers * Samsung S3C series SoC RTC 2. linux kernel 中 已经支持 S3C2410 的 RTC,但是并没有添加到平台设备初 始化数组中,所以系统启动时并不会初始化这一部分,需要修改文件 mach-smdk.c static struct platform_device *smdk2410_devices _initdata = 3. 创建设备节点,在文件系统/dev 目录下执行: sudo mknod rtc c 10 135 4. 重新编译内核,查看启动信息 S3C24XX RTC, (c) 2004,2006 Simtec Electronics s3c-rtc s3c2410-rtc: rtc disabled, re-enabling s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0 这里说明 rtc 驱动起来可以正常工作了 S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled No device for DAI UDA134X No device for DAI s3c24xx-i2s ALSA device list: No soundcards found. TCP cubic registered NET: Registered protocol family 17 s3c-rtc s3c2410-rtc: hctosys: invalid date/time 以上信息说明当前 RTC 时间 invalid , RTC 初始时间为 Wed Dec 31 23:59:59 1969 ; 从内核函数 int rtc_valid_tm(struct rtc_time *tm) ,可以看出,当 year 小于 1970 时, 认为是时间 invalid ,函数返回 -EINVAL ; drivers/rtc/rtc-lib.c /* * Does the rtc_time represent a valid date/time? */ int rtc_valid_tm(struct rtc_time *tm) if (tm-tm_year tm_mon) = 12 | tm-tm_mday tm_mday rtc_month_days(tm-tm_mon, tm-tm_year + 1900) | (unsigned)tm-tm_hour) = 24 | (unsigned)tm-tm_min) = 60 | (unsigned)tm-tm_sec) = 60) return -EINVAL; return 0; EXPORT_SYMBOL(rtc_valid_tm); 下面来验证一下这个想法 # hwclock Wed Dec 31 23:59:59 1969 0.000000 seconds # date Thu Jan 1 00:06:58 UTC 1970 系统时间是通过 date 来设置的, RTC 时间是通过 hwclock 来设置的。开机时系统时 间首先通过 RTC 来获得,RTC 没有设置时,系统时间也会使用 Wed Dec 31 23:59:59 1969。 # hwclock -help BusyBox v1.9.2 (2008-04-01 21:32:34 CST) multi-call binary Usage: hwclock -r|-show -s|-hctosys -w|-systohc -l|-localtime -u|-utc -f FILE Query and set a hardware clock (RTC) Options: -r Read hardware clock and print result -s Set the system time from the hardware clock -w Set the hardware clock to the system time -u The hardware clock is kept in coordinated universal time -l The hardware clock is kept in local time -f FILE Use the specified clock (e.g. /dev/rtc2) # hwclock -s hwclock: settimeofday() failed: Invalid argument # hwclock -w s3c2410-rtc s3c2410-rtc: rtc only supports 100 years hwclock: RTC_SET_TIME: Invalid argument 以上错误信息都是因为 year 设置不当引起的。没有设置 RTC , RTC 也不会启动计时。 下面首先设置正确的系统时间,然后将系统时间传递给 RTC 。 # date 040612282008.20 Sun Apr 6 12:28:20 UTC 2008 # hwclock -w # hwclock Sun Apr 6 12:29:01 2008 0.000000 seconds # hwclock Sun Apr 6 12:30:15 2008 0.000000 seconds Ok , RTC 开始工作了! 为了使系统时间和 RTC 时间同步,可以在初始化文件中添加命令 Hwclock s 使每次开机时读取 RTC 时间,并同步给系统时间。 在 etc/init.d/rcS 中添加 /bin/hwclock -s 时间设置的相关命令 1. 在虚拟终端中使用 date 命令来查看和设置系统时间 查看系统时钟的操作: # date 设置系统时钟的操作: # date 091713272003.30 通用的设置格式: # date 月日时分年 . 秒 2. 使用 hwclock 或 clock 命令查看和设置硬件时钟 查看硬件时钟的操作: # hwclock -show 或 # clock -show 2003 年 09 月 17 日 星期三 13 时 24 分 11 秒 -0.482735 seconds 设置硬件时钟的操作: # hwclock -set -date=“09/17/2003 13:26:00“ 或者 # clock -set -date=“09/17/2003 13:26:00“ 通用的设置格式:hwclock/clock -set -date=“ 月/ 日/ 年时:分:秒” 。 3. 同步系统时钟和硬件时钟 Linux 系统( 笔者使用的是 Red Hat 8.0 ,其它系统没有做过实验 ) 默认重启后,硬 件时钟和系统时钟同步。如果不大方便重新启动的话( 服务器通常很少
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 8292-2025浓缩天然胶乳挥发脂肪酸值的测定
- 材料疲劳裂纹扩展模型重点基础知识点
- 高考数学真题总结与答案
- 行政管理的法律风险识别与应对策略试题及答案
- 停车场火灾应急预案编制(3篇)
- 行政管理实践中的法律盲点试题及答案
- 火灾应急预案及程序护理(3篇)
- 信息技术核心概念试题及答案
- 2025年海外市场的战略开发风险试题及答案
- 行政责任追究的实际案例试题及答案
- 医院质控办工作职责、人员岗位职责
- 药品生产质量管理规范(2010版)(含13个附录)
- 高校教学课件:旅游文化学
- 安全主题班会 《防洪防汛知识讲解》教学课件
- DB62∕T 3171-2019 双向螺旋挤土灌注桩技术规程
- 土壤分析技术规范(第二版)
- 论文答辩武汉大学论文答辩开题报告PPT模板
- 推进白洋淀景区运营机制改革实施方案
- 2021年卒中中心建设相关制度及流程汇编
- 机械故障诊断大作业滚动轴承
- 密封件定位套机械加工工艺过程卡片
评论
0/150
提交评论