Raspberry Pi2 and Pi3 running pure Debian and the Linux Mainline/Vanilla Kernel

Note: This post is 7 years old. Some information may no longer be correct or even relevant. Please, keep this in mind while reading.

Update 2017 Feb 25: I have updated the step-by-step instructions based on the suggested fixes and improvements contained in the reader comments. I also have copied the step-by-step instructions from this blog post to the README.md file hosted on https://github.com/michaelfranzl/rpi23-gen-image. From now on I will update the instructions only on github, so expect that the instructions in this blog post will grow slightly out of date.

Update 2017 Mar 4: 64 bit kernel and Debian OS now works on the RPi3.

Update 2018 May: Debian 10 “Buster” works, including wireless LAN on RPi3

Gallium graphics drivers for Raspberry Pi’s VC4 chip are now fully supported by Linux Mainline

This has been a long way coming. In February 2014, Broadcom announced that they would release the formerly closed-source drivers for the VideoCore IV (VC4) GPU of their BCM283x family of System-on-a-chip (SoC), powering Raspberry Pi’s.

To make a long story short, Eric Anholt started porting the Open Source drivers, as documented by this presentation early 2015, and contributed code to the Linux (Mainline) Kernel, libdrm, Mesa, and X.org. I’m sure it was a long and painful work. But the results are worth it. A picture says more than 1000 words:

Debian 9 ("Stretch") running on a Raspberry Pi 2, powered by Linux 4.9.0-rc3 Mainline/Vanilla Kernel. Notable in this image: Graphics driver is "Gallium" running on the VC4 GPU of the Broadcom 2836 system-on-a-chip (SOC). Glxgears runs with 60 FPS and consumes very little CPU. I2C interface is recognized.
Debian 9 (“Stretch”) running on my Raspberry Pi 2 (and 3), powered by Linux 4.9.0-rc3 Mainline/Vanilla Kernel. Notable in this image: Graphics driver is recognized as “Gallium” running on the VC4 GPU of the Broadcom 2836 system-on-a-chip (SOC). The glxgears benchmark runs with 60 FPS (the vsync of the monitor) and consumes very little CPU. Even the Raspberry I2C interface is recognized by the Linux Mainline Kernel.

To emphasize the point: It is no longer necessary to run specialized distributions (like Raspbian) or Linux kernels (like the Raspbian flavor) in order to have the Raspberry Pi well supported. And this is good news. Debian is a well established and maintained standard Distribution. And even though the Raspberry Pi is not powerful enough for the professional desktop user, it is powerful enough for the casual desktop user, and it is very small and cheap, which opens up a whole lot of possibities for new real-world applications.

I ran an additional test: Gnome even runs on Wayland (modern replacement for the X Window System) on the Raspberry Pi 2 (and 3):

Gnome on Wayland on Raspberry Pi 2
Gnome on Wayland on Raspberry Pi 2



It still is not a matter of a one-click installer to reproduce these results, you need some experience when you run into barriers. But it has gotten a whole lot easier. Github user drtyhlpr thankfully published the script rpi23-gen-image that can create a standard Debian distribution for the Raspberry Pi that can simply be copied to a SD card.

I have created a fork of this script to use the official Linux kernel instead of the Raspberry flavor one. Above screenshots are taken from a system that I’ve created with this script. My fork is developed into a slightly different direction:

  • Only official Debian releases 9 (“Stretch”) and newer are supported.
  • Only the official/mainline/vanilla Linux kernel is supported (not the raspberry flavor kernel).
  • The Linux kernel must be pre-cross-compiled on the PC running this script (instructions below).
  • Only U-Boot booting is supported.
  • The U-Boot sources must be pre-downloaded and pre-cross-compiled on the PC running this script (instructions below).
  • An apt caching proxy server must be installed to save bandwidth (instructions below).
  • The installation of the system to an SD card is done by simple copying or rsyncing, rather than creating, shrinking and expanding file system images.
  • The FBTURBO option is removed in favor or the working VC4 OpenGL drivers of the mainline Linux kernel.

All of these simplifications are aimed at higher bootstrapping speed and maintainability of the script. For example, we want to avoid testing of all of the following combinations:

RPi2 with u-boot, with official kernel
RPi2 without u-boot, with official kernel
RPi2 with u-boot, with raspberry kernel
RPi2 without u-boot, with raspberry kernel
RPi3 with u-boot, with official kernel
RPi3 without u-boot, with official kernel
RPi3 with u-boot, with raspberry kernel
RPi3 without u-boot, with raspberry kernel

Thus, the script only supports:

RPi2 with u-boot with official kernel
RPi3 with u-boot with official kernel

RPi2 (setting RPI_MODEL=2) is well supported. It will run the arm architecture of Debian, and a 32-bit kernel. You should get very good results, see my related blog posts:


The newer RPi3 (setting RPI_MODEL=3) is supported too. It will run the arm64 architecture of Debian, and a 64-bit kernel. The support of this board by the Linux kernel will very likely improve over time.

In general, this script is EXPERIMENTAL. I do not provide ISO file system images. It is better to master the process rather than to rely on precompiled images. In this sense, use this project only for educational purposes.

How to do it

Basically, we will deboostrap a minimal Debian 9 (“Stretch”) system for the Raspberry on a regular PC running also Debian 9 (“Stretch”). Then we copy that system onto a SD card, then boot it on the Raspberry.

We will work with the following directories:

  |- rpi23-gen-image
  |- linux
  |- u-boot
  |- raspberry-firmware

Set up your working directory:

mkdir workspace
cd workspace

Do the following steps as root user.

Set up caching for apt

This way, you won’t have to re-download hundreds of megabytes of Debian packages from the Debian server every time you run the rpi23-gen-image script.

apt-get install apt-cacher-ng

Check its status page:


Install dependencies

The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process.

apt-get install debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc device-tree-compiler

For a RPi2, you also need:

apt-get install crossbuild-essential-armhf

For a RPi3, you also need:

apt-get install crossbuild-essential-arm64

Kernel compilation

Get the latest Linux mainline kernel. This is a very large download, about 2GB. (For a smaller download of about 90 MB, consider downloading the latest stable kernel as .tar.xz from https://kernel.org.)

git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux

Confirmed working revision (approx. version 4.10, Feb 2017): 60e8d3e11645a1b9c4197d9786df3894332c1685

git checkout 60e8d3e116

Working configuration files for this Linux kernel revision are included in this repository. (working-rpi2-linux-config.txt and working-rpi3-linux-config.txt).

If you want to generate the default .config file that is also working on the Raspberry, execute

make mrproper

For a RPi2:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- multi_v7_defconfig

For a RPi3:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig

Whichever .config file you have at this point, if you want to get more control as to what is enabled in the kernel, you can run the graphical configuration tool at this point:

apt-get install libglib2.0-dev libgtk2.0-dev libglade2-dev

For a RPi2:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- gconfig

For a RPi3:

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- gconfig

Before compiling the kernel, back up your .config file so that you don’t lose it after the next make mrproper:

cp .config ../kernelconfig-backup.txt

Compiling the kernel

Clean the sources:

make mrproper

Optionally, copy your previously backed up .config:

cp ../kernelconfig-backup.txt .config

Find out how many CPU cores you have to speed up compilation:

NUM_CPU_CORES=$(grep -c processor /proc/cpuinfo)

Run the compilation on all CPU cores. This takes about 10 minutes on a modern PC:

For a RPi2:

make -j${NUM_CPU_CORES} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

For a RPi3:

make -j${NUM_CPU_CORES} ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

Verify that you have the required kernel image.

For a RPi2 this is:


For a RPi3 this is:


U-Boot bootloader compilation

cd ..
git clone git://git.denx.de/u-boot.git

Confirmed working revision: b24cf8540a85a9bf97975aadd6a7542f166c78a3

git checkout b24cf8540a

Let’s increase the maximum kernel image size from the default (8 MB) to 64 MB. This way, u-boot will be able to boot even larger kernels. Edit ./u-boot/include/configs/rpi.h  and add above the very last line (directly above “#endif”):

#define CONFIG_SYS_BOOTM_LEN (64 * 1024 * 1024)

Find out how many CPU cores you have to speed up compilation:

NUM_CPU_CORES=$(grep -c processor /proc/cpuinfo)

Compile for a RPi model 2 (32 bits):

make -j${NUM_CPU_CORES} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rpi_2_defconfig all

Compile for a RPi model 3 (64 bits):

make -j${NUM_CPU_CORES} ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- rpi_3_defconfig all

Verify that you have the required bootloader file:


Pre-download Raspberry firmware

The Raspberry Pi still needs some binary proprietary blobs for booting. Get them:

cd ..
mkdir -p raspberry-firmware/boot
cd raspberry-firmware/boot
wget https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat
wget https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf
wget https://github.com/raspberrypi/firmware/raw/master/boot/start.elf
wget https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf

Confirmed working revision: bf5201e9682bf36370bc31d26b37fd4d84e1cfca

Build the system!

This is where you call the rpi23-gen-image.sh script.

cd ../..
git clone https://github.com/michaelfranzl/rpi23-gen-image.git
cd rpi23-gen-image

For example:

DEBIAN_RELEASE="stretch" \
USER_NAME="pi" \
PASSWORD="xxx" \
APT_INCLUDES="i2c-tools,rng-tools,avahi-daemon,rsync,vim" \
UBOOTSRC_DIR="$(pwd)/../u-boot" \
KERNELSRC_DIR="$(pwd)/../linux" \
HOSTNAME="rpi2" \
RPI_FIRMWARE_DIR="$(pwd)/../raspberry-firmware" \

You may want to modify the variables according to the section “Command-line parameters” below.

The file example.sh in my github repostory contains a working example.

Install the system on a SD card

Insert a SD card into the card reader of your host PC. You’ll need two partitions on it. I’ll leave as an exercise for the reader the creation of a partition table according to the following output of fdisk for a 64GB card:

Device         Boot  Start        End    Sectors    Size   Id  Type
/dev/mmcblk0p1        2048     500000     497953  243.1M    c  W95 FAT32 (LBA)
/dev/mmcblk0p2      501760   62552063   62050304   29.6G   83  Linux

The following commands will erase all contents of the SD card and install the system (copy via rsync) on the SD card:

umount /dev/mmcblk0p1
umount /dev/mmcblk0p2

mkfs.vfat /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p2

mkdir -p /mnt/raspcard

mount /dev/mmcblk0p2 /mnt/raspcard
mkdir -p /mnt/raspcard/boot/firmware
mount /dev/mmcblk0p1 /mnt/raspcard/boot/firmware

rsync -a ./images/stretch/build/chroot/ /mnt/raspcard

umount /dev/mmcblk0p1
umount /dev/mmcblk0p2

Note about SD cards: Cheap (or sometimes even professional) SD cards can be weird at times. I’ve repeatedly noticed corrupt/truncated files even after proper rsync and proper umount on different brand new SD cards. TODO: Add a method to verify all file checksums after rsync.

Try booting the Raspberry

Insert the SD card into the Raspberry Pi, and if everything went well, you should see a console-based login prompt on the screen. Login with the login details you’ve passed into the script (USER_NAME and PASSWORD).

Alternatively, if you have included “avahi-daemon” in your APT_INCLUDES, you don’t need a screen and keyboard and can simply log in via SSH from another computer, even without knowing the Rasberry’s dynamic/DHCP IP address (replace “hostname” and “username” with what you have set as USER_NAME and HOSTNAME above):

ssh username@hostname.local

Finishing touches directly on the Raspberry

Remember to change usernames, passwords, and SSH keys!

Check uber-low RAM usage

Running top shows that the freshly booted system uses only 23 MB out of the availabl 1GB RAM! Confirmed for both RPi2 and RPi3.

Network Time Synchronization

The Raspberry doesn’t have a real time clock. But the default systemd conveniently syncs time from the network. Check the output of timedatectl. Confirmed working for both RPi2 and RPi3.

Hardware Random Number Generator

The working device node is available at /dev/hwrng. Confirmed working for both RPi2 and RPi3.

I2C Bus

Also try I2C support:

apt-get install ic2-tools
i2cdetect -y 0

Confirmed working for both RPi2 and RPi3.

Test onboard LEDs

As of the kernel revision referenced above, this only works on the RPi2. The RPi3 has only the red PWR LED on all the time, but otherwise is working fine.

By default, the green onboard LED of the RPi blinks in a heartbeat pattern according to the system load (this is done by kernel feature LEDS_TRIGGER_HEARTBEAT).

To use the green ACT LED as an indicator for disc access, execute:

echo mmc0 > /sys/class/leds/ACT/trigger

To toggle the red PWR LED:

echo 0 > /sys/class/leds/PWR/brightness # Turn off
echo 1 > /sys/class/leds/PWR/brightness # Turn on 

Or use the red PWR LED as heartbeat indicator (kernel option for this must be enabled):

echo heartbeat > /sys/class/leds/PWR/trigger

Notes about systemd

systemd now replaces decades-old low-level system administration tools. Here is a quick cheat sheet:

Reboot machine:

systemctl reboot

Halt machine (this actually turns off the RPi):

systemctl halt

Show all networking interfaces:


Show status of the Ethernet adapter:

networkctl status eth0

Show status of the local DNS caching client:

systemctl status systemd-resolved

Install GUI

Successfully tested on the RPi2 and RPI3.

If you want to install a graphical user interface, I would suggest the light-weight LXDE window manager. Gnome is still too massive to run even on a GPU-accelerated Raspberry.

apt-get install lightdm lxde lxde-common task-lxde-desktop

Reboot, and you should be greeted by the LightDM greeter screen!

Test GPU acceleration via VC4 kernel driver

Successfully tested on the RPi2 and RPI3.

apt-get install mesa-utils
glxinfo | grep '^OpenGL'

Glxinfo should output:

OpenGL vendor string: Broadcom
OpenGL renderer string: Gallium 0.4 on VC4
OpenGL version string: 2.1 Mesa 12.0.3
OpenGL shading language version string: 1.20
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 12.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

Kernel compilation directly on the Rasberry

Only successfully tested on the RPi2. Not yet tested on the RPI3.

In case you want to compile and deploy another Mainline Linux kernel directly on the Raspberry, proceed as described above, but you don’t need the ARCH and CROSS_COMPILE flags. Instead, you need the -fno-pic compiler flag for modules. The following is just the compilation step (configuration and installation omitted):

make -j5 CFLAGS_MODULE="-fno-pic"
make modules_install

Follow-up articles


67 thoughts on “Raspberry Pi2 and Pi3 running pure Debian and the Linux Mainline/Vanilla Kernel”

    1. I don’t know, but I believe the chances are very good.

      “Rapsberry Pi” in Wikipedia says: “The new BCM2837 [on the RPi 3] based on 64-bit ARMv8 architecture is backwards compatible with the Raspberry Pi 2 as well as the original. While the new CPU is 64-bit, the Pi retains the original VideoCore IV GPU which has a 32-bit design.”

      If you try it out, maybe leave a comment here!

    2. I kept getting a dtc not found error. I had to add device_tree_compiler to modify the
      Assemble a full, bootable base Debian system
      section. I added device-tree-compiler to the following line.

      APT_INCLUDES=”util-linux,systemd-sysv,avahi-daemon,vim,parted,build-essential,linux-compiler-gcc-5-arm,g++,make,bc,rsync,device-tree-compiler” \


  1. Yup, doesn’t boot (no signal on HDMI). I tried your way and tried to download all firmware files from github. Doesn’t work

    1. A missing HDMI signal doesn’t imply that it’s not booting. Does the ACT LED flash in a heartbeat rhytm? Also check the config.txt documentation regarding HDMI configuration (safe mode etc.)

      1. >Does the ACT LED flash in a heartbeat rhytm

        Nope. Just the red LED turns on. As if there was nothing in the SD slot

        1. I added the following lines to /etc/rc.local to disable the red LED and change the green LED to flash when writing to the SD card.

          echo 0 > /sys/class/leds/PWR/brightness
          echo mmc0 > /sys/class/leds/ACT/trigger

    2. I tested on a RPi3 and it works. However, the screen is blank and only the red PWR led is on, like you described. That could be fixed via kernel configuration, which I yet have to test. But I can log in via SSH, and at least the Ethernet interface, I2C bus and USB works.

  2. Hi folks, i used Debian Stretch as the build host and it worked for me after changing ‘linux-compiler-gcc-5-arm’ to ‘linux-compiler-gcc-6-arm’ (+ also added device-tree-compiler).

  3. Hi Michael, this look really cool. Can you maybe upload a .img on github or somewhere, that I can just copy to the SD card? I don’t have a spare computer to install debian on, and I’m trying to use virtualbox on my mac to follow the instructions, but I’m having trouble. Thanks

    1. btw: adding CONFIG_SYS_BOOTM_LEN=16000000 to u-boot/configs/rpi_3_defconfig followed by re-build did not help.

      1. I actually could reproduce your issue on my RPi3. But increasing CONFIG_SYS_BOOTM_LENGTH to 64 MB does work. I updated the instructions above, and the README of the github repository. Don’t forget to run `make clean` before you recompile u-boot. It should work then.

  4. Hi again !

    My rpi3 now boots. Yeah !

    Two more issues though:
    It seems the variables for installing xfce directly into the image are ignored, i cant find any reference to xfce in the build.log and no xfce is present once booting the pi. The same is true for console keyboard config, the locale is not generated and the keyboard is not set even though i have included the mentioned settings. Thats a minor issue though.

    Second and more seriously, once installing xfce and logging into the graphical interface the pi soon locks up hard, opening one or two windows is sufficient to break it.

    Here is a dmesg http://kashofer.org/owncloud/index.php/s/pAaqwgnDAqUAVhn

    Any suggestions for issue 2 ?


    1. I took out all desktop environment options from the script to keep everything minimal and simple. Installation of a desktop environment should be done manually – see “Install GUI” section above.

      As to the hangups after any window is opened in XFCE, I experienced the same on both RPi2 and RPi3. I haven’t investigated what causes it, but I unplugged and re-plugged the USB keyboard and that seemed to fix it. It became responsive after about 10 seconds. It could be unrelated to USB though.

      If you find a fix, let me know it.

  5. You need a kernel configuration file, without extra modules, but with all the required extensions. On other sites it is advised to take as a basis the settings from rpi2. Can you adapt and post it here?

  6. Hi,

    I have a problem running current Debian Stretch with a vanilla kernel (4.10.10) on my RPi 2b

    As soon as the vc4 drm gets initialized, the screen turns black. (using the composite out). I changed the kernel configuration to compile vc4 as a module and console stays available until I insmod “vc4”.

    I cannot verify if HDMI is working at the moment. Any idea?

    1. I have only tried with standard HDMI cable, I cannot help you with this. Work on full support of the Rasberries by the mainline Linux kernel is still going on as far as I know.

    2. Hi Luna,

      I just got done with the instructions and I can ssh into the pi (RPi2), but I believe I’m hitting the same issue as you. I’ve tried with both the composite and HDMI and suffer the same result.

      I don’t have any useful feedback at this point, but I did want to add another data point to the bug. If you’ve found a solution, please post back.



  7. Just followed your README.md instructions and it works fine on an RPi3! Thanks SO MUCH!!! There are a couple of minor changes you might want to make to your README, but they didn’t throw me for a loop:

    1. After telling people to become root to do the apt installs, you might want to tell them to go back to normal user mode before the git/build steps

    2. After git clone git://git.denx.de/u-boot.git, you might want to add that they should cd into u-boot before doing git checkout

  8. Mr. Franzl,

    I got this problem:
    “I: Retrieving InRelease
    I: Failed to retrieve InRelease”

    And another one:
    “W: Failure while configuring base packages. This will be re-attempted up to five times.
    W: See //debootstrap/debootstrap.log for details (possibly the package i2c-tools is at fault)”

    Any comment please?

  9. Hi Michael,
    Thank you for the great instructions and the script. Debian is my operating system distribution of choice since 1995 (Linux since 1993, first TAMU Linux followed by SLS and Slackware). I got a Raspberry Pi 2 one or two years ago, but did not do much with it yet (using Raspbian so far).
    I ran into 2 problems with the script:
    First, the apt-get dist-upgrade command did not work. I am using an up-to-date Debian unstable as the host system; maybe it plays a role. I applied this patch:

    diff –git a/bootstrap.d/11-apt.sh b/bootstrap.d/11-apt.sh
    index 0d24564..627f09c 100644
    — a/bootstrap.d/11-apt.sh
    +++ b/bootstrap.d/11-apt.sh
    @@ -26,7 +26,7 @@ fi

    # Upgrade package index and update all installed packages and changed dependencies
    chroot_exec apt-get -qq -y update
    -chroot_exec apt-get -qq -y -u dist-upgrade
    +chroot_exec apt-get -qq -y –allow-unauthenticated -u dist-upgrade

    if [ -d packages ] ; then
    for package in packages/*.deb ; do

    Second, after copying the files to the SD card, u-boot.bin will not load anything further from the SD card, but it instead insists on booting via BOOTP and TFTP. This is obviously a dead end, because I only have a DHCP server running. This happens both with the confirmed working revision and with the newest one (commit 08546df976b79b1694af3ff12b26baf2931f371a). Which files could I check to make it work?

    1. Regarding the –allow-unauthenticated switch, this seems to be specific to your host system. It should not be needed.

      Regarding u-boot not loading the kernel, you should attach a monitor and keyboard to the Raspberry Pi and go into the u-boot interactive console, and try to boot manually to find out the problem. Probably something simple like a wrong filename.

      1. Thank you again.
        For some reason, some files in /boot/firmware/ had been omitted from the SD card. After adding those, the kernel will be loaded.

        The next problem is that the network interface is not available. I am using Linux 4.11.7, and about 9 seconds into the booting, the LEDs on the Ethernet interface will light up, and a kernel message tells that eth0 was renamed into something. “ifup” does not recognize that string, and no IPv4 networking is working. I am not familiar enough with systemd to troubleshoot this, but I suspect that it could be some problem with the userspace.

        The hardware should be OK, because when the files were missing U-boot did get a DHCP reply from the router.

        1. According to the log files, there were some problems with some core package depencies.
          I finally solved the problem by “debootstrap stretch /stretch” and rerunning the build script in that chroot, instead of running it in Debian Sid (unstable). Now everything works fine.
          Lesson learned: Debian unstable is a too moving target for this kind of cross-platform development.

  10. Hi Michael,
    tried to build it on a rpi3 itself, but Kernel doesn’t start:

    reading bcm2837-rpi-3-b.dtb
    7404 bytes read in 18 ms (401.4 KiB/s)
    ** No boot file defined **
    ## Booting kernel from Legacy Image at 01000000 …
    Image Name:
    Image Type: AArch64 Linux Kernel Image (gzip compressed)
    Data Size: 5346093 Bytes = 5.1 MiB
    Load Address: 00080000
    Entry Point: 00080000
    Verifying Checksum … OK
    ## Flattened Device Tree blob at 00000100
    Booting using the fdt blob at 0x000100
    Uncompressing Kernel Image … OK
    Loading Device Tree to 000000003ab4a000, end 000000003ab4eceb … OK

    Starting kernel …

    nothing happens…

    Could not find any kernel-image nor initrd-file in the new built sys.

    No error-messages from your script.
    But found there some CROSS-statements. How to handle this?

    1. Next try:
      commented out the line ‘CROSS_COMPILE=aarch64-linux-gnu-‘
      in the rpi23-gen-image.sh
      and rebuilt the system, but same result.

      No more ideas for now…

      1. now on a freshly installed Stretch on my PC following the above instructions:

        same result, stops after “Starting kernel …”

        No ssh open, no logs in /var.

        Kernel was 4.11.9

        BTW: in 11-apt.sh I got this:
        The repository ‘http://ftp.debian.org/debian stretch Release’ is not signed.
        and some more such errors, overridden with –allow-unauthenticated to get a complete run.

        This did not happen on Pi3. (There I tried Kernel 4.9.36)

        1. Above I give exact kernel/firmware/uboot git revision hashes. With newer/older revisions you’ll likely run into problems. Also compare checksums of the kernel, uboot and firmware files on the SD card and on the host system. Low quality SD cards and SD card readers may corrupt files, as well as improper unmounting.

          1. Sorry, but could not handle or understand git revisions. Maybe, there is a problem.

            File-compare should not be a problem, did a full diff-loop over all files…

            Will wait now for a ready-to-use image.

  11. Hey Michael,

    Thanks for the howto. I was able to get (most) things working with some minor modifications ( –allow-unauthenticated for apt) and I think a “change directory (cd) command”. Nevertheless, bravo and thanks for the detailed tutorial.

    I’ve got both an rpi2 and rpi3, but I’m currently attempting to get all the functionality on the rpi3 going.

    I’m still unable to get the VC4 driver working. I see plenty of commentary on the internet about configuring an overlay in /boot/config.txt. Did you have to set anything in /boot/config.txt?

    For instance:

    and documentation:


    Thanks for any help!


    1. No, I didn’t have to add anything to config.txt. Only “avoid_warnings=2” is set on both Rpi2 and Rpi3. Make sure you check out the above quoted kernel, firmware and u-boot git revisions/hashes since I haven’t tested with any other revision since I wrote this article. VC4 should just work out of the box because it’s integrated into the upstream kernel.

  12. I am getting problem on this command

    rsync -a ./image/stretch/build/chroot/mnt/raspcard

    It’s showing me an error. please tell me where did this /image/stretch ……. Is ??

  13. Thanks for your work!
    Two things:
    1) just for the record: in recent kernel versions the SD/MMC host driver doesn’t detect the any card anymore, hence the kernel hangs forever while trying to mount the rootfs (hangs forever due to the “rootwait” command line parameter)
    2) I just can’t get the kernel to recognise the sound HW. Did you do anything more than setting ‘CONFIG_SND_BCM2835_SOC_I2S’ to ‘y’?

  14. You’re awesome! It worked, but only after i’ve added “–allow-unauthenticated” to the script ( gona fix keyring issue maybe, the proper way).

    Any thoughts on how to boot kernel from apt repo via u-boot? Best scenario i see here is just trigger u-boot configuration generator (mkimage) after kernel update. That way i could easily compile new drivers on Pi directly.

    Anyway, thanks a lot!!!

      1. the Pi3 actually can boot from USB, Pi3 B+ even out of the box. (under certain conditions, i heard it has trouble with certain hardware which takes long to initialize, e.g some hard drives, but i boot from USB stick without issues + much faster compared to SD)

        just curious: debian has an official aarch64 port. Can’t i just take the kernel from there without compiling it using your instructions?

        thank you for the awesome guide.

  15. I got this booting to the login screen but my keyboard and mouse would not get detected. Seemed none of the USB items I put in where getting detected. Any reason that could be? Thanks

  16. Mike,

    Thanks for your very detailed write up on how to get a raspberry pi 3 working with default debian.

    I am having trouble with getting the image to load the kernel. I have gotten the pi to boot from the sd card but it stops on “starting kernel …” and there is no further output through the hdmi and it doesn’t get an IP address so I am assuming that the system isn’t booting and the ACT light doesn’t do anything more once it stops at “starting kernel …” so I that is further evidence that it isn’t booting into a a full system.

    I am very confident that the sd card is fine since I can get it to work with the regular raspbian image, and I have tried 2 different sd card readers to write the image so I am very confident that it isn’t a corrupted sd card image.

    I have tried doing the default .config that is output from the gui kernel config tool, using just the “working-rpi3-linux-config.txt” just using that with the name changed to “.config” which results in me having to answer more config questions.

    When doing that and running “make -j${NUM_CPU_CORES} ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-” it says: ” Restart config…”

    I have tried loading the “working-rpi3-linux-config.txt” into the gui kernel tool and then writing it with the changes. That doesn’t work either.

    I have also tried it with kernel 4.9.78 and 4.14.16, that has not worked either. I still get stuck at the same point, “Starting Kernel…”

    On one test with the modified “working-rpi3-linux-config.txt” output from the kernel config gui and kernel 4.9.78 It would get to “starting Kernel…” and restart 1 second after stopping there, and continued till I pulled the power, and would do that again if I plugged the power back in.

    What reccomondations do you have? Where did I go wrong? Does it have to exactly be the 4.10.0 Kernel? How did you figure out the correct kernel flags for the raspberry pi? did you get that from the raspberrypi linux github? (https://github.com/raspberrypi/linux)


    Keeps stopping at “Starting Kernel…” on bootup even with different kernel configs, different packages, and different kernels it still stops there

  17. The ARMv6 or ARMv7 in Raspberry Pi and Pi 2 are bi-endian (supporting both big-endian and little-endian byte order). All the pre-built GNU/Linux distributions for the Raspberry Pi are little-endian.

    I have some code that I would like to test in big-endian mode, and I was wondering if you could give some advice how to modify your recipe. Is there any Debian armeb packages that could be useful in bootstrapping the userspace?

    According to https://raspberrypi.stackexchange.com/questions/7279/big-endian-distribution-for-the-raspberry-pi it is possible to build the kernel in either mode, but the bootloader would have to be adjusted before starting the kernel. With uboot, I guess it should not be a problem to insert a SETEND instruction somewhere. And I guess the instruction could also be inserted at the start of the kernel boot routine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.