diff mbox series

[U-Boot,v3] x86: Avoid writing temporary asl files into the source tree

Message ID 20190728201628.223888-1-sjg@chromium.org
State Accepted
Delegated to: Bin Meng
Headers show
Series [U-Boot,v3] x86: Avoid writing temporary asl files into the source tree | expand

Commit Message

Simon Glass July 28, 2019, 8:16 p.m. UTC
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>
---

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(-)

Comments

Bin Meng July 29, 2019, 1:36 a.m. UTC | #1
Hi Simon,

On Mon, Jul 29, 2019 at 4:16 AM Simon Glass <sjg@chromium.org> wrote:
>
> 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>
> ---
>
> 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(-)
>
> diff --git a/Makefile b/Makefile
> index 704579bec1..6a147badae 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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.

>                 -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
>                 -type f -print | xargs rm -f \
>                 bl31.c bl31.elf bl31_*.bin image.map
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index de67677f61..7a3b51d61b 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -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

> +# 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)
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>

I will fix the above issues when applying.

Regards,
Bin
Bin Meng July 29, 2019, 1:43 a.m. UTC | #2
On Mon, Jul 29, 2019 at 9:36 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Mon, Jul 29, 2019 at 4:16 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > 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>
> > ---
> >
> > 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(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 704579bec1..6a147badae 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -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.
>
> >                 -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
> >                 -type f -print | xargs rm -f \
> >                 bl31.c bl31.elf bl31_*.bin image.map
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index de67677f61..7a3b51d61b 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -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
>
> > +# 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)
> > --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Bin Meng <bmeng.cn@gmail.com>
>
> I will fix the above issues when applying.

applied to u-boot-x86, thanks!
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 704579bec1..6a147badae 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index de67677f61..7a3b51d61b 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -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)