[SOLVED] Building linux-firmware package with Pat's slackbuild script
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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 /?
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!
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?
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.