LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: dacheng

新编译的内核时钟比计算机快8小时?[已解决]

[复制链接]
发表于 2010-1-15 18:55:34 | 显示全部楼层
Post by dacheng;2064297
谢谢simon22543,原来initrd也可以去掉啊,让我吃了一惊。谢谢d00m3d,下次我试试LZMA。我现在已经到2.8M了。最郁闷的是快8小时的问题始终没有解决。我已经编译了5次了,每次1.5小时啊,要疯了。。。

I do not believe it is a problem with the new kernel.

If your output from the date command is 8 hrs ahead, it should be something incorrect with the time zone or localtime.

Try the followings:

One way to determine the local time zone, run the following script:

[QUOTE]tzselect


After answering a few questions about the location, the script will output the name of the time zone (e.g., America/Edmonton). There are also some other possible timezones listed in /usr/share/zoneinfo such as Canada/Eastern or EST5EDT that are not identified by the script but can be used.

Then create the /etc/localtime file by running:

cp -v --remove-destination /usr/share/zoneinfo/<xxx> \
    /etc/localtime


Replace <xxx> with the name of the time zone selected (e.g., Canada/Eastern).

The meaning of the cp option:


--remove-destination

    This is needed to force removal of the already existing symbolic link. The reason for copying the file instead of using a symlink is to cover the situation where /usr is on a separate partition. This could be important when booted into single user mode.[/QUOTE]

The above is excerpted from the LFS handbook
http://mirror.vtx.ch/lfs/view/development/chapter06/glibc.html

I always correct the system localtime with the above commands.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-15 21:16:01 | 显示全部楼层
hwclock仍然不可用,尝试中。机器也不算太老,是p4m 2.2G。waq说的rtc我会认真看的。至于d00m3d说的问题。我再编译一次试试。因为我现在是东八区,难道说用新内核要重新设时区或localtime?
嗯,这次使用lzma压缩,去掉initrd,把dos、vfat、reaserfs、串口、并口都编译为一个模块,看看大小。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-1-15 21:25:41 | 显示全部楼层
内核相关部分如下:
* Real Time Clock
  •    Set system time from RTC on startup and resume
    (rtc0)  RTC used to set the system time
  •    /sys/class/rtc/rtcN (sysfs)
  •    /proc/driver/rtc (procfs for rtc0)
  •    /dev/rtcN  (character devices)
  •   RTC UIE emulation on dev interface racter devices)
    <*>   PC-style 'CMOS'
    其余选项全部编译为模块
  • 回复 支持 反对

    使用道具 举报

    发表于 2010-1-15 21:30:29 | 显示全部楼层
    If you decided not to use initrd, then you must compile the necessary filesystem supports (e.g. ext3) and hardware supports (e.g. IDE or SATA) into kernel and not as modules.  Otherwise, your system will not boot.
    回复 支持 反对

    使用道具 举报

    发表于 2010-1-15 21:32:36 | 显示全部楼层
    Post by dacheng;2064438
    hwclock仍然不可用,尝试中。机器也不算太老,是p4m 2.2G。waq说的rtc我会认真看的。至于d00m3d说的问题。[color="Red"]我再编译一次试试。因为我现在是东八区,难道说用新内核要重新设时区或localtime?
    嗯,这次使用lzma压缩,去掉initrd,把dos、vfat、reaserfs、串口、并口都编译为一个模块,看看大小。
    You may not need to re-compile a new kernel again to make this change.

    It should always work.  Simply run the compiled kernel and apply these changes.
    回复 支持 反对

    使用道具 举报

     楼主| 发表于 2010-1-15 21:54:43 | 显示全部楼层
    对了,不使用initrd,在使用make-kpkg时就应该不使用--initrd了吧!
    取消上述参数,直接使用sudo make-kpkg kernel_image重新编译内核成功。
    回复 支持 反对

    使用道具 举报

    发表于 2010-1-15 21:57:50 | 显示全部楼层
    You got it.
    回复 支持 反对

    使用道具 举报

     楼主| 发表于 2010-1-15 23:43:42 | 显示全部楼层
    最新进展:
    1、使用lzma压缩算法后,新内核大小为2061920 Byte,而系统自带的内核为2024144 Byte,看来还是有余地的,呵呵。
    2、我相信,rtc部分选项无误 ,因为使用新内核启动时,屏幕上有提示:
        rtc_cmos 00:06 setting system clock 2010-01-15 23:05:32 UTC(1263596733)
    3、这次编译耗时1小时(难道以前不是1.5小时,怎么差这多?)
    4、这次我使用了tzselect命令,重启后仍然无效。
    5、启动中还有一个错误:
    udevd[1088]:inotify-init failed:function not implemented
    error initalizing inotify
    udeved[1088]:error initalizing inofify
    上述错误尚不知如何解决,但并不影响使用
    6、试着删除了/etc/adjtime,重启仍然是快8小时。
    7、reboot时,屏幕输出大量信息,还有大量类似help的输出,如:
    “invalid card number"
    "avaliable option"
    上述信息全部是在单用户模式下输出的
    8、稍后重启试验d00m3d兄给出的关于localtime的命令,结果明天告诉大家。
    感谢大家,特别是d00m3d兄!
    回复 支持 反对

    使用道具 举报

     楼主| 发表于 2010-1-16 08:44:41 | 显示全部楼层
    使用d00m3d兄提供的cp命令并重启后系统时钟仍然快8小时。我怀疑是某些脚本的原因。继续Google。。。。。
    回复 支持 反对

    使用道具 举报

     楼主| 发表于 2010-1-16 09:28:34 | 显示全部楼层
    比较新老内核的config文件的RTC部分,结果是一样的。再次证明和编译内核无关,可能和设置有关。
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    快速回复 返回顶部 返回列表