You are not logged in.

#1 2008-03-09 16:22:24

Reasons
Member
From: Washington
Registered: 2007-11-04
Posts: 572

Changing kernel name

Whenever I compile my own kernel I do it the ABS way and use this script (seen below) which installed is named kernel26-NAME but in all actuality (like with the screenshot tool) comes up as kernel26-ARCH-NAME. Is there a way to make it like the first one? I found that option when I was choosing kernel options, but if I removed the arch the kernel wouldn't load and if I just do a straight makepkg on the pkgbuild not modified by the script, it just builds and I never get to choose option.

#!/bin/bash
# Author: kano <gt@fallendusk.org>

# Configuration #
appendname="-reasons" # Name to append to kernel package
BUILD=0    # Build package when done? No = 0; Yes = 1
#MAKEPKGOPT="" # Uncomment if you're building after you make; Add any options you want passed to makepkg (can be nothing)

# Work starts here; shouldn't have to edit anything below #
mkdir kernel26${appendname}/
cp kernel26/* kernel26${appendname}/

regen_md5sum() {
    if [ ${file} != 'PKGBUILD' ]; then
        echo "Regenerating md5sum for ${file}"
        cat kernel26${appendname}/PKGBUILD \
        | sed "s/'`md5sum kernel26/${file} | awk '{ print $1 }'`'/'`md5sum kernel26${appendname}/${file} | awk '{ print $1 }'`'/;" \
        > PKGBUILD.tmp
        mv PKGBUILD.tmp kernel26${appendname}/PKGBUILD
    fi
}

for file in "PKGBUILD" "kernel26.preset" "kernel26.install"; do
    echo "Editing ${file}"

    cat kernel26/${file} | \
           sed "s/kernel26/kernel26${appendname}/g" \
    | sed "s/vmlinuz26/vmlinuz26${appendname}/g" \
    | sed "s/kconfig26/kconfig26${appendname}/g" \
    | sed "s/System.map26/System.map26${appendname}/g" \
    > kernel26${appendname}/${file}

    # Regenerate md5sum
    regen_md5sum
done

for file in "config" "config.x86_64"; do
    echo "Editing ${file}"

    cat kernel26/${file} | \
           sed "s/CONFIG_LOCALVERSION=\"-ARCH\"/CONFIG_LOCALVERSION=\"-ARCH${appendname}\"/" \
    > kernel26${appendname}/${file}

    # Regenerate md5sum
    regen_md5sum
done

mv kernel26${appendname}/mkinitcpio-kernel26.conf kernel26${appendname}/mkinitcpio-kernel26${appendname}.conf
mv kernel26${appendname}/kernel26.install kernel26${appendname}/kernel26${appendname}.install
mv kernel26${appendname}/kernel26.preset kernel26${appendname}/kernel26${appendname}.preset

# Add make menuconfig to PKGBUILD
cat kernel26${appendname}/PKGBUILD | \
sed 's/# load configuration/\n  # configure kernel before build\n  make menuconfig\n\n  # load configuration/;' \
> PKGBUILD.tmp
mv PKGBUILD.tmp kernel26${appendname}/PKGBUILD

echo "Custom kernel pkgbuild created."

# To build or to not to build?
if [ ${BUILD} -eq 1 ]; then
    cd kernel26${appendname}
    makepkg ${MAKEPKGOPT}
fi

Offline

#2 2008-03-17 07:57:48

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: Changing kernel name

I'd say you'd have to replace

    cat kernel26/${file} | \
           sed "s/CONFIG_LOCALVERSION=\"-ARCH\"/CONFIG_LOCALVERSION=\"-ARCH${appendname}\"/" \
    > kernel26${appendname}/${file}

with either

    cat kernel26/${file} | \
           sed "s/CONFIG_LOCALVERSION=\"-ARCH\"/CONFIG_LOCALVERSION=\"${appendname}\"/" \
    > kernel26${appendname}/${file}

or (more consice (spelling?))

    sed -i "s/CONFIG_LOCALVERSION=\"-ARCH\"/CONFIG_LOCALVERSION=\"${appendname}\"/" kernel26/${file}

Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

Board footer

Powered by FluxBB