본문 바로가기

YOCTO

YOCTO) 자주 사용하는 디버깅 명령어

 

✅ Yocto 디버깅 명령어 – 상황별 정리


🔹 1. 🔍 변수 확인 / 환경 확인

📌 bitbake <레시피> -e

해당 레시피의 모든 환경 변수 값을 출력 (override 포함)

bitbake busybox -e | grep ^SRC_URI
bitbake core-image-minimal -e | grep ^IMAGE_INSTALL

🔹 2. 🧪 태스크 단독 실행 (테스트용)

📌 bitbake -c <테스크명> <레시피>

특정 태스크만 실행할 때 (예: compile, install, devshell, menuconfig)

bitbake -c compile busybox
bitbake -c menuconfig virtual/kernel
bitbake -c devshell busybox

🧠 참고: devshell은 해당 소스 디렉토리로 진입한 쉘을 열어줌 (수동 디버깅용)


🔹 3. 🔁 태스크 강제 재실행 / 클린

📌 bitbake -c <테스크명> -f <레시피>

캐시 무시하고 강제로 다시 실행 (-f = force)

bitbake -c compile -f busybox
bitbake -c do_patch -f virtual/kernel

📌 bitbake -c clean <레시피>

특정 레시피의 빌드 아티팩트를 삭제

bitbake -c clean busybox

📌 bitbake -c cleansstate <레시피>

SSTATE 캐시까지 삭제 (진짜 완전 초기화)

bitbake -c cleansstate busybox

🔹 4. 🧠 태스크/레시피 간 의존성 시각화

📌 bitbake -g <레시피>

의존성 그래프 (.dot 파일 생성됨)

bitbake -g core-image-minimal

생성된 파일:

  • pn-depends.dot – 레시피 간 의존성
  • task-depends.dot – 태스크 간 의존성

도트 파일은 xdot 또는 graphviz 도구로 시각화 가능


🔹 5. 🐛 이미지/파일시스템 디버깅

📌 rootfs 구성 확인

cd tmp/work/qemuarm64/core-image-minimal/1.0-r0/rootfs/
tree

📌 이미지 마운트 (ext4 등)

sudo mount -o loop tmp/deploy/images/qemuarm64/core-image-minimal-qemuarm64.ext4 /mnt
ls /mnt

🔹 6. 🧰 실행 중인 이미지 디버깅 (런타임)

📌 QEMU로 부팅 + SSH, gdb 등 디버깅

runqemu qemuarm64

→ 로그인 후 strace, gdb, lsof로 분석 가능

📌 이미지에 디버깅 도구 포함

EXTRA_IMAGE_FEATURES += "debug-tweaks tools-debug"
IMAGE_INSTALL:append = "gdb strace"

✅ 자주 쓰는 디버깅용 태스크 요약

명령어 설명

bitbake -e <recipe> 변수 확인 (override 포함)
bitbake -c devshell <recipe> 소스 디렉토리 진입 (쉘 열림)
bitbake -c clean <recipe> 레시피 출력물 삭제
bitbake -c compile -f <recipe> 캐시 무시 강제 컴파일
bitbake -g <image> 의존성 그래프 .dot 생성
runqemu <machine> QEMU 부팅 후 런타임 디버깅 가능

✨ 보너스: 실무에서 요긴한 조합

bitbake -c devshell busybox
# → 진입해서 Makefile 직접 실행, 수동 디버깅

bitbake -e busybox | grep ^EXTRA_OEMAKE
# → make 관련 옵션 확인