Skip to contentSkip to conversation

linux: install firmware to staging.

PATCH Superseded Spenser Gilliland 5 participants 13 messages Jul 7, 2013 – Oct 27, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 linux/Config.in |  5 +++++
 linux/linux.mk  | 13 +++++++++++++
 2 files changed, 18 insertions(+)
linux/Config.in +5 -0
index f58e714..b733019 100644
@@ -297,6 +297,11 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
 	  /boot in the target root filesystem, as is typically done on
 	  x86/x86_64 systems.
 
+# This option is used to install firmware to staging. Other packages such as
+# beagle-capes then install the firmware into the target. This avoids
+# installing all linux firmware.
+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 2/2 beagle-capes: new package

installs cape dtbos from the kernel firmware into the target system.

---
 package/Config.in                    |  1 +
 package/beagle-capes/Config.in       | 12 ++++++++++++
 package/beagle-capes/beagle-capes.mk | 15 +++++++++++++++
 3 files changed, 28 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..3b06f98 100644
@@ -226,6 +226,7 @@ source "package/rpi-firmware/Config.in"
 source "package/sunxi-boards/Config.in"
 source "package/ux500-firmware/Config.in"
 source "package/zd1211-firmware/Config.in"
+source "package/beagle-capes/Config.in"
 endmenu
 source "package/freescale-imx/Config.in"
 source "package/acpid/Config.in"
package/beagle-capes/Config.in new file +12 -0
new file mode 100644
index 0000000..568e84f
@@ -0,0 +1,12 @@
+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 firmware from the kernel source.
+
+	  This package requires that a kernel with beaglebone capes firmware is
+	  selected.
+
+comment "requires the 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 2/2 beagle-capes: new package

Hi Spenser,

Quoted 2 lines · Spenser Gilliland

installs cape dtbos from the kernel firmware into the target system.

Slightly off topic, but did you run into any issues with the eMMC virtual cape when you did this? The cape manager requests the eMMC cape dtbo before the root file system is mounted. When mdev was finally run from the init scripts, it didn't satisfy that request (I quickly looked through the mdev source, and I didn't see any code to do this. mdev seems to only handle "hotplug" firmware requests). If I manually loaded the eMMC virtual cape dtbo file before the timeout, I could get things to work. I ended up compiling the dtbos into the kernel, but if your br configuration doesn't need to do this, then could you share?

Also, and this is just to understand things better, but if you don't want a firmware file copied to the target, wouldn't you just turn it off in the kernel's configuration?

Or were you motivated by the shear volume of dtbo files that you get when you turn on Beaglebone cape support? I was thinking that I wanted finer grain configuration in the Linux kernel so that I could select whether or not I wanted "cape-bone-exptest.dtbo" or "cape-bone-adafruit-lcd", etc., but I don't think that's a br problem. Prior to the Beaglebone capes, I had not seen so many firmware files that I didn't need.

Thanks,
Frank

p.s. thanks for the opengl work. I have a project coming up in the fall that will need it, so your commits are very timely.

Quoted 67 lines
---
 package/Config.in                    |  1 +
 package/beagle-capes/Config.in       | 12 ++++++++++++
 package/beagle-capes/beagle-capes.mk | 15 +++++++++++++++
 3 files changed, 28 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..3b06f98 100644
@@ -226,6 +226,7 @@ source "package/rpi-firmware/Config.in"
 source "package/sunxi-boards/Config.in"
 source "package/ux500-firmware/Config.in"
 source "package/zd1211-firmware/Config.in"
+source "package/beagle-capes/Config.in"
 endmenu
 source "package/freescale-imx/Config.in"
 source "package/acpid/Config.in"
package/beagle-capes/Config.in new file +12 -0
new file mode 100644
index 0000000..568e84f
@@ -0,0 +1,12 @@
+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 firmware from the kernel source.
+
+         This package requires that a kernel with beaglebone capes firmware is
+         selected.
+
+comment "requires the linux kernel"
+       depends on !(BR2_LINUX_KERNEL)
package/beagle-capes/beagle-capes.mk new file +15 -1
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))
--

1.8.1.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 2/2 beagle-capes: new package

Hi Frank,

Your buildroot-bbb repo has been a great reference that helped me get this all up and running.

Quoted 10 lines

Slightly off topic, but did you run into any issues with the eMMC virtual cape when you did this? The cape manager requests the eMMC cape dtbo before the root file system is mounted. When mdev was finally run from the init scripts, it didn't satisfy that request (I quickly looked through the mdev source, and I didn't see any code to do this. mdev seems to only handle "hotplug" firmware requests). If I manually loaded the eMMC virtual cape dtbo file before the timeout, I could get things to work. I ended up compiling the dtbos into the kernel, but if your br configuration doesn't need to do this, then could you share?

Although, this is not a significant part of my testing (mainly focused on hdmi support.) I can say that the emmc is detected very early in the boot process and the following is shown during boot.

[    2.064491] mmc1: BKOPS_EN bit is not set
[    2.071345] mmc1: new high speed MMC card at address 0001
[    2.078050] mmcblk1: mmc1:0001 MMC02G 1.78 GiB
[    2.083224] mmcblk1boot0: mmc1:0001 MMC02G partition 1 1.00 MiB
[    2.089812] mmcblk1boot1: mmc1:0001 MMC02G partition 2 1.00 MiB
[    2.098715]  mmcblk1: p1 p2
[    2.106001]  mmcblk1boot1: unknown partition table
[    2.113814]  mmcblk1boot0: unknown partition table

Also, just an fyi to everyone with respect to hdmi output, you must have beagle-capes enabled to allow HDMI output as HDMI is implemented as a cape. Also, for any capes to work patch [1] is required.

[1] https://github.com/fhunleth/buildroot-bbb/blob/bbb/board/beagleboneblack/linux-0001-Add-missing-DTC-flags.patch

Quoted 3 lines

Also, and this is just to understand things better, but if you don't want a firmware file copied to the target, wouldn't you just turn it off in the kernel's configuration?

No, by default Buildroot does not install use the firmware_install target. This is for reasons of disk space usage. The kernel, by default, likes to install a lot of firmware. Additionally, there is a linux-firmware package for installing most of this firmware and has much more granular control.

Quoted 7 lines

Or were you motivated by the shear volume of dtbo files that you get when you turn on Beaglebone cape support? I was thinking that I wanted finer grain configuration in the Linux kernel so that I could select whether or not I wanted "cape-bone-exptest.dtbo" or "cape-bone-adafruit-lcd", etc., but I don't think that's a br problem. Prior to the Beaglebone capes, I had not seen so many firmware files that I didn't need.

I thought about doing individual capes but the constantly changing nature of these capes would require lots of updates and special cases. However, the size of dtbo's are negligible so I just installed them all.

Quoted 5 lines

Thanks,
Frank

p.s. thanks for the opengl work. I have a project coming up in the fall that will need it, so your commits are very timely.

Great to hear. Hopefully, the Beaglebone Black will be a possible target soon.

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate

#4 lore raw

PATCH 2/2 beagle-capes: new package

Hi Spenser,

Quoted 17 lines · Spenser Gilliland

Hi Frank,

Your buildroot-bbb repo has been a great reference that helped me get this all up and running.

Quoted 10 lines

Slightly off topic, but did you run into any issues with the eMMC virtual cape when you did this? The cape manager requests the eMMC cape dtbo before the root file system is mounted. When mdev was finally run from the init scripts, it didn't satisfy that request (I quickly looked through the mdev source, and I didn't see any code to do this. mdev seems to only handle "hotplug" firmware requests). If I manually loaded the eMMC virtual cape dtbo file before the timeout, I could get things to work. I ended up compiling the dtbos into the kernel, but if your br configuration doesn't need to do this, then could you share?

Quoted 3 lines

Although, this is not a significant part of my testing (mainly focused on hdmi support.) I can say that the emmc is detected very early in the boot process and the following is shown during boot.

Cool. I won't be touching HDMI since my cape conflicts with it, so it's good to know that the HDMI support is being exercised.

Quoted 9 lines
[    2.064491] mmc1: BKOPS_EN bit is not set
[    2.071345] mmc1: new high speed MMC card at address 0001
[    2.078050] mmcblk1: mmc1:0001 MMC02G 1.78 GiB
[    2.083224] mmcblk1boot0: mmc1:0001 MMC02G partition 1 1.00 MiB
[    2.089812] mmcblk1boot1: mmc1:0001 MMC02G partition 2 1.00 MiB
[    2.098715]  mmcblk1: p1 p2
[    2.106001]  mmcblk1boot1: unknown partition table
[    2.113814]  mmcblk1boot0: unknown partition table

It certainly looks like the eMMC is working for you. I'll retest.

Quoted 5 lines

Also, just an fyi to everyone with respect to hdmi output, you must have beagle-capes enabled to allow HDMI output as HDMI is implemented as a cape. Also, for any capes to work patch [1] is required.

[1] https://github.com/fhunleth/buildroot-bbb/blob/bbb/board/beagleboneblack/linux-0001-Add-missing-DTC-flags.patch

Just as an update on this patch, I've since found out that this particular patch does exist in Robert Nelson's kernel patch repo. However, it is specifically not applied to his Debian builds. I'm checking into this. He also doesn't apply a few other patches. One notable one is the am335x power management patch since buildroot has some support for building and loading the power management firmware. I don't know what the story is there, but the buildroot power management package can't be used for the bbb at the moment.

Quoted 10 lines
Quoted 4 lines

Also, and this is just to understand things better, but if you don't want a firmware file copied to the target, wouldn't you just turn it off in the kernel's configuration?

No, by default Buildroot does not install use the firmware_install target. This is for reasons of disk space usage. The kernel, by default, likes to install a lot of firmware. Additionally, there is a linux-firmware package for installing most of this firmware and has much more granular control.

Ugh. I didn't realized that. I understand your patch now. Thanks.

Quoted 9 lines
Quoted 8 lines

Or were you motivated by the shear volume of dtbo files that you get when you turn on Beaglebone cape support? I was thinking that I wanted finer grain configuration in the Linux kernel so that I could select whether or not I wanted "cape-bone-exptest.dtbo" or "cape-bone-adafruit-lcd", etc., but I don't think that's a br problem. Prior to the Beaglebone capes, I had not seen so many firmware files that I didn't need.

Quoted 4 lines

I thought about doing individual capes but the constantly changing nature of these capes would require lots of updates and special cases. However, the size of dtbo's are negligible so I just installed them all.

Sounds good.

Quoted 9 lines
Quoted 6 lines

Thanks,
Frank

p.s. thanks for the opengl work. I have a project coming up in the fall that will need it, so your commits are very timely.

Great to hear. Hopefully, the Beaglebone Black will be a possible target soon.

Quoted 7 lines

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate

--
Frank Hunleth
Troodon Software LLC
http://troodon-software.com/

#5 lore raw

PATCH 2/2 beagle-capes: new package

In reply to Spenser Gilliland

Spenser, All,

On 2013-07-07 18:31 -0500, Spenser Gilliland spake thusly:

Quoted 1 line

installs cape dtbos from the kernel firmware into the target system.

I know it was me suggesting this new package, but in the end, wouldn't this be better handled with a post-build script?

A post-build script would also have all lattitude to decide what exact .dtbo files to copy over, not just everything.

Not saying we should drop this package, but there really are a few options here, and I don't really know what's better.

Quoted 14 lines
---
 package/Config.in                    |  1 +
 package/beagle-capes/Config.in       | 12 ++++++++++++
 package/beagle-capes/beagle-capes.mk | 15 +++++++++++++++
 3 files changed, 28 insertions(+)
 create mode 100644 package/beagle-capes/Config.in
 create mode 100644 package/beagle-capes/beagle-capes.mk
package/Config.in +0 -0
index 4df48ba..3b06f98 100644

package/Config.in source "package/rpi-firmware/Config.in" · line 229

Quoted 4 lines
package/Config.in +1 -0
@@ -226,6 +226,7 @@ source "package/rpi-firmware/Config.in"
 source "package/sunxi-boards/Config.in"
 source "package/ux500-firmware/Config.in"
 source "package/zd1211-firmware/Config.in"
+source "package/beagle-capes/Config.in"

Alphabetical order, please.

Quoted 9 lines
package/Config.in +0 -0
 endmenu
 source "package/freescale-imx/Config.in"
 source "package/acpid/Config.in"
package/beagle-capes/Config.in new file +0 -0
new file mode 100644
index 0000000..568e84f

package/beagle-capes/Config.in line 6

Quoted 6 lines
package/beagle-capes/Config.in new file +6 -0
@@ -0,0 +1,12 @@
+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 firmware from the kernel source.

The comment is mis-leading: the firmware files are not copied from the kernel source tree, but from staging. I would not state where they are copied from, so I'd say something along those lines:

Install BeagleBone capes firmwares.

These firmwares are bundled in the TI fork on the Linux kernel for the BegaleBone, so you'll need to configure Buildroot to use such a kernel.

package/beagle-capes/Config.in line 11

Quoted 4 lines
package/beagle-capes/Config.in new file +4 -0
+	  This package requires that a kernel with beaglebone capes firmware is
+	  selected.
+
+comment "requires the linux kernel"

comment "beagle-capes requires a Linux kernel"

Quoted 12 lines
package/beagle-capes/Config.in new file +1 -0
+	depends on !(BR2_LINUX_KERNEL)
package/beagle-capes/beagle-capes.mk new file +5 -0
new file mode 100644
index 0000000..5b6f121
@@ -0,0 +1,15 @@
+################################################################################
+#
+# beagle-capes 
+#
+################################################################################

package/beagle-capes/beagle-capes.mk line 15

Quoted 10 lines
package/beagle-capes/beagle-capes.mk new file +10 -0
+
+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))

Otherwise, LGTM.

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 2/2 beagle-capes: new package

Yann,

Quoted 2 lines

I know it was me suggesting this new package, but in the end, wouldn't this be better handled with a post-build script?

If it's handled with a post script; then the kconfig option for installing firmware would need to be visible to the user.

Quoted 7 lines

A post-build script would also have all lattitude to decide what exact .dtbo files to copy over, not just everything.

Not saying we should drop this package, but there really are a few options here, and I don't really know what's better.

Alphabetical order, please.

Will fix.

Quoted 9 lines

The comment is mis-leading: the firmware files are not copied from the kernel source tree, but from staging. I would not state where they are copied from, so I'd say something along those lines:

Install BeagleBone capes firmwares.

These firmwares are bundled in the TI fork on the Linux kernel for the BegaleBone, so you'll need to configure Buildroot to use such a kernel.

Will fix.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+comment "requires the linux kernel"

comment "beagle-capes requires a Linux kernel"

Will fix.

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate

#7 lore raw

PATCH 2/2 beagle-capes: new package

Spenser, All,

On 2013-07-09 10:34 -0500, Spenser Gilliland spake thusly:

Quoted 5 lines
Quoted 2 lines

I know it was me suggesting this new package, but in the end, wouldn't this be better handled with a post-build script?

If it's handled with a post script; then the kconfig option for installing firmware would need to be visible to the user.

Indeed, I was just thinking aloud. Disregard my comment, then. ;-)

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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 2/2 beagle-capes: new package

In reply to Spenser Gilliland
Quoted 50 lines · Spenser Gilliland

installs cape dtbos from the kernel firmware into the target system.

---
  package/Config.in                    |  1 +
  package/beagle-capes/Config.in       | 12 ++++++++++++
  package/beagle-capes/beagle-capes.mk | 15 +++++++++++++++
  3 files changed, 28 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..3b06f98 100644
@@ -226,6 +226,7 @@ source "package/rpi-firmware/Config.in"
  source "package/sunxi-boards/Config.in"
  source "package/ux500-firmware/Config.in"
  source "package/zd1211-firmware/Config.in"
+source "package/beagle-capes/Config.in"
  endmenu
  source "package/freescale-imx/Config.in"
  source "package/acpid/Config.in"
package/beagle-capes/Config.in new file +12 -0
new file mode 100644
index 0000000..568e84f
@@ -0,0 +1,12 @@
+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 firmware from the kernel source.
+
+	  This package requires that a kernel with beaglebone capes firmware is
+	  selected.
+
+comment "requires the linux kernel"
+	depends on !(BR2_LINUX_KERNEL)
package/beagle-capes/beagle-capes.mk new file +3 -0
new file mode 100644
index 0000000..5b6f121
@@ -0,0 +1,15 @@
+################################################################################
+#
+# beagle-capes

package/beagle-capes/beagle-capes.mk line 13

Quoted 10 lines
package/beagle-capes/beagle-capes.mk new file +10 -0
+#
+################################################################################
+
+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

Hi Spenser,

We had a discussion at the Buildroot developer meeting, and finally
found a solution which may be better...

Instead of doing the firmware_install from the linux package, you can
do it from the beagle-capes package, i.e.:

define BEAGLE_CAPES_BUILD_CMDS

	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) \
		firmware_install INSTALL_FW_PATH=$(@D)

endef

define BEAGLE_CAPES_INSTALL_TARGET_CMDS

	$(INSTALL) -m 644 $(@D)/*.dtbo $(TARGET_DIR)/lib/firmware/

endef

We don't expect that this 'install firmware to staging' feature would
ever be used by any other package, that's why we prefer not to have it in the linux.mk.

By the way, this will only work for a beaglebone-specific kernel, of
course. Is there any way to check for that and error out with a clear error message?

Regards,
Arnout

Quoted 3 lines
package/beagle-capes/beagle-capes.mk new file +2 -0
+
+$(eval $(generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#9 lore raw

PATCH 2/2 beagle-capes: new package

Hi Arnout,

Quoted 11 lines

We had a discussion at the Buildroot developer meeting, and finally
found a solution which may be better...

Instead of doing the firmware_install from the linux package, you can
do it from the beagle-capes package, i.e.:

define BEAGLE_CAPES_BUILD_CMDS

        $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) \
                firmware_install INSTALL_FW_PATH=$(@D)

endef

Quoted 8 lines

define BEAGLE_CAPES_INSTALL_TARGET_CMDS

        $(INSTALL) -m 644 $(@D)/*.dtbo $(TARGET_DIR)/lib/firmware/

endef

We don't expect that this 'install firmware to staging' feature would
ever be used by any other package, that's why we prefer not to have it in the linux.mk.

I agree. I'll create a new patch and resubmit.

Quoted 4 lines

By the way, this will only work for a beaglebone-specific kernel, of
course. Is there any way to check for that and error out with a clear error message?

We can check if any dts files exist in the firmware dir of the kernel.
I'll write up a patch.

Thanks,
Spenser

Signature · 3 lines
Spenser Gilliland
Computer Engineer
Doctoral Candidate
#10 lore raw

PATCH 1/2 linux: install firmware to staging.

In reply to Spenser Gilliland

On 2013-07-07 18:31 -0500, Spenser Gilliland spake thusly:

Quoted 15 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.

---
 linux/Config.in |  5 +++++
 linux/linux.mk  | 13 +++++++++++++
 2 files changed, 18 insertions(+)
linux/Config.in +0 -0
index f58e714..b733019 100644

linux/Config.in config BR2_LINUX_KERNEL_INSTALL_TARGET · line 302

Quoted 6 lines
linux/Config.in +3 -0
@@ -297,6 +297,11 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
 	  /boot in the target root filesystem, as is typically done on
 	  x86/x86_64 systems.
 
+# This option is used to install firmware to staging. Other packages such as
+# beagle-capes then install the firmware into the target. This avoids
+# installing all linux firmware.

I would also states that this applies to special firmware files that are *not* distributed with the linux-firmware package. All 'standard' firmwares should be installed via linux-firmware. This knob is for very special cases such as the BBB capes. Waht about:

# This option can be selected by other packages that require special

# firmwares bundled in some fiorks of the Linux kernell (eg. the BBB
# capes firmwares (.dtbo) as distributed in the TI Linux kernel fork).
# To install other firmwares, please use the linux-firmware package.
Quoted 26 lines
linux/Config.in +2 -0
+config BR2_LINUX_KERNEL_INSTALL_FIRMWARE
+	bool
 
 # Linux extensions
 source "linux/Config.ext.in"
linux/linux.mk +9 -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

linux/linux.mk define LINUX_INSTALL_IMAGES_CMDS · line 287

Quoted 10 lines
linux/linux.mk +4 -0
@@ -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)

Otherwise, LGTM.

Peter, Thomas, what do you thiink of this scheme? Should we puruse this series, or do you have a better idea?

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.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

PATCH 1/2 linux: install firmware to staging.

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

linux/Config.in config BR2_LINUX_KERNEL_INSTALL_TARGET · line 302

Quoted 3 lines
linux/Config.in +3 -0
+# This option is used to install firmware to staging. Other packages such as
+# beagle-capes then install the firmware into the target. This avoids
+# installing all linux firmware.

I would also states that this applies to special firmware files that are *not* distributed with the linux-firmware package. All 'standard' firmwares should be installed via linux-firmware. This knob is for very special cases such as the BBB capes. Waht about:

Quoted 4 lines

# This option can be selected by other packages that require special

# firmwares bundled in some fiorks of the Linux kernell (eg. the BBB
# capes firmwares (.dtbo) as distributed in the TI Linux kernel fork).
# To install other firmwares, please use the linux-firmware package.

The thing that worries me here is that this .dtbo thing for capes is custom to the BBB kernel, and as far as I know, not in the upstream kernel. So it annoys me a bit to have this within the linux/linux.mk logic, because if we started to add vendor-specific logic in this generic kernel .mk file, where are we going to end?

In order to have a better understanding of the problem, could someone summarize how things work with those .dtbo? Where are they located source wise, how they are built, where they should be installed, how/when they are loaded/used in the system, etc.

Thanks,

Thomas

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

PATCH 1/2 linux: install firmware to staging.

Dear Thomas,

Quoted 10 lines
Quoted 4 lines

# This option can be selected by other packages that require special

# firmwares bundled in some fiorks of the Linux kernell (eg. the BBB
# capes firmwares (.dtbo) as distributed in the TI Linux kernel fork).
# To install other firmwares, please use the linux-firmware package.

The thing that worries me here is that this .dtbo thing for capes is custom to the BBB kernel, and as far as I know, not in the upstream kernel. So it annoys me a bit to have this within the linux/linux.mk logic, because if we started to add vendor-specific logic in this generic kernel .mk file, where are we going to end?

This should be the only change required to support any in-kernel firmware. It's very vendor agnostic and can be useful for more than just beagle-capes. This also establishes precedent for how to handle non-mainlined in-kernel firmware.

Quoted 4 lines

In order to have a better understanding of the problem, could someone summarize how things work with those .dtbo? Where are they located source wise, how they are built, where they should be installed, how/when they are loaded/used in the system, etc.

The .dtbo are device tree overlay files, the device tree sources from which they are made are located in <kernel>/firmware/capes. They are built using the device tree compiler (dtc). They should be installed in /lib/firmware and are used by the in-kernel capebus manager on boot to add support for the capes. The kernel installs these dtbo when the firmware_install target is built.

In the kernel, the capebus manager uses eeproms to determine which capes are installed on the target and installs the needed dtbo for the cape. This creates the needed platform devices in the kernel.

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate