Skip to content
/ upker Public

Simple tool that helps automating the configure/patch/build/install of a specified linux kernel. Assumes a mkinitcpio/grub environment.

Notifications You must be signed in to change notification settings

spacebub/upker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Simple tool that helps automating the configure/patch/build/install of a specified linux kernel.
Only works on a mkinitcpio/grub environment and only tested on arch.

  Downloads specified kernel, builds and installs it. If a previous kernel is provided,
cleans the boot directory, /var/lib and dkms modules as well as anything left in the build
directory.

Usage:
  upker -option value --flag

  The default base path is "$HOME/Kernel". The default archive format is "tar.xz".
These can be changed by editing the "## User Configuration" section of this scipt.

  The expected file name for the configuration file is either as majorversion.config (ex. for 6.1.4: 6.1.config)
or, for custom configs, suffixedversion.config (ex. for 6.1.4-suffix: 6.1-suffix.config).
If no configuration file is present, the configuration will have to manually be done during building.

  The expected file name for patch scripts is *-patch.txt. If no patch file is present patching will be skipped
(same as --nopatch). The patch file itself follows the format:
patchdir (absolute path, no ~/)
patch name (just the name, without a number or extension)
  Ex:
  If the directory is ~/Kernel/patches, and the required patches are 0001-first.patch and folder/0002-second.patch
and you want to skip the numbering:
    home/user/Kernel/patches
    *first.patch
    folder/*second.patch
  You can also provide the full names:
    home/user/Kernel/patches
    0001-first.patch
    folder/0002-second.patch

Examples:
  To download and install kernel 6.1.4 as 6.1.4-custom-suffix, remove 6.1.3-custom-suffix,
  build with LLVM and sign the image with sbctl:
    upker -ok 6.1.3 -k 6.1.4 -s custom-suffix --clang --sign

  To download and install version 6.1.4 without removing anything:
    upker -k 6.1.4 --install

  To remove all traces of kernel 6.1.4 including:
    upker -k 6.1.4 --clean

  To download and patch kernel without building or installing:
    upker -k 6.1.4 --download

  To download kernel without building, installing or patching:
    upker -k 6.1.4 --download --nopatch

  To build and install kernel with clang after one has been extracted with --download:
    upker -k 6.1.4 --resume --install --clang (Note: If a kernel has been installed, since the
                                              build directory is not cleaned, it can be reinstalled
                                              (rerun make install, create/run mkinitcpio profile,
                                              run grub-mkconfig) by running the same command (with
                                              or without --clang).
                                              If DKMS modules have been installed, they will not be
                                              reinstalled.)

  To attempt an automatic update:
    upker --autoupdate

Options:
    -p |--path /path/to/build   Specify a path to the build directory.
    -k |--kernel 6.1.4          Version number of the kernel to build.
    -ok|--oldkernel 6.1.4       Version number of old kernel to replace.
    -s |--suffix tkg            Kernel suffix to be appended at the end of the version number.
    -os|--oldsuffix tkg         Kernel suffix of the kernel to be replaced.
    -c |--config backup.config  Specify name of a custom config file located in the build directory.
    -P |--patch patchall.sh     Specify name of custom patch script located in the build directory.

Flags:
    --pull                      Update any git repository present in the base path.

    --install                   This will install relevant files to the modules and boot
                                folders, will refresh grub, run relevant dkms commands and
                                create a mkinitpcio profile. Enabled by default if old kernel
                                version is supplied.

    --clean=all/archive         Clean all traces of given kernel. This will clean the
                                boot and modules folders and will remove the build folder.
                                Accepts the following arguments:
                                  all     - Deletes everything: dkms modules, kernel modules,
                                        images, signatures, boot entries, build folder but
                                        keeps the archive. Does not work without a kernel
                                        version.
                                  archive - Deletes the associated kernel's archive. If
                                        no kernel version is specified, deletes all kernel
                                        archives.


    --download                  Download the kernel and prepare the directory. This will
                                also apply patches assuming the nopatch flag is omitted.
                                If a kernel folder with the same version already exists
                                it will be replaced.

    --resume                    If a corresponding build directory exists, skips to build.
                                Does not assume --install, if needed it should be supplied
                                separately.

    --nopatch                   Skip the patching process defined in the patch script.

    --clang                     Build kernel with LLVM.

    --sign                      Assuming sbctl is installed and configured and secure boot
                                has already been set up, signs the new image.

    --autoupdate                Tries to query the latest available kernel, compares it to
                                the currently used version, gets the current suffix, gets
                                the compiler used and uses the information to configure,
                                build and install the newer kernel. Overwrites every other
                                flag/option.

    --force                     Will force execution of subsequent steps after error.
                                Not recommended since most steps rely on the successful
                                completion of previous ones.

Other:
    --help                      Show this text and exit.
    --version                   Show script version.

About

Simple tool that helps automating the configure/patch/build/install of a specified linux kernel. Assumes a mkinitcpio/grub environment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages