[Buildroot] [PATCH] linux: add option to create kernel tarball

Yegor Yefremov yegorslists at googlemail.com
Sat Nov 8 16:32:47 UTC 2014


This option will invoke "make tar-pkg" in kernel's build directory
and the resulting linux-*.tar will be copied to images folder.

Signed-off-by: Yegor Yefremov <yegorslists at googlemail.com>
---
 linux/Config.in |  5 +++++
 linux/linux.mk  | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/linux/Config.in b/linux/Config.in
index e0d123c..b222bbf 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -345,6 +345,11 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
 	  /boot if DTBs have been generated by the kernel build
 	  process.
 
+config BR2_LINUX_KERNEL_BUILD_AS_TARBALL
+	bool "Build kernel as a tarball"
+	help
+	  Execute "make tar-pkg" and copy resulting tarball to images folder.
+
 # Linux extensions
 source "linux/Config.ext.in"
 
diff --git a/linux/linux.mk b/linux/linux.mk
index 6740d01..e09fc5c 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -215,6 +215,15 @@ define LINUX_CONFIGURE_CMDS
 	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
 endef
 
+ifeq ($(BR2_LINUX_KERNEL_BUILD_AS_TARBALL),y)
+define LINUX_MAKE_KERNEL_PKG
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) tar-pkg
+endef
+define LINUX_INSTALL_KERNEL_PKG
+	cp $(@D)/*.tar $(BINARIES_DIR)
+endef
+endif
+
 ifeq ($(BR2_LINUX_KERNEL_DTS_SUPPORT),y)
 ifeq ($(BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT),)
 define LINUX_BUILD_DTB
@@ -271,6 +280,7 @@ define LINUX_BUILD_CMDS
 	fi
 	$(LINUX_BUILD_DTB)
 	$(LINUX_APPEND_DTB)
+	$(LINUX_MAKE_KERNEL_PKG)
 endef
 
 
@@ -293,6 +303,7 @@ endef
 define LINUX_INSTALL_IMAGES_CMDS
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
 	$(LINUX_INSTALL_DTB)
+	$(LINUX_INSTALL_KERNEL_PKG)
 endef
 
 define LINUX_INSTALL_TARGET_CMDS
-- 
1.8.3.2



More information about the buildroot mailing list