[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:kernel:using_slackwares_kernel_build_scripts [2019/04/24 11:23 (UTC)] – Add lilo info dive | howtos:kernel:using_slackwares_kernel_build_scripts [2019/04/24 15:31 (UTC)] – Add note that these scripts can be used for 14.2 dive | ||
---|---|---|---|
Line 31: | Line 31: | ||
(A recipe dictates the arch of the package set.) | (A recipe dictates the arch of the package set.) | ||
- | The Slackware kernel build scripts | + | The Slackware kernel build scripts |
- | source directory on any mirror | + | any mirror |
- | contains the 64 and 32 bit generic and huge configs, and a | + | huge configs, and a kernel source tarball. The 14.2 source directories have a |
- | kernel source tarball. The 14.2 source directories have a | + | different setup, |
- | different setup, | + | |
There isn't a firmware build script in there so I won't be | There isn't a firmware build script in there so I won't be | ||
Line 115: | Line 114: | ||
**OUTPUT:** | **OUTPUT:** | ||
- | **Mandatory**. Where the build script will move the | + | Optional. Where the build script will move the |
- | completed packages to. This is the most important variable. | + | completed packages to.\\ |
- | If this isn't set then the packages will be __lost in the | + | Default |
- | void__. No kidding.\\ | + | ${TMP}/ |
- | Default: | + | |
**INSTALL_PACKAGES: | **INSTALL_PACKAGES: | ||
Line 301: | Line 299: | ||
(The generic script is also used to make the huge kernel.) | (The generic script is also used to make the huge kernel.) | ||
- | == The Variables == | + | === The Variables |
- | After placing the relevant configs in k/ | + | After placing the relevant configs in k/ |
- | the kernel source tarball in k/, it is only necessary to set | + | tarball in k/, it is only necessary to export |
- | and export | + | environment and then run the build script. Make sure the $OUTPUT directory |
- | script. Make sure the $OUTPUT directory exists, or create it. | + | exists |
- | You may also want to export INSTALL_PACKAGES=NO if you don't | + | INSTALL_PACKAGES=NO if you don't want to install the packages as they are being |
- | want to install the packages as they are being built. | + | built. |
- | <note warning> | + | Examples to set $OUTPUT |
- | then the packages will be deleted when the build script | + | |
- | attempts to move them.</ | + | |
In bourne type shells (sh, bash, ksh, zsh, ash etc): | In bourne type shells (sh, bash, ksh, zsh, ash etc): | ||
Line 344: | Line 340: | ||
</ | </ | ||
- | == The Build == | + | === The Build === |
Then run the build script: | Then run the build script: | ||
Line 382: | Line 378: | ||
highlighting, | highlighting, | ||
- | == Not Only But Also == | + | === Not Only But Also === |
In addition to the packages being created, we also have the | In addition to the packages being created, we also have the | ||
Line 406: | Line 402: | ||
recreate your initrd and rerun lilo. | recreate your initrd and rerun lilo. | ||
- | ==== The Setup Script ==== | + | ==== A Setup Script ==== |
- | local-version-setup.sh: | + | An example |
<code bash> | <code bash> | ||
Line 417: | Line 413: | ||
# The is an example kernel package build script. | # The is an example kernel package build script. | ||
- | ########### | + | ########### SETTINGS ########## |
+ | export OUTPUT=/ | ||
LOCALVERSION=jabberwok | LOCALVERSION=jabberwok | ||
CONFIG_SUFFIX=.x64 | CONFIG_SUFFIX=.x64 | ||
- | export | + | export |
- | ########### OPTIONALSETTINGS ############ | + | |
#export TMP=/ | #export TMP=/ | ||
#export NUMJOBS=-j1 | #export NUMJOBS=-j1 | ||
- | export INSTALL_PACKAGES=NO | + | ####### END OF SETTINGS ###### |
- | ############# END OF SETTINGS | + | |
set -e | set -e | ||
- | |||
- | # Bail out if OUTPUT is not set. | ||
- | if [ -z " | ||
- | printf " | ||
- | exit 1 | ||
- | fi | ||
mkdir -p " | mkdir -p " | ||
- | # Taken from build-all-kernels.sh. | + | # From build-all-kernels.sh. |
VERSION=$(/ | VERSION=$(/ | ||
| rev | cut -f 3- -d . | cut -f 1 -d - | rev) | | rev | cut -f 3- -d . | cut -f 1 -d - | rev) | ||
+ | OLD_CONFIG=$(/ | ||
+ | | sort -V | tail -n 1 | rev | cut -f 2- -d . | cut -f 1 -d - | rev) | ||
+ | |||
# Bail out if no VERSION found. | # Bail out if no VERSION found. | ||
if [ -z " | if [ -z " | ||
Line 448: | Line 440: | ||
GENERIC_CONFIG=config-generic-${VERSION}${CONFIG_SUFFIX} | GENERIC_CONFIG=config-generic-${VERSION}${CONFIG_SUFFIX} | ||
HUGE_CONFIG=config-huge-${VERSION}${CONFIG_SUFFIX} | HUGE_CONFIG=config-huge-${VERSION}${CONFIG_SUFFIX} | ||
- | OLD_VERSION=$(/bin/ls -1 kernel-configs/ | + | OLD_CONFIG=$(/bin/ls -1 kernel-configs/ |
| sort -V | tail -n 1 | rev | cut -f 2- -d . | cut -f 1 -d - | rev) | | sort -V | tail -n 1 | rev | cut -f 2- -d . | cut -f 1 -d - | rev) | ||
Line 454: | Line 446: | ||
if ! [ -e kernel-configs/ | if ! [ -e kernel-configs/ | ||
printf " | printf " | ||
- | cp -v kernel-configs/ | + | cp -v kernel-configs/ |
kernel-configs/ | kernel-configs/ | ||
fi | fi | ||
Line 460: | Line 452: | ||
if ! [ -e kernel-configs/ | if ! [ -e kernel-configs/ | ||
printf " | printf " | ||
- | cp -v kernel-configs/ | + | cp -v kernel-configs/ |
kernel-configs/ | kernel-configs/ | ||
fi | fi | ||
Line 488: | Line 480: | ||
In a nutshell: | In a nutshell: | ||
- | * Set the mandatory | + | * Set the variables at the top of the script. |
- | * Set any optional variables you want. | + | |
* sh setup.sh | * sh setup.sh | ||
- | If $OUTPUT or $VERSION | + | If $VERSION |
- | error. | + | |
Tweaks in a nutshell: | Tweaks in a nutshell: | ||
Line 502: | Line 492: | ||
* The hard-coded /tmp path is replaced. Only needed if setting $TMP. | * The hard-coded /tmp path is replaced. Only needed if setting $TMP. | ||
- | $VERSION is found automatically from the highest | + | $VERSION is found automatically from the highest |
- | archive. The configs are found in a similar way. They will | + | source |
- | be created if none are found for $VERSION. If the versions | + | will be created if none are found for $VERSION. If the |
- | aren't what you expect, you may need to remove the other | + | versions |
- | files, leaving the ones you need. | + | other files, leaving the ones you need. |
==== Lilo ==== | ==== Lilo ==== | ||
- | Example section for / | + | When using a local version the image name would be formatted like: |
+ | |||
+ | / | ||
+ | |||
+ | Without a local version, e.g. an upgrade to a stock kernel, it would be: | ||
+ | |||
+ | / | ||
+ | |||
+ | However, if the /boot symlinks are created then only: | ||
+ | |||
+ | / | ||
+ | |||
+ | This saves having to re-edit | ||
+ | |||
+ | Example using a local version: | ||
< | < | ||
Line 519: | Line 523: | ||
read-only | read-only | ||
</ | </ | ||
+ | |||
+ | Substitute the initrd file name for your own. I tend to name them after the | ||
+ | specific kernel they were made for, which is helpful with more than one kernel | ||
+ | installed. | ||
==== Final Thoughts ==== | ==== Final Thoughts ==== | ||
Line 527: | Line 535: | ||
it shows enough to get started. | it shows enough to get started. | ||
- | This is the way that the kernel packages are made in | + | This is the way that the kernel packages are made in Slackware |
- | Slackware | + | with a few tweaks added, so it has does have a history of reliability behind |
- | has does have a history of reliability behind it. | + | it. |
Link to example scripts: | Link to example scripts: | ||
http:// | http:// | ||
+ | |||
+ | Consider these as works in progress, so they may be updated from time to time. | ||
====== Sources ====== | ====== Sources ====== |