TL;DR. How do I switch to a newer kernel I just compiled & packed as .deb? Generally, is there a sane way of upgrading a raspbian kernel remotely using a .deb package?

I have successfully cross-compiled the 4.4.5 RPi kernel in form of .deb packages, and installed them (specifically, linux-image-... and linux-headers-... below) on RPi.

These are the files I got after compilation:


I installed the following deb packages:

sudo dpkg -i linux-image-4.4.5+_4.4.5+-4_armhf.deb
sudo dpkg -i linux-headers-4.4.5+_4.4.5+-4_armhf.deb

Below is the contents of /boot after installation:

$ ls -lat /boot
total 30972
drwxr-xr-x 21 root root    4096 Mar 12 21:31 ..
-rwxr-xr-x  1 root root 5085910 Mar 12 21:22 initrd.img-4.4.5+
-rwxr-xr-x  1 root root  129312 Mar 12 11:54 config-4.4.5+
-rwxr-xr-x  1 root root 1995382 Mar 12 11:54 System.map-4.4.5+
-rwxr-xr-x  1 root root 4074960 Mar 12 11:54 vmlinuz-4.4.5+
drwxr-xr-x  2 root root    8192 Mar  8 12:45 .fseventsd
-rwxr-xr-x  1 root root    4096 Mar  7 21:03 ._cmdline.txt
-rwxr-xr-x  1 root root     152 Mar  7 21:03 cmdline.txt
drwxr-xr-x  3 root root    8192 Mar  7 21:01 .TemporaryItems
-rwxr-xr-x  1 root root    4096 Mar  7 21:01 ._.TemporaryItems
drwxr-xr-x  2 root root    8192 Mar  7 20:37 .Trashes
-rwxr-xr-x  1 root root    4096 Mar  7 20:37 ._.Trashes
-rwxr-xr-x  1 root root     103 Feb 26 01:17 issue.txt
-rwxr-xr-x  1 root root   18974 Feb 26 01:17 LICENSE.oracle
-rwxr-xr-x  1 root root    1635 Feb 26 01:04 config.txt
drwxr-xr-x  2 root root    8192 Feb 26 01:03 overlays
-rwxr-xr-x  1 root root   10841 Feb 25 23:22 bcm2708-rpi-b.dtb
-rwxr-xr-x  1 root root   11120 Feb 25 23:22 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x  1 root root   10871 Feb 25 23:22 bcm2708-rpi-cm.dtb
-rwxr-xr-x  1 root root   12108 Feb 25 23:22 bcm2709-rpi-2-b.dtb
-rwxr-xr-x  1 root root   12575 Feb 25 23:22 bcm2710-rpi-3-b.dtb
-rwxr-xr-x  1 root root    2505 Feb 25 23:22 fixup_cd.dat
-rwxr-xr-x  1 root root    6481 Feb 25 23:22 fixup.dat
-rwxr-xr-x  1 root root    9722 Feb 25 23:22 fixup_db.dat
-rwxr-xr-x  1 root root    9724 Feb 25 23:22 fixup_x.dat
-rwxr-xr-x  1 root root 4046732 Feb 25 23:22 kernel7.img
-rwxr-xr-x  1 root root 3963140 Feb 25 23:22 kernel.img
-rwxr-xr-x  1 root root  612472 Feb 25 23:22 start_cd.elf
-rwxr-xr-x  1 root root 4888200 Feb 25 23:22 start_db.elf
-rwxr-xr-x  1 root root 2739672 Feb 25 23:22 start.elf
-rwxr-xr-x  1 root root 3840328 Feb 25 23:22 start_x.elf
-rwxr-xr-x  1 root root   17920 Feb  9 13:32 bootcode.bin
-rwxr-xr-x  1 root root    1494 Nov 18 16:01 LICENCE.broadcom
-rwxr-xr-x  1 root root   18693 Aug 21  2015 COPYING.linux
drwxr-xr-x  6 root root   16384 Jan  1  1970 .

I know it's possible to switch the kernel by setting kernel=my_kernel.img, but I don't have the image file. It's possible to run imagetool-uncompressed.py to create the image file, but it implies a little more effort. Should I be doing that instead of .deb?

  • what is main goal of your question? easiest way to install kernel or way to do it with deb package?
    – edo1
    Mar 14, 2016 at 16:13
  • @edo1 very good points. My initial question was: how to do that using .deb, as I thought it has to be the easiest way. If it's not – what would be the easiest way? Mar 14, 2016 at 16:15
  • Easiest way is to install deb package (to get modules installed), prepare and copy zImage as I mentioned in my answer (zImage should be done during package building). If you want easy to install method, you need to prepare deb package with modules and kernel.img files. It shouldn't be too complicated, raspbian kernel package could be used as an example.
    – edo1
    Mar 14, 2016 at 17:00

2 Answers 2


It's not so obvious from a start but you don't have a proper image that is able to boot. Even making uImage target. Weird, but true. You need the toolset for RPi kernels :

git clone https://github.com/raspberrypi/tools.git

after that I'm usually cloning to the same dir into linux folder a kernel I desire. After that do your regular make-cycle. Install everything but the kernel. After that brew a kernel(exec from linux/ folder where you've just completed build and installed everything but the kernel) :

cd ../tools/mkimage/
./imagetool-uncompressed.py ../../linux/arch/arm/boot/Image
rm /boot/kernel.img
mv kernel.img /boot/

also there can be a file /boot/kernel7.img - if there's such a file, make a copy :

cd /boot
rm kernel7.img
cp kernel.img kernel7.img

reboot and good luck!

  • imagetool-uncompressed.py utility isn't necessary nowadays, current bootloader can load unmodified Image or zImage. But you have to use mkknlimg utility if you need device tree support.
    – edo1
    Mar 14, 2016 at 9:15
  • @edo1 I had complications with Image and zImage, so I'm strongly recommending to use this script. actually I had no problems with linux-stable from Git at kernel.org just making an image Mar 14, 2016 at 13:11
  • I use zImage without imagetool-uncompressed.py for a while without any issue. Other question: do you use DT overlays? It shouldn't work without mkknlimg.
    – edo1
    Mar 14, 2016 at 13:50
  • @edo1 I'm currently using latest linux-stable from kerne.org Git, no custom overlays. Just tweaking my kernel to suite my needs, and also latest stable has a pre-config target in make lists, by the way - the one for RPi CPU Mar 14, 2016 at 14:36
  • ok, but your solution won't work with device tree overlays, I think it is important thing to make a notice.
    – edo1
    Mar 14, 2016 at 17:07

The issue is that common debian kernel package isn't designed for raspberry and doesn't provide proper kernel image.
You could simply use zImage file (which is created during cross-compilation) as a kernel image, imagetool-uncompressed.py isn't needed nowadays.

Some additional information is here: building kernel image (.img) including ramdisk

Update: I forgot about very important thing:

the loader checks kernel images for DT-compatibility, which is marked by a trailer added by the mkknlimg utility


You could find this utility in scripts directory of raspberry kernel.
I think nobody wants to build kernel without device tree support, so you need to execute
./scripts/mkknlimg arch/arm/boot/zImage kernel7.img
in rasberry kernel tree and copy kernel7.img file to boot partition on SD card (you should use kernel.img filename for the first Pi generation).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.