simonpoole
Posts: 3
Joined: Thu Nov 13, 2014 12:56 pm

Minimal Raspbian build using live-build

Thu Nov 13, 2014 1:12 pm

I've been experimenting with Debian's "live-build" tool to build a bootable minimal Raspbian-based disk image, and I thought it was worth sharing.

Build code:
https://github.com/simonpoole1/raspbian-live-build
Example disk image (tested only on my own model-B Pi so far):
https://www.dropbox.com/s/m9rbkou09gb9f ... 1.img?dl=0

It's built using the raspbian.org and raspberrypi.org APT repositories, so it's the exact same software you get in a Raspbian image - just less of it. It's trivial to configure a list of packages to include in the build (see the README).

It's installed into a read-only Squashfs image, with a non-persistent read-write overlay (in-memory using aufs), but it should be possible to tweak the build to use a persistent overlay.

The image currently includes:
* The PI firmware/bootloader
* The very miminal core of Raspian - the basic Debian packages you need for a working OS plus apt-get.
* Basic networking tools (e.g. ifconfig, dhclient, ifup)
* rpi-update

It boots to a command-line login prompt (user:pi, pass:pi), and from there you can install more packages with "sudo apt-get".

Hopefully that's of use to someone.

Simon

alwanbi
Posts: 17
Joined: Mon Oct 06, 2014 12:34 am
Contact: Website

Re: Minimal Raspbian build using live-build

Fri Nov 14, 2014 4:20 pm

Hi Simon,
Thanks for doing this for the raspberry pi community!
I was just wondering where to go next with my distro experiments.
Currently I am using piCore for a specific application but I don't know how to compile the kernel to get a specific v4l-dvb module I need.
I will test this distro out later tonite when I get home from work and let you know how it goes.

Alan
Alan Jones

diederik
Posts: 393
Joined: Wed Mar 26, 2014 11:17 pm

Re: Minimal Raspbian build using live-build

Fri Nov 14, 2014 5:35 pm

This is awesome, thank you very much 8-)

alwanbi
Posts: 17
Joined: Mon Oct 06, 2014 12:34 am
Contact: Website

Re: Minimal Raspbian build using live-build

Mon Nov 17, 2014 4:13 am

Hi Simon,
I am currently testing out your image.
Do you have plans for incorporating persistence in the future?

Alan
Alan Jones

simonpoole
Posts: 3
Joined: Thu Nov 13, 2014 12:56 pm

Re: Minimal Raspbian build using live-build

Tue Nov 18, 2014 9:15 am

Alan - I've had a brief play with persistence and it worked easily for certain directories like /etc and /home, but not the root folder ("/"). It fails to boot - I haven't had time to dig into why. I really want a persistent overlay for the root folder so that apt installs/updates will stick. What did you want persistence for?

The live-build system lets you take other approaches - e.g. it should be possible to generate an image with a regular read-write root partition instead of a read-only squashfs file. But I'm keen on the squashfs approach because it should be possible to make the Pi more robust against filesystem corruption.

alwanbi
Posts: 17
Joined: Mon Oct 06, 2014 12:34 am
Contact: Website

Re: Minimal Raspbian build using live-build

Tue Nov 18, 2014 4:29 pm

Morning Simon,
We are tracking on the same thing, lol.
I also would like /home, /etc, and any apt-get installs to stick.
I like your approach to making the Pi more robust against filesystem corruption.
With /etc persistent it will help beef up security for ssh and save some initial typing after booting up the system.

Alan
Alan Jones

simonpoole
Posts: 3
Joined: Thu Nov 13, 2014 12:56 pm

Re: Minimal Raspbian build using live-build

Fri Nov 28, 2014 2:31 pm

I haven't got time to take this any further at the moment. I've posted a 'TODO' list of possible next steps (https://github.com/simonpoole1/raspbian ... er/TODO.md). If anyone wants to improve on what I've done so far and send any fixes/changes my way, I'd be happy to roll them in.

whoami
Posts: 64
Joined: Fri Nov 15, 2013 1:41 pm

Re: Minimal Raspbian build using live-build

Fri Nov 28, 2014 3:41 pm

This is actually very useful for security purposes. Can use this to boot a pi and then chroot into a full fledged raspbian on another partition.

beta-tester
Posts: 1373
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Minimal Raspbian build using live-build

Sat Nov 29, 2014 8:38 am

simonpoole wrote:I've been experimenting with Debian's "live-build" tool to build a bootable minimal Raspbian-based disk image, and I thought it was worth sharing.

Build code:
https://github.com/simonpoole1/raspbian-live-build
thank you very much... sounds very interesting.

BTW: at the Install instruction is written:

Code: Select all

sudo apt-get install pv
pv pi-minimal.img | sudo dd of=/dev/path-to-your-sd-card bs=16M
why installing and using pv?
isnt is possible to use dd alone like:

Code: Select all

sudo dd if=pi-minimal.img of=/dev/path-to-your-sd-card bs=16M
it looks not so complicated
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

bash21
Posts: 2
Joined: Wed Dec 17, 2014 5:35 pm

Re: Minimal Raspbian build using live-build

Wed Dec 17, 2014 5:40 pm

hi, tried to build an own image (no changes made in your config) and i got the following error:

Code: Select all

lb config: unrecognized option '--bootstrap-flavour'
Makefile:66: recipe for target 'config' failed
make: *** [config] Error 1
does someone know what's going wrong?

bash21
Posts: 2
Joined: Wed Dec 17, 2014 5:35 pm

Re: Minimal Raspbian build using live-build

Wed Dec 17, 2014 5:42 pm

hi, tried to build my own image, but i got the following error (i didn't change anything in the configuration):

Code: Select all

lb config: unrecognized option '--bootstrap-flavour'
Makefile:66: recipe for target 'config' failed
make: *** [config] Error 1
what's going wrong?

Return to “Raspberry Pi OS”