x86: Avoid writing temporary asl files into the source tree
authorSimon Glass <sjg@chromium.org>
Sun, 28 Jul 2019 20:16:28 +0000 (14:16 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 9 Aug 2019 14:24:02 +0000 (22:24 +0800)
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.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: remove dsdt.hex from 'make clean' rules and correct U-Boot spelling]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
scripts/Makefile.lib

index 2f5e28cac32be88bdb2de4090d2b71c07ebc0206..ef116e0e0aeb8ae65f9619281bf4e82db06af8d4 100644 (file)
@@ -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)