Skip to contentSkip to conversation

x86: Avoid writing temporary asl files into the source tree

PATCH Superseded Simon Glass 2 participants 2 messages Jul 10, 2019 – Jul 25, 2019 Kbuild

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---

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 | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)
Makefile +1 -0
index 516260f46d0..e9ff14f3405 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.tmp.c' \
 		-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 +5 -3
index de67677f61a..59c8cf38f94 100644
@@ -397,9 +397,11 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free
 # ---------------------------------------------------------------------------
 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 $(patsubst %.c,%.tmp.c,$@) $< && \
+	iasl -p $@ -tc $(patsubst %.c,%.tmp.c,$@) \
+		$(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.410.gd8fdbe21b5-goog
#1 lore raw

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

Hi Simon,

Quoted 28 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.

---

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 | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)
Makefile +0 -0
index 516260f46d0..e9ff14f3405 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.tmp.c' \

Can we reuse the dsdt.asl.tmp? dsdt.tmp.c still looks weird because it's actually ASL file, not C file. See below.

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 de67677f61a..59c8cf38f94 100644

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

Quoted 8 lines
scripts/Makefile.lib +2 -3
@@ -397,9 +397,11 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free
 # ---------------------------------------------------------------------------
 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 $(patsubst %.c,%.tmp.c,$@) $< && \

(patsubst %.c,%.asl.tmp,$@) so we can reuse dsdt.asl.tmp

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

Quoted 1 line
scripts/Makefile.lib +1 -0
+       iasl -p $@ -tc $(patsubst %.c,%.tmp.c,$@) \

Ditto

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

Quoted 6 lines
scripts/Makefile.lib +2 -1
+               $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
+       mv $(patsubst %.c,%.hex,$@) $@
 
 $(obj)/dsdt.c:    $(src)/dsdt.asl
        $(call cmd,acpi_c_asl)
--

Regards,
Bin