diff options
| -rw-r--r-- | gnu/local.mk | 1 | ||||
| -rw-r--r-- | gnu/system/images/visionfive2.scm | 122 |
2 files changed, 123 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index e0e3ebbea68..d76c0d1e39f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk | |||
| @@ -778,6 +778,7 @@ GNU_SYSTEM_MODULES = \ | |||
| 778 | %D%/system/images/pinebook-pro.scm \ | 778 | %D%/system/images/pinebook-pro.scm \ |
| 779 | %D%/system/images/rock64.scm \ | 779 | %D%/system/images/rock64.scm \ |
| 780 | %D%/system/images/unmatched.scm \ | 780 | %D%/system/images/unmatched.scm \ |
| 781 | %D%/system/images/visionfive2.scm \ | ||
| 781 | %D%/system/images/wsl2.scm \ | 782 | %D%/system/images/wsl2.scm \ |
| 782 | \ | 783 | \ |
| 783 | %D%/machine.scm \ | 784 | %D%/machine.scm \ |
diff --git a/gnu/system/images/visionfive2.scm b/gnu/system/images/visionfive2.scm new file mode 100644 index 00000000000..26f70afbc14 --- /dev/null +++ b/gnu/system/images/visionfive2.scm | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> | ||
| 3 | ;;; | ||
| 4 | ;;; This file is part of GNU Guix. | ||
| 5 | ;;; | ||
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | ;;; under the terms of the GNU General Public License as published by | ||
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | ;;; your option) any later version. | ||
| 10 | ;;; | ||
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | ;;; GNU General Public License for more details. | ||
| 15 | ;;; | ||
| 16 | ;;; You should have received a copy of the GNU General Public License | ||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | (define-module (gnu system images visionfive2) | ||
| 20 | #:use-module (gnu bootloader) | ||
| 21 | #:use-module (gnu bootloader u-boot) | ||
| 22 | #:use-module (gnu services dbus) | ||
| 23 | #:use-module (gnu services dns) | ||
| 24 | #:use-module (gnu services avahi) | ||
| 25 | #:use-module (gnu services shepherd) | ||
| 26 | #:use-module (gnu services ssh) | ||
| 27 | #:use-module (gnu services networking) | ||
| 28 | #:use-module (gnu image) | ||
| 29 | #:use-module (gnu packages linux) | ||
| 30 | #:use-module (guix packages) | ||
| 31 | |||
| 32 | #:use-module (gnu packages ssh) | ||
| 33 | #:use-module (gnu packages guile-xyz) | ||
| 34 | #:use-module (gnu packages admin) | ||
| 35 | #:use-module (gnu services) | ||
| 36 | #:use-module (gnu services base) | ||
| 37 | #:use-module (gnu services networking) | ||
| 38 | #:use-module (gnu system) | ||
| 39 | #:use-module (gnu system file-systems) | ||
| 40 | #:use-module (gnu system image) | ||
| 41 | #:use-module (guix platforms riscv) | ||
| 42 | #:use-module (srfi srfi-26) | ||
| 43 | #:export (visionfive2-barebones-os | ||
| 44 | visionfive2-image-type | ||
| 45 | visionfive2-barebones-raw-image)) | ||
| 46 | |||
| 47 | ;;; Commentary: | ||
| 48 | ;;; | ||
| 49 | ;;; VisionFive2 can boot from MMC1 (SPI flash) or MMC2 (SD card) selected | ||
| 50 | ;;; by DIP switches MSEL[1:0], you may want boot from MMC2 to use the | ||
| 51 | ;;; U-Boot from Guix System instead of the vendor U-Boot in MMC1. Before | ||
| 52 | ;;; doing so, make sure you have a correct 'fdtfile' in the environment: | ||
| 53 | ;;; | ||
| 54 | ;;; uboot> setenv fdtfile starfive/jh7110-starfive-visionfive-2-v1.3b.dtb | ||
| 55 | ;;; uboot> saveenv | ||
| 56 | ;;; | ||
| 57 | ;;; Code: | ||
| 58 | |||
| 59 | (define visionfive2-barebones-os | ||
| 60 | (operating-system | ||
| 61 | (host-name "visionfive2") | ||
| 62 | (timezone "Etc/UTC") | ||
| 63 | (locale "en_US.utf8") | ||
| 64 | (bootloader (bootloader-configuration | ||
| 65 | (bootloader u-boot-starfive-visionfive2-bootloader) | ||
| 66 | (targets '("/dev/mmcblk0")))) | ||
| 67 | (file-systems (cons (file-system | ||
| 68 | (device (file-system-label "Guix_image")) | ||
| 69 | (mount-point "/") | ||
| 70 | (type "ext4")) | ||
| 71 | %base-file-systems)) | ||
| 72 | (kernel-arguments (list "earlycon" "clk_ignore_unused")) | ||
| 73 | (firmware '()) | ||
| 74 | (packages (append (list cloud-utils neofetch) %base-packages)) | ||
| 75 | (services | ||
| 76 | (append (list (service openssh-service-type | ||
| 77 | (openssh-configuration | ||
| 78 | (openssh openssh-sans-x) | ||
| 79 | (permit-root-login #t) | ||
| 80 | (allow-empty-passwords? #t))) | ||
| 81 | (service agetty-service-type | ||
| 82 | (agetty-configuration | ||
| 83 | (extra-options '("-L")) | ||
| 84 | (baud-rate "115200") | ||
| 85 | (term "vt100") | ||
| 86 | (tty "ttyS0"))) | ||
| 87 | (service dhcp-client-service-type)) | ||
| 88 | %base-services)))) | ||
| 89 | |||
| 90 | (define visionfive2-disk-image | ||
| 91 | (image-without-os | ||
| 92 | (format 'disk-image) | ||
| 93 | (partition-table-type 'gpt) | ||
| 94 | (partitions (list | ||
| 95 | (partition | ||
| 96 | (size (* 1 (expt 2 20))) | ||
| 97 | (label "spl") | ||
| 98 | (offset (* 34 512)) | ||
| 99 | (file-system "unformatted") | ||
| 100 | (uuid (uuid "2E54B353-1271-4842-806F-E436D6AF6985"))) | ||
| 101 | (partition | ||
| 102 | (size (* 4 (expt 2 20))) | ||
| 103 | (label "uboot") | ||
| 104 | (offset (* 2082 512)) | ||
| 105 | (file-system "unformatted") | ||
| 106 | (uuid (uuid "BC13C2FF-59E6-4262-A352-B275FD6F7172"))) | ||
| 107 | root-partition)))) | ||
| 108 | |||
| 109 | (define visionfive2-image-type | ||
| 110 | (image-type | ||
| 111 | (name 'visionfive2-raw) | ||
| 112 | (constructor (cut image-with-os visionfive2-disk-image <>)))) | ||
| 113 | |||
| 114 | (define visionfive2-barebones-raw-image | ||
| 115 | (image | ||
| 116 | (inherit | ||
| 117 | (os+platform->image visionfive2-barebones-os riscv64-linux | ||
| 118 | #:type visionfive2-image-type)) | ||
| 119 | (name 'visionfive2-barebones-raw-image))) | ||
| 120 | |||
| 121 | ;; Return the default image. | ||
| 122 | visionfive2-barebones-raw-image | ||
