You are not logged in.

#1 2009-09-02 14:18:20

s3kt0r
Member
Registered: 2009-01-20
Posts: 208

[Solved] customizing kernel26-git (AUR)

I wanted to get the git version, because it has some new drivers that I "need". I don't understand it but, everytime I try to build, it doesn't build it with the options I selected and saved, despite reporting that my config has been saved in pkg directory.
It even builds modules that I didn't select. roll

Any thoughts?

Last edited by s3kt0r (2009-09-03 18:36:10)


box1: Arch (linux-3.17-rc5)
box2: Gentoo (linux-3.17-rc5)
wm: subtle

Offline

#2 2009-09-02 14:29:17

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: [Solved] customizing kernel26-git (AUR)

please post your PKGBUILD

Offline

#3 2009-09-02 14:34:38

s3kt0r
Member
Registered: 2009-01-20
Posts: 208

Re: [Solved] customizing kernel26-git (AUR)

pkgbuild is on AUR.

# Contributor: Mathias Burén <mathias.buren@gmail.com>
# Maintainer: xduugu
pkgname=kernel26-git
pkgver=20090902
pkgrel=1
pkgdesc="The Linux Kernel and modules from Linus' git tree"
url="http://www.kernel.org/"
arch=(i686 x86_64)
license=('GPL2')
depends=('coreutils' 'kernel26-firmware-git' 'module-init-tools' 'mkinitcpio>=0.5.15')
makedepends=('git')
backup=(etc/mkinitcpio.d/$pkgname.preset)
install=$pkgname.install
source=($pkgname.preset config.{i686,x86_64} \
        logo_linux_{clut224.ppm,mono.pbm,vga16.ppm})
md5sums=('7dd364c1dea0c459f3f3c76e86acbea9'
         '636a6749fec71eb2d91cf9272c20de9c'
         '9e46b89b4c97d004293f6458727e7adb'
         '6a5a1925501fe20fafd04fdb3cb4f6ed'
         'e8c333eaeac43f5c6a1d7b2f47af12e2'
         'c120adbd9c0daa0136237a83adeabd1e')
sha256sums=('b2ffb854cc2f92e61482e48a8863407011d266cac86cede52899a875d6e448f6'
            'f68da919fcb7e4a8a2d9a5eff609352ef9b0b4d937c35d205d2f856aca2d80f5'
            '396bacef53b0265e1f4af81021258dcea5bc7ff4676ba0e1caa65d629973b627'
            '4274579ccf42a9acc03283edffea2dda2c4a48e3fd734bbaeada4c16dff9d156'
            '1e5bea8de1c2cc24498fb9a4fdbb313f36f38f671f2bfc46ccf7acbd7958a4b9'
            'f9c7c1275313890fc12f6bab92e2c0794b5041e223d868eb0e34cd99baee3d7a')

_gitroot="git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git"
_gitname="linux-2.6.git"


####################################################################
# KERNEL CONFIG FILES
#
# This PKGBUILD searches for config files in the current directory
# and will use the first one it finds from the following
# list as base configuration:
#       config.local
#       config.saved.$CARCH
#       config.$CARCH
#
####################################################################


#############################################################
# PATCHES
#
# This package builds the vanilla git kernel by default,
# but it is possible to patch the source without modifying
# this PKGBUILD.
#
# Simply create a directory 'patches' in your PKGBUILD
# directory and _any_ file (dotfiles excluded) in this
# folder will be applied to the kernel source.
#
# Prefixing the patch file names with dots will obviously
# excluded them from the patching process.
#
#############################################################


#############################
# CONFIGURATION
#
# Uncomment desired options
#############################


#######
# Set to menuconfig, xconfig, gconfig or oldconfig
#
# If you set it to something else, the
# (manual) kernel configuration step will
# be skipped
#
_menu_method="menuconfig"       


#######
# The directory where the kernel should be built
#
# Can be useful, for example, if you want to compile on a
# tmpfs mount, which can speed up the compilation process
#
_build_dir="$srcdir"


#######
# Stop build process after kernel configuration
#
# This option enables _save_config implicitly.
#
# _configure_only=1

#######
# Append the date to the localversion
#
#       e.g. -ARCH -> -ARCH-20090422
#
# _date_localversion=1


#######
# Set the pkgver to the kernel version
# rather than the build date
#
# _kernel_pkgver=1


#######
# Save the .config file to package directory
# as config.saved.$CARCH
#
_save_config=1


#######
# Make the kernel build process verbose
#
# _verbose=1

##############################
# where the magic happens...
##############################
build() {
        local _karch="x86"

        #################################
        # Get the latest kernel sources
        #################################
        msg "Fetching sources..."

        cd "$startdir"
        if [ -d "$_gitname" ]; then
                msg2 "Updating sources..."
                cd "$_gitname" && git fetch && cd "$OLDPWD" || return 1
        else
                msg2 "Cloning the project..."
                git clone --mirror "$_gitroot" "$_gitname" || return 1
        fi

        msg "Creating build branch..."
        rm -rf "$_build_dir/$_gitname-build"
        git clone "$_gitname" "$_build_dir/$_gitname-build" || return 1

        cd "$_build_dir/$_gitname-build"


        ####################################
        # Add Archlinux logo to the source
        ####################################
        msg "Adding Archlinux logo..."
        cp "$srcdir/logo_linux_clut224.ppm"  drivers/video/logo/ &&
        cp "$srcdir/logo_linux_mono.pbm"     drivers/video/logo/ &&
        cp "$srcdir/logo_linux_vga16.ppm"    drivers/video/logo/ || return 1


        #################
        # Apply patches
        #################
        if [ -d "$startdir/patches" ]; then
                msg "Applying patches..."
                for i in "$startdir/patches/"*; do
                        msg2 "Applying ${i##*/}..."
                        patch -Np1 -i "$i" || (error "Applying ${i##*/} failed" && return 1)
                done
        fi


        #################
        # CONFIGURATION
        #################

        #########################
        # Loading configuration
        #########################
        msg "Loading configuration..."
        for i in local "saved.$CARCH" "$CARCH"; do
                if [ -e "$startdir/config.$i" ]; then
                        msg2 "Using kernel config file config.$i..."
                        cp -f "$startdir/config.$i" .config || return 1
                        break
                fi
        done

        [ ! -e .config ] &&
                warning "No suitable kernel config file was found. You'll have to configure the kernel from scratch."


        ###########################
        # Start the configuration
        ###########################
        msg "Updating configuration..."
        yes "" | make config > /dev/null

        case "$_menu_method" in
                menuconfig|oldconfig|xconfig|gconfig)
                        msg2 "Running make $_menu_method..."
                        make $_menu_method
                        ;;
                *) warning "Unknown config program: $_menu_method" ;;
        esac


        ##############################################
        # Save the config file the package directory
        ##############################################
        if [[ -n "$_save_config" || -n "$_configure_only" ]]; then
                msg "Saving configuration..."
                msg2 "Saving $_build_dir/$_gitname-build/.config as $startdir/config.saved.$CARCH"
                cp .config "$startdir/config.saved.$CARCH" || return 1
        fi

#######################################
        # Stop after configuration if desired
        #######################################
        if [ -n "$_configure_only" ]; then
                rm -rf "$_build_dir/$_gitname-build"
                return 1
        fi


        ###############################
        # Append date to localversion
        ###############################
        if [ -n "$_date_localversion" ]; then
                _localversion="$(sed -rn 's/^CONFIG_LOCALVERSION="([^"]*)"$/\1/p' .config)"
                [ -n "$_localversion" ] && msg2 "CONFIG_LOCALVERSION is set to: $_localversion"

                # since this is a git package, the $pkgver is equal to $(date +%Y%m%d)
                msg2 "Appending $pkgver to CONFIG_LOCALVERSION..."
                sed -i "s/^CONFIG_LOCALVERSION=.*$/CONFIG_LOCALVERSION=\"$_localversion-$pkgver\"/" \
                        .config
        fi


        #################
        # BUILD PROCESS
        #################

        ################################
        # Build the kernel and modules
        ################################
        msg "Building kernel and modules..."
        make V="$_verbose" bzImage modules || return 1


        ######################
        # Get kernel version
        ######################
        _kernver="$(make kernelrelease)"
        _basekernel="${_kernver%%-*}"


        ############################################################
        # Use kernel version instead of the current date as pkgver
        ############################################################
        if [ -n "$_kernel_pkgver" ]; then
                msg "Updating pkgver..."
                # work around AUR parser bug
                [ 1 ] && pkgver=${_kernver//-/_}

                # do not silently overwrite existing packages
                if [[ "$FORCE" != "1" && -e "$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}" ]]; then
                        error "A package has already been built. (use -f to overwrite)"
                        return 1
                fi
        fi


        #############################################################
        # Provide kernel26
        # (probably someone wants to use this kernel exclusively?)
        #############################################################
        provides=("${provides[@]}" "kernel26=${_kernver//-/_}")


        ################
        # INSTALLATION
        ################

        #####################
        # Install the image
        #####################
        msg "Installing kernel image..."
        install -D -m644 System.map                "$pkgdir/boot/System.map26-git" &&
        install -D -m644 arch/$_karch/boot/bzImage "$pkgdir/boot/vmlinuz26-git"    &&
        install -D -m644 .config                   "$pkgdir/boot/kconfig26-git"    || return 1


        ##########################
        # Install kernel modules
        ##########################
        msg "Installing kernel modules..."
        make INSTALL_MOD_PATH="$pkgdir" modules_install


        ##############################
        # Install fake kernel source
        ##############################
        install -D -m644 Module.symvers  "$pkgdir/usr/src/linux-$_kernver/Module.symvers"  &&
        install -D -m644 Makefile        "$pkgdir/usr/src/linux-$_kernver/Makefile"        &&
        install -D -m644 kernel/Makefile "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile" &&
        install -D -m644 .config         "$pkgdir/usr/src/linux-$_kernver/.config"         &&
        install -D -m644 .config         "$pkgdir/lib/modules/$_kernver/.config"           || return 1

#######################################################
        # Install scripts directory and fix permissions on it
        #######################################################
        cp -a scripts "$pkgdir/usr/src/linux-$_kernver" &&
                chmod og-w -R "$pkgdir/usr/src/linux-$_kernver" || return 1


        ##########################
        # Install header files
        ##########################
        msg "Installing header files..."

        # kernel headers
        msg2 "kernel"
        for i in acpi asm-{generic,$_karch} config linux math-emu media net pcmcia scsi sound trace video; do
                mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/$i" &&
                        cp -a include/$i "$pkgdir/usr/src/linux-$_kernver/include" || return 1
        done

        # lirc headers
        msg2 "lirc"
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video" &&
                cp drivers/media/video/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/" || return 1

        for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
                mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i" &&
                        cp -a drivers/media/video/$i/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i" || return 1
        done

        # md headers
        msg2 "md"
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/md" &&
                cp drivers/md/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/md" || return 1

        # inotify.h
        msg2 "inotify.h"
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/linux" &&
                cp include/linux/inotify.h "$pkgdir/usr/src/linux-$_kernver/include/linux/" || return 1

        # CLUSTERIP file for iptables
        msg2 "CLUSTERIP file for iptables"
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/" &&
                cp net/ipv4/netfilter/ipt_CLUSTERIP.c "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/" || return 1

        # wireless headers
        msg2 "wireless"
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/mac80211/" &&
                cp net/mac80211/*.h "$pkgdir/usr/src/linux-$_kernver/net/mac80211/" || return 1

        # Kconfig files
        msg2 "Kconfig files"
        for i in $(find . -name "Kconfig*"); do
                mkdir -p "$pkgdir/usr/src/linux-$_kernver/${i%/*}" &&
                        cp "$i" "$pkgdir/usr/src/linux-$_kernver/$i" || return 1
        done


        ########################################
        # Install architecture dependent files
        ########################################
        msg "Installing architecture files..."
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel" &&
                cp arch/$_karch/kernel/asm-offsets.s "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel"

        cp arch/$_karch/Makefile* "$pkgdir/usr/src/linux-$_kernver/arch/$_karch"
        cp -r arch/$_karch/configs "$pkgdir/usr/src/linux-$_kernver/arch/$_karch"

        # copy arch includes for external modules and fix the nVidia issue
        mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" &&
                cp -a "arch/$_karch/include" "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/" || return 1

        # create a necessary symlink to the arch folder
        cd "$pkgdir/usr/src/linux-$_kernver/arch" || return 1

        if [ "$CARCH" = "x86_64" ]; then
                ln -s $_karch x86_64 || return 1
        else
                ln -s $_karch i386 || return 1
        fi

        cd "$OLDPWD" || return 1


        ################################
        # Remove unneeded architecures
        ################################
        msg "Removing unneeded architectures..."
        for i in "$pkgdir/usr/src/linux-$_kernver/arch/"*; do
                [ "${i##*/}" != "$_karch" ] && rm -rf "$i"
        done
 ##################################
        # Create some important symlinks
        ##################################
        msg "Creating important symlinks..."
        cd "$pkgdir/usr/src/linux-$_kernver/include" &&
                ln -s asm-$_karch asm &&
                cd "$OLDPWD" || return 1

        cd "$pkgdir/lib/modules/$_kernver" &&
                rm -rf source build &&
                ln -s ../../../usr/src/linux-$_kernver build &&
                cd "$OLDPWD" || return 1

        cd "$pkgdir/usr/src" &&
                ln -s linux-$_kernver linux-$_basekernel-git &&
                cd "$OLDPWD" || return 1

        cd "$pkgdir/lib/modules" &&
                ln -s $_kernver $_basekernel-git &&
                cd "$OLDPWD" || return 1


        ###################
        # Fix permissions
        ###################
        msg "Fixing permissions..."
        chown -R root:root "$pkgdir/usr/src/linux-$_kernver" &&
                find "$pkgdir/usr/src/linux-$_kernver" -type d -exec chmod 755 {} \; || return 1


        ############################
        # Install mkinitcpio files
        ############################
        msg "Installing preset file..."
        install -D -m644 "$srcdir/kernel26-git.preset" \
                "$pkgdir/etc/mkinitcpio.d/kernel26-git.preset" || return 1

        msg "Generating kernel26-git.kver..."
        echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" \
                > "$pkgdir/etc/mkinitcpio.d/kernel26-git.kver" || return 1


        #######################
        # Remove the firmware
        #######################
        rm -rf "$pkgdir/lib/firmware"


        ##########################
        # Remove build directory
        ##########################
        rm -rf "$_build_dir/$_gitname-build"
}

# vim: set fenc=utf-8 ts=2 sw=2 noet:

thanks

edit: Started reviewing the pkgbuild again and I don't know if in fact this causing the issue here, but on line 14 it reads:

source=($pkgname.preset config.{i686,x86_64} \

Does this have anything to do with it? Perhaps only the config.{i686,x86_64} part?
edit2: I now think that I posted in the wrong place, would be more logic to be inside PKGBUILDS and ABS support. Mod team, we await your final decision. wink
edit3: Solved, problem was most likely wrong file name when saving config on menuconfig. PKGBUILD has instructions to rename the .config file to config.saved.i686 and then use that to makepkg. Instead of giving it some other name, just go with the default (.config), the pkgbuild will do the rest. Thanks to xduugu and stuffcorpse for the help.

Last edited by s3kt0r (2009-09-03 18:34:47)


box1: Arch (linux-3.17-rc5)
box2: Gentoo (linux-3.17-rc5)
wm: subtle

Offline

Board footer

Powered by FluxBB