2012년 10월 18일 목요일

안드로이드 오픈소스 프로젝트 (한글번역) - 커널 빌드하기

이 문서는...


이 문서는 source.android.com의 글을 번역한 것입니다.
(원문: http://source.android.com/source/building-kernels.html)

작성자: 박영기
작성일: 2012-10-19

커널 빌드하기

커널에만 관심이 있다면, 커널 소스를 다운로드하고 컴파일하는 가이드로 이 문서가 도움이 될 것이다.

아래의 설명들은 AOSP(Android Open Source Project)의 모든 소스코드를 다운로드하지 않는것을 전제로 한다. 만약 AOSP의 모든 소스코드를 다운로드했다면, 실제 커널 소스를 다운로드하는 것을 제외한 git clone 단계를 건너뛰어야 한다.

여기서는 Pandaboard kernel을 사용한다.

빌드를 위한 커널 빌드 알아내기

당신은 device 프로젝트에서 kernel의 git log를 보고싶을 것이다. device 프로젝트는 device/<vendor>/<name> 형식으로 되어있다.

*주: device/ti/panda 의 정확한 용도는 현재 알 수 없지만, 그 속에 빌드된 kernel 이미지가 존재한다. 여기서 설명하고자하는 바는, kernel 이미지 파일의 커밋로그에서 실제 커널 저장소(kernel/omap.git 등)상의 SHA-1 커밋번호를 알아내자는 것이다.
$ git clone https://android.googlesource.com/device/ti/panda
$ cd panda
$ git log kernel

로그에는 커널 프로젝트를 위하여 SHA1 커밋을 포함해야한다. 다음 단계에서 사용할 수 있도록 이 값을 메모해 두자.

소스 다운로드하기

당신이 원하는 커널은 다음과 의존관계에 있다.
$ git clone https://android.googlesource.com/kernel/common.git
$ git clone https://android.googlesource.com/kernel/exynos.git
$ git clone https://android.googlesource.com/kernel/goldfish.git
$ git clone https://android.googlesource.com/kernel/msm.git
$ git clone https://android.googlesource.com/kernel/omap.git
$ git clone https://android.googlesource.com/kernel/samsung.git
$ git clone https://android.googlesource.com/kernel/tegra.git
  • goldfish 프로젝트는 에뮬레이트된 플랫폼(emulated platforms)을 위한 kernel 소스를 포함하고있다.
  • msn 프로젝트는 ADP1, ADP2, Nexus One 를 위한 것이다. 그리고 퀄컴 MSM 칩셋을 위한 작업의 시작점으로 사용될 수 있다.
  • omap 프로젝트는 PandaBoard, Galaxy Nexus 를 위한 것이다. 그리고 TI OMAP 칩셋을 위한 작업의 시작점으로 사용될 수 있다. 
  • samsung 프로젝트는 Nexus S 를 위한 것이다. 그리고 Samsung Hummingbird 칩셋을 위한 작업의 시작점으로 사용될 수 있다.
  • tegra 프로젝트는 Xoom, Nexus 7을 위한 것이다. 그리고 NVIDIA Tegra 칩셋을 위한 작업의 시작점으로 사용될 수 있다. 
  • exynos 프로젝트는 Samsung Exynos 칩셋을 위한 작업의 시작점으로 사용될 수 있다.

미리 컴파일된 gcc 다운받기

prebuilt toolchain이 경로($PATH)에 있는 것을 확인한다.
$ git clone https://android.googlesource.com/platform/prebuilt
$ export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH

컴파일

예를들어 우리는 다음 명령을 사용하여 panda 커널을 빌드한다.
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd omap
$ git checkout 
$ make panda_defconfig
$ make
tuna 커널을 빌드하려면, 위의 모든 명령에서 "panda"를 "tuna"로 바꾸어 실행한다.
  • maguro와 toro를 위한 커널은 device/samsung/tuna/kernel 입니다.
  • crespo와 crespo4g를 위한 커널은 device/samsung/crespo/kernel 입니다.
  • stingray와 wingray를 위한 커널은 device/moto/wingray/kernel 입니다.
이미지는 arch/arm/boot/zImage 에 출력됩니다. 이 예제의 경우 zImage를  device/<vendor>/<name>/kernel 혹은 device/ti/panda/kernel 에 복사할 수 있습니다.



댓글 없음:

댓글 쓰기