Skip to contentSkip to conversation

Makefile.lib: Always rebuild DSDT

PATCH In review Andy Shevchenko 5 participants 10 messages Oct 20, 2021 – Dec 9, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile.lib: Always rebuild DSDT

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
index 07696e86bb54..8c3c893b398a 100644
@@ -441,7 +441,7 @@ cmd_acpi_c_asl=         \
 	iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
 	mv $(patsubst %.c,%.hex,$@) $@
 
-$(obj)/dsdt.c:    $(src)/dsdt.asl
+$(obj)/dsdt.c:    $(src)/dsdt.asl FORCE
 	$(call cmd,acpi_c_asl)
 	$(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
 
Signature · 1 line
2.33.0
#1 lore raw

Hi Andy,

Quoted 10 lines · Andy Shevchenko

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ick. Since it uses #include, doesn't the dependency generation work with this?

Quoted 15 lines
scripts/Makefile.lib +1 -2
index 07696e86bb54..8c3c893b398a 100644
@@ -441,7 +441,7 @@ cmd_acpi_c_asl=         \
        iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
        mv $(patsubst %.c,%.hex,$@) $@
 
-$(obj)/dsdt.c:    $(src)/dsdt.asl
+$(obj)/dsdt.c:    $(src)/dsdt.asl FORCE
        $(call cmd,acpi_c_asl)
        $(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
 
--
Quoted 2 lines

2.33.0

Regards,
Simon

#2 lore raw
Quoted 9 lines · Simon Glass
Quoted 5 lines · Andy Shevchenko

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

Ick. Since it uses #include, doesn't the dependency generation work with this?

How?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Hi Andy,

Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Simon Glass
Quoted 1 line · Andy Shevchenko
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

Ick. Since it uses #include, doesn't the dependency generation work with this?

How?

If you do a sandbox build you will see this file:

arch/sandbox/dts/.sandbox.dtb.cmd

It contains the dependencies used to compile the device tree. Can we use the same mechanism? There is a .cmd file for the dsdt file but it does not seem to have the correct contents.

Regards,
Simon

#4 lore raw
Quoted 14 lines · Simon Glass
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Simon Glass
Quoted 1 line · Andy Shevchenko
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

Ick. Since it uses #include, doesn't the dependency generation work with this?

How?

Quoted 7 lines

If you do a sandbox build you will see this file:

arch/sandbox/dts/.sandbox.dtb.cmd

It contains the dependencies used to compile the device tree. Can we use the same mechanism? There is a .cmd file for the dsdt file but it does not seem to have the correct contents.

A spent more than couple of hours to fight with make and failed. Maybe you can improve the below (it still rebuilds always)

From 2fa93fdc376b60c69ff1a2e9ffd16d30702c6399 Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Wed, 20 Oct 2021 15:21:49 +0300
Subject: [PATCH 1/1] Makefile.lib: Always rebuild DSDT

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

---
 scripts/Makefile.lib | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
scripts/Makefile.lib +11 -6
index ac270844c2e1..939f99dee9f9 100644
@@ -432,16 +432,21 @@ CFLAGS_REMOVE_efi_freestanding.o := $(LTO_CFLAGS)
 # renamed to dsdt.c for consumption by the build system.
 ASL_TMP = $(patsubst %.c,%.asl.tmp,$@)
 
+asl_cpp_flags  = -Wp,-MD,$(depfile) -nostdinc                   \
+		 $(UBOOTINCLUDE)                                \
+		 -I$(srctree)/include                           \
+		 -D__ASSEMBLY__                                 \
+		 -undef -D__ACPI__
+
 quiet_cmd_acpi_c_asl= ASL     $<
 cmd_acpi_c_asl=         \
-	$(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -D__ACPI__ \
-		-P $(UBOOTINCLUDE) -o $(ASL_TMP) $< && \
+	$(HOSTCC) -P -E $(asl_cpp_flags) -x assembler-with-cpp -o $(ASL_TMP) $< && \
 	iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
-	mv $(patsubst %.c,%.hex,$@) $@
+	mv $(patsubst %.c,%.hex,$@) $@ && \
+	sed -i -e "s,dsdt_aml_code,AmlCode," $@
 
-$(obj)/dsdt.c:    $(src)/dsdt.asl
-	$(call cmd,acpi_c_asl)
-	$(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
+$(obj)/dsdt.c:    $(src)/dsdt.asl FORCE
+	$(call if_changed_dep,acpi_c_asl)
 
 # Bzip2
 # ---------------------------------------------------------------------------
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 17 lines · Andy Shevchenko
Quoted 16 lines · Simon Glass
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Simon Glass
Quoted 1 line · Andy Shevchenko
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

Ick. Since it uses #include, doesn't the dependency generation work with this?

How?

If you do a sandbox build you will see this file:

Quoted 8 lines
Quoted 5 lines

arch/sandbox/dts/.sandbox.dtb.cmd

It contains the dependencies used to compile the device tree. Can we use the same mechanism? There is a .cmd file for the dsdt file but it does not seem to have the correct contents.

A spent more than couple of hours to fight with make and failed. Maybe you can improve the below (it still rebuilds always)

So, can we fix this annoying bug, please?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw
Quoted 20 lines · Andy Shevchenko
Quoted 19 lines · Andy Shevchenko
Quoted 18 lines · Simon Glass
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Simon Glass
Quoted 1 line · Andy Shevchenko
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

Ick. Since it uses #include, doesn't the dependency generation work with this?

How?

If you do a sandbox build you will see this file:

arch/sandbox/dts/.sandbox.dtb.cmd

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

It contains the dependencies used to compile the device tree. Can we use the same mechanism? There is a .cmd file for the dsdt file but it does not seem to have the correct contents.

A spent more than couple of hours to fight with make and failed. Maybe you can improve the below (it still rebuilds always)

So, can we fix this annoying bug, please?

Any news here? If no other solution, please apply this patch.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
In reply to Andy Shevchenko
Quoted 6 lines · Andy Shevchenko

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

The build process that you describe is not in our documentation.

By which defconfig is $(src)/dsdt.asl consumed? Where does it come from? Please, provide a reproducible example.

Would you be able to provide a documentation patch explaining how to use a user provided dsdt.asl file?

Best regards

Heinrich

Quoted 17 lines
---
  scripts/Makefile.lib | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
index 07696e86bb54..8c3c893b398a 100644
@@ -441,7 +441,7 @@ cmd_acpi_c_asl=         \
  	iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
  	mv $(patsubst %.c,%.hex,$@) $@
 
-$(obj)/dsdt.c:    $(src)/dsdt.asl
+$(obj)/dsdt.c:    $(src)/dsdt.asl FORCE
  	$(call cmd,acpi_c_asl)
  	$(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
 
#8 lore raw

Hi,

Quoted 34 lines · Heinrich Schuchardt
Quoted 6 lines · Andy Shevchenko

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

The build process that you describe is not in our documentation.

By which defconfig is $(src)/dsdt.asl consumed? Where does it come from? Please, provide a reproducible example.

Would you be able to provide a documentation patch explaining how to use a user provided dsdt.asl file?

Best regards

Heinrich

Quoted 12 lines
---
  scripts/Makefile.lib | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +0 -0
index 07696e86bb54..8c3c893b398a 100644
@@ -441,7 +441,7 @@ cmd_acpi_c_asl=         \
      iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
      mv $(patsubst %.c,%.hex,$@) $@
 
Quoted 6 lines

scripts/Makefile.lib cmd_acpi_c_asl= \ · line 447

Quoted 5 lines
scripts/Makefile.lib +1 -1
-$(obj)/dsdt.c:    $(src)/dsdt.asl
+$(obj)/dsdt.c:    $(src)/dsdt.asl FORCE
      $(call cmd,acpi_c_asl)
      $(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
 

I agree that this patch is better than having the bug. But yes the docs could really use some notes here, for the person who does come along and clean up the dependency bug.

Regards,
Simon

#9 lore raw
Quoted 45 lines · Simon Glass

Hi,

Quoted 34 lines · Heinrich Schuchardt
Quoted 6 lines · Andy Shevchenko

The dsdt.asl is usually combined out of several files that are included in the main one. Whenever we change the content of any of such files, build system is not able to recognize them. Hence the easiest way is to force DSDT rebuild each time we run make.

The build process that you describe is not in our documentation.

By which defconfig is $(src)/dsdt.asl consumed? Where does it come from? Please, provide a reproducible example.

Would you be able to provide a documentation patch explaining how to use a user provided dsdt.asl file?

Best regards

Heinrich

Quoted 12 lines
---
   scripts/Makefile.lib | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +0 -0
index 07696e86bb54..8c3c893b398a 100644
@@ -441,7 +441,7 @@ cmd_acpi_c_asl=         \
       iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
       mv $(patsubst %.c,%.hex,$@) $@
 
Quoted 6 lines

scripts/Makefile.lib cmd_acpi_c_asl= \ · line 447

Quoted 5 lines
scripts/Makefile.lib +1 -1
-$(obj)/dsdt.c:    $(src)/dsdt.asl
+$(obj)/dsdt.c:    $(src)/dsdt.asl FORCE
       $(call cmd,acpi_c_asl)
       $(Q)sed -i -e "s,dsdt_aml_code,AmlCode," $@
 
Quoted 6 lines

I agree that this patch is better than having the bug. But yes the docs could really use some notes here, for the person who does come along and clean up the dependency bug.

Regards,
Simon

The patch is neither applicable to origin/next nor to origin/master.

I only find a line

$(obj)/dsdt_generated.c: $(src)/dsdt.asl

Best regards

Heinrich