Coccinelle: 리눅스 커널의 소스‑투‑소스 변환 도구
Source: Hacker News
설치
- 소스에서 Coccinelle를 빌드하려면
install.txt에 있는 지침을 따르세요. - 설치 후,
spatch스크립트는/usr/bin또는/usr/local/bin에 배치됩니다. spatch의 사전 컴파일된 버전은 여기에서 다운로드할 수 있습니다:
설치 없이 실행하기
다운로드/빌드 디렉터리에서 바로 Coccinelle를 실행할 수 있습니다.
프로그램이 설정 파일을 찾을 수 있도록 환경 변수를 설정하세요:
# Bash
source env.sh
# tcsh
source env.csh
사용법
간단한 예제로 Coccinelle를 테스트해 보세요:
spatch --sp-file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c
Coccinelle를 설치하지 않았다면, 빌드 디렉터리에서 스크립트를 실행하세요:
./spatch # or ./spatch.opt
spatch의 바이트코드 버전을 사용할 때는 OCaml(ocamlrun 인터프리터 제공)을 설치해야 할 수 있으며, 다음과 같이 실행합니다:
ocamlrun spatch --sp-file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c
문서
자세한 내용은 make docs를 실행하고 docs/ 디렉터리의 파일들을 살펴보세요.
Debian/Ubuntu에서는 LaTeX 문서를 빌드하기 위해 texlive-fonts-extra 패키지가 필요할 수 있습니다.
런타임 의존성 (Debian/Ubuntu)
- SmPL의 OCaml 스크립팅:
ocaml-native-compilers또는ocaml-nox - SmPL의 Python 스크립팅:
python3-dev(런타임 전용; Coccinelle 빌드에는 필요 없음)
기여
기여를 환영합니다. Linux 커널의 Developer’s Certificate of Origin 1.1에 따라 기여에 서명해 주세요:
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the
right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my
knowledge, is covered under an appropriate open source license and I
have the right under that license to submit that work with modifications,
whether created in whole or in part by me, under the same open source
license (unless I am permitted to submit under a different license), as
indicated in the file; or
(c) The contribution was provided directly to me by some other person who
certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public
and that a record of the contribution (including all personal information
I submit with it, including my sign‑off) is maintained indefinitely and
may be redistributed consistent with this project or the open source
license(s) involved.
실제 이름을 넣어 다음과 같은 줄을 추가하세요:
Signed-off-by: Your Name