Customise Raspberry Pi OS images for SD card flashing
Project description
setup-pi
Tweak the operating system ready for copying it over to an sd card for a raspberry pi. Only works with linux
Uses mounts, docker, chroot and qemu emulation to tweak your raspberry pi OS producing an image.
AI-generated and unreviewed. However... I have used to the create five pi images.
Motivation
I got bored with mounting and settng up a device to get networking via rj-45 working after I had to upgrade a PI. So I decided to automate parts of this.
Part of my motivation was a particularly nasty issue where the Pi would die immeidatley ater boot producing no logs with a certain wifi adaptor. The response from r/raspberrypi on reddit was of course "this is off topic and documented", it was not oftopic or documented.
Alternatives and prior work
Raspios has an image builder. An LLM tells me that this works with a first bookt script. I do not like first book scripts because it can be difficult to debug (you need to reflash, insert into a pi, reboot, wait long enough for a boot, switch off the pi, remove the sd card, then mount)
Installation
Install qemu and docker. Then install
pipx install setup-pi
Usage
Create a toml file describing the image you want to generator.
You can use --sudoers to generate a sudoers rules to run without root.
hostname = "electric-pi"
persistent_logging = true
backdoor = true
first_boot_cmd = "/listen"
# Ethernet - set eth_dhcp = false for static
eth_dhcp = true
# eth_ip = "192.168.0.2"
# eth_netmask = "255.255.255.0"
# eth_gateway = "192.168.0.1" # optional even for static
# WiFi - set wifi = true to configure
wifi = true
wifi_ssid = "wif"
wifi_pass = "XXXXXXXXXX"
# wifi_dhcp = true
# wlan0_ip = "192.168.3.200"
# wifi_netmask = "255.255.255.0"
# wifi_gateway = "192.168.3.1"
packages = ["ncat"]
[[users]]
name = "bruger"
sudo = true
ssh_keys = ["~/.ssh/id_rsa.pub"]
[[files]]
src = "listen"
dst = "/listen"
mode = "0755"
# [[users]]
# name = "guest"
# sudo = false
# password = "letmein"
Then run:
setup-raspios intial.img output.img --config config.toml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file setup_pi-0.1.3.tar.gz.
File metadata
- Download URL: setup_pi-0.1.3.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03265a9d2e47b3e7d40f91d4434380a802a8ea49d8f3a8fe0cd621257cd90b55
|
|
| MD5 |
0653d41f2d4699f48f7a8ee69abfcf73
|
|
| BLAKE2b-256 |
a74e52d37028d6eb4fe9bdc16bffadb3fb2a1f25357eee7372aae00770aad6db
|
File details
Details for the file setup_pi-0.1.3-py3-none-any.whl.
File metadata
- Download URL: setup_pi-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de2f5880e83654a622b19db03b7d8fecd73b2b2008bc722ed0de495dd6eae6c7
|
|
| MD5 |
441ffdcc1927ab8751ee3f757f94df71
|
|
| BLAKE2b-256 |
dc9b5ed9ad6e8bf2c17b31f402a8210bcc7f74dad7bc58552d54d5d5749a4e86
|