wok rev 17366

linux: add install_module_headers
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Nov 20 22:37:52 2014 +0100 (2014-11-20)
parents 1ef3f82b0095
children e3cc7eaaf433
files linux/receipt
line diff
     1.1 --- a/linux/receipt	Thu Nov 20 18:30:47 2014 +0100
     1.2 +++ b/linux/receipt	Thu Nov 20 22:37:52 2014 +0100
     1.3 @@ -44,6 +44,114 @@
     1.4  	esac
     1.5  fi
     1.6  
     1.7 +install_module_headers()
     1.8 +{
     1.9 +	local path
    1.10 +	path=usr/src/linux-$KVERSION
    1.11 +	mkdir -p $1/lib/modules/$KVERSION
    1.12 +	ln -sf /$path $1/lib/modules/$KVERSION/build
    1.13 +	install -D -m644 $src/Makefile \
    1.14 +		$1/$path/Makefile
    1.15 +	install -D -m644 $src/kernel/Makefile \
    1.16 +		$1/$path/kernel/Makefile
    1.17 +	install -D -m644 $src/.config \
    1.18 +		$1/$path/.config
    1.19 +	mkdir -p $1/$path/include
    1.20 +
    1.21 +	for i in acpi asm-generic config crypto drm generated linux math-emu \
    1.22 +		media net pcmcia scsi sound trace video xen; do
    1.23 +		cp -a $src/include/$i $1/$path/include/
    1.24 +	done
    1.25 +
    1.26 +	# copy arch includes for external modules
    1.27 +	mkdir -p $1/$path/arch/x86
    1.28 +	cp -a $src/arch/x86/include $1/$path/arch/x86/
    1.29 +
    1.30 +	# copy files necessary for later builds, like nvidia and vmware
    1.31 +  	cp -a $src/Module.symvers-modules $1/$path/Module.symvers
    1.32 +  	cp -a $src/scripts $1/$path
    1.33 +  	# fix permissions on scripts dir
    1.34 +  	chmod og-w -R $1/$path/scripts
    1.35 +  	mkdir -p $1/$path/.tmp_versions
    1.36 +
    1.37 +	mkdir -p $1/$path/arch/x86/kernel
    1.38 +	cp -a $src/arch/x86/Makefile $1/$path/arch/x86/
    1.39 +	cp -a $src/arch/x86/Makefile_32.cpu $1/$path/arch/x86/
    1.40 +	cp -a $src/arch/x86/kernel/asm-offsets.s $1/$path/arch/x86/kernel/
    1.41 +
    1.42 +	# add headers for lirc package
    1.43 +	mkdir -p $1/$path/drivers/media/video
    1.44 +	cp -a $src/drivers/media/video/*.h  $1/$path/drivers/media/video/
    1.45 +
    1.46 +	for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 ; do
    1.47 +   		mkdir -p $1/$path/drivers/media/video/$i
    1.48 +   		cp -a $src/drivers/media/video/$i/*.h $1/$path/drivers/media/video/$i
    1.49 +	done
    1.50 +
    1.51 +	# add docbook makefile
    1.52 +	install -D -m644 $src/Documentation/DocBook/Makefile \
    1.53 +    		$1/$path/Documentation/DocBook/Makefile
    1.54 +
    1.55 +	# add dm headers
    1.56 +	mkdir -p $1/$path/drivers/md
    1.57 +	cp -a $src/drivers/md/*.h  $1/$path/drivers/md
    1.58 +
    1.59 +	# add inotify.h
    1.60 +	mkdir -p $1/$path/include/linux
    1.61 +	cp -a $src/include/linux/inotify.h $1/$path/include/linux/
    1.62 +
    1.63 +	# add wireless headers
    1.64 +	mkdir -p $1/$path/net/mac80211/
    1.65 +	cp -a $src/net/mac80211/*.h $1/$path/net/mac80211/
    1.66 +
    1.67 +	# add dvb headers for external modules
    1.68 +	# in reference to:
    1.69 +	# http://bugs.archlinux.org/task/9912
    1.70 +	mkdir -p $1/$path/drivers/media/dvb/dvb-core
    1.71 +	cp -a $src/drivers/media/dvb/dvb-core/*.h $1/$path/drivers/media/dvb/dvb-core/
    1.72 +
    1.73 +	# add dvb headers for external modules
    1.74 +	# in reference to:
    1.75 +	# http://bugs.archlinux.org/task/11194
    1.76 +	if [ -d $src/include/config/dvb/ ]; then
    1.77 +		mkdir -p $1/$path/include/config/dvb/
    1.78 +		cp $src/include/config/dvb/*.h $1/$path/include/config/dvb/
    1.79 +	fi
    1.80 +
    1.81 +	# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
    1.82 +	# in reference to:
    1.83 +	# http://bugs.archlinux.org/task/13146
    1.84 +	mkdir -p $1/$path/drivers/media/dvb/frontends/
    1.85 +	cp -a $src/drivers/media/dvb/frontends/lgdt330x.h $1/$path/drivers/media/dvb/frontends/
    1.86 +	cp -a $src/drivers/media/video/msp3400-driver.h $1/$path/drivers/media/dvb/frontends/
    1.87 +
    1.88 +	# add dvb headers  
    1.89 +	# in reference to:
    1.90 +	# http://bugs.archlinux.org/task/20402
    1.91 +	mkdir -p $1/$path/drivers/media/dvb/dvb-usb
    1.92 +	cp -a $src/drivers/media/dvb/dvb-usb/*.h $1/$path/drivers/media/dvb/dvb-usb/
    1.93 +	mkdir -p $1/$path/drivers/media/dvb/frontends
    1.94 +	cp -a $src/drivers/media/dvb/frontends/*.h $1/$path/drivers/media/dvb/frontends/
    1.95 +	mkdir -p $1/$path/drivers/media/common/tuners
    1.96 +	cp -a $src/drivers/media/common/tuners/*.h $1/$path/drivers/media/common/tuners/
    1.97 +
    1.98 +	# add xfs and shmem for aufs building
    1.99 +	mkdir -p $1/$path/fs/xfs
   1.100 +	mkdir -p $1/$path/mm
   1.101 +	cp -a $src/fs/xfs/xfs_sb.h $1/$path/fs/xfs/xfs_sb.h
   1.102 +	
   1.103 +	# copy in Kconfig files
   1.104 +	for i in $(find . -name "Kconfig*"); do 
   1.105 +		mkdir -p $1/$path/$(echo $i | sed 's|/Kconfig.*||')
   1.106 +		cp -a $src/$i $1/$path/$i
   1.107 +	done
   1.108 +
   1.109 +	chown -R root.root $1/$path
   1.110 +	find $1/$path -type d -exec chmod 755 {} \;
   1.111 +	# remove unneeded architectures
   1.112 +	rm -rf $1/$path/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
   1.113 +}	
   1.114 +
   1.115  # Rules to configure and make the package.
   1.116  compile_rules()
   1.117  {
   1.118 @@ -167,6 +275,8 @@
   1.119  		[ -s arch/x86/boot/bzImage ] || return 1
   1.120  		mkdir -p $DESTDIR/linux64/boot 2> /dev/null
   1.121  		mv arch/x86/boot/bzImage $DESTDIR/linux64/boot/vmlinuz-$VERSION-slitaz64
   1.122 +		KVERSION=$VERSION-slitaz64
   1.123 +		install_module_headers $DESTDIR/linux64
   1.124  		ln System.map System.map-modules64
   1.125  		ln Module.symvers Module.symvers-modules64
   1.126  	else
   1.127 @@ -208,6 +318,8 @@
   1.128  	[ -s arch/x86/boot/bzImage ] || return 1
   1.129  	mkdir -p $DESTDIR/boot 2> /dev/null
   1.130  	mv arch/x86/boot/bzImage $DESTDIR/boot/vmlinuz-$VERSION-slitaz
   1.131 +	KVERSION=$VERSION-slitaz
   1.132 +	install_module_headers $DESTDIR
   1.133  	
   1.134  	# Compress all modules.
   1.135  	if [ -d "$DESTDIR/lib/modules/$VERSION-slitaz" ]; then