You are not logged in.
welcome to improve it, save it as kernel.sh, input “chmod +x ./kernel.sh && ./kernel.sh” in the termainal , it will be run, enjoy
#!/bin/bash
#This is a archlinux kernelcreat script, only to used by archlinux, welcom to use.
#This script is divided into two parts of build newkernel && load kernelmodules
#This script is free software. You can free to change and redistribute it. but you should open the s
ource code. There is NO WARRANTY, to the extent permitted by law.
#wrote by kindusmith@protonmail.com
####################The part of 1: build newkernel#################
read -p "Input your need to upgrade version of the linux kernel, please:" version
mkdir upgradekernel-${version} && cd upgradekernel-${version} \
&& wget https://git.kernel.org/pub/\
scm/linux/kernel/git/stable/linux.git/snapshot/linux-${version}.tar.gz \
&& tar -zxvf linux-${version}.tar.gz && cd linux-${version} && make clean && \
make mrproper && zcat /proc/config.gz >.config \
&& sed -i -e "s/CONFIG_LOCALVERSION=/#CONFIG_LOCALVERSION=/g" -e \
"s/#CONFIG_LOCALVERSION_AUTO=y/CONFIG_LOCALVERSION_AUTO=y/g" .config \
&& make -j8 && sudo cp -v arch/x86_64/boot/bzImage \
/boot/vmlinuz-linux-custom &&sudo make modules_install \
&& sudo cp -v /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/\
linux-custom.preset \
&& sudo sed -i -e "s/vmlinuz-linux/vmlinuz-linux-custom/g" -e \
"s/initramfs-linux/initramfs-linux-custom/g" -e \
"s/initramfs-linux-fallback/initramfs-linux-custom-fallback/g" \
/etc/mkinitcpio.d/linux-custom.preset \
&& sudo mkinitcpio -p linux-custom && sudo grub-mkconfig -o /boot/grub/grub.cfg \
&& sudo rm -rf upgradekernel-${version}
#####################The part of 2: load kernelmodules################
sudo pacman -Syu && sudo pacman -S nvidia-dkms acpi_call-dkms \
virtualbox-host-dkms bbswitch-dkms wireguard-dkms \
&& sudo modprobe vboxguest vboxvideos && sudo vboxreload \
&& sudo mkinitcpio -p linux-custom && sudo reboot
Last edited by kindusmith (2020-03-25 12:49:54)
Offline
Most archlinux users that want a custom kernel use a PKGBUILD , build with makepkg and install with pacman .
https://git.archlinux.org/svntogit/pack … ages/linux is how core/linux is built .
Btw, your script will fail if the user doesn't have sudo installed.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
And will prompt the user for a password every time you call sudo if they have sudo installed but timestamp_timeout=0 set in their sudoer defaults.
Mod note: Moving to Community Contributions.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline