做者:彭東林
linux
郵箱:pengdonglin137@163.comgit
https://gist.github.com/tessus/5e118d44261a6ab2f198github
Qemu-4.1spa
Linux-4.14調試
ARM64code
aarch64-linux-gnu-gcc 8.3blog
在進行嵌入式開發時,常常會用到串口,這樣就可使用串口來登陸到板子上,若是能將一個串口複用爲多個終端的話,對於咱們的開發調試就會更加方便,而tmux就提供了這樣的功能。unicode
下面介紹tmux如何靜態交叉編譯,使其運行在arm開發板上。開發
tmux-2.1get
libevent:2.1.10
ncurses-6.1
交叉編譯tmux須要libevent和ncurses兩個軟件包。
一、下載libevent:https://github.com/libevent/libevent/releases/download/release-2.1.10-stable/libevent-2.1.10-stable.tar.gz
二、解壓和交叉編譯,下面是編譯腳本:
1 ./configure --prefix=`pwd` \ 2 --host=aarch64-linux-gnu \ 3 --disable-shared 4 5 make 6 make install
一、下載ncurses: https://ftp.gnu.org/gnu/ncurses/ncurses-6.1.tar.gz
二、解壓和交叉編譯,下面是編譯腳本:
1 ./configure --prefix=`pwd` \ 2 --host=aarch64-linux-gnu \ 3 --with-default-terminfo-dir=/usr/share/terminfo \ 4 --with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" 5 6 make 7 make install
一、下載tmux:https://github.com/tmux/tmux/releases/download/2.1/tmux-2.1.tar.gz
二、解壓和交叉編譯,下面是編譯腳本:
1 export CFLAGS="-I/home/pengdl/work/Third_Part/tmux/libevent-2.1.10-stable/include/ \ 2 -I/home/pengdl/work/Third_Part/tmux/ncurses-6.1/include \ 3 -I /home/pengdl/work/Third_Part/tmux/ncurses-6.1/include/ncurses" 4 5 export LDFLAGS="--static -L/home/pengdl/work/Third_Part/tmux/libevent-2.1.10-stable/lib/ \ 6 -L/home/pengdl/work/Third_Part/tmux/ncurses-6.1/lib" 7 8 ./configure --prefix=`pwd` \ 9 --host=aarch64-linux-gnu \ 10 --enable-static
上面就完成了交叉編譯,而後將tmux可執行程序
將terminfo配置文件拷貝到開發板上,能夠只拷貝實際要用的:
# 在跟文件系統裏建立以下目錄 cd rootfs/ mkdir -p usr/share/terminfo/ # 拷貝PC上的terminfo文件 cp /lib/terminfo/* usr/share/terminfo/ -raf
下面是可用的TERM配置:
$ tree usr/share/terminfo/ usr/share/terminfo/ ├── a │ └── ansi ├── c │ ├── cons25 │ ├── cons25-debian │ └── cygwin ├── d │ └── dumb ├── E │ ├── Eterm │ └── Eterm-color -> Eterm ├── h │ └── hurd ├── l │ └── linux ├── m │ ├── mach │ ├── mach-bold │ ├── mach-color │ ├── mach-gnu │ └── mach-gnu-color ├── p │ └── pcansi ├── r │ ├── rxvt │ ├── rxvt-basic │ ├── rxvt-m -> rxvt-basic │ ├── rxvt-unicode │ └── rxvt-unicode-256color ├── s │ ├── screen │ ├── screen-256color │ ├── screen-256color-bce │ ├── screen-bce │ ├── screen-s │ ├── screen-w │ ├── screen.xterm-256color │ └── sun ├── v │ ├── vt100 │ ├── vt102 │ ├── vt220 │ └── vt52 ├── w │ ├── wsvt25 │ └── wsvt25m └── x ├── xterm ├── xterm-256color ├── xterm-color ├── xterm-debian -> xterm ├── xterm-mono ├── xterm-r5 ├── xterm-r6 ├── xterm-vt220 └── xterm-xfree86 13 directories, 43 files
[root@aarch64 ]# echo $TERM vt102
能夠根據本身的喜愛,選擇相應的配置,我的感受linux配置不過,設置方法:
export TERM=linux
stty rows 30 cols 120
能夠根據實際狀況修改終端大小。查看當前終端大小:stty size 或者 stty -a
[root@aarch64 ]# stty rows 30 cols 120 [root@aarch64 ]# stty size 30 120
tmux new -s wk
完。