Patchwork [17/30] linux-firware: use ${base_libdir} instead of /lib for packaging

login
register
mail settings
Submitter Javier Martinez Canillas
Date Aug. 5, 2012, 3:54 p.m.
Message ID <1344182057-15981-18-git-send-email-javier@dowhile0.org>
Download mbox | patch
Permalink /patch/33871/
State New
Headers show

Comments

Javier Martinez Canillas - Aug. 5, 2012, 3:54 p.m.
It is considered good practice to use the build system provided
variables instead of directly specify hardcoded paths.

Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
 .../linux-firmware/linux-firmware_git.bb           |   34 ++++++++++----------
 1 files changed, 17 insertions(+), 17 deletions(-)
Darren Hart - Aug. 6, 2012, 6:10 p.m.
On 08/05/2012 08:54 AM, Javier Martinez Canillas wrote:
> It is considered good practice to use the build system provided
> variables instead of directly specify hardcoded paths.

The firmware location is explicitly set because this is where the Linux
kernel requires it to be. This patch will break firmware loading.

--
Darren

> Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
> ---
>  .../linux-firmware/linux-firmware_git.bb           |   34 ++++++++++----------
>  1 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb b/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
> index a7e4ed6..c5ab173 100644
> --- a/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
> +++ b/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
> @@ -35,50 +35,50 @@ do_compile() {
>  }
>  
>  do_install() {
> -	install -d  ${D}/lib/firmware/
> -	cp -r * ${D}/lib/firmware/
> +	install -d  ${D}${base_libdir}/firmware/
> +	cp -r * ${D}${base_libdir}/firmware/
>  
>  	# Libertas sd8686
> -	ln -sf libertas/sd8686_v9.bin ${D}/lib/firmware/sd8686.bin
> -	ln -sf libertas/sd8686_v9_helper.bin ${D}/lib/firmware/sd8686_helper.bin
> +	ln -sf libertas/sd8686_v9.bin ${D}${base_libdir}/firmware/sd8686.bin
> +	ln -sf libertas/sd8686_v9_helper.bin ${D}${base_libdir}/firmware/sd8686_helper.bin
>  
>  	# Realtek rtl8192* 
> -	install -m 0644 LICENCE.rtlwifi_firmware.txt ${D}/lib/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt
> +	install -m 0644 LICENCE.rtlwifi_firmware.txt ${D}${base_libdir}/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt
>  
>  	# fixup wl12xx location, after 2.6.37 the kernel searches a different location for it
> -	( cd ${D}/lib/firmware ; ln -sf ti-connectivity/* . )
> +	( cd ${D}${base_libdir}/firmware ; ln -sf ti-connectivity/* . )
>  }
>  
>  PACKAGES =+ "${PN}-sd8686 ${PN}-rtl8192cu linux-firmware-rtl8192ce linux-firmware-rtl8192su ${PN}-wl12xx"
>  
>  LICENSE_${PN}-sd8686 = "Firmware:LICENSE.libertas"
>  FILES_${PN}-sd8686 = " \
> -  /lib/firmware/libertas/sd8686_v9* \
> -  /lib/firmware/sd8686* \
> -  /lib/firmware/LICENCE.libertas \
> +  ${base_libdir}/firmware/libertas/sd8686_v9* \
> +  ${base_libdir}/firmware/sd8686* \
> +  ${base_libdir}/firmware/LICENCE.libertas \
>  "
>  
>  LICENSE_${PN}-rtl8192cu = "Firmware:LICENCE.rtlwifi_firmware"
>  FILES_${PN}-rtl8192cu = " \
> -  /lib/firmware/rtlwifi/rtl8192cufw.bin \
> -  /lib/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt \
> +  ${base_libdir}/firmware/rtlwifi/rtl8192cufw.bin \
> +  ${base_libdir}/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt \
>  "
>  
>  LICENSE_${PN}-rtl8192ce = "Firmware:LICENCE.rtlwifi_firmware"
>  FILES_${PN}-rtl8192ce = " \
> -  /lib/firmware/rtlwifi/rtl8192cfw.bin \
> +  ${base_libdir}/firmware/rtlwifi/rtl8192cfw.bin \
>  "
>  
>  LICENSE_${PN}-rtl8192su = "Firmware:LICENCE.rtlwifi_firmware"
>  FILES_${PN}-rtl8192su = " \
> -  /lib/firmware/rtlwifi/rtl8712u.bin \
> +  ${base_libdir}/firmware/rtlwifi/rtl8712u.bin \
>  "
>  
>  FILES_${PN}-wl12xx = " \
> -  /lib/firmware/wl12* \
> -  /lib/firmware/TI* \
> -  /lib/firmware/ti-connectivity \
> +  ${base_libdir}/firmware/wl12* \
> +  ${base_libdir}/firmware/TI* \
> +  ${base_libdir}/firmware/ti-connectivity \
>  "
>  
> -FILES_${PN} += "/lib/firmware/*"
> +FILES_${PN} += "${base_libdir}/firmware/*"
>  
>
Phil Blundell - Aug. 6, 2012, 6:21 p.m.
On Mon, 2012-08-06 at 11:10 -0700, Darren Hart wrote:
> On 08/05/2012 08:54 AM, Javier Martinez Canillas wrote:
> > It is considered good practice to use the build system provided
> > variables instead of directly specify hardcoded paths.
> 
> The firmware location is explicitly set because this is where the Linux
> kernel requires it to be. 

Is that actually true?  I thought the kernel just supplied the leafname
that it wanted and the knowledge about what directory to search was
encoded in the hotplug helper scripts.

> This patch will break firmware loading.

That might well be the case, though, unless the scripts have also been
patched to respect ${base_libdir}.  

And, notwithstanding all the above, it's not entirely obvious that
${base_libdir} is semantically the right variable for things that aren't
libraries.  How does the udev recipe represent the patch to /lib/udev?

p.
Darren Hart - Aug. 7, 2012, 4:14 p.m.
On 08/06/2012 11:21 AM, Phil Blundell wrote:
> On Mon, 2012-08-06 at 11:10 -0700, Darren Hart wrote:
>> On 08/05/2012 08:54 AM, Javier Martinez Canillas wrote:
>>> It is considered good practice to use the build system provided
>>> variables instead of directly specify hardcoded paths.
>>
>> The firmware location is explicitly set because this is where the Linux
>> kernel requires it to be. 
> 
> Is that actually true?  I thought the kernel just supplied the leafname
> that it wanted and the knowledge about what directory to search was
> encoded in the hotplug helper scripts.

I was sure it was true at the time, but trying to get a reference from
the source suggests I was mistaken. According to
Documentation/firmware_class/README, the hotplug script is responsible
for locating the firmware by basename and catting it to a sysfs file for
the kernel to then read.

While there are several hardcoded references to "/lib/firmware"
(comments, installation of in-kernel firmware, etc.), none of these seem
to be related to loading firmware installed via linux-firmware.

So... the question I guess is: does hotplug know to look in
${base_libdir}/firmware.

But the larger concern, is that all these changes appear to have been
done via search/replace without any functional testing of the result.

--
Darren

> 
>> This patch will break firmware loading.
> 
> That might well be the case, though, unless the scripts have also been
> patched to respect ${base_libdir}.  
> 
> And, notwithstanding all the above, it's not entirely obvious that
> ${base_libdir} is semantically the right variable for things that aren't
> libraries.  How does the udev recipe represent the patch to /lib/udev?
> 
> p.
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Koen Kooi - Aug. 7, 2012, 6:29 p.m.
Op 7 aug. 2012, om 18:14 heeft Darren Hart <dvhart@linux.intel.com> het volgende geschreven:

> 
> 
> On 08/06/2012 11:21 AM, Phil Blundell wrote:
>> On Mon, 2012-08-06 at 11:10 -0700, Darren Hart wrote:
>>> On 08/05/2012 08:54 AM, Javier Martinez Canillas wrote:
>>>> It is considered good practice to use the build system provided
>>>> variables instead of directly specify hardcoded paths.
>>> 
>>> The firmware location is explicitly set because this is where the Linux
>>> kernel requires it to be. 
>> 
>> Is that actually true?  I thought the kernel just supplied the leafname
>> that it wanted and the knowledge about what directory to search was
>> encoded in the hotplug helper scripts.
> 
> I was sure it was true at the time, but trying to get a reference from
> the source suggests I was mistaken. According to
> Documentation/firmware_class/README, the hotplug script is responsible
> for locating the firmware by basename and catting it to a sysfs file for
> the kernel to then read.

That hasn't been the case for a long, long time. CONFIG_HOTPLUG should be "", the kernel can load it on its own now. Any reference to 'hotplug' as something executable is very outdated.

regards,

Koen

Patch

diff --git a/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb b/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
index a7e4ed6..c5ab173 100644
--- a/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
+++ b/meta/recipes-kernel/linux-firmware/linux-firmware_git.bb
@@ -35,50 +35,50 @@  do_compile() {
 }
 
 do_install() {
-	install -d  ${D}/lib/firmware/
-	cp -r * ${D}/lib/firmware/
+	install -d  ${D}${base_libdir}/firmware/
+	cp -r * ${D}${base_libdir}/firmware/
 
 	# Libertas sd8686
-	ln -sf libertas/sd8686_v9.bin ${D}/lib/firmware/sd8686.bin
-	ln -sf libertas/sd8686_v9_helper.bin ${D}/lib/firmware/sd8686_helper.bin
+	ln -sf libertas/sd8686_v9.bin ${D}${base_libdir}/firmware/sd8686.bin
+	ln -sf libertas/sd8686_v9_helper.bin ${D}${base_libdir}/firmware/sd8686_helper.bin
 
 	# Realtek rtl8192* 
-	install -m 0644 LICENCE.rtlwifi_firmware.txt ${D}/lib/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt
+	install -m 0644 LICENCE.rtlwifi_firmware.txt ${D}${base_libdir}/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt
 
 	# fixup wl12xx location, after 2.6.37 the kernel searches a different location for it
-	( cd ${D}/lib/firmware ; ln -sf ti-connectivity/* . )
+	( cd ${D}${base_libdir}/firmware ; ln -sf ti-connectivity/* . )
 }
 
 PACKAGES =+ "${PN}-sd8686 ${PN}-rtl8192cu linux-firmware-rtl8192ce linux-firmware-rtl8192su ${PN}-wl12xx"
 
 LICENSE_${PN}-sd8686 = "Firmware:LICENSE.libertas"
 FILES_${PN}-sd8686 = " \
-  /lib/firmware/libertas/sd8686_v9* \
-  /lib/firmware/sd8686* \
-  /lib/firmware/LICENCE.libertas \
+  ${base_libdir}/firmware/libertas/sd8686_v9* \
+  ${base_libdir}/firmware/sd8686* \
+  ${base_libdir}/firmware/LICENCE.libertas \
 "
 
 LICENSE_${PN}-rtl8192cu = "Firmware:LICENCE.rtlwifi_firmware"
 FILES_${PN}-rtl8192cu = " \
-  /lib/firmware/rtlwifi/rtl8192cufw.bin \
-  /lib/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt \
+  ${base_libdir}/firmware/rtlwifi/rtl8192cufw.bin \
+  ${base_libdir}/firmware/rtlwifi/LICENCE.rtlwifi_firmware.txt \
 "
 
 LICENSE_${PN}-rtl8192ce = "Firmware:LICENCE.rtlwifi_firmware"
 FILES_${PN}-rtl8192ce = " \
-  /lib/firmware/rtlwifi/rtl8192cfw.bin \
+  ${base_libdir}/firmware/rtlwifi/rtl8192cfw.bin \
 "
 
 LICENSE_${PN}-rtl8192su = "Firmware:LICENCE.rtlwifi_firmware"
 FILES_${PN}-rtl8192su = " \
-  /lib/firmware/rtlwifi/rtl8712u.bin \
+  ${base_libdir}/firmware/rtlwifi/rtl8712u.bin \
 "
 
 FILES_${PN}-wl12xx = " \
-  /lib/firmware/wl12* \
-  /lib/firmware/TI* \
-  /lib/firmware/ti-connectivity \
+  ${base_libdir}/firmware/wl12* \
+  ${base_libdir}/firmware/TI* \
+  ${base_libdir}/firmware/ti-connectivity \
 "
 
-FILES_${PN} += "/lib/firmware/*"
+FILES_${PN} += "${base_libdir}/firmware/*"