Android 10부터 CTS-on-GSI/VTS 규정 준수 테스트를 실행하는 데 사용되는 일반 시스템 이미지 (GSI)는 릴리스 서명을 위해 userdebug에서 사용자 빌드 유형으로 변경되었습니다. VTS를 실행하려면 adb root
가 필요하지만 사용자 빌드 장치에서는 adb root
를 사용할 수 없기 때문에 이것은 VTS 테스트의 문제입니다.
디버그 램디스크(또는 디버그 부팅 이미지)는 부트로더가 잠금 해제 된 사용자 빌드 장치에서 adb root
를 활성화하기 위해 도입되었습니다. 이는 CTS-on-GSI 및 VTS-on-GSI에 대해 동일한 사용자 빌드 GSI system.img
를 사용하여 테스트 흐름을 단순화합니다. STS 설정의 경우 다른 userdebug OEM system.img
를 사용하는 것이 여전히 필요합니다.
다음 표는 Android 10에서 규정 준수 테스트를 위한 이미지 및 빌드 유형 변경 사항을 보여줍니다.
테스트 스위트 | 테스트 | 짓다 | 디버그 램디스크 | adb 루트? | Android 9 -> 10 빌드 변형 변경 |
---|---|---|---|---|---|
CTS | OEM의 시스템 | 사용자 | N | N | 변경 없음 |
CTS-on-GSI | GSI | 사용자 | N | N | userdebug -> 사용자 GSI 서명 된 릴리스 |
STS | OEM의 시스템 | 사용자 디버그 | N | 와이 | Q의 새로운 기능 |
VTS | GSI | 사용자 | 와이 | 와이 | userdebug -> 사용자 GSI 서명 된 릴리스 |
개요
다음 추가 이미지 파일은 빌드 폴더( ${ANDROID_PRODUCT_OUT}
) 아래에 생성됩니다.
-
boot-debug.img
-
vendor_boot-debug.img
boot-debug.img
가 장치의 boot
파티션에 플래시되면 시스템 sepolicy 파일의 userdebug 버전과 추가 속성 파일인 adb_debug.prop
이 로드됩니다. 이것은 사용자가 system.img
(GSI 또는 OEM)를 빌드하는 adb root
를 허용합니다.
vendor_boot
파티션이 있는 장치를 사용하는 GKI(일반 커널 이미지) 의 경우 boot-debug.img
를 플래싱하면 안 됩니다. boot
파티션은 인증된 GKI 이미지로 플래싱되어야 하기 때문입니다. 대신 ramdisk 디버그를 용이하게 하기 위해 vendor_boot-debug.img
를 vendor_boot
파티션에 플래시해야 합니다.
디버그 램디스크를 사용하기 위한 전제 조건
디버그 램디스크는 준수 테스트를 실행하는 OEM에서 제공합니다. 릴리스 서명이 되어 있으면 안 되며 기기가 잠금 해제된 경우에만 사용할 수 있습니다.
디버그 램디스크는 다음을 사용하여 장치를 업그레이드하는 데 생성되거나 사용되지 않습니다.
-
BOARD_BUILD_SYSTEM_ROOT_IMAGE
참 - 커널 명령줄의
skip_initramfs
안드로이드 12 GSI
Android 12 GSI에서 디버그 램디스크를 사용하는 데 추가 지침이 필요하지 않습니다.
2021년 9월 29일부터 디버그 램디스크는 더 이상 repack_bootimg
도구로 업데이트할 필요가 없습니다. SGR1.210929.001 (7777720)
이후의 Android 12 GSI 빌드는 system.img
에 최신 userdebug_plat_sepolicy.cil
파일을 통합하고 디버그 ramdisk에서 userdebug_plat_sepolicy.cil
을 무시합니다. 자세한 내용은 CL 을 참조하십시오.
안드로이드 11 GSI
boot-debug.img
또는 vendor_boot-debug.img
가 사용되면 시스템 sepolicy는 boot-debug.img
또는 vendor_boot-debug.img
의 디버그 램디스크에 있는 userdebug_plat_sepolicy.cil
파일에서 로드됩니다. GSI 이미지를 부팅하려면 항상 android11-gsi
분기의 최신 sepolicy 변경 사항을 통합하여 boot-debug.img
또는 vendor_boot-debug.img
를 다시 빌드하세요.
또는 repack_bootimg
도구를 사용하여 업데이트된 GSI sepolicy로 boot-debug.img
또는 vendor_boot-debug.img
를 다시 빌드할 수 있습니다.
디버그 램디스크 재포장
sepolicy 변경 사항을 통합하여 boot-debug.img
를 다시 빌드하는 대신 파트너는 repack_bootimg
를 사용하여 GSI sepolicy 파일을 boot-debug.img
(또는 장치가 GKI를 사용하는 경우 vendor_boot-debug.img
)로 업데이트할 수 있습니다.
단계는 다음과 같습니다.
https://ci.android.com 에서
otatools.zip
을 다운로드합니다.aosp_arm64-userdebug
aosp-master
의 빌드 아티팩트에서 다운로드하는 것이 좋습니다.repack_bootimg
실행 환경 설정:unzip otatools.zip -d otatools
export PATH="${PWD}/otatools/bin:${PATH}"
repack_bootimg --help
사용 중인 GSI 빌드에서
userdebug_plat_sepolicy.cil
또는boot-with-debug-ramdisk-${KERNEL_VERSION}.img
를 다운로드합니다. 예를 들어RJR1.211020.001 (7840830)
의 arm64 GSI를 사용하는 경우 https://ci.android.com/builds/submitted/ 7840830 /aosp_arm64-user/latest 에서 다운로드하십시오.장치
boot-debug.img
또는vendor_boot-debug.img
를userdebug_plat_sepolicy.cil
로 업데이트합니다.repack_bootimg --local --dst_bootimg boot-debug.img \ --ramdisk_add userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil \ --ramdisk_add userdebug_plat_sepolicy.cil:first_stage_ramdisk/userdebug_plat_sepolicy.cil
# If using GKI
repack_bootimg --local --dst_bootimg vendor_boot-debug.img \ --ramdisk_add userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil \ --ramdisk_add userdebug_plat_sepolicy.cil:first_stage_ramdisk/userdebug_plat_sepolicy.cil
boot-with-debug-ramdisk-${KERNEL_VERSION}.img
:repack_bootimg --src_bootimg boot-with-debug-ramdisk-5.4.img \ --dst_bootimg boot-debug.img \ --ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil \ --ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:first_stage_ramdisk/userdebug_plat_sepolicy.cil
# If using GKI
repack_bootimg --src_bootimg boot-with-debug-ramdisk-5.4.img \ --dst_bootimg vendor_boot-debug.img \ --ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil \ --ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:first_stage_ramdisk/userdebug_plat_sepolicy.cil
--ramdisk_add
의 인수는 장치 구성에 따라 조정할 수 있습니다. 자세한 설명은 다음 섹션 을 참조하십시오.
userdebug sepolicy의 경로
위의 repack_bootimg
는 --src_bootimg
램디스크에서 --dst_bootimg
램디스크로 userdebug_plat_sepolicy.cil
파일을 복사합니다. 그러나 디버그 램디스크 내의 경로는 Android 버전에 따라 다를 수 있습니다. Android 10 및 11에서 경로는 커널 명령줄에서 androidboot.force_normal_boot=1
인 기기의 first_stage_ramdisk/userdebug_plat_sepolicy.cil
입니다. 그렇지 않으면 경로는 userdebug_plat_sepolicy.cil
입니다.
다음 명령을 실행하여 커널 명령줄에 androidboot.force_normal_boot
가 있는지 확인합니다.
adb root
adb shell cat /proc/cmdline | grep force_normal_boot
Android 12부터 디버그 램디스크 내의 경로는 커널 명령줄에 androidboot.force_normal_boot=1
의 존재 여부에 관계없이 항상 userdebug_plat_sepolicy.cil
입니다. 다음 표는 다양한 Android 버전에서 디버그 램디스크 내의 경로를 보여줍니다.
디버그 이미지 | 안드로이드 10 | 안드로이드 11 | 안드로이드 12 |
---|---|---|---|
GKI boot-with-debug-ramdisk-${KERNEL_VERSION}.img | 해당 없음 | first_stage_ramdisk/userdebug_plat_sepolicy.cil | userdebug_plat_sepolicy.cil |
기기별 boot-debug.img | force_normal_boot에 따라 다름 | force_normal_boot에 따라 다름 | userdebug_plat_sepolicy.cil |
기기별 vendor_boot-debug.img | 해당 없음 | force_normal_boot에 따라 다름 | userdebug_plat_sepolicy.cil |
--ramdisk_add
를 지정하여 src_path:dst_path
쌍 목록이 있는 다른 경로에서 파일을 복사할 수 있습니다. 예를 들어 다음 명령은 Android 11 boot-with-debug-ramdisk-5.4.img
파일 first_stage_ramdisk/userdebug_plat_sepolicy.cil
을 Android 11 vendor_boot-debug.img
내의 first_stage_ramdisk/userdebug_plat_sepolicy.cil
로 복사합니다.
repack_bootimg \
--src_bootimg boot-with-debug-ramdisk-5.4.img \
--dst_bootimg vendor_boot-debug.img \
--ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:first_stage_ramdisk/userdebug_plat_sepolicy.cil
커널 커맨드 라인에 androidboot.force_normal_boot=1
가 없다면 목적지 경로를 userdebug_plat_sepolicy.cil
로 변경하기 위해 아래와 같이 커맨드를 조정해야 합니다.
repack_bootimg \
--src_bootimg boot-with-debug-ramdisk-5.4.img \
--dst_bootimg vendor_boot-debug.img \
--ramdisk_add first_stage_ramdisk/userdebug_plat_sepolicy.cil:userdebug_plat_sepolicy.cil
AVB 바닥글 추가
--dst_bootimg
에 전달된 이미지가 AVB 연결 파티션으로 구성된 경우 repack_bootimg
명령을 실행한 후 AVB 바닥글을 추가해야 합니다.
예를 들어 repack_bootimg
를 실행 하기 전에 다음 명령을 실행하여 vendor_boot-debug.img
에 연결된 AVB 바닥글이 있는지 확인합니다.
avbtool info_image --image vendor_boot-debug.img
원래 연결된 AVB 바닥글이 있는 경우 repack_bootimg
명령을 실행한 후 AVB 바닥글을 추가해야 합니다. 모든 테스트 키를 사용하여 boot
vendor_boot-debug.img
에 서명하는 것은 장치가 잠금 해제된 경우에만 디버그 램디스크를 사용할 수 있기 때문에 vendor_boot
합니다.
avbtool add_hash_footer --partition_name vendor_boot \
--partition_size 100663296 \
--algorithm SHA256_RSA4096 \
--key otatools/external/avb/test/data/testkey_rsa4096.pem \
--image vendor_boot-debug.img