NotePublic/Ecology/LubanCat2/LubanCat2_Linux_Lite_配置.md

246 lines
9.1 KiB
Markdown
Raw Normal View History

# LubanCat2 Linux Lite 配置
```bash
cd /etc/systemd/network
sudo touch usb0.network
sudo vim usb0.network
```
```usb0.network
[Match]
Name=usb0
[Network]
Address=192.168.137.2/24
Gateway=192.168.137.1
DNS=114.114.114.114
```
```bash
sudo systemctl enable systemd-networkd
sudo systemctl disable NetworkManager
vim ~/.bashrc
```
```bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Codespaces bash prompt theme
__bash_prompt() {
PS1='${debian_chroot:+($debian_chroot)}\[\033[00m\][\[\033[0;32m\]\u\[\033[00m\]:\[\033[1;31m\]\h\[\033[00m\]] \[\033[1;34m\]\W\[\033[00m\]\$ '
unset -f __bash_prompt
}
__bash_prompt
export PROMPT_DIRTRIM=4
export GOPATH=/home/cat/go
# export GOPATH=/root/go
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:/go/bin/:$PATH
```
```bash
cd /boot/
sudo ln -sf dtb/rk3568-lubancat-2io.dtb rk-kernel.dtb
cd /boot/uEnv/
sudo ln -sf uEnvLubanCat2IO.txt uEnv.txt
ssh-keygen
touch ~/.ssh/authorized_keys
su
ssh-keygen
touch ~/.ssh/authorized_keys
```
```authorized_keys
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBcDkSuBJ+MYBB/b48FMSSWbsnHMHX4/Al94pINz9g2rR1wA5i+0uFNZRIkRNMkiwaRGeWHnL9GYQD44MHh5gjg= cy187@LAPTOP-I7CCLQLD
```
![Logo](./img/LubanCat2_Linux_Lite_配置/logo.bmp)
```bash
# 关闭/恢复图形显示器虚拟终端字符登录界面。
sudo systemctl mask getty@tty1.service
sudo systemctl unmask getty@tty1.service
su root
tar -xvf go1.22.4.linux-arm64.tar.gz
mv go /
2024-07-05 11:20:01 +08:00
mkdir ~/go
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn
go install github.com/ramya-rao-a/go-outline@latest
go install github.com/go-delve/delve/cmd/dlv@latest
go install github.com/mdempsky/gocode@latest
go install github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest
go install github.com/rogpeppe/godef@latest
go install github.com/sqs/goreturns@latest
go install github.com/cweill/gotests/gotests@latest
go install github.com/fatih/gomodifytags@latest
go install github.com/josharian/impl@latest
go install github.com/haya14busa/goplay/cmd/goplay@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/tools/gopls@latest
go install golang.org/x/tools/cmd/godoc@latest
go install golang.org/x/tools/cmd/goimports@latest
```
```bash
sudo apt install qt5dxcb-plugin qtchooser qtltools qtgstreamer-plugins-qt5 qtvirtualkeyboard-plugin libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5gstreamer-1.0-0 libqt5gstreamerquick-1.0-0 libqt5gstreamerui-1.0-0 libqt5gstreamerutils-1.0-0 libqt5multimediawidgets5 libqt5multimediaquick5 libqt5multimedia5 libqt5quick5 libqt5qml5 libqt5printsupport5 libqt5quickcontrols2-5 libqt5quickwidgets5 libqt5serialport5 libqt5serialbus5-plugins libqt5serialbus5-bin libqt5serialbus5 qml-module-qtmultimedia libqt5xml5 libqt5core5a libqt5network5 libqt5gui5 libqt5quickparticles5 libqt53dquickextras5 libqt53dquickinput5 libqt5positioningquick5 libqt53dquickrender5 libqt53dquickscene2d5 libqt5virtualkeyboard5 qml-module-qtquick-virtualkeyboard qml-module-qtquick-window2 qml-module-qtquick-shapes qml-module-qtquick-scene2d qml-module-qtquick-privatewidgets qml-module-qtquick-localstorage qml-module-qtquick-extras qml-module-qtquick-dialogs qml-module-qtquick-controls2 qml-module-qtquick-controls qml-module-qt-labs-calendar qml-module-qt-labs-folderlistmodel qml-module-gsettings1.0 qml-module-qmltermwidget qml-module-qt-labs-folderlistmodel qml-module-qt-labs-location qml-module-qt-labs-platform qml-module-qt-labs-qmlmodels qml-module-qt-labs-settings qml-module-qt-labs-sharedimage qml-module-qtcharts qml-module-qtmultimedia qml-module-qtlocation qml-module-qtpositioning qml-module-qtqml-statemachine libssl-dev libprotobuf-c-dev libprotobuf-c1 protobuf-c-compiler protobuf-compiler libqt5waylandclient5 libqt5waylandcompositor5 qtwayland5 gstreamer1.0-plugins-base-apps gstreamer1.0-libav libgstreamer-plugins-bad1.0-0 gstreamer1.0-qt5 gstreamer1.0-plugins-ugly gstreamer1.0-plugins-good gstreamer1.0-plugins-bad libasound2 libasound2-data libasound2-dev libasound2-plugin-equal libasound2-plugins libasound2-plugins-extra alsaplayer-alsa alsa-tools alsa-topology-conf alsa-utils alsa-firmware-loaders alsa-base gstreamer1.0-alsa libgstreamermm-1.0-dev libgstreamermm-1.0-1 libgstreamer1.0-dev libgstreamer1.0-0 gstreamer1.0-tools gstreamer1.0-gl libxcb-xfixes0
sudo apt install qt5-qmake qtbase5-dev qtbase5-dev-tools qtdeclarative5-dev qtdeclarative5-dev-tools qtconnectivity5-dev qtlocation5-dev qtquickcontrols2-5-dev qtscript5-dev libqt5gstreamer-dev libqt5serialport5-dev libqt5xdg-dev libqt5xmlpatterns5-dev libqt5serialbus5-dev qtmultimedia5-dev libqt5virtualkeyboard5-dev qtwayland5-private-dev libqt5waylandclient5-dev libqt5waylandcompositor5-dev qtwayland5-dev-tools qtbase5-private-dev libxcb-xfixes0-dev
sudo apt install git cmake qtdeclarative5-doc qtscript5-doc qtmultimedia5-doc qtconnectivity5-doc qtgstreamer-doc qtlocation5-doc qtquickcontrols2-5-doc
sudo dpkg -i gstreamer1.0-rockchip1_1.14-4_arm64.deb
```
其中 [gstreamer1.0-rockchip1_1.14-4_arm64.deb](./img/LubanCat2_Linux_Lite_配置/gstreamer1.0-rockchip1_1.14-4_arm64.deb) 在 \<rk356x sdk\>/ubuntu/packages/arm64/gst-rkmpp/ 目录下获得。
```bash
cd /usr/share/fonts
2024-07-05 11:20:01 +08:00
sudo mkdir haoan
cd haoan
sudo cp HARMONYOS_SANS_SC_* /usr/share/fonts/haoan
sudo chmod 644 *
sudo mkfontdir
sudo mkfontscale
sudo fc-cache
```
```bash
sudo apt install ./nats-server-v2.9.21-arm64.deb
# 编译 nats.c
tar -xvf nats.c-3.6.1.tar.gz
cd nats.c-3.6.1
cmake .
make -j4
sudo make install
sudo ldconfig
sudo systemctl start haoan-hostcore
sudo systemctl enable haoan-hostcore
sudo systemctl start haoan-nats
sudo systemctl enable haoan-nats
sudo ./XiaYu -platform linuxfb:fb=/dev/fb0:mmsize=1024x600 -plugin evdevtouch:/dev/input/event2
sudo systemctl start haoan-xiayu
sudo systemctl enable haoan-xiayu
```