misc/linux/install.sh
Georg Pfuetzenreuter 852c2e4699
Add kernel build and install scripts
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-08-23 15:05:08 +02:00

31 lines
1.1 KiB
Bash
Executable File

#!/bin/sh -Cefu
# Copies a newly built Linux, creates an initrd image and a GRUB boot entry
#
# Copyright 2024 Georg Pfuetzenreuter <mail+opensuse@georg-pfuetzenreuter.net>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
builddir=/tmp/build
commit="${1?Specify commit hash}"
make -C/usr/src/linux -j6 O="$builddir" modules_install
make -C/usr/src/linux O="$builddir" install
VMLINUZ=/boot/vmlinuz-"$commit"
INITRD=/boot/initrd-"$commit"
LINUX_VERSION=6.4.0-default-dirty
install -vm0644 "$builddir"/arch/x86/boot/bzImage "$VMLINUZ"
dracut --kernel-image "$VMLINUZ" "$INITRD" "$LINUX_VERSION"
grub2-mkconfig -o /boot/grub2/grub.cfg