diff mbox

[v2,1/2] linux: install firmware to staging.

Message ID 1373391595-19359-1-git-send-email-spenser@gillilanding.com
State Changes Requested
Headers show

Commit Message

Spenser Gilliland July 9, 2013, 5:39 p.m. UTC
Install firmware to staging when the hidden option
BR2_LINUX_KERNEL_INSTALL_FIRMWARE is selected.  This allows parts of the
firmware provided by the linux kernel to be installed in the target.

Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
v1->v2:
  - increase comment clarity in Config.in
---
 linux/Config.in |  7 +++++++
 linux/linux.mk  | 13 +++++++++++++
 2 files changed, 20 insertions(+)

Comments

Yann E. MORIN July 9, 2013, 8:03 p.m. UTC | #1
On 2013-07-09 12:39 -0500, Spenser Gilliland spake thusly:
> Install firmware to staging when the hidden option
> BR2_LINUX_KERNEL_INSTALL_FIRMWARE is selected.  This allows parts of the
> firmware provided by the linux kernel to be installed in the target.
> 
> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> Cc: Peter Korsgaard <jacmet@uclibc.org>
> Cc: Yann E. Morin <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Since this subject is a bit sensible, and Thomas has valid concerns about
this feature, it would be nice to hold on this until Thomas and Peter,
and others, have fully commented on this.

This is the best-so-far idea that we've discused with Spenser and Peter
on IRC, but is far from ideal. If anyone has a better idea, then do not
hesitate to speak (speak now, or be silent for the rest of Eternity! ;-) )

Regards,
Yann E. MORIN.
Thomas Petazzoni July 10, 2013, 7:11 a.m. UTC | #2
Dear Spenser Gilliland,

On Tue,  9 Jul 2013 12:39:54 -0500, Spenser Gilliland wrote:
> Install firmware to staging when the hidden option
> BR2_LINUX_KERNEL_INSTALL_FIRMWARE is selected.  This allows parts of the
> firmware provided by the linux kernel to be installed in the target.
> 
> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> Cc: Peter Korsgaard <jacmet@uclibc.org>
> Cc: Yann E. Morin <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

As discussed on IRC, I'm not really happy with the idea that one
package (linux) installs things in staging, and then another package
(beagle-capes) takes what the linux package has installed in staging,
and copies it to the target. Normally, it's the responsibility of a
given to package to install its stuff to the final destination.
Possibly with sub-options in this package to find out what should
actually be installed.

So normally, the situation you have should be solved with a Linux
Kernel package sub-option to select the list of in-kernel firmwares to
install.

Best regards,

Thomas
Yann E. MORIN July 10, 2013, 5:12 p.m. UTC | #3
Thomas, Spenser, All,

On 2013-07-10 09:11 +0200, Thomas Petazzoni spake thusly:
> On Tue,  9 Jul 2013 12:39:54 -0500, Spenser Gilliland wrote:
> > Install firmware to staging when the hidden option
> > BR2_LINUX_KERNEL_INSTALL_FIRMWARE is selected.  This allows parts of the
> > firmware provided by the linux kernel to be installed in the target.
> > 
> > Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> > Cc: Peter Korsgaard <jacmet@uclibc.org>
> > Cc: Yann E. Morin <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> 
> As discussed on IRC, I'm not really happy with the idea that one
> package (linux) installs things in staging, and then another package
> (beagle-capes) takes what the linux package has installed in staging,
> and copies it to the target. Normally, it's the responsibility of a
> given to package to install its stuff to the final destination.
> Possibly with sub-options in this package to find out what should
> actually be installed.
> 
> So normally, the situation you have should be solved with a Linux
> Kernel package sub-option to select the list of in-kernel firmwares to
> install.

Altenatively, as I suggested before, this could be delegated to a
post-build script:
  - the package (linux) always install its files in staging
  - a post-build scripts cherry-picks what is relevant

What I don't like with this solution is that the Linux kernel would
always install its firmware files, and that people will start using that
as the source of the firmwares, while we do have linux-firmware for
that.

I really can't think of a better approach, considering that:
  - we want to use linux-firmware to install 'standard' firmwares
  - we want the use to be able to install capes' firmwares
  - we do not want to have cross-package build/install procedures (what
    I suggested and Spenser implemented in this patchset)

Regards,
Yann E. MORIN.
Thomas Petazzoni July 11, 2013, 8:58 a.m. UTC | #4
Dear Yann E. MORIN,

On Wed, 10 Jul 2013 19:12:18 +0200, Yann E. MORIN wrote:

> Altenatively, as I suggested before, this could be delegated to a
> post-build script:
>   - the package (linux) always install its files in staging
>   - a post-build scripts cherry-picks what is relevant
> 
> What I don't like with this solution is that the Linux kernel would
> always install its firmware files, and that people will start using that
> as the source of the firmwares, while we do have linux-firmware for
> that.

Another solution is, inside the kernel menu:

	[*] Install in-kernel firmwares
		(*.dtbo) List of firmwares to installs

Best regards,

Thomas
diff mbox

Patch

diff --git a/linux/Config.in b/linux/Config.in
index f58e714..f5c4764 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -297,6 +297,13 @@  config BR2_LINUX_KERNEL_INSTALL_TARGET
 	  /boot in the target root filesystem, as is typically done on
 	  x86/x86_64 systems.
 
+# This option can be selected by other packages that require special
+# firmwares bundled in some forks of the Linux kernel (e.g. the BeagleBone
+# Black cape firmwares (.dtbo) as distibuted in the TI Linux Kernel fork.) To
+# install firmware from the mainline kernel please use the
+# linux-firmware package.
+config BR2_LINUX_KERNEL_INSTALL_FIRMWARE
+	bool
 
 # Linux extensions
 source "linux/Config.ext.in"
diff --git a/linux/linux.mk b/linux/linux.mk
index befef16..88c954d 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -256,6 +256,15 @@  define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
 endef
 endif
 
+ifeq ($(BR2_LINUX_KERNEL_INSTALL_FIRMWARE),y)
+
+LINUX_INSTALL_STAGING = YES
+
+define LINUX_INSTALL_FIRMWARE_TO_STAGING
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) firmware_install \
+		INSTALL_FW_PATH=$(STAGING_DIR)/lib/firmware/
+endef
+endif
 
 define LINUX_INSTALL_HOST_TOOLS
 	# Installing dtc (device tree compiler) as host tool, if selected
@@ -269,6 +278,10 @@  define LINUX_INSTALL_IMAGES_CMDS
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
 endef
 
+define LINUX_INSTALL_STAGING_CMDS
+	$(LINUX_INSTALL_FIRMWARE_TO_STAGING)
+endef
+
 define LINUX_INSTALL_TARGET_CMDS
 	$(LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET)
 	$(LINUX_INSTALL_DTB)