Setting for Linux kernel analysis
I would like to share the configuration when analyzing the kernel code.
There are many better tools and IDE, so you can use whatever you want.
ctags
sudo apt-get install ctags -y
cscope
sudo apt-get install cscope -y
Create cscope db shell file
#!/bin/sh
rm -rf cscope.files cscope.files
find . \( -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.s' -o -name '*.S' \) -print > cscope.files
cscope -i cscope.files
Added .vimrc
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
if filereadable("./cscope.out")
cs add cscope.out
else
cs add /usr/src/linux/cscope.out
endif
set csverb
linux mainline support ctags, cscope DB
Recent Linux kernel makefiles automatically create ctags and cscope database files.
// put the architecture you want to analyze.
make ARCH=arm64 tags cscope
.vimrc
" Syntax Highlighting
if has("syntax")
syntax on
endif
"set ruler " set ru
"set laststatus=0 " show status bar (set ls)
"set statusline=%F\ %y%m%r\ %=Line:\ %l/%L\ [%p%%]\ Col:%c\ Buf:%n
"hi statusline ctermfg=White ctermbg=4 cterm=none
set number " line number set nu
" indent
set autoindent " auto indent set ai
set smartindent " set si
set showmatch " show match bracket
" tab
set smarttab
set tabstop=4 " tab change space set ts=4
set shiftwidth=4 " shift size set sw=4
set softtabstop=4 " sts=4
set expandtab " space instead of tab
set hlsearch " search highlite
set ignorecase
set incsearch
set bs=indent,eol,start
set pastetoggle=<Insert>
set nocompatible
set fileencodings=utf-8,euc-kr
set history=1000
set nobackup
set wildmenu " set wmnu
" Vundle - https://github.com/VundleVim/Vundle.vim
" 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 'flazz/vim-colorschemes'
Plugin 'vim-airline/vim-airline'
"Plugin 'vim-airline/vim-airline-themes'
Plugin 'frazrepo/vim-rainbow'
call vundle#end() " required
" vim theme - https://github.com/flazz/vim-colorschemes
set t_Co=256
colorscheme jellybeans
" vim-airline - https://github.com/vim-airline/vim-airline
" refer(https://github.com/vim-airline/vim-airline/blob/master/doc/airline.txt)
"let g:airline_statusline_ontop=1
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#show_tab_type=0
"let g:airline#extensions#whitespace#enabled = 0
"let g:airline_section_error='syntastic-err'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.linenr = ' ☰'
let g:airline_symbols.maxlinenr = ':'
let g:airline_symbols.colnr = ''
" vim-airline-themes - https://github.com/vim-airline/vim-airline-themes
"let g:airline_theme='jellybeans'
" vim-rainbow - https://github.com/frazrepo/vim-rainbow
let g:rainbow_active = 1
" cscope
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
if filereadable("./cscope.out")
cs add cscope.out
else
cs add /usr/src/linux/cscope.out
endif