make firmware_install on kernel linux-4.14.34

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
fabbrocino
Ronin
Ronin
Posts: 3
Joined: 16 Oct 2017, 15:00
Distribution: Porteus-v3.1

make firmware_install on kernel linux-4.14.34

Post#1 by fabbrocino » 14 Apr 2018, 15:19

Hi to everyone, a question:
I have download from kernel.org the linux kernel 4.14.34 and I'have execute the "make && make modules_install && make firmware_install".
But I have problem with "make firmware_install" because the section "firmware_install" not is present in Makefile :unknown:
Why? How can I solve the problem? :worthy:

beny
Full of knowledge
Full of knowledge
Posts: 2083
Joined: 02 Jan 2011, 11:33
Location: italy

make firmware_install on kernel linux-4.14.34

Post#2 by beny » 14 Apr 2018, 20:00

if you clone the firmware on the kernel.org maybe you have all the firmware, is too huge 460 mb,but you can strip it i think, neko san can answer you better than me,make a lot of kernel version so firmware version too.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

make firmware_install on kernel linux-4.14.34

Post#3 by brokenman » 14 Apr 2018, 23:49

Firmware was removed from the kernel source and is now handled by the distro packages. You can get all the firmware in the kernel-firmware slackware package.
http://packages.slackware.com
How do i become super user?
Wear your underpants on the outside and put on a cape.

neko
DEV Team
DEV Team
Posts: 2107
Joined: 09 Feb 2013, 09:55
Distribution: APorteus-FVWM-ja-x86_64.iso
Location: japan

make firmware_install on kernel linux-4.14.34

Post#4 by neko » 15 Apr 2018, 00:45

@fabbrocino
I studied the method to get firmware from firmware package that was presented by brokenman. (@brokenman, Thanks)

There are 2 steps.
1st step: (getFWlist)
getting the firmware list that is needed by the kernel.
2nd step: (getFW)
getting the firmware from firmware package depending on the firmware list.


I made 2 scripts.
shell script "getFWlist"
# getFWlist PATH/lib
argument PATH/lib is the directory that includes kernel module "PATH/lib/modules/*/modules.dep".

Code: Select all

#!/bin/sh
#
# get firmware list from kernel modules (.ko) depend list.
#
# getFWlist PATH/lib
#
# PATH/lib/modules/*/modules.dep
# *:kernel version name. ex: 4.15.0-rc1-porteus
#
# [OUTPUT: ./FW.list]
# KO=with-relative-path.ko
# firmware-name-with-relative-path
# firmware-name-with-relative-path
# ...
# firmware-name-with-relative-path
# KO=with-relative-path.ko
# ...
#
#==== argument check ====#
if [ $# -ne 1 ]
then
	echo "argumet error (not only one)" >/dev/stderr
	exit 1
fi
BLIB=${1%/}
BLIB=${BLIB##*/}
if [ "$BLIB" != "lib" ]
then
	echo "argumet error (not .../lib or ..../lib/)" >/dev/stderr
	exit 1
fi
MODDEP=`/bin/ls $1/modules/*/modules.dep`
if [ -z "$MODDEP" ]
then
	echo "argumet error (not include modules/*/modules.dep)" >/dev/stderr
	exit 1
fi

#==== get firmare list ====#
SOPATH=${MODDEP%/modules.dep}
WORK=getFMlist$$
mkdir $WORK
for i in `cat $MODDEP | cut -d':' -f1 | sort -u`
do
	modinfo -F firmware $SOPATH/$i | sort -u > $WORK/FW
	FW=`cat $WORK/FW`	
	if [ -z "$FW" ]
	then
		continue
	fi
	echo "====$i"
	echo "====$i" >> $WORK/FW.list
	cat $WORK/FW >> $WORK/FW.list
done
if [ -f FW.list ]
then
	rm -f old.FW.list
	mv FW.list old.FW.list
fi
mv $WORK/FW.list .
rm -fr $WORK
exit 0

shell script "getFW"
# getFW FW-list PATH/lib
1st argument FW-list is the result output of "getFWlist"
2nd argument is the directory that include "PATH/lib/firmware" directory which has full set firmware.
It could be gotten from slackware/arcklinux package.

Code: Select all

#!/bin/sh
#
# pick up firmwares of FW-list from PATH/lib directory
# and set these into the firmware directory.
#
# getFW FW-list PATH/lib
#
# PATH/lib/firmware
#
# [FW-list]
# KO=with-relative-path.ko
# firmware-name-with-relative-path
# firmware-name-with-relative-path
# ...
# firmware-name-with-relative-path
# KO=with-relative-path.ko
# ...
#
# [OUTPUT directory]
# firmware
# repo_getFW$$
#

#==== argument check ====#
if [ $# -ne 2 ]
then
	echo "argumet error (not FM-list PATH/lib)" >/dev/stderr
	exit 1
fi
FWS=${2%/}
BLIB=${FWS##*/}
if [ "$BLIB" != "lib" ]
then
	echo "2nd argumet error (not .../lib or ..../lib/)" >/dev/stderr
	exit 1
fi
if [ ! -d $2/firmware ]
then
	echo "2nd argumet error (not include firmware directory)" >/dev/stderr
	exit 1
fi
#==== function [copydirect] ====#
copydirect()
{
local RELATIVE=firmware/$2
RELATIVE=${RELATIVE%/*}

mkdir -p $RELATIVE
cp -a $1/firmware/$2 $RELATIVE/
}
#==== function [copysymlink] ====#
copysymlink()
{
local HPT=`readlink -f $1`
#local HPT=$(cd $1 && pwd) #NG: because use symbolic name ## 
local SYMORG=`readlink -f $HPT/firmware/$2`
local SYMPT=${SYMORG%/*}
local SYMRELATIVE=${SYMPT#$HPT/}

mkdir -p $SYMRELATIVE
cp -a $SYMORG $SYMRELATIVE/
}
#==== get firmare ====#
WORK=repo_getFW$$
mkdir $WORK
if [ -e firmware ]
then
	rm -fr old.firmware
	mv firmware old.firmware
fi
mkdir firmware
for i in `cat $1` "====AtEnd"
do
	if [ ${i:0:4} = "====" ]
	then
		if [ -f $WORK/ko ]
		then
		#==== at end ====#
			cat $WORK/ko >> $WORK/all
			if [ -f $WORK/find ]
			then
				cat $WORK/ko >> $WORK/findS
				cat $WORK/find >> $WORK/findS
				cat $WORK/find >> $WORK/all
			fi
			if [ -f $WORK/link ]
			then
				cat $WORK/ko >> $WORK/linkS
				cat $WORK/link >> $WORK/linkS
				cat $WORK/link >> $WORK/all
			fi
			if [ -f $WORK/empty ]
			then
				cat $WORK/ko >> $WORK/emptyS
				cat $WORK/empty >> $WORK/emptyS
				cat $WORK/empty >> $WORK/all
			fi
		fi
		echo $i
		echo $i > $WORK/ko
		rm -fr $WORK/find $WORK/empty $WORK/link
		continue
	fi
	if [ ! -e $FWS/firmware/$i ]
	then
		echo "[1;31m"$i"[0m" >> $WORK/empty
		continue
	fi
	copydirect $FWS $i
	if [ ! -h $FWS/firmware/$i ]
	then
		echo $i >> $WORK/find
		continue
	fi
	copysymlink $FWS $i
	echo "[1;36m"$i"[0m" >> $WORK/link
done
rm -f $WORK/ko
exit 0
Thanks.

fabbrocino
Ronin
Ronin
Posts: 3
Joined: 16 Oct 2017, 15:00
Distribution: Porteus-v3.1

make firmware_install on kernel linux-4.14.34

Post#5 by fabbrocino » 19 Apr 2018, 08:13

Thank you very much to brokenman for his advice and to Neko for his script.
The problem has been solved in a big way!
Thanks again :thumbsup:

Post Reply