bareboxTools: init at v2020.12.0

This adds the bareboxTools as a package. The buildBarebox function is
intentionally modeled like the buildUBoot function, which should allow
future expansion to build barebox for NixOS systems. The tools are
useful on their own, since they allow flashing of systems via the
different USB loader tools shipped in the scripts directory.

authored by Rouven Czerwinski and committed by Andreas Rammhold 7a6203ff af2ab765

+101
+96
pkgs/misc/barebox/default.nix
···
··· 1 + { stdenv 2 + , lib 3 + , fetchurl 4 + , bison 5 + , dtc 6 + , flex 7 + , libusb1 8 + , lzop 9 + , openssl 10 + , pkgconfig 11 + , buildPackages 12 + }: 13 + 14 + let 15 + buildBarebox = { 16 + filesToInstall 17 + , installDir ? "$out" 18 + , defconfig 19 + , extraMeta ? {} 20 + , ... } @ args: stdenv.mkDerivation rec { 21 + pname = "barebox-${defconfig}"; 22 + 23 + version = "2020.12.0"; 24 + 25 + src = fetchurl { 26 + url = "https://www.barebox.org/download/barebox-${version}.tar.bz2"; 27 + sha256 = "06vsd95ihaa2nywpqy6k0c7xwk2pzws4yvbp328yd2pfiigachrv"; 28 + }; 29 + 30 + postPatch = '' 31 + patchShebangs scripts 32 + ''; 33 + 34 + nativeBuildInputs = [ 35 + bison 36 + dtc 37 + flex 38 + openssl 39 + libusb1 40 + lzop 41 + pkgconfig 42 + ]; 43 + depsBuildBuild = [ buildPackages.stdenv.cc ]; 44 + 45 + hardeningDisable = [ "all" ]; 46 + 47 + makeFlags = [ 48 + "DTC=dtc" 49 + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" 50 + ]; 51 + 52 + configurePhase = '' 53 + runHook preConfigure 54 + 55 + make ${defconfig} 56 + 57 + runHook postConfigure 58 + ''; 59 + 60 + installPhase = '' 61 + runHook preInstall 62 + 63 + mkdir -p ${installDir} 64 + cp ${lib.concatStringsSep " " filesToInstall} ${installDir} 65 + 66 + runHook postInstall 67 + ''; 68 + 69 + enableParallelBuilding = true; 70 + 71 + dontStrip = true; 72 + 73 + meta = with lib; { 74 + homepage = "https://www.barebox.org"; 75 + description = "The Swiss Army Knive for bare metal"; 76 + license = licenses.gpl2; 77 + maintainers = with maintainers; [ emantor ]; 78 + } // extraMeta; 79 + } // removeAttrs args [ "extraMeta" ]; 80 + 81 + in { 82 + inherit buildBarebox; 83 + 84 + bareboxTools = buildBarebox { 85 + defconfig = "hosttools_defconfig"; 86 + installDir = "$out/bin"; 87 + extraMeta.platforms = lib.platforms.linux; 88 + filesToInstall = [ 89 + "scripts/bareboximd" 90 + "scripts/imx/imx-usb-loader" 91 + "scripts/omap4_usbboot" 92 + "scripts/omap3-usb-loader" 93 + "scripts/kwboot" 94 + ]; 95 + }; 96 + }
+5
pkgs/top-level/all-packages.nix
··· 19280 ubootWandboard 19281 ; 19282 19283 uclibc = callPackage ../os-specific/linux/uclibc { }; 19284 19285 uclibcCross = callPackage ../os-specific/linux/uclibc {
··· 19280 ubootWandboard 19281 ; 19282 19283 + # Upstream Barebox: 19284 + inherit (callPackage ../misc/barebox {}) 19285 + buildbarebox 19286 + bareboxTools; 19287 + 19288 uclibc = callPackage ../os-specific/linux/uclibc { }; 19289 19290 uclibcCross = callPackage ../os-specific/linux/uclibc {