diff --git a/base.nix b/base.nix deleted file mode 100644 index 1eade56..0000000 --- a/base.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ config, pkgs, lib, ... }: -{ - # Remove ZFS - boot.supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" "ext4" "vfat" ]; - - # RISC-V Quirks and patches, should be upstreamed - nixpkgs.overlays = [ - (final: prev: { - hpcg = prev.callPackage ./examples/hpcg.nix { }; - vte = (prev.vte.override { - stdenv = prev.stdenv; - }).overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ prev.gobject-introspection prev.glib ]; - depsBuildHost = [ prev.pkg-config ]; - #nativeBuildInputs = old.nativeBuildInputs ++ [ prev.glib ]; - propagatedBuildInputs = [ prev.gtk3 pkgs.pango ]; - #NIX_DEBUG = 5; - }); - gusb = prev.gusb.overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ prev.gobject-introspection ]; - }); - colord = prev.colord.overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ prev.gobject-introspection ]; - }); - cage = prev.cage.overrideAttrs (old: { - depsBuildBuild = [ prev.pkg-config ]; - }); -# ebook_tools = prev.ebook_tools.overrideAttrs (_old: { -# preConfigure = '' -# NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $($PKG_CONFIG --cflags libzip)" -# ''; -# }); - discount = prev.discount.overrideAttrs (_old: { - configurePlatforms = []; - }); - sane-backends = prev.sane-backends.overrideAttrs (_old: { - CFLAGS = "-DHAVE_MMAP=0"; - }); - curl = prev.curl.overrideAttrs (_old: { - CFLAGS = "-w"; - LDFLAGS = "-latomic"; - }); - x265 = prev.x265.override { multibitdepthSupport = false; }; - }) - ]; - - users = { - users.default = { - password = "visionfive-nix"; - isNormalUser = true; - extraGroups = [ - "wheel" - ]; - }; - }; -} diff --git a/examples/hpcg.nix b/examples/hpcg.nix deleted file mode 100644 index 100f118..0000000 --- a/examples/hpcg.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, cmake } : - -stdenv.mkDerivation rec { - pname = "hpcg"; - version = "114602d"; - - src = fetchFromGitHub { - owner = "hpcg-benchmark"; - repo = pname; - rev = "114602d458d1034faa52b71e4c15aba9b3a17698"; - hash = "sha256-n+Qz0G630SyG3v1E1buwjHO8t779tq2TbWBcAjwwvxw="; - }; - - nativeBuildInputs = [ cmake ]; - enableParallelBuilding = true; - - installPhase = '' - mkdir -p $out/bin $out/share/hpcg - - cp xhpcg $out/bin - #cp hpcg.dat $out/share/hpcg - ''; - - meta = with lib; { - description = "HPC conjugate gradient benchmark"; - homepage = "https://www.hpcg-benchmark.org"; - platforms = platforms.linux; - license = licenses.bsd3; - maintainers = [ maintainers.markuskowa ]; - }; -} - diff --git a/examples/launchCageOnBoot.nix b/examples/launchCageOnBoot.nix deleted file mode 100644 index 78c9d66..0000000 --- a/examples/launchCageOnBoot.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: -let - welcomeMessage = "visionfive-nix"; - xtermWelcomeScript = pkgs.writeScript "xterm-visionfive-welcome.sh" '' - ${pkgs.figlet}/bin/figlet -c ${welcomeMessage} - ${pkgs.neofetch}/bin/neofetch - sh - ''; -in -{ - hardware.opengl.enable = true; - services.cage = { - enable = true; - user = "default"; - program = "${pkgs.xterm}/bin/xterm -fa 'Monospace' -fs 14 -bg black -fg white -e sh -c '${xtermWelcomeScript}'"; - }; -} diff --git a/examples/launchSwayOnBoot.nix b/examples/launchSwayOnBoot.nix deleted file mode 100644 index 98eb403..0000000 --- a/examples/launchSwayOnBoot.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - programs = { - sway.enable = true; - bash.loginShellInit = '' - if [[ "$(tty)" == /dev/tty1 ]]; then - exec sway &> /dev/null - fi - ''; - }; -} diff --git a/examples/mosquitto.nix b/examples/mosquitto.nix deleted file mode 100644 index ef7c63d..0000000 --- a/examples/mosquitto.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - networking.firewall.allowedTCPPorts = [ 1883 ]; - services.mosquitto = { - enable = true; - settings.max_keepalive = 300; - listeners = [ - { - port = 1883; - omitPasswordAuth = true; - users = {}; - settings = { - allow_anonymous = true; - }; - acl = [ "topic readwrite #" ]; - } - ]; - }; -} diff --git a/kernel.nix b/kernel.nix deleted file mode 100644 index 210e90e..0000000 --- a/kernel.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ lib -, fetchFromGitHub -, buildLinux -, vendor-kernel -, ... } @ args: - -let - kernelVersion = rec { - # Fully constructed string, example: "5.10.0-rc5". - string = "${version + "." + patchlevel + "." + sublevel + (lib.optionalString (extraversion != "") extraversion)}"; - file = "${vendor-kernel}/Makefile"; - version = toString (builtins.match ".+VERSION = ([0-9]+).+" (builtins.readFile file)); - patchlevel = toString (builtins.match ".+PATCHLEVEL = ([0-9]+).+" (builtins.readFile file)); - sublevel = toString (builtins.match ".+SUBLEVEL = ([0-9]+).+" (builtins.readFile file)); - # rc, next, etc. - extraversion = toString (builtins.match ".+EXTRAVERSION = ([a-z0-9-]+).+" (builtins.readFile file)); - }; - modDirVersion = "${kernelVersion.string}"; -in buildLinux (args // { - inherit modDirVersion; - version = "${modDirVersion}-visionfive"; - - src = vendor-kernel; - - kernelPatches = []; - - defconfig = "starfive_jh7100_fedora_defconfig"; - - structuredExtraConfig = with lib.kernel; { - KEXEC = yes; - SERIAL_8250_DW = yes; - PINCTRL_STARFIVE = yes; - - # Doesn't build as a module - DW_AXI_DMAC_STARFIVE = yes; - - # stmmac hangs when built as a module - #PTP_1588_CLOCK = yes; - #STMMAC_ETH = yes; - #STMMAC_PCI = yes; - - # For qemu - BLOCK = yes; - BLK_DEV = yes; - DEVTMPFS = yes; - VIRTIO_MENU = yes; - VIRTIO_BLK = yes; - - # For 9P: https://wiki.qemu.org/Documentation/9psetup - NET_9P = yes; - NET_9P_VIRTIO = yes; - NET_9P_DEBUG = yes; - "9P_FS" = yes; - "9P_FS_POSIX_ACL" = yes; - PCI = yes; - VIRTIO_PCI = yes; - PCI_HOST_GENERIC = yes; - }; - - extraMeta = { - description = "Linux kernel for StarFive's JH7100 RISC-V SoC (VisionFive)"; - platforms = [ "riscv64-linux" ]; - hydraPlatforms = [ "riscv64-linux" ]; - }; -} // (args.argsOverride or { })) diff --git a/old-flake.lock b/old-flake.lock deleted file mode 100644 index cb0567c..0000000 --- a/old-flake.lock +++ /dev/null @@ -1,44 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1657645802, - "narHash": "sha256-wd+LiuGtHP8mTIc0gZrO2yqzmEPVvh5IyWrB8WCQNKM=", - "owner": "matthewcroughan", - "repo": "nixpkgs", - "rev": "39a827f18b870afb02f6c0f09151c69f2d8e7a4d", - "type": "github" - }, - "original": { - "owner": "matthewcroughan", - "ref": "mc/riscv-testing", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs", - "vendor-kernel": "vendor-kernel" - } - }, - "vendor-kernel": { - "flake": false, - "locked": { - "lastModified": 1657526524, - "narHash": "sha256-NiEeWgYzEhqLbvB0krpjoRv8oXXsJYp6KeDor+f9tak=", - "owner": "starfive-tech", - "repo": "linux", - "rev": "74003f14f92e3c8eb31536b599c1f0c7aba3cdf2", - "type": "github" - }, - "original": { - "owner": "starfive-tech", - "repo": "linux", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/old-flake.nix b/old-flake.nix deleted file mode 100644 index a50cf76..0000000 --- a/old-flake.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - inputs = { - nixpkgs.url = "github:matthewcroughan/nixpkgs/mc/riscv-testing"; - - # VisionFive ("v1") - vendor-kernel = { - url = "github:starfive-tech/linux"; - flake = false; - }; - }; - outputs = { self, nixpkgs, vendor-kernel, ... }: - let - inherit (nixpkgs) lib; - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; }; - modules = [ - { nixpkgs.overlays = [ self.overlay ]; } - "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-riscv64-visionfive-installer.nix" - ./base.nix - ./configuration.nix - ]; - in - { - overlay = final: prev: { - linuxPackages_visionfive = final.linuxPackagesFor ( - ( - final.callPackage ./kernel.nix { inherit vendor-kernel; } - ).override { - patches = []; - } - ); - }; - legacyPackages.${system} = - { - inherit (pkgs.pkgsCross.riscv64.linux) linuxPackages_visionfive; - }; - images = { - visionfive-cross = self.nixosConfigurations.visionfive-cross.config.system.build.sdImage; - visionfive-native = self.nixosConfigurations.visionfive-native.config.system.build.sdImage; - - visionfive2-cross = self.nixosConfigurations.visionfive2-cross.config.system.build.sdImage; - visionfive2-native = self.nixosConfigurations.visionfive2-native.config.system.build.sdImage; - }; - nixosConfigurations = { - visionfive-cross = nixpkgs.lib.nixosSystem { - system = "${system}"; - modules = modules ++ [ - { - nixpkgs.crossSystem = { - gcc.arch = "rv64gv"; - gcc.tune = "rv64gv"; - system = "riscv64-linux"; - }; - } - ]; - }; - visionfive-native = nixpkgs.lib.nixosSystem { - system = "riscv64-linux"; - modules = modules; - }; - }; - }; -} diff --git a/visionfive2/README.md b/visionfive2/README.md deleted file mode 100644 index 151061b..0000000 --- a/visionfive2/README.md +++ /dev/null @@ -1,61 +0,0 @@ - -# VisionFive 2 - -As of writing, VisionFive 2 support is quite experimental; see [kernel/README.md](kernel/README.md). - -## Flash the bootloader via serial connection - -This step may be optional. - -Make the serial connection according to the section "Recovering the Bootloader" in . -Flip the tiny switches towards the H (as opposed to L) marking on the PCB (towards edge of the board) as described that section (Step 2). -Power up, and assuming your serial device is `/dev/ttyUSB0`, run: - -```shellSession -nix run .#visionFive2_bootloader_recover /dev/ttyUSB0 -``` - -## Write a bootable SD card - -```shellSession -$ nix build .#images.visionfive2-cross -``` - -Insert an SD card of which all contents will be replaced. - -These instructions assume your SD card reader is `/dev/mmcblk0`. - -Make sure no partitions are mounted. - -```shellSession -$ echo /dev/mmcblk0p* -$ sudo umount /dev/mmcblk0p1 -$ sudo umount /dev/mmcblk0p2 -... repeat for all partitions -``` - -`pv` provides a rough progress indicator based on the compressed size. -If you don't have `pv`, run in `nix shell nixpkgs#pv` or use `cat` instead. - -```shellSession -$ sudo sh -c 'pv &2 NOTE: If your board appears to hang, RX/TX may be flipped, - echo >&2 _depending on boot setting_!!! - echo "$0" - ${expectScript} "$@" - echo >&2 "Launching new session. Hint enter to display help." - ${visionFive2_recovery_resume.program} "$@" - ''; - in { type = "app"; program = "${wrapSudo program}"; }; - - visionFive2_recovery_resume = - let - program = pkgs.writeScript "recoverBootloader_resume" '' - #!${pkgs.runtimeShell} - set -eu - ${pkgs.picocom}/bin/picocom $1 -b 115200 -s "${pkgs.lrzsz}/bin/sz -X" - ''; - in { type = "app"; program = "${wrapSudo program}"; }; - - visionFive2_bootloader_recover = - let - expectScript = pkgs.writeScript "expect-visionfive-recover-bootLoader" '' - #!${pkgs.expect}/bin/expect -f - set timeout -1 - spawn ${pkgs.picocom}/bin/picocom [lindex $argv 0] -b 115200 -s "${pkgs.lrzsz}/bin/sz -X" - expect "CC" - send "\x01\x13" - expect "*** file:" - send "${inputs.jh7110_recovery_binary}" - send "\r" - expect "Transfer complete" - - # Wait for menu and install SPL - expect "0: update 2ndboot/SPL in flash" - send "0\r" - - expect "CC" - send "\x01\x13" - expect "*** file:" - send "${inputs.jh7110_u-boot-spl-bin}" - send "\r" - expect "Transfer complete" - - # Wait for menu and install u-boot - expect "2: update fw_verif/uboot in flash" - send "2\r" - expect "CC" - send "\x01\x13" - expect "*** file:" - send "${inputs.jh7110_u-boot-bin}" - send "\r" - expect "Transfer complete" - ''; - program = pkgs.writeShellScript "flash-visionfive.sh" '' - cat >&2 <&2 <"); - MODULE_DESCRIPTION("pwmdac dummy codec driver"); - MODULE_LICENSE("GPL v2"); diff --git a/visionfive2/kernel/package/visionfive-2-gpu.patch b/visionfive2/kernel/package/visionfive-2-gpu.patch deleted file mode 100644 index beea1d9..0000000 --- a/visionfive2/kernel/package/visionfive-2-gpu.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/drivers/gpu/drm/i2c/tda998x_pin.c b/drivers/gpu/drm/i2c/tda998x_pin.c -index 995efc8e55ed..48a616a7e851 100644 ---- a/drivers/gpu/drm/i2c/tda998x_pin.c -+++ b/drivers/gpu/drm/i2c/tda998x_pin.c -@@ -30,7 +30,7 @@ static const struct of_device_id tda998x_rgb_dt_ids[] = { - { .compatible = "starfive,tda998x_rgb_pin", }, - { /* sentinel */ }, - }; --MODULE_DEVICE_TABLE(of, starfive_drm_dt_ids); -+MODULE_DEVICE_TABLE(of, tda998x_rgb_dt_ids); - - static struct platform_driver starfive_drm_platform_driver = { - .probe = starfive_drm_platform_probe, diff --git a/visionfive2/kernel/package/visionfive-2-pl330-name-collision.patch b/visionfive2/kernel/package/visionfive-2-pl330-name-collision.patch deleted file mode 100644 index 255f7be..0000000 --- a/visionfive2/kernel/package/visionfive-2-pl330-name-collision.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index 110de8a60058..0a01256ef9e4 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -1050,7 +1050,7 @@ static bool _trigger(struct pl330_thread *thrd) - return true; - } - --static bool _start(struct pl330_thread *thrd) -+static bool _dma_start(struct pl330_thread *thrd) - { - switch (_state(thrd)) { - case PL330_STATE_FAULT_COMPLETING: -@@ -1702,7 +1702,7 @@ static int pl330_update(struct pl330_dmac *pl330) - thrd->req_running = -1; - - /* Get going again ASAP */ -- _start(thrd); -+ _dma_start(thrd); - - /* For now, just make a list of callbacks to be done */ - list_add_tail(&descdone->rqd, &pl330->req_done); -@@ -2089,7 +2089,7 @@ static void pl330_tasklet(struct tasklet_struct *t) - } else { - /* Make sure the PL330 Channel thread is active */ - spin_lock(&pch->thread->dmac->lock); -- _start(pch->thread); -+ _dma_start(pch->thread); - spin_unlock(&pch->thread->dmac->lock); - } - -@@ -2107,7 +2107,7 @@ static void pl330_tasklet(struct tasklet_struct *t) - if (power_down) { - pch->active = true; - spin_lock(&pch->thread->dmac->lock); -- _start(pch->thread); -+ _dma_start(pch->thread); - spin_unlock(&pch->thread->dmac->lock); - power_down = false; - } diff --git a/visionfive2/sd-image.nix b/visionfive2/sd-image.nix deleted file mode 100644 index 2470d06..0000000 --- a/visionfive2/sd-image.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ inputs, importApply, ... }: -{ config, lib, pkgs, modulesPath, ... }: -{ - imports = [ - (modulesPath + "/profiles/base.nix") - (modulesPath + "/installer/sd-card/sd-image.nix") - (importApply ./kernel/nixos-module.nix { inherit inputs; }) - ]; - - environment.systemPackages = with pkgs; [ mtdutils ]; - - boot = { - consoleLogLevel = lib.mkDefault 7; - - initrd.kernelModules = [ - # "dw-axi-dmac-platform" - ]; - initrd.includeDefaultModules = false; - initrd.availableKernelModules = [ - "dw_mmc-pltfm" - "dw_mmc-starfive" - "spi-dw-mmio" - "mmc_block" - "nvme" - "sdhci" #? - "sdhci-pci" #? - "sdhci-of-dwcmshc" - ]; - - loader = { - grub.enable = false; - generic-extlinux-compatible.enable = true; - }; - - }; - - sdImage = { - imageName = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-visionfive-2.img"; - - populateFirmwareCommands = '' - ''; - - populateRootCommands = '' - mkdir -p ./files/boot - ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot - ''; - }; -} \ No newline at end of file