티스토리 뷰
728x90
AOSP cuttlefish 빌드
우분투 터미널에서 repo를 사용하여 아래와 같이 안드로이드 AOSP(Android Open Source Project) 코드를 받을 수 있습니다.
- repo init에서 "-b 브랜치" 옵션 : 특정 브랜치의 소스를 다운로드
- 브랜치 이름은 https://source.android.com/docs/setup/reference/build-numbers#source-code-tags-and-builds 에서 TAG에 있는 것을 입력하시면 되며, 브랜치를 입력하지 않으면 기본적으로 main 브랜치의 소스를 가져옵니다.
- repo sync는 소스를 다운로드 받으며, -j8은 8개의 스레드로 다운로드 받으라는 의미.
repo init --partial-clone -b android-15.0.0_r20 -u https://android.googlesource.com/platform/manifest
repo sync -j8
빌드를 하려면,
- 먼저 source build/envsetup.sh를 실행하여 환경을 셋업
- lunch로 빌드 타겟을 설정 (아래 코드에서는 cuttlefish를 타겟으로 설정)
source build/envsetup.sh
lunch aosp_cf_x86_64_phone-trunk_staging-userdebug
그리고 아래 명령어로 빌드를 할 수 있습니다. (-j8은 8개 스레드로 빌드하며, 입력하지 않으면 1개 스레드로 빌드)
m -j8
Troubleshooting
Ubuntu 24.04에서 빌드하다보면 이런 에러가 발생하는데....
mj@mj:~/aosp_15$ make -j8
21:11:50 Build sandboxing disabled due to nsjail error.
....
[E][2025-03-18T17:35:52+0900][1] initCloneNs():379 mount('/', '/', NULL, MS_REC|MS_PRIVATE, NULL): Permission denied
[F][2025-03-18T17:35:52+0900][1] runChild():469 Launching child process failed
[W][2025-03-18T17:35:52+0900][1502626] runChild():489 Received error message from the child process before it has been executed
[E][2025-03-18T17:35:52+0900][1502626] standaloneMode():272 Couldn't launch the child process
17:36:19 ninja failed with: exit status 1
아래 블로그를 참고하여 빌드 문제를 해결하였습니다.
https://blog.amoseui.com/android-13-aosp-cuttlefish
임시 해결책은 아래와 같이 적용합니다. echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns 영구적인 적용 방법은 아래와 같습니다. /etc/sysctl.d/60-apparmor-namespace.conf 파일 생성 $ cat /etc/sysctl.d/60-apparmor-namespace.conf kernel.apparmor_restrict_unprivileged_userns=0 reboot 후 적용.
빌드가 완료되면 아래 명령어로 빌드된 이미지를 실행시키고 종료시킬 수 있습니다.
launch가 되면, 브라우저로 https://localhost:8443 에 접속하면 에뮬레이터를 동작시킬 수 있습니다.
# run
$ launch_cvd --daemon
# stop
$ stop_cvd
cuttlefish 설치
커틀피시를 실행하려면 아래를 참고해서 설치할 수 있습니다.
$ sudo apt install -y git devscripts config-package-dev debhelper-compat golang curl
$ git clone https://github.com/google/android-cuttlefish
$ cd android-cuttlefish
$ for dir in base frontend; do
cd $dir
debuild -i -us -uc -b -d
cd ..
done
$ sudo dpkg -i ./cuttlefish-base_*_*64.deb || sudo apt-get install -f
$ sudo dpkg -i ./cuttlefish-user_*_*64.deb || sudo apt-get install -f
$ sudo usermod -aG kvm,cvdnetwork,render $USER
$ sudo reboot
또는 Github https://github.com/google/android-cuttlefish
참고해서 아래 명령어로 설치할 수 있습니다.
tools/buildutils/build_packages.sh
sudo apt install ./cuttlefish-base_*.deb ./cuttlefish-user_*.deb
sudo usermod -aG kvm,cvdnetwork,render $USER
sudo reboot
728x90
'개발 > Android' 카테고리의 다른 글
WSL에서 AOSP(안드로이드 오픈소스) 빌드하기 (0) | 2024.05.04 |
---|---|
[Android] ADB로 실행 중인 앱 프로세스 종료 (0) | 2023.10.10 |
[Android] ADB로 Intent 보내는 방법 (1) | 2023.10.10 |
[Android] ADB로 실행 중인 프로세스/스레드 확인 (1) | 2023.10.01 |
[Android] ADB 앱 삭제 명령어 (0) | 2023.10.01 |
공지사항
최근에 올라온 글
최근에 달린 댓글
링크
TAG
- 포르투갈
- 파란버섯
- 안드로이드
- javascript
- 마비노기 모바일
- Flutter
- 12e 트램
- 파이썬
- 오블완
- adb
- 나무던전
- java
- 리스보아 카드
- android
- 15e 트램
- Python
- 포르투
- aosp 빌드
- 모루정원
- 와보땅
- 다크스텀프
- 주황버섯
- 티스토리챌린지
- Unreal Engine
- Skia
- 와일드보어의 땅
- 메이플랜드
- DART
- 원숭이의숲
- 리스본
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함