#!/bin/bash ## src2pkg script for: kernel-modules ## Auto-generated by src2pkg-1.9.6 ## src2pkg Copyright 2005-2011 Gilbert Ashley # 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-modules build a unique KNAME like 'my_modules' KNAME='kiss' # The package build number. See ChangeLog at the end of this file BUILD='4' # 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='x86' # edit to change this to the correct kernel version SOURCE_NAME='linux-2.6.31.11.tar.bz2' # you shouldn't need to change anything below ALT_NAME and ALT_VERSION # reset the default package name(which would be 'linux' in this case) ALT_NAME="kernel-$KNAME" # uncomment and edit this to reset the default VERSION (needed if using kernel version patches) ALT_VERSION=2.6.31.11 PATCHLIST='4310_aufs2-31.11.patch' # don't split anything out SPLIT_PACKAGE= # packaging options # MAKE_IMG creates a mountable file-system image of the modules directory (sfs) # our init scripts include code to mount these early during bootup MAKE_IMG=sfs # 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 [[ -r $CWD/config-$KNAME-$VERSION ]] ; then cp $CWD/config-$KNAME-$VERSION $SRC_DIR/.config elif [[ -r $CWD/config-$KNAME ]] ; then cp $CWD/config-$KNAME $SRC_DIR/.config elif [[ -r $CWD/config ]] ; then cp $CWD/config $SRC_DIR/.config elif [[ -r $CWD/config* ]] ; then cp $CWD/config* $SRC_DIR/.config else echo "" echo $RED"Error!"$NORMAL" No kernel configuration file found!" echo "To build the kernel-modules, place a copy of your" echo "kernel-modules configuration file in the current directory" echo "and name it config-$KNAME-$VERSION, config-$KNAME or 'config'." echo "Exiting..." exit 0 fi # update the config file cd $SRC_DIR && make oldconfig # build the kernel cd $SRC_DIR && make bzImage STATUS=$? if [[ $STATUS = 0 ]] ; then mkdir -p $PKG_DIR/boot cp $SRC_DIR/arch/$KARCH/boot/bzImage $PKG_DIR/boot/vmlinuz-$KNAME-$VERSION cp $SRC_DIR/System.map $PKG_DIR/boot/System.map-$KNAME-$VERSION cp $SRC_DIR/.config $PKG_DIR/boot/config-$KNAME-$VERSION else echo "Kernel failed to compile cleanly! Exiting..." exit 1 fi # build the modules # this method has the advantage of not needing to be root to # install the modules and to create the *.map files cd $SRC_DIR && make modules STATUS=$? if [[ $STATUS = 0 ]] ; then mkdir -p $PKG_DIR/lib/modules/$VERSION cd $SRC_DIR export INSTALL_MOD_PATH=$PKG_DIR make _modinst_ if [[ -x /sbin/depmod ]] ; then /sbin/depmod -b $PKG_DIR $VERSION fi else echo "Kernel-modules failed to compile cleanly! Exiting..." exit 1 fi # Remove erroneous links(build & source) in /lib/modules rm -f $PKG_DIR/lib/modules/$VERSION/source $PKG_DIR/lib/modules/$VERSION/build # recreate them to point to the right place ( cd $PKG_DIR/lib/modules/$VERSION && ln -sf /usr/src/linux-$VERSION source ) ( cd $PKG_DIR/lib/modules/$VERSION && ln -sf /usr/src/linux-$VERSION build ) # case $MAKE_IMG in sfs) # create a squashfs image of the contents of the modules directory echo "Creating a squashfs image of the modules." ( cd $PKG_DIR/lib/modules && \ { mksquashfs $VERSION kernel-modules-$VERSION.sfs -comp gzip rm -rf $VERSION/* mv kernel-modules-$VERSION.sfs $VERSION/ } ) ;; # other possibilities iso, extX esac if ! [[ -e $CWD/pkg-desc ]] ; then cat > $CWD/pkg-desc < $PKG_DIR/etc/rc.d/rc.modules-${VERSION}.new chmod 644 $PKG_DIR/etc/rc.d/rc.modules-${VERSION}.new fix_pkg_perms strip_bins create_docs compress_man_pages make_description make_doinst make_package post_process # src2pkg - Copyright 2005-2011 Gilbert Ashley # Build 2 adds the aufs patch with aufs built-in, adds mtd/jffs2 modules, # makes creation of fs image optional # aufs maybe the best choice for a union mount. It came closer than any # other to getting in the mainline kernel. Even the code is pretty large, # it only patches a few lines in a couple of existing files, so the patch should # be fairly easy to maintain. # Build 3 adds a whole slew of modules mostly for network devices # lowers HZ to 300, uses gzip instead of lzma, turns on optimization # Build 4 uses a nearly fully modular configuration for a generic kernel, but with # ext2/3/4 built in plus iso9660, FAT/NTFS and others