projects/guix·blob python-team · refs

133 lines · 4.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2024-2025 Zheng Junjie <[email protected]>
3;;; Copyright © 2026 Artyom V. Poptsov <[email protected]>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Commentary:
21;;;
22;;; With this image, VisionFive2 can boot from MMC1 (MicroSD card) with
23;;; SDIO3.0 boot mode (RPIO_1:L, RGPIO_0:H -- see [1]), in this case the
24;;; board will use U-Boot from Guix System instead of the vendor U-Boot.
25;;; Booting from eMMC and NVME is still work-in-progress.
26;;;
27;;; References:
28;;; 1. <https://doc-en.rvspace.org/VisionFive2/Boot_UG/VisionFive2_SDK_QSG/boot_mode_settings.html>
29;;;
30;;; Code:
31
32(define-module (gnu system images visionfive2)
33 #:use-module (gnu bootloader)
34 #:use-module (gnu bootloader u-boot)
35 #:use-module (gnu services dbus)
36 #:use-module (gnu services dns)
37 #:use-module (gnu services avahi)
38 #:use-module (gnu services shepherd)
39 #:use-module (gnu services ssh)
40 #:use-module (gnu services networking)
41 #:use-module (gnu image)
42 #:use-module (gnu packages linux)
43 #:use-module (guix packages)
44
45 #:use-module (gnu packages ssh)
46 #:use-module (gnu packages guile-xyz)
47 #:use-module (gnu packages admin)
48 #:use-module (gnu services)
49 #:use-module (gnu services base)
50 #:use-module (gnu services networking)
51 #:use-module (gnu system)
52 #:use-module (gnu system file-systems)
53 #:use-module (gnu system image)
54 #:use-module (gnu system linux-initrd)
55 #:use-module (guix platforms riscv)
56 #:use-module (srfi srfi-26)
57 #:export (visionfive2-barebones-os
58 visionfive2-image-type
59 visionfive2-barebones-raw-image))
60
61(define visionfive2-barebones-os
62 (operating-system
63 (host-name "visionfive2")
64 (timezone "Etc/UTC")
65 (locale "en_US.utf8")
66 (bootloader (bootloader-configuration
67 (bootloader u-boot-starfive-visionfive2-bootloader)
68 (targets '("/dev/mmcblk0"))))
69 (file-systems (cons (file-system
70 (device (file-system-label "Guix_image"))
71 (mount-point "/")
72 (type "ext4"))
73 %base-file-systems))
74 (kernel-arguments (list "earlycon" "clk_ignore_unused"))
75 (initrd-modules
76 (append (list "mmc_block"
77 "clk-starfive-jh7110-aon"
78 "clk-starfive-jh7110-stg"
79 "phy-jh7110-dphy-tx"
80 "pcie_starfive"
81 "nvme")
82 %base-initrd-modules))
83 (firmware '())
84 (packages (append (list cloud-utils neofetch) %base-packages))
85 (services
86 (append (list (service openssh-service-type
87 (openssh-configuration
88 (openssh openssh-sans-x)
89 (permit-root-login #t)
90 (allow-empty-passwords? #t)))
91 (service agetty-service-type
92 (agetty-configuration
93 (extra-options '("-L"))
94 (baud-rate "115200")
95 (term "vt100")
96 (tty "ttyS0")))
97 (service dhcpcd-service-type))
98 %base-services))))
99
100(define visionfive2-disk-image
101 (image-without-os
102 (name 'visionfive2-disk-image)
103 (format 'disk-image)
104 (partition-table-type 'gpt)
105 (partitions (list
106 (partition
107 (size (* 1 (expt 2 20)))
108 (label "spl")
109 (offset (* 34 512))
110 (file-system "unformatted")
111 (uuid (uuid "2E54B353-1271-4842-806F-E436D6AF6985")))
112 (partition
113 (size (* 4 (expt 2 20)))
114 (label "uboot")
115 (offset (* 2082 512))
116 (file-system "unformatted")
117 (uuid (uuid "BC13C2FF-59E6-4262-A352-B275FD6F7172")))
118 root-partition))))
119
120(define visionfive2-image-type
121 (image-type
122 (name 'visionfive2-raw)
123 (constructor (cut image-with-os visionfive2-disk-image <>))))
124
125(define visionfive2-barebones-raw-image
126 (image
127 (inherit
128 (os+platform->image visionfive2-barebones-os riscv64-linux
129 #:type visionfive2-image-type))
130 (name 'visionfive2-barebones-raw-image)))
131
132;; Return the default image.
133visionfive2-barebones-raw-image