[SOLVED] Where might I find the kernel-source SlackBuild ?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been keeping up with the 4.4.x Kernel in Slackware64-14.2 by installing and / or updating the Kernel Packages from Slackware64-current in my Slackware64-14.2 + Multilib + Nvidia Blob Laptop.
Last Month, volkerdi seemed surprised that the Nvidia Blob was working for me because the Kernel Packages were compiled with a different version of gcc on current vs my 14.2 System ...
So far everything has worked great, but sooner or later I imagine I'll run into the trouble that Pat anticipated so I would like to start building my own set of 'tagged' 4.4.x Kernel Packages.
I've located all Pat's SlackBuild scripts except a kernel-source.SlackBuild ...
Are there any special tricks to creating a kernel-source Package ?
Is there a kernel-source.SlackBuild out there somewhere that I've not managed to find ?
As far as I know, the kernel source would be the source for a kernel. You get that from kernel.org. Slackware doesn't alter the kernel source in any way, so what you get from kernel.org is what you get from Slackware's kernel sources.
Making that into a Slackware package is probably superfluous, but you could, if you wanted, place it in a dir structure that mimics your target, and then use makepkg to make it into a formal package.
Basically, no special requirements (because Slackware uses an unmodified source code).
You'll have to create links (to the source code) in the modules directory, but it's rather general (and not Slackware specific) requirement.
As an alternative, you might also consider setting up /usr/src/linux as a git clone which is what I do. git takes up extra diskspace and the initial clone can be quite a big download, but from then on in, its just a matter of 'git pull' to update it, which is really convenient.
Unlike rkelsen I do prefer to package up my kernels+modules. We all have our own individual approaches.
Hmmm ... Let me think about simply building the Kernels and Modules in /usr/src/linux-4.4.x/ without bothering to build Unofficial Slackware Packages ...
I am a firm believer in Slackware Packages and the installpkg / upgradepkg / removepkg tools.
For kernels, `removepkg` is especially convenient for removing old kernels from the system.
But I suppose there's not a lot to remove with the kernel Packages, is there ?
But I suppose there's not a lot to remove with the kernel Packages, is there ?
I've always done my kernels manually. If I build a custom kernel (whether based on a test config from Pat or different customizations), I just build it in /usr/src/, copy the vmlinuz image over to boot, run make modules_install, then rebuild an initrd based on the new kernel. If I decide to remove old kernels, I find it is plenty easy to just remove the kernel, initrd, kernel source, and modules manually. To me, it's much easier than the extra effort involved in trying to create or manage a SlackBuild for them. Plus, if you generate an initrd, it wouldn't be included with the kernel package (unless you manually include it), so you'll still either be left with files on your drive or have to manually remove it.
Normally, I'm all for Slackware packages and if there isn't a SlackBuild available, I'll create one myself, but the kernel puts files in only a few known places, and it's very easy to manually remove them. I suppose if you were to create a SlackBuild that also builds the kernel, installs the modules, copies the kernel over, generates an initrd (if needed), and packages all of that into a nifty little Slackware package, it could be nice, but that's far too much work for me to spend on this when it is super easy to just manually remove them (compared to many packages who have their files scattered across the filesystem in many different folders).
I've always done my kernels manually. If I build a custom kernel (whether based on a test config from Pat or different customizations), I just build it in /usr/src/, copy the vmlinuz image over to boot, run make modules_install, then rebuild an initrd based on the new kernel. If I decide to remove old kernels, I find it is plenty easy to just remove the kernel, initrd, kernel source, and modules manually.
This is exactly the way I do it.
Quote:
Originally Posted by bassmadrigal
I suppose if you were to create a SlackBuild that also builds the kernel, installs the modules, copies the kernel over, generates an initrd (if needed), and packages all of that into a nifty little Slackware package, it could be nice, but that's far too much work for me to spend on this when it is super easy to just manually remove them (compared to many packages who have their files scattered across the filesystem in many different folders).
Yep, creating a package every time would be more trouble than it's worth.
I use the following script to fetch the kernel sources, build it, and install the built kernel and modules. Removing the kernel is easy too, just need to remove the copied files and installed modules.
#!/bin/sh
# Script to get, build and install kernels in Slackware Linux
# functions
check_version() {
if [ -z "$VERSION" ]; then
echo "No version specified."
echo "Kernel version can be specified using the -k argument."
exit 1
fi
}
init() {
check_version
#ARCH=$(uname -a)
NUMJOBS=3
# Get base version of kernel, ie, for 3.10.17, base version is 3.10
BASEVER=${VERSION%.*}
# Get really base version, like for 3.10.17, it is 3
BASEBASEVER=${VERSION%%.*}
# Check for something like 4.0
[ "$BASEVER" = "$BASEBASEVER" ] && BASEVER=${VERSION%.*.*}
}
change_dir() {
check_version
[ ! "$(basename $(pwd))" = "linux-$VERSION" ] && cd "linux-$VERSION"
}
get() {
check_version
# Download the base kernel
wget -Nc "https://www.kernel.org/pub/linux/kernel/v${BASEBASEVER}.x/linux-$BASEVER.tar.xz"
# Download patch
if [ ! "$VERSION" = "$BASEVER" ]; then
wget -Nc "https://www.kernel.org/pub/linux/kernel/v${BASEBASEVER}.x/patch-$VERSION.xz"
fi
}
extract_release() {
# Check if kernel directory is available
if [ -d "linux-$VERSION" ]; then
return 0
fi
if [ -d "linux-$BASEVER" ]; then
return 0
# Else extract the base version
elif [ -f "linux-${BASEVER}.tar.xz" ]; then # || [ -f "linux-$BASEVER.tar.gz" ] || [ -f "linux-$BASEVER.tar.bz2" ]
tar xvf "linux-${BASEVER}.tar.xz" || return 1
else
echo "Unable to extract linux-${BASEVER}.tar.xz"
return 1
fi
}
extract_patch() {
# Need to check if patch for specified version is available
if [ -e "patch-$VERSION.xz" ]; then
# Extract the patch
unxz "patch-$VERSION.xz"
elif [ -f "patch-$VERSION.gz" ]; then
"gunzip patch-$VERSION.gz"
else
return 1
fi
}
apply_patch() {
# Now check and apply patch
if [ -e "patch-$VERSION" ]; then
# Change into the src directory and apply the patch
cd "linux-$BASEVER" && patch -p1 < ../"patch-$VERSION" || exit 1
# Change name of src directory so state can be verified
cd .. && mv -v "linux-$BASEVER" "linux-$VERSION"
fi
}
extract(){
check_version
extract_release
extract_patch
apply_patch
}
config() {
# change to proper directory
change_dir
# copy the config
cp -i ../config-*"$BASEVER"* .config || exit 1
# Config handling is manual
make oldconfig
# Custom config too
make menuconfig
}
build() {
# change to proper directory
change_dir
# Build the kernel
make -j"$NUMJOBS" bzImage
# Build the modules
make -j"$NUMJOBS" modules
}
install() {
check_version
# change to proper directory
change_dir
echo "Installing kernel ${VERSION}"
# Install the modules
sudo make modules_install || exit 1
# Copy the built kernel and configs
sudo cp -v arch/x86/boot/bzImage "/boot/vmlinuz-custom-$VERSION" || exit 1
sudo cp -v System.map "/boot/System.map-custom-$VERSION" || exit 1
sudo cp -v .config "/boot/config-custom-$VERSION" || exit 1
}
remove() {
check_version
echo "Removing kernel ${VERSION}"
sudo rm -rv "/lib/modules/$VERSION" || exit 1
sudo rm -v "/boot/vmlinuz-custom-$VERSION" || exit 1
sudo rm -v "/boot/System.map-custom-$VERSION" || exit 1
sudo rm -v "/boot/config-custom-$VERSION" || exit 1
}
post_install() {
# Update bootloader
echo 'Updating grub configurartion'
sudo update-grub
}
clean() {
check_version
# change to proper directory
change_dir
# Unpatch and move the directory to linux-basever
patch -R -p1 < ../"patch-$VERSION" || exit 1
cd .. && mv -v "linux-$VERSION" "linux-$BASEVER"
}
display_help() {
cat << EOF
Usage: slack_kernel.sh -k <kernel> <option>
Options-
[get,-g] [clean,-c] [extract,-e]
[config,-m] [build,-b] [install,-i]
[posinstall,-p] [remove,-r] [all(-gembip),-a]
[help,-h]
EOF
}
# process cmd line args
while getopts "gcembiprahk:" opt; do
case "$opt" in
g) get;;
c) clean;;
e) extract;;
m) config;;
b) build;;
i) install;;
p) post_install;;
r) remove;;
a) get; extract; config; build; install; post_install;;
h) display_help ;;
k) VERSION=$OPTARG; init;;
*) ;;
esac
done
#echo "Done"
My usage for it is like:
Code:
# cd ~/build/kernel
# sh slack_kernel.sh -k 4.4.25 -a
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.