Skip to contentSkip to conversation

scripts/package/Makefile: Add source RPM target

PATCH New Major Hayden 1 participant 1 message Mar 19, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/package/Makefile: Add source RPM target

Some developers use external build systems to compile kernels and these build systems may accept a source RPM as an input. This patch adds a quick method for developers to build a source RPM using make srpm-pkg.

---
 scripts/package/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/package/Makefile +9 -0
index 2c6de21e5152..8329d6dfe3d8 100644
@@ -47,6 +47,14 @@ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \
 	--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \
 rm -f $(objtree)/.scmversion
 
+# srpm-pkg
+# ---------------------------------------------------------------------------
+srpm-pkg: FORCE
+	$(MAKE) clean
+	$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
+	$(call cmd,src_tar,$(KERNELPATH),kernel.spec)
+	+rpmbuild $(RPMOPTS) -ts $(KERNELPATH).tar.gz
+
 # rpm-pkg
 # ---------------------------------------------------------------------------
 rpm-pkg: FORCE
@@ -140,6 +148,7 @@ perf-%pkg: FORCE
 help: FORCE
 	@echo '  rpm-pkg             - Build both source and binary RPM kernel packages'
 	@echo '  binrpm-pkg          - Build only the binary kernel RPM package'
+	@echo '  srpm-pkg            - Build only the source kernel RPM package'
 	@echo '  deb-pkg             - Build both source and binary deb kernel packages'
 	@echo '  bindeb-pkg          - Build only the binary kernel deb package'
 	@echo '  snap-pkg            - Build only the binary kernel snap package (will connect to external hosts)'
Signature · 1 line
2.20.1