2019-07-19 01:22:46 +01:00
|
|
|
# Raspberry Pi image specs
|
2017-10-08 21:18:48 +01:00
|
|
|
|
2019-07-19 01:22:46 +01:00
|
|
|
This repository contains the files with which the images referenced at
|
|
|
|
https://wiki.debian.org/RaspberryPiImages have been built.
|
2017-10-08 21:18:48 +01:00
|
|
|
|
|
|
|
## Option 1: Downloading an image
|
|
|
|
|
2019-08-30 15:16:27 +01:00
|
|
|
See https://wiki.debian.org/RaspberryPiImages for where to obtain the
|
2019-07-19 01:22:46 +01:00
|
|
|
latest pre-built image.
|
2017-10-08 21:18:48 +01:00
|
|
|
|
|
|
|
## Option 2: Building your own image
|
|
|
|
|
2021-12-08 23:03:41 +00:00
|
|
|
If you prefer, you can build a Debian Raspberry Pi image
|
2018-07-18 23:57:39 +01:00
|
|
|
yourself. If you are reading this document online, you should first
|
|
|
|
clone this repository:
|
2017-10-08 21:18:48 +01:00
|
|
|
|
|
|
|
```shell
|
2019-07-19 01:22:46 +01:00
|
|
|
git clone --recursive https://salsa.debian.org/raspi-team/image-specs.git
|
|
|
|
cd image-specs
|
2017-10-25 09:55:04 +01:00
|
|
|
```
|
|
|
|
|
2020-08-15 06:52:44 +01:00
|
|
|
For this you will first need to install the following packages on a
|
2021-08-02 18:17:25 +01:00
|
|
|
Debian Bullseye (11) or higher system:
|
2020-08-15 06:52:44 +01:00
|
|
|
|
|
|
|
* binfmt-support
|
2021-08-02 18:17:25 +01:00
|
|
|
* bmap-tools
|
|
|
|
* debootstrap
|
|
|
|
* dosfstools
|
|
|
|
* fakemachine (optional, only available on amd64)
|
|
|
|
* kpartx
|
2021-03-04 08:41:51 +00:00
|
|
|
* qemu-utils
|
2020-08-20 13:27:53 +01:00
|
|
|
* qemu-user-static
|
2020-08-29 19:38:44 +01:00
|
|
|
* time
|
2021-08-02 18:17:25 +01:00
|
|
|
* vmdb2 (>= 0.17)
|
2021-12-08 23:02:51 +00:00
|
|
|
* python3
|
2020-08-29 19:38:44 +01:00
|
|
|
|
|
|
|
To install these (as root):
|
|
|
|
```shell
|
2021-12-08 23:02:51 +00:00
|
|
|
apt install -y vmdb2 dosfstools qemu-utils qemu-user-static debootstrap binfmt-support time kpartx bmap-tools python3
|
2021-04-24 23:07:01 +01:00
|
|
|
apt install -y fakemachine
|
2020-08-29 19:38:44 +01:00
|
|
|
```
|
2020-08-15 06:52:44 +01:00
|
|
|
|
2020-08-20 13:27:53 +01:00
|
|
|
If debootstrap still fails with exec format error, try
|
2021-02-07 01:45:01 +00:00
|
|
|
running `dpkg-reconfigure qemu-user-static`. This calls
|
2020-08-20 13:27:53 +01:00
|
|
|
`/var/lib/dpkg/info/qemu-user-static.postinst` which uses binfmt-support
|
|
|
|
to register the executable format with /usr/bin/qemu-$fmt-static
|
|
|
|
|
2019-12-17 20:41:16 +00:00
|
|
|
This repository includes a master YAML recipe (which is basically a
|
|
|
|
configuration file) for all of the generated images, diverting as
|
|
|
|
little as possible in a parametrized way. The master recipe is
|
|
|
|
[raspi_master.yaml](raspi_master.yaml).
|
2019-07-19 01:22:46 +01:00
|
|
|
|
2021-02-02 09:21:35 +00:00
|
|
|
A Makefile is supplied to drive the build of the recipes into images.
|
2021-04-24 23:07:01 +01:00
|
|
|
If `fakemachine` is installed, it can be run as an unprivileged user.
|
|
|
|
Otherwise, because some steps of building the image require root privileges,
|
|
|
|
you'll need to execute `make` as root.
|
|
|
|
|
2021-02-02 09:21:35 +00:00
|
|
|
The argument to `make` is constructed as follows:
|
|
|
|
`raspi_<model>_<release>.<result-type>`
|
|
|
|
|
2023-06-13 20:09:45 +01:00
|
|
|
Whereby <model\> is one of `1`, `2`, `3` or `4`, <release\> is either
|
2023-06-13 20:02:39 +01:00
|
|
|
`bullseye`, `bookworm`, or `trixie`; and <result-type\> is `img` or `yaml`.
|
2021-02-02 09:21:35 +00:00
|
|
|
|
|
|
|
Model `1` should be used for the Raspberry Pi 0, 0w and 1, models A and
|
|
|
|
B. Model `2` for the Raspberry Pi 2 models A and B. Model `3` for all
|
|
|
|
models of the Raspberry Pi 3 and model `4` for all models of the
|
2021-08-02 18:17:25 +01:00
|
|
|
Raspberry Pi 4.
|
2021-02-02 09:21:35 +00:00
|
|
|
So if you want to build the default image for a Raspberry Pi 3B+ with
|
|
|
|
Bullseye, you can just issue:
|
2019-07-19 01:22:46 +01:00
|
|
|
|
2019-12-17 20:41:16 +00:00
|
|
|
```shell
|
2021-02-02 09:21:35 +00:00
|
|
|
make raspi_3_bullseye.img
|
2019-12-17 20:41:16 +00:00
|
|
|
```
|
|
|
|
|
2021-02-02 09:21:35 +00:00
|
|
|
This will first create a `raspi_3_bullseye.yaml` file and then use that
|
|
|
|
*yaml* recipe to build the image with `vmdb2`.
|
|
|
|
|
|
|
|
You can also edit the `yaml` file to customize the built image. If you
|
2019-12-17 20:41:16 +00:00
|
|
|
want to start from the platform-specific recipe, you can issue:
|
|
|
|
|
2021-02-02 09:21:35 +00:00
|
|
|
```shell
|
|
|
|
make raspi_3_bullseye.yaml
|
|
|
|
```
|
2019-12-17 20:41:16 +00:00
|
|
|
The recipe drives [vmdb2](https://vmdb2.liw.fi/), the successor to
|
|
|
|
`vmdebootstrap`. Please refer to [its
|
2021-02-02 09:21:35 +00:00
|
|
|
documentation](https://vmdb2.liw.fi/documentation/) for further details;
|
|
|
|
it is quite an easy format to understand.
|
2019-07-19 01:22:46 +01:00
|
|
|
|
2019-12-17 20:41:16 +00:00
|
|
|
Copy the generated file to a name descriptive enough for you (say,
|
2021-02-02 09:21:35 +00:00
|
|
|
`my_raspi_bullseye.yaml`). Once you have edited the recipe for your
|
|
|
|
specific needs, you can generate the image by issuing the following (as
|
|
|
|
root):
|
2017-10-25 09:55:04 +01:00
|
|
|
|
|
|
|
```shell
|
2021-02-02 09:21:35 +00:00
|
|
|
vmdb2 --rootfs-tarball=my_raspi_bullseye.tar.gz --output \
|
|
|
|
my_raspi_bullseye.img my_raspi_bullseye.yaml --log my_raspi_bullseye.log
|
2017-10-08 21:18:48 +01:00
|
|
|
```
|
|
|
|
|
2021-02-02 09:21:35 +00:00
|
|
|
This is, just follow what is done by the `_build_img` target of the
|
|
|
|
Makefile.
|
2019-07-19 01:22:46 +01:00
|
|
|
|
|
|
|
## Installing the image onto the Raspberry Pi
|
2017-10-08 21:18:48 +01:00
|
|
|
|
|
|
|
Plug an SD card which you would like to entirely overwrite into your SD card reader.
|
|
|
|
|
2019-07-19 01:22:46 +01:00
|
|
|
Assuming your SD card reader provides the device `/dev/mmcblk0`
|
2018-12-05 00:38:09 +00:00
|
|
|
(**Beware** If you choose the wrong device, you might overwrite
|
|
|
|
important parts of your system. Double check it's the correct
|
|
|
|
device!), copy the image onto the SD card:
|
2017-10-08 21:18:48 +01:00
|
|
|
|
|
|
|
```shell
|
2021-08-02 18:17:25 +01:00
|
|
|
bmaptool copy raspi_3_bullseye.img.xz /dev/mmcblk0
|
|
|
|
```
|
|
|
|
|
|
|
|
Alternatively, if you don't have `bmap-tools` installed, you can use
|
|
|
|
`dd` with the compressed image:
|
|
|
|
|
|
|
|
```shell
|
2023-10-05 19:55:23 +01:00
|
|
|
xzcat raspi_3_bullseye.img.xz | dd of=/dev/mmcblk0 bs=64k oflag=dsync status=progress
|
2021-08-02 18:17:25 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Or with the uncompressed image:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
dd if=raspi_3_bullseye.img of=/dev/mmcblk0 bs=64k oflag=dsync status=progress
|
2017-10-08 21:18:48 +01:00
|
|
|
```
|
|
|
|
|
2019-07-19 01:22:46 +01:00
|
|
|
Then, plug the SD card into the Raspberry Pi, and power it up.
|
2017-10-08 21:18:48 +01:00
|
|
|
|
2020-07-07 21:19:43 +01:00
|
|
|
The image uses the hostname `rpi0w`, `rpi2`, `rpi3`, or `rpi4` depending on the
|
2019-12-17 20:41:16 +00:00
|
|
|
target build. The provided image will allow you to log in with the
|
|
|
|
`root` account with no password set, but only logging in at the
|
|
|
|
physical console (be it serial or by USB keyboard and HDMI monitor).
|