[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.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
slackwarearm:cstmz_kernel [2022/07/08 07:47 (UTC)] mozesslackwarearm:cstmz_kernel [2023/06/06 16:36 (UTC)] (current) mozes
Line 5: Line 5:
 ^  ^  ^ ^  ^  ^
 | Document | Describe how to customise the Slackware AArch64 Kernel packages |  | Document | Describe how to customise the Slackware AArch64 Kernel packages | 
-| Version | 1.00July 2022 |+| Version | 1.02June 2023 |
 | Author | Stuart Winter <mozes@slackware> | | Author | Stuart Winter <mozes@slackware> |
 | References | [[http://ftp.arm.slackware.com/slackwarearm/slackwareaarch64-current/source/README_SOURCE.txt|Slackware ARM source tree README]] | | References | [[http://ftp.arm.slackware.com/slackwarearm/slackwareaarch64-current/source/README_SOURCE.txt|Slackware ARM source tree README]] |
 +| See also | [[cstmz_kernel_rpi_selfbuild|Raspberry Pi Kernel fork self build]] |
  
 ==== Caveats / Warnings ==== ==== Caveats / Warnings ====
Line 16: Line 17:
   * When customising the Kernel, it's best to remain at the same major version and patch level.  For example, if the Slackware AArch64 Kernel is Linux 5.18.3, it's safer to remain either at this exact version or to use another Kernel within the 5.18 series rather than moving to 5.19 (or even backwards to 5.17).   * When customising the Kernel, it's best to remain at the same major version and patch level.  For example, if the Slackware AArch64 Kernel is Linux 5.18.3, it's safer to remain either at this exact version or to use another Kernel within the 5.18 series rather than moving to 5.19 (or even backwards to 5.17).
  
 +<note tip>If you want to add support for a Hardware Model that isn't yet supported, building a custom Kernel is just one part of the integration.  Please read the [[slackwarearm:development_refguide_di|Slackware ARM Direct Integration Guide]].</note>
  
 === Raspberry Pi Kernel fork === === Raspberry Pi Kernel fork ===
Line 27: Line 29:
  
 //You should consider using the Raspberry Pi Kernel fork as an **experimentation** rather than a suggestion or endorsement.// //You should consider using the Raspberry Pi Kernel fork as an **experimentation** rather than a suggestion or endorsement.//
 +
 +=== Raspberry Pi & alternate Kernel Fork: automated build system ===
 +
 +
 +To simplify building the Raspberry Pi Kernel fork, you should follow [[cstmz_kernel_rpi_selfbuild|this guide]].
 +
 +You can also use this guide to help get started using the script for building Slackware packages from alternate source repositories, which helps when Hardware Model vendors have yet to upstream their changes to the mainline Linux Kernel.
  
 ===== Introduction ===== ===== Introduction =====
Line 32: Line 41:
 If you'd like to customise the Linux Kernel for your system - perhaps to add some hardware support or a Kernel feature, or perhaps add a patch, the easiest way is to use the Slackware ARM Kernel package build scripts.  This is because the Kernel and Operating System Initial RAM Disk are tightly coupled. If you'd like to customise the Linux Kernel for your system - perhaps to add some hardware support or a Kernel feature, or perhaps add a patch, the easiest way is to use the Slackware ARM Kernel package build scripts.  This is because the Kernel and Operating System Initial RAM Disk are tightly coupled.
  
 +
 +<note tip>If you are rebuilding your Kernel to enable some additional hardware support or a Kernel feature, please drop a note to [[https://www.linuxquestions.org/questions/slackware-arm-108/|the forum]].  The Slackware ARM/AArch64 Kernels were based on default platform configurations, but the aim is to have behavioural and feature parity with Slackware x86/64 where possible. Usually any Kernel configuration change requests will be included within the official Slackware Kernel package.</note>
  
 === The Slackware ARM/AArch64 build system === === The Slackware ARM/AArch64 build system ===
Line 71: Line 82:
 rsync \ rsync \
    --delete -Pavv \    --delete -Pavv \
-   ftp.slackware.uk::slackwarearm/slackwareaarch64-current .+   ftp.arm.slackware.com::slackwarearm/slackwareaarch64-current .
 </code> </code>
  
Line 78: Line 89:
 <note important>The full 'slackware' tree is required because the Kernel build script requires some of the package files to be available during build time, as certain tools and libraries are extracted from them to build the OS InitRD (Operating System Initial RAM Disk).</note> <note important>The full 'slackware' tree is required because the Kernel build script requires some of the package files to be available during build time, as certain tools and libraries are extracted from them to build the OS InitRD (Operating System Initial RAM Disk).</note>
  
- 
-=== Remove the existing Kernel packages from the downloaded tree === 
- 
-When building the vast majority of packages from the Slackware AArch64 source tree, the build system will remove any existing package prior to creating a new one (if configured in ''/usr/share/slackdev/slackdev.config''), but this isn't the case for the Kernel packages, so they should be removed manually. 
- 
-Continuing within the directory above: 
- 
-<code> 
-$ cd slackwareaarch64-current/slackware 
-$ rm -fv a/kernel*{armv5,armv7,armv8}* 
-$ rm -fv k/kernel-source* 
-$ rm -fv d/kernel-headers* 
-</code> 
  
 ==== Install the prerequisite packages ==== ==== Install the prerequisite packages ====
Line 143: Line 141:
 <code> <code>
 $ cd /tmp ; mkdir rpikernel ; cd rpikernel $ cd /tmp ; mkdir rpikernel ; cd rpikernel
-$ git clone --depth=1 --branch rpi-5.18.y https://github.com/raspberrypi/linux.git linux-rpi-5.18.y+$ git clone --depth=1 --branch rpi-6.1.y https://github.com/raspberrypi/linux.git linux-rpi-6.1.y
 </code> </code>
  
Line 156: Line 154:
 $ kver=$( echo "$(sed -ne's/^VERSION *= *//p' Makefile).$(sed -ne's/^PATCHLEVEL *= *//p' Makefile).$(sed -ne's/^SUBLEVEL *= *//p' Makefile)" ) $ kver=$( echo "$(sed -ne's/^VERSION *= *//p' Makefile).$(sed -ne's/^PATCHLEVEL *= *//p' Makefile).$(sed -ne's/^SUBLEVEL *= *//p' Makefile)" )
 $ popd $ popd
-$ mv -fv linux-rpi-5.18.y linux-$kver+$ mv -fv linux-rpi-linux-$kver
 </code> </code>
  
Line 194: Line 192:
 <code> <code>
 $ egrep '^export VERSION.*' /home/mozes/slackware/slackwareaarch64-current/source/k/arm/build  $ egrep '^export VERSION.*' /home/mozes/slackware/slackwareaarch64-current/source/k/arm/build 
-export VERSION=${VERSION:-5.18.8}+export VERSION=${VERSION:-6.1.27}
 </code> </code>
  
Line 205: Line 203:
 $ cd /usr/src/ $ cd /usr/src/
 $ ls -d linux-* -la $ ls -d linux-* -la
-drwxr-xr-x 24 root root 4096 Jun 30 10:41 linux-5.18.8/+drwxr-xr-x 24 root root 4096 Jun 30 10:41 linux-6.1.27/
 </code> </code>
  
Line 220: Line 218:
 Example: Example:
 <code> <code>
-$ cd /usr/src/linux-5.18.8+$ cd /usr/src/linux-*
 $ make menuconfig $ make menuconfig
 </code> </code>
Line 262: Line 260:
 ===== Building Kernel Packages ===== ===== Building Kernel Packages =====
  
-Now that you have customised the Kernel, you can build the Kernel packages:+Now that you have customised the Kernel, it's time to build the Kernel packages
  
 As **root**: As **root**:
 +
 +== Create a directory to receive the new packahges ==
 +
 +To avoid overwriting the official packages within the Slackware tree, we will store them in an alternate location.
 +
 +<code>
 +$ mkdir -p /tmp/testpkgs
 +</code>
 +
 +== Enter the Slackware ARM Kernel source directory ==
 +
 +
 <code> <code>
 $ cd ~/slackwareaarch64-current/source/k $ cd ~/slackwareaarch64-current/source/k
 </code> </code>
 +
 +== Build the Kernel packages ==
 +
 +<note warning>The ''kernel.SlackBuild'' Kernel build system replaces /lib/modules/<Kernel version you're building> If the Kernel version number you're building is identical to the version of the running Kernel (use ''uname -r'' to check), you **must** reinstall the ''a/kernel-modules'' package belonging to your running Kernel.  If not your machine will most likely fail to boot properly, with the Kernel complaining about magic numbers being out of alignment when loading a variety of Kernel modules.</note>
  
 For the standard/mainline Slackware Kernel source: For the standard/mainline Slackware Kernel source:
 <code> <code>
-$ ./arm/build --srcdir /usr/src --noconfig --nopatches+$ ./arm/build --srcdir /usr/src --pkgstoreoverride /tmp/testpkgs --noconfig --nopatches
 </code> </code>
  
Line 277: Line 292:
  
 <code> <code>
-$ ./arm/build --srcdir /usr/src/rpikernel --noconfig --nopatches+$ ./arm/build --srcdir /usr/src/rpikernel --pkgstoreoverride /tmp/testpkgs --noconfig --nopatches 
 </code> </code>
  
 <note>The meaning of the command line options: ''--srcdir'' instructs the kernel.SlackBuild to use the source tree ''linux-<version>'' found within ''/usr/src/linux'' rather than unpacking the source archive contained within the Slackware AArch64 source tree.</note> <note>The meaning of the command line options: ''--srcdir'' instructs the kernel.SlackBuild to use the source tree ''linux-<version>'' found within ''/usr/src/linux'' rather than unpacking the source archive contained within the Slackware AArch64 source tree.</note>
-<note>''--noconfig'' instructs the kernel.SlackBuild not to install the Slackware Kernel configuration (as this would overwrite your customised version)</note>+<note>''--noconfig'' instructs the kernel.SlackBuild not to install the Slackware Kernel configuration (as this would overwrite your customised version).</note>
 <note>''--nopatches'' instructs the kernel.SlackBuild not to apply its patch set, since it's already been applied. In the case of using the Raspberry Pi Kernel fork, there's no need to apply the patches for the mainline Kernel.</note> <note>''--nopatches'' instructs the kernel.SlackBuild not to apply its patch set, since it's already been applied. In the case of using the Raspberry Pi Kernel fork, there's no need to apply the patches for the mainline Kernel.</note>
 +<note>''--pkgstoreoverride'' instructs the kernel.SlackBuild to store the new packages in the directory specified.</note>
  
 The Kernel packages will build.   The Kernel packages will build.  
Line 314: Line 330:
 ===== Installing/upgrading to the new Kernel packages ===== ===== Installing/upgrading to the new Kernel packages =====
  
-If the build process worked, your Kernel packages will have been installed into your Slackware AArch64 tree within the appropriate package 'seriesdirectories: +If the build process worked, your Kernel packages will have been installed into the directory specified (''/tmp/testpkgs'').
 As **root**: As **root**:
 <code> <code>
-$ cd ~/tgzstash/+$ cd /tmp/testpkgs
 </code> </code>
  
Line 378: Line 393:
  
 <code> <code>
-$ ./arm/build+$ mkdir -p /tmp/testpkgs 
 +$ ./arm/build --pkgstoreoverride /tmp/testpkgs
 </code> </code>
  
-As with the Kernel packages, your new ''hwm-bw-raspberrypi'' package will be copied into ''~/tgzstash/a'' from where you can install it with ''upgradepkg''.+As with the Kernel packages, your new ''hwm-bw-raspberrypi'' package will be stored within ''/tmp/testpkgs'' from where you can install it with ''upgradepkg''.
  
 <code> <code>
-$ cd ~/tgzstash/a+$ cd /tmp/testpkgs/a
 $ upgradepkg hwm-bw-raspberrypi-*.t?z $ upgradepkg hwm-bw-raspberrypi-*.t?z
 </code> </code>
  
 +<note important>Only the ''source/k'' and ''source/a/hwm-bw-raspberrypi'' build scripts support the ''--pkgstoreoverride'' command line operator.  To adjust the output directory for other packages, you should edit their ''arm/build'' scripts.</note>
 slackwarearm:cstmz_kernel ()