# Patch DSDT Phần 1

## **Dump `DSDT`**

### Windows

> Recommend

**B1**: Down `ssdt-time` từ nguồn [sau](https://github.com/corpnewt/SSDTTime)

**B2**: Bấm phím `8` sau đó enter&#x20;

**B3**: Lấy dsdt từ thư mục của `ssdt-time`

![](https://lh5.googleusercontent.com/3YtJQMBP_rs6jRtn-PsyRTOe29lq8xdNBXqRjngYHXNuEJKuZfUAmbtIPA9lQZKMMXix-f2XnuZyyxnhnXS9xxunyg4g4Ucvj7xOZaWsNx_KwpuEUkudAqZWXOsw4Gr88S1EStDv=s0)

> Lưu ý: Nếu các bạn dual boot với win qua opencore thì dsdt sau khi dump sẽ mất đi sự thuần khiết&#x20;
>
> > sinh ra nhiều lỗi hơn

### Winpe

#### Method Using `Rw everything`

B1: Tải [rw-evrything](http://rweverything.com/download/)

B2: Các bạn tiến hành cài đặt và mở app&#x20;

B3: Sau đó các bạn chọn vào menu `Access ⇒ ACPI Tables ⇒ dsdt`

B4: Sau đó các bạn bấm save và chọn nơi lưu&#x20;

B5: Tiếp các bạn đổi tên file từ đuôi `.bin ⇒ .aml`&#x20;

B6: Sau đó boot về mac và tận hưởng thôi&#x20;

#### Method `Acpidump.exe`

B1: Tải [acpidump.exe](https://acpica.org/downloads/binary-tools)&#x20;

B2 : Mở `cmd` ra&#x20;

B3: `[ kéo acpidump.exe vào ] -b -n DSDT -z`

B4: Đổi extension của dsdt từ `.dat ⇒ .aml`&#x20;

### Macos

#### Method `acpidump.efi`

**B1**: Tải `acpidum.efi` từ nguồn [sau](https://github.com/dortania/OpenCore-Install-Guide/blob/master/extra-files/acpidump.efi.zip) đó bỏ nó vào mục `EFI-tool` rồi snapshot config

**B2**: Tại giao diện boot chọn `acpidum.efi` &#x20;

**B3**: Dùng `open‌sell.efi`  dán đoạn sau vào `openshell.efi`&#x20;

> Viết từng dòng không dán toàn bộ

```
fs0: // replace with proper drive

dir  // to verify this is the right directory

cd EFI\OC\Tools

EFI\OC\Tools> acpidump.efi -b -n DSDT -z
```

> Khi dán toàn bộ vào nó sẽ có dạng là

```
shell> fs0: // replace with proper drive

fs0:\> dir  // to verify this is the right directory

   Directory of fs0:\

   01/01/01 3:30p EFI

fs0:\> cd EFI\OC\Tools

fs0:\EFI\OC\Tools> acpidump.efi -b -n DSDT -z
```

> Lưu ý : Sau khi dump xong nó sẽ nằm ở mục `EFI ⇒ OC ⇒ tool` dưới dạng file `.dat` hãy rename nó lại thành file `.aml`

#### Method `SysReport Quirk`

> Recommend

B1: Các bạn cần tạo 1 bộ `efi debug` như sau:

* Tải bộ [opencore pkg debug](https://github.com/acidanthera/opencorepkg/releases)
* Thay thế các mục sau vào efi đang sử dụng&#x20;
  * `bootX64.efi`
  * `drivers`
  * `opencore.efi`

B2: Mở config lên snaps lại và tìm như hình&#x20;

![](https://lh6.googleusercontent.com/k_3zv83oQuGu2EEU1i-xk6Aqn_vlW7HtIDJz8f-9X6GUdoN-hoRga1NEvRAv91Wcu5BAnFV1r2EcLUgd5n4zftJRSaMc1l-tzg_GJA85cFFX6xPrr4YhczrnElJWIb-ZTlWEZWy9=s0)

B3: Boot lại vào ổ cứng&#x20;

B4: Các bạn sẽ thấy xuất hiện mục `SysReport ⇒ ACPI`

![](https://lh5.googleusercontent.com/DHiHPSsiG_klXenIfZgwXllxnEXwh3RIgAIu1FSSMM-760pSubbLzerXAqD0cQPsKV7RXEuCVd2uk_KJ-8UPQS8ag5AynOMdzAuU_otPyzBF_ccSdSefxapZx3PNDL_nxp0un1rz=s0)

![](https://lh3.googleusercontent.com/3z0J2PxCdKzjDtR7usSNQ3a7dUn-qgvYymJjQgSmMGdB6_0jDiM-4o3Jg03LmKV56HJ58mVYMq4Hu5rU4pmZEUIddR5VbWVRVcH7GLkdaB3iPQCKAh0zc0P_PTVWHCKbeMTZKH2Y=s0)

> Sau khi làm xong các bạn sẽ được như hình&#x20;

![](https://lh4.googleusercontent.com/H5ZqduhdBqrFczNnkQq_sNicD-S-pvJs2RvqynIdm8wEAUbnCTdPLzp-qLqGZBHI3YFqWk-6EqEIz4444bJIw91hwx5wafulgjPVcv3rElPRr_9pznrzrskqPnEl9J6WeU8k99Lt=s0)

#### Method Using `Hackintool`

B1:  Các bạn mở hackintool mục `utilities`

B2: Các bạn ấn ![](https://lh3.googleusercontent.com/dfguZY9Ik7T8V-Asyqw-qrxS4FpJWYIDMe6Z49WQJErhryBwbJGxnoaeHl3tHW5ty5DhK0KruPMwtyH9h2B5xY4vnhyhXWU120_8sk4gt80Mtb2jNWpgJLUq26TvCRXh45h3pCUz=s0)&#x20;

B3: Chọn nơi lưu&#x20;

> Sau khi chọn xong sẽ được như hình

![](https://lh3.googleusercontent.com/aHTbga7EWfVBM11xNzpn71A5QRfHaeI0YBm30OSX26M8ZBsVL3_HDsM8plK0nA2Cv4RFOaOaTJi_NI0jhpHEfs8Aafe6OHg2A6-QRwRm21LBBrTq98qYZ7RN4DcuLo2HDeakUrDw=s0)

B4: Mở folder chọn lưu ở bước 2 ra và copy file `dsdt.aml` ra nơi mà bạn muốn như của mình nó sẽ là ở `desktop`

![](https://lh6.googleusercontent.com/Y1q-FciNEJhvvtsgnHbz_5c9JMvt9gcn5WvxXpEW1SglbqPZmUvNXp8bHIt0abbM_EwNBN6xFuB7NhV6Ozy7HUhLQQWc2x-rqpwK32xOUoEmxA0RL994Vt0LeNcr0SSBiShtzMQ1=s0)

#### Method `patchmatic`

B1: Tải [patchmatic](https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/)

B2: Nhập lệnh sau vào `terminal`&#x20;

`cd + [ kéo folder muốn lưu ssdt vào ] [kéo patchmatic vào ] -extract`

> Sau khi làm xong các bạn sẽ được như hình&#x20;

![](https://lh3.googleusercontent.com/gDaVFvNeT_OTDv0TFpUUKDEdQICsaSd0g6nwlGEHXF0NLAHnXkPVAtkIFa8EhwMED3hF-mVcQ7q1aLRfH3dfdqtU4ZXr5_g_7VDmncKMiWaE5XBW0EAoUh8r4u4oeihgg40TcIf6=s0)

B3: Mở folder vừa chọn ở bước 2 sẽ được như hình&#x20;

![](https://lh4.googleusercontent.com/Q3eNYJzyRnQfazI_M-NulPKHe_KapLfzbNZITawpAeeGsHLu1gJ4A5Wo2k2rAxCwKCJ46LzzgWTf_yzSha0oYocqZR0O5uutL2QKEvVVllvyr10PAAx69xcdr2JcGiV-QL6p09tH=s0)

#### Method clover

> Recommend

B1: Tải efi clover [ở đây](https://drive.google.com/drive/folders/1fh5ZKcshCjLAp5SMH200Snd0DAvTmIDL?usp=sharing)&#x20;

B2: Cho efi vừa tải vào usb hoặc 1 phân vùng trên ổ cứng&#x20;

> Được format với chuẩn fat32

B3: Boot vào efi vừa tải&#x20;

B4: Ngay giao diện boot các bạn ấn `F4`&#x20;

> Hoặc `Fn +F4`

B5: Boot lại vào macos các bạn vào efi clover mục `ACPI ⇒ origin`

B6: Các bạn sẽ được như hình&#x20;

![](https://lh5.googleusercontent.com/Q7IceDENPqbwTFkXgEN9871vRGFDqBh-fLAiFZ9A5FrNJ4i3TbrCZ8sHb37862jHjxblYbWm1WkwcSh_G1e4d8A0Y7UUwP_PwkC6riuPRuUpV-E5cmBECDEO1h10PSQ5RIWMAWVD=s0)

> Lưu ý: Ở macos mình đưa ra khá nhiều cách dump nhưng theo cảm nhận của mình thì  cách dump bằng clover là chuẩn và trực quan nhất&#x20;

### Linux

> Recommend

#### Method Using Terminal

B1: Mở `terminal`&#x20;

> nhấn `ALT + T`&#x20;

B2: Gõ lệnh&#x20;

```
Cd + [ tên nơi các bạn muốn lưu file ]
sudo apt update
sudo apt install acpidump
sudo acpidump > acpidump.out
sudo acpixtract -a acpidump.out
```

B3: Sau khi nhập các lệnh trên thì terminal sẽ dump tất cả các file acpi ra ngoài nơi mà các bạn chỉ định ở đây các bạn sẽ tìm file dsdt và đổi tên file từ đuôi `.dat ⇒ .aml`

#### Method Using `ssdt-time`

B1: Tải [ssdt-time](https://github.com/corpnewt/SSDTTime)

B2: Chọn phím `4`&#x20;

B3: ssdt sẽ được dump tự động vào mục `Results`

<figure><img src="https://lh6.googleusercontent.com/Li54WCXY7_Y15H-HtXL_Ur9rFkXlMTvni_MQnWltCHKUwpS1Tx_InJ0mYwVZ8XtIdMJlwOOPC6_L1sAZCh5zoUuHNfDH2XIpfOTwZr0b-uqL0okK76PAMFF_HRFnDMn61D3G12D8=s0" alt=""><figcaption></figcaption></figure>

> Lưu ý: Mình khuyến khích các bạn dùng `sysreport` và tính năng dump của clover&#x20;
>
> Vậy khi nào thì dùng `patchmatic`? Dùng `patchmatic` sẽ apply tất cả các hotpatch vào dsdt vì vậy sẽ mất đi bản chất gốc của dsdt nó sẽ sinh ra 1 số lỗi còn nếu các máy dùng `patchmatic` để dump dsdt mà không có error thì cứ dùng `patchmatic` để dump
>
> > Nhưng hãy nhớ rằng ko chỉ riêng `patchmatic` mà bất cứ công cụ nào dump DSDT trong MacOS

## **Biên dịch dsdt**

### AML to DSL

B1: Tải [maciasl](https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/)

B2: Chọn `show package contents ⇒ contents  ⇒ macos` &#x20;

![](https://lh3.googleusercontent.com/vxlfGSeeSldAmAeiA2hzupFHa_XavD3Krv6p6JDQY81YBZh0_Xw-MVX_0A8SWENZSTQ6bd_EYAc1Rqy9-FqxRiflBbrtabaZElvOSUQa10NbPXsHdF_AvaiUSdq_NB05dRTcudTk=s0)

![](https://lh6.googleusercontent.com/Tuu-JT2IjfcstvBIeMuONaTTrdRDUj4sK64zEN5zaatiuNop5d99FcQFN5sj41ZAqNPcip4A_7AyJEugwvAR6Ft6fFxBSswPC_msFKn3in-jbO4mlZi-GLMMfkbhh1N8ertqgRTM=s0)

B3: Copy file `iasl62` vào thư mục lưu dsdt&#x20;

> Như của mình là `extract`

![](https://lh5.googleusercontent.com/OEkCeGPzc5pyTlTG93A3SBZZzX_vRSbBZhicHJNDvGVPj1SyZEHc9ob4X8YSAh3F-Oj_DY3UpNyUODpmSLZLPDr8uxpXGrVe0z-CfLOAJIaiUir1jik7IS2DaiPZIsGCBdw_fbh4=s0)

B4: Copy đoạn code sau vào bộ nhớ tạm&#x20;

> `Command +c`

```
External(MDBG, MethodObj, 1)

External(_GPE.MMTB, MethodObj, 0)

External(_SB.PCI0.LPCB.H_EC.ECWT, MethodObj, 2)

External(_SB.PCI0.LPCB.H_EC.ECRD, MethodObj, 1)

External(_SB.PCI0.LPCB.H_EC.ECMD, MethodObj, 1)

External(_SB.PCI0.PEG0.PEGP.SGPO, MethodObj, 2)

External(_SB.PCI0.GFX0.DD02._BCM, MethodObj, 1)

External(_SB.PCI0.SAT0.SDSM, MethodObj, 4)

External(_GPE.VHOV, MethodObj, 3)

External(_SB.PCI0.XHC.RHUB.TPLD, MethodObj, 2)
```

B5: Gõ lệnh sau và `terminal`&#x20;

> Sau khi làm xong sẽ được như hình&#x20;

```
cd + [ kéo folder lưu dsdt vào ]
pbpaste>refs.txt
```

![](https://lh6.googleusercontent.com/28fTnQzt65XKqbMNVcI3h3RHKBc5jjWgNUeuOEINLNTlx782-Q-4cHF8MnxYYy4Y7RmculCSmGSLRp4UGDJ6Ytop22mFoWW4GG_I_0BRXPp_rpl7X3RxzQRXU3gGyMsg8VhmLYUJ=s0)

B6: Gõ lệnh sau vào terminal&#x20;

`[ kéo file iasl62 vào ] -da -dl -fe refs.txt DSDT.aml SSDT*.aml`

> Lưu ý: Ở đây mình hướng dẫn biên dịch file dsdt với `refs.txt` sẽ giúp giảm các lỗi phổ biến. Nếu bạn nào cảm thấy không thích refs.txt thì các bạn nhập code sau vào `terminal`&#x20;

`[ kéo file iasl62 vào ] -da -dl *.aml`

> Lưu ý 2: Nếu các bạn cần biên dịch 1 file ssdt nào đó hoặc dsdt mà muốn dùng `refs.txt` thì dùng code trên sẽ ta sẽ bị lỗi vì code trên áp dụng khi bạn có 2 file dsdt và ssdt cần biên dịch nếu chỉ biên dịch 1 file ta nhập code sau&#x20;
>
> > Ở đây đang nói là dùng phương pháp `refs.txt`&#x20;

* SSDT: `[ kéo file iasl62 vào ] -da -dl -fe refs.txt SSDT*.aml`
* DSDT: `[ kéo file iasl62 vào ] -da -dl -fe refs.txt DSDT.aml`&#x20;

### DSL to AML

B1: Ấn `complie`

![](https://i.imgur.com/mlAru41.png)

B2: Chọn `File -> Save as`

![](https://i.imgur.com/ftj2NmU.png)

B3: Sửa file formart lại thành `ACPI Machine language Binary`

![](https://i.imgur.com/dpMrREJ.png)

B4: Ấn save

<details>

<summary>Biên dịch DSDT và SSDT ở Windows</summary>

Biên dịch từ `.aml` sang `.dsl`

B1: Các bạn tải tool [Xiasl](https://github.com/ic005k/Xiasl/releases)

B2: Giải nén và chạy `Xiasl.exe`

B3: Chọn `File -> Open` và chọn file `.aml` mà bạn muốn biên dịch&#x20;

![](/files/G4oMEjI9vNEUy7GmRHrV)

Sau khi ấn `Open` thì file đã được biên dịch rồi đấy

![](/files/fuoFaqf19NrYQgFNBvul)

Tiếp theo ta sẽ biên dịch ngược lại từ `.dsl` sang `.aml`

Biên dịch từ `.dsl`sang `.aml`

B1: Các bạn tải tool [Xiasl](https://github.com/ic005k/Xiasl/releases)

B2: Giải nén và chạy `Xiasl.exe`

B3: Chọn `File -> Open` và chọn file `.dsl`mà bạn muốn biên dịch&#x20;

B4: Nhấn `Complie` để tiến hành biên dịch&#x20;

![](/files/IMwuxvxWhvskDJcxRWtQ)

Và như vậy là xong rồi. Các file sau khi biên dịch từ `.aml` sang `.dsl` hoặc ngược lại đều nằm cùng folder với file gốc trước khi biên dịch

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://advance.heavietnam.com/acpi-advance/patch-dsdt-phan-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
