diff mbox

linux: add option to create kernel tarball

Message ID 1415464367-32108-1-git-send-email-yegorslists@googlemail.com
State Rejected
Headers show

Commit Message

Yegor Yefremov Nov. 8, 2014, 4:32 p.m. UTC
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@googlemail.com>
---
 linux/Config.in |  5 +++++
 linux/linux.mk  | 11 +++++++++++
 2 files changed, 16 insertions(+)

Comments

Yann E. MORIN Nov. 8, 2014, 4:39 p.m. UTC | #1
Yegor, All,

On 2014-11-08 17:32 +0100, Yegor Yefremov spake thusly:
> This option will invoke "make tar-pkg" in kernel's build directory
> and the resulting linux-*.tar will be copied to images folder.

Why would we want that only for the kernel?

If we were to add such a command, we would want to have it for all
packages, done in a generic way, unless there is a *really* *compelling*
reason to have such a linux-specific command.

Regards,
Yann E. MORIN.

> Signed-off-by: Yegor Yefremov <yegorslists@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
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Nov. 8, 2014, 5:43 p.m. UTC | #2
Yann, Yegor,

On Sat, 8 Nov 2014 17:39:42 +0100, Yann E. MORIN wrote:
> Yegor, All,
> 
> On 2014-11-08 17:32 +0100, Yegor Yefremov spake thusly:
> > This option will invoke "make tar-pkg" in kernel's build directory
> > and the resulting linux-*.tar will be copied to images folder.
> 
> Why would we want that only for the kernel?
> 
> If we were to add such a command, we would want to have it for all
> packages, done in a generic way, unless there is a *really* *compelling*
> reason to have such a linux-specific command.

Well, the kernel has this "tar-pkg" target that other packages
typically don't have. However, I'm curious to know what is the use case
for "make tar-pkg" in the kernel in the context of Buildroot.

Yegor?

Thomas
Yegor Yefremov Nov. 8, 2014, 6:24 p.m. UTC | #3
On Sat, Nov 8, 2014 at 6:43 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Yann, Yegor,
>
> On Sat, 8 Nov 2014 17:39:42 +0100, Yann E. MORIN wrote:
>> Yegor, All,
>>
>> On 2014-11-08 17:32 +0100, Yegor Yefremov spake thusly:
>> > This option will invoke "make tar-pkg" in kernel's build directory
>> > and the resulting linux-*.tar will be copied to images folder.
>>
>> Why would we want that only for the kernel?
>>
>> If we were to add such a command, we would want to have it for all
>> packages, done in a generic way, unless there is a *really* *compelling*
>> reason to have such a linux-specific command.
>
> Well, the kernel has this "tar-pkg" target that other packages
> typically don't have. However, I'm curious to know what is the use case
> for "make tar-pkg" in the kernel in the context of Buildroot.
>
> Yegor?

Image, you have a system/rootfs, that you've made via BR or it is
Debian etc. Now you just want to update the kernel and modules. Kernel
is simple, as BR compiles and copies it to output/images folder. But
to install kernel modules you first need to invoke one of the make
*-pkg commands, to do this you need to first export ARCH,
CROSS_COMPILE etc. First then you can copy resulting image to target
device and via "tar xf linux-*.tar -C /" install new kernel modules.
Am I missing something and such option already exists in BR? The only
one I see would be to tar output/target/lib/modules. But it still need
to be made manually. I wanted to have an option to have both kernel
image and modules ready for installation in output/images.

Yegor
Peter Korsgaard Nov. 8, 2014, 9:53 p.m. UTC | #4
>>>>> "Yegor" == Yegor Yefremov <yegorslists@googlemail.com> writes:

Hi,

 >> Well, the kernel has this "tar-pkg" target that other packages
 >> typically don't have. However, I'm curious to know what is the use case
 >> for "make tar-pkg" in the kernel in the context of Buildroot.
 >> 
 >> Yegor?

 > Image, you have a system/rootfs, that you've made via BR or it is
 > Debian etc. Now you just want to update the kernel and modules. Kernel
 > is simple, as BR compiles and copies it to output/images folder. But
 > to install kernel modules you first need to invoke one of the make
 > *-pkg commands, to do this you need to first export ARCH,
 > CROSS_COMPILE etc. First then you can copy resulting image to target
 > device and via "tar xf linux-*.tar -C /" install new kernel modules.
 > Am I missing something and such option already exists in BR? The only
 > one I see would be to tar output/target/lib/modules. But it still need
 > to be made manually. I wanted to have an option to have both kernel
 > image and modules ready for installation in output/images.

That imho sounds like a quite special setup and something that could
easily be implemented in a custom post-buid / post-image script.

So I prefer to NOT add this patch.
Thomas Petazzoni Nov. 9, 2014, 9:48 a.m. UTC | #5
Yegor,

On Sat, 8 Nov 2014 19:24:48 +0100, Yegor Yefremov wrote:

> Image, you have a system/rootfs, that you've made via BR or it is
> Debian etc. Now you just want to update the kernel and modules. Kernel
> is simple, as BR compiles and copies it to output/images folder. But
> to install kernel modules you first need to invoke one of the make
> *-pkg commands, to do this you need to first export ARCH,
> CROSS_COMPILE etc. First then you can copy resulting image to target
> device and via "tar xf linux-*.tar -C /" install new kernel modules.
> Am I missing something and such option already exists in BR? The only
> one I see would be to tar output/target/lib/modules. But it still need
> to be made manually. I wanted to have an option to have both kernel
> image and modules ready for installation in output/images.

This really seems like you're looking for a build system that produces
binary packages. With your patch, you're doing something for the kernel
specifically, but what if someone has the same need for some other
library or application built by Buildroot?

So like Peter, I don't think this is something we want to merge in
Buildroot.

Thomas
Yegor Yefremov Nov. 9, 2014, 12:36 p.m. UTC | #6
On Sun, Nov 9, 2014 at 10:48 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Yegor,
>
> On Sat, 8 Nov 2014 19:24:48 +0100, Yegor Yefremov wrote:
>
>> Image, you have a system/rootfs, that you've made via BR or it is
>> Debian etc. Now you just want to update the kernel and modules. Kernel
>> is simple, as BR compiles and copies it to output/images folder. But
>> to install kernel modules you first need to invoke one of the make
>> *-pkg commands, to do this you need to first export ARCH,
>> CROSS_COMPILE etc. First then you can copy resulting image to target
>> device and via "tar xf linux-*.tar -C /" install new kernel modules.
>> Am I missing something and such option already exists in BR? The only
>> one I see would be to tar output/target/lib/modules. But it still need
>> to be made manually. I wanted to have an option to have both kernel
>> image and modules ready for installation in output/images.
>
> This really seems like you're looking for a build system that produces
> binary packages. With your patch, you're doing something for the kernel
> specifically, but what if someone has the same need for some other
> library or application built by Buildroot?
>
> So like Peter, I don't think this is something we want to merge in
> Buildroot.

OK. I think, it won't be a problem to make this via post-build script.

Yegor
diff mbox

Patch

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