[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 revisionLast revisionBoth sides next revision | ||
howtos:kernel:using_slackwares_kernel_build_scripts [2019/04/24 11:37 (UTC)] – script edit dive | howtos:kernel:using_slackwares_kernel_build_scripts [2019/04/24 15:37 (UTC)] – 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 47: | Line 46: | ||
* Loop to the next package... | * Loop to the next package... | ||
- | At its simplest, you can mirror the k/ directory, export | + | At its simplest, you can mirror the k/ directoryand |
- | OUTPUT in the environment, | + | This will build and install a set of kernel packages, using the newest |
- | This will build and install a set of kernel packages, using | + | source archive found in the current directory. There is no need to manually set |
- | the highest | + | the kernel version. |
- | directory. There is no need to manually set the kernel | + | |
- | version. If the version isn't what you expect, you may | + | |
- | need to remove the other files, leaving the one you need. | + | |
- | By exporting a few options | + | By exporting a few variables |
- | such as: | + | |
* The local version (explanation below.) | * The local version (explanation below.) | ||
Line 64: | Line 59: | ||
* Whether the packages are installed on the build system. | * Whether the packages are installed on the build system. | ||
- | Some minor tweaking of the scripts is necessary if we change | + | Some minor tweaking of the scripts is necessary if we change the default build |
- | the default build directory, and to stop the existing | + | directory, and we may not want to clobber |
- | symlinks in /boot from being clobbered. | + | are making a custom kernel. |
For this example I will build packages for linux-5.0.8, | For this example I will build packages for linux-5.0.8, | ||
Line 115: | Line 110: | ||
**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 295: | ||
(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 336: | ||
</ | </ | ||
- | == The Build == | + | === The Build === |
Then run the build script: | Then run the build script: | ||
Line 382: | Line 374: | ||
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 398: | ||
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 409: | ||
# 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. | ||
Line 449: | Line 436: | ||
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 455: | Line 442: | ||
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 461: | Line 448: | ||
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 489: | Line 476: | ||
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 local-version-setup.sh | + | |
- | If $OUTPUT or $VERSION | + | If $VERSION |
- | error. | + | |
Tweaks in a nutshell: | Tweaks in a nutshell: | ||
Line 511: | Line 496: | ||
==== 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 521: | Line 520: | ||
</ | </ | ||
- | The image name should be formatted like: | + | 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 532: | Line 531: | ||
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 ====== |