summaryrefslogtreecommitdiff
path: root/px/system/raspberry.scm
diff options
context:
space:
mode:
authorFranz Geffke <franz@pantherx.org>2023-11-06 20:08:14 +0000
committerFranz Geffke <franz@pantherx.org>2023-11-06 20:08:14 +0000
commit47b4c9c854915df93893dbaa993accfacf9027fe (patch)
tree4f9b1742d63fcfbc94cc6b8d84f76c4d00c3a0b7 /px/system/raspberry.scm
parent0b426d7b7ed8e176bf464ef9e0683f74a6c9d20f (diff)
rewrite: apply guix-reference formatting; cleanup some module imports
Diffstat (limited to 'px/system/raspberry.scm')
-rw-r--r--px/system/raspberry.scm252
1 files changed, 117 insertions, 135 deletions
diff --git a/px/system/raspberry.scm b/px/system/raspberry.scm
index f63c69c..f9b903d 100644
--- a/px/system/raspberry.scm
+++ b/px/system/raspberry.scm
@@ -38,13 +38,8 @@
%reterminal-gui-services
reterminal-gui-os))
-
(define %raspberrypi-config-params
- (list "enable_uart=1"
- "uart_2ndstage=1"
- "arm_64bit=1"
- "kernel=u-boot.bin"))
-
+ (list "enable_uart=1" "uart_2ndstage=1" "arm_64bit=1" "kernel=u-boot.bin"))
(define %raspberrypi-cmdline-params
(list "root=LABEL=RASPIROOT rw rootwait"
@@ -52,90 +47,89 @@
"selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N"
"dwc_otg.lpm_enable=0 kgdboc=serial0,115200"))
-
(define (make-raspberrypi-boot-partition config cmdline)
- (partition
- (size (* 128 (expt 2 20)))
- (label "BOOT")
- (file-system "fat32")
- (flags '())
- (initializer
- (gexp (lambda* (root #:key #:allow-other-keys)
- (use-modules (guix build utils))
- (mkdir-p root)
- (copy-recursively #$(file-append u-boot-rpi-arm64 "/libexec/u-boot.bin" )
- (string-append root "/u-boot.bin"))
- (copy-recursively #$(file-append raspberrypi-firmware "/" ) root)
- (copy-recursively #$(file-append seeed-reterminal-dtoverlays "/" )
- (string-append root "/overlays"))
- (copy-recursively #$(plain-file "config.txt"
- (string-join config "\n"))
- (string-append root "/config.txt"))
- (copy-recursively #$(plain-file "cmdline.txt"
- (string-join cmdline " "))
- (string-append root "/cmdline.txt"))
- )))))
+ (partition (size (* 128
+ (expt 2 20)))
+ (label "BOOT")
+ (file-system
+ "fat32")
+ (flags '())
+ (initializer #~(lambda* (root #:key #:allow-other-keys)
+ (use-modules (guix build utils))
+ (mkdir-p root)
+ (copy-recursively #$(file-append
+ u-boot-rpi-arm64
+ "/libexec/u-boot.bin")
+ (string-append root
+ "/u-boot.bin"))
+ (copy-recursively #$(file-append
+ raspberrypi-firmware "/")
+ root)
+ (copy-recursively #$(file-append
+ seeed-reterminal-dtoverlays
+ "/")
+ (string-append root
+ "/overlays"))
+ (copy-recursively #$(plain-file "config.txt"
+ (string-join
+ config "\n"))
+ (string-append root
+ "/config.txt"))
+ (copy-recursively #$(plain-file "cmdline.txt"
+ (string-join
+ cmdline " "))
+ (string-append root
+ "/cmdline.txt"))))))
(define %raspberrypi-boot-partition
(make-raspberrypi-boot-partition %raspberrypi-config-params
%raspberrypi-cmdline-params))
-
(define %raspberrypi-root-partition
- (partition
- (size 'guess)
- (label "RASPIROOT")
- (file-system "ext4")
- (flags '(boot))
- (initializer (gexp initialize-root-partition))))
-
+ (partition (size 'guess)
+ (label "RASPIROOT")
+ (file-system
+ "ext4")
+ (flags '(boot))
+ (initializer #~initialize-root-partition)))
(define raspberrypi-image-type
- (image-type
- (name 'raspberrypi-raw)
- (constructor (cut image-with-os
- (image-without-os
- (format 'disk-image)
- (partitions (list %raspberrypi-boot-partition
- %raspberrypi-root-partition)))
- <>))))
-
+ (image-type (name 'raspberrypi-raw)
+ (constructor (cut image-with-os
+ (image-without-os (format 'disk-image)
+ (partitions (list
+ %raspberrypi-boot-partition
+ %raspberrypi-root-partition)))
+ <>))))
(define raspberrypi-gui-os
(operating-system
(inherit px-gui-arm-os)
-
+
(bootloader (bootloader-configuration
- (bootloader u-boot-rpi-arm64-bootloader)
- (targets '("/dev/vda"))
+ (bootloader u-boot-rpi-arm64-bootloader)
+ (targets '("/dev/vda"))
(device-tree-support? #f)))
(kernel linux-raspberry-5.15)
- (kernel-arguments (cons* "cgroup_enable=memory"
- %default-kernel-arguments))
+ (kernel-arguments (cons* "cgroup_enable=memory" %default-kernel-arguments))
(initrd-modules '())
- (firmware (list raspberrypi-firmware
- brcm80211-firmware
- bluez-firmware))
+ (firmware (list raspberrypi-firmware brcm80211-firmware bluez-firmware))
(file-systems (cons* (file-system
- (device (file-system-label "BOOT"))
- (mount-point "/boot/firmware")
- (type "vfat"))
+ (device (file-system-label "BOOT"))
+ (mount-point "/boot/firmware")
+ (type "vfat"))
(file-system
- (device (file-system-label "RASPIROOT"))
- (mount-point "/")
- (type "ext4"))
- %base-file-systems))
- (services (cons* (service btuart-service-type)
- %px-gui-arm-services))))
-
+ (device (file-system-label "RASPIROOT"))
+ (mount-point "/")
+ (type "ext4")) %base-file-systems))
+ (services
+ (cons* (service btuart-service-type) %px-gui-arm-services))))
(define raspberrypi-gui-image
- (image
- (inherit
- (os+platform->image raspberrypi-gui-os aarch64-linux
- #:type raspberrypi-image-type))
- (partition-table-type 'mbr)
- (name 'raspberrypi-gui-image)))
+ (image (inherit (os+platform->image raspberrypi-gui-os aarch64-linux
+ #:type raspberrypi-image-type))
+ (partition-table-type 'mbr)
+ (name 'raspberrypi-gui-image)))
;;
;; SEEED reTerminal core configurations
@@ -152,7 +146,7 @@
"dtoverlay=reTerminal,tp_rotate=0"
"dtoverlay=reTerminal-bridge"
"dtoverlay=reTerminal,key0=0x043,key1=0x044,key2=0x057,key3=0x058"
- "vt.global_cursor_default=0"
+ "vt.global_cursor_default=0"
%raspberrypi-config-params))
(define %reterminal-cmdline-params
@@ -162,87 +156,74 @@
(make-raspberrypi-boot-partition %reterminal-config-params
%reterminal-cmdline-params))
-
(define reterminal-image-type
- (image-type
- (name 'reterminal-image-raw)
- (constructor (cut image-with-os
- (image-without-os
- (format 'disk-image)
- (partitions (list %reterminal-boot-partition
- %raspberrypi-root-partition)))
- <>))))
+ (image-type (name 'reterminal-image-raw)
+ (constructor (cut image-with-os
+ (image-without-os (format 'disk-image)
+ (partitions (list
+ %reterminal-boot-partition
+ %raspberrypi-root-partition)))
+ <>))))
(define %reterminal-core-packages
%px-core-arm-packages)
-
(define %reterminal-core-services
%px-core-arm-services)
-
(define* (reterminal-core-os #:key (open-ports %px-server-open-ports-common)
- (authorized-keys '()))
- (make-os
- (operating-system
- (host-name "reterminal-core")
- (timezone "Europe/Berlin")
- (locale "en_US.utf8")
-
- (bootloader (bootloader-configuration
- (bootloader u-boot-rpi-arm64-bootloader)
- (targets '("/dev/vda"))
- (device-tree-support? #f)))
- (initrd-modules '())
- (kernel linux-raspberry-5.15)
- (kernel-loadable-modules %reterminal-kernel-modules)
- (kernel-arguments (cons* "cgroup_enable=memory"
- %default-kernel-arguments))
- (file-systems (cons* (file-system
- (device (file-system-label "BOOT"))
- (mount-point "/boot/firmware")
- (type "vfat"))
- (file-system
- (device (file-system-label "RASPIBOOT"))
- (mount-point "/")
- (type "ext4"))
- %base-file-systems))
- (users (cons (user-account
- (name "panther")
- (comment "panther's account")
- (group "users")
- (password (crypt "pantherx" "$6$abc"))
- (supplementary-groups '("wheel"
- "audio" "video"))
- (home-directory "/home/panther"))
- %base-user-accounts))
- (name-service-switch %mdns-host-lookup-nss))
- #:kernel 'custom
- #:open-ports open-ports
- #:authorized-keys authorized-keys
- #:templates (list %raspberry-pi-4-template
- %seeed-reterminal-template)
- #:default-packages %reterminal-core-packages
- #:default-services %reterminal-core-services)
- )
+ (authorized-keys '()))
+ (make-os (operating-system
+ (host-name "reterminal-core")
+ (timezone "Europe/Berlin")
+ (locale "en_US.utf8")
+
+ (bootloader (bootloader-configuration
+ (bootloader u-boot-rpi-arm64-bootloader)
+ (targets '("/dev/vda"))
+ (device-tree-support? #f)))
+ (initrd-modules '())
+ (kernel linux-raspberry-5.15)
+ (kernel-loadable-modules %reterminal-kernel-modules)
+ (kernel-arguments (cons* "cgroup_enable=memory"
+ %default-kernel-arguments))
+ (file-systems (cons* (file-system
+ (device (file-system-label "BOOT"))
+ (mount-point "/boot/firmware")
+ (type "vfat"))
+ (file-system
+ (device (file-system-label "RASPIBOOT"))
+ (mount-point "/")
+ (type "ext4")) %base-file-systems))
+ (users (cons (user-account
+ (name "panther")
+ (comment "panther's account")
+ (group "users")
+ (password (crypt "pantherx" "$6$abc"))
+ (supplementary-groups '("wheel" "audio" "video"))
+ (home-directory "/home/panther"))
+ %base-user-accounts))
+ (name-service-switch %mdns-host-lookup-nss))
+ #:kernel 'custom
+ #:open-ports open-ports
+ #:authorized-keys authorized-keys
+ #:templates (list %raspberry-pi-4-template
+ %seeed-reterminal-template)
+ #:default-packages %reterminal-core-packages
+ #:default-services %reterminal-core-services))
(define reterminal-core-image
- (image
- (inherit
- (os+platform->image (reterminal-core-os)
- aarch64-linux
- #:type reterminal-image-type))
- (partition-table-type 'mbr)
- (name 'reterminal-core-image)))
+ (image (inherit (os+platform->image (reterminal-core-os) aarch64-linux
+ #:type reterminal-image-type))
+ (partition-table-type 'mbr)
+ (name 'reterminal-core-image)))
;;
;; SEEED reTerminal GUI configuration
;;
-
(define %reterminal-gui-packages
- (cons* seeed-reterminal-dtoverlays
- %px-gui-arm-packages))
+ (cons* seeed-reterminal-dtoverlays %px-gui-arm-packages))
(define %reterminal-gui-services
%px-gui-arm-services)
@@ -252,4 +233,5 @@
(inherit raspberrypi-gui-os)
(kernel-loadable-modules %reterminal-kernel-modules)
(packages %reterminal-gui-packages)
- (services %reterminal-gui-services)))
+ (services
+ %reterminal-gui-services)))