1e41f4b71Sopenharmony_ci# dmesg 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## 命令功能 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_cidmesg命令用于显示开机信息,以及系统启动过程和运行过程中的信息。 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## 命令格式 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_cidmesg 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_cidmesg [_-c/-C/-D/-E/-L/-U_] 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_cidmesg -s [_size_] 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_cidmesg -l [_level_] 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_cidmesg > [_fileA_] 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci## 参数说明 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci**表1** 参数说明 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci| 参数 | 参数说明 | 取值范围 | 27e41f4b71Sopenharmony_ci| --------------- | ---------------------------------------- | --------------- | 28e41f4b71Sopenharmony_ci| -c | 打印缓存区内容并清空缓存区。 | N/A | 29e41f4b71Sopenharmony_ci| -C | 清空缓存区。 | N/A | 30e41f4b71Sopenharmony_ci| -D/-E | 关闭/开启控制台打印。 | N/A | 31e41f4b71Sopenharmony_ci| -L/-U | 关闭/开启串口打印。 | N/A | 32e41f4b71Sopenharmony_ci| -s size | 设置缓存区大小 size是要设置的大小。 | N/A | 33e41f4b71Sopenharmony_ci| -l level | 设置缓存等级。 | [0, 5] | 34e41f4b71Sopenharmony_ci| > fileA | 将缓存区内容重定向写入文件。 | N/A | 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci## 使用指南 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci- 该命令依赖于LOSCFG_SHELL_DMESG,在kernel/liteos_a中输入make menuconfig命令。此时会弹出配置项,找到Debug选项并进入,然后在配置项中开启"Enable Shell dmesg": 40e41f4b71Sopenharmony_ci Debug ---> Enable a Debug Version ---> Enable Shell ---> Enable Shell dmesg 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci- dmesg参数缺省时,默认打印缓存区内容。 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci- 各“ - ”选项不能混合使用。 45e41f4b71Sopenharmony_ci 1. 写入文件需确保已挂载文件系统。 46e41f4b71Sopenharmony_ci 2. 关闭串口打印会影响shell使用,建议先连接telnet再尝试关闭串口。 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci## 使用实例 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci举例:输入dmesg > dmesg.log。 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci## 输出说明 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci**示例** dmesg重定向到文件 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci``` 59e41f4b71Sopenharmony_ciOHOS # dmesg > dmesg.log 60e41f4b71Sopenharmony_ciDmesg write log to dmesg.log success 61e41f4b71Sopenharmony_ci```