From d29202bc48be6069e3d7ddc7b7760aac8c0c19b7 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 23 Feb 2018 17:50:24 -0500 Subject: [PATCH 1/9] uboot: 2017.11 -> 2018.03, cross fixes (cherry picked from commit 5804547243010ec8e341e98e8acbc5c96263682e) (cherry picked from commit 7c46833b047710f220971d7d7d3b1dbe6fed805b) --- pkgs/misc/uboot/default.nix | 77 ++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 1bfcea1057e..9e07c22fe2a 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -1,10 +1,9 @@ -{ stdenv, fetchurl, fetchpatch, bc, dtc, openssl, python2 -, hostPlatform +{ stdenv, fetchurl, fetchpatch, bc, dtc, openssl, python2, swig +, hostPlatform, buildPackages }: let - buildUBoot = { targetPlatforms - , filesToInstall + buildUBoot = { filesToInstall , installDir ? "$out" , defconfig , extraMakeFlags ? [] @@ -13,18 +12,14 @@ let stdenv.mkDerivation (rec { name = "uboot-${defconfig}-${version}"; - version = "2017.11"; + version = "2018.03"; src = fetchurl { url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2"; - sha256 = "01bcsah5imy6m3fbjwhqywxg0pfk5fl8ks9ylb7kv3zmrb9qy0ba"; + sha256 = "1z9x635l5164c5hnf7qs19w7j3qghbkgs7rpn673dm898i9pfx3y"; }; patches = [ - (fetchpatch { - url = https://github.com/dezgeg/u-boot/commit/cbsize-2017-11.patch; - sha256 = "08rqsrj78aif8vaxlpwiwwv1jwf0diihbj0h88hc0mlp0kmyqxwm"; - }) (fetchpatch { url = https://github.com/dezgeg/u-boot/commit/rpi-2017-11-patch1.patch; sha256 = "067yq55vv1slv4xy346px7h329pi14abdn04chg6s1s6hmf6c1x9"; @@ -34,8 +29,8 @@ let sha256 = "0bbw0q027xvzvdxxvpzjajg4rm30a8mb7z74b6ma9q0l7y7bi0c4"; }) (fetchpatch { - url = https://github.com/dezgeg/u-boot/commit/pythonpath-2017-11.patch; - sha256 = "162b2lglp307pzxsf9m7nnmzwxqd7xkwp5j85bm6bg1a38ngpl9v"; + url = https://github.com/dezgeg/u-boot/commit/pythonpath-2018-03.patch; + sha256 = "1rhhlhrwhv7ic1n5i720jfh2cxwrkssrkvinllyjy3j9k9bpzcqd"; }) ]; @@ -43,14 +38,22 @@ let patchShebangs tools ''; - nativeBuildInputs = [ bc dtc openssl python2 ]; + nativeBuildInputs = [ bc dtc openssl python2 swig ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; hardeningDisable = [ "all" ]; - makeFlags = [ "DTC=dtc" ] ++ extraMakeFlags; + makeFlags = [ + "DTC=dtc" + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + ] ++ extraMakeFlags; configurePhase = '' + runHook preConfigure + make ${defconfig} + + runHook postConfigure ''; installPhase = '' @@ -65,21 +68,13 @@ let enableParallelBuilding = true; dontStrip = true; - crossAttrs = { - makeFlags = [ - "ARCH=${hostPlatform.platform.kernelArch}" - "CROSS_COMPILE=${stdenv.cc.targetPrefix}" - ]; - }; - meta = with stdenv.lib; { homepage = http://www.denx.de/wiki/U-Boot/; description = "Boot loader for embedded systems"; license = licenses.gpl2; maintainers = [ maintainers.dezgeg ]; - platforms = targetPlatforms; } // extraMeta; - } // args); + } // removeAttrs args [ "extraMeta" ]); in rec { inherit buildUBoot; @@ -88,10 +83,14 @@ in rec { defconfig = "allnoconfig"; installDir = "$out/bin"; buildFlags = "tools NO_SDL=1"; + hardeningDisable = []; dontStrip = false; - targetPlatforms = stdenv.lib.platforms.linux; + extraMeta.platforms = stdenv.lib.platforms.linux; # build tools/kwboot extraMakeFlags = [ "CONFIG_KIRKWOOD=y" ]; + postConfigure = '' + sed -i '/CONFIG_SYS_TEXT_BASE/c\CONFIG_SYS_TEXT_BASE=0x00000000' .config + ''; filesToInstall = [ "tools/dumpimage" "tools/fdtgrep" @@ -103,86 +102,86 @@ in rec { ubootA20OlinuxinoLime = buildUBoot rec { defconfig = "A20-OLinuXino-Lime_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-sunxi-with-spl.bin"]; }; ubootBananaPi = buildUBoot rec { defconfig = "Bananapi_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-sunxi-with-spl.bin"]; }; ubootBeagleboneBlack = buildUBoot rec { defconfig = "am335x_boneblack_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["MLO" "u-boot.img"]; }; # http://git.denx.de/?p=u-boot.git;a=blob;f=board/solidrun/clearfog/README;hb=refs/heads/master ubootClearfog = buildUBoot rec { defconfig = "clearfog_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-spl.kwb"]; }; ubootJetsonTK1 = buildUBoot rec { defconfig = "jetson-tk1_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"]; }; ubootOdroidXU3 = buildUBoot rec { defconfig = "odroid-xu3_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-dtb.bin"]; }; ubootOrangePiPc = buildUBoot rec { defconfig = "orangepi_pc_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-sunxi-with-spl.bin"]; }; ubootPcduino3Nano = buildUBoot rec { defconfig = "Linksprite_pcDuino3_Nano_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-sunxi-with-spl.bin"]; }; ubootQemuArm = buildUBoot rec { defconfig = "qemu_arm_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot.bin"]; }; ubootRaspberryPi = buildUBoot rec { defconfig = "rpi_defconfig"; - targetPlatforms = ["armv6l-linux"]; + extraMeta.platforms = ["armv6l-linux"]; filesToInstall = ["u-boot.bin"]; }; ubootRaspberryPi2 = buildUBoot rec { defconfig = "rpi_2_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot.bin"]; }; ubootRaspberryPi3_32bit = buildUBoot rec { defconfig = "rpi_3_32b_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot.bin"]; }; ubootRaspberryPi3_64bit = buildUBoot rec { defconfig = "rpi_3_defconfig"; - targetPlatforms = ["aarch64-linux"]; + extraMeta.platforms = ["aarch64-linux"]; filesToInstall = ["u-boot.bin"]; }; ubootUtilite = buildUBoot rec { defconfig = "cm_fx6_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot-with-nand-spl.imx"]; buildFlags = "u-boot-with-nand-spl.imx"; postConfigure = '' @@ -196,7 +195,7 @@ in rec { ubootWandboard = buildUBoot rec { defconfig = "wandboard_defconfig"; - targetPlatforms = ["armv7l-linux"]; + extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot.img" "SPL"]; }; } From 2a450cec19028bb7ea533bbb3d98966722b22d7e Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Sat, 3 Mar 2018 21:17:13 -0500 Subject: [PATCH 2/9] uboot: add patch to increase maximum path length in extlinux.conf This fixes problems with cross compiled kernels failing to boot. (cherry picked from commit 1f4bb8c61d71f2ac12f1cc6cf50aaa590df40a45) (cherry picked from commit 828fdd61b9b5ae0d3c9253309f3d115210348096) --- pkgs/misc/uboot/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 9e07c22fe2a..800c0057282 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -32,6 +32,10 @@ let url = https://github.com/dezgeg/u-boot/commit/pythonpath-2018-03.patch; sha256 = "1rhhlhrwhv7ic1n5i720jfh2cxwrkssrkvinllyjy3j9k9bpzcqd"; }) + (fetchpatch { + url = https://github.com/dezgeg/u-boot/commit/extlinux-path-length-2018-03.patch; + sha256 = "07jafdnxvqv8lz256qy29agjc2k1zj5ad4k28r1w5qkhwj4ixmf8"; + }) ]; postPatch = '' From d50bcaa8168b2b41d0e6d195d9ccb03e9d332d6c Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 23 Feb 2018 23:47:27 -0500 Subject: [PATCH 3/9] uboot: sheevplug and guruplug: use mainline U-Boot These derivations have not seen any updates since they were created in 2010, and some of their sources have disappeared. There are upstream configs for these boards, so these are now used, and they build correctly. I have no way of testing them, and I don't if anyone even uses either board with Nix anymore. (cherry picked from commit 01020b3263629be5a8697aa781dcb267df8de0a0) (cherry picked from commit 48ade50d8ece09d3ff732b07f0facdcd78084ac3) --- pkgs/misc/uboot/default.nix | 12 ++ pkgs/misc/uboot/gas220.patch | 18 --- pkgs/misc/uboot/guruplug-file-systems.patch | 48 -------- .../uboot/guruplug-usb-msd-multi-lun.patch | 106 ------------------ pkgs/misc/uboot/guruplug.nix | 57 ---------- pkgs/misc/uboot/sheevaplug.nix | 61 ---------- pkgs/top-level/all-packages.nix | 6 +- 7 files changed, 14 insertions(+), 294 deletions(-) delete mode 100644 pkgs/misc/uboot/gas220.patch delete mode 100644 pkgs/misc/uboot/guruplug-file-systems.patch delete mode 100644 pkgs/misc/uboot/guruplug-usb-msd-multi-lun.patch delete mode 100644 pkgs/misc/uboot/guruplug.nix delete mode 100644 pkgs/misc/uboot/sheevaplug.nix diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 800c0057282..9da52e49437 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -129,6 +129,12 @@ in rec { filesToInstall = ["u-boot-spl.kwb"]; }; + ubootGuruplug = buildUBoot rec { + defconfig = "guruplug_defconfig"; + extraMeta.platforms = ["armv5tel-linux"]; + filesToInstall = ["u-boot.bin"]; + }; + ubootJetsonTK1 = buildUBoot rec { defconfig = "jetson-tk1_defconfig"; extraMeta.platforms = ["armv7l-linux"]; @@ -183,6 +189,12 @@ in rec { filesToInstall = ["u-boot.bin"]; }; + ubootSheevaplug = buildUBoot rec { + defconfig = "sheevaplug_defconfig"; + extraMeta.platforms = ["armv5tel-linux"]; + filesToInstall = ["u-boot.bin"]; + }; + ubootUtilite = buildUBoot rec { defconfig = "cm_fx6_defconfig"; extraMeta.platforms = ["armv7l-linux"]; diff --git a/pkgs/misc/uboot/gas220.patch b/pkgs/misc/uboot/gas220.patch deleted file mode 100644 index c5a91b0f3d0..00000000000 --- a/pkgs/misc/uboot/gas220.patch +++ /dev/null @@ -1,18 +0,0 @@ -Patch to allow assembling with binutils 2.20. It worked without this patch in 2.19.1 -diff --git a/board/mv_feroceon/USP/jump.S b/board/mv_feroceon/USP/jump.S -index 4b6b9ee..58037fc 100644 ---- a/board/mv_feroceon/USP/jump.S -+++ b/board/mv_feroceon/USP/jump.S -@@ -29,9 +29,11 @@ disclaimer. - #include "sys/mvCpuIfRegs.h" - - --jumpStart: - - .section ".reset_vector_sect",#alloc, #execinstr -+ -+jumpStart: -+ - #if defined(MV_88F6082) || defined(MV_88F6183) || defined(DB_88F5181_OLD) || defined(DB_FPGA) || \ - defined(MV88F6281) || defined(MV88F6192) || defined(MV88F6180) || defined(MV_88F6183L) || \ - defined(MV88F6190) diff --git a/pkgs/misc/uboot/guruplug-file-systems.patch b/pkgs/misc/uboot/guruplug-file-systems.patch deleted file mode 100644 index 30dc1994303..00000000000 --- a/pkgs/misc/uboot/guruplug-file-systems.patch +++ /dev/null @@ -1,48 +0,0 @@ -Add support for the various file systems as found in `sheevaplug.h'. -As for the SheevaPlug, the increase in size means that the environment -must be pushed further away. - -In addition, increase the malloc area size to allow compilation of UbiFS. - ---- u-boot/include/configs/guruplug.h 1970-01-01 01:00:01.000000000 +0100 -+++ u-boot/include/configs/guruplug.h 2010-09-29 18:59:52.000000000 +0200 -@@ -123,8 +123,8 @@ - * it has to be rounded to sector size - */ - #define CONFIG_ENV_SIZE 0x20000 /* 128k */ --#define CONFIG_ENV_ADDR 0x40000 --#define CONFIG_ENV_OFFSET 0x40000 /* env starts here */ -+#define CONFIG_ENV_ADDR 0x60000 -+#define CONFIG_ENV_OFFSET 0x60000 /* env starts here */ - - /* - * Default environment variables -@@ -145,7 +145,7 @@ - /* - * Size of malloc() pool - */ --#define CONFIG_SYS_MALLOC_LEN (1024 * 128) /* 128kB for malloc() */ -+#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) /* 1 MiB for malloc() */ - /* size in bytes reserved for initial data */ - #define CONFIG_SYS_GBL_DATA_SIZE 128 - -@@ -195,4 +195,18 @@ - - #define CONFIG_SYS_ALT_MEMTEST - -+/* -+ * File system -+ */ -+#define CONFIG_CMD_EXT2 -+#define CONFIG_CMD_FAT -+#define CONFIG_CMD_JFFS2 -+#define CONFIG_CMD_UBI -+#define CONFIG_CMD_UBIFS -+#define CONFIG_RBTREE -+#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ -+#define CONFIG_MTD_PARTITIONS -+#define CONFIG_CMD_MTDPARTS -+#define CONFIG_LZO -+ - #endif /* _CONFIG_GURUPLUG_H */ - diff --git a/pkgs/misc/uboot/guruplug-usb-msd-multi-lun.patch b/pkgs/misc/uboot/guruplug-usb-msd-multi-lun.patch deleted file mode 100644 index 4f32dd89031..00000000000 --- a/pkgs/misc/uboot/guruplug-usb-msd-multi-lun.patch +++ /dev/null @@ -1,106 +0,0 @@ -The GuruPlug's microSD card reader is a USB mass storage device that -has two logical units (LUNs), i.e., two "SCSI disks". This patch -adds multi-LUN support to the USB MSD driver. - -See the thread at . - ---- u-boot/common/usb_storage.c 1970-01-01 01:00:01.000000000 +0100 -+++ u-boot/common/usb_storage.c 2010-10-02 00:38:15.000000000 +0200 -@@ -204,6 +204,22 @@ int usb_stor_info(void) - return 1; - } - -+static unsigned int usb_get_max_lun(struct us_data *us) -+{ -+ int len; -+ unsigned char result; -+ len = usb_control_msg(us->pusb_dev, -+ usb_rcvctrlpipe(us->pusb_dev, 0), -+ US_BBB_GET_MAX_LUN, -+ USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, -+ 0, us->ifnum, -+ &result, sizeof(result), -+ USB_CNTL_TIMEOUT * 5); -+ USB_STOR_PRINTF("Get Max LUN -> len = %i, result = %i\n", -+ len, (int) result); -+ return (len > 0) ? result : 0; -+} -+ - /******************************************************************************* - * scan the usb and reports device info - * to the user if mode = 1 -@@ -241,13 +257,21 @@ int usb_stor_scan(int mode) - break; /* no more devices avaiable */ - - if (usb_storage_probe(dev, 0, &usb_stor[usb_max_devs])) { -- /* ok, it is a storage devices -- * get info and fill it in -- */ -- if (usb_stor_get_info(dev, &usb_stor[usb_max_devs], -- &usb_dev_desc[usb_max_devs]) == 1) -+ /* OK, it's a storage device. Iterate over its LUNs -+ * and populate `usb_dev_desc'. */ -+ int lun, max_lun, start = usb_max_devs; -+ -+ max_lun = usb_get_max_lun(&usb_stor[usb_max_devs]); -+ for (lun = 0; -+ lun <= max_lun && usb_max_devs < USB_MAX_STOR_DEV; -+ lun++) { -+ usb_dev_desc[usb_max_devs].lun = lun; -+ if (usb_stor_get_info(dev, &usb_stor[start], -+ &usb_dev_desc[usb_max_devs]) == 1) { - usb_max_devs++; - } -+ } -+ } - /* if storage device */ - if (usb_max_devs == USB_MAX_STOR_DEV) { - printf("max USB Storage Device reached: %d stopping\n", -@@ -882,6 +906,7 @@ static int usb_inquiry(ccb *srb, struct - do { - memset(&srb->cmd[0], 0, 12); - srb->cmd[0] = SCSI_INQUIRY; -+ srb->cmd[1] = srb->lun << 5; - srb->cmd[4] = 36; - srb->datalen = 36; - srb->cmdlen = 12; -@@ -905,6 +930,7 @@ static int usb_request_sense(ccb *srb, s - ptr = (char *)srb->pdata; - memset(&srb->cmd[0], 0, 12); - srb->cmd[0] = SCSI_REQ_SENSE; -+ srb->cmd[1] = srb->lun << 5; - srb->cmd[4] = 18; - srb->datalen = 18; - srb->pdata = &srb->sense_buf[0]; -@@ -924,6 +950,7 @@ static int usb_test_unit_ready(ccb *srb, - do { - memset(&srb->cmd[0], 0, 12); - srb->cmd[0] = SCSI_TST_U_RDY; -+ srb->cmd[1] = srb->lun << 5; - srb->datalen = 0; - srb->cmdlen = 12; - if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) -@@ -943,6 +970,7 @@ static int usb_read_capacity(ccb *srb, s - do { - memset(&srb->cmd[0], 0, 12); - srb->cmd[0] = SCSI_RD_CAPAC; -+ srb->cmd[1] = srb->lun << 5; - srb->datalen = 8; - srb->cmdlen = 12; - if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) -@@ -957,6 +985,7 @@ static int usb_read_10(ccb *srb, struct - { - memset(&srb->cmd[0], 0, 12); - srb->cmd[0] = SCSI_READ10; -+ srb->cmd[1] = srb->lun << 5; - srb->cmd[2] = ((unsigned char) (start >> 24)) & 0xff; - srb->cmd[3] = ((unsigned char) (start >> 16)) & 0xff; - srb->cmd[4] = ((unsigned char) (start >> 8)) & 0xff; -@@ -973,6 +1002,7 @@ static int usb_write_10(ccb *srb, struct - { - memset(&srb->cmd[0], 0, 12); - srb->cmd[0] = SCSI_WRITE10; -+ srb->cmd[1] = srb->lun << 5; - srb->cmd[2] = ((unsigned char) (start >> 24)) & 0xff; - srb->cmd[3] = ((unsigned char) (start >> 16)) & 0xff; - srb->cmd[4] = ((unsigned char) (start >> 8)) & 0xff; diff --git a/pkgs/misc/uboot/guruplug.nix b/pkgs/misc/uboot/guruplug.nix deleted file mode 100644 index 9f24f1da86a..00000000000 --- a/pkgs/misc/uboot/guruplug.nix +++ /dev/null @@ -1,57 +0,0 @@ -{stdenv, fetchgit, unzip}: - -# Marvell's branch of U-Boot for the GuruPlug. - -let - # Aug 2010 revision of the `testing' branch of Marvell's U-Boot repository. - # See - # - # for details. - rev = "f106056095049c2c748c2a2797e5353295240e04"; -in -stdenv.mkDerivation { - name = "uboot-guruplug-0.0-pre-${stdenv.lib.strings.substring 0 7 rev}"; - - src = fetchgit { - url = "git://git.denx.de/u-boot-marvell.git"; - sha256 = "18gwyj16vml7aja9cyan51jwfcysy4cs062z7wmgdc0l9bha6iw7"; - inherit rev; - }; - - patches = - [ ./guruplug-file-systems.patch ./guruplug-usb-msd-multi-lun.patch ]; - - enableParallelBuilding = true; - - # Remove the cross compiler prefix. - configurePhase = '' - make mrproper - make guruplug_config - sed -i /CROSS_COMPILE/d include/config.mk - ''; - - buildPhase = '' - unset src - if test -z "$crossConfig"; then - make all u-boot.kwb - else - make all u-boot.kwb ARCH=arm CROSS_COMPILE=$crossConfig- - fi - ''; - - nativeBuildInputs = [ unzip ]; - - dontStrip = true; - - installPhase = '' - mkdir -p $out - cp -v u-boot u-boot.{kwb,map} $out - - mkdir -p $out/bin - cp tools/{envcrc,mkimage} $out/bin - ''; - - meta = { - platforms = [ "armv5tel-linux" ]; - }; -} diff --git a/pkgs/misc/uboot/sheevaplug.nix b/pkgs/misc/uboot/sheevaplug.nix deleted file mode 100644 index 53d811d1a44..00000000000 --- a/pkgs/misc/uboot/sheevaplug.nix +++ /dev/null @@ -1,61 +0,0 @@ -{stdenv, fetchurl, unzip}: - -# We should enable this check once we have the cross target system information -# assert stdenv.system == "armv5tel-linux" || crossConfig == "armv5tel-linux"; - -# All this file is made for the Marvell Sheevaplug - -stdenv.mkDerivation { - name = "uboot-sheevaplug-3.4.27"; - - src = fetchurl { - url = "ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.4.tar.bz2"; - sha256 = "19vp4rlikz7h72pqsjhgz7nmgjy4c6vabvxkw67wni70vy5ddy8s"; - }; - - srcAddon = fetchurl { - url = "http://www.plugcomputer.org/405/us/plug-basic/uboot/u-boot-3.4.27.zip"; - sha256 = "1wqxznpdb6d2kx58gral4q0mg5ddxyrv7az8c6v29nr3cd9yrfsg"; - }; - - postUnpack = '' - mv u-boot-1.1.4 u-boot-3.4.27 - unzip -o $srcAddon - sourceRoot=u-boot-3.4.27 - ''; - - patches = [ ./gas220.patch ]; - - # Remove the cross compiler prefix, and add reiserfs support - configurePhase = '' - make mrproper - make rd88f6281Sheevaplug_config NBOOT=1 LE=1 - sed -i /CROSS_COMPILE/d include/config.mk - ''; - - buildPhase = '' - unset src - if test -z "$crossConfig"; then - make clean all - else - make clean all ARCH=arm CROSS_COMPILE=$crossConfig- - fi - ''; - - nativeBuildInputs = [ unzip ]; - - dontStrip = true; - - installPhase = '' - mkdir -p $out - cp u-boot-rd88f6281Sheevaplug_400db_nand.bin $out - cp u-boot u-boot.map $out - - mkdir -p $out/bin - cp tools/{envcrc,mkimage} $out/bin - ''; - - meta = { - platforms = [ "armv5tel-linux" ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c27168530e0..6e4d75f78c3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13797,6 +13797,7 @@ with pkgs; ubootBananaPi ubootBeagleboneBlack ubootClearfog + ubootGuruplug ubootJetsonTK1 ubootOdroidXU3 ubootOrangePiPc @@ -13806,17 +13807,14 @@ with pkgs; ubootRaspberryPi2 ubootRaspberryPi3_32bit ubootRaspberryPi3_64bit + ubootSheevaplug ubootUtilite ubootWandboard ; # Non-upstream U-Boots: - ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { }; - ubootNanonote = callPackage ../misc/uboot/nanonote.nix { }; - ubootGuruplug = callPackage ../misc/uboot/guruplug.nix { }; - uclibc = callPackage ../os-specific/linux/uclibc { }; uclibcCross = callPackage ../os-specific/linux/uclibc { From b63124dfc5f4f1f868a8132efc159d99f1b73516 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Tue, 6 Mar 2018 00:04:10 -0500 Subject: [PATCH 4/9] uboot: fix cross-build of ubootTools (cherry picked from commit 28fd7d9594fa0ed1a1b80a9652b5ab065a29e077) (cherry picked from commit 4c669db598aba04b9a6dd3ecaf0811329d80a072) --- pkgs/misc/uboot/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 9da52e49437..dbb2bbef1a4 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -86,12 +86,11 @@ in rec { ubootTools = buildUBoot rec { defconfig = "allnoconfig"; installDir = "$out/bin"; - buildFlags = "tools NO_SDL=1"; hardeningDisable = []; dontStrip = false; extraMeta.platforms = stdenv.lib.platforms.linux; # build tools/kwboot - extraMakeFlags = [ "CONFIG_KIRKWOOD=y" ]; + extraMakeFlags = [ "CONFIG_KIRKWOOD=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "tools" ]; postConfigure = '' sed -i '/CONFIG_SYS_TEXT_BASE/c\CONFIG_SYS_TEXT_BASE=0x00000000' .config ''; From 7dffe0d38c7be19537b9fe67ba24be8c37f96a0c Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Thu, 15 Mar 2018 09:03:39 +0200 Subject: [PATCH 5/9] U-Boot: Add AArch64 QEMU build See https://github.com/u-boot/u-boot/blob/master/doc/README.qemu-arm on how to use it. (cherry picked from commit 6b069c656abf9704662317dc0173f18cdf4dfc91) (cherry picked from commit eff6d9628c9e0bae2096251f8e97789c0b9afe6f) --- pkgs/misc/uboot/default.nix | 6 ++++++ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 7 insertions(+) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index dbb2bbef1a4..b56ca269357 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -158,6 +158,12 @@ in rec { filesToInstall = ["u-boot-sunxi-with-spl.bin"]; }; + ubootQemuAarch64 = buildUBoot rec { + defconfig = "qemu_arm64_defconfig"; + extraMeta.platforms = ["aarch64-linux"]; + filesToInstall = ["u-boot.bin"]; + }; + ubootQemuArm = buildUBoot rec { defconfig = "qemu_arm_defconfig"; extraMeta.platforms = ["armv7l-linux"]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6e4d75f78c3..78641135ef6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13802,6 +13802,7 @@ with pkgs; ubootOdroidXU3 ubootOrangePiPc ubootPcduino3Nano + ubootQemuAarch64 ubootQemuArm ubootRaspberryPi ubootRaspberryPi2 From 566d3feb4e5b785513f1ed1c6a23faee96d96077 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 10 Dec 2017 20:56:36 -0500 Subject: [PATCH 6/9] U-Boot: Add SOPINE Baseboard build This build is compatible with PINE A64-LTS. [dezgeg changed the original device tree patch to v4 of the patch series "sunxi: sync H3, H5, A64 DTs from mainline Linux" submitted to the upstream mailing list by Andre Przywara. Also install the u-boot-sunxi-with-spl.bin binary similar to 32-bit boards since it's now being built by the upstream build system.] (cherry picked from commit 2ff31f71ae1f10b3d1779b876ac94bf2a9998bd9) (cherry picked from commit 176d151f4d98d54adf293ee58427da649f28452c) --- pkgs/misc/uboot/default.nix | 19 ++++++++++++++++++- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index b56ca269357..aac5f5a2c80 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -1,11 +1,20 @@ { stdenv, fetchurl, fetchpatch, bc, dtc, openssl, python2, swig +, armTrustedFirmwareAllwinner , hostPlatform, buildPackages }: let + # Various changes for 64-bit sunxi boards, (hopefully) destined for 2018.05 + sunxiPatch = fetchpatch { + name = "sunxi.patch"; + url = "https://github.com/u-boot/u-boot/compare/v2018.03...dezgeg:2018-03-sunxi.patch"; + sha256 = "1pqn7c6c06hfygwpcgaraqvqxcjhz99j0rx5psfhj8igy0qvk2dq"; + }; + buildUBoot = { filesToInstall , installDir ? "$out" , defconfig + , extraPatches ? [] , extraMakeFlags ? [] , extraMeta ? {} , ... } @ args: @@ -36,7 +45,7 @@ let url = https://github.com/dezgeg/u-boot/commit/extlinux-path-length-2018-03.patch; sha256 = "07jafdnxvqv8lz256qy29agjc2k1zj5ad4k28r1w5qkhwj4ixmf8"; }) - ]; + ] ++ extraPatches; postPatch = '' patchShebangs tools @@ -200,6 +209,14 @@ in rec { filesToInstall = ["u-boot.bin"]; }; + ubootSopine = buildUBoot rec { + extraPatches = [sunxiPatch]; + defconfig = "sopine_baseboard_defconfig"; + extraMeta.platforms = ["aarch64-linux"]; + BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; + filesToInstall = ["u-boot-sunxi-with-spl.bin"]; + }; + ubootUtilite = buildUBoot rec { defconfig = "cm_fx6_defconfig"; extraMeta.platforms = ["armv7l-linux"]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 78641135ef6..96c76b95519 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13809,6 +13809,7 @@ with pkgs; ubootRaspberryPi3_32bit ubootRaspberryPi3_64bit ubootSheevaplug + ubootSopine ubootUtilite ubootWandboard ; From f2ea9e0ebf32754c0a9ad3ff5385b943b48bae3f Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Fri, 19 Jan 2018 22:14:00 +0200 Subject: [PATCH 7/9] U-Boot: Add Pine64 build (cherry picked from commit 4b77663edfba2c4e15db46c1ba900fa9819e4325) (cherry picked from commit 1896fcff609d7b99b4be1781a5c9523193c33e4f) --- pkgs/misc/uboot/default.nix | 8 ++++++++ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 9 insertions(+) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index aac5f5a2c80..4a96deadaea 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -167,6 +167,14 @@ in rec { filesToInstall = ["u-boot-sunxi-with-spl.bin"]; }; + ubootPine64 = buildUBoot rec { + extraPatches = [sunxiPatch]; + defconfig = "pine64_plus_defconfig"; + extraMeta.platforms = ["aarch64-linux"]; + BL31 = "${armTrustedFirmwareAllwinner}/bl31.bin"; + filesToInstall = ["u-boot-sunxi-with-spl.bin"]; + }; + ubootQemuAarch64 = buildUBoot rec { defconfig = "qemu_arm64_defconfig"; extraMeta.platforms = ["aarch64-linux"]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 96c76b95519..d18e51772ce 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13802,6 +13802,7 @@ with pkgs; ubootOdroidXU3 ubootOrangePiPc ubootPcduino3Nano + ubootPine64 ubootQemuAarch64 ubootQemuArm ubootRaspberryPi From d884ece1daa254b39c0fae9910bde0771c8fd496 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Fri, 16 Mar 2018 19:27:01 +0200 Subject: [PATCH 8/9] U-Boot: Make ubootJetsonTK1 install even more files (cherry picked from commit 4fe75d11b2efdd3325ee8eaa4347626f1a950dbd) (cherry picked from commit a68e60f450b5be76d40627066b2c34a0e2360fab) --- pkgs/misc/uboot/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 4a96deadaea..807bc48a642 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -147,6 +147,11 @@ in rec { defconfig = "jetson-tk1_defconfig"; extraMeta.platforms = ["armv7l-linux"]; filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"]; + # tegra-uboot-flasher expects this exact directory layout, sigh... + postInstall = '' + mkdir -p $out/spl + cp spl/u-boot-spl $out/spl/ + ''; }; ubootOdroidXU3 = buildUBoot rec { From ba172467cc728e5345205c9f3d7fc992d4eed081 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Sat, 24 Mar 2018 16:07:50 +0200 Subject: [PATCH 9/9] U-Boot: Disable parallel build https://hydra.nixos.org/build/71880710 (cherry picked from commit 50dc85ed6283bb17684597cbf95f9405d5637fea) (cherry picked from commit 91b09422cf6f8e44d3d06274761053d9e21d6fa2) --- pkgs/misc/uboot/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 807bc48a642..4cf1748bad4 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -78,7 +78,9 @@ let runHook postInstall ''; - enableParallelBuilding = true; + # make[2]: *** No rule to make target 'lib/efi_loader/helloworld.efi', needed by '__build'. Stop. + enableParallelBuilding = false; + dontStrip = true; meta = with stdenv.lib; {