uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,75 @@
{ lib
, buildPythonApplication
, fetchFromGitHub
, click
, semantic-version
, requests
, colorama
, pyserial
, wheel
, scons
, setuptools
, tinyprog
, pytestCheckHook
}:
buildPythonApplication rec {
pname = "apio";
version = "0.8.1";
format = "flit";
src = fetchFromGitHub {
owner = "FPGAwars";
repo = "apio";
rev = "v${version}";
sha256 = "sha256-04qAGTzusMT3GsaRxDoXNJK1Mslzxu+ugQclBJx8xzE=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace 'scons==4.2.0' 'scons' \
--replace '==' '>='
substituteInPlace apio/managers/scons.py --replace \
'return "tinyprog --libusb --program"' \
'return "${tinyprog}/bin/tinyprog --libusb --program"'
substituteInPlace apio/util.py --replace \
'_command = join(get_bin_dir(), "tinyprog")' \
'_command = "${tinyprog}/bin/tinyprog"'
# semantic-version seems to not support version numbers like the one of tinyprog in Nixpkgs (1.0.24.dev114+gxxxxxxx).
# See https://github.com/rbarrois/python-semanticversion/issues/47.
# This leads to an error like "Error: Invalid version string: '1.0.24.dev114+g97f6353'"
# when executing "apio upload" for a TinyFPGA.
# Replace the dot with a dash to work around this problem.
substituteInPlace apio/managers/scons.py --replace \
'version = semantic_version.Version(pkg_version)' \
'version = semantic_version.Version(pkg_version.replace(".dev", "-dev"))'
'';
propagatedBuildInputs = [
click
semantic-version
requests
colorama
pyserial
wheel
scons
setuptools # needs pkg_resources at runtime (technically not needed when tinyprog is also in this list because of the propagatedBuildInputs of tinyprog)
tinyprog # needed for upload to TinyFPGA
];
checkInputs = [
pytestCheckHook
];
pytestFlagsArray = [ "--offline" ];
meta = with lib; {
description = "Open source ecosystem for open FPGA boards";
homepage = "https://github.com/FPGAwars/apio";
license = licenses.gpl2Only;
maintainers = with maintainers; [ Luflosi ];
};
}

View file

@ -0,0 +1,37 @@
{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, libusb1, AppKit }:
rustPlatform.buildRustPackage rec {
pname = "ecpdap";
version = "0.1.7";
src = fetchFromGitHub {
owner = "adamgreig";
repo = pname;
rev = "v${version}";
sha256 = "sha256-fdvpGmEy54i48H6YJ4E1LIuogimNEL8PJS5ScoW/6DM=";
};
cargoSha256 = "sha256-2YARNoHVDBwGr8FE/oRlNZMX/vCPIre7OnZbr04eF/M=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libusb1 ]
++ lib.optional stdenv.isDarwin AppKit;
postInstall = ''
mkdir -p $out/etc/udev/rules.d
cp drivers/*.rules $out/etc/udev/rules.d
'';
meta = with lib; {
description = "A tool to program ECP5 FPGAs";
longDescription = ''
ECPDAP allows you to program ECP5 FPGAs and attached SPI flash
using CMSIS-DAP probes in JTAG mode.
'';
homepage = "https://github.com/adamgreig/ecpdap";
license = licenses.asl20;
maintainers = with maintainers; [ expipiplus1 ];
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, IOKit
, libftdi1
, libusb-compat-0_1
}:
stdenv.mkDerivation rec {
pname = "fujprog";
version = "4.8";
src = fetchFromGitHub {
owner = "kost";
repo = pname;
rev = "v${version}";
sha256 = "08kzkzd5a1wfd1aycywdynxh3qy6n7z9i8lihkahmb4xac3chmz5";
};
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
libftdi1
libusb-compat-0_1
] ++ lib.optionals stdenv.isDarwin [ IOKit ];
meta = with lib; {
description = "JTAG programmer for the ULX3S and ULX2S open hardware FPGA development boards";
homepage = "https://github.com/kost/fujprog";
license = licenses.bsd2;
maintainers = with maintainers; [ trepetti ];
platforms = platforms.all;
changelog = "https://github.com/kost/fujprog/releases/tag/v${version}";
};
}

View file

@ -0,0 +1,70 @@
{ lib, stdenv, fetchFromGitHub
, pkg-config, libftdi1
, python3, pypy3
# PyPy yields large improvements in build time and runtime performance, and
# IceStorm isn't intended to be used as a library other than by the nextpnr
# build process (which is also sped up by using PyPy), so we use it by default.
# See 18839e1 for more details.
#
# FIXME(aseipp, 3/1/2021): pypy seems a bit busted since stdenv upgrade to gcc
# 10/binutils 2.34, so short-circuit this for now in passthru below (done so
# that downstream overrides can't re-enable pypy and break their build somehow)
, usePyPy ? stdenv.hostPlatform.system == "x86_64-linux"
}:
stdenv.mkDerivation rec {
pname = "icestorm";
version = "2020.12.04";
passthru = rec {
pythonPkg = if (false && usePyPy) then pypy3 else python3;
pythonInterp = pythonPkg.interpreter;
};
src = fetchFromGitHub {
owner = "YosysHQ";
repo = "icestorm";
rev = "7afc64b480212c9ac2ce7cb1622731a69a7d212c";
sha256 = "0vxhqs2fampglg3xlfwb35229iv96kvlwp1gyxrdrmlpznhkqdrk";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ passthru.pythonPkg libftdi1 ];
makeFlags = [ "PREFIX=$(out)" ];
enableParallelBuilding = true;
# fix icebox_vlog chipdb path. icestorm issue:
# https://github.com/cliffordwolf/icestorm/issues/125
#
# also, fix up the path to the chosen Python interpreter. for pypy-compatible
# platforms, it offers significant performance improvements.
patchPhase = ''
substituteInPlace ./icebox/icebox_vlog.py \
--replace /usr/local/share "$out/share"
for x in icefuzz/Makefile icebox/Makefile icetime/Makefile; do
substituteInPlace "$x" --replace python3 "${passthru.pythonInterp}"
done
for x in $(find . -type f -iname '*.py'); do
substituteInPlace "$x" \
--replace '/usr/bin/env python3' '${passthru.pythonInterp}'
done
'';
meta = {
description = "Documentation and tools for Lattice iCE40 FPGAs";
longDescription = ''
Project IceStorm aims at reverse engineering and
documenting the bitstream format of Lattice iCE40
FPGAs and providing simple tools for analyzing and
creating bitstream files.
'';
homepage = "https://github.com/YosysHQ/icestorm/";
license = lib.licenses.isc;
maintainers = with lib.maintainers; [ shell thoughtpolice emily ];
platforms = lib.platforms.all;
};
}

View file

@ -0,0 +1,117 @@
{ lib, stdenv, rpmextract, patchelf, makeWrapper, file, requireFile, glib, zlib,
freetype, fontconfig, xorg, libusb-compat-0_1 }:
stdenv.mkDerivation {
pname = "diamond";
version = "3.10";
nativeBuildInputs = [ rpmextract patchelf makeWrapper file ];
src = requireFile {
name = "diamond_3_10-base_x64-111-2-x86_64-linux.rpm";
url = "http://www.latticesemi.com/view_document?document_id=52180";
sha256 = "ec0b370cf8bd55831eeed7c5eadcabacbd6e63ac657c20209d672119a07a5c0f";
};
buildCommand = ''
origprefix=usr/local/diamond/3.10_x64
prefix=diamond
echo "Unpacking $src..."
rpmextract $src
# Move $pwd/usr/local/diamond/VERS to $out/diamond, cd.
mkdir -p $out/$prefix
rmdir $out/$prefix
mv $origprefix $out/$prefix
cd $out
# Extract all tarballs.
for tb in \
cae_library/cae_library.tar.gz \
embedded_source/embedded_source.tar.gz \
ispfpga/ispfpga.tar.gz \
synpbase/synpbase.tar.gz \
tcltk/tcltk.tar.gz \
bin/bin.tar.gz \
examples/examples.tar.gz \
data/data.tar.gz ; do
echo "Extracting tarball $prefix/$tb"
cd $out/$prefix/$(dirname $tb)
tar xf $(basename $tb)
rm $(basename $tb)
done
# Patch shebangs in start scripts .
cd $out/$prefix/bin/lin64
for tool in \
programmer \
pgrcmd \
diamond_env \
powercal \
model300 \
update \
diamond \
debugger \
ddtcmd \
cableserver \
revealrva \
ipexpress \
fileutility \
diamond ; do
echo "Patching script $prefix/bin/lin64/$tool..."
patchShebangs $tool
done
# Patch executable ELFs.
for path in bin/lin64 ispfpga/bin/lin64; do
cd $out/$prefix/$path
for f in *; do
if ! file $f | grep -q "ELF 64-bit LSB executable" ; then
continue
fi
echo "Patching ELF $prefix/$path/$f..."
# We force RPATH otherwise libraries from LD_LIBRARY_PATH (which the
# tools mangle by themselves) will not be able to find their
# dependencies from nix.
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$libPath" --force-rpath \
$f
done
done
# Remove 32-bit libz.
rm $out/$prefix/bin/lin64/libz.{so,so.1}
# Make wrappers (should these target more than the 'diamond' tool?).
# The purpose of these is just to call the target program using its
# absolute path - otherwise, it will crash.
mkdir -p bin
for tool in diamond ; do
makeWrapper $out/$prefix/bin/lin64/$tool $out/bin/$tool
done
'';
libPath = lib.makeLibraryPath [
glib zlib freetype fontconfig
xorg.libSM xorg.libICE xorg.libXrender xorg.libXext xorg.libX11 xorg.libXt
libusb-compat-0_1
];
meta = {
description = "Vendor development tools for Lattice FPGA devices";
longDescription = ''
Lattice Diamond software is the leading-edge software design environment
for cost- sensitive, low-power Lattice FPGA architectures. It is the
next-generation replacement for ispLEVER.
'';
homepage = "https://www.latticesemi.com/latticediamond";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ q3k ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,36 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, pkg-config
, libftdi1
, libusb1
, udev
}:
stdenv.mkDerivation rec {
pname = "openfpgaloader";
version = "0.6.0";
src = fetchFromGitHub {
owner = "trabucayre";
repo = "openFPGALoader";
rev = "v${version}";
sha256 = "sha256-gPRBHy7WVra4IlGvzrhNqbEbOQtYtUC+zQ+SnJTMvRA=";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [
libftdi1
libusb1
udev
];
meta = with lib; {
description = "Universal utility for programming FPGAs";
homepage = "https://github.com/trabucayre/openFPGALoader";
license = licenses.agpl3Only;
maintainers = with maintainers; [ danderson ];
};
}

View file

@ -0,0 +1,43 @@
{ lib
, python3Packages
, fetchFromGitHub
}:
with python3Packages; buildPythonApplication rec {
pname = "tinyprog";
# `python setup.py --version` from repo checkout
version = "1.0.24.dev114+g${lib.substring 0 7 src.rev}";
src = fetchFromGitHub {
owner = "tinyfpga";
repo = "TinyFPGA-Bootloader";
rev = "97f6353540bf7c0d27f5612f202b48f41da75299";
sha256 = "0zbrvvb957z2lwbfd39ixqdsnd2w4wfjirwkqdrqm27bjz308731";
};
sourceRoot = "source/programmer";
propagatedBuildInputs = [
pyserial
jsonmerge
intelhex
tqdm
six
packaging
setuptools
pyusb
];
nativeBuildInputs = [ setuptools-scm ];
preBuild = ''
export SETUPTOOLS_SCM_PRETEND_VERSION="${version}"
'';
meta = with lib; {
homepage = "https://github.com/tinyfpga/TinyFPGA-Bootloader/tree/master/programmer";
description = "Programmer for FPGA boards using the TinyFPGA USB Bootloader";
maintainers = with maintainers; [ emily ];
license = licenses.asl20;
};
}

View file

@ -0,0 +1,72 @@
{ lib, stdenv, fetchFromGitHub, python3, boost, cmake }:
let
rev = "2f06397673bbca3da11928d538b8ab7d01c944c6";
# git describe --tags
realVersion = "1.0-534-g${builtins.substring 0 7 rev}";
in stdenv.mkDerivation rec {
pname = "trellis";
version = "2021-12-14";
srcs = [
(fetchFromGitHub {
owner = "YosysHQ";
repo = "prjtrellis";
inherit rev;
hash = "sha256-m5CalAIbzY2bhOvpBbPBeLZeDp+itk1HlRsSmtiddaA=";
name = "trellis";
})
(fetchFromGitHub {
owner = "YosysHQ";
repo = "prjtrellis-db";
# note: the upstream submodule points to revision 0ee729d20eaf,
# but that's just the tip of the branch that was merged into master.
# fdf4bf275a is the merge commit itself
rev = "fdf4bf275a7402654bc643db537173e2fbc86103";
sha256 = "eDq2wU2pnfK9bOkEVZ07NQPv02Dc6iB+p5GTtVBiyQA=";
name = "trellis-database";
})
];
sourceRoot = "trellis";
buildInputs = [ boost ];
nativeBuildInputs = [ cmake python3 ];
cmakeFlags = [
"-DCURRENT_GIT_VERSION=${realVersion}"
# TODO: should this be in stdenv instead?
"-DCMAKE_INSTALL_DATADIR=${placeholder "out"}/share"
];
preConfigure = ''
rmdir database && ln -sfv ${builtins.elemAt srcs 1} ./database
cd libtrellis
'';
postInstall = lib.optionalString stdenv.isDarwin ''
for f in $out/bin/* ; do
install_name_tool -change "$out/lib/libtrellis.dylib" "$out/lib/trellis/libtrellis.dylib" "$f"
done
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/ecppack $out/share/trellis/misc/basecfgs/empty_lfe5u-85f.config /tmp/test.bin
'';
meta = with lib; {
description = "Documentation and bitstream tools for Lattice ECP5 FPGAs";
longDescription = ''
Project Trellis documents the Lattice ECP5 architecture
to enable development of open-source tools. Its goal is
to provide sufficient information to develop a free and
open Verilog to bitstream toolchain for these devices.
'';
homepage = "https://github.com/YosysHQ/prjtrellis";
license = licenses.isc;
maintainers = with maintainers; [ q3k thoughtpolice emily rowanG077 ];
platforms = platforms.all;
};
}