Patchwork [2/2] beagle-capes: new package

login
register
mail settings
Submitter Spenser Gilliland
Date July 7, 2013, 11:31 p.m.
Message ID <1373239866-18076-2-git-send-email-spenser@gillilanding.com>
Download mbox | patch
Permalink /patch/257444/
State Superseded
Headers show

Comments

Spenser Gilliland - July 7, 2013, 11:31 p.m.
installs cape dtbos from the kernel firmware into the target system.

Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
---
 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
Frank Hunleth - July 8, 2013, 12:43 a.m.
Hi Spenser,

On Sun, Jul 7, 2013 at 7:31 PM, Spenser Gilliland
<spenser@gillilanding.com> wrote:
> 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.

> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> ---
>  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
>
> diff --git a/package/Config.in b/package/Config.in
> index 4df48ba..3b06f98 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/beagle-capes/Config.in b/package/beagle-capes/Config.in
> new file mode 100644
> index 0000000..568e84f
> --- /dev/null
> +++ b/package/beagle-capes/Config.in
> @@ -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)
> diff --git a/package/beagle-capes/beagle-capes.mk b/package/beagle-capes/beagle-capes.mk
> new file mode 100644
> index 0000000..5b6f121
> --- /dev/null
> +++ b/package/beagle-capes/beagle-capes.mk
> @@ -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@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Spenser Gilliland - July 8, 2013, 3:08 a.m.
Hi Frank,

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


> 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

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

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

> 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
Frank Hunleth - July 8, 2013, 1:02 p.m.
Hi Spenser,

On Sun, Jul 7, 2013 at 11:08 PM, Spenser Gilliland
<spenser@gillilanding.com> wrote:
> Hi Frank,
>
> Your buildroot-bbb repo has been a great reference that helped me get
> this all up and running.
>
>
>> 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.

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.

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

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

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

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

Sounds good.

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



--
Frank Hunleth
Troodon Software LLC
http://troodon-software.com/
Yann E. MORIN - July 8, 2013, 5:47 p.m.
Spenser, All,

On 2013-07-07 18:31 -0500, Spenser Gilliland spake thusly:
> 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.

> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> ---
>  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
> 
> diff --git a/package/Config.in b/package/Config.in
> index 4df48ba..3b06f98 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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.

>  endmenu
>  source "package/freescale-imx/Config.in"
>  source "package/acpid/Config.in"
> diff --git a/package/beagle-capes/Config.in b/package/beagle-capes/Config.in
> new file mode 100644
> index 0000000..568e84f
> --- /dev/null
> +++ b/package/beagle-capes/Config.in
> @@ -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.

> +	  This package requires that a kernel with beaglebone capes firmware is
> +	  selected.
> +
> +comment "requires the linux kernel"

comment "beagle-capes requires a Linux kernel"

> +	depends on !(BR2_LINUX_KERNEL)
> diff --git a/package/beagle-capes/beagle-capes.mk b/package/beagle-capes/beagle-capes.mk
> new file mode 100644
> index 0000000..5b6f121
> --- /dev/null
> +++ b/package/beagle-capes/beagle-capes.mk
> @@ -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))

Otherwise, LGTM.

Regards,
Yann E. MORIN.
Spenser Gilliland - July 9, 2013, 3:34 p.m.
Yann,

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

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

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

>> +
>> +comment "requires the linux kernel"
>
> comment "beagle-capes requires a Linux kernel"

Will fix.

Thanks,
Spenser


--
Spenser Gilliland
Computer Engineer
Doctoral Candidate
Yann E. MORIN - July 9, 2013, 4:07 p.m.
Spenser, All,

On 2013-07-09 10:34 -0500, Spenser Gilliland spake thusly:
> > 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.
Arnout Vandecappelle - Oct. 27, 2013, 11:22 a.m.
On 08/07/13 01:31, Spenser Gilliland wrote:
> installs cape dtbos from the kernel firmware into the target system.
> 
> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> ---
>   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
> 
> diff --git a/package/Config.in b/package/Config.in
> index 4df48ba..3b06f98 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/beagle-capes/Config.in b/package/beagle-capes/Config.in
> new file mode 100644
> index 0000000..568e84f
> --- /dev/null
> +++ b/package/beagle-capes/Config.in
> @@ -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)
> diff --git a/package/beagle-capes/beagle-capes.mk b/package/beagle-capes/beagle-capes.mk
> new file mode 100644
> index 0000000..5b6f121
> --- /dev/null
> +++ b/package/beagle-capes/beagle-capes.mk
> @@ -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

 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

> +
> +$(eval $(generic-package))
>
Spenser Gilliland - Oct. 27, 2013, 8:43 p.m.
Hi Arnout,

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

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

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

Patch

diff --git a/package/Config.in b/package/Config.in
index 4df48ba..3b06f98 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/beagle-capes/Config.in b/package/beagle-capes/Config.in
new file mode 100644
index 0000000..568e84f
--- /dev/null
+++ b/package/beagle-capes/Config.in
@@ -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)
diff --git a/package/beagle-capes/beagle-capes.mk b/package/beagle-capes/beagle-capes.mk
new file mode 100644
index 0000000..5b6f121
--- /dev/null
+++ b/package/beagle-capes/beagle-capes.mk
@@ -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))