Intel Asl Compiler Iasl: Compiling From Scratch |
|
|

Jun 16 2009, 10:22 AM



- Member
- Group: Comrade
- Posts: 50
Compiling Intel's ASL Compiler iaslACPI 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.php3. 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

. 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:
iasl.zip ( 329.32K )
Number of downloads: 100Latest 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

Jun 19 2009, 12:28 AM



- Member
- Group: Adept
- Posts: 91
What exactly is this for?

Jun 19 2009, 02:29 AM


- Quite Unreal
- Group: Root Administrators
- Posts: 245
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!

Jun 28 2009, 06:17 PM



- Member
- Group: Adept
- Posts: 91
It was more of a rhetorical question since this post in no way explains what iasl compiler does.

Jun 28 2009, 09:47 PM



- Member
- Group: Comrade
- Posts: 50
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

Jul 1 2009, 05:32 PM



- Member
- Group: Adept
- Posts: 91
It wasn't an urgent issue.

Jul 9 2009, 02:09 PM




- Advanced Member
- Group: Developer
- Posts: 5,541
Thank you for the trick. Before I can't make iasl. Now Yes!
New iasl works without problems.

Jul 9 2009, 10:38 PM



- Member
- Group: Comrade
- Posts: 50
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

Aug 26 2009, 07:16 AM




- Advanced Member
- Group: Developer
- Posts: 5,541
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
makefilereplace
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!
acpiexec.zip ( 197.2K )
Number of downloads: 1145. Usage
acpiexec -s dsdt.aml
to stop press Ctrl-C

Aug 26 2009, 08:24 AM



- Member
- Group: Comrade
- Posts: 50
QUOTE (Slice @ Aug 26 2009, 09:16 AM)

I also made
acpiexec -ACPI Execution and Debugging.
[...]
Enjoy!
acpiexec.zip ( 197.2K )
Number of downloads: 1145. 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

Aug 26 2009, 10:29 AM




- Advanced Member
- Group: Developer
- Posts: 5,541
One useful trickIn 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

Aug 26 2009, 05:07 PM




- Advanced Member
- Group: Comrade
- Posts: 232
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 P5Q-E - P45/ICH10R - Marvell 88E8056 - Focusrite Saffire 6 USB - EVGA GTX660 - C2D E8500 - 10.8.2 retail - Chameleon 2.2 svn r21xx

Aug 26 2009, 08:23 PM




- Advanced Member
- Group: Developer
- Posts: 5,541
Did you use new sources 2009 with replaced file osunixxf.c from project 2008? Look also my correction in step 3.

Sep 4 2009, 03:25 AM

- Initiate
- Group: Comrade
- Posts: 3
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
And yes, replacing osunixxf.c from 2008 to 2009 sources still works.
Here's iasl Sept-03-2009.
iasl_osx_20090903.zip ( 223.21K )
Number of downloads: 120 This post has been edited by Signal64: Sep 4 2009, 03:28 AM

Sep 4 2009, 07:37 AM


- Member
- Group: Comrade
- Posts: 45
great news Signal64, thanks!

Oct 26 2009, 04:54 AM

- Advanced Member
- Group: Staff
- Posts: 109
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>

Oct 26 2009, 08:44 PM

- Advanced Member
- Group: Staff
- Posts: 109
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.
acpica_unix_20091013.patch.gz ( 1.01K )
Number of downloads: 70

Nov 2 2009, 08:57 PM

- Advanced Member
- Group: Staff
- Posts: 714
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.
acpica_unix_20091013.patch.gz ( 1.01K )
Number of downloads: 70Thanks
Kabyl, the patch worked.
Attached is compiled one.
attachment fixed by realityiswhere
iasl_20091013.zip ( 223.5K )
Number of downloads: 108

Nov 9 2009, 02:03 PM




- Advanced Member
- Group: Developer
- Posts: 5,541
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
acpiexec_20091013.zip ( 236.56K )
Number of downloads: 64

Mar 28 2010, 12:08 AM




- Advanced Member
- Group: Comrade
- Posts: 232
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 P5Q-E - P45/ICH10R - Marvell 88E8056 - Focusrite Saffire 6 USB - EVGA GTX660 - C2D E8500 - 10.8.2 retail - Chameleon 2.2 svn r21xx