diff --git a/kernel-xenlinux.spec b/kernel-xenlinux.spec index 906cc07..fd0bf3b 100644 --- a/kernel-xenlinux.spec +++ b/kernel-xenlinux.spec @@ -224,6 +224,49 @@ cp vmlinux %buildroot%{debuginfodir}/lib/modules/%kernelrelease find %buildroot/lib/modules/%kernelrelease -name "*.ko" -type f >modnames +# mark modules executable so that strip-to-file can strip them +xargs --no-run-if-empty chmod u+x < modnames + +# Generate a list of modules for block and networking. + +fgrep /drivers/ modnames | xargs --no-run-if-empty nm -upA | +sed -n 's,^.*/\([^/]*\.ko\): *U \(.*\)$,\1 \2,p' > drivers.undef + +collect_modules_list() +{ + sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef | + LC_ALL=C sort -u > %buildroot/lib/modules/%kernelrelease/modules.$1 +} + +collect_modules_list networking \ + 'register_netdev|ieee80211_register_hw|usbnet_probe' +collect_modules_list block \ + 'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler' +collect_modules_list drm \ + 'drm_open|drm_init' +collect_modules_list modesetting \ + 'drm_crtc_init' + +# detect missing or incorrect license tags +rm -f modinfo +while read i +do + echo -n "${i#%buildroot/lib/modules/%kernelrelease/} " >> modinfo + /sbin/modinfo -l $i >> modinfo +done < modnames + +egrep -v \ + 'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \ + modinfo && exit 1 + +rm -f modinfo modnames + +# remove files that will be auto generated by depmod at rpm -i time +for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap +do + rm -f %buildroot/lib/modules/%kernelrelease/modules.$i +done + # Move the devel headers out of the root file system mkdir -p %buildroot/usr/src/kernels mv %buildroot/lib/modules/%kernelrelease/build/* %buildroot/%src_install_dir