ProjectOSX

Welcome Guest!

Returning User? Login here.

Want membership privileges? Register here.

5 Pages V   1 2 3 > »   
Start a new topic Add Reply
> Intel Asl Compiler Iasl: Compiling From Scratch
zhell
post Jun 16 2009, 10:22 AM
Post #1
Compiling Intel's ASL Compiler iasl

ACPI is the Advanced Configuration and Power management Interface. ASL is the language used to compile the tables describing the computer's hardware. In some cases it may be helpful to edit some of those tables, most notably the DSDT.

There are several methods to dump the ACPI tables. Given the dump of an ACPI table, one typically wants to decompile the ".aml" file, modify the resulting ASL code (often with the ending ".dsl") and finally recompile it. These two feats are accomplished by Intel's ASL compiler "iasl". You may just want to download the binary at the end of the post and put it in /usr/local/bin or you can compile it yourself as outlined below.

Update: As reported by Slice, the latest version ("acpica-unix-20110623") compiles with a simple "make", at least on Lion 10.7.1 with Xcode 4.1.

1. You need xCode installed (from the App Store, free download for Lion)
2. Get the current source from http://www.acpica.org/downloads/unix_source_code.php
3. Open Terminal, change dir to where you want to have your source code.
4. Extract the source tarball by running
CODE
tar xf ~/Downloads/acpica-unix-20110623.tar

5. Change directory to "compiler"
CODE
cd compiler

6. Run the following command:
CODE
make

8. You get a file called "iasl" the current directory... this is your ASL compiler biggrin.gif . To install you can just issue:
CODE
sudo cp iasl /usr/bin/

(there is no need to set the permissions, the linker does that for you)


CODE
Intel ACPI Component Architecture
ASL Optimizing Compiler version 20110623-64 [Sep  7 2011]
Copyright (c) 2000 - 2011 Intel Corporation

Supports ACPI Specification Revision 4.0a


Download just the "iasl" binary file version 20110623-64:Attached File  iasl.zip ( 329.32K ) Number of downloads: 123


Latest vesion

This post has been edited by Slice: Dec 3 2011, 07:42 PM
Reason for edit: updated
GA-Z68MX-UD2H-B3-U1c | Core i7 2600 | 16GB DDR3-1600
Intel SSD 520 240GB + WDC WD-20EARX 2TB Fusion drive
Sapphire Radeon HD 6850 1024MB PEG | Atheros AR9380 Mini PCIe | Intel 82574L PCIe
OS X 10.8.2 | Chameleon 2.1svn | Clover EFI r897
pater
post Jun 19 2009, 12:28 AM
Post #2
What exactly is this for?
realityiswhere
post Jun 19 2009, 02:29 AM
Post #3
QUOTE (pater @ Jun 18 2009, 09:28 PM) *
What exactly is this for?


de/re-compiling of dsdt files.

Great post zhell!
Debian Squeeze: HPM8120N - Q6600, 965 northbridge/ICH8-R south, 9500GT (1GB)
Snow Leopard 10.6.6: Alu Macbook: Core 2 Duo 2.0GHz, 2GB Ram, nVidia 9400M.
Android: Samsung Galaxy S Vibrant (GT-i9000m, Froyo) and Samsung Galaxy Tab (Froyo)
Having trouble posting? Have you taken the Quiz yet? --------------------------- If you see spam, report it!
pater
post Jun 28 2009, 06:17 PM
Post #4
It was more of a rhetorical question since this post in no way explains what iasl compiler does.
zhell
post Jun 28 2009, 09:47 PM
Post #5
QUOTE (pater @ Jun 28 2009, 08:17 PM) *
It was more of a rhetorical question since this post in no way explains what iasl compiler does.

Thanks pater. For next time, please note that stating the above instead of asking a rhetorical question may lead to a more prompt response from my side.
GA-Z68MX-UD2H-B3-U1c | Core i7 2600 | 16GB DDR3-1600
Intel SSD 520 240GB + WDC WD-20EARX 2TB Fusion drive
Sapphire Radeon HD 6850 1024MB PEG | Atheros AR9380 Mini PCIe | Intel 82574L PCIe
OS X 10.8.2 | Chameleon 2.1svn | Clover EFI r897
pater
post Jul 1 2009, 05:32 PM
Post #6
It wasn't an urgent issue.
Slice
post Jul 9 2009, 02:09 PM
Post #7
Thank you for the trick. Before I can't make iasl. Now Yes! rolleyes.gif
New iasl works without problems.
Пожалуйста, прочитайте ЧаВо!
i3-2120 GA-H61M-S1, Radeon HD6670, ALC887(VoodooHDA 2.8.6), OS⌘10.9.4, OS⌘ 10.7.5 Clover FakeSMC_plugins_3.3.1 Realtek LAN v3.1.2
zhell
post Jul 9 2009, 10:38 PM
Post #8
Thanks for the feedback, Slice. I also was not able to compile iasl until Kabyl told me how to do it, so all credit goes to him.
GA-Z68MX-UD2H-B3-U1c | Core i7 2600 | 16GB DDR3-1600
Intel SSD 520 240GB + WDC WD-20EARX 2TB Fusion drive
Sapphire Radeon HD 6850 1024MB PEG | Atheros AR9380 Mini PCIe | Intel 82574L PCIe
OS X 10.8.2 | Chameleon 2.1svn | Clover EFI r897
Slice
post Aug 26 2009, 07:16 AM
Post #9
I also made acpiexec -ACPI Execution and Debugging.
QUOTE
sergey:acpiexec sergey$ /acpiexec

Intel ACPI Component Architecture
AML Execution/Debug Utility version 20090521 [Aug 26 2009]

Usage: acpiexec [Options] [InputFile]

Where:
-? Display this message
-a Do not abort methods on error
-b <CommandLine> Batch mode command execution
-e [Method] Batch mode method execution
-i Do not run STA/INI methods during init
-m Display final memory use statistics
-o <OutputFile> Send output to this file
-r Disable OpRegion address simulation
-s Enable Interpreter Slack Mode
-t Enable Interpreter Serialized Mode
-v Verbose init output
-x <DebugLevel> Specify debug output level
-z Enable debug semaphore timeout

Same trick
1. cd project/tools/acpiexec
2. Edit makefile
replace
CODE
acpiexec : $(patsubst %.c,%.o, $(SRCS))
    $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -lpthread -lrt -o $(PROG)
by
CODE
LDLIBS = -lpthread -lrt

acpiexec : $(patsubst %.c,%.o, $(SRCS))
    $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) $(LDLIBS) -o $(PROG)

3. Edit osunixxf.c - this is a file from 2008 project but I need to correct according 2009
Line 144
CODE
/* Upcalls to AcpiExec */
//Slice
void
AeTableOverride (
                 ACPI_TABLE_HEADER       *ExistingTable,
                 ACPI_TABLE_HEADER       **NewTable);

Line ~260
CODE
#ifdef ACPI_EXEC_APP

    /* This code exercises the table override mechanism in the core */

    if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
    {
        /* override DSDT with itself */
//Slice
        // *NewTable = AcpiGbl_DbTablePtr;
        
        AeTableOverride (ExistingTable, NewTable);
//
    }
    return (AE_OK);
#else
    return AE_NO_ACPI_TABLES;
#endif

4. make LDLIBS=' '
Enjoy!
Attached File  acpiexec.zip ( 197.2K ) Number of downloads: 119

5. Usage
acpiexec -s dsdt.aml
to stop press Ctrl-C
Пожалуйста, прочитайте ЧаВо!
i3-2120 GA-H61M-S1, Radeon HD6670, ALC887(VoodooHDA 2.8.6), OS⌘10.9.4, OS⌘ 10.7.5 Clover FakeSMC_plugins_3.3.1 Realtek LAN v3.1.2
zhell
post Aug 26 2009, 08:24 AM
Post #10
QUOTE (Slice @ Aug 26 2009, 09:16 AM) *
I also made acpiexec -ACPI Execution and Debugging.
[...]
Enjoy!
Attached File  acpiexec.zip ( 197.2K ) Number of downloads: 119

5. Usage
acpiexec -s dsdt.aml
to stop press Ctrl-C

Awesome, thanks a lot, Slice! I'll certainly give this a try.
GA-Z68MX-UD2H-B3-U1c | Core i7 2600 | 16GB DDR3-1600
Intel SSD 520 240GB + WDC WD-20EARX 2TB Fusion drive
Sapphire Radeon HD 6850 1024MB PEG | Atheros AR9380 Mini PCIe | Intel 82574L PCIe
OS X 10.8.2 | Chameleon 2.1svn | Clover EFI r897
Slice
post Aug 26 2009, 10:29 AM
Post #11
One useful trick
In DSDT you can encounter infinite loop waiting for hardware bits
QUOTE
**** Exception AE_AML_INFINITE_LOOP during execution of method [\SMI_] (Node 0x101ca8)

So it is better to make debug version of dsdt.aml
This is my SMI
CODE
    Method (SMI, 2, NotSerialized)
    {
        Acquire (SMIX, 0xFFFF)
        While (Zero) {}
        Store (Arg1, \_SB.SMIA)
        Store (Arg0, \_SB.SMIC)
        Store (\_SB.SMIC, Local0)
        While (Zero) //LNotEqual (Local0, Zero)) -- for Debug only I replaced condition to Zero
        {
            Store (\_SB.SMIC, Local0)  //-- waiting for hardware
        }

        Store (\_SB.SMIA, Local1)
        Release (SMIX)
        Return (Local1)
    }

The same in method SXX6().
Find your own problem!

Another problem
QUOTE
Executed 3 _INI methods requiring 0 _STA executions (examined 97 objects)

So you can start with option -i ( Do not run STA/INI methods during init)
acpiexec -i dsdt.debug.aml
Пожалуйста, прочитайте ЧаВо!
i3-2120 GA-H61M-S1, Radeon HD6670, ALC887(VoodooHDA 2.8.6), OS⌘10.9.4, OS⌘ 10.7.5 Clover FakeSMC_plugins_3.3.1 Realtek LAN v3.1.2
Gringo Vermelho
post Aug 26 2009, 05:07 PM
Post #12
I downloaded the two source archives and tried to compile iasl. osunix.c is not present in any of them.

There's a file named osunixxf.c but using that instead doesn't work:

CODE
../osunixxf.c: In function 'AcpiOsWaitSemaphore':
../osunixxf.c:664: warning: implicit declaration of function 'sem_timedwait'
cc  aslcompilerparse.o aslcompilerlex.o aslanalyze.o aslcodegen.o aslcompile.o aslerror.o aslfiles.o asllength.o asllisting.o aslload.o asllookup.o aslmain.o aslmap.o aslopcodes.o asloperands.o aslresource.o aslrestype1.o aslrestype2.o aslstartup.o asltree.o aslutils.o asltransform.o aslfold.o aslstubs.o aslopt.o ../common/getopt.o ../utilities/utalloc.o ../utilities/utcache.o ../utilities/utcopy.o ../utilities/utdebug.o ../utilities/utdelete.o ../utilities/utglobal.o ../utilities/utinit.o ../utilities/utlock.o ../utilities/utobject.o ../utilities/utmisc.o ../utilities/utmath.o ../utilities/utmutex.o ../utilities/utresrc.o ../utilities/utstate.o ../utilities/utxface.o ../namespace/nsaccess.o ../namespace/nsalloc.o ../namespace/nsdump.o ../namespace/nsnames.o ../namespace/nsobject.o ../namespace/nsparse.o ../namespace/nssearch.o ../namespace/nsutils.o ../namespace/nswalk.o ../namespace/nsxfobj.o ../parser/psargs.o ../parser/psloop.o ../parser/psopcode.o ../parser/psparse.o ../parser/psscope.o ../parser/pstree.o ../parser/psutils.o ../parser/pswalk.o ../dispatcher/dswscope.o ../dispatcher/dswstate.o ../dispatcher/dsfield.o ../dispatcher/dsobject.o ../dispatcher/dsopcode.o ../dispatcher/dsutils.o ../dispatcher/dswexec.o ../dispatcher/dswload.o ../executer/exconvrt.o ../executer/excreate.o ../executer/exdump.o ../executer/exmisc.o ../executer/exmutex.o ../executer/exnames.o ../executer/exoparg1.o ../executer/exoparg2.o ../executer/exoparg3.o ../executer/exoparg6.o ../executer/exprep.o ../executer/exregion.o ../executer/exresnte.o ../executer/exresolv.o ../executer/exresop.o ../executer/exstore.o ../executer/exstoren.o ../executer/exstorob.o ../executer/exsystem.o ../executer/exutils.o ../common/adfile.o ../common/adisasm.o ../common/adwalk.o ../common/dmrestag.o ../common/dmtable.o ../common/dmtbinfo.o ../common/dmtbdump.o ../debugger/dbfileio.o ../disassembler/dmbuffer.o ../disassembler/dmnames.o ../disassembler/dmopcode.o ../disassembler/dmobject.o ../disassembler/dmresrc.o ../disassembler/dmresrcl.o ../disassembler/dmresrcs.o ../disassembler/dmutils.o ../disassembler/dmwalk.o ../tables/tbfadt.o ../tables/tbinstal.o ../tables/tbutils.o ../tables/tbxface.o ../osunixxf.o \
          -o iasl
Undefined symbols:
  "_sem_timedwait", referenced from:
      _AcpiOsWaitSemaphore in osunixxf.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [aslmain] Error 1


This post has been edited by Gringo Vermelho: Aug 26 2009, 05:55 PM
ASUS P8Z77-V Pro - EVGA GTX 660 - i5-3570K - 10.9.1 retail - Chameleon 2.2 svn r22xx
Slice
post Aug 26 2009, 08:23 PM
Post #13
Did you use new sources 2009 with replaced file osunixxf.c from project 2008? Look also my correction in step 3.
Пожалуйста, прочитайте ЧаВо!
i3-2120 GA-H61M-S1, Radeon HD6670, ALC887(VoodooHDA 2.8.6), OS⌘10.9.4, OS⌘ 10.7.5 Clover FakeSMC_plugins_3.3.1 Realtek LAN v3.1.2
Signal64
post Sep 4 2009, 03:25 AM
Post #14
QUOTE (Slice @ Aug 26 2009, 01:23 PM) *
Did you use new sources 2009 with replaced file osunixxf.c from project 2008? Look also my correction in step 3.


Think they are talking about step 7 in zhell's first post for iasl.
That needs to be osunixxf.c instead of osunix.c tongue.gif

And yes, replacing osunixxf.c from 2008 to 2009 sources still works.

Here's iasl Sept-03-2009.

Attached File  iasl_osx_20090903.zip ( 223.21K ) Number of downloads: 121


This post has been edited by Signal64: Sep 4 2009, 03:28 AM
drmash
post Sep 4 2009, 07:37 AM
Post #15
great news Signal64, thanks!
Kabyl
post Oct 26 2009, 04:54 AM
Post #16
To make it even easier, follow this:

Grab the sources from http://www.acpica.org/downloads/unix_source_code.php, open a Terminal window and after having extracted the tarball;
CODE
       cd compiler
       export CFLAGS='-DACPI_USE_ALTERNATE_TIMEOUT -include pthread.h'
       make LDLIBS=

You get the iasl tool in the current dir. To install you can just do:
CODE
       sudo cp iasl /usr/bin/

(there is no need to set the permissions, the linker does that for you)

Thanks to np_ for the #include <pthread.h>
Kabyl
post Oct 26 2009, 08:44 PM
Post #17
Apparently the resulted tool doesn't work, anyone had any success with that? or to be more precise, anyone "spent time" with this and has a fix?

EDIT:
Attached is a patch against acpica-unix-20091013, until someone cares enough to provide something better.

Attached File  acpica_unix_20091013.patch.gz ( 1.01K ) Number of downloads: 71
THe KiNG
post Nov 2 2009, 08:57 PM
Post #18
QUOTE (Kabyl @ Oct 26 2009, 08:44 PM) *
Apparently the resulted tool doesn't work, anyone had any success with that? or to be more precise, anyone "spent time" with this and has a fix?

EDIT:
Attached is a patch against acpica-unix-20091013, until someone cares enough to provide something better.

Attached File  acpica_unix_20091013.patch.gz ( 1.01K ) Number of downloads: 71

Thanks Kabyl, the patch worked.
Attached is compiled one.

attachment fixed by realityiswhere smile.gif Attached File  iasl_20091013.zip ( 223.5K ) Number of downloads: 109
Slice
post Nov 9 2009, 02:03 PM
Post #19
Thanks! It works.
Some new feature
CODE
Global:
  -@<file>       Specify command file
  -I<dir>        Specify additional include directory

Compile/decompile seems to be same.

Also new debugger
Attached File  acpiexec_20091013.zip ( 236.56K ) Number of downloads: 67
Пожалуйста, прочитайте ЧаВо!
i3-2120 GA-H61M-S1, Radeon HD6670, ALC887(VoodooHDA 2.8.6), OS⌘10.9.4, OS⌘ 10.7.5 Clover FakeSMC_plugins_3.3.1 Realtek LAN v3.1.2
Gringo Vermelho
post Mar 28 2010, 12:08 AM
Post #20
Latest IASL binary here:

http://www.insanelymac.com/forum/index.php?showtopic=189272

This post has been edited by Gringo Vermelho: Mar 28 2010, 12:10 AM
ASUS P8Z77-V Pro - EVGA GTX 660 - i5-3570K - 10.9.1 retail - Chameleon 2.2 svn r22xx

5 Pages V   1 2 3 > » 
Add Reply Start a new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: