How to use a fresh newly compiled kernel ?

The SARPi project forum. For anything and everything relating to Slackware ARM on a Raspberry Pi 1, 2, and 3. This forum is NOT a replacement or substitute for the Slackware (ARM) forums on Linux Questions website! Please try to seek help there first about any issues you may be experiencing, or question you might have, before posting on here.
User avatar
jaypee
Registered user
Registered user
Posts: 3
Joined: Sat Apr 12 2014 - 13:08:52

How to use a fresh newly compiled kernel ?

Postby jaypee » Sat Apr 12 2014 - 13:37:34

I'm having problem trying to boot a new kernel image on my RPi.

I was trying to use a D-Link wireless adapter for my system but I guessed that the necessary modules were missing on my Slackware installation (14.1 + slackpkg update + rpi-update by April 10 2014). There is only one 8192cu.ko file in my modules directory and no dependent files declared in modules.dep. On my other computers the module is named rtl8192cu.ko and has many dependencies (rtlwifi, etc.) and works fine.

I couldn't find a correct collection of already compiled modules for my wireless adapter so I made the decision to generate it by myself. However, unfortunately, the kernel sources provided by the SARpi distribution and the running kernels have different versions. Consequently I downloaded a kernel source package from ftp.arm.slackware.com and started a compilation. After 8 or 10 hours I got a System.map and a zImage ready to be installed. I renamed zImage to kernel.img and started a reboot.

And I got the infamous coloured screen of raspberry death (actually not coming to life). Googling the symptom it turned out that my kernel image was not correct according to the doc I found.

But I don't understand why. Naturally I've tried different configurations but after hours and days of work I'm still unable to boot a home-made kernel and my f*ing wifi adapter still refuses to communicate.

Advice or comments would be very highly appreciated.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Sun Apr 13 2014 - 13:47:04

Hi jaypee,

Is the following guide any use to you? http://docs.slackware.com/slackware:beg ... n_services

Hope it helps. ;)
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
jaypee
Registered user
Registered user
Posts: 3
Joined: Sat Apr 12 2014 - 13:08:52

Re: How to use a fresh newly compiled kernel ?

Postby jaypee » Mon Apr 14 2014 - 10:36:23

Nope :(

In my life I've compiled and installed tens of kernels with different configurations on a slackware distro without too many difficulties but it's my first time on a raspberry. There is no lilo for the raspi so each time the device fails to reboot you have to move your sd card to your computer and swap your kernel images before going back to the raspi.

I can't figure out what's wrong with my kernel images. Using file(1) I see
kernel.img-3.13.7: Linux kernel ARM boot executable zImage (little-endian)
which seems to be fine but since the boot process stops immediately I've no clue about the problem.

I'm wondering if there is something very specific to the SARPi distro compared to the slackware arm package !

However my kernel trials were motivated by the problems with my D-Link wifi adapter. I supposed that the necessary modules were missing but I was probably wrong since I've installed a raspbian on a new sd card and everything worked out of the box. The output of lsmod(1) gave me a list of modules similar to the one on slackware.

I'm still searching a solution ....

User avatar
jaypee
Registered user
Registered user
Posts: 3
Joined: Sat Apr 12 2014 - 13:08:52

Re: How to use a fresh newly compiled kernel ?

Postby jaypee » Mon Apr 14 2014 - 12:55:40

Well not specifying explicitely (-Dwext) the driver for wpa_supplicant seems making situation better ...

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Mon Apr 14 2014 - 21:28:21

jaypee wrote:I'm wondering if there is something very specific to the SARPi distro compared to the slackware arm package !


Hi jaypee,

There's nothing specific within the Slackware ARM installation files which FatDog.eu provides that has been modified. We build our installer using the original source from the official Raspberry Pi Foundation repository. The installer and all system packages available for download from our site should have no impact on the issues you are currently experiencing.

Maybe a look at the compatible USB Wi-Fi adapters on http://elinux.org/RPi_USB_Wi-Fi_Adapters might be beneficial to see if you can find one that works for you? Just a thought. ;)
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Mon Jan 16 2017 - 21:36:44

OK, I am revisiting this. I have exactly the same problem, and like jaypee, have built 10's if not hundreds of kernels on Slackware for years.

Build the latest kernel (using /proc/config.gz), build modules, install modules and the copy across zImage to /boot.

Power up, one flash of the green LED and nothing. Likewise have to mount the SD card on my notebook to fix it up back.

All the other files in boot - do they need to be built to suit the kernel.img also?

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Mon Jan 16 2017 - 22:29:02

linicks wrote:OK, I am revisiting this. I have exactly the same problem, and like jaypee, have built 10's if not hundreds of kernels on Slackware for years.

Build the latest kernel (using /proc/config.gz), build modules, install modules and the copy across zImage to /boot.

Power up, one flash of the green LED and nothing. Likewise have to mount the SD card on my notebook to fix it up back.

All the other files in boot - do they need to be built to suit the kernel.img also?

Nick


One flash of green LED and then the RPi hangs on the rainbow splash screen means your kernel is not being loaded. There's an issue some where and without a serial output it's hard to define what's causing it.

You're using zImage but that's not how I do it. Here's a brief run down of what you need to do in order to get things working...

First download the RPi Linux kernel source from https://github.com/raspberrypi/linux
Or 'git clone' it...

Code: Select all

git clone git://github.com/raspberrypi/linux linux

Then in the Linux directory...

Code: Select all

cd linux
# for RPi 1
make bcmrpi_defconfig
# for RPi2 or RPi3
make bcm2709_defconfig

# build the kernel and DTBs
make Image
make dtbs
cp arch/arm/boot/Image /boot/kernel.img
# for RPi2 and RPi3 it's 'kernel7.img'
cp arch/arm/boot/dts/bcm27*.dtb /boot/

# build the kernel modules and install them
make modules
make modules_install

# if you want to update the firmware you can use 'rpi-update' or download it and from GitHub RPi repository.
# update the firmware without installing new kernel/modules
SKIP_KERNEL=1 rpi-update

# if your kernel is 4.8.x or 4.9.x then run rpi-update with the following options:
BRANCH=next SKIP_KERNEL=1 rpi-update


I guess these kind of problems are to be expected after I started including the kernel .config in the SARPi releases. :lol:
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Mon Jan 16 2017 - 22:48:44

OK, thanks - I got it.

I never moved over the *.dtb files, and for some reason the latest vanilla kernel doesn't have them...

Tired now, investigate tomorrow.

Thanks,

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Mon Jan 16 2017 - 23:54:41

No worries, Nick.

You need the DTBs or else the hardware will not be recognised and instantiated on the system correctly. ;)
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Sat Jan 21 2017 - 15:28:33

Well, I am getting really confused now. On my test server, I have bcm2708* files in boot and it appears that what is needed - and can't find a bcm2708_defconfig anywhere.

From dmesg:

Machine model: Raspberry Pi Model B Rev 2

Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xe bcm2708.serial=0xa8442744 smsc95xx.macaddr=B8:27:EB:44:27:44 bcm2708_fb.fbswap=1 bcm2708.uart_clock=48000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 ipv6.disable=1 console=tty1 nofont root=/dev/mmcblk0p3 rootfstype=ext4 elevator=noop rootwait ro

And in /boot:

bcm2708-rpi-b.dtb bcm2710-rpi-cm3.dtb fixup_cd.dat kernel.img start_cd.elf version-kernel_raspi.txt
bcm2708-rpi-b-plus.dtb bootcode.bin fixup.dat LICENCE.broadcom start_db.elf version-raspi-boot.txt
bcm2708-rpi-cm.dtb cmdline.txt fixup_db.dat overlays/ start.elf
bcm2709-rpi-2-b.dtb config.txt fixup_x.dat README start_x.elf
bcm2710-rpi-3-b.dtb COPYING.linux kernel7.img README.initrd System.map

So what bcm* do I need here?

Thanks for any help.

NIck
P.S. in the meantime I am building a kernel in 'screen', as it takes about 30 hours :D
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Sat Jan 21 2017 - 16:26:05

linicks wrote:Well, I am getting really confused now. On my test server, I have bcm2708* files in boot and it appears that what is needed - and can't find a bcm2708_defconfig anywhere.

So what bcm* do I need here?

Thanks for any help.

NIck
P.S. in the meantime I am building a kernel in 'screen', as it takes about 30 hours :D


Nick mate, come on! RTFM :lol:

Code: Select all

# for RPi 1
make bcmrpi_defconfig

# for RPi2 or RPi3
make bcm2709_defconfig


There is no bcm2708_defconfig ...

Code: Select all

cd linux/arch/arm/configs
ls -lah bcm*_defconfig
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Sat Jan 21 2017 - 17:46:01

Exaga wrote:Nick mate, come on! RTFM :lol:



Indeed :D I think I read too many... anyway, lets see what happens tomorrow sometime when the kernel build is finished*.

Stay tuned...

Nick
* I once built Gentoo on a lowly x486 with a 5mb dn/2.5mb up ADSL connection - it took over 2 weeks!
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Sat Jan 21 2017 - 17:54:34

linicks wrote:* I once built Gentoo on a lowly x486 with a 5mb dn/2.5mb up ADSL connection - it took over 2 weeks!


That beats me! It took me about 5 days to install Gentoo and another 3 days to configure and update it. Then I allowed some idiot to remotely log in (a friend of a friend) who said he knew what he was doing and the ba****d trashed the entire system in less than 10 minutes! :rofl:

Needless to say, I've never even looked at Gentoo since.
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Sun Jan 22 2017 - 12:38:24

OK, I think (hope) I am getting somewhere. I was really confused why I didn't have any bcm2708/9 files - the reason is (I think) that now bcm2835/6 supercedes them.

Also I found (after 3 builds) that I only get kernel7+ modules built, yet the Pi boots off kernel.img (that is one issue - no modules).

Sooooo, build #4 under way - and this time I looked a menuconfig and found I needed arm6 _NOT_ arm7 (tut!). Secondly I need to build the bcm2835* files.

Also the embedded .config file in /proc is wrong for this running kernel. Somehow, what I think is happening is that whoever builds the kernel that rpi-update gets does two builds - one for arm6 and then one for arm7 - so the last config used is the one in /proc.

So, wait another 14 hours odd and see what happens.

I found this handy page to sort out the confusion (see the table):

https://www.element14.com/community/com ... i-you-have

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Sun Jan 22 2017 - 21:34:29

linicks wrote:So, wait another 14 hours odd and see what happens.


Which Linux kernel source are you using?
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Sun Jan 22 2017 - 21:43:31

Official kernel.org 4.9.4 (which is now .5).

I couldn't use the raspberry git repro - takes up over 2GB and my SD card runs out of space ~ that took 4 tries to suss that out trying everthing so I gave up.

Good fun though ;)

NIck
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Sun Jan 22 2017 - 22:17:20

Right, I am now getting somewhere, but where I do not know:

After 4 hours of make Image:

Code: Select all

 LD      vmlinux
  SORTEX  vmlinux
  SYSMAP  System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
root@pitest:~/kernel/linux-4.9.4# make dtbs
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  DTC     arch/arm/boot/dts/bcm2835-rpi-b.dtb
  DTC     arch/arm/boot/dts/bcm2835-rpi-a.dtb
  DTC     arch/arm/boot/dts/bcm2835-rpi-b-rev2.dtb
  DTC     arch/arm/boot/dts/bcm2835-rpi-b-plus.dtb
  DTC     arch/arm/boot/dts/bcm2835-rpi-a-plus.dtb
  DTC     arch/arm/boot/dts/bcm2836-rpi-2-b.dtb
  DTC     arch/arm/boot/dts/bcm2835-rpi-zero.dtb


Finally. Now to make modules... so see y'all in another 20 hours.

Nick \0/
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Thu Jan 26 2017 - 21:20:38

Just a quick update. You _do_ need to use the patched raspberry Pi git kernel as it has all the patches for bcm* stuff.

It is a 2.1 GB clone - and on an 8 GB card, there isn't enough room to build it all.

I have given up for the moment.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Fri Jan 27 2017 - 02:15:25

linicks wrote:Just a quick update. You _do_ need to use the patched raspberry Pi git kernel as it has all the patches for bcm* stuff.


It's why I advised you to download the Linux kernel source from the RPi github repository and not kernel.org ...
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
glorsplitz
Registered user
Registered user
Posts: 38
Joined: Sun Aug 07 2016 - 22:54:24

Re: How to use a fresh newly compiled kernel ?

Postby glorsplitz » Sun Jan 29 2017 - 21:22:08

Hello all

I've not built any kernels for a long while as slackware has been managing those pretty well over the past few years and I don't mess around with any odd hardware.

I've been using rpi-update and got curious about building a kernel for rpi and what cross compiling is.

I read through this thread and looking at different ways on the web about how to do things and found http://elinux.org/index.php?title=Raspberry_Pi_Kernel_Compilation&redirect=no

On one of my slackware 64 14.2 vms I went through the above link section Example Checklist/Roadmap, hold a new user's hand part and it went well but I didn't transfer anything over to the rpi.

Wow, those are some long compile/build times you all have experienced, whatl I did took a 2-3 hours maybe.

Just wondering is that all there is to it? THANKS!
Last edited by glorsplitz on Mon Jan 30 2017 - 02:42:42, edited 2 times in total.

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Sun Jan 29 2017 - 21:53:46

I messed around for two weeks - building on a Pi takes 24 hours+ - but using the raspberry Pi git kernel my 8GB card runs out of space as I only have about 800MB left after doing a git clone.

I don't understand why the git clone is 2.1GB to start with? Anyone enlighten me?

Good fun anyway :)

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
glorsplitz
Registered user
Registered user
Posts: 38
Joined: Sun Aug 07 2016 - 22:54:24

Re: How to use a fresh newly compiled kernel ?

Postby glorsplitz » Sun Jan 29 2017 - 22:24:26

24 hours+ to find out you run out of space? You doing this on spare sd card?

I have little git experience, just recently started fooling with it, are you dumping the .git directory? I've been downloading the zips.

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: How to use a fresh newly compiled kernel ?

Postby linicks » Mon Jan 30 2017 - 18:47:06

The zip files didn't work for me, lots of broken symlinks...

And no, I didn't dump the .git directory - didn't think about it! Maybe have another go later.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 205
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: How to use a fresh newly compiled kernel ?

Postby Exaga » Mon Jan 30 2017 - 20:05:53

linicks wrote:The zip files didn't work for me, lots of broken symlinks...

And no, I didn't dump the .git directory - didn't think about it! Maybe have another go later.

Nick


Code: Select all

cd /tmp
git clone https://github.com/raspberrypi/linux linux
cd linux
# for RPi 1
make bcmrpi_defconfig
# for RPi2 or RPi3
make bcm2709_defconfig

# build the kernel and DTBs
make Image
make dtbs

# copy the kernel.img
cp arch/arm/boot/Image /boot/kernel.img
# for RPi2 and RPi3 it's 'kernel7.img'
cp arch/arm/boot/Image /boot/kernel7.img

# copy the DTBs
cp arch/arm/boot/dts/bcm27*.dtb /boot/

# build the kernel modules and install them
make modules
make modules_install

# reboot the system
reboot
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

Return to “SARPi Project - Slackware ARM on a Raspberry Pi”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests