Jump to content
18 posts in this topic

Recommended Posts

UefiTableExtract

================

mac OS application to extract and decompile DSDT and SSDT tables from UEFI-Firmware files.

The App is based on acpiTableExtract.pl by Pike R. Alpha

To run this App, you need UEFIExtract and iasl installed in PATH or inside UefiTableExtract.app/Contents/MacOS

You can let the install.command do this for you.

 

The binary files (.aml) will be saved in a AML sub-directory of the directory that holds your firmware.

The IASL compiler/decompiler is called to decompile the files after the AML files are saved.

Decompiled files will be stored in a DSL sub-directory.

 

In some rare cases, decompiling may fails with an error like: 'Namespace lookup failure, AE_ALREADY_EXISTS'

To fix this, look at the output for the last table which produce the error and try something like this from the Terminal:

cd AML
mv SSDT-trouble.aml SSDT-trouble.bin && iasl -d SSDT-trouble.bin
iasl -da DSDT.aml SSDT*.aml

If you are lazy, just open AML/DSDT.aml with MaciASL, but be sure that "Autoload tables in the same directory" is activated!

(For compiling *.dsl files with MaciASL, this compiler option should always be in use.)

 

For editing dsl files I use MaciASL from https://github.com/acidanthera/MaciASL/releases

Compiling can be done with iasl from Terminal or by just pressing the button in MaciASL.

 

To compress DSDT.aml and to put it back into AmiBoardInfo.bin (the original is saved in the AML sub-directory) I use Dsdt2Bios.

And last but not least UEFITool to put them all back into the firmware.

 

Download: https://github.com/Saman-VDR/uefiTableExtract

 

Have fun!

 

 

Edited by uglyJoe
  • Like 3
Link to comment
https://www.insanelymac.com/forum/topic/301861-uefitableextract/
Share on other sites

  • 2 weeks later...

Awesome work!

 

Before ive did this always on Windows with uefi tool, searched them Long, extracted,  then removed the first Bytes from every table to make it iasl compatible, renamed them, ......... endless ^^

 

You maked my life a lot easyer :-)

 

Very usefull if you want to compare tables from other bios files!

 

Thank you!

Oh dear. I wish you asked me before you had done this. I mean this is exactly why we have RFE (Request For Enhancements) in place i.e. someone already asked me to implement this feature. And I did. I just don't have a hack right now. Now what? 

  • Like 1

Update your script with a Credit to uglyJoe :-) xD

No. What he did is not right. Open source is meant to be cooperative, where people can ask the project maintainer/developer (me) for any kind of RFE, or they can join the maintainer/developer (me). So when is a fork ok? 

 

Easy. If the project maintain/developer(s) declines your RFE, which I did not, then a fork would have been ok. This is a rule in the world of OSS.

 

Also. Don't forget. My work is well maintained. It's not an abandoned project. That's also when a fork is the right thing to do, but like it is right now… that is what they call an indecent attempt to take over a well maintained project. Which in my view, and that of many others, is not ok.

  • Like 1

Hello again,

 

@Ramalama

you are welcome :)

See Version 2 - it's more like a App now and should decompile new iMac firmware as well.

I removed command-line args but put the main script in a loop, so that it is possible to drag bios after bios (or even AML folder) .

AML and DST were now saved in the dump directory.

 

 

@Pike

I don't really understand your doubt. It's just a fork of your genius script, nothing more.

 

Fork A Repo

 

 

fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

 

Most commonly, forks are used to either propose changes to someone else's project or to use someone else's project as a starting point for your own idea.

 

Propose changes to someone else's project

A great example of using forks to propose changes is for bug fixes. Rather than logging an issue for a bug you've found, you can:

  • Fork the repository.
  • Make the fix.
  • Submit a pull request to the project owner.
If the project owner likes your work, they might pull your fix into the original repository!

 

 

My intention is just that and all copyrights are in place.

 

 

Have Fun!

  • Like 1

Aah, i did not understand before that he forked your work^^

 

But if its possible pike, please update your script, to dump SSDT tables too, not just DSDT from bios file :-)

 

Cheers :-)

It already dumps SSDT tables. In fact all ACPI tabled, and this particular piece of code didn't change. Some of his changes are also unnecessary. The only thing that really changed was a rename action and calling a command line tool. That is how I see it.

 

p.s. I'm not against crediting someone, but I won't do that for wrong reasons.

Main difference is the call of iasl!

To resolve all external methods optimally, this version decompile all .aml together after your function do the magic.

 

Separate from these differnt strategies - there is a bug:

`$iasl -p DSL/$targetFile -d AML/$targetFile -e DSL/DSDT.aml,DSL/SSDT*.aml` 
fixed:

`$iasl -p DSL/$targetFile -e AML/DSDT.aml AML/SSDT*.aml -d AML/$targetFile` 
Have a look at this diff, one DSDT.dsl was made with your version, the second after my changes: 

imac:AML uglyJoe$ diff -ruN /Bios/Gigabyte/H81MHD3.F2.dump/AML/DSDT-pike.dsl /Bios/Gigabyte/H81MHD3.F2.dump/AML/DSDT.dsl 
--- /Bios/Gigabyte/H81MHD3.F2.dump/AML/DSDT-pike.dsl	2014-11-05 17:06:22.000000000 +0100
+++ /Bios/Gigabyte/H81MHD3.F2.dump/AML/DSDT.dsl	2014-11-05 17:07:18.000000000 +0100
@@ -3,7 +3,7 @@
  * AML Disassembler version 20140926-64 [Sep 26 2014]
  * Copyright (c) 2000 - 2014 Intel Corporation
  * 
- * Disassembly of DSDT.aml, Wed Nov  5 17:06:22 2014
+ * Disassembly of DSDT.aml, Wed Nov  5 17:07:18 2014
  *
  * Original Table Header:
  *     Signature        "DSDT"
@@ -20,17 +20,13 @@
 {
     /*
      * iASL Warning: There were 8 external control methods found during
-     * disassembly, but additional ACPI tables to resolve these externals
-     * were not specified. This resulting disassembler output file may not
-     * compile because the disassembler did not know how many arguments
-     * to assign to these methods. To specify the tables needed to resolve
-     * external control method references, the -e option can be used to
-     * specify the filenames. Example iASL invocations:
-     *     iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml
-     *     iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml
-     *     iasl -e ssdt*.aml -d dsdt.aml
+     * disassembly, but only 7 were resolved (1 unresolved). Additional
+     * ACPI tables may be required to properly disassemble the code. This
+     * resulting disassembler output file may not compile because the
+     * disassembler did not know how many arguments to assign to the
+     * unresolved methods.
      *
-     * In addition, the -fe option can be used to specify a file containing
+     * If necessary, the -fe option can be used to specify a file containing
      * control method external declarations with the associated method
      * argument counts. Each line of the file must be of the form:
      *     External (<method pathname>, MethodObj, <argument count>)
@@ -41,20 +37,13 @@
      * because the disassembler had to guess at the number of arguments
      * required for each:
      */
-    External (_SB_.PCI0.GFX0.GLID, MethodObj)    // Warning: Unresolved method, guessing 1 arguments
-    External (_SB_.PCI0.GFX0.GSCI, MethodObj)    // Warning: Unresolved method, guessing 0 arguments
-    External (_SB_.PCI0.GFX0.IUEH, MethodObj)    // Warning: Unresolved method, guessing 1 arguments
-    External (_SB_.PCI0.PEG0.HPME, MethodObj)    // Warning: Unresolved method, guessing 0 arguments
-    External (_SB_.PCI0.PEG1.HPME, MethodObj)    // Warning: Unresolved method, guessing 0 arguments
-    External (_SB_.PCI0.PEG2.HPME, MethodObj)    // Warning: Unresolved method, guessing 0 arguments
     External (_SB_.TPM_.PTS_, MethodObj)    // Warning: Unresolved method, guessing 1 arguments
-    External (LIDS, MethodObj)    // Warning: Unresolved method, guessing 0 arguments
 
-    External (_PR_.AAC0, UnknownObj)
-    External (_PR_.ACRT, UnknownObj)
-    External (_PR_.APSV, UnknownObj)
-    External (_PR_.CFGD, UnknownObj)
-    External (_PR_.CPU0._PPC, UnknownObj)
+    External (_PR_.AAC0, FieldUnitObj)
+    External (_PR_.ACRT, FieldUnitObj)
+    External (_PR_.APSV, FieldUnitObj)
+    External (_PR_.CFGD, FieldUnitObj)
+    External (_PR_.CPU0._PPC, IntObj)
     External (_SB_.IAOE.ECTM, UnknownObj)
     External (_SB_.IAOE.FFSE, UnknownObj)
     External (_SB_.IAOE.IBT1, UnknownObj)
@@ -65,31 +54,38 @@
     External (_SB_.IETM, UnknownObj)
     External (_SB_.IFFS.FFSS, UnknownObj)
     External (_SB_.PCCD, UnknownObj)
-    External (_SB_.PCCD.PENB, UnknownObj)
-    External (_SB_.PCI0.GFX0.CLID, UnknownObj)
+    External (_SB_.PCCD.PENB, IntObj)
+    External (_SB_.PCI0.GFX0.CLID, FieldUnitObj)
     External (_SB_.PCI0.GFX0.DD1F, UnknownObj)
-    External (_SB_.PCI0.GFX0.GSSE, UnknownObj)
-    External (_SB_.PCI0.GFX0.STAT, UnknownObj)
-    External (_SB_.PCI0.GFX0.TCHE, UnknownObj)
+    External (_SB_.PCI0.GFX0.GLID, MethodObj)    // 1 Arguments
+    External (_SB_.PCI0.GFX0.GSCI, MethodObj)    // 0 Arguments
+    External (_SB_.PCI0.GFX0.GSSE, FieldUnitObj)
+    External (_SB_.PCI0.GFX0.IUEH, MethodObj)    // 1 Arguments
+    External (_SB_.PCI0.GFX0.STAT, FieldUnitObj)
+    External (_SB_.PCI0.GFX0.TCHE, FieldUnitObj)
     External (_SB_.PCI0.PEG0, UnknownObj)
+    External (_SB_.PCI0.PEG0.HPME, MethodObj)    // 0 Arguments
     External (_SB_.PCI0.PEG0.PEGP, UnknownObj)
     External (_SB_.PCI0.PEG1, UnknownObj)
+    External (_SB_.PCI0.PEG1.HPME, MethodObj)    // 0 Arguments
     External (_SB_.PCI0.PEG2, UnknownObj)
+    External (_SB_.PCI0.PEG2.HPME, MethodObj)    // 0 Arguments
     External (D1F0, UnknownObj)
     External (D1F1, UnknownObj)
     External (D1F2, UnknownObj)
-    External (DIDX, UnknownObj)
-    External (GSMI, UnknownObj)
-    External (IGDS, IntObj)
-    External (MDBG, IntObj)
-    External (PDC0, UnknownObj)
-    External (PDC1, UnknownObj)
-    External (PDC2, UnknownObj)
-    External (PDC3, UnknownObj)
-    External (PDC4, UnknownObj)
-    External (PDC5, UnknownObj)
-    External (PDC6, UnknownObj)
-    External (PDC7, UnknownObj)
+    External (DIDX, FieldUnitObj)
+    External (GSMI, FieldUnitObj)
+    External (IGDS, FieldUnitObj)
+    External (LIDS, FieldUnitObj)
+    External (MDBG, MethodObj)    // 1 Arguments
+    External (PDC0, IntObj)
+    External (PDC1, IntObj)
+    External (PDC2, IntObj)
+    External (PDC3, IntObj)
+    External (PDC4, IntObj)
+    External (PDC5, IntObj)
+    External (PDC6, IntObj)
+    External (PDC7, IntObj)
 
     Name (SP1O, 0x2E)
     Name (GPIB, 0x0A00)
@@ -10281,8 +10277,7 @@
     {
         If (CondRefOf (MDBG))
         {
-            Return (MDBG) /* External reference */
-            Arg0
+            Return (MDBG (Arg0))
         }
 
         Return (Zero)
@@ -10506,12 +10501,12 @@
                     Store (\_SB.PCI0.LPCB.H_EC.LSTE, LIDS) /* External reference */
                     If (IGDS)
                     {
-                        If (LEqual (LIDS (), Zero))
+                        If (LEqual (LIDS, Zero))
                         {
                             Store (0x80000000, \_SB.PCI0.GFX0.CLID) /* External reference */
                         }
 
-                        If (LEqual (LIDS (), One))
+                        If (LEqual (LIDS, One))
                         {
                             Store (0x80000003, \_SB.PCI0.GFX0.CLID) /* External reference */
                         }
@@ -11729,12 +11724,12 @@
                 Return (Zero)
             }
 
-            If (LNotEqual (LIDS (), \_SB.PCI0.LPCB.H_EC.LSTE))
+            If (LNotEqual (LIDS, \_SB.PCI0.LPCB.H_EC.LSTE))
             {
                 Store (\_SB.PCI0.LPCB.H_EC.LSTE, LIDS) /* External reference */
                 If (IGDS)
                 {
-                    If (\_SB.PCI0.GFX0.GLID (LIDS ()))
+                    If (\_SB.PCI0.GFX0.GLID (LIDS))
                     {
                         Or (0x80000000, \_SB.PCI0.GFX0.CLID, \_SB.PCI0.GFX0.CLID) /* External reference */
                     }
Have Fun!

Intel keeps updating iasl and as a result sometimes things do get broken. That is quite normal for projects relying on third party tools. However. This incompatibility issue, because that's what it is, will only occur when people replace: /usr/local/bin/iasl with a more recent copy of iasl. Normally it would be the version that ssdtPRGen.sh downloads. Luckily one of the Beta testers reported this back in September, when he replaced  the file. His report helped me to solve it. That is how it is so posed to work. Work with the developer to resolve issues and to improve it. But what you did is not helping anyone. In fact. I plan on stopping my work on this particular project, and introduce a new kind of license that prohibits this kind of failures. Effectively... you killed a perfectly fine project. So how is that going to help people?

 

About the dependancies. There is no such error. Not a single one when I run it on any of the Apple firmware models. 

Intel keeps updating iasl and as a result sometimes things do get broken. That is quite normal for projects relying on third party tools. However. This incompatibility issue, because that's what it is, will only occur when people replace: /usr/local/bin/iasl with a more recent copy of iasl.

 

Ok, my fault - thanks for pointing that out.

I added a test to found the correct command-line arguments already.

 

His report helped me to solve it. That is how it is so posed to work.

 

But it isn't solved in your version.

 

I plan on stopping my work on this particular project, and introduce a new kind of license that prohibits this kind of failures. Effectively... you killed a perfectly fine project. So how is that going to help people?

 

If you want to punish other people because I do something that you don't like - do it. But sorry, that isn't my deal, that's up to you.

So I killed nothing. I just forked a project on git-hub that hasn't any license like that.

 

About the dependancies. There is no such error. Not a single one when I run it on any of the Apple firmware models. 

 

With firmware by Gigabyte, it's sadly not that easy.

  • Like 1

Ok, my fault - thanks for pointing that out.

I added a test to found the correct command-line arguments already.

 

 

But it isn't solved in your version.

 

 

If you want to punish other people because I do something that you don't like - do it. But sorry, that isn't my deal, that's up to you.

So I killed nothing. I just forked a project on git-hub that hasn't any license like that.

 

 

With firmware by Gigabyte, it's sadly not that easy.

It is fixed in the private repository, where v2.1 is available to Beta testers.

 

This is not about punishing people, but developing something takes time, and time equals money. So when someone (you) adds a layer of confusion, by forking one of my projects and giving it a new name, not work with me, then I have to take measures and protect my time, energy and ultimately the money lost that I put into it. Again. Time is money.

 

And here is a good example of how I forked the macosxbootloader Note that there is no new name, and I will cooperate with Tiamo the minute he gets back on the radar. That's how it should be done so next time at least contact the developer/maintainer and try to work with that person. Not against him... by adding confusion.

 

I have a Gigabyte setup as hack, later today, and will personally check this. 

  • 2 years later...

This is what I typed but I cant find the extracted files:

 

./acpiTableExtract.pl  OzHiSierra2.ROM

  1 files checked

  0 files skipped (shorter than Acpi table header)

 

  0 file skipped (padding blocks / zero data)

 

Does the script copy them somewhere. Also can't figure out how to run the app.

 

Thanks

  • 1 year later...
On 6/28/2017 at 2:45 AM, davidm71 said:

This is what I typed but I cant find the extracted files:

 

./acpiTableExtract.pl  OzHiSierra2.ROM

  1 files checked

  0 files skipped (shorter than Acpi table header)

 

  0 file skipped (padding blocks / zero data)

 

Does the script copy them somewhere. Also can't figure out how to run the app.

 

Thanks

I know, I'm late but acpiTableExtract.pl is Pike's version.

Edited by uglyJoe
  • 3 months later...
×
×
  • Create New...