Skip to contentSkip to conversation

x86: Avoid writing temporary asl files into the source tree

PATCH New Simon Glass 2 participants 3 messages Jul 28, 2019 – Jul 29, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 x86: Avoid writing temporary asl files into the source tree

At present the iasl tool (Intel ACPI (Advanced Configuration and Power Interface) Source Language Compiler) is called in such a way that it uses the source directory for its temporary files.

This means we end up with these files when building x86 boards:

board/dfi/dfi-bt700/dsdt.aml
board/dfi/dfi-bt700/dsdt.asl.tmp

Update the code to put temporary files in the target directory instead.

The iasl tool is quite confusing since it generates files with different extensions and does not allow these to be individually specified. Add some documentation to help with this.

---

Changes in v3:
- Use dsdt.asl.tmp as the temporary file again
- Add ASL_TMP for the temporary file
- Add some comments to make it clear what iasl does

Changes in v2:
- Use dsdt.tmp.c as the temporary filename instead of dsdt.c.tmp
- Remove this file with distclean

 Makefile             |  1 +
 scripts/Makefile.lib | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
Makefile +1 -0
index 704579bec1..6a147badae 100644
@@ -1846,6 +1846,7 @@ clean: $(clean-dirs)
 		-o -name '*.symtypes' -o -name 'modules.order' \
 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
 		-o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
+		-o -name 'dsdt.hex' \
 		-o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
 		-type f -print | xargs rm -f \
 		bl31.c bl31.elf bl31_*.bin image.map
scripts/Makefile.lib +14 -3
index de67677f61..7a3b51d61b 100644
@@ -395,11 +395,22 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free
 
 # ACPI
 # ---------------------------------------------------------------------------
+#
+# This first sends the file (typically dsdt.asl) through the preprocessor
+# resolve includes and any CONFIG options used. This produces dsdt.asl.tmp
+# which is pure ASL code.  The Intel ASL (ACPI (Advanced Configuration and Power
+# Interface) Source Language compiler (iasl) then converts this ASL code into a
+# C file containing the hex data to build into U_Boot. This file is called
+# dsdt.hex (despite us setting the prefix to .../dsdt.asl.tmp) so must be
+# renamed to dsdt.c for consumption by the build system.
+ASL_TMP = $(patsubst %.c,%.asl.tmp,$@)
+
 quiet_cmd_acpi_c_asl= ASL     $<
 cmd_acpi_c_asl=         \
-	$(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \
-	iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
-	mv $(patsubst %.asl,%.hex,$<) $@
+	$(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) \
+		-o $(ASL_TMP) $< && \
+	iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
+	mv $(patsubst %.c,%.hex,$@) $@
 
 $(obj)/dsdt.c:    $(src)/dsdt.asl
 	$(call cmd,acpi_c_asl)
Signature · 1 line
2.22.0.709.g102302147b-goog
#1 lore raw

PATCH v3 1/1 x86: Avoid writing temporary asl files into the source tree

Hi Simon,

Quoted 37 lines · Simon Glass

At present the iasl tool (Intel ACPI (Advanced Configuration and Power Interface) Source Language Compiler) is called in such a way that it uses the source directory for its temporary files.

This means we end up with these files when building x86 boards:

   board/dfi/dfi-bt700/dsdt.aml
   board/dfi/dfi-bt700/dsdt.asl.tmp

Update the code to put temporary files in the target directory instead.

The iasl tool is quite confusing since it generates files with different extensions and does not allow these to be individually specified. Add some documentation to help with this.

---

Changes in v3:
- Use dsdt.asl.tmp as the temporary file again
- Add ASL_TMP for the temporary file
- Add some comments to make it clear what iasl does

Changes in v2:
- Use dsdt.tmp.c as the temporary filename instead of dsdt.c.tmp
- Remove this file with distclean

 Makefile             |  1 +
 scripts/Makefile.lib | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
Makefile +0 -0
index 704579bec1..6a147badae 100644

Makefile clean: $(clean-dirs) · line 1849

Quoted 4 lines
Makefile +1 -0
@@ -1846,6 +1846,7 @@ clean: $(clean-dirs)
                -o -name '*.symtypes' -o -name 'modules.order' \
                -o -name modules.builtin -o -name '.tmp_*.o.*' \
                -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
+               -o -name 'dsdt.hex' \

This is not needed as it is already renamed to dsdt.c by our make rules.

Quoted 8 lines
Makefile +0 -0
                -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
                -type f -print | xargs rm -f \
                bl31.c bl31.elf bl31_*.bin image.map
scripts/Makefile.lib +0 -0
index de67677f61..7a3b51d61b 100644

scripts/Makefile.lib $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free · line 403

Quoted 9 lines
scripts/Makefile.lib +6 -0
@@ -395,11 +395,22 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free
 
 # ACPI
 # ---------------------------------------------------------------------------
+#
+# This first sends the file (typically dsdt.asl) through the preprocessor
+# resolve includes and any CONFIG options used. This produces dsdt.asl.tmp
+# which is pure ASL code.  The Intel ASL (ACPI (Advanced Configuration and Power
+# Interface) Source Language compiler (iasl) then converts this ASL code into a
+# C file containing the hex data to build into U_Boot. This file is called

nits: U-Boot

Quoted 7 lines
scripts/Makefile.lib +4 -1
+# dsdt.hex (despite us setting the prefix to .../dsdt.asl.tmp) so must be
+# renamed to dsdt.c for consumption by the build system.
+ASL_TMP = $(patsubst %.c,%.asl.tmp,$@)
+
 quiet_cmd_acpi_c_asl= ASL     $<
 cmd_acpi_c_asl=         \
-       $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \

scripts/Makefile.lib $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free

Quoted 10 lines
scripts/Makefile.lib +4 -3
-       iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
-       mv $(patsubst %.asl,%.hex,$<) $@
+       $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) \
+               -o $(ASL_TMP) $< && \
+       iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
+       mv $(patsubst %.c,%.hex,$@) $@
 
 $(obj)/dsdt.c:    $(src)/dsdt.asl
        $(call cmd,acpi_c_asl)
--

I will fix the above issues when applying.

Regards,
Bin

#2 lore raw

PATCH v3 1/1 x86: Avoid writing temporary asl files into the source tree

Quoted 82 lines · Bin Meng

Hi Simon,

Quoted 37 lines · Simon Glass

At present the iasl tool (Intel ACPI (Advanced Configuration and Power Interface) Source Language Compiler) is called in such a way that it uses the source directory for its temporary files.

This means we end up with these files when building x86 boards:

   board/dfi/dfi-bt700/dsdt.aml
   board/dfi/dfi-bt700/dsdt.asl.tmp

Update the code to put temporary files in the target directory instead.

The iasl tool is quite confusing since it generates files with different extensions and does not allow these to be individually specified. Add some documentation to help with this.

---

Changes in v3:
- Use dsdt.asl.tmp as the temporary file again
- Add ASL_TMP for the temporary file
- Add some comments to make it clear what iasl does

Changes in v2:
- Use dsdt.tmp.c as the temporary filename instead of dsdt.c.tmp
- Remove this file with distclean

 Makefile             |  1 +
 scripts/Makefile.lib | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
Makefile +0 -0
index 704579bec1..6a147badae 100644

Makefile clean: $(clean-dirs) · line 1849

Quoted 4 lines
Makefile +1 -0
@@ -1846,6 +1846,7 @@ clean: $(clean-dirs)
                -o -name '*.symtypes' -o -name 'modules.order' \
                -o -name modules.builtin -o -name '.tmp_*.o.*' \
                -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
+               -o -name 'dsdt.hex' \

This is not needed as it is already renamed to dsdt.c by our make rules.

Quoted 8 lines
Makefile +0 -0
                -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
                -type f -print | xargs rm -f \
                bl31.c bl31.elf bl31_*.bin image.map
scripts/Makefile.lib +0 -0
index de67677f61..7a3b51d61b 100644

scripts/Makefile.lib $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free · line 403

Quoted 9 lines
scripts/Makefile.lib +6 -0
@@ -395,11 +395,22 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free
 
 # ACPI
 # ---------------------------------------------------------------------------
+#
+# This first sends the file (typically dsdt.asl) through the preprocessor
+# resolve includes and any CONFIG options used. This produces dsdt.asl.tmp
+# which is pure ASL code.  The Intel ASL (ACPI (Advanced Configuration and Power
+# Interface) Source Language compiler (iasl) then converts this ASL code into a
+# C file containing the hex data to build into U_Boot. This file is called

nits: U-Boot

Quoted 14 lines
scripts/Makefile.lib +8 -3
+# dsdt.hex (despite us setting the prefix to .../dsdt.asl.tmp) so must be
+# renamed to dsdt.c for consumption by the build system.
+ASL_TMP = $(patsubst %.c,%.asl.tmp,$@)
+
 quiet_cmd_acpi_c_asl= ASL     $<
 cmd_acpi_c_asl=         \
-       $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \
-       iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
-       mv $(patsubst %.asl,%.hex,$<) $@
+       $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) \
+               -o $(ASL_TMP) $< && \
+       iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
+       mv $(patsubst %.c,%.hex,$@) $@
 
Quoted 8 lines

scripts/Makefile.lib $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free

Quoted 3 lines
scripts/Makefile.lib +0 -1
 $(obj)/dsdt.c:    $(src)/dsdt.asl
        $(call cmd,acpi_c_asl)
--

I will fix the above issues when applying.

applied to u-boot-x86, thanks!