From patchwork Sun May 12 11:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zheng Junjie X-Patchwork-Id: 64371 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3216927BBEA; Sun, 12 May 2024 12:11:45 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2167827BBE2 for ; Sun, 12 May 2024 12:11:44 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s676u-0007N8-O3; Sun, 12 May 2024 07:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s676e-0007K6-Qm for guix-patches@gnu.org; Sun, 12 May 2024 07:11:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s676e-0002gV-6S for guix-patches@gnu.org; Sun, 12 May 2024 07:11:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s676d-0004WJ-Vh for guix-patches@gnu.org; Sun, 12 May 2024 07:11:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70892] [PATCH 6/6] system: images: Add visionfive2 module. Resent-From: Zheng Junjie Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 May 2024 11:11:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70892 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70892@debbugs.gnu.org Received: via spool by 70892-submit@debbugs.gnu.org id=B70892.171551225717333 (code B ref 70892); Sun, 12 May 2024 11:11:03 +0000 Received: (at 70892) by debbugs.gnu.org; 12 May 2024 11:10:57 +0000 Received: from localhost ([127.0.0.1]:53903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s676W-0004VV-CN for submit@debbugs.gnu.org; Sun, 12 May 2024 07:10:56 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:55316 helo=cstnet.cn) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s676T-0004Uk-F1 for 70892@debbugs.gnu.org; Sun, 12 May 2024 07:10:55 -0400 Received: from m.tailaa68d.ts.net (unknown [107.174.64.25]) by APP-01 (Coremail) with SMTP id qwCowAAHDhpto0BmKz2UBA--.64920S7; Sun, 12 May 2024 19:10:42 +0800 (CST) From: Zheng Junjie Date: Sun, 12 May 2024 19:09:29 +0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: qwCowAAHDhpto0BmKz2UBA--.64920S7 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUO77k0a2IF6F4UM7kC6x804xWl14x267AK xVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUJVWUGw A2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYIkIc2x26xkF7I0E14v26r1Y6r1xM28l Y4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr 1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_ Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEnc xIr21le4C262xC7I0v67AEwI8IwI1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv2 0xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7 xvr2IYc2Ij64vIr41lw4CEx2IqxVAFz4v204v26I0v724l42xK82IYc2Ij64vIr41l4I8I 3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxV WUJVWUGwC2zVAF1VAY17CE14v26r1j6r15MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAF wI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcI k0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j 6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UiNVkUUUUU= X-Originating-IP: [107.174.64.25] X-CM-SenderInfo: x2kh0wxmxqyx3h6l2u1dvotugofq/ X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/system/images/visionfive2.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. Change-Id: I8831f1148bcddb0d604e1174034fca85cd2887a1 --- gnu/local.mk | 1 + gnu/system/images/visionfive2.scm | 121 ++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 gnu/system/images/visionfive2.scm diff --git a/gnu/local.mk b/gnu/local.mk index 439fe587b0..ac3aa9fcc8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -778,6 +778,7 @@ GNU_SYSTEM_MODULES = \ %D%/system/images/pinebook-pro.scm \ %D%/system/images/rock64.scm \ %D%/system/images/unmatched.scm \ + %D%/system/images/visionfive2.scm \ %D%/system/images/wsl2.scm \ \ %D%/machine.scm \ diff --git a/gnu/system/images/visionfive2.scm b/gnu/system/images/visionfive2.scm new file mode 100644 index 0000000000..31d1948ab9 --- /dev/null +++ b/gnu/system/images/visionfive2.scm @@ -0,0 +1,121 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Zheng Junjie <873216071@qq.com> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu system images visionfive2) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader u-boot) + #:use-module (gnu services dbus) + #:use-module (gnu services dns) + #:use-module (gnu services avahi) + #:use-module (gnu services shepherd) + #:use-module (gnu services ssh) + #:use-module (gnu services networking) + #:use-module (gnu image) + #:use-module (gnu packages linux) + #:use-module (guix packages) + + #:use-module (gnu packages ssh) + #:use-module (gnu packages guile-xyz) + #:use-module (gnu packages admin) + #:use-module (gnu services) + #:use-module (gnu services base) + #:use-module (gnu services networking) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system image) + #:use-module (guix platforms riscv) + #:use-module (srfi srfi-26) + #:export (visionfive2-barebones-os + visionfive2-image-type + visionfive2-barebones-raw-image)) + +;;; Commentary: +;;; +;;; for now, must boot from spl, mmc boot fail. +;;; so must set fdtfile. +;;; uboot> setenv fdtfile starfive/jh7110-starfive-visionfive-2-v1.3b.dtb +;;; uboot> savenv +;;; +;;; ./pre-inst-env guix system image gnu/system/images/visionfive2.scm \ +;;; --target=riscv64-linux-gnu --no-grafts +;;; +;;; Code: + +(define visionfive2-barebones-os + (operating-system + (host-name "visionfive2") + (timezone "Etc/UTC") + (locale "en_US.utf8") + (bootloader (bootloader-configuration + (bootloader u-boot-starfive-visionfive2-bootloader) + (targets '("/dev/mmcblk0")))) + (file-systems (cons (file-system + (device (file-system-label "my-root")) + (mount-point "/") + (type "ext4")) + %base-file-systems)) + (kernel-arguments + (append (list "console=ttyS0,115200" + "rootwait" + "earlycon" + "clk_ignore_unused") + %default-kernel-arguments)) + (firmware '()) + (packages (append (list cloud-utils neofetch) %base-packages)) + (services + (append (list (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (permit-root-login #t) + (allow-empty-passwords? #t))) + (service dhcp-client-service-type)) + %base-services)))) + +(define visionfive2-disk-image + (image-without-os + (format 'disk-image) + (partition-table-type 'gpt) + (partitions (list + (partition + (size (* 1 (expt 2 20))) + (label "spl") + (offset (* 34 512)) + (file-system "unformatted") + (uuid (uuid "2E54B353-1271-4842-806F-E436D6AF6985"))) + (partition + (size (* 4 (expt 2 20))) + (label "uboot") + (offset (* 2082 512)) + (file-system "unformatted") + (uuid (uuid "BC13C2FF-59E6-4262-A352-B275FD6F7172"))) + root-partition)))) + +(define visionfive2-image-type + (image-type + (name 'visionfive2-raw) + (constructor (cut image-with-os visionfive2-disk-image <>)))) + +(define visionfive2-barebones-raw-image + (image + (inherit + (os+platform->image visionfive2-barebones-os riscv64-linux + #:type visionfive2-image-type)) + (name 'visionfive2-barebones-raw-image))) + +;; Return the default image. +visionfive2-barebones-raw-image