Giter Site home page Giter Site logo

d1-riscv-nixos-sun20iw1p1-builder's Introduction

NixOS on Allwinner D1

## With Nix flakes
$ nix build .#nixosConfigurations.sdImageLicheeRVInstaller.config.system.build.sdImage

## Or without Nix flakes
$ NIX_PATH='nixpkgs=channel:nixos-unstable' nix-build '<nixpkgs/nixos>' -I nixos-config=./sd-image-licheerv-installer.nix --arg system null -A config.system.build.sdImage

Due to performance limitations of current RISC-V machines, it may not be trivial to build this natively. This project currently prefers cross builds from x86_64-linux. It is recommended to add hydra.nichi.co to your Nix binary cache.

Prebuilt images can be found on the GitHub releases page.

Status

The image boots successfully with WiFi and HDMI support. Supported boards:

  • Sipeed LicheeRV Dock
  • MangoPi MQ-Pro (compatible with LicheeRV)
  • MangoPi MQ

asciicast

Other build options

For cross builds from other platforms, edit sd-image-licheerv-installer.nix:

-  nixpkgs.buildPlatform = "x86_64-linux";
+  nixpkgs.buildPlatform = "aarch64-linux";

For native / emulated builds, edit sd-image-licheerv-installer.nix:

-  nixpkgs.buildPlatform = "x86_64-linux";

For emulated builds on NixOS, add this to your system's configuration.nix:

  boot.binfmt.emulatedSystems = [ "riscv64-linux" ];

For emulated builds on non-NixOS, check this discourse.

Configuration

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixos-sun20iw1p1.url = "github:chuangzhu/nixos-sun20iw1p1";
  };
  outputs = { self, nixpkgs, nixos-sun20iw1p1 }: {
    nixosConfugurations.myLicheeRV = nixpkgs.lib.nixosSystem {
      modules = [
        nixos-sun20iw1p1.nixosModules.sd-image-licheerv
        ./hardware-configuration.nix
        ./configuration.nix
        ({ pkgs, config, ... }: {
          nixpkgs.buildPlatform = "x86_64-linux";
        })
      ];
    };
  };
}

Then you can build your customized SD card image using nix build .#nixosConfigurations.myLicheeRV.config.system.build.sdImage.

When you make changes, you can build the new configuration using nix build .#nixosConfigurations.myLicheeRV.config.system.build.toplevel, copy it to the running system using nix copy --no-check-sigs --to ssh://[email protected] ./result, then execute /nix/store/xxxx-nixos-system-myLicheeRV-xxxx/switch-to-configuration switch on the board.

Without Nix flakes

# configuration.nix
{ config, pkgs, lib, ... }: {
  imports = [
    <nixos-sun20iw1p1/sd-image-licheerv.nix>
    ./hardware-configuration.nix
  ];
  nixpkgs.buildPlatform = "x86_64-linux";
}
$ NIX_PATH='nixpkgs=channel:nixos-unstable:nixos-sun20iw1p1=https://github.com/chuangzhu/nixos-sun20iw1p1/archive/master.tar.gz' nix-build '<nixpkgs/nixos>' -I nixos-config=configuration.nix --arg system null -A config.system.build.sdImage

Credit

I followed this guide from the linux-sunxi community. Many thanks to @smaeul and other people's awesome work. This is based on @NickCao and @zhaofengli's work porting numerous Nix packages to riscv64-linux.

d1-riscv-nixos-sun20iw1p1-builder's People

Contributors

chuangzhu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.