2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
가상 A/B 구현 - 패치
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
다음 패치를 선택하여 다음과 같은 알려진 문제를 해결하세요.
사이드로드 시 할당 가능한 공간 정확히 확인
*2 * 합계(업데이트 그룹 크기)*보다 크기가 작은 super 파티션이 있는 가상 A/B 기기에 전체 OTA 패키지를 사이드로드하면 복구 로그 /tmp/recovery.log
에서 다음과 같이 실패할 수 있습니다.
The maximum size of all groups with suffix _b (...) has exceeded half of allocatable space for dynamic partitions ...
다음은 로그의 예입니다.
[INFO:dynamic_partition_control_android.cc(1020)] Will overwrite existing partitions. Slot A may be unbootable until update finishes!
[...]
[ERROR:dynamic_partition_control_android.cc(803)] The maximum size of all groups with suffix _b (2147483648) has exceeded half of allocatable space for dynamic partitions 1073741824.
이 문제가 발생하면 CL 1399393을 선택하고, 기기가 복구를 부팅으로 사용하지 않는 경우 부팅 파티션이나 복구 파티션을 다시 빌드하고 플래시합니다.
병합 중 세분화 오류 해결
OTA 업데이트를 적용한 후 VAB 병합 프로세스 중에 update_engine_client --cancel
을 호출하면 CleanupPreviousUpdateAction
이 다운됩니다. 또한 markSlotSuccessful
이 늦게 제공될 경우 와일드 포인터 오류도 발생할 수 있습니다.
이 문제는 StopActionInternal
함수 추가를 통해 해결되었습니다.
CleanupPreviousUpdateAction
은 소멸 시 대기 중인 작업을 취소하며, 메시지 루프에서 대기 중인 작업의 작업 ID를 추적하는 변수를 유지합니다. segfault를 방지하기 위해 소멸 시 대기 중인 작업이 취소됩니다.
다음 변경사항이 Android 11 소스 트리에 있는지 확인하여 병합 중에 update_engine
에서 발생하는 SIGSEGV
비정상 종료 문제를 해결합니다.
update_engine 조기 병합 방지
기기(Android 11 이상)가 부팅되고 부팅이 완료되면 update_engine
은 ScheduleWaitMarkBootSuccessful()
과 WaitForMergeOrSchedule()
을 호출합니다. 그러면 병합 프로세스가 시작됩니다. 하지만 기기가 이전 슬롯으로 재부팅됩니다. 병합이 이미 시작되었으므로 기기가 부팅되지 않고 작동할 수 없게 됩니다.
소스 트리에 다음 변경사항을 추가합니다. CL 1664859는 선택사항입니다.
- CL 1439792 (CL 1439372 전제 조건)
- CL 1439372(
CleanupPreviousUpdateAction
: 소멸 시 대기 중인 작업 취소)
- CL 1663460 (
markSlotSuccessful
이 늦게 제공될 경우의 잠재적 와일드 포인터 오류 수정)
- CL 1664859 (선택사항 -
CleanupPreviousUpdateAction
에 관해 unittest
추가)
올바른 dm-verity 구성 확인
Android 11 이상에서는 기기를 다음 dm-verity 옵션으로 잘못 구성할 수 있습니다.
- 커널의
CONFIG_DM_VERITY_AVB=y
AVB_HASHTREE_ERROR_MODE_MANAGED_RESTART_AND_EIO
없이 모든 verity 모드(예: AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE
)를 사용하도록 구성된 부트로더
이 기기 설정에서 verity 오류가 발생하면 vbmeta 파티션이 손상되고 비 A/B 기기는 작동하지 않게 렌더링됩니다. 마찬가지로 병합이 시작되면 A/B 기기도 작동하지 않을 수 있습니다. AVB_HASHTREE_ERROR_MODE_MANAGED_RESTART_AND_EIO
verity 모드만 사용하세요.
- 커널에서
CONFIG_DM_VERITY_AVB=n
를 설정합니다.
- 대신
AVB_HASHTREE_ERROR_MODE_MANAGED_RESTART_AND_EIO
모드를 사용하도록 기기를 구성합니다.
자세한 내용은 verity 문서: dm-verity 오류 처리를 참고하세요.
시스템 이미지와 공급업체 이미지를 따로 빌드한 다음 merge_target_files
를 사용하여 병합하면 병합 프로세스 중에 가상 A/B 구성이 잘못 삭제될 수 있습니다. 병합된 타겟 파일에서 가상 A/B 구성이 올바른지 확인하려면 CL 2084183 패치(동적 파티션 정보에서 동일한 키/값 쌍 병합)를 적용합니다.
필수 구성요소 업데이트
Android 13부터 snapuserd
가 공급업체 램디스크에서 일반 램디스크로 이동되었습니다. 기기가 Android 13으로 업그레이드되는 경우 공급업체 램디스크와 일반 램디스크에 모두 snapuserd
의 사본이 포함될 수 있습니다. 이 경우에 가상 A/B에 snapuserd
의 시스템 사본이 필요합니다. snapuserd
의 올바른 사본이 배치되도록 하려면 CL 2031243(first_stage_ramdisk에 snapuserd
복사)을 적용합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Implement Virtual A/B - patches\n\nCherry-pick the following patches to address the following known issues.\n\n### Check allocatable space correctly when sideloading\n\nSideloading a full OTA package on a Virtual A/B device that has a super\npartition with a size smaller than \\*2 \\* sum(size of update groups)\\* may fail\nwith the following in recovery log `/tmp/recovery.log`: \n\n The maximum size of all groups with suffix _b (...) has exceeded half of allocatable space for dynamic partitions ...\n\nHere is an example of the log: \n\n [INFO:dynamic_partition_control_android.cc(1020)] Will overwrite existing partitions. Slot A may be unbootable until update finishes!\n [...]\n [ERROR:dynamic_partition_control_android.cc(803)] The maximum size of all groups with suffix _b (2147483648) has exceeded half of allocatable space for dynamic partitions 1073741824.\n\nIf you encounter this issue, cherry pick [CL\n1399393](https://android-review.googlesource.com/1399393), rebuild, and flash\nthe boot partition or recovery partition if the device doesn't use recovery as\nboot.\n\n### Fix segmentation fault during merge\n\nAfter applying an OTA update, during the VAB merge process, a call to\n`update_engine_client --cancel` causes `CleanupPreviousUpdateAction` to crash. A\npotential wild pointer error also exists when `markSlotSuccessful` comes late.\n\nThis was resolved by adding the `StopActionInternal` function.\n`CleanupPreviousUpdateAction` cancels pending tasks on destroy. It maintains a\nvariable that tracks the task ID of the pending task in the message loop. On\ndestroy, the pending task is canceled to avoid segfault.\n\nEnsure the following changes are in your Android 11 source tree to fix `SIGSEGV`\ncrashes in `update_engine` during merge:\n\n- [CL 1439792](https://android-review.googlesource.com/1439792) (a prerequisite to CL 1439372)\n- [CL 1439372](https://android-review.googlesource.com/1439372) (`CleanupPreviousUpdateAction`: cancel pending tasks on destroy)\n- [CL 1663460](https://android-review.googlesource.com/1663460) (fix the potential wild pointer error when `markSlotSuccessful` comes late)\n\n### Prevent update_engine premature merge\n\nWhen a device boots (Android 11 and higher), and the boot completes, the\n`update_engine` calls `ScheduleWaitMarkBootSuccessful()`, and\n`WaitForMergeOrSchedule()`. This starts the merge process. However, the device\nreboots to the old slot. Because the merge already started, the device fails to\nboot and becomes inoperable.\n\nAdd the following changes to your source tree. Note that CL 1664859 is optional.\n\n- [CL 1439792](https://android-review.googlesource.com/1439792) (a prerequisite to CL 1439372)\n- [CL 1439372](https://android-review.googlesource.com/1439372) (`CleanupPreviousUpdateAction`: cancel pending tasks on destroy)\n- [CL 1663460](https://android-review.googlesource.com/1663460) (fix the potential wild pointer error when `markSlotSuccessful` comes late)\n- [CL 1664859](https://android-review.googlesource.com/1664859) (optional - add `unittest` for `CleanupPreviousUpdateAction`)\n\n### Ensure the correct dm-verity configuration\n\nIn Android 11 and higher, devices can be inadvertently configured with the\nfollowing dm-verity options:\n\n- `CONFIG_DM_VERITY_AVB=y` in the kernel\n- The bootloader configured to use any verity mode, (such as `AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE`), without `AVB_HASHTREE_ERROR_MODE_MANAGED_RESTART_AND_EIO`.\n\nWith this device configuration, any verity error causes the vbmeta partition to\nbecome corrupted, and renders non-A/B devices inoperable. Similarly, if a merge\nhas started, A/B devices might also become inoperable. Only use the\n`AVB_HASHTREE_ERROR_MODE_MANAGED_RESTART_AND_EIO` verity mode.\n\n1. Set `CONFIG_DM_VERITY_AVB=n` in the kernel.\n2. Configure devices to use the `AVB_HASHTREE_ERROR_MODE_MANAGED_RESTART_AND_EIO` mode instead.\n\nFor more information reference the verity documentation: [Handling dm-verity\nErrors](https://android.googlesource.com/platform/external/avb/+/android16-release/README.md#Handling-dm_verity-Errors).\n\n### Confirm the merged file is correctly configured\n\nIf you are building system images and vendor images separately, then using\n`merge_target_files` to merge them, Virtual A/B configurations might be\nincorrectly dropped during the merge process. To verify that Virtual A/B\nconfigurations are correct in the merged target file, apply the following\npatches: [CL\n2084183](https://android-review.googlesource.com/c/platform/build/+/2084183/)\n(merge identical key/val pairs in dynamic partition info)\n\n### Update necessary components\n\nAs of Android 13, `snapuserd` has been moved from vendor ramdisk to generic\nramdisk. If your device is upgrading to Android 13, it is possible that both\nvendor ramdisk and generic ramdisk contain a copy of `snapuserd`. In this\nsituation, Virtual A/B requires the system copy of `snapuserd`. To ensure that\nthe correct copy of `snapuserd` is in place, apply [CL\n2031243](https://android-review.googlesource.com/c/platform/system/core/+/2031243/)\n(copy `snapuserd` to first_stage_ramdisk)."]]