Skip to content

emojifreak/debian-rpi-image-script

Repository files navigation

NEW: kernel build script by clang is available at https://gist.github.com/emojifreak/180b335cd58edd9a64fc42b85f735c6d

Built images are available at http://114.150.218.139:63873/RPi-boot-images/ built by auto-image-builder.sh (images refreshed on 16 August 2021 after Debian 11 Bullseye release). Now these images support USB booting if you have updated the RPi firmware as https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md .

Warning: You need a recent version of qemu-user-static package. Otherwise the scripts here will probably fail.

debian-rpi-image-script

Shell script to build Debian SD card image booting the Raspberry Pi series. Official Debian SD card images are available at https://raspi.debian.net/ Features provided by this shell script are

  • GPT partitioning and boot from USB.
  • Choice of Debian 10 Buster, 11 Bullseye and later.
  • Choice among ifupdown, Network Manager and systemd-networkd for network configuration
  • Choice of package coverage according to the package priority
  • btrfs and ext4 filesystems can be chosen as /. btrfs compress-force=lzo significantly increases the storage speed and size.
  • Setting the size of a swap partition (or lack of it)
  • Choice of timezone and locale
  • Choice of wireless SSID
  • Choice of keyboard layout

If you find any trouble, please report it as a github issue here. Other build shell scripts are listed below.

raspberripyOS-rpi-sd-builder

Use the kernel from Raspberry Pi OS. Except that, it is the same as above. Use of Gnome Wayland requires module_blacklist=v3d. This is a bug in gnome-shell.

devuan-rpi-image-script

SD card image builder is also available here for Devuan 3 Beowulf, 4 Chimaera and later. Devuan official images are available at https://arm-files.devuan.org/ , which does not have an image for RPi4, but the above script can produce an image booting RPi4 (incl. 8GB model). The two shell scripts are similar except packages given as an argument to mmdebstrap, namely, systemd-sysv,udev,debian-archive-keyring versus sysvinit-core,eudev,devuan-keyring,sntp. Hardware clock can be corrected by sntp -S pool.ntp.org as root.

Additional packages

  • Graphical User Interface can be installed by tasksel or apt-get install task-xfce-desktop.
  • language supports can be installed, for example, by apt-get install task-japanese task-japanese-desktop.

Running 32-bit kernel on RPi 3 or 4

32-bit kernel on 64-bit ARM CPU is unsupported by Debian kernel team, unlike the Raspberry Pi OS. build-raspi-kernel.sh can build a 32-bit kernel runnable on RPi 3 and 4. Compilation must be done in a Debian 11 Bullseye armhf (container or VM or a real hardware). The missing config item in the Debian kernel is CONFIG_PCIE_BRCMSTB=m, which is turned on only for arm64. 32-bit kernel usable on RPi 3 and 4 are available from http://114.150.218.139:63873/32bit-kernels-for-64bit-raspberrypi/

Comments on Linux 5.10 and Rapsberry Pi 4 (as of April 2021)

32-bit executables on 64-bit linux-image-arm64 kernel

linux-image-arm64 64-bit kernel can run armhf 32-bit executables. If armhf,arm64 is given to the above scripts as the target architecture in place of armhf or arm64, then an SD card with 32-bit executables and 64-bit kernel will be built. It should boot if debian-rpi-sd-builder.sh is used. It will not if devuan-rpi-sd-builder.sh is used, and the following steps are necessary. The difference comes from systemd-nspawn versus chroot.

  1. mount /dev/mmcblk0p2 /mnt
  2. mount /dev/mmcblk0p1 /mnt/boot/firmware
  3. echo arm_64bit=1 >>/mnt/boot/firmware/config.txt
  4. cp -p /mnt/usr/lib/linux-image-*-arm64/broadcom/bcm*rpi*.dtb /mnt/boot/firmware
  5. umount /mnt/boot/firmware
  6. umount /mnt

Other image builders

If you find another builder not listed above, please open a github issue. Where is the Ubuntu official builder?

Debian ARM mailing list

https://lists.debian.org/debian-arm/ is a mailing list for talking Debian ARM related topics, including Raspberry Pi.

About

Shell script to build Debian and Devuan SD card image booting the Raspberry Pi series

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages