18

UPDATE: This answer was given a long time ago. It will not build Raspbian Jessie - it will build whatever the Raspberry Pi Foundation's latest released image is based on. At time of writing, this is Raspbian Buster.


I am wanting to generate a custom image of Raspbian Jessie (primarily modifying the UI and adding some extra packages).

Thusfar, I have taken the image provided by the Foundation, modified it 'after the fact' and then taken a backup of the image from the SD card to then distribute. Obviously, this leaves 'fingerprints' on the image and can also makes it difficult to reproduce the steps, should it be required.

I have looked at Spindle, however it seems to have not been updated for Jessie yet. Other tools' documentation has been a bit intimidating, and have left me feeling as though there is a gap in my understanding to be able to achieve what I am trying to do.

What is the easiest way to build a custom version of Raspbian Jessie that would be considered suitable for distribution? Buildroot, Yocto project, OpenEmbedded? How does the Foundation make their image?

Tools, tutorials, documentation, etc. are all welcome - I am really looking for a point of reference to be able to work from with a bit more confidence.

Mike Roberts
  • 595
  • 1
  • 6
  • 13
  • I tried making a package for my self... took me over a week and got nowhere. Probably due to lack of understanding the intrinsics of Linux but I suspect cloning the image, then modifying the image file after cloning may be the best solution in your case. – Piotr Kula Dec 17 '15 at 13:06
  • go to susestudio.com and build your own os / image for raspberry pi (0/2/3) or for computers:) susestudio.com is the easiest way!!! –  Aug 12 '16 at 06:40

4 Answers4

15

I have since learnt that the Raspberry Pi foundation uses this repository for generating their images:

https://github.com/RPi-Distro/pi-gen

This can be modified to create an image as desired.

Mike Roberts
  • 595
  • 1
  • 6
  • 13
3

With regard to making an image, the obvious way would be to just create it from packages. See here if how the images are structured is unclear. Scripting this from a list of sources is probably easier than learning someone else's tool that does pretty much the same thing, especially since the Pi images are slightly unusual.

As for creating the packages, as I think you are aware, Raspbian is variant of Debian, which is the most widely cloned GNU/Linux distro; this is how Ubuntu, Mint, Kali, etc. started (all of which I think still use apt-get and actual Debian packages in their repos).

Here's a couple of questions from our larger sibling Unix & Linux, which have numbers of appropriate answers (the search there was custom debian image is:question):

How to create .debs, the package format used, is well documented with further links on their wiki:

In fact, there's some kind of official .pdf tutorial.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
3

Have you tried the Raspbian UnAttended NetInstaller?
Without any customization it would install a very bare-bones system, but you can customize it in a number of ways, see https://github.com/debian-pi/raspbian-ua-netinst#installer-customization for details about that.
The most interesting part for your use case seems to be to script your customizations in post-install.txt. While it has a .txt extension, it is sourced from the main installation script and thus executed as script and you're free to (ab)use that fact. And this is not some dirty hack.

Diederik de Haas
  • 809
  • 8
  • 12
-1

I think if you can download the image from the raspberrypi.org customise it, and then just dd the whole SD compact it like tar gz or anything like it isn't this a better way for your purpose ?

I was looking into this http://www.linuxfromscratch.org/ a few weeks ago but I've been busy so I never gave it a change, but this may help.

  • I already explained that that is what I was doing, and why that wasn't desirable. The accepted answer is definitely still the best way. – Mike Roberts Aug 04 '18 at 18:21