2. $ mkdir -p logs
$ vi build_kernel.sh
Beaglebone Black(BBB) Kernel Build Script Edit
# In build_kernel.sh script…
109 make_kernel () {
….
127 make V=1 -j${CORES} ARCH=${KERNEL_ARCH} LOCALVERSION=${BUILD} CROSS_COMPILE="${CC}"
${address} ${image} modules > ../logs/build.log
※ make_kernel()함수 내 make zImage 명령에 V=1 및 > ../logs/build.log 추가
※ V=1 : Make 실행 시 수행되는 명령어 출력
3. $ ./build_kernel.sh
Beaglebone Black(BBB) Kernel Build
+ Detected build host [Ubuntu 14.04.4 LTS]
+ host: [x86_64]
+ git HEAD commit: [fa3dbf5d372bb7e2473fb09120209be64a877944]
…
※ build_kernel.sh 명령으로 BBB용 리눅스 커널 빌드 시작
$ ls -al
..
drwxrwxr-x 26 hcyang hcyang 4096 8월 21 23:35 KERNEL
-rw-rw-r-- 1 hcyang hcyang 1111 8월 15 23:38 LICENSE
-rwxrwxr-x 1 hcyang hcyang 5165 8월 15 23:38 build_deb.sh
-rwxrwxr-x 1 hcyang hcyang 8966 8월 21 19:04 build_kernel.sh
-rwxrwxr-x 1 hcyang hcyang 7405 8월 15 23:38 build_mainline.sh
..
※ 스크립트가 끝나면 KERNEL 디렉토리에 커널 소스가 다운로드 및 빌드가 수행되어져 있음.
4. $ cat logs/build.log
Beaglebone Black(BBB) Kernel Build Log
make -f ./Makefile silentoldconfig
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig silentoldconfig
mkdir -p include/config include/generated
scripts/kconfig/conf --silentoldconfig Kconfig
set -e; : ' CHK include/config/kernel.release'; mkdir -p include/config/; echo "4.8.0-
rc2$(/bin/bash ./scripts/setlocalversion .)" < include/config/auto.conf > include/config/kernel.release.tmp; if [ -r
include/config/kernel.release ] && cmp -s include/config/kernel.release include/config/kernel.release.tmp; then
rm -f include/config/kernel.release.tmp; else : ' UPD include/config/kernel.release'; mv -f
include/config/kernel.release.tmp include/config/kernel.release; fi
make -f ./scripts/Makefile.asm-generic
src=asm obj=arch/arm/include/generated/asm
…
※ 빌드 완료 후 logs/build.log 파일이 생성되었는지 확인
해당 Log 파일은 이후 Visual Studio 개발 환경 구축을 위해 사용됨
5. Download Beaglebone Black(BBB) Kernel to Windows
SCP / FTP 등을 통해 KERNEL 디렉토리를 윈도우 개발환경으로 다운받거나
NFS / 삼바 / SSHFS 등을 통해 윈도우 개발환경으로 연결.
9. Visual Studio Project Setup
Include 경로 / Macro 등이 설정되어 있지 않아 header file이나 Symbol 등을 찾지 못함
10. Visual Studio Project Setup - include directory / Macros 추가
빌드 과정 중 생성된 build.log 에서 분석을 원하는 파일에 대한 Build 명령 검색
11. Visual Studio Project Setup - include directory / Macros 추가
해당 명령에서 –I / -include / -D 옵션 추출
12. Visual Studio Project Setup - include directory / Macros 추가
-I 옵션 : 프로젝트 속성 VC++ 디렉토리 포함 디렉토리에 추가
13. Visual Studio Project Setup - include directory / Macros 추가
-D 옵션 : 프로젝트 속성 C/C++ 전처리기 전처리기 정의에서 기존 내용 모두 삭제 후 추가
14. Visual Studio Project Setup - include directory / Macros 추가
-include 옵션 파일은 직접 프로젝트의 헤더파일 항목에 에 추가.
15. Visual Studio Project Setup - include directory / Macros 추가
Include 경로 및 Definition Peeking 등의 기능 정상 동작 확인
16. 요약
1. Makefile 에 V=1 옵션을 넣어 Build 명령을 추출할 수 있게 한다.
2. Build 명령에서 필요한 include directory / Macro 등을 추출한다.
3. Visual Studio 의 프로젝트 설정에서 추출한 내용들을 적절히 추가한다.