LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to update the kernel? (https://www.linuxquestions.org/questions/slackware-14/how-to-update-the-kernel-4175548937/)

GreenFireFly 07-25-2015 04:45 PM

How to update the kernel?
 
Hello Everyone,

Is there package for a new linux kernel i can install and kernel headers package? Is this all that is need to update the kernel? Any else the need to be done after?

BTW: I'm on Slackware 14.1 64bit Multilib.

Didier Spaier 07-25-2015 04:52 PM

Hello,

1) No package for a new kernel. Generally you'll have to build it yourself.
2) You don't have to change the kernel headers when you install a new kernel.
3) You will have to build and install the modules associated with the kernel.
4) Which new kernel do you want to install and why?
5) Read http://docs.slackware.com/howtos:sla...kernelbuilding first.

PS URL fixed, thanks lems.

1337_powerslacker 07-25-2015 08:48 PM

Quote:

Originally Posted by GreenFireFly (Post 5396254)
Hello Everyone,

Is there package for a new linux kernel i can install and kernel headers package? Is this all that is need to update the kernel? Any else the need to be done after?

BTW: I'm on Slackware 14.1 64bit Multilib.

Definitely follow Didier's advice; it is quite sound. I would add the proviso, however, that building the kernel, once you get the hang of it, will become second nature. Unlike some other distros, Slackware makes it easy to build from source directly from kernel.org. I myself am running the latest, 4.1.3, and it is quite stable. Just make sure you follow the directions in the tutorial specified by Didier. Having said that, have fun!

Regards,

Matt

lems 07-26-2015 06:31 AM

Didier's link corrected (a `g' was missing):
http://docs.slackware.com/howtos:sla...kernelbuilding

This document helped me, here are some notes I made based on the document above as well as LQ postings when I started to build my kernel:

Get a kernel tarball*. Then:
Code:

tar -C /usr/src -jxvf linux-kernel.tar.xz
cd /usr/src
rm linux
ln -s linux-new-kernel linux

(You can build your kernel as user as well, so you could unpack it in $HOME.)

* There is a script getkernel that I wrote which is able to get the latest kernel of your kernel minor version, or the latest stable one.

Then either copy the config from /boot or use:
zcat /proc/config.gz > /usr/src/linux/.config

Patrick releases configs for newer kernels as well, see the testing/ directory.

Then:
Code:

cd /usr/src/linux
make oldconfig
make menuconfig

Some options to consider:
Code:

General Setup -> Local version
General Setup -> Kernel .config support
General Setup -> Automatic process group scheduling
Processor type and features -> Timer Frequency -> 1000 Hz
Processor type and features -> Processor Family -> Your model
Processor type and features -> Preemption model -> Preemptible kernel
# I turned this off since I had problems when using the nvidia binary blob with it.
Kernel hacking -> Kernel debugging

After exiting and saving your changes, run this command to build the kernel:

Code:

make bzImage modules
Consider adding a -jX to the above make command to speed it up, where X is the number of your cores plus one.
You can either run `nproc', or `grep cores /proc/cpuinfo' to get the correct number.

Installing it (change the names/flavors [`generic', `smp'] according to your needs):
Code:

make modules_install
cp arch/x86_64/boot/bzImage /boot/vmlinuz-generic-version-LOCALVERSION
cp System.map /boot/System.map-generic-version-LOCALVERSION
cp .config /boot/config-generic-version-LOCALVERSION
cd /boot
rm System.map
ln -s System.map-generic-version-LOCALVERSION System.map

If using an initrd, you could run the following command:
Code:

/usr/share/mkinitrd/mkinitrd_command_generator.sh /boot/new-vmlinuz-image
Run the command it displays, and if using lilo, add this to your kernel/image section:
Code:

initrd = /boot/initrd.gz
Don't forget to run
Code:

lilo -v
Another, maybe cleaner way would be to use/write a SlackBuild to do this, so you can remove or upgrade the kernel as a package using Slackware's pkgtools. But I haven't looked into it yet.

oldtechaa 07-26-2015 07:12 AM

You could also use: slackware64-current kernel packages.

Building a kernel is a good exercise though. Besides what everybody else said, you can remove a lot of device drivers from the kernel if you know you'll never need them.

Once you do it a couple times, it'll be easy. I just started using Linux this past year and have probably already compiled kernels 50 times, mainly just for fun and speed and optimization.

Just be sure to build your filesystem into the kernel, so you don't need an initrd. Could someone explain why a generic kernel with no filesystems enabled is a good idea?

GreenFireFly 07-26-2015 11:12 AM

Hello Everyone,

Ok thanks for the info guys.

ryanpcmcquen 07-26-2015 09:47 PM

Late to the game, but I have a script that will compile kernels for you and even update LILO:

https://github.com/ryanpcmcquen/linu...re/kernelMe.sh

Just read the top of the script on how to use it, basically you run the script and it prompts you to choose mainline, stable or longterm, then figures out what the latest one is by parsing kernel.org. Some hidden features include passing a kernel config file to it (like the ones Pat puts up on ftp), like so:

Code:

KERNELCONFIG=/usr/src/config-huge-4.1.1.x64 sh kernelMe.sh
Note that the full path is required.

And building a generic kernel (instead of the default HUGE):

Code:

HUGE=n sh kernelMe.sh
I use it all the time to compile the latest stable kernel. Let me know if you have any issues, and if you find it useful, GitHub stars are always appreciated!

bassmadrigal 07-27-2015 01:28 PM

Quote:

Originally Posted by oldtechaa (Post 5396432)
You could also use: slackware64-current kernel packages.

Make sure you do an installpkg instead of an upgradepkg so that your original kernel can remain unaffected.

Quote:

Originally Posted by oldtechaa (Post 5396432)
Could someone explain why a generic kernel with no filesystems enabled is a good idea?

Because while I may use ext4, someone else may use btrfs, or JFS. Including all filesystems gets away from the idea behind a generic kernel, and including only the popular filesystems may make the people who don't use them think the kernel is "bloated".

Bertman123 08-11-2015 01:56 PM

Quote:

Originally Posted by ryanpcmcquen (Post 5396645)
Late to the game, but I have a script that will compile kernels for you and even update LILO:

https://github.com/ryanpcmcquen/linu...re/kernelMe.sh

Just read the top of the script on how to use it, basically you run the script and it prompts you to choose mainline, stable or longterm, then figures out what the latest one is by parsing kernel.org. Some hidden features include passing a kernel config file to it (like the ones Pat puts up on ftp), like so:

Code:

KERNELCONFIG=/usr/src/config-huge-4.1.1.x64 sh kernelMe.sh
Note that the full path is required.

And building a generic kernel (instead of the default HUGE):

Code:

HUGE=n sh kernelMe.sh
I use it all the time to compile the latest stable kernel. Let me know if you have any issues, and if you find it useful, GitHub stars are always appreciated!

I just tried this out and was easy enough to use. Thanks for this. Gave you a star on github.

ryanpcmcquen 08-11-2015 02:03 PM

Quote:

Originally Posted by Bertman123 (Post 5404446)
I just tried this out and was easy enough to use. Thanks for this. Gave you a star on github.

Thanks!

enorbet 08-12-2015 12:22 AM

Most of you probably already know it but Alien Bob's page on building a custom kernel is especially good.... located H E R E Besides the lil' tidbits like how to get a display (ex: in a terminal) for root while logged in as User, Eric has the courage to risk post good technique, even if it draws hipster criticism like for running "make xconfig". Doing configs for kernels in this way is not just a mere convenience, it is a better learning experience and safer because all 3 items (category, specific, and help) all show all the time if nothing else just to relieve doubt but also explained and creates an association for where, what, and why.

oldtechaa 08-12-2015 07:19 AM

I agree. I see no reason why one should not use xconfig when possible. It is far more convenient than config, especially when you decide you need to go back to a previous option, and the single-tree option makes it easier to have multiple branches open, but just use the arrow keys to navigate, versus menuconfig's single-layer view.


All times are GMT -5. The time now is 12:14 PM.