Files
ssmithxandClaude Opus 5.5 f4ed3b8e9d Boot Guix on real Pi 4 hardware with a declarative image
Replace the GRUB/efi-raw + prepare-rpi-image.sh post-processing approach
with a declarative SD image:

- rpi4-image.scm: MBR image with FAT "RPI-BOOT" (start4.elf, u-boot.bin,
  config.txt, overlays, DTB) and ext4 "Guix" root.
- rpi4.scm: u-boot-bootloader variant with no raw-disk installer, so
  reconfigure only rewrites extlinux.conf; serial console on ttyS1;
  linux-rpi4 kernel; root account with uid 0.
- packages/rpi4-linux.scm: nonguix linux + CLK_BCM2835, SD (sdhci-iproc),
  GENET built in.
- packages/u-boot-rpi-arm64-guix-router.scm + rpi-env-layout.patch:
  move load addresses so a 36 MB distro kernel doesn't overlap FDT/initrd.
- run-qemu-rpi4.sh: direct-kernel QEMU raspi4b smoke test.
- Docs: PITFALLS #16-21, README boot flow; Phase 1 confirmed on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 11:44:08 -04:00

38 lines
1.5 KiB
Scheme

;;; Nonguix `linux' with the options a Raspberry Pi 4 needs to boot from
;;; microSD and bring up its onboard Ethernet.
;;;
;;; The stock config ships CLK_BCM2835 disabled (emmc2's clock comes from the
;;; cprman, so the SD card never probes), MMC/regulator/firmware-GPIO bits as
;;; modules (the SD regulators hang off the firmware GPIO expander), and no
;;; GENET Ethernet at all. Everything on the path to the root file system is
;;; built in so the initrd needs no Pi-specific modules.
(define-module (rpi4-linux)
#:use-module (gnu packages linux)
#:use-module (guix packages)
#:use-module (nongnu packages linux)
#:export (linux-rpi4))
(define %rpi4-kernel-configs
'(;; SD card (emmc2): clocks, regulators, controller, block device.
"CONFIG_CLK_BCM2835=y"
"CONFIG_CLK_RASPBERRYPI=y"
"CONFIG_GPIO_RASPBERRYPI_EXP=y"
"CONFIG_REGULATOR_FIXED_VOLTAGE=y"
"CONFIG_REGULATOR_GPIO=y"
"CONFIG_MMC_SDHCI=y"
"CONFIG_MMC_SDHCI_PLTFM=y"
"CONFIG_MMC_SDHCI_IPROC=y"
"CONFIG_RPMB=y" ;MMC_BLOCK depends on RPMB || !RPMB
"CONFIG_MMC_BLOCK=y"
;; VL805 USB 3 controller needs its firmware loaded via the reset driver.
"CONFIG_RESET_RASPBERRYPI=y"
;; Onboard Gigabit Ethernet (BCM54213PE behind GENET).
"CONFIG_BCMGENET=m"
"CONFIG_MDIO_BCM_UNIMAC=m"
"CONFIG_BROADCOM_PHY=m"))
(define-public linux-rpi4
(customize-linux #:name "linux-rpi4"
#:linux linux
#:configs %rpi4-kernel-configs))