adding new driver to kernel src and building rpm

Amadeus W.M. amadeus84 at verizon.net
Sun Jan 25 06:50:18 UTC 2015


I'm trying to do the following:

1) add the smi2021 driver for EasyCap Somagic usb frame grabbers into the 
kernel tree
2) compile the kernel with smi2021 as a module
3) build the rpm.

I got the driver from Jon Arne Jorgensen's kernel branch on github:

https://github.com/jonjonarnearne/smi2021

then tried to follow these instructions:

https://fedoraproject.org/wiki/Building_a_custom_kernel

but the whole thing fails with this eror:


Patch100000: smi2021.patch
+ case "$patch" in
+ patch -p1 -F1 -s
+ chmod +x scripts/checkpatch.pl
+ touch .scmversion
+ mkdir configs
+ for i in '*.config'
+ mv kernel-3.17.8-aarch64.config .config
++ head -1 .config
++ cut -b 3-
+ Arch=arm64
+ make ARCH=arm64 listnewconfig
+ grep -E '^CONFIG_'
+ '[' -s .newoptions ']'
+ cat .newoptions
CONFIG_VIDEO_SMI2021
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.sASN4F (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.sASN4F (%prep)


So I spent a lot of time trying to figure this out and I know why it happens
but I don't know how to fix it. 

The smi2021.patch being applied above is the diff between the kernel trees 
with and without the driver. The patch succeeds. The problem is that in 
order to have the module compiled I did make oldconfig and so I ended up with 

CONFIG_VIDEO_SMI2021=m

in the kernel-3.17.8-x86_64 **ONLY**. Then the kernel.spec has some code 
that runs oldconfig over **ALL** the kernel*.config files:


for i in *.config
do
  mv $i .config
  Arch=`head -1 .config | cut -b 3-`
  make ARCH=$Arch listnewconfig | grep -E '^CONFIG_' >.newoptions || true
%if %{listnewconfig_fail}
  if [ -s .newoptions ]; then
    cat .newoptions
    exit 1
  fi
%endif
  rm -f .newoptions
  make ARCH=$Arch oldnoconfig
  echo "# $Arch" > configs/$i
  cat .config >> configs/$i
done
# end of kernel config
%endif


Of course, none of the other config files (for other architectures then 
x86_64) have the CONFIG_VIDEO_SMI2021 options, hence the error.


So the key question is what is the proper way to add a new driver to the
kernel tree and run 

rpmbuild -bb --target=$(uname -m) kernel.spec

on it? Do I put CONFIG=VIDEO_SMI2021=m in SOURCES/config-local, or what?


For what it's worth, I am able to do 

make oldconfig        # picks up the option for the new driver
make 

in the kernel tree with the new code in it and it goes through without errors.
So if I want to run the new kernel with the new driver, I can, but I'd rather
do this by building the custom rpm, as I don't know when or if this driver 
will be included in the vanilla kernel.

Please help, I'm at the end of my wits. Thanks!





More information about the devel mailing list