아래의 스크립트를 이용해서 특정 arch의 파일만 골라서 데이터 베이스를 만들도록 하자.
아래 스크립트는 arm64만 검색을 하도록 한 것이다.
만약 다른 arch를 제외하고 싶다면, 아래 파일을 사용해서 특정 arch를 제외 시키자.
# mk_cscope_ctags_arm64.sh
# use like below
#
# $ ls
# linux
# $ mk_cscope_ctags_arm64.sh linux
echo "kernel root directory: $1"
if [ "$1" = "" ]; then
echo "input kernel directory"
exit 0
else
kdir=$(basename $1)
fi
rm -vrf cscope.files cscope.in.out cscope.out cscope.po.out
mkdir tmp
cur_dir=$(pwd -P)
export TMPDIR=$cur_dir/tmp
## ctags
# -I : for ignore compiler option (ex. rq_lock())
ctags -RV --fields=+Kl \
-I __acquires \
-I __releases \
--exclude=alpha \
--exclude=arc \
--exclude=arm \
--exclude=c6x \
--exclude=h8300 \
--exclude=hexagon \
--exclude=ia64 \
--exclude=m68k \
--exclude=microblaze \
--exclude=mips \
--exclude=nds32 \
--exclude=nios2 \
--exclude=openrisc \
--exclude=parisc \
--exclude=powerpc \
--exclude=riscv \
--exclude=s390 \
--exclude=sh \
--exclude=sparc \
--exclude=um \
--exclude=unicore32 \
--exclude=x86 \
--exclude=xtensa \
--exclude=csky \
--exclude=out
### cscope
find ./ \
! \( -path ./$kdir/arch/alpha -prune \) \
! \( -path ./$kdir/arch/arc -prune \) \
! \( -path ./$kdir/arch/arm -prune \) \
! \( -path ./$kdir/arch/c6x -prune \) \
! \( -path ./$kdir/arch/h8300 -prune \) \
! \( -path ./$kdir/arch/hexagon -prune \) \
! \( -path ./$kdir/arch/ia64 -prune \) \
! \( -path ./$kdir/arch/m68k -prune \) \
! \( -path ./$kdir/arch/microblaze -prune \) \
! \( -path ./$kdir/arch/mips -prune \) \
! \( -path ./$kdir/arch/nds32 -prune \) \
! \( -path ./$kdir/arch/nios2 -prune \) \
! \( -path ./$kdir/arch/openrisc -prune \) \
! \( -path ./$kdir/arch/parisc -prune \) \
! \( -path ./$kdir/arch/powerpc -prune \) \
! \( -path ./$kdir/arch/riscv -prune \) \
! \( -path ./$kdir/arch/s390 -prune \) \
! \( -path ./$kdir/arch/sh -prune \) \
! \( -path ./$kdir/arch/sparc -prune \) \
! \( -path ./$kdir/arch/um -prune \) \
! \( -path ./$kdir/arch/unicore32 -prune \) \
! \( -path ./$kdir/arch/x86 -prune \) \
! \( -path ./$kdir/arch/xtensa -prune \) \
! \( -path ./$kdir/arch/csky -prune \) \
-name "*.cpp" -or \
-name "*.CPP" -or \
-name "*.c" -or \
-name "*.C" -or \
-name "*.h" -or \
-name "*.H" -or \
-name "*.mm" -or \
-name "*.MM" -or \
-name "*.ac" -or \
-name "*.am" -or \
-name "*.s" -or \
-name "*.S" > cscope.files
cscope -k -q -b -v -i cscope.files
# -b : Build the cross-reference only.
# -v : verbose
# -i : Browse through all source files whose names are listed in namefile
# -k : kernel mode, turns off the use of the default include dir (usually /usr/include) when building the database
# -q : Enable fast symbol lookup via an inverted index
rm -rvf $cur_dir/tmp
다음과 같이 스크립트를 실행한다.
$ ls -a
. .. linux
$ mk_cscope_ctags_arm64.sh linux
이제 vim에서
아래 명령를 통해서 검색해 보면, arm64의 함수만 검색되는 것을 확인할 수 있다.
:ts do_page_fault

※ 참고
https://docs.ctags.io/en/latest/man/ctags.1.html
ctags — Universal Ctags 0.3.0 documentation
A tag can record various information, called extension fields. Extension fields are tab-separated key-value pairs appended to the end of the EX command as a comment, as described above. These key value pairs appear in the general form key:value. In additio
docs.ctags.io
https://cscope.sourceforge.net/cscope_man_page.html
Manpage of CSCOPE
CSCOPE NAME cscope - interactively examine a C program SYNOPSIS cscope [ -bCcdehkLlqRTUuV ] [-Fsymfile] [-freffile] [-Iincdir] [-inamefile] [-numpattern] [-pn] [-sdir] DESCRIPTION cscope is an interactive, screen-oriented tool that allows the user
cscope.sourceforge.net
'Kernel > 环境' 카테고리의 다른 글
| module signing (1) | 2024.09.21 |
|---|---|
| kernel - make cscope tags (0) | 2024.02.02 |
| 라즈베리파이4 arm64 빌드 및 설치스크립트 (0) | 2024.02.02 |