adding new driver to kernel src and building rpm

Amadeus W.M. amadeus84 at verizon.net
Sun Jan 25 14:00:39 UTC 2015


Thanks for the answer, please see below.


On Sat, 24 Jan 2015 23:16:23 -0800, Adam Williamson wrote:

> On Sun, 2015-01-25 at 06:50 +0000, Amadeus W.M. wrote:
>> 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)
>> 
>> Please help, I'm at the end of my wits. Thanks!
> 
> You just have to put the new config option in one of the config* files 
> that's part of the kernel package git checkout itself - one that gets 
> included in the appropriate arch builds. 


How do I do that?


> If you want to build the 
> driver as a module for all arches, put CONFIG_VIDEO_SMI2021=m in 
> config-generic , for instance.
> -- 
> Adam Williamson
> Fedora QA Community Monkey
> IRC: adamw | Twitter: AdamW_Fedora | XMPP: adamw AT happyassassin . net
> http://www.happyassassin.net


I did do that, as per these instructions:

https://fedoraproject.org/wiki/Building_a_custom_kernel

(Configure Kernel Options, #6). So 

grep -i smi2021 rpmbuild/SOURCES/config-*
rpmbuild/SOURCES/config-x86_64-generic:CONFIG_VIDEO_SMI2021=m

So config-x86_64-generic is the ONLY one that has this option. Then
I run rpmbuild and the kernel*.config files are generated:


grep -i smi2021 rpmbuild/BUILD/kernel-3.17.fc20/linux-3.17.8-200.smi2021.fc20.x86_64/kernel*.config
rpmbuild/BUILD/kernel-3.17.fc20/linux-3.17.8-200.smi2021.fc20.x86_64/kernel-3.17.8-x86_64.config:CONFIG_VIDEO_SMI2021=m
rpmbuild/BUILD/kernel-3.17.fc20/linux-3.17.8-200.smi2021.fc20.x86_64/kernel-3.17.8-x86_64-debug.config:CONFIG_VIDEO_SMI2021=m

so only two of them have the new option. Then rpmbuild -bb fails with 

CONFIG_VIDEO_SMI2021
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.sASN4F (%prep)

The relevant code in /var/tmp/rpm-tmp.sASN4F is 


# now run oldconfig over all the 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 [ -s .newoptions ]; then
    cat .newoptions
    exit 1
  fi
  rm -f .newoptions
  make ARCH=$Arch oldnoconfig
  echo "# $Arch" > configs/$i
  cat .config >> configs/$i
done
# end of kernel config


which checks that ALL *.config files in the kernel tree have empty .newoptions. 
Of course, none do, except for the x86_64 ones.




More information about the devel mailing list