Skip to contentSkip to conversation

Makefile: rules for printing kernel architecture and localversion

PATCH New Enrico Weigelt, metux IT consult 1 participant 1 message Jul 29, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makefile: rules for printing kernel architecture and localversion

trivial rule to print out the kernel arch and localversion, so external tools, like distro packagers, can easily get it.

v2: add help text

---
 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Makefile +10 -0
index fa0fbe7..32c8f2a 100644
@@ -1517,6 +1517,10 @@ help:
 	@echo  'Kernel packaging:'
 	@$(MAKE) $(build)=$(package-dir) help
 	@echo  ''
+	@echo  'Build configuration retrieval:'
+	@echo  '  kernellocalversion  - Print kernel local version (CONFIG_LOCALVERSION)'
+	@echo  '  kernelarch          - Print kernel architecture'
+	@echo  ''
 	@echo  'Documentation targets:'
 	@$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
 	@echo  ''
@@ -1728,6 +1732,12 @@ kernelrelease:
 kernelversion:
 	@echo $(KERNELVERSION)
 
+kernellocalversion:
+	@$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree) | sed -e 's~^\-~~'
+
+kernelarch:
+	@echo $(ARCH)
+
 image_name:
 	@echo $(KBUILD_IMAGE)
 
Signature · 1 line
1.9.1