2020-12-25 13:55:36 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, bison
|
|
|
|
, dtc
|
|
|
|
, flex
|
|
|
|
, libusb1
|
|
|
|
, lzop
|
|
|
|
, openssl
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-12-25 13:55:36 +00:00
|
|
|
, buildPackages
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
buildBarebox = {
|
|
|
|
filesToInstall
|
|
|
|
, installDir ? "$out"
|
|
|
|
, defconfig
|
|
|
|
, extraMeta ? {}
|
|
|
|
, ... } @ args: stdenv.mkDerivation rec {
|
|
|
|
pname = "barebox-${defconfig}";
|
|
|
|
|
|
|
|
version = "2020.12.0";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.barebox.org/download/barebox-${version}.tar.bz2";
|
|
|
|
sha256 = "06vsd95ihaa2nywpqy6k0c7xwk2pzws4yvbp328yd2pfiigachrv";
|
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs scripts
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
bison
|
|
|
|
dtc
|
|
|
|
flex
|
|
|
|
openssl
|
|
|
|
libusb1
|
|
|
|
lzop
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-12-25 13:55:36 +00:00
|
|
|
];
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
|
|
|
hardeningDisable = [ "all" ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"DTC=dtc"
|
|
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
make ${defconfig}
|
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p ${installDir}
|
|
|
|
cp ${lib.concatStringsSep " " filesToInstall} ${installDir}
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.barebox.org";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Swiss Army Knive for bare metal";
|
2024-07-27 06:49:29 +00:00
|
|
|
license = licenses.gpl2Only;
|
2020-12-25 13:55:36 +00:00
|
|
|
maintainers = with maintainers; [ emantor ];
|
|
|
|
} // extraMeta;
|
|
|
|
} // removeAttrs args [ "extraMeta" ];
|
|
|
|
|
|
|
|
in {
|
|
|
|
inherit buildBarebox;
|
|
|
|
|
|
|
|
bareboxTools = buildBarebox {
|
|
|
|
defconfig = "hosttools_defconfig";
|
|
|
|
installDir = "$out/bin";
|
|
|
|
extraMeta.platforms = lib.platforms.linux;
|
|
|
|
filesToInstall = [
|
|
|
|
"scripts/bareboximd"
|
|
|
|
"scripts/imx/imx-usb-loader"
|
|
|
|
"scripts/omap4_usbboot"
|
|
|
|
"scripts/omap3-usb-loader"
|
|
|
|
"scripts/kwboot"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|