at 17.09-beta 153 lines 4.0 kB view raw
1{ stdenv, fetchurl, bc, dtc, python2 2, hostPlatform 3}: 4 5let 6 buildUBoot = { targetPlatforms 7 , filesToInstall 8 , installDir ? "$out" 9 , defconfig 10 , extraMeta ? {} 11 , ... } @ args: 12 stdenv.mkDerivation (rec { 13 14 name = "uboot-${defconfig}-${version}"; 15 version = "2017.03"; 16 17 src = fetchurl { 18 url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2"; 19 sha256 = "0gqihplap05dlpwdb971wsqyv01nz2vabwq5g5649gr5jczsyjzm"; 20 }; 21 22 nativeBuildInputs = [ bc dtc python2 ]; 23 24 hardeningDisable = [ "all" ]; 25 26 postPatch = '' 27 patchShebangs tools 28 ''; 29 30 configurePhase = '' 31 make ${defconfig} 32 ''; 33 34 installPhase = '' 35 runHook preInstall 36 37 mkdir -p ${installDir} 38 cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir} 39 40 runHook postInstall 41 ''; 42 43 enableParallelBuilding = true; 44 dontStrip = true; 45 46 crossAttrs = { 47 makeFlags = [ 48 "ARCH=${hostPlatform.platform.kernelArch}" 49 "CROSS_COMPILE=${stdenv.cc.prefix}" 50 ]; 51 }; 52 53 meta = with stdenv.lib; { 54 homepage = http://www.denx.de/wiki/U-Boot/; 55 description = "Boot loader for embedded systems"; 56 license = licenses.gpl2; 57 maintainers = [ maintainers.dezgeg ]; 58 platforms = targetPlatforms; 59 } // extraMeta; 60 } // args); 61 62in rec { 63 inherit buildUBoot; 64 65 ubootTools = buildUBoot rec { 66 defconfig = "allnoconfig"; 67 installDir = "$out/bin"; 68 buildFlags = "tools NO_SDL=1"; 69 dontStrip = false; 70 targetPlatforms = stdenv.lib.platforms.linux; 71 filesToInstall = ["tools/dumpimage" "tools/mkenvimage" "tools/mkimage"]; 72 }; 73 74 ubootA20OlinuxinoLime = buildUBoot rec { 75 defconfig = "A20-OLinuXino-Lime_defconfig"; 76 targetPlatforms = ["armv7l-linux"]; 77 filesToInstall = ["u-boot-sunxi-with-spl.bin"]; 78 }; 79 80 ubootBananaPi = buildUBoot rec { 81 defconfig = "Bananapi_defconfig"; 82 targetPlatforms = ["armv7l-linux"]; 83 filesToInstall = ["u-boot-sunxi-with-spl.bin"]; 84 }; 85 86 ubootBeagleboneBlack = buildUBoot rec { 87 defconfig = "am335x_boneblack_defconfig"; 88 targetPlatforms = ["armv7l-linux"]; 89 filesToInstall = ["MLO" "u-boot.img"]; 90 }; 91 92 ubootJetsonTK1 = buildUBoot rec { 93 defconfig = "jetson-tk1_defconfig"; 94 targetPlatforms = ["armv7l-linux"]; 95 filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"]; 96 }; 97 98 ubootOdroidXU3 = buildUBoot rec { 99 defconfig = "odroid-xu3_defconfig"; 100 targetPlatforms = ["armv7l-linux"]; 101 filesToInstall = ["u-boot-dtb.bin"]; 102 }; 103 104 ubootPcduino3Nano = buildUBoot rec { 105 defconfig = "Linksprite_pcDuino3_Nano_defconfig"; 106 targetPlatforms = ["armv7l-linux"]; 107 filesToInstall = ["u-boot-sunxi-with-spl.bin"]; 108 }; 109 110 ubootRaspberryPi = buildUBoot rec { 111 defconfig = "rpi_defconfig"; 112 targetPlatforms = ["armv6l-linux"]; 113 filesToInstall = ["u-boot.bin"]; 114 }; 115 116 ubootRaspberryPi2 = buildUBoot rec { 117 defconfig = "rpi_2_defconfig"; 118 targetPlatforms = ["armv7l-linux"]; 119 filesToInstall = ["u-boot.bin"]; 120 }; 121 122 ubootRaspberryPi3_32bit = buildUBoot rec { 123 defconfig = "rpi_3_32b_defconfig"; 124 targetPlatforms = ["armv7l-linux"]; 125 filesToInstall = ["u-boot.bin"]; 126 }; 127 128 ubootRaspberryPi3_64bit = buildUBoot rec { 129 defconfig = "rpi_3_defconfig"; 130 targetPlatforms = ["aarch64-linux"]; 131 filesToInstall = ["u-boot.bin"]; 132 }; 133 134 ubootUtilite = buildUBoot rec { 135 defconfig = "cm_fx6_defconfig"; 136 targetPlatforms = ["armv7l-linux"]; 137 filesToInstall = ["u-boot-with-nand-spl.imx"]; 138 buildFlags = "u-boot-with-nand-spl.imx"; 139 postConfigure = '' 140 cat >> .config << EOF 141 CONFIG_CMD_SETEXPR=y 142 EOF 143 ''; 144 # sata init; load sata 0 $loadaddr u-boot-with-nand-spl.imx 145 # sf probe; sf update $loadaddr 0 80000 146 }; 147 148 ubootWandboard = buildUBoot rec { 149 defconfig = "wandboard_defconfig"; 150 targetPlatforms = ["armv7l-linux"]; 151 filesToInstall = ["u-boot.img" "SPL"]; 152 }; 153}