ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
ใช้ DT หลายรายการ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ผู้ให้บริการ SoC และ ODM จํานวนมากรองรับการใช้ Device Tree (DT) หลายรายการในอุปกรณ์ ซึ่งช่วยให้ใช้ SKU หรือการกำหนดค่าหลายรายการในภาพเดียวได้ ในกรณีเช่นนี้ บูตโหลดเดอร์จะระบุฮาร์ดแวร์และโหลด DT ที่เกี่ยวข้องขณะรันไทม์

รูปที่ 1 การซ้อนทับ Device Tree (DTO) หลายรายการใน Bootloader
หมายเหตุ: คุณไม่จำเป็นต้องใช้ DT หลายรายการ
ตั้งค่า
หากต้องการเพิ่มการรองรับ DT หลายรายการลงในรูปแบบ DTO ให้ตั้งค่ารายการ DT หลักและรายการ DT วางซ้อนอีกรายการ

รูปที่ 2 การใช้งาน DTO รันไทม์สําหรับ DT หลายรายการ
ตัวโหลดการเปิดเครื่องควรทําสิ่งต่อไปนี้ได้
- อ่านรหัส SoC แล้วเลือก DT หลักที่เกี่ยวข้อง
- อ่านรหัสบอร์ดและเลือกชุด DT การวางซ้อนตามความเหมาะสม
คุณควรเลือก DT หลักเพียงรายการเดียวเพื่อใช้งานขณะรันไทม์ คุณเลือก DT วางซ้อนได้หลายรายการ แต่ต้องเข้ากันได้กับ DT หลักที่เลือก การใช้การวางซ้อนหลายรายการจะช่วยหลีกเลี่ยงการจัดเก็บการวางซ้อน 1 รายการต่อบอร์ดภายในพาร์ติชัน DTBO และช่วยให้บูตโหลดเดอร์ระบุชุดย่อยของการวางซ้อนที่จำเป็นตามรหัสบอร์ดได้ (หรืออาจใช้การสำรวจอุปกรณ์ต่อพ่วง) ตัวอย่างเช่น บอร์ด ก อาจต้องเพิ่มอุปกรณ์ด้วยการวางซ้อน 1, 3 และ 5 ส่วนบอร์ด ข อาจต้องเพิ่มอุปกรณ์ด้วยการวางซ้อน 1, 4 และ 5
พาร์ติชัน
หากต้องการแบ่งพาร์ติชัน ให้ระบุตำแหน่งที่เชื่อถือได้และเข้าถึงได้ในช่วงรันไทม์ของบูตโหลดเดอร์ในหน่วยความจำแฟลชเพื่อจัดเก็บ DTB และ DTBO (บูตโหลดเดอร์ต้องค้นหาไฟล์เหล่านี้ได้ในกระบวนการจับคู่) โปรดทราบว่า DTB และ DTBO ไม่สามารถอยู่ในพาร์ติชันเดียวกัน หาก DTB/DTBO อยู่ในพาร์ติชัน dtb
/dtbo
ให้ใช้โครงสร้างตารางและรูปแบบส่วนหัวตามที่ระบุไว้ในรูปแบบพาร์ติชัน DTB และ DTBO
ทำงานใน Bootloader
วิธีเรียกใช้
- ระบุ SoC และโหลด .dtb ที่เกี่ยวข้องจากพื้นที่เก็บข้อมูลลงในหน่วยความจำ
- ระบุบอร์ดและโหลด
.dtbo
ที่เกี่ยวข้องจากที่เก็บข้อมูลลงในหน่วยความจำ
- วางซ้อน
.dtb
กับ .dtbo
เพื่อสร้างไฟล์ DT ที่ผสาน
- เริ่มเคอร์เนลโดยระบุที่อยู่หน่วยความจำของ DT ที่ผสาน
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 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-26 UTC"],[],[],null,["# Use multiple DTs\n\nMany SoC vendors and ODMs support the use of multiple device trees (DTs) on a device,\nenabling one image to power multiple SKUs or configurations. In such cases, the\nbootloader identifies the hardware and loads the corresponding DT at runtime:\n\n**Figure 1.** Multiple device tree overlays (DTOs) in bootloader.\n\n**Note:** Using multiple DTs isn't mandatory.\n\nSet up\n------\n\nTo add support for multiple DTs to the DTO model, set up a list of main DTs\nand another list of overlay DTs.\n\n**Figure 2.** Runtime DTO implementation for multiple DTs.\n\nThe bootloader should be able to:\n\n- Read the SoC ID and select the corresponding main DT.\n- Read the board ID and select the set of overlay DTs accordingly.\n\nOnly one main DT should be selected for use at runtime. Multiple overlay DTs\nmay be selected but they must be compatible with the chosen main DT. Using\nmultiple overlays can help avoid storing one overlay per board within the DTBO\npartition and enable the bootloader to determine the subset of required overlays\nbased on the board ID (or possibly by probing the peripherals). For\nexample, Board A may need the devices added by the overlays 1, 3, and 5 while\nBoard B may need the devices added by the overlays 1, 4, and 5.\n\nPartition\n---------\n\nTo partition, determine a bootloader runtime-accessible and trusted location\nin flash memory to store the DTBs and DTBOs (bootloader must be able to locate\nthese files in the matching process). Keep in mind that DTBs and DTBOs cann't\nexist in the same partition. If your DTBs/DTBOs are in the\n`dtb`/`dtbo` partition, use the table structure and header\nformat detailed in [DTB and DTBO\npartition format](/docs/core/architecture/dto/partitions).\n\nRun in bootloader\n-----------------\n\nTo run:\n\n1. **Identify the SoC** and load the corresponding .dtb from storage into memory.\n2. **Identify the board** and load the corresponding `.dtbo` from storage into memory.\n3. Overlay the `.dtb` with the `.dtbo` to be a merged DT.\n4. Start kernel given the memory address of the merged DT."]]