3.7 KiB
3.7 KiB
技术点记录
ubuntu 24 开机慢优化
# 在 systemd-networkd-wait-online.service Service 加入 TimeoutStartSec=2sec
sudo EDITOR=vim systemctl edit systemd-networkd-wait-online.service
# 在打开的编辑器中添加:
# [Service]
# TimeoutStartSec=2sec
配置时区
sudo timedatectl set-timezone Asia/Shanghai
linux 下播放音频
sudo apt install libasound2-dev alsa-utils
linux 下播放视频
sudo apt install libvlc-dev vlc
显示安装
sudo apt install xorg
当前用户加入播放音频与视频的组中
sudo usermod -aG audio,video,dialout $USER
关闭背光
# xorg 环境,关闭背光
xset dpms force off
# xorg 环境,重新打开背光
xset dpms force on
注册为 service ,并开机启动
sudo cp /script/game-driver.service /etc/systemd/system/
sudo systemctl enable game-driver
sudo systemctl start game-driver
编译 arm64 架构
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -o game-driver-arm64 .
J8引脚
J8:
3V3 (1) (2) 5V
GPIO2 (3) (4) 5V
GPIO3 (5) (6) GND
GPIO4 (7) (8) GPIO14
GND (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND
GPIO22 (15) (16) GPIO23
3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND
GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8
GND (25) (26) GPIO7
GPIO0 (27) (28) GPIO1
GPIO5 (29) (30) GND
GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
GND (39) (40) GPIO21
极简桌面环境并自动登录
安装 xorg i3
sudo apt install xorg i3-wm
自动启动 Xorg 和窗口管理器
编辑 .bashrc文件,在文件的末尾添加以下行:
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
startx
fi
这会在你登录后,自动启动 Xorg 和窗口管理器。该脚本检查当前是否在 tty1 控制台(默认终端)上
自动登录
使用 systemctl edit 修改 getty@tty1 服务:
sudo EDITOR=vim systemctl edit getty@tty1.service
# 在打开的编辑器中添加:
# [Service]
# ExecStart=
# ExecStart=-/sbin/agetty --autologin <your_username> --noclear %I $TERM
其中:
- <your_username>:替换为你想自动登录的用户名。
禁用 i3bar 状态栏
编辑 ~/.config/i3/config,将如下行注释掉:
# bar {
# status_command i3status
# }
如果没有 ~/.config/i3/config 文件,需要重启系统,进入 i3 后,根据提示创建默认的配置文件
配置 i3
安装 unclutter:
sudo apt install unclutter
编辑 ~/.config/i3/config,添加如下行:
exec --no-startup-id unclutter -root # 隐藏鼠标
exec --no-startup-id xset dpms 0 0 0 # 关闭屏幕自动关闭
exec --no-startup-id xset s off # 关闭屏幕保护
不使用 xset -dpms 来禁用屏幕自动关闭,因为当使用 xset dpms force off 或 xset dpms force on 时,会导致禁用失效
安装中文字体和 emoji 字体
sudo apt install fonts-noto-cjk fonts-noto-color-emoji
安装浏览器作为默认启动页面
安装浏览器
sudo add-apt-repository ppa:xtradeb/apps
sudo apt install ungoogled-chromium
设置默认启动页面
编辑 ~/.config/i3/config,添加如下行:
exec --no-startup-id ungoogled-chromium --kiosk --disable-extensions --disable-translate --app=<your_url>
设置系统默认音量
输入命令 alsamixer 进入音量控制界面,调节 master 后,按 esc 退出
然后输入 sudo alsactl store 保存音量设置