Od 27 marca 2025 r. zalecamy używanie android-latest-release zamiast aosp-main do kompilowania i wspołtworzenia AOSP. Więcej informacji znajdziesz w artykule o zmianach w AOSP.
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
.
W Androidzie 10 i 11 pierwsza faza pamięci RAM zawiera binarny plik init (który wykonuje wczesne montowanie zgodnie z informacjami w plikach fstab) oraz pliki fstab producenta. (w Androidzie 9 i starszych system.img zawiera zawartość $TARGET_ROOT_OUT).
W przypadku urządzeń z boot-ramdisk (nie A/B) pierwszym etapem inicjalizacji jest statyczny plik wykonywalny znajdujący się w folderze /init. Te urządzenia montują system.img jako /system, a następnie wykonują operację przełączenia katalogu, aby przenieść punkt zamontowania /system do /.
Treści z pamieci RAM są zwalniane po zakończeniu montowania.
W przypadku urządzeń, które używają odzyskiwania jako dysku RAM, pierwszy etap inicjalizacji znajduje się w /init na dysku RAM odzyskiwania. Najpierw przełącz root na /first_stage_ramdisk, aby usunąć komponenty odzyskiwania z otoczenia, a potem postępuj tak samo jak w przypadku urządzeń z boot-ramdisk (czyli zamontuj system.img jako /system, przełącz root, aby przenieść ten mount do /, i zwolnij zawartość ramdisk po zamontowaniu). Jeśli androidboot.force_normal_boot=1 jest obecny na linii poleceń jądra (lub w bootconfig od Androida 12), urządzenia uruchamiają się normalnie (w Androidzie), a nie w trybie odzyskiwania.
Po zakończeniu pierwszego etapu inicjalizacji uruchamia się /system/bin/init z argumentem
selinux_setup, aby skompilować i wczytać SELinux do systemu. Na koniec funkcja init ponownie wykonuje funkcję /system/bin/init, podając jej argument second_stage. W tym momencie uruchamia się główna faza init i kontynuuje proces uruchamiania za pomocą skryptów init.rc.
W następnych sekcjach szczegółowo opisujemy różnice w schematach partycji na urządzeniach innych niż A/B przed i po Androidzie 10.
Układy partycji (urządzenia inne niż A/B)
W następnych sekcjach szczegółowo opisujemy różnice w schematach partycji na urządzeniach innych niż A/B przed i po Androidzie 10.
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# Ramdisk partitions\n\n| **Note:** This page applies to Android 11 and lower. For Android 12 and greater, see [Generic boot\n| partition](/docs/core/architecture/bootloader/partitions/generic-boot).\n\nIn Android 10 and 11,\nthe first stage ramdisk\ncontains the first stage init binary (which performs early mounting as specified\nby fstab entries) and vendor fstab files. (As in Android 9 and lower,\n`system.img` contains the contents of `$TARGET_ROOT_OUT`.)\n\n- For devices with a boot-ramdisk (non-A/B), first stage init is a static\n executable located at `/init`. These devices mount `system.img` as `/system`,\n then perform a switch root operation to move the mount at `/system` to `/`.\n The contents of the ramdisk are freed after mounting has completed.\n\n- For devices that use recovery as a ramdisk, first stage init is located at\n `/init` within the recovery ramdisk. These devices first switch root to\n `/first_stage_ramdisk` to remove the recovery components from the environment,\n then proceed the same as devices with a boot-ramdisk (that is, mount\n `system.img` as `/system`, switch root to move that mount to `/`, and free\n ramdisk contents after mounting). If `androidboot.force_normal_boot=1` is\n present in the kernel command line (or bootconfig from Android\n 12 onward), devices boot normally (into Android)\n instead of booting into recovery mode.\n\nAfter first stage init finishes, it executes `/system/bin/init` with the\n`selinux_setup` argument to compile and load SELinux onto the system. Finally,\ninit executes `/system/bin/init` again with the `second_stage` argument. At this\npoint, the main phase of init runs and continues the boot process using the\n`init.rc` scripts.\n| **Note:** Android 10 replaces ramdisk contents with a first stage init executable, which is incompatible with how previous ramdisks booted the system.\n\nThe following sections detail differences in partition layouts for non-A/B\ndevices before and after Android 10.\n\nPartition layouts (non-A/B devices)\n-----------------------------------\n\nThe following sections detail differences in partition layouts for non-A/B\ndevices before and after Android 10.\n\n### boot.img\n\n| Ramdisk *(Android 8.x and lower)* | System as root *(Android 9)* | Ramdisk *(Android 10 and 11)* |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Contains a kernel and a `ramdisk.img`. ``` ramdisk.img -/ - init.rc - init - etc -\u003e /system/etc - system/ (mount point) - vendor/ (mount point) - odm/ (mount point) ... ``` | Contains a normal boot kernel only. | Contains a kernel and `ramdisk.img`. ``` ramdisk.img -/ - init - vendor fstab files - system/ (mount point) - vendor/ (mount point) - odm/ (mount point) ... ``` |\n\n### recovery.img\n\nContains a recovery kernel and a recovery `ramdisk.img`\n\n### system.img\n\n| Ramdisk *(Android 8.x and lower)* | System as root *(Android 9)* | Ramdisk *(Android 10 and 11)* |\n|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Contains a `system.img`. ``` system.img -/ - bin/ - etc - vendor -\u003e /vendor - ... ``` | Contains the merged contents of `$TARGET_SYSTEM_OUT` and `$TARGET_ROOT_OUT`. ``` system.img -/ - init.rc - init - etc -\u003e /system/etc - system/ - bin/ - etc/ - vendor -\u003e /vendor - ... - vendor/ (mount point) - odm/ (mount point) ... ``` | Contains the merged contents of `$TARGET_SYSTEM_OUT` and `$TARGET_ROOT_OUT`. ``` system.img -/ - init.rc - init -\u003e /system/bin/init - etc -\u003e /system/etc - system/ - bin/ - etc/ - vendor -\u003e /vendor - ... - vendor/ (mount point) - odm/ (mount point) ... ``` |\n\nPartition layouts (A/B devices)\n-------------------------------\n\nThe following sections detail differences in partition layouts for A/B devices\nbefore and after Android 10.\n\n### boot.img\n\n| System as root *(Android 9)* | Ramdisk *(Android 10 and 11)* |\n|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Contains normal boot kernel and recovery-ramdisk (`BOARD_USES_RECOVERY_AS_BOOT := true`). Recovery-ramdisk is used only to boot into recovery. | Contains normal boot kernel and recovery-ramdisk (`BOARD_USES_RECOVERY_AS_BOOT := true`). Recovery-ramdisk is used to boot into both recovery and Android. ``` ramdisk.img -/ - init -\u003e /system/bin/init - first_stage_ramdisk - vendor fstab files - etc -\u003e /system/etc - system/ (mount point) - vendor/ (mount point) - odm/ (mount point) ... ``` |\n\n### system.img\n\nContains the merged contents of `$TARGET_SYSTEM_OUT` and `$TARGET_ROOT_OUT`. \n\n system.img\n -/\n - init.rc\n - init -\u003e /system/bin/init\n - etc -\u003e /system/etc\n - system/\n - bin/\n - etc/\n - vendor -\u003e /vendor\n - ...\n - vendor/ (mount point)\n - odm/ (mount point)\n ..."]]