I´m using Raspbian on RaspBerry Pi and it´s working ok, but now I want to modify the distro according to my needs.

I know the source for the kernel is found in kernel.org, but I haven't been able to find the sources for Raspbian. Does anyone know where I can find them?

After i get the sources for the kernel and Raspbian and modify them how should I do it? Should I download everything to my PC running Ubuntu and then cross-compile the kernel and then the distro, so that I can create an image from scratch? What about the boot-loader?

Sorry to be asking all these newby questions, but I´ve never needed to modify any distros before, but now I want to learn.

The thing I need is a step forward in the right direction. At least get the C sources for Raspbian.

  • @goldilocks Ok, that's the source for the kernel. What about the source for the actual distro? Is it all there? Am I insane? Are my concepts wrong? Kernel is different from the actual distro, or is it not? Sorry for asking that here
    – morcillo
    Feb 19, 2013 at 14:04
  • It's probably not a whole lot different. The distro is kind-of defined by the package manager and the packages it is shipped with. Raspbian will be built with that kernel source. The modules they build into it will be their decision.
    – Jivings
    Feb 19, 2013 at 16:25

2 Answers 2


I want to modify the distro according to my needs. [...] What about the source for the actual distro? Is it all there? Am I insane?

The distro has sources, but these are either the same as or slightly patched versions of the original sources -- a distro does not really contain any original software per se (discounting the package manager), it is just an original configuration of such.

So there are the original sources and the probably mostly very similiar .src packages that are available via the package manager. I have never heard of someone rebuilding a particular distro from source, as this would be somewhat pointless, unless it is for use on a platform for which those sources have not been previously compiled (such as raspbian is to debian).

Bluntly then, it does sound a little insane. I would not consider compiling everything over again from source a very direct route toward "modify[ing] the distro according to my needs". To a certain extent, compile time options are useful, but I think only in a small minority of cases (for which you can source build without having to do the whole rest of the system).

The kernel is a little more straightforward, although unless there are specific things that you know you want from a kernel, rolling your own is a largely academic exercise (it won't make any real difference). I have cross compiled the raspbian 3.6.11+ kernel following the elinux guide using a crosstool-ng toolchain and it works, although there is a little bit of weirdness that followed from converting the 3.2.27+ /proc/config.gz to 3.6.11 -- eg, the ipt_LOG module was not built, which many people probably use in their iptables rules..that took a bit of tracking down.

I think your best is to first decide specifically what "your needs" are and then get opinions about how to address those specifics, rather than starting off down the "start from scratch" path. Customizing an install doesn't generally require a lot of re-compiling, whereas building one all over again will take you months (if ever) to sort out and probably end with you realizing the same thing (it was mostly a waste of time).

  • Your explanation was great, and you were right I just wanted to go through all that problem due to academical reasons. I wanted to know how to do it. I'm pretty used to working with microcontrollers with no operating system, but now I wanted to go to a higher level and I thought that was the right path. You've probably just saved me from a long and desperate life of compiling and crying. Thank you and I'll try what you suggested
    – morcillo
    Feb 20, 2013 at 0:46

@goldilocks provided a very sound answer on sources modification and why you don't really need that. I wanted to add that your real goal is probably getting some specific things configured - for that you can follow this simple route: mount the card image and modify its content to meet your specific needs, including semi-installing additional software or change default configuration (network interfaces, autoruns, additional scripts you may want to add).

This is what I do for my RPI boxes - I'm using them as smart home agents plugged into network in different areas of the house - they are able to discover network and start acting as soon as powered up.

Your Answer

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

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