Re: Building debian-live for Raspberry Pi
Hi Marc,
On 2025-08-26 08:53, Marc Haber wrote:
> When am I supposed to delete everything and start over again with lb config,
> and when is it okay to edit files in config/? From what I understand, some
> settings of lb config can result in multiple changes inside config, so I am
> probably safer off by starting over every time again until I know better
> what I am doing, right?
My usual workflow depends on whether I'm playing around to figure out
how to do what I want, or actually building the image.
When I'm playing around, I start by creating a temporary directory, and
run `lb config` in it with the needed parameters (eg: --distribution).
At this point my understanding is that it's safe to customize things
under config/ and run `lb build` multiple times. If I need to run `lb
config` with other arguments, I delete everything and start again. Once
I think I got the general idea right, I move to My Script (read on).
> I currently use this shell script to initiate build:
>
> | MIRROR="http://debian.debian.zugschlus.de/debian"
> | SECMIRROR="http://debian-security.debian.zugschlus.de/debian-security"
> | | rm -rf * .build
> | sudo lb clean
> | CO="--apt-indices false --apt-recommends false"
> | CO="$CO --debootstrap-options \"--variant=minbase\""
> | CO="$CO --firmware-chroot false --memtest none"
> | CO="$CO --mirror-binary-security $SECMIRROR"
> | CO="$CO --mirror-chroot-security $SECMIRROR"
> | | | lb config --binary-image hdd --architecture arm64 $CO
> | | echo "zstd sudo user-setup sq sequoia-chameleon-gnupg" >
> config/package-lists/recommends.list.chroot
> | sudo lb build
>
> Is there any better way to do it?
Not sure if better or worse, but My Script looks more or less like this:
destdir="$(mktemp -d)"
cd $destdir
lb config [...]
echo curl >> config/package-lists/live.list.chroot
[...]
sudo lb build
If the resulting image needs to be changed in any way, I edit the script
and start again. So effectively I'm throwing everything away at each
iteration, when actually building the image.
> I am currently using this on an amd64 system with qemu-user-binfmt. Is that
> a valid way to build a live image? A genuine Raspberry Pi takes about ten
> minutes to build an image (with a fast USB3 SSD), but I'd need to pull the
> 300 MB image to my notebook then to transfer it to the system that I will be
> using to boot the image. Otoh, the "cross build" on the machine with the
> vastly quicker mass storage takes about twice as long because the emulation
> is so slow. Especially building the initramfs feels like the process has
> stalled.
"Cross" building the image takes a very long time indeed. We did it once
for the official ISO and it took several hours on a fairly fast machine:
https://cdimage.debian.org/cdimage/weekly-live-builds/arm64/iso-hybrid/debian-live-testing-arm64-gnome.iso.log
I would recommend building it on the Raspberry Pi, ten minutes does not
sound *too* bad. Another option if you're building often enough could be
renting an arm64 VM from one of the many cloud providers. This is the
sort of use case where The Cloud can make sense, I think: start the vm,
build the image, destroy the vm. Costs should be minimal.
> Can I influence the partitioning that live-build puts into the hdd image?
> The Raspberry Pi needs a FAT32 to load its firmware from. I think that I
> would try to put the squashfs and the other auxiliary files that Debian-live
> needs to boot on the FAT32 firmware partition as well. Should this not be
> possible (for example, in the case that the raspi firmware has a size limit
> for the FAT32 partition), how can I build the HDD image with two partitions?
>
> Where would I place files that I need to be copied to one of the partitions
> of the image? I think that I at least need a config.txt and probably a
> cmdline.txt on the FAT32 partition.
Not sure about that, but I know that for persistence you can create a
separate partition and label it accordingly:
https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#580
Perhaps see if the manual has more about this?
Oh, although this is probably going to be too entry-level, I gave a
presentation about Debian Live that may be of interest:
https://wiki.debian.org/DebianEvents/gb/2024/MiniDebConfCambridge/Rocca
Reply to: