neofetch 介绍
neofetch 是一款用于在终端中显示系统信息的工具,其主要特点是以美观的方式展示宿主机的基本信息。它通常用于展示系统的分发版本、内核版本、硬件信息、桌面环境,以及一些个性化的设置,配合 ASCII 艺术风格的 logo,使得屏幕显得更加引人注目。
主要功能和特点:
- 系统信息展示:显示操作系统、内核版本、CPU、内存使用情况、包管理器等。
- 图形化的艺术字:能够显示与所用操作系统相对应的 ASCII 艺术 logo。
- 自定义选项:用户可以通过配置文件进行个性化设置,选择显示的信息、颜色等。
- 轻量级:非常轻量,启动速度快,不对系统性能造成影响。
- 支持多种平台:支持大部分 Linux 发行版、macOS 和其他 Unix-like 系统。
neofetch 安装
bash
apt install -y neofetch # 或者
dnf install -y neofetch
neofetch 输出
我这是一台RISC-V架构荔枝派4A
neofetch 源码
https://github.com/dylanaraps/neofetch/blob/master/neofetch
查看源码后,发现是这部分获取的Host信息
逐个尝试后,发现荔枝派4A用的是 /sys/firmware/devicetree/base/model
bash
get_model() {
case $os in
Linux)
if [[ -d /system/app/ && -d /system/priv-app ]]; then
model="$(getprop ro.product.brand) $(getprop ro.product.model)"
elif [[ -f /sys/devices/virtual/dmi/id/board_vendor ||
-f /sys/devices/virtual/dmi/id/board_name ]]; then
model=$(< /sys/devices/virtual/dmi/id/board_vendor)
model+=" $(< /sys/devices/virtual/dmi/id/board_name)"
elif [[ -f /sys/devices/virtual/dmi/id/product_name ||
-f /sys/devices/virtual/dmi/id/product_version ]]; then
model=$(< /sys/devices/virtual/dmi/id/product_name)
model+=" $(< /sys/devices/virtual/dmi/id/product_version)"
elif [[ -f /sys/firmware/devicetree/base/model ]]; then
model=$(< /sys/firmware/devicetree/base/model)
elif [[ -f /tmp/sysinfo/model ]]; then
model=$(< /tmp/sysinfo/model)
fi
;;
...
修改Host描述
需要修改的文件位于 arch/riscv/boot/dts/thead/th1520-lpi4a-dsi0.dts
c
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2022-2023 Alibaba Group Holding Limited.
*/
#include "th1520-lpi4a.dtsi"
/ {
model = "T-HEAD Light Lichee Pi 4A configuration for 8GB DDR board"; # 这行需要修改
compatible = "thead,light-val", "thead,light-lpi4a", "thead,light";
memory@0 {
device_type = "memory";
reg = <0x0 0x200000 0x1 0xffe00000>;
};
vcc1v8_lontium: vcc1v8-lontium {
compatible = "regulator-fixed";
enable-active-high;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
gpio = <&gpio3_porta 17 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&vcc1v8_lontium_pwren>;
regulator-name = "vcc1v8-lontium";
};
vcc3v3_edp: vcc3v3-edp {
compatible = "regulator-fixed";
enable-active-high;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&gpio2_porta 18 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&vcc3v3_edp_pwren>;
regulator-name = "vcc3v3-edp";
};
};
&cmamem {
size = <0 0x20000000>; // 512MB on lpi4a (SOM)
alloc-ranges = <0 0xd8000000 0 0x20000000>; // [0x0D800_0000 ~ 0x0F800_0000]
};
&i2c3 {
clock-frequency = <400000>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
lt8911i2c: lt8911i2c@29{
compatible = "i2c,lt8911";
reg = <0x29>;
};
};
&dsi0 {
status = "okay";
};
&dhost_0 {
panel0@0 {
compatible = "i2c_dsi,lt8911";
reg = <0>;
lt8911,backlight-gpio = <&gpio2_porta 20 GPIO_ACTIVE_HIGH>;
lt8911,irq-gpio = <&gpio3_porta 16 GPIO_ACTIVE_LOW>;
lt8911,reset-gpio = <&gpio3_porta 15 GPIO_ACTIVE_LOW>;
lt8911,rst-delay-ms = <10>;
lt8911,edp-lane-cnt = <2>;
lt8911,mipi-lane-cnt = <4>;
lt8911,edp-depth = <8>; /* 6 or 8 */
pinctrl-names = "default";
pinctrl-0 = <<8911exb_gpios>;
hsvcc-supply = <&vcc1v8_lontium>;
vspn3v3-supply = <&vcc3v3_edp>;
port {
panel0_in: endpoint {
remote-endpoint = <&dsi0_out>;
};
};
};
};
&padctrl0_apsys { /* right-pinctrl */
light-evb-padctrl0 {
/*
* Pin Configuration Node:
* Format: <pin_id mux_node config>
*/
pinctrl_i2c3: i2c3grp {
thead,pins = <
FM_I2C3_SCL LIGHT_PIN_FUNC_0 0x204
FM_I2C3_SDA LIGHT_PIN_FUNC_0 0x204
>;
};
lt8911exb_gpios: lt8911exb-gpios {
thead,pins = <
FM_GPIO2_20 LIGHT_PIN_FUNC_0 0x208
FM_GMAC0_RXD1 LIGHT_PIN_FUNC_3 0x0
FM_GMAC0_RXD0 LIGHT_PIN_FUNC_3 0x208
>;
};
vcc1v8_lontium_pwren: vcc1v8-lontium-pwren {
thead,pins = <
FM_GMAC0_RXD2 LIGHT_PIN_FUNC_3 0x208
>;
};
vcc3v3_edp_pwren: vcc3v3-edp-pwren {
thead,pins = <
FM_GPIO2_18 LIGHT_PIN_FUNC_0 0x208
>;
};
dsi_reset_gpio: dsi-reset-gpio {
thead,pins = <
FM_GPIO2_22 LIGHT_PIN_FUNC_0 0x0
>;
};
};
};
修改完以后重新编译内核就可以了。
谢谢大家