Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release thay vì aosp-main để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trong Android 10 và 11,
ramdisk giai đoạn đầu chứa nhị phân khởi động giai đoạn đầu (thực hiện việc gắn sớm như được chỉ định
bởi các mục fstab) và tệp fstab của nhà cung cấp. (Như trong Android 9 trở xuống, system.img chứa nội dung của $TARGET_ROOT_OUT.)
Đối với các thiết bị có boot-ramdisk (không phải A/B), quá trình khởi động giai đoạn đầu là một tệp thực thi tĩnh nằm tại /init. Các thiết bị này gắn system.img dưới dạng /system, sau đó thực hiện thao tác chuyển đổi gốc để di chuyển điểm gắn tại /system sang /.
Nội dung của ramdisk sẽ được giải phóng sau khi quá trình gắn kết hoàn tất.
Đối với các thiết bị sử dụng tính năng khôi phục dưới dạng ramdisk, quá trình khởi chạy giai đoạn đầu tiên nằm tại /init trong ramdisk khôi phục. Trước tiên, các thiết bị này chuyển đổi thư mục gốc sang /first_stage_ramdisk để xoá các thành phần khôi phục khỏi môi trường, sau đó tiến hành tương tự như các thiết bị có boot-ramdisk (tức là gắn system.img dưới dạng /system, chuyển đổi thư mục gốc để di chuyển phương tiện gắn đó sang / và giải phóng nội dung ramdisk sau khi gắn). Nếu androidboot.force_normal_boot=1 có trong dòng lệnh hạt nhân (hoặc bootconfig từ Android 12 trở lên), thì các thiết bị sẽ khởi động bình thường (vào Android) thay vì khởi động vào chế độ khôi phục.
Sau khi hoàn tất giai đoạn khởi chạy đầu tiên, quá trình này sẽ thực thi /system/bin/init bằng đối số selinux_setup để biên dịch và tải SELinux vào hệ thống. Cuối cùng, init sẽ thực thi lại /system/bin/init bằng đối số second_stage. Tại thời điểm này, giai đoạn chính của quá trình khởi chạy sẽ chạy và tiếp tục quá trình khởi động bằng các tập lệnh init.rc.
Các phần sau đây trình bày chi tiết sự khác biệt về bố cục phân vùng cho các thiết bị không phải A/B trước và sau Android 10.
Bố cục phân vùng (thiết bị không phải A/B)
Các phần sau đây trình bày chi tiết sự khác biệt về bố cục phân vùng cho các thiết bị không phải A/B trước và sau Android 10.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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 ..."]]