From 233caa0d3ef5c95320a4ee90b307f145a82f5e9d Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sat, 20 Nov 2021 02:12:32 +0000 Subject: [PATCH] improve linux build scripts --- _posts/2021-11-06-linux-contribution.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/_posts/2021-11-06-linux-contribution.md b/_posts/2021-11-06-linux-contribution.md index 3b0c0a6..2393c52 100644 --- a/_posts/2021-11-06-linux-contribution.md +++ b/_posts/2021-11-06-linux-contribution.md @@ -39,16 +39,17 @@ pacman -S flex base-devel xmlto kmod inetutils bc libelf git cpio perl tar xz {% highlight bash %} zcat /proc/config.gz > .config {% endhighlight %} -- Make! +- Make! The `-j8` parameter specifies the number of threads to be used by the build. My CPU has 8 threads and so I use it all. {% highlight bash %} make -j8 {% endhighlight %} -- Install the newly built Kernel +- Install the newly built Kernel. I create this as a script file and run it after every build from the root of repository. {% highlight bash %} -make modules_install -VERSION=5.10 -cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-linux${VERSION} -mkinitcpio -k $VERSION -g /boot/initramfs-linux${VERSION}.img +make -j8 modules_install +RELEASE=$(cat include/config/kernel.release) +cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-linux${RELEASE} +mkinitcpio -k $RELEASE -g /boot/initramfs-linux${RELEASE}.img +mkinitcpio -k $RELEASE -s autodetect -g /boot/initramfs-linux-fallback${RELEASE}.img {% endhighlight %} - Run grub-mkconfig to add a menu option for this new kernel {% highlight bash %}