-
Notifications
You must be signed in to change notification settings - Fork 6
커널 컴파일
Steve edited this page Jul 13, 2019
·
2 revisions
커널소스는 www.kernel.org 에서 다운로드 받는다.
현재(2019년 6월 27일) 최종 소스는 5.1.15 이다.
** 커널 컴파일은 Ubuntu linux 에서 진행 한다. **
다운로드한 최종 소스는 이름은 linux-5.1.15.tar.xz 이다.
아래 명령어로 압축을 해제 한다.
$sudo xz -d linux-5.1.15.tar.xz
$sudo tar xf linux-5.1.15.tar
ARM Cross compiler 설치 아래와 같이 64bit AArch64 툴체인을 설치 한다.
sudo apt install binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
필요 패키지 설치
아래 명령어로 패키지를 설치 한다.
sudo apt-get update
sudo apt-get install build-essential libncurses5 libncurses5-dev bin86 kernel-package libssl-dev bison flex libelf-dev
#3. 크로스 컴파일 설정 수정
크로스 컴파일 환경을 위한 커널 makefile 의 346 라인을 아래와 같이 수정한다.
#ARCH ?= $(SUBARCH)
ARCH ?= arm64
CROSS_COMPILE ?= aarch64-linux-gnu-
linux-5.1.15/arch/arm64/configs/defconfig 를 이용하여 커널 환경을 설정 한.
linux-5-1.15$ sudo cp arch/arm64/configs/defconfig .config
ref : 6. make menuconfig
아래와 같이 입력하여 커널 설정을 시작 한다.
위의 참조 링크와 같이 커널을 설정 한다.
linux-5-1.15$ sudo make menuconfig
아래와 같이 커널 빌딩을 시작한다.
linux-5-1.15$ sudo make all
vmlinux 에 있는 section 정보를 아래와 같이 추출한다.
linux-5-1.15$ aarch64-linux-gnu-objdump -h vmlinux > vmlinux_section
linux-5-1.15$ aarch64-linux-gnu-objdump
Usage: ./aarch64-linux-gnu-objdump <option(s)> <file(s)>
Display information from object <file(s)>.
At least one of the following switches must be given:
-a, --archive-headers Display archive header information
-f, --file-headers Display the contents of the overall file header
-p, --private-headers Display object format specific file header contents
-P, --private=OPT,OPT... Display object format specific contents
-h, --[section-]headers Display the contents of the section headers
-x, --all-headers Display the contents of all headers
-d, --disassemble Display assembler contents of executable sections
-D, --disassemble-all Display assembler contents of all sections
-S, --source Intermix source code with disassembly
-s, --full-contents Display the full contents of all sections requested
-g, --debugging Display debug information in object file
-e, --debugging-tags Display debug information using ctags style
-G, --stabs Display (in raw form) any STABS info in the file
-W[lLiaprmfFsoRt] or
--dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,
=frames-interp,=str,=loc,=Ranges,=pubtypes,
=gdb_index,=trace_info,=trace_abbrev,=trace_aranges,
=addr,=cu_index]
Display DWARF info in the file
-t, --syms Display the contents of the symbol table(s)
-T, --dynamic-syms Display the contents of the dynamic symbol table
-r, --reloc Display the relocation entries in the file
-R, --dynamic-reloc Display the dynamic relocation entries in the file
@<file> Read options from <file>
-v, --version Display this program's version number
-i, --info List object formats and architectures supported
-H, --help Display this information