Giter VIP home page Giter VIP logo

ekernel's Introduction

ekernel - Custom Gentoo EFI Stub Kernel Updater

Automate custom gentoo kernel update tasks.

The update process can be divided into the following steps:

  1. configure - copy and update the previous .config
  2. build - compile the new kernel and install modules
  3. install - copy the new EFI stub kernel image to the EFI system partition
  4. commit - commit the new config with a detailed commit message
  5. clean - remove unused kernel source directories, modules and boot images

This tool aims to minimize the effort by automating the previous steps, while ensuring maximum flexibility w.r.t. configuration changes.

Tasks

The following variables will be used throughout this description:

old - previous kernel's source directory

new - new kernel's source directory

esp - directory containing the live kernel image on the EFI system partition (/boot/EFI/Gentoo/bootx64.efi)

jobs - number of parallel make jobs given by -j (default: 64)

version - new kernel's version string

ekernel-configure

Runs make menuconfig if the current config file is missing, or no other kernel is installed

Otherwise, copy the current config file to the new source directory if it doesn't exist (prevent accidental overwrite).

cp -n ${old}/.config ${new}

Get newly added config options and store the result in ${new}/.newoptions.

cd ${new}
make listnewconfig > ${new}/.newoptions

If -l was selected: print newly added config options and exit.

cat ${new}/.newoptions
exit

Interactively update the previous config and exit if aborted.

cd ${new}
make oldconfig || exit

ekernel-build

Build and install modules, using the given number of jobs.

make -j ${jobs} && make modules_install

ekernel-install

Update symlink /usr/src/linux to the new source directory.

eselect kernel set $(basename ${new})

Install the EFI stub kernel image (and a backup copy to revert to in case something breaks after a subsequent kernel update).

mount /boot
cp ${new}/arch/x86_64/boot/bzImage ${esp}/bootx64.efi
cp ${new}/arch/x86_64/boot/bzImage ${esp}/gentoo-${version}.efi

Rebuild external modules.

emerge @module-rebuild

ekernel-clean

Remove unused kernel source directories, modules and boot images.

emerge --depclean sys-kernel/gentoo-sources
rm -rf $(find /usr/src/ -maxdepth 1 -name "linux-*" | sed -e '/${old}/d' -e '/${new}/d')
rm -rf $(ls -1 /lib/modules/ | sed -e '/${old}/d' -e '/${new}/d')
rm -rf $(ls -1 ${esp} | sed -e '/${old}/d' -e '/${new}/d' -e '/bootx64/d')

The default is to keep the previous kernel version in case something goes horribly wrong.

ekernel-commit

Commit the new kernel config with a detailed commit message.

git add -f /usr/src/linux/.config
git commit -S -m "${msg}"

The message will not only contain the version change, but also details about the newly added or removed options.

Installation

You may use the ebuild app-admin/ekernel from my personal repository.

Requirements

ekernel's People

Contributors

phlo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.