1. Install the software package
sudo passwd root sudo apt install cmake python2-dev python3-dev build-essential cmake flex bison -y sudo apt install universal-ctags cscope vim git -y sudo apt install python-is-python3 -y sudo apt-get install build-essential libncurses-dev bison flex libssl-dev
2. Download the VIM plug-in manager
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim ~/.vimrc
" ==============vim basic configuration============== set guifont=Monospace\ 14 set nu! "Display line number syntax enable syntax on colorscheme desert set autowrite "automatically save set foldmethod=syntax set foldlevel=100 "Do not automatically fold code when starting vim set textwidth=80 set formatoptions + =t set cindent set smartindent set noerrorbells set showmatch set nobackup set noswapfile " set cursorline " disable noremap <Up> <Nop> noremap <Down> <Nop> noremap <Left> <Nop> noremap <Right> <Nop> " remap control + arrow key to select windows noremap <C-Down> <C-W>j noremap <C-Up> <C-W>k noremap <C-Left> <C-W>h noremap <C-Right> <C-W>l noremap <C-J> <C-W>j noremap <C-K> <C-W>k noremap <C-H> <C-W>h noremap <C-L> <C-W>l " ==============Vundle plug-in management============== " Vundle manage set nocompatible " be iMproved, required filetype off "required " set the runtime path to include Vundle and initialize set rtp + =~/.vim/bundle/Vundle.vim call vundle#begin() " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' Plugin 'Valloric/YouCompleteMe' Plugin 'scrooloose/nerdtree' " Plugin 'majutsusushi/tagbar' " Tag bar" Plugin 'Xuyuanp/nerdtree-git-plugin' Plugin 'jistr/vim-nerdtree-tabs' Plugin 'vim-airline/vim-airline' | Plugin 'vim-airline/vim-airline-themes' " Status line" Plugin 'jiangmiao/auto-pairs' Plugin 'mbbill/undotree' Plugin 'gdbmgr' Plugin 'scrooloose/nerdcommenter' Plugin 'Yggdroot/indentLine' "Indentation level" Plugin 'bling/vim-bufferline' " Buffer line" "Plugin 'kepbod/quick-scope' " Quick scope Plugin 'yianwillis/vimcdoc' Plugin 'nelstrom/vim-visual-star-search' Plugin 'ludovicchabant/vim-gutentags' Plugin 'w0rp/ale' Plugin 'mbbill/echofunc' Plugin 'Yggdroot/LeaderF', { 'do': './install.sh' } " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " ==============YCM============== let g:ycm_server_python_interpreter='/usr/bin/python' let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py' " YCM lookup definition let mapleader=',' nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR> nnoremap <leader>gf :YcmCompleter GoToDefinition<CR> nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR> let g:ycm_collect_identifiers_from_tags_files = 1 set completeopt=menu,menuone let g:ycm_add_preview_to_completeopt = 0 "Turn off function prototype prompts let g:ycm_show_diagnostics_ui = 0 "Turn off diagnostic information let g:ycm_server_log_level = 'info' let g:ycm_min_num_identifier_candidate_chars = 2 "Two characters trigger completion let g:ycm_collect_identifiers_from_comments_and_strings = 1 " Collect let g:ycm_complete_in_strings=1 noremap <c-z> <NOP> let g:ycm_key_invoke_completion = '<c-z>' " There is a shortcut key to trigger semantic completion in YCM let g:ycm_max_num_candidates = 15 "Number of candidates let g:ycm_semantic_triggers = { \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'], \ 'cs,lua,javascript': ['re!\w{2}'], \} " ===========gutentags============== "Search for the logo of the project directory, and stop recursing to the upper directory when encountering these file/directory names. let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project', '.gitignore'] " Adding extra parameters to ctags will make the tags file larger. " let g:gutentags_ctags_extra_args = ['--fields= + niazlS', '--extra= + q'] let g:gutentags_ctags_extra_args = ['--fields= + lS'] " let g:gutentags_ctags_extra_args + = ['--c + + -kinds= + px'] " let g:gutentags_ctags_extra_args + = ['--c-kinds= + px'] if isdirectory("kernel/") & amp; & amp; isdirectory("mm/") let g:gutentags_file_list_command = 'find arch/arm/ mm/ kernel/ include/ init/ lib/' endif \t " =======echodoc displays function parameters============ " ctags -R --fields= + lS . "======== NetRedTree========= autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 & amp; & amp; !exists("s:std_in") | NERDTree | endif let NERDTreeWinSize=20 "let NERDTreeShowLineNumbers=1 let NERDTreeAutoCenter=1 let NERDTreeShowBookmarks=1 let g:winManagerWindowLayout='TagList' nmap wm :WMToggle<cr> " ======ALE static syntax detection======== let g:ale_sign_column_always = 1 let g:ale_sign_error = '?' let g:ale_sign_warning = 'w' let g:ale_statusline_format = ['? %d', '? %d', '? OK'] let g:ale_echo_msg_format = '[%linter%] %code: %%s' let g:ale_lint_on_text_changed = 'normal' let g:ale_lint_on_insert_leave = 1 "let g:airline#extensions#ale#enabled = 1 let g:ale_c_gcc_options = '-Wall -O2 -std=c99' let g:ale_cpp_gcc_options = '-Wall -O2 -std=c + + 14' let g:ale_c_cppcheck_options = '' let g:ale_cpp_cppcheck_options = '' "========airline status bar========== let g:airline#extensions#tabline#enabled = 1 let g:airline_section_b = '%-0.10{getcwd()}' let g:airline_section_c = '%t' let g:airline#extensions#tagbar#enabled = 1 let g:airline_section_y = '' "------------------------------------------------ ---------------------------------- " cscope: Create database: cscope -Rbq; F5 to find c symbols; F6 to find strings; F7 to find function definitions; F8 to find who called the function, "------------------------------------------------ ---------------------------------- if has("cscope") set csprg=/usr/bin/cscope set csto=1 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out endif set csverb endif :set cscopequickfix=s-,c-,d-,i-,t-,e- nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> "nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> "F5 searches for c symbols; F6 searches for strings; F7 searches for function definitions; F8 searches for who called the function, nmap <silent> <F5> :cs find s <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR> nmap <silent> <F6> :cs find t <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR> "nmap <silent> <F7> :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <silent> <F7> :cs find c <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR> "------------------------------------------------ ---------------------------------- " Automatically load ctags: ctags -R if filereadable("tags") set tags=tags endif "------------------------------------------------ ---------------------------------- "global: Create database "------------------------------------------------ ---------------------------------- if filereadable("GTAGS") set cscopetag set cscopeprg=gtags-cscope cs add GTAGS au BufWritePost *.c,*.cpp,*.h silent! !global -u & amp; endif
Install using the following command
vim :PluginInstall
3. Compile and install YouCompelte
apt install build-essential cmake vim-nox python3-dev cd ~/.vim/bundle/YouCompleteMe Compile and install YouCompelte cd ~/.vim/bundle/YouCompleteMe ~/.vim/bundle/YouCompleteMe$ ./install.py --clang-completer ~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples$ cp .ycm_extra_conf.py ~/.vim
4. Tool chain
wget https://snapshots.linaro.org/gnu-toolchain/12.2-2023.04-1/aarch64-linux-gnu/gcc-linaro-12.2.1-2023.04-x86_64_aarch64-linux-gnu.tar.xz export PATH=$PATH:/opt//opt/gcc-linaro-12.2.1-2023.04-x86_64_aarch64-linux-gnu/bin export CROSS_COMPILE=aarch64-linux-gnu-
Five: Compile Linux kernel
sudo apt-get install gcc g++ sudo apt-get install libncurses5-dev sudo apt-get install build-essential sudo apt-get install kernel-package sudo apt-get install libssl-dev sudo apt-get install libc6-dev sudo apt-get install bin86 sudo apt-get install flex sudo apt-get install bison sudo apt-get install qttools5-dev sudo apt-get install libelf-dev git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux.git or git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-defconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 ake ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- tags cscope TAGS -j8