请问怎么让D1的Linux log 显示 CST 时间呢?而不是UTC时间。
-
[ 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北京时间呢?
-
同问 同问 同问
-
Linux这个时间是
KBUILD_BUILD_TIMESTAMP
,按照文档它默认输出就是一个UTC时间,改输出应该是可以的(? -
KBUILD_BUILD_TIMESTAMP 怎么改成 CST+8 时区?
-
$ 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
-
改成这样 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:/#
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号