Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    请问怎么让D1的Linux log 显示 CST 时间呢?而不是UTC时间。

    MR Series
    4
    6
    2133
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      memory LV 7 last edited by

      [ 0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000
      [ 0.000000] Linux version 5.4.61 (memory@ubuntu) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #357 PREEMPT Tue Jan 18 09:18:31 UTC 2022
      [ 0.000000] cma: Reserved 8 MiB at 0x0000000043800000

      $ date

      Tue Jan 18 17:35:49 CST 2022

      请问怎么让D1的Linux log 显示 CST北京时间呢?

      1 Reply Last reply Reply Quote Share 0
      • tigger
        tigger LV 7 last edited by

        同问 同问 同问

        1 Reply Last reply Reply Quote Share 0
        • YuzukiTsuru
          柚木 鉉 LV 9 last edited by YuzukiTsuru

          Linux这个时间是KBUILD_BUILD_TIMESTAMP,按照文档它默认输出就是一个UTC时间,改输出应该是可以的(?

          KBUILD_BUILD_TIMESTAMP

          314d6cd1-e74c-4b6d-a1b6-998ca4761c65-image.png

          S 1 Reply Last reply Reply Quote Share 1
          • S
            smartcar LV 2 last edited by

            KBUILD_BUILD_TIMESTAMP 怎么改成 CST+8 时区?

            1 Reply Last reply Reply Quote Share 0
            • S
              smartcar LV 2 @YuzukiTsuru last edited by

              @yuzukitsuru

              $ repo diff lichee/linux-5.4/scripts/mkcompile_h
              
              project lichee/linux-5.4/
              diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
              index 4578e413b..9227c01e1 100755
              --- a/scripts/mkcompile_h
              +++ b/scripts/mkcompile_h
              @@ -36,7 +36,7 @@ else
               fi
              
               if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
              -       TIMESTAMP=`date`
              +       TIMESTAMP=`date +%Y%m%d%H%M%S`
               else
                      TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
               fi
              

              搞定了:

              root@TinaLinux:/# cat /proc/version
              Linux version 5.4.61 (smartcar@ubuntu) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #2 PREEMPT 20220310023542
              root@TinaLinux:/#
              root@TinaLinux:/#
              root@TinaLinux:/#
              root@TinaLinux:/#
              root@TinaLinux:/#
              

              应该是改这个 shell 指令了, 20220310023542 还是 UTC 时间, 我去查查怎么改成 CST+8

              1 Reply Last reply Reply Quote Share 0
              • S
                smartcar LV 2 last edited by whycan

                改成这样 TIMESTAMP=TZ=UTC-8 date +"%Y-%m-%d %H:%M:%S" 搞定:

                $ repo diff lichee/linux-5.4/scripts/mkcompile_h
                
                project lichee/linux-5.4/
                diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
                index 4578e413b..f861eed94 100755
                --- a/scripts/mkcompile_h
                +++ b/scripts/mkcompile_h
                @@ -36,7 +36,7 @@ else
                 fi
                
                 if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
                -       TIMESTAMP=`date`
                +       TIMESTAMP=`TZ=UTC-8 date +"%Y-%m-%d %H:%M:%S"`
                 else
                        TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
                 fi
                

                正常了:

                root@TinaLinux:/#
                root@TinaLinux:/# cat /proc/version
                Linux version 5.4.61 (smartcar@ubuntu) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #3 PREEMPT 2022-03-10 10:50:30
                root@TinaLinux:/#
                
                1 Reply Last reply Reply Quote Share 0
                • 1 / 1
                • First post
                  Last post

                Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                行为准则 | 用户协议 | 隐私权政策