#!/bin/bash ## src2pkg script for: kernel-headers ## src2pkg Copyright 2005-2008 Gilbert Ashley # KNAME for standard kernels is 'huge, 'huge-smp', 'generic', or 'generic-smp' # KNAME gets appended to the name of the package (like 'kernel-$KNAME') # in order to avoid that installpkg or upgradepkg overwrite your existing kernel(s), # You should give this kernel build a unique KNAME. The KNAME will be used # to name the finished kernel (vmlinuz-$KNAME), System.map/System.map-$KNAME # and config file (config-$KNAME). This script will search for a config file in the # directory where it is run. The config file should be named config-$KNAME-$VERSION, # config-$KNAME or simply config. KNAME='headers' # edit to change this to the correct kernel version SOURCE_NAME='linux-2.6.31.11.tar.bz2' # reset the package name (which would normally be 'linux' in this case) ALT_NAME="libc-headers" # uncomment and edit this to reset the default VERSION (needed if using kernel version patches) ALT_VERSION=2.6.31.11 # the build number for this package BUILD='3' # BUILD 2 # add the headers for the aufs kernel patch we are using # BUILD 3 # change the name from kernel-headers to libc-headers # We want these to be right CORRECT_PERMS=YES SPLIT_PACKAGE= # if you want to build a kernel for architecture other than ix86, change this # the most likely alternatives are: ia64, ppc or x86_64 # this needs to be set so that the script can find the finished bzImage file # under $SRC_DIR/arch/$KARCH/boot/bzImage KARCH='i386' # Normally you shouldn't need to change anything below here SOURCES_DIR=$PWD/../../kernel PATCHLIST='4310_aufs2-31.11.patch' # Get the functions and configs . /usr/libexec/src2pkg/FUNCTIONS ; # do_all_processes can substitute these 16 steps: pre_process find_source make_dirs unpack_source fix_source_perms #configure_source #compile_source #fake_install if ! [[ -e $CWD/pkg-desc ]] ; then cat > $CWD/pkg-desc < $PKG_DIR/usr/include/linux/aufs_type.h ) ( cd $SRC_DIR/fs/aufs ../../scripts/unifdef -U__KERNEL__ aufs.h > $PKG_DIR/usr/include/linux/aufs.h ) # skip a bunch of fix-ups skip() { # now fix up missing headers. We arbitrarily filter them # with unifdef to avoid checking to see if they really need it # we could have patched the Kbuild files to do this # list of missing headers and the packages which need them: # include/linux/linkage.h sysklogd (ksym_mod.c) # include/asm-generic/linkage.h syklogd # include/asm-generic/linkage.h provides reasonable defaults # the alternate arch/x86/include/asm/linkage.h includes linux/stringify and linux/compiler.h # It appears that the same may hold true for page.h (better to use the one from include/asm-generic) ( cd $SRC_DIR/include/linux for FILE in compiler.h linkage.h ; do # sanitize them using unifdef ../../scripts/unifdef -U__KERNEL__ $FILE > $PKG_DIR/usr/include/linux/$FILE done ) ( if [[ $KARCH = "i386" ]] ; then # cd $SRC_DIR/arch/x86/include/asm cd $SRC_DIR/include/asm-generic else cd $SRC_DIR/arch/$KARCH/include/asm fi # include/asm-generic/linkage.h provides reasonable defaults for FILE in linkage.h page.h ; do # sanitize them using unifdef ../../../../scripts/unifdef -U__KERNEL__ $FILE > $PKG_DIR/usr/include/asm-$KARCH/$FILE done ) # more missing headers pointed out on the ubuntu buglist ( cd $SRC_DIR/drivers/media/dvb/dvb-core for FILE in demux.h dmxdev.h dvbdev.h dvb_demux.h \ dvb_frontend.h dvb_net.h dvb_ringbuffer.h ; do ../../../../scripts/unifdef -U__KERNEL__ $FILE > $PKG_DIR/usr/include/linux/dvb/$FILE done cd .. ../../../scripts/unifdef -U__KERNEL__ frontends/lgdt330x.h > $PKG_DIR/usr/include/linux/dvb/lgdt330x.h mkdir -p $PKG_DIR/usr/include/media cd $SRC_DIR/drivers/media/video ../../../scripts/unifdef -U__KERNEL__ msp3400-driver.h > $PKG_DIR/usr/include/media/msp3400-driver.h # these are dependencies of the above msp3400-driver.h which lead to other unmet depends.... # so we'll leave them out for now cd $SRC_DIR/include/media ../../scripts/unifdef -U__KERNEL__ msp3400.h > $PKG_DIR/usr/include/media/msp3400.h ../../scripts/unifdef -U__KERNEL__ v4l2-device.h > $PKG_DIR/usr/include/media/v4l2-device.h ../../scripts/unifdef -U__KERNEL__ v4l2-subdev.h > $PKG_DIR/usr/include/media/v4l2-subdev.h ../../scripts/unifdef -U__KERNEL__ v4l2-common.h > $PKG_DIR/usr/include/media/v4l2-common.h ../../scripts/unifdef -U__KERNEL__ v4l2-dev.h > $PKG_DIR/usr/include/media/v4l2-dev.h # these look like they're pretty generic -especially mutex.h cd $SRC_DIR/include/linux ../../scripts/unifdef -U__KERNEL__ device.h > $PKG_DIR/usr/include/linux/device.h ../../scripts/unifdef -U__KERNEL__ cdev.h > $PKG_DIR/usr/include/linux/cdev.h ../../scripts/unifdef -U__KERNEL__ mutex.h > $PKG_DIR/usr/include/linux/mutex.h ../../scripts/unifdef -U__KERNEL__ stringify.h > $PKG_DIR/usr/include/linux/stringify.h # others listed by ubuntu -all under drivers/media/dvb: # b2c2, bt8xx, dm1105, dvb-usb, pluto2, siano, ttpci, ttusb-budget, ttusb-dec ) } # as someone else said: the install rule sucks ( cd $PKG_DIR/usr/include find -name ".install*" -exec rm -f {} \; find -name "..install*" -exec rm -f {} \; find -name ".check*" -exec rm -f {} \; find -name "..check*" -exec rm -f {} \; ) # remove stuff supplied elsewhere ( cd $PKG_DIR/usr/include rm -f scsi/scsi.h # for using modern versions of libdrm and its' dependencies, # leave these headers in, instead of removing rm -rf drm ) #mkdir -p $PKG_DIR/install #cat > $PKG_DIR/install/doinst.sh < ## See the documentation for more help and examples. Below are some of # the most common Extras and Options for easy cut-and-paste use. # EXTRA_CONFIGS='' PRE_FIX='' DOCLIST='' # MAKE_COMMAND='' INSTALL_LINE='' # SHELL_INSTALL='YES' CORRECT_PERMS='NO' # When editing src2pkg scripts to add custom code, use these variables # to refer to the current directory, the sources or the package tree: # $CWD (current directory), $SRC_DIR (sources), $PKG_DIR (package tree)