LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices


Reply
  Search this Thread
Old 01-07-2018, 12:15 PM   #1
glorsplitz
Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 614

Rep: Reputation: 119Reputation: 119
howto build latest kernel? been dragging my feet on this


Following
https://docs.slackware.com/howtos:ha...m:raspberrypi3

says can use SARPi Project to install 14.2,-current

I did.

Does the following build slackwarearm kernel NOT rpi-update flavored one?

then says:
I recommend to build your own Linux kernel packages because the kernel you are
running does not match with the installed Slackware ARM packages

https://www.raspberrypi.org/document...el/building.md

Next get the sources, which will take some time:
Code:
git clone --depth=1 https://github.com/raspberrypi/linux
RASPBERRY PI 2, PI 3, AND COMPUTE MODULE 3 DEFAULT BUILD CONFIGURATION
Code:
cd linux
KERNEL=kernel7
make bcm2709_defconfig
Build and install the kernel, modules, and Device Tree blobs; this step takes a long time:
Code:
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img

Is that all there is to it? THANKS!
 
Old 01-07-2018, 05:53 PM   #2
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 522

Rep: Reputation: 276Reputation: 276Reputation: 276
I've been considering this for some time now, but due to my personal multimedia needs (DVB & Analogue Sound) I got stuck with the official (Raspbian) 4.4.50 kernel, the last one on which DVB under USB still works and the new firmware with the latest Analogue Sound improvements, that are stressing the GPU too much, is not applied. There are theories that the firmware is "independent" from the kernel and that you can play with them independently, might break some device-tree updated modules, but that never worked for me - no boot if I changed only the firmware files (downgrade).

On your last question, take a look here for some more info:
https://elinux.org/Raspberry_Pi_Kernel_Compilation

And, be aware that you might end up with some issues if you go for the very last kernel version - check on their forums for other peoples successes before picking the kernel source version. Example (I was justme123):
https://www.raspberrypi.org/forums/v...f=107&t=187222
https://github.com/bengtmartensson/lirc_rpi/issues/8

Last edited by abga; 01-07-2018 at 06:01 PM. Reason: + extra details
 
Old 01-07-2018, 06:19 PM   #3
Exaga
Member
 
Registered: Nov 2012
Posts: 127

Rep: Reputation: Disabled
Quote:
Originally Posted by glorsplitz View Post
Does the following build slackwarearm kernel NOT rpi-update flavored one?
By using the Raspberry Pi GitHub Linux repository, what you're actually downloading is a modified Linux source which includes support (drivers, configs, etc.) for the RPi devices. There's no such thing as a Slackware ARM kernel (although I can understand what you mean by that). There's just the Linux kernel. The Linux kernel source you're downloading from the Raspberry Pi GitHub repository is what you might describe as the 'rpi-update flavoured one'.

Quote:
Originally Posted by glorsplitz View Post
then says:
I recommend to build your own Linux kernel packages because the kernel you are
running does not match with the installed Slackware ARM packages
Who or what says this?

Quote:
Originally Posted by glorsplitz View Post
The above documentation can be useful, especially when troubleshooting, but be mindful that everything published on that website is geared up for Raspbian. So, if you're building a kernel on Slackware ARM, these instructions are somewhat lacking in depth and explanation. I guess it's OK for Raspbian users who aren't too bothered about what they're doing, as long as it works in the end.

Quote:
Originally Posted by glorsplitz View Post
Next get the sources, which will take some time:
Code:
git clone --depth=1 https://github.com/raspberrypi/linux
RASPBERRY PI 2, PI 3, AND COMPUTE MODULE 3 DEFAULT BUILD CONFIGURATION
Code:
cd linux
KERNEL=kernel7
make bcm2709_defconfig
Build and install the kernel, modules, and Device Tree blobs; this step takes a long time:
Code:
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
Is that all there is to it? THANKS!
In a word, "No". There's more to consider than just that. It's a shame FatDog.eu is still down because I published a forum post on how to compile your own Linux kernel on the RPi devices. However, there's no harm in going through it again. If only for your peace of mind.

Firstly, which RPi are you using to build? I highly recommend not attempting to do this on a RPi2 or RPi3 without a rather large heat-sink attached to the SoC. On the RPi3 I would also recommend a fan to accompany the rather large heat-sink. When you're using all four cores to compile (i.e. gcc 'make -j4' option) the SoC gets very hot, very quickly! Then it'll crash at 88-90 Celsius -by design- as a protection measure to stop any permanent damage being done. So, with that in mind, cooling the SoC is a top priority.

Download the Linux kernel and RPi firmware source using 'git'. I usually work in the /tmp directory.

Code:
~# git clone git://github.com/raspberrypi/linux.git linux
~# git clone git://github.com/raspberrypi/firmware.git firmware
You'll be downloading the 'stable' release or whatever the RPi guys call it. I believe the current release is kernel 4.9.x at this time. You can check which branch you're using with the following command.

Code:
~# cd linux
~# git status
On branch rpi-4.9.y
Your branch is up to date with 'origin/rpi-4.9.y'.

nothing to commit, working tree clean
So, if you want to build another Linux kernel release you can take a look at the available RPi GitHub branches with this command.

Code:
~# git branch -a
If/when you want to switch to another branch (for example: Linux kernel 4.14) use this command.

Code:
~# git checkout -f rpi-4.14.y
Branch 'rpi-4.14.y' set up to track remote branch 'rpi-4.14.y' from 'origin'.
Switched to a new branch 'rpi-4.14.y'
Remember if you do switch kernel branches then you'll have to checkout the firmware branches to match the kernel. Use the RPi firmware 'master' branch for kernel 4.9.x and 'next' branch for kernel 4.14/4.15.

So, you've got all you need to build a kernel. Using the RPi2/3 defconfig here will save a *lot* of time. No need to start configuring your own kernel parameters if you don't want to. Everything is already supported and included for the Raspberry Pi in the Linux kernel source you've downloaded from the RPi repository. First make the kernel .config before building the kernel.

Code:
~# make bcm2709_defconfig
~# make -j4 Image
~# make -j4 dtbs
~# make -j4 modules
~# make modules_install
Now backup *every thing* in your /boot directory before continuing. I recommend putting it on a USB memory stick or another SD card, in case things go pear-shaped. Then you can start copying over the new firmware, overlays, dtbs, kernel, etc.

Code:
~# cd /tmp/firmware
~# cp -av overlays bcm*.dtb bootcode.bin COPYING.linux fixup*.dat LICENCE.broadcom start*.elf /boot/
~# cd /tmp/linux
~# cp -av arch/arm/boot/Image /boot/kernel7.img
~# cp -av System.map /boot/System.map
~# cp -av arch/arm/boot/dts/*.dtb /boot/
~# cp -av arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
That's it. You can 'reboot' and hopefully enjoy your system with a new kernel and firmware.

Last edited by Exaga; 01-08-2018 at 03:50 AM. Reason: forgot to copy System.map to /boot dir
 
3 members found this post helpful.
Old 01-07-2018, 06:52 PM   #4
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 522

Rep: Reputation: 276Reputation: 276Reputation: 276
Quote:
Originally Posted by Exaga View Post
Now backup *every thing* in your /boot directory before continuing. I recommend putting it on a USB memory stick or another SD card, in case things go pear-shaped. Then you can start copying over the new firmware, overlays, dtbs, kernel, etc.
Backing up /lib/firmware & /lib/modules before the new kernel installation might be also useful if things go wrong with the new compilation.

I was under the apparent false impression that you need the Linaro compiler to get their kernel compiled. Thanks for your HowTo, saved it!
 
1 members found this post helpful.
Old 01-07-2018, 07:41 PM   #5
glorsplitz
Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 614

Original Poster
Rep: Reputation: 119Reputation: 119
Exaga, Thank you, looks like what I've been looking for.

Quote:
Originally Posted by Exaga View Post
Who or what says this?
here, just above "5. Tips and tricks". I guess you did, bottom of page says: "Sources Originally written by Exaga"

Quote:
Originally Posted by Exaga View Post
It's a shame FatDog.eu is still down because I published a forum post on how to compile your own Linux kernel on the RPi devices.
Maybe if you still have the source, you could provide it as attachment?


On one of my rpi3 I've been using rpi-update, to see how much my mileage would vary, kernel is 4.9.73-v7+, however slackwarearm current kernel is 4.14.12, since all the other updates are for kernel 4.14.12, I'd like to get the kernel proper.

Will be looking to try this out soon, as time permits and report back. Cheers! and thanks for prompt response.

Last edited by glorsplitz; 01-07-2018 at 07:50 PM.
 
Old 01-07-2018, 08:07 PM   #6
Exaga
Member
 
Registered: Nov 2012
Posts: 127

Rep: Reputation: Disabled
Quote:
Originally Posted by abga View Post
Backing up /lib/firmware & /lib/modules before the new kernel installation might be also useful if things go wrong with the new compilation.
Backing up is always good policy. There's never a bad time to backup. Nothing I'm advising will touch or have anything to do with existing firmware or modules. They will all be supplanted by newer versions but not removed. So, if the worst thing happens, just copy the contents of the /boot partition back onto the SD card from the backup which was made. After that, normal operations resume.

A better option would be to use a seperate SD card with Slackware ARM installed, for testing and to copy the new stuff on to. Then you won't risk breaking your working Slackware ARM system.

Quote:
Originally Posted by abga View Post
I was under the apparent false impression that you need the Linaro compiler to get their kernel compiled. Thanks for your HowTo, saved it!
LMFAO! @ Linaro compiler. I bet you read that on the Raspberry Pi forums or some other equally 'reliable' resource site. Seriously, all you need is some Jaffa cakes, Slackware ARM, gcc, a little 'know-how', and Jaffa cakes.

Don't thank me. Thank MoZes and the rest of the Slackware Team. They are the ones who create all the magic. If it wasn't for them you wouldn't be learning anything from me.
 
Old 01-07-2018, 08:29 PM   #7
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 522

Rep: Reputation: 276Reputation: 276Reputation: 276
Quote:
Originally Posted by Exaga View Post
Nothing I'm advising will touch or have anything to do with existing firmware or modules.
Wouldn't:
Code:
~# make -j4 modules_install
overwrite /lib/modules/kernel-version ? If it's the same kernel version that is being manually compiled?

Last edited by abga; 01-07-2018 at 08:35 PM. Reason: missed 1 sentence
 
Old 01-07-2018, 08:34 PM   #8
Exaga
Member
 
Registered: Nov 2012
Posts: 127

Rep: Reputation: Disabled
Quote:
Originally Posted by glorsplitz View Post
Exaga, Thank you, looks like what I've been looking for.

here, just above "5. Tips and tricks". I guess you did, bottom of page says: "Sources Originally written by Exaga"

Maybe if you still have the source, you could provide it as attachment?


On one of my rpi3 I've been using rpi-update, to see how much my mileage would vary, kernel is 4.9.73-v7+, however slackwarearm current kernel is 4.14.12, since all the other updates are for kernel 4.14.12, I'd like to get the kernel proper.

Will be looking to try this out soon, as time permits and report back. Cheers! and thanks for prompt response.
Actually, the whole page was not written by me. I'm only responsible for the top part of that page. The "Manual install method without a Raspbian image" section, and below it, was submitted by yugiohjcj. I'm guessing, the RPi documentation was the only link(s) he could find to building a kernel for the device.

I did do a SARPi test-build using the 4.14.x kernel just before Christmas. It hasn't been tested yet.

The sources just mean who has submitted content to that page. There is no original source, per se.

You're welcome to any of my advice that may be useful to you. I really like to read/hear about Slackware ARM users doing exactly what you're planning to do. There's no better Linux learning curve than Slackware and therefore why waste the opportunity? It would be great if there were lots of Slackware ARM users all running different devices. All chipping in and sharing their work/knowledge and experiences; building kernels and packages, writing Slackdoc pages, posting on these forums, creating blogs, making 'how-to' guides, etc. We'll only get to that point by people doing their own thing and learning by it.
 
1 members found this post helpful.
Old 01-07-2018, 08:44 PM   #9
Exaga
Member
 
Registered: Nov 2012
Posts: 127

Rep: Reputation: Disabled
Quote:
Originally Posted by abga View Post
Wouldn't:
Code:
~# make -j4 modules_install
overwrite /lib/modules ?
Yes, if you were compiling the same version (e.g. 4.9.73 or 4.14.10) but then there wouldn't be much point in doing that unless you really had to (or wanted to?).

Just as an example: if you have 4.9.70 installed and you are building 4.9.73 then modules_install will not overwrite /lib/modules/4.9.70-v7-arm - it will modules_install to /lib/modules/4.9.73-v7-arm

<edit> Afterthought... there's always this:
https://www.kernel.org/doc/Documenta...ld/modules.txt
Code:
modules_install
		Install the external module(s). The default location is
		/lib/modules/<kernel_release>/extra/, but a prefix may
		be added with INSTALL_MOD_PATH (discussed in section 5).

Last edited by Exaga; 01-07-2018 at 08:57 PM. Reason: afterthought
 
Old 01-07-2018, 09:10 PM   #10
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 522

Rep: Reputation: 276Reputation: 276Reputation: 276
Quote:
Originally Posted by Exaga View Post
Yes, if you were compiling the same version (e.g. 4.9.73 or 4.14.10) but then there wouldn't be much point in doing that unless you really had to (or wanted to?).

Just as an example: if you have 4.9.70 installed and you are building 4.9.73 then modules_install will not overwrite /lib/modules/4.9.70-v7-arm - it will modules_install to /lib/modules/4.9.73-v7-arm

<edit> Afterthought... there's always this:
https://www.kernel.org/doc/Documenta...ld/modules.txt
Code:
modules_install
		Install the external module(s). The default location is
		/lib/modules/<kernel_release>/extra/, but a prefix may
		be added with INSTALL_MOD_PATH (discussed in section 5).
Thanks for the confirmation, I do indeed need to recompile the same kernel for some drivers patches and maybe check some optimizations - the Raspbian provided kernel 4.4.38 (if my memory serves me well) was performing pretty bad and it was the point I started considering recompiling it on my own and checking the configuration - "optimization recipe".

There's an additional step you might have forgotten in your kernel compilation HowTo from above (many people do), it's about installing the device firmware that comes with the kernel:
Code:
make firmware_install
This is why I hinted the extra step (after the /boot backup) for a backup of both /lib/modules/ & /lib/firmware/
 
Old 01-07-2018, 09:42 PM   #11
Penthux
Member
 
Registered: Dec 2008
Location: Middlesbrough, UK
Distribution: Slackware
Posts: 231

Rep: Reputation: 67
Quote:
Originally Posted by abga View Post
There's an additional step you might have forgotten in your kernel compilation HowTo from above (many people do), it's about installing the device firmware that comes with the kernel:
Code:
make firmware_install
This is why I hinted the extra step (after the /boot backup) for a backup of both /lib/modules/ & /lib/firmware/
Yes. I've been managing the SARPi Project now for over 5 years and in all that time I've forgotten 'make firmware_install'.

Intentionally.
 
1 members found this post helpful.
Old 01-08-2018, 10:56 AM   #12
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,603

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by Exaga View Post
Firstly, which RPi are you using to build? I highly recommend not attempting to do this on a RPi2 or RPi3 without a rather large heat-sink attached to the SoC. On the RPi3 I would also recommend a fan to accompany the rather large heat-sink. When you're using all four cores to compile (i.e. gcc 'make -j4' option) the SoC gets very hot, very quickly! Then it'll crash at 88-90 Celsius -by design- as a protection measure to stop any permanent damage being done. So, with that in mind, cooling the SoC is a top priority.
With my Raspberry Pi 3 I've had problems with the device locking up compiling heavy stuff. That was solved here without a heatsink and without a fan by downclocking it. Takes longer to compile, but not that much. Adding this to /boot/config.txt was sufficient for me (I added the links as a comment to myself). Not sure though if all three lines are really needed:
Code:
# see forum.fatdog.eu/viewtopic.php?t=139
# or www.raspberrypi.org/forums/viewtopic.php?t=139013&p=923582
force_turbo=0
arm_freq=900
arm_freq_min=600

Quote:
Originally Posted by Exaga View Post
Download the Linux kernel and RPi firmware source using 'git'. I usually work in the /tmp directory.

[...]

That's it. You can 'reboot' and hopefully enjoy your system with a new kernel and firmware.
Many thanks, I very much appreciate that you took the time to write it up (and more so that I could download your updated kernel/modules/firmware packages in the past)! Especially the Raspberry Pi firmware stuff had left me puzzled before.
 
Old 01-08-2018, 03:01 PM   #13
Exaga
Member
 
Registered: Nov 2012
Posts: 127

Rep: Reputation: Disabled
Quote:
Originally Posted by titopoquito View Post
With my Raspberry Pi 3 I've had problems with the device locking up compiling heavy stuff. That was solved here without a heatsink and without a fan by downclocking it. Takes longer to compile, but not that much. Adding this to /boot/config.txt was sufficient for me (I added the links as a comment to myself). Not sure though if all three lines are really needed:
Code:
# see forum.fatdog.eu/viewtopic.php?t=139
# or www.raspberrypi.org/forums/viewtopic.php?t=139013&p=923582
force_turbo=0
arm_freq=900
arm_freq_min=600
I can believe it, and thanks for sharing your experiences. Underclocking is certainly an option. Not something I would try for myself or advise others to do. Each to their own way, I guess. Whatever works is generally acceptable for most people.

Quote:
Originally Posted by titopoquito View Post
Many thanks, I very much appreciate that you took the time to write it up (and more so that I could download your updated kernel/modules/firmware packages in the past)! Especially the Raspberry Pi firmware stuff had left me puzzled before.
You're most welcome. Always happy to be of some help.
 
Old 01-08-2018, 07:17 PM   #14
glorsplitz
Member
 
Registered: Dec 2002
Distribution: slackware!
Posts: 614

Original Poster
Rep: Reputation: 119Reputation: 119
Quote:
Originally Posted by Exaga View Post
You're welcome to any of my advice that may be useful to you. I really like to read/hear about Slackware ARM users doing exactly what you're planning to do. There's no better Linux learning curve than Slackware and therefore why waste the opportunity? It would be great if there were lots of Slackware ARM users all running different devices. All chipping in and sharing their work/knowledge and experiences; building kernels and packages, writing Slackdoc pages, posting on these forums, creating blogs, making 'how-to' guides, etc. We'll only get to that point by people doing their own thing and learning by it.
Exaga, thank you for all the info and support. I agree with all the above. I look forward to getting to this and will definitely post back what happens.
 
2 members found this post helpful.
Old 01-09-2018, 03:11 PM   #15
Exaga
Member
 
Registered: Nov 2012
Posts: 127

Rep: Reputation: Disabled
Quote:
Originally Posted by glorsplitz View Post
Exaga, thank you for all the info and support. I agree with all the above. I look forward to getting to this and will definitely post back what happens.
I sincerely hope you are successful and productive in all your endeavours. You may fail 100 times before you get it right once but the knowledge and experience you will gain from it is immeasureable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: FSF dragging its feet on secure boot LXer Syndicated Linux News 0 01-02-2013 01:03 AM
Microsoft dragging its feet on Linux Secure Boot fix etech3 General 10 12-01-2012 07:32 AM
LXer: Microsoft dragging its feet on Linux Secure Boot fix LXer Syndicated Linux News 16 11-26-2012 10:15 AM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM
Howto install Woody with latest kernel? hellwoofer Debian 3 08-13-2003 12:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 03:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration