최근 AOSP(Android Open Source Project)에 Android 13이 추가되었습니다.
AOSP는 많은 git project들로 이루어져있고, repo라는 툴로 많은 git project를 쉽게 다운받을 수 있습니다.
먼저 repo라는 툴을 설치하고 repo를 통해 AOSP 코드들을 다운로드하는 방법을 소개하겠습니다.
1. REPO 설치
Repo는 script로 구현된 Tool입니다. 다운만 받아주면 되요. 먼저 ~/bin 폴더를 생성하고 PATH에 등록해주세요
$ mkdir ~/bin
$ PATH=~/bin:$PATHcurl 명령어로 repo tool을 ~/bin폴더에 다운받습니다. 그리고 repo에 실행권한을 주었습니다.
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo2. Android 13 소스코드 다운로드
Repo를 이용하여 안드로이드 오픈소스를 받기 전에 폴더를 먼저 생성합니다. 적당한 곳에 생성하시고 생성한 폴더 안으로 이동해주세요.
$ mkdir android13
$ cd android13그리고 Repo는 git을 이용하기 때문에 git을 설치하셔야 합니다. git을 설치하셨으면 기본적인 설정인 user name과 user email을 등록하셔야 합니다. 자신의 이름과 email을 입력해주세요.
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"이제 Repo 툴로 AOSP 소스를 다운로드 받을 준비가 끝났습니다.
2.1 Android 13 브랜치 다운로드
아래 명령어는 Android 13의 android-13.0.0_r11 브랜치의 소스에 대한 프로젝트를 셋업하겠다는 의미입니다.
$ repo init -u https://android.googlesource.com/platform/manifest -b android-13.0.0_r11AOSP의 모든 브랜치 정보들은 Source Code Tags and Builds에서 확인할 수 있습니다.
android-13.0.0_r11보다 더 최신 브랜치가 있다면 그것을 다운받으시면 됩니다.
명령어 실행 시, 아래와 같이 repo has been initialized 라는 메시지가 나오면 셋업이 완료된 것입니다.
$ repo init -u https://android.googlesource.com/platform/manifest -b android-13.0.0_r11
Downloading Repo source from https://gerrit.googlesource.com/git-repo
... A new version of repo (2.29) is available.
... You should upgrade soon:
cp /home/js/test/android13/.repo/repo/repo /home/js/.bin/repo
Your identity is: farfs <farfs.dev@gmail.com>
If you want to change this, please re-run 'repo init' with --config-name
repo has been initialized in /home/js/test/android13그리고, 아래와 같이 repo sync 명령어 입력 시, 셋업 시 설정된 git 프로젝트들이 다운로드됩니다.
$ repo sync
Receiving objects: 100% (6238/6238), 5.32 MiB | 25.67 MiB/s, done.
Resolving deltas: 100% (1584/1584), done.
Receiving objects: 100% (13918/13918), 7.89 MiB | 37.74 MiB/s, done.
Resolving deltas: 100% (4645/4645), done.
Receiving objects: 100% (1493/1493), 1.10 MiB | 43.47 MiB/s, done.
.....2.2 AOSP 소스 다운로드 확인
repo sync가 완료되면 아래와 같이 다운로드된 파일을 확인할 수 있습니다.
$ ls
Android.bp bionic bootstrap.bash compatibility dalvik development docs frameworks kernel libnativehelper packages platform_testing sdk test tools
art bootable build cts developers device external hardware libcore Makefile pdk prebuilts system toolchain3. AOSP 빌드
먼저 다운로드 받은 프로젝트에서 다음 명령어로 빌드 관련 의존성을 설정합니다.
$ source build/envsetup.sh그리고, 다음 명령어로 어떤 타입의 디바이스 또는 아키텍처를 빌드할지 선택합니다.
$ lunch
You\'re building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_mips-eng
4. aosp_mips64-eng
5. aosp_x86-eng
6. aosp_x86_64-eng
....
Which would you like? [aosp_arm-eng] 6디바이스 및 아키텍처까지 설정을 모두 마치셨다면, 다음 명령어로 전체 빌드를 할 수 있습니다. -jN은 빌드할 때 사용할 쓰레드 개수 N개를 설정하는 옵션입니다.
-j8은 8개 쓰레드로 빌드합니다.
$ m -j84. 에뮬레이터로 안드로이드 실행
빌드가 완료되면 안드로이드 이미지들이 생성됩니다.
다음 명령어를 입력하시면 컴파일된 안드로이드 이미지가 에뮬레이터에서 실행됩니다.
$ emulator5. References
Related Posts
- Android 14 - 사진/동영상 파일, 일부 접근 권한 소개
- Android - adb push, pull로 파일 복사, 다운로드
- Android 14 - 암시적 인텐트 변경사항 및 문제 해결
- Jetpack Compose - Row와 Column
- Android 13, AOSP 오픈소스 다운로드 및 빌드
- Android 13 - 세분화된 미디어 파일 권한
- Android 13에서 Notification 권한 요청, 알림 띄우기
- Android 13에서 'Access blocked: ComponentInfo' 에러 해결
- 에러 해결: android gradle plugin requires java 11 to run. you are currently using java 1.8.
- 안드로이드 - 코루틴과 Retrofit으로 비동기 통신 예제
- 안드로이드 - 코루틴으로 URL 이미지 불러오기
- Android - 진동, Vibrator, VibrationEffect 예제
- Some problems were found with the configuration of task 에러 수정
- Query method parameters should either be a type that can be converted into a database column or a List
- 우분투에서 Android 12 오픈소스 다운로드 및 빌드
- Android - ViewModel을 생성하는 방법
- Android - Transformations.map(), switchMap() 차이점
- Android - Transformations.distinctUntilChanged() 소개
- Android - TabLayout 구현 방법 (+ ViewPager2)
- Android - 휴대폰 전화번호 가져오는 방법
- Android 12 - Splash Screens 알아보기
- Android 12 - Incremental Install (Play as you Download) 소개
- Android - adb 명령어로 bugreport 로그 파일 추출
- Android - adb 명령어로 App 데이터 삭제
- Android - adb 명령어로 앱 비활성화, 활성화
- Android - adb 명령어로 특정 패키지의 PID 찾기
- Android - adb 명령어로 퍼미션 Grant 또는 Revoke
- Android - adb 명령어로 apk 설치, 삭제
- Android - adb 명령어로 특정 패키지의 프로세스 종료
- Android - adb 명령어로 screen capture 저장
- Android - adb 명령어로 System 앱 삭제, 설치
- Android - adb 명령어로 settings value 확인, 변경
- Android 12 - IntentFilter의 exported 명시적 선언
- Android - adb 명령어로 공장초기화(Factory reset)
- Android - adb logcat 명령어로 로그 출력