Android 10 से, CTS-on-GSI/VTS कंप्लायंस टेस्टिंग को रन करने के लिए इस्तेमाल की जाने वाली सामान्य सिस्टम इमेज (जीएसआई) को रिलीज़ के लिए साइन किया जाता है. इसलिए, इसे यूज़रडीबग से यूज़र बिल्ड टाइप में बदल दिया गया है. यह VTS टेस्टिंग के लिए एक समस्या है, क्योंकि VTS को चलाने के लिए adb root की ज़रूरत होती है. हालांकि, adb root किसी यूज़र बिल्ड डिवाइस पर उपलब्ध नहीं है.
डीबग रैमडिस्क (या डीबग बूट इमेज) को इसलिए पेश किया गया है, ताकि adb root को ऐसे डिवाइस पर चालू किया जा सके जिसका बूटलोडर अनलॉक किया गया हो. इससे टेस्टिंग का तरीका आसान हो जाता है. ऐसा इसलिए, क्योंकि CTS-on-GSI और VTS-on-GSI के लिए, एक ही यूज़र बिल्ड जीएसआई system.img का इस्तेमाल किया जाता है. एसटीएस सेट अप करने के लिए, किसी दूसरे userdebug ओईएम system.img का इस्तेमाल करना अब भी ज़रूरी है.
नीचे दी गई टेबल में, Android 10 में अनुपालन की जांच के लिए, इमेज और बिल्ड टाइप में हुए बदलावों को दिखाया गया है.
| टेस्ट सुइट | इनसे जांचें | बनाएं | ramdisk को डीबग करना | adb root? | Android 9 -> 10 बिल्ड वैरिएंट में बदलाव |
|---|---|---|---|---|---|
| CTS | ओईएम का सिस्टम | उपयोगकर्ता | नहीं | नहीं | कोई बदलाव नहीं |
| CTS-on-GSI | GSI | उपयोगकर्ता | नहीं | नहीं | userdebug -> उपयोगकर्ता जीएसआई रिलीज़ पर हस्ताक्षर किया गया |
| STS | ओईएम का सिस्टम | userdebug | नहीं | Y | Q में नई सुविधा |
| VTS | GSI | उपयोगकर्ता | Y | Y | userdebug -> उपयोगकर्ता जीएसआई रिलीज़ पर हस्ताक्षर किया गया |
खास जानकारी
ये अतिरिक्त इमेज फ़ाइलें, build फ़ोल्डर (${ANDROID_PRODUCT_OUT}) में जनरेट की जाती हैं:
boot-debug.imgvendor_boot-debug.img
जब boot-debug.img को डिवाइस के boot पार्टीशन पर फ़्लैश किया जाता है, तब सिस्टम की sepolicy फ़ाइल का userdebug वर्शन और एक अतिरिक्त प्रॉपर्टी फ़ाइल, adb_debug.prop लोड होती है. इससे, उपयोगकर्ता के बिल्ड system.img के साथ adb root को अनुमति मिलती है. यह GSI या OEM का हो सकता है.
सामान्य कर्नेल इमेज (जीकेआई) का इस्तेमाल करने वाले ऐसे डिवाइसों के लिए जिनमें vendor_boot पार्टिशन है, boot-debug.img को फ़्लैश नहीं किया जाना चाहिए. ऐसा इसलिए, क्योंकि boot पार्टिशन को सर्टिफ़ाइड जीकेआई इमेज के साथ फ़्लैश किया जाना चाहिए.
इसके बजाय, vendor_boot-debug.img को vendor_boot पार्टीशन पर फ़्लैश किया जाना चाहिए, ताकि ramdisk को डीबग किया जा सके.
डीबग रैमडिस्क का इस्तेमाल करने की ज़रूरी शर्तें
डबग रैमडिस्क, ओईएम उपलब्ध कराता है. ओईएम ही अनुपालन से जुड़े टेस्ट करता है. इसे रिलीज़ के लिए साइन नहीं किया जाना चाहिए. साथ ही, इसका इस्तेमाल सिर्फ़ तब किया जा सकता है, जब डिवाइस अनलॉक हो.
डिबग रैमडिस्क जनरेट नहीं किया जाएगा. साथ ही, इसका इस्तेमाल इन डिवाइसों को अपग्रेड करने के लिए नहीं किया जाएगा:
BOARD_BUILD_SYSTEM_ROOT_IMAGEtrueskip_initramfsकर्नेल कमांड लाइन में
Android 12 GSI
Android 12 जीएसआई के साथ डीबग रैमडिस्क का इस्तेमाल करने के लिए, किसी अन्य निर्देश की ज़रूरत नहीं है.
29/09/2021 से, डिबग रैमडिस्क को repack_bootimg टूल से अपडेट करने की ज़रूरत नहीं होगी. Android 12 GSI SGR1.210929.001 (7777720) के बाद के बिल्ड में, system.img में अप-टू-डेट userdebug_plat_sepolicy.cil फ़ाइल शामिल होती है. साथ ही, यह डीबग रैमडिस्क से userdebug_plat_sepolicy.cil को अनदेखा करता है. ज़्यादा जानकारी के लिए, सीएल देखें.
Android 11 GSI
boot-debug.img या vendor_boot-debug.img का इस्तेमाल करने पर, सिस्टम sepolicy को boot-debug.img या vendor_boot-debug.img के debug ramdisk में मौजूद userdebug_plat_sepolicy.cil फ़ाइल से लोड किया जाता है. GSI इमेज बूट करने के लिए, कृपया android11-gsi ब्रांच से, sepolicy में किए गए अप-टू-डेट बदलावों को हमेशा शामिल करें, ताकि boot-debug.img या vendor_boot-debug.img को फिर से बनाया जा सके.
इसके अलावा, repack_bootimg टूल का इस्तेमाल करके, अपडेट किए गए जीएसआई सेपॉलिसी के साथ boot-debug.img या vendor_boot-debug.img को फिर से बनाया जा सकता है.
डीबग रैमडिस्क को फिर से पैक करें
सेपॉलिसी में बदलावों को शामिल करके boot-debug.img को फिर से बनाने के बजाय, पार्टनर repack_bootimg का इस्तेमाल करके, जीएसआई सेपॉलिसी फ़ाइल को boot-debug.img में अपडेट कर सकते हैं. अगर डिवाइस GKI का इस्तेमाल करता है, तो vendor_boot-debug.img में अपडेट किया जा सकता है.
इसके लिए, यह तरीका अपनाएं:
otatools.zipको https://ci.android.com से डाउनलोड करें. हमारा सुझाव है कि आपaosp_cf_arm64_only_phone-userdebugके बिल्ड आर्टफ़ैक्ट से डाउनलोड करें. यहaosp-android-latest-releaseब्रांच पर उपलब्ध है.repack_bootimgके लिए, एक्ज़ीक्यूशन एनवायरमेंट सेट अप करें:unzip otatools.zip -d otatoolsexport PATH="${PWD}/otatools/bin:${PATH}"repack_bootimg --helpGSI के जिस बिल्ड का इस्तेमाल किया जा रहा है उससे
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 GKIrepack_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.cilboot-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 GKIrepack_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, फ़ाइल userdebug_plat_sepolicy.cil को --src_bootimg के रैमडिस्क से --dst_bootimg के रैमडिस्क में कॉपी करता है. हालांकि, अलग-अलग 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 rootadb shell cat /proc/cmdline | grep force_normal_boot
Android 12 से, डिबग रैमडिस्क में पाथ हमेशा userdebug_plat_sepolicy.cil होता है. भले ही, कर्नल कमांड लाइन में androidboot.force_normal_boot=1 मौजूद हो या न हो. यहां दी गई टेबल में, अलग-अलग Android वर्शन में, डीबग रैमडिस्क के पाथ दिखाए गए हैं.
| डीबग इमेज | Android 10 | Android 11 | Android 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 |
src_path:dst_path जोड़े की सूची के साथ, अलग-अलग पाथ से और अलग-अलग पाथ पर फ़ाइलें कॉपी करने के लिए, --ramdisk_add तय किया जा सकता है. उदाहरण के लिए, यहां दिया गया निर्देश, 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.cilAVB फ़ुटर जोड़ना
अगर --dst_bootimg को पास की गई इमेज को AVB-chained पार्टीशन के तौर पर कॉन्फ़िगर किया गया है, तो repack_bootimg कमांड चलाने के बाद AVB फ़ुटर जोड़ना होगा.
उदाहरण के लिए, repack_bootimg चलाने से पहले, यह देखने के लिए कि क्या किसी vendor_boot-debug.img में चेन किया गया AVB फ़ूटर है, यहां दिया गया निर्देश चलाएं.
avbtool info_image --image vendor_boot-debug.imgअगर इसमें पहले से ही चेन किया गया AVB फ़ूटर है, तो repack_bootimg कमांड चलाने के बाद AVB फ़ूटर जोड़ना होगा. vendor_boot-debug.img पर हस्ताक्षर करने के लिए किसी भी टेस्ट कुंजी का इस्तेमाल किया जा सकता है. ऐसा इसलिए, क्योंकि डीबग रैमडिस्क का इस्तेमाल सिर्फ़ तब किया जा सकता है, जब डिवाइस अनलॉक हो. इससे boot या 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