Compare commits
5 Commits
ccf41b441d
...
81bd11999a
Author | SHA1 | Date | |
---|---|---|---|
81bd11999a | |||
6cb22575b3 | |||
53ab72fa20 | |||
97d477d285 | |||
20fb2f9194 |
@ -1,6 +1,26 @@
|
||||
build:lagarto-ox:
|
||||
stage: build
|
||||
when: manual
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix develop -L .#lagarto-ox --command fpga/run-remotely.sh fpgalogin1:ci
|
||||
|
||||
build:lagarto-ox-tarball:
|
||||
stage: build
|
||||
when: manual
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix build -L .#nixosConfigurations.lagarto-ox.pkgs.fpga-tarball
|
||||
- cd result
|
||||
- out=/ceph/home/gitlab-runner/public_html/nixos-riscv/
|
||||
- fn=$(ls | head -1)
|
||||
- cp $fn $out/$fn
|
||||
- rm -f $out/latest.tar.zst
|
||||
- ln -s $out/$fn $out/latest.tar.zst
|
||||
- cd ..
|
||||
- rm result
|
||||
- |
|
||||
echo "Pinned: https://jungle.bsc.es/~gitlab-runner/nixos-riscv/$fn"
|
||||
echo "Latest: https://jungle.bsc.es/~gitlab-runner/nixos-riscv/latest.tar.zst"
|
||||
|
@ -546,6 +546,91 @@
|
||||
EOF
|
||||
'';
|
||||
|
||||
# A tarball with all the parts to boot NixOS in a FPGA
|
||||
fpga-tarball = let
|
||||
build = config.system.build;
|
||||
in prev.stdenv.mkDerivation rec {
|
||||
name = "nixos-riscv";
|
||||
src = ./fpga;
|
||||
|
||||
COMMIT = if self ? rev then self.rev
|
||||
else throw ("Refusing to build tarball from a dirty Git tree!");
|
||||
|
||||
TOPLEVEL = build.toplevel;
|
||||
OPENSBI = final.opensbi;
|
||||
KERNEL = build.kernel;
|
||||
INITRD = build.initialRamdisk;
|
||||
ROOTFS = build.sdImage;
|
||||
UBOOT_ENV = final.uboot-env;
|
||||
BITSTREAM = final.bitstream;
|
||||
BOOTROM = final.bootrom;
|
||||
bitName = builtins.baseNameOf BITSTREAM;
|
||||
|
||||
unpackPhase = ''
|
||||
mkdir -p src/nixos-riscv
|
||||
ln -s $src fpga
|
||||
fpga/upload.sh src/nixos-riscv
|
||||
chmod +w -R src
|
||||
sourceRoot=src
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
cat > nixos-riscv/README.txt <<EOF
|
||||
-----------------------------------------
|
||||
NixOS image for Lagarto Ox in a U55C FPGA
|
||||
-----------------------------------------
|
||||
|
||||
Author: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
|
||||
|
||||
These files allow you to boot NixOS on Lagarto Ox. They correspond to
|
||||
this commit:
|
||||
|
||||
https://pm.bsc.es/gitlab/rarias/nixos-riscv/-/commit/${COMMIT}
|
||||
|
||||
Here are the pieces used by this system:
|
||||
|
||||
COMMIT = ${COMMIT}
|
||||
TOPLEVEL = ${TOPLEVEL}
|
||||
OPENSBI = ${OPENSBI}
|
||||
KERNEL = ${KERNEL}
|
||||
INITRD = ${INITRD}
|
||||
ROOTFS = ${ROOTFS}
|
||||
UBOOT_ENV = ${UBOOT_ENV}
|
||||
BITSTREAM = ${BITSTREAM}
|
||||
BOOTROM = ${BOOTROM}
|
||||
|
||||
Copy these files into a MEEP FPGA node, then allocate a FPGA node and
|
||||
run from this directory (don't forget the dot at the end):
|
||||
|
||||
$ ./run-node.sh .
|
||||
|
||||
That would flash the bitstream and NixOS and boot the whole system
|
||||
until the login, and exit after some inactivity period. You should see
|
||||
this message near the end:
|
||||
|
||||
__________________
|
||||
< Welcome to NixOS >
|
||||
------------------
|
||||
^__^
|
||||
(oo)_______
|
||||
(__) )/
|
||||
||----w |
|
||||
|| ||
|
||||
|
||||
If you can read this message then then you have
|
||||
successfully booted NixOS into the login shell.
|
||||
|
||||
EOF
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
tar --zstd -cvf $out/${COMMIT}.tar.zst nixos-riscv
|
||||
'';
|
||||
|
||||
nativeBuildInputs = with final.buildPackages; [ rsync zstd ];
|
||||
};
|
||||
|
||||
opensbi = prev.opensbi.overrideAttrs (old: rec {
|
||||
#version = "1.4";
|
||||
version = "1.5";
|
||||
|
Loading…
Reference in New Issue
Block a user