LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Building linux-firmware package with Pat's slackbuild script (https://www.linuxquestions.org/questions/slackware-14/building-linux-firmware-package-with-pats-slackbuild-script-905393/)

Phorize 09-28-2011 05:28 AM

Building linux-firmware package with Pat's slackbuild script
 
Hi All. I am running a custom 3.0.4 kernel and would like to add the latest binary blobs to enable my rtl8192se card to work. I can do this by dumping the binaries in the /lib/firmware directory, but would prefer to create a proper package using the latest firmware package from the kernel.org git repo (or at least the last one that got mirrored before the kernel.org got taken down).

This is the slackbuild from current:

Code:

#!/bin/sh

# Copyright 2008, 2009  Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-kernel-firmware

VERSION=${VERSION:-2.6.38.7}
ARCH=${ARCH:-noarch}
BUILD=${BUILD:-1}

rm -rf $PKG
mkdir -p $TMP $PKG
echo "Using /usr/src/linux-2.6.38.7/"
echo "Make sure this is *ready*..."
mkdir -p $PKG/lib/firmware
( cd /usr/src/linux-2.6.38.7 && make firmware_install INSTALL_FW_PATH=$PKG/lib/firmware )
cp -a /usr/src/linux-2.6.38.7/firmware/WHENCE $PKG/lib/firmware

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $TMP/kernel-firmware-${VERSION}-noarch-$BUILD.txz

Obviously I will need to change the script to go to /usr/src/linux-3.0.4 but this doesn't include the binary blobs which are packaged separately. I propose to unpack the latest firmware into the /usr/src/linux-3.0.4/firmware and then run the script before doing upgradepkg kernel-firmware-3.0.4. I just wanted to check that this made sense before doing it! Incidentally, /usr/src/linux-3.0.4/firmware/README.AddingFirmware discusses adding firmware but advises against adding arbitrary firmware to the /lib/firmware directory-I am working on the assumption that this is intended for kernel developers and does not have implications for end users.

Thoughts appreciated.

andrewthomas 09-28-2011 05:43 AM

I think that you would be safe to just install the package from -current

Thu Aug 25 09:10:45 UTC 2011
a/kernel-firmware-20110814git-noarch-1.txz: Upgraded.
Fetch the latest kernel firmware from git -- the stuff in the kernel sources
is somewhat stale.

ftp://ftp.osuosl.org/pub/slackware/s...t-noarch-1.txz

Phorize 09-28-2011 11:55 AM

Quote:

Originally Posted by andrewthomas (Post 4484291)
I think that you would be safe to just install the package from -current

Thu Aug 25 09:10:45 UTC 2011
a/kernel-firmware-20110814git-noarch-1.txz: Upgraded.
Fetch the latest kernel firmware from git -- the stuff in the kernel sources
is somewhat stale.

ftp://ftp.osuosl.org/pub/slackware/s...t-noarch-1.txz

Thanks for your reply. I unpacked the package in current and it doesn't include the firmware for my card-the rt8192se is only supported from 3.0 onwards. I am going to need to either build the package myself or just dump the binaries in manually. I would prefer to build a package because it is "nicer". That said, I don't know how the firmware finds its way into the package usually. Is this just a matter or patching the source with the firmware package from git and then running the slackbuild from /?

Phorize 09-28-2011 12:42 PM

Ok, so I have merged the latest firmware into the /usr/src/linux-3.0.4/firmware, removed the 2.6.27.6 firmware package, ran the kernel-firmware.Slackbuild script and installed the resultant package. I have examined the package, it it seems that although make has run recursively into some of the directories in /usr/src/linux-3.0.4 firmware, it hasn't done all of them, including rtlwifi, which is the one that I want!

Any thoughts on what amendments I can make to the script to ensure that all of the firmware is packaged-I have a newbie hunch that make can't deal with the binary blobs, for obvious reasons. Any comments on this being the case are particularly welcomed!

andrewthomas 09-28-2011 01:33 PM

I took this firmware package

ftp.osuosl.org/pub/gentoo/distfiles/linux-firmware-20110818.tar.bz2

and built this kernel-firmware package with it

http://dl.dropbox.com/u/27872107/ker...t-noarch-1.txz

it has does contain the firmware that you want.


Code:

linux-firmware-20110818/rtlwifi/
[lxde@slack-asus rtlwifi]$ ls -al
total 280
drwxr-xr-x  2 lxde lxde  4096 Sep 28 13:19 .
drwxr-xr-x 54 lxde lxde  4096 Sep 28 13:19 ..
-rw-r--r--  1 lxde lxde  13540 Aug 17 10:55 rtl8192cfw.bin
-rw-r--r--  1 lxde lxde  16014 Aug 17 10:55 rtl8192cufw.bin
-rw-r--r--  1 lxde lxde  20526 Aug 17 10:55 rtl8192defw.bin
-rw-r--r--  1 lxde lxde  88856 Aug 17 10:55 rtl8192sefw.bin
-rw-r--r--  1 lxde lxde 129304 Aug 17 10:55 rtl8712u.bin


Phorize 09-28-2011 02:00 PM

Quote:

Originally Posted by andrewthomas (Post 4484659)
I took this firmware package

ftp.osuosl.org/pub/gentoo/distfiles/linux-firmware-20110818.tar.bz2

and built this kernel-firmware package with it

http://dl.dropbox.com/u/27872107/ker...t-noarch-1.txz

it has does contain the firmware that you want.


Code:

linux-firmware-20110818/rtlwifi/
[lxde@slack-asus rtlwifi]$ ls -al
total 280
drwxr-xr-x  2 lxde lxde  4096 Sep 28 13:19 .
drwxr-xr-x 54 lxde lxde  4096 Sep 28 13:19 ..
-rw-r--r--  1 lxde lxde  13540 Aug 17 10:55 rtl8192cfw.bin
-rw-r--r--  1 lxde lxde  16014 Aug 17 10:55 rtl8192cufw.bin
-rw-r--r--  1 lxde lxde  20526 Aug 17 10:55 rtl8192defw.bin
-rw-r--r--  1 lxde lxde  88856 Aug 17 10:55 rtl8192sefw.bin
-rw-r--r--  1 lxde lxde 129304 Aug 17 10:55 rtl8712u.bin


Thank you for replying and sharing your pkg. I would like to build my own. Can you tell me how you build yours. The only ways I know are to use a slackbuild or setting make install targets to a build directory where I can run makepkg. As the git package doesn't have a makefile, how do you configure your package to install to the correct directories?

andrewthomas 09-28-2011 02:37 PM

I just downloaded the firmware file from:

http://ftp.osuosl.org/pub/gentoo/dis...110818.tar.bz2

and put it in a directory with the slackbuild and a slack-desc file.


Here is the slackbuild that I made for it.

Code:

#!/bin/sh

# Copyright 2011  Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


PKGNAM=kernel-firmware
VERSION=${VERSION:-$(date +%Y%m%d)git}
ARCH=noarch
BUILD=${BUILD:-1}

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM

rm -rf $PKG
mkdir -p $TMP $PKG

cd $PKG
tar xvf $CWD/linux-firmware-20110818.tar.bz2
chown -R root:root .
mkdir -p lib
mv linux-firmware-20110818 lib/firmware

# Install documentation link:
mkdir -p $PKG/usr/doc
( cd $PKG/usr/doc
  ln -sf /lib/firmware kernel-firmware-$VERSION
)

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz


Phorize 10-05-2011 02:47 AM

Quote:

Originally Posted by andrewthomas (Post 4484692)
I just downloaded the firmware file from:

http://ftp.osuosl.org/pub/gentoo/dis...110818.tar.bz2

and put it in a directory with the slackbuild and a slack-desc file.


Here is the slackbuild that I made for it.

Code:

#!/bin/sh

# Copyright 2011  Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


PKGNAM=kernel-firmware
VERSION=${VERSION:-$(date +%Y%m%d)git}
ARCH=noarch
BUILD=${BUILD:-1}

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM

rm -rf $PKG
mkdir -p $TMP $PKG

cd $PKG
tar xvf $CWD/linux-firmware-20110818.tar.bz2
chown -R root:root .
mkdir -p lib
mv linux-firmware-20110818 lib/firmware

# Install documentation link:
mkdir -p $PKG/usr/doc
( cd $PKG/usr/doc
  ln -sf /lib/firmware kernel-firmware-$VERSION
)

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz


All sorted, thanks for the help!

andrewthomas 10-05-2011 05:54 AM

You're welcome.

Glad to be of help.


All times are GMT -5. The time now is 02:02 AM.