Skip to contentSkip to conversation

linux: install firmware to staging.

PATCH New Spenser Gilliland 3 participants 7 messages Jul 9, 2013 – Jul 11, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 linux: install firmware to staging.

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.

Cc Peter Korsgaard <[email protected]>
Cc Yann E. Morin <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
v1->v2:
- increase comment clarity in Config.in

---
 linux/Config.in |  7 +++++++
 linux/linux.mk  | 13 +++++++++++++
 2 files changed, 20 insertions(+)
linux/Config.in +7 -0
index f58e714..f5c4764 100644
@@ -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"
linux/linux.mk +13 -0
index befef16..88c954d 100644
@@ -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)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 2/2 beagle-capes: new package

installs the beaglebone cape dtbos.

Cc Peter Korsgaard <[email protected]>
Cc Yann E. Morin <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
v1->v2:
- alpha order in ../Config.in
- clarify Config.in

---
 package/Config.in                    |  1 +
 package/beagle-capes/Config.in       | 13 +++++++++++++
 package/beagle-capes/beagle-capes.mk | 15 +++++++++++++++
 3 files changed, 29 insertions(+)
 create mode 100644 package/beagle-capes/Config.in
 create mode 100644 package/beagle-capes/beagle-capes.mk
package/Config.in +1 -0
index 4df48ba..d17baa9 100644
@@ -221,6 +221,7 @@ menu "Hardware handling"
 menu "Misc devices firmwares"
 source "package/am33x-cm3/Config.in"
 source "package/b43-firmware/Config.in"
+source "package/beagle-capes/Config.in"
 source "package/linux-firmware/Config.in"
 source "package/rpi-firmware/Config.in"
 source "package/sunxi-boards/Config.in"
package/beagle-capes/Config.in new file +13 -0
new file mode 100644
index 0000000..90482ec
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_BEAGLE_CAPES
+	bool "beagle-capes"
+	depends on BR2_LINUX_KERNEL && BR2_arm
+	select BR2_LINUX_KERNEL_INSTALL_FIRMWARE
+	help
+	  Installs beaglebone capes firmwares.
+
+	  These firmwares are bundled in the TI fork on the Linux kernel for the
+	  BeagleBone; therefore, a kernel with these firmwares must be configured in
+	  the Kernel Configuration section of Buildroot.
+
+comment "beagle-capes requires a Linux kernel"
+	depends on !(BR2_LINUX_KERNEL)
package/beagle-capes/beagle-capes.mk new file +15 -0
new file mode 100644
index 0000000..5b6f121
@@ -0,0 +1,15 @@
+################################################################################
+#
+# beagle-capes 
+#
+################################################################################
+
+BEAGLE_CAPES_SOURCE =
+
+BEAGLE_CAPES_DEPENDENCIES = linux
+
+define BEAGLE_CAPES_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 644 $(STAGING_DIR)/lib/firmware/*.dtbo $(TARGET_DIR)/lib/firmware/
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v2 2/2 beagle-capes: new package

On 2013-07-09 12:39 -0500, Spenser Gilliland spake thusly:

Quoted 6 lines

installs the beaglebone cape dtbos.

Cc Peter Korsgaard <[email protected]>
Cc Yann E. Morin <[email protected]>
Cc Thomas Petazzoni <[email protected]>

Ditto the previous patch: may need further discussion if a better idea pops up.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v2 1/2 linux: install firmware to staging.

In reply to Spenser Gilliland

On 2013-07-09 12:39 -0500, Spenser Gilliland spake thusly:

Quoted 8 lines

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.

Cc Peter Korsgaard <[email protected]>
Cc Yann E. Morin <[email protected]>
Cc Thomas Petazzoni <[email protected]>

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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v2 1/2 linux: install firmware to staging.

In reply to Spenser Gilliland

Dear Spenser Gilliland,

Quoted 8 lines · Spenser Gilliland

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.

Cc Peter Korsgaard <[email protected]>
Cc Yann E. Morin <[email protected]>
Cc Thomas Petazzoni <[email protected]>

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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH v2 1/2 linux: install firmware to staging.

Thomas, Spenser, All,

On 2013-07-10 09:11 +0200, Thomas Petazzoni spake thusly:

Quoted 18 lines · Spenser Gilliland
Quoted 8 lines

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.

Cc Peter Korsgaard <[email protected]>
Cc Yann E. Morin <[email protected]>
Cc Thomas Petazzoni <[email protected]>

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.

Quoted 3 lines

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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH v2 1/2 linux: install firmware to staging.

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com