Skip to contentSkip to conversation

microblaze: fix 'FORCE prerequisite is missing' warning

PATCH In review Masahiro Yamada 4 participants 9 messages Jan 14, 2025 – Jun 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 microblaze: fix 'FORCE prerequisite is missing' warning

If you add foo.dtb into the arch/microblaze/boot/dts/ directory and run 'make simpleImage.foo', you will observe the following warning:

arch/microblaze/boot/dts/Makefile:15: FORCE prerequisite is missing

Without FORCE, if_changed cannot detect the command line changes.

---

 arch/microblaze/boot/dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/microblaze/boot/dts/Makefile +1 -1
index b84e2cbb20ee..932dc7550a1b 100644
@@ -11,7 +11,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
 # Generate system.dtb from $(DTB).dtb
 ifneq ($(DTB),system)
-$(obj)/system.dtb: $(obj)/$(DTB).dtb
+$(obj)/system.dtb: $(obj)/$(DTB).dtb FORCE
 	$(call if_changed,copy)
 endif
 endif
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/4 microblaze: merge build rules for linux.bin and simpleImage.$(DTB)

The build rules for $(obj)/linux.bin and $(obj)/simpleImage.$(DTB) are identical.

The build rules for $(obj)/linux.bin.ub and $(obj)/simpleImage.$(DTB).ub are also identical.

This commit consolidates the identical build rules.

---

 arch/microblaze/boot/Makefile | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
arch/microblaze/boot/Makefile +2 -8
index 2b42c370d574..9e3fec78f084 100644
@@ -7,12 +7,6 @@ targets := linux.bin linux.bin.gz linux.bin.ub simpleImage.*
 
 OBJCOPYFLAGS := -R .note -R .comment -R .note.gnu.build-id -O binary
 
-$(obj)/linux.bin: vmlinux FORCE
-	$(call if_changed,objcopy)
-
-$(obj)/linux.bin.ub: $(obj)/linux.bin FORCE
-	$(call if_changed,uimage)
-
 $(obj)/linux.bin.gz: $(obj)/linux.bin FORCE
 	$(call if_changed,gzip)
 
@@ -22,10 +16,10 @@ quiet_cmd_strip = STRIP   $< $@$2
 
 UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
 
-$(obj)/simpleImage.$(DTB): vmlinux FORCE
+$(obj)/linux.bin $(obj)/simpleImage.$(DTB): vmlinux FORCE
 	$(call if_changed,objcopy)
 
-$(obj)/simpleImage.$(DTB).ub: $(obj)/simpleImage.$(DTB) FORCE
+$(obj)/linux.bin.ub $(obj)/simpleImage.$(DTB).ub: %.ub: % FORCE
 	$(call if_changed,uimage)
 
 $(obj)/simpleImage.$(DTB).unstrip: vmlinux FORCE
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/4 microblaze: prevent linux.bin from containing a built-in DTB

In reply to Masahiro Yamada

MicroBlaze is the only architecture that specifies the built-in DTB directly via the command line (i.e., 'make simpleImage.*').

All other architectures supporting a builtin DTB use a CONFIG option to specify the DTB.

Kbuild supports building multiple targets in a single command. Running 'make foo bar' should produce the same output as executing 'make foo' and 'make bar' separately.

The oddity in MicroBlaze does not align with the Kbuild philosophy.

For example:

  $ make all simpleImage.foo

This creates both linux.bin (since 'all' depends on linux.bin) and simpleImage.foo.

It generates linux.bin containing foo.dtb, while linux.bin generated by 'make all' contains no DTB.

Michal Simek requires that linux.bin contain no built-in DTB. [1] Therefore, the linux.bin generated in the example above is considered invalid.

This commit introduces a sanity check to avoid creating such an invalid linux.bin.

Similarly, you cannot do 'make simpleImage.foo simpleImage.bar' since it is unclear which DTB (foo.dtb or bar.dtb) should be included. This command will fail without an explicit check.

[1]: https://lore.kernel.org/all/[email protected]/

---

 arch/microblaze/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/microblaze/Makefile +1 -0
index 02e6be9c5b0d..670a1690aa73 100644
@@ -66,6 +66,7 @@ PHONY += linux.bin linux.bin.gz linux.bin.ub
 linux.bin.ub linux.bin.gz: linux.bin
 linux.bin: vmlinux
 linux.bin linux.bin.gz linux.bin.ub:
+	$(if $(filter simpleImage.%, $(MAKECMDGOALS)),$(error You cannot build linux.bin and simpleImage.* at the same time))
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 	@echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH 4/4 microblaze: remove unnecessary system.dts

In reply to Masahiro Yamada

The default image linux.bin does not contain any DTB, but a separate system.dtb is compiled.

Michal Simek clearly explained "system.dtb is really old dtb more for demonstration purpose and nothing else and likely it is not working on any existing board." [1]

The system.dts is not necessary even for demonstration purposes. There is no need to compile out-of-tree *.dts under arch/microblaze/boot/dts/ unless it is embedded into the kernel. Users can directly use dtc.

[1]: https://lore.kernel.org/all/[email protected]/

---

 arch/microblaze/boot/dts/Makefile   |   3 +-
 arch/microblaze/boot/dts/system.dts | 353 ----------------------------
 2 files changed, 1 insertion(+), 355 deletions(-)
 delete mode 100644 arch/microblaze/boot/dts/system.dts
arch/microblaze/boot/dts/Makefile +1 -2
index 932dc7550a1b..fa0a6c0854ca 100644
@@ -1,8 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-dtb-y := system.dtb
-
 ifneq ($(DTB),)
 obj-y += linked_dtb.o
 
@@ -11,6 +9,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
 # Generate system.dtb from $(DTB).dtb
 ifneq ($(DTB),system)
+targets += system.dtb
 $(obj)/system.dtb: $(obj)/$(DTB).dtb FORCE
 	$(call if_changed,copy)
 endif
arch/microblaze/boot/dts/system.dts deleted +0 -353

353 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer
#4 lore raw

Re: [PATCH 4/4] microblaze: remove unnecessary system.dts

Quoted 36 lines · Masahiro Yamada

The default image linux.bin does not contain any DTB, but a separate system.dtb is compiled.

Michal Simek clearly explained "system.dtb is really old dtb more for demonstration purpose and nothing else and likely it is not working on any existing board." [1]

The system.dts is not necessary even for demonstration purposes. There is no need to compile out-of-tree *.dts under arch/microblaze/boot/dts/ unless it is embedded into the kernel. Users can directly use dtc.

[1]: https://lore.kernel.org/all/[email protected]/

---

 arch/microblaze/boot/dts/Makefile   |   3 +-
 arch/microblaze/boot/dts/system.dts | 353 ----------------------------
 2 files changed, 1 insertion(+), 355 deletions(-)
 delete mode 100644 arch/microblaze/boot/dts/system.dts
arch/microblaze/boot/dts/Makefile +0 -2
index 932dc7550a1b..fa0a6c0854ca 100644
@@ -1,8 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-dtb-y := system.dtb
-
 ifneq ($(DTB),)
 obj-y += linked_dtb.o
 

arch/microblaze/boot/dts/Makefile $(obj)/linked_dtb.o: $(obj)/system.dtb · line 11

Quoted 3 lines
arch/microblaze/boot/dts/Makefile +0 -0
@@ -11,6 +9,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
 # Generate system.dtb from $(DTB).dtb
 ifneq ($(DTB),system)

Can't this be dropped as setting DTB=system.dtb should work if there's not an in-tree system.dts anymore.

Quoted 4 lines
arch/microblaze/boot/dts/Makefile +1 -0
+targets += system.dtb
 $(obj)/system.dtb: $(obj)/$(DTB).dtb FORCE
        $(call if_changed,copy)
 endif
#5 lore raw

Re: [PATCH 4/4] microblaze: remove unnecessary system.dts

Quoted 37 lines · Rob Herring
Quoted 35 lines · Masahiro Yamada

The default image linux.bin does not contain any DTB, but a separate system.dtb is compiled.

Michal Simek clearly explained "system.dtb is really old dtb more for demonstration purpose and nothing else and likely it is not working on any existing board." [1]

The system.dts is not necessary even for demonstration purposes. There is no need to compile out-of-tree *.dts under arch/microblaze/boot/dts/ unless it is embedded into the kernel. Users can directly use dtc.

[1]: https://lore.kernel.org/all/[email protected]/

---

 arch/microblaze/boot/dts/Makefile   |   3 +-
 arch/microblaze/boot/dts/system.dts | 353 ----------------------------
 2 files changed, 1 insertion(+), 355 deletions(-)
 delete mode 100644 arch/microblaze/boot/dts/system.dts
arch/microblaze/boot/dts/Makefile +0 -2
index 932dc7550a1b..fa0a6c0854ca 100644
@@ -1,8 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-dtb-y := system.dtb
-
 ifneq ($(DTB),)
 obj-y += linked_dtb.o
 
Quoted 7 lines

arch/microblaze/boot/dts/Makefile $(obj)/linked_dtb.o: $(obj)/system.dtb · line 11

Quoted 4 lines
arch/microblaze/boot/dts/Makefile +0 -0
@@ -11,6 +9,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
 # Generate system.dtb from $(DTB).dtb
 ifneq ($(DTB),system)

Can't this be dropped as setting DTB=system.dtb should work if there's not an in-tree system.dts anymore.

I believe this ifneq is necessary, just in case a user adds system.dtb to arch/microblaze/boot/dts/.

'system.dtb' is a special name because
arch/microblaze/boot/dts/linked_dtb.S wraps it.

So, $(DTB) is copied to system.dtb, and then
it is wrapped by linked_dtb.S.

If $(DTB) is already 'system',
we cannot copy system.dtb to itself.

See the definition of cmd_copy in scripts/Makefile.lib

cmd_copy = cat $< > $@

"cat system.dtb > system.dtb"
would create an empty system.dtb

Quoted 5 lines
Quoted 5 lines
arch/microblaze/boot/dts/Makefile +1 -0
+targets += system.dtb
 $(obj)/system.dtb: $(obj)/$(DTB).dtb FORCE
        $(call if_changed,copy)
 endif
Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#6 lore raw

Re: [PATCH 4/4] microblaze: remove unnecessary system.dts

Quoted 59 lines · Masahiro Yamada
Quoted 37 lines · Rob Herring
Quoted 35 lines · Masahiro Yamada

The default image linux.bin does not contain any DTB, but a separate system.dtb is compiled.

Michal Simek clearly explained "system.dtb is really old dtb more for demonstration purpose and nothing else and likely it is not working on any existing board." [1]

The system.dts is not necessary even for demonstration purposes. There is no need to compile out-of-tree *.dts under arch/microblaze/boot/dts/ unless it is embedded into the kernel. Users can directly use dtc.

[1]: https://lore.kernel.org/all/[email protected]/

---

  arch/microblaze/boot/dts/Makefile   |   3 +-
  arch/microblaze/boot/dts/system.dts | 353 ----------------------------
  2 files changed, 1 insertion(+), 355 deletions(-)

delete mode 100644 arch/microblaze/boot/dts/system.dts

arch/microblaze/boot/dts/Makefile +0 -2
index 932dc7550a1b..fa0a6c0854ca 100644
@@ -1,8 +1,6 @@
  # SPDX-License-Identifier: GPL-2.0
  #
 
-dtb-y := system.dtb
-
  ifneq ($(DTB),)
  obj-y += linked_dtb.o
 
Quoted 7 lines

arch/microblaze/boot/dts/Makefile $(obj)/linked_dtb.o: $(obj)/system.dtb · line 11

Quoted 4 lines
arch/microblaze/boot/dts/Makefile +0 -0
@@ -11,6 +9,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
  # Generate system.dtb from $(DTB).dtb
  ifneq ($(DTB),system)

Can't this be dropped as setting DTB=system.dtb should work if there's not an in-tree system.dts anymore.

I believe this ifneq is necessary, just in case a user adds system.dtb to arch/microblaze/boot/dts/.

'system.dtb' is a special name because
arch/microblaze/boot/dts/linked_dtb.S wraps it.

So, $(DTB) is copied to system.dtb, and then
it is wrapped by linked_dtb.S.

If $(DTB) is already 'system',
we cannot copy system.dtb to itself.

Quoted 8 lines

See the definition of cmd_copy in scripts/Makefile.lib

cmd_copy = cat $< > $@

"cat system.dtb > system.dtb"
would create an empty system.dtb

I have played with this and pretty much this patch is blocking simpleImage.system build target.

I have no issue with patches 1-3 and I would keep system.dts as empty and keep it in the tree because users (including me) just rewrite system.dts with proper DTS and call make simpleImage.system.

Thanks,
Michal

Signature · 6 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs
TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs
#7 lore raw

Re: [PATCH 4/4] microblaze: remove unnecessary system.dts

Quoted 72 lines · Michal Simek
Quoted 59 lines · Masahiro Yamada
Quoted 37 lines · Rob Herring
Quoted 35 lines · Masahiro Yamada

The default image linux.bin does not contain any DTB, but a separate system.dtb is compiled.

Michal Simek clearly explained "system.dtb is really old dtb more for demonstration purpose and nothing else and likely it is not working on any existing board." [1]

The system.dts is not necessary even for demonstration purposes. There is no need to compile out-of-tree *.dts under arch/microblaze/boot/dts/ unless it is embedded into the kernel. Users can directly use dtc.

[1]: https://lore.kernel.org/all/[email protected]/

---

  arch/microblaze/boot/dts/Makefile   |   3 +-
  arch/microblaze/boot/dts/system.dts | 353 ----------------------------
  2 files changed, 1 insertion(+), 355 deletions(-)

delete mode 100644 arch/microblaze/boot/dts/system.dts

arch/microblaze/boot/dts/Makefile +0 -2
index 932dc7550a1b..fa0a6c0854ca 100644
@@ -1,8 +1,6 @@
  # SPDX-License-Identifier: GPL-2.0
  #
 
-dtb-y := system.dtb
-
  ifneq ($(DTB),)
  obj-y += linked_dtb.o
 
Quoted 7 lines

arch/microblaze/boot/dts/Makefile $(obj)/linked_dtb.o: $(obj)/system.dtb · line 11

Quoted 4 lines
arch/microblaze/boot/dts/Makefile +0 -0
@@ -11,6 +9,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
  # Generate system.dtb from $(DTB).dtb
  ifneq ($(DTB),system)

Can't this be dropped as setting DTB=system.dtb should work if there's not an in-tree system.dts anymore.

I believe this ifneq is necessary, just in case a user adds system.dtb to arch/microblaze/boot/dts/.

'system.dtb' is a special name because
arch/microblaze/boot/dts/linked_dtb.S wraps it.

So, $(DTB) is copied to system.dtb, and then
it is wrapped by linked_dtb.S.

If $(DTB) is already 'system',
we cannot copy system.dtb to itself.

Quoted 8 lines

See the definition of cmd_copy in scripts/Makefile.lib

cmd_copy = cat $< > $@

"cat system.dtb > system.dtb"
would create an empty system.dtb

Quoted 6 lines

I have played with this and pretty much this patch is blocking simpleImage.system build target.

I have no issue with patches 1-3 and I would keep system.dts as empty and keep it in the tree because users (including me) just rewrite system.dts with proper DTS and call make simpleImage.system.

Why is "system" so special?

You hard-code this line:
dtb-y := system.dtb

"make simpleImage.system" compiles system.dts to system.dtb

However,

"make simpleImage.foo" does not compile foo.dts to foo.dtb since "dtb-y := foo.dtb" is missing.
This works only if you drop-in a pre-compiled foo.dtb

"make simpleImage.<name>" works only when <name> is "system".

Is this what you mean?

Signature · 2 lines
Best Regards
Masahiro Yamada
#8 lore raw

Re: [PATCH 4/4] microblaze: remove unnecessary system.dts

Quoted 80 lines · Masahiro Yamada
Quoted 72 lines · Michal Simek
Quoted 59 lines · Masahiro Yamada
Quoted 37 lines · Rob Herring
Quoted 35 lines · Masahiro Yamada

The default image linux.bin does not contain any DTB, but a separate system.dtb is compiled.

Michal Simek clearly explained "system.dtb is really old dtb more for demonstration purpose and nothing else and likely it is not working on any existing board." [1]

The system.dts is not necessary even for demonstration purposes. There is no need to compile out-of-tree *.dts under arch/microblaze/boot/dts/ unless it is embedded into the kernel. Users can directly use dtc.

[1]: https://lore.kernel.org/all/[email protected]/

---

   arch/microblaze/boot/dts/Makefile   |   3 +-
   arch/microblaze/boot/dts/system.dts | 353 ----------------------------
   2 files changed, 1 insertion(+), 355 deletions(-)

delete mode 100644 arch/microblaze/boot/dts/system.dts

arch/microblaze/boot/dts/Makefile +0 -2
index 932dc7550a1b..fa0a6c0854ca 100644
@@ -1,8 +1,6 @@
   # SPDX-License-Identifier: GPL-2.0
   #
 
-dtb-y := system.dtb
-
   ifneq ($(DTB),)
   obj-y += linked_dtb.o
 
Quoted 7 lines

arch/microblaze/boot/dts/Makefile $(obj)/linked_dtb.o: $(obj)/system.dtb · line 11

Quoted 4 lines
arch/microblaze/boot/dts/Makefile +0 -0
@@ -11,6 +9,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb
 
   # Generate system.dtb from $(DTB).dtb
   ifneq ($(DTB),system)

Can't this be dropped as setting DTB=system.dtb should work if there's not an in-tree system.dts anymore.

I believe this ifneq is necessary, just in case a user adds system.dtb to arch/microblaze/boot/dts/.

'system.dtb' is a special name because
arch/microblaze/boot/dts/linked_dtb.S wraps it.

So, $(DTB) is copied to system.dtb, and then
it is wrapped by linked_dtb.S.

If $(DTB) is already 'system',
we cannot copy system.dtb to itself.

Quoted 8 lines

See the definition of cmd_copy in scripts/Makefile.lib

cmd_copy = cat $< > $@

"cat system.dtb > system.dtb"
would create an empty system.dtb

Quoted 6 lines

I have played with this and pretty much this patch is blocking simpleImage.system build target.

I have no issue with patches 1-3 and I would keep system.dts as empty and keep it in the tree because users (including me) just rewrite system.dts with proper DTS and call make simpleImage.system.

Quoted 7 lines

Why is "system" so special?

You hard-code this line:
dtb-y := system.dtb

"make simpleImage.system" compiles system.dts to system.dtb

yes.

Quoted 4 lines

However,

"make simpleImage.foo" does not compile foo.dts to foo.dtb since "dtb-y := foo.dtb" is missing.

Correct but foo.dts is not in the source code too.
Downstream repos can add multiple dtses to source code based on configurations which are supporting and then they add

dtb-y += foo.dtb

there.

Quoted 1 line

This works only if you drop-in a pre-compiled foo.dtb

as above. It is up to users to decide how they want to do it.

If they add dts to source they have to also add a rule. If they want to just use DTB then can just copy it there to get it work.

Another option is also just overwrite system.dts by custom dts file.

Quoted 1 line

"make simpleImage.<name>" works only when <name> is "system".

With upstream repo yes.
And the reason is that system.dts is just example.
In Microblaze systems you can have unlimited amount of configurations that's why make no sense to start to push DTSes to the kernel because it is only supporting one particular configuration on one board.

Thanks,
Michal