Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dezgeg committed Jan 27, 2017
2 parents 972749f + 2f367e0 commit be0e48e
Show file tree
Hide file tree
Showing 35 changed files with 330 additions and 45 deletions.
2 changes: 1 addition & 1 deletion lib/platforms.nix
Expand Up @@ -15,7 +15,7 @@ rec {
freebsd = ["i686-freebsd" "x86_64-freebsd"];
gnu = linux; /* ++ hurd ++ kfreebsd ++ ... */
illumos = ["x86_64-solaris"];
linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "mips64el-linux"];
linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mips64el-linux"];
netbsd = ["i686-netbsd" "x86_64-netbsd"];
openbsd = ["i686-openbsd" "x86_64-openbsd"];
unix = linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/config/pulseaudio.nix
Expand Up @@ -108,7 +108,7 @@ in {
type = types.bool;
default = false;
description = ''
Whether to include the 32-bit pulseaudio libraries in the systemn or not.
Whether to include the 32-bit pulseaudio libraries in the system or not.
This is only useful on 64-bit systems and currently limited to x86_64-linux.
'';
};
Expand Down
63 changes: 63 additions & 0 deletions nixos/modules/installer/cd-dvd/sd-image-aarch64.nix
@@ -0,0 +1,63 @@
# To build, use:
# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-aarch64.nix -A config.system.build.sdImage
{ config, lib, pkgs, ... }:

let
extlinux-conf-builder =
import ../../system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix {
inherit pkgs;
};
in
{
imports = [
../../profiles/minimal.nix
../../profiles/installation-device.nix
./sd-image.nix
];

assertions = lib.singleton {
assertion = pkgs.stdenv.system == "aarch64-linux";
message = "sd-image-aarch64.nix can be only built natively on Aarch64 / ARM64; " +
"it cannot be cross compiled";
};

# Needed by RPi firmware
nixpkgs.config.allowUnfree = true;

boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;

boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = ["console=ttyS0,115200n8" "console=tty0"];
boot.consoleLogLevel = 7;

# FIXME: this probably should be in installation-device.nix
users.extraUsers.root.initialHashedPassword = "";

sdImage = {
populateBootCommands = let
# Contains a couple of fixes for booting a Linux kernel, will hopefully appear upstream soon.
patchedUboot = pkgs.ubootRaspberryPi3_64bit.overrideAttrs (oldAttrs: {
src = pkgs.fetchFromGitHub {
owner = "dezgeg";
repo = "u-boot";
rev = "baab53ec244fe44def01948a0f10e67342d401e6";
sha256 = "0r5j2pc42ws3w3im0a9c6bh01czz5kapqrqp0ik9ra823cw73lxr";
};
});

configTxt = pkgs.writeText "config.txt" ''
kernel=u-boot-rpi3.bin
arm_control=0x200
enable_uart=1
'';
in ''
for f in bootcode.bin fixup.dat start.elf; do
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/
done
cp ${patchedUboot}/u-boot.bin boot/u-boot-rpi3.bin
cp ${configTxt} boot/config.txt
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
'';
};
}
@@ -1,3 +1,5 @@
# To build, use:
# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix -A config.system.build.sdImage
{ config, lib, pkgs, ... }:

let
Expand Down Expand Up @@ -46,7 +48,7 @@ in
cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/
done
cp ${pkgs.ubootRaspberryPi2}/u-boot.bin boot/u-boot-rpi2.bin
cp ${pkgs.ubootRaspberryPi3}/u-boot.bin boot/u-boot-rpi3.bin
cp ${pkgs.ubootRaspberryPi3_32bit}/u-boot.bin boot/u-boot-rpi3.bin
cp ${configTxt} boot/config.txt
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
'';
Expand Down
2 changes: 2 additions & 0 deletions nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix
@@ -1,3 +1,5 @@
# To build, use:
# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix -A config.system.build.sdImage
{ config, lib, pkgs, ... }:

let
Expand Down
Expand Up @@ -7,12 +7,12 @@
stdenv.mkDerivation rec {

pname = "discord";
version = "0.0.13";
version = "0.0.1";
name = "${pname}-${version}";

src = fetchurl {
url = "https://cdn-canary.discordapp.com/apps/linux/${version}/${pname}-canary-${version}.tar.gz";
sha256 = "1pwb8y80z1bmfln5wd1vrhras0xygd1j15sib0g9vaig4mc55cs6";
url = "https://cdn.discordapp.com/apps/linux/${version}/${pname}-${version}.tar.gz";
sha256 = "10m3ixvhmxdw55awd84gx13m222qjykj7gcigbjabcvsgp2z63xs";
};

libPath = stdenv.lib.makeLibraryPath [
Expand All @@ -30,11 +30,11 @@ stdenv.mkDerivation rec {
# see pkgs/applications/misc/adobe-reader/builder.sh
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$out:$libPath" \
$out/DiscordCanary
$out/Discord
paxmark m $out/DiscordCanary
paxmark m $out/Discord
ln -s $out/DiscordCanary $out/bin/
ln -s $out/Discord $out/bin/
ln -s $out/discord.png $out/share/pixmaps
# Putting udev in the path won't work :(
Expand All @@ -44,9 +44,9 @@ stdenv.mkDerivation rec {

desktopItem = makeDesktopItem {
name = pname;
exec = "DiscordCanary";
exec = "Discord";
icon = pname;
desktopName = "Discord Canary";
desktopName = "Discord";
genericName = meta.description;
categories = "Network;InstantMessaging;";
};
Expand Down
1 change: 1 addition & 0 deletions pkgs/build-support/cc-wrapper/default.nix
Expand Up @@ -272,6 +272,7 @@ stdenv.mkDerivation {
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
# ARM with a wildcard, which can be "" or "-armhf".
if stdenv.isArm then "ld-linux*.so.3" else
if stdenv.system == "aarch64-linux" then "ld-linux-aarch64.so.1" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
if stdenv.system == "mips64el-linux" then "ld.so.1" else
if stdenv.system == "x86_64-darwin" then "/usr/lib/dyld" else
Expand Down
@@ -0,0 +1,12 @@
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"

updateAutotoolsGnuConfigScriptsPhase() {
if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi

for script in config.sub config.guess; do
for f in $(find . -name "$script"); do
echo "Updating Autotools / GNU config script to a newer upstream version: $f"
cp -f "@gnu_config@/$script" "$f"
done
done
}
2 changes: 2 additions & 0 deletions pkgs/development/interpreters/spidermonkey/17.nix
Expand Up @@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
postPatch = ''
# Fixes an issue with version detection under perl 5.22.x
sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
'' + stdenv.lib.optionalString stdenv.isAarch64 ''
patch -p1 -d ../.. < ${./aarch64-double-conversion.patch}
'';

preConfigure = ''
Expand Down
@@ -0,0 +1,13 @@
diff -ru mozjs17.0.0-orig/mfbt/double-conversion/utils.h mozjs17.0.0/mfbt/double-conversion/utils.h
--- mozjs17.0.0-orig/mfbt/double-conversion/utils.h 2013-02-11 17:33:28.000000000 -0500
+++ mozjs17.0.0/mfbt/double-conversion/utils.h 2016-12-03 20:39:07.915042988 -0500
@@ -58,7 +58,8 @@
defined(__mips__) || defined(__powerpc__) || \
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
- defined(_MIPS_ARCH_MIPS32R2)
+ defined(_MIPS_ARCH_MIPS32R2) || \
+ defined(__AARCH64EL__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
#if defined(_WIN32)
2 changes: 1 addition & 1 deletion pkgs/development/libraries/glibc/common.nix
Expand Up @@ -93,7 +93,7 @@ stdenv.mkDerivation ({
"--enable-kernel=2.6.32"
] ++ lib.optionals (cross != null) [
(if cross.withTLS then "--with-tls" else "--without-tls")
(if cross.float == "soft" then "--without-fp" else "--with-fp")
(if cross ? float && cross.float == "soft" then "--without-fp" else "--with-fp")
] ++ lib.optionals (cross != null
&& cross.platform ? kernelMajor
&& cross.platform.kernelMajor == "2.6") [
Expand Down
39 changes: 39 additions & 0 deletions pkgs/development/libraries/gnu-config/default.nix
@@ -0,0 +1,39 @@
{ stdenv, fetchurl }:

let
rev = "6a82322dd05cdc57b4cd9f7effdf1e2fd6f7482b";

# Don't use fetchgit as this is needed during Aarch64 bootstrapping
configGuess = fetchurl {
url = "http://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=${rev}";
sha256 = "1yj9yi94h7z4z6jzickddv64ksz1aq5kj0c7krgzjn8xf8p3avmh";
};
configSub = fetchurl {
url = "http://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=${rev}";
sha256 = "1qsqdpla6icbzskkk7v3zxrpzlpqlc94ny9hyy5wh5lm5rwwfvb7";
};
in
stdenv.mkDerivation rec {
name = "gnu-config-${version}";
version = "2016-12-31";

buildCommand = ''
mkdir -p $out
cp ${configGuess} $out/config.guess
cp ${configSub} $out/config.sub
'';

meta = with stdenv.lib; {
description = "Attempt to guess a canonical system name";
homepage = http://savannah.gnu.org/projects/config;
license = licenses.gpl3;
# In addition to GPLv3:
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program.
maintainers = [ maintainers.dezgeg ];
platforms = platforms.all;
};
}
@@ -0,0 +1,13 @@
diff -ru gnu-efi-3.0.4-orig/lib/aarch64/initplat.c gnu-efi-3.0.4/lib/aarch64/initplat.c
--- gnu-efi-3.0.4-orig/lib/aarch64/initplat.c 2016-03-17 09:53:14.000000000 -0400
+++ gnu-efi-3.0.4/lib/aarch64/initplat.c 2016-12-03 17:53:57.166575974 -0500
@@ -41,7 +41,8 @@

void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n)
{
- unsigned char *p = dest, *q = src;
+ unsigned char *p = dest;
+ const unsigned char *q = src;

while (n--)
*p++ = *q++;
4 changes: 3 additions & 1 deletion pkgs/development/libraries/gnu-efi/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, pciutils }:
{ stdenv, fetchurl, pciutils }: with stdenv.lib;

stdenv.mkDerivation rec {
name = "gnu-efi-${version}";
Expand All @@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "1bzq5czw5dxlvpgs9ij2iz7q6krwhja87vc982r6vffcqcl0982i";
};

patches = optional stdenv.isAarch64 ./aarch64-fix-discarded-qualifier.patch;

buildInputs = [ pciutils ];

hardeningDisable = [ "stackprotector" ];
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/libraries/libsigsegv/aarch64.patch
@@ -0,0 +1,12 @@
diff --git a/configure b/configure
index 6c4e868..0298e19 100755
--- a/configure
+++ b/configure
@@ -14501,6 +14501,7 @@ else

case "$host_cpu" in
a29k | \
+ aarch64* | \
alpha* | \
arc | \
arm* | strongarm* | xscale* | \
6 changes: 6 additions & 0 deletions pkgs/development/libraries/libsigsegv/default.nix
Expand Up @@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
sha256 = "16hrs8k3nmc7a8jam5j1fpspd6sdpkamskvsdpcw6m29vnis8q44";
};

# Based on https://github.com/davidgfnet/buildroot-Os/blob/69fe6065b9dd1cb4dcc0a4b554e42cc2e5bd0d60/package/libsigsegv/libsigsegv-0002-fix-aarch64-build.patch
# but applied directly to configure since we can't use autoreconf while bootstrapping.
patches = if stdenv.isAarch64 || stdenv.cross.arch or "" == "aarch64"
then [ ./aarch64.patch ]
else null; # TODO: change to lib.optional on next mass rebuild

# https://github.com/NixOS/nixpkgs/issues/6028
doCheck = false;

Expand Down
9 changes: 7 additions & 2 deletions pkgs/development/libraries/libunwind/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, xz }:
{ stdenv, fetchurl, fetchpatch, autoreconfHook, xz }:

stdenv.mkDerivation rec {
name = "libunwind-1.1";
Expand All @@ -8,13 +8,18 @@ stdenv.mkDerivation rec {
sha256 = "16nhx2pahh9d62mvszc88q226q5lwjankij276fxwrm8wb50zzlx";
};

buildInputs = stdenv.lib.optional stdenv.isAarch64 autoreconfHook;

patches = [ ./libunwind-1.1-lzma.patch ./cve-2015-3239.patch
# https://lists.nongnu.org/archive/html/libunwind-devel/2014-04/msg00000.html
(fetchpatch {
url = "https://raw.githubusercontent.com/dropbox/pyston/1b2e676417b0f5f17526ece0ed840aa88c744145/libunwind_patches/0001-Change-the-RBP-validation-heuristic-to-allow-size-0-.patch";
sha256 = "1a0fsgfxmgd218nscswx7pgyb7rcn2gh6566252xhfvzhgn5i4ha";
})
];
] ++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
url = "https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/77709d1c6d5c39e23c1535b1bd584be1455f2551/extra/libunwind/libunwind-aarch64.patch";
sha256 = "1mpjs8izq9wxiaf5rl4gzaxrkz0s51f9qz5qc5dj72pr84mw50w8";
});

postPatch = ''
sed -i -e '/LIBLZMA/s:-lzma:-llzma:' configure
Expand Down
11 changes: 8 additions & 3 deletions pkgs/development/libraries/liburcu/default.nix
@@ -1,14 +1,19 @@
{ stdenv, fetchurl }:
{ stdenv, fetchurl, perl }:

stdenv.mkDerivation rec {
version = "0.8.6";
version = "0.9.3";
name = "liburcu-${version}";

src = fetchurl {
url = "http://lttng.org/files/urcu/userspace-rcu-${version}.tar.bz2";
sha256 = "08dbfkdj4pm9s3q56nwa1vzldkf1jav61g2r4xq7mfhlw2yd79di";
sha256 = "01j0xp3f0w147yfyzybkjvb7i67i7prsvnkssgvgwry9lvk35khv";
};

nativeBuildInputs = stdenv.lib.optional doCheck perl;

preCheck = "patchShebangs tests/unit";
doCheck = true;

meta = with stdenv.lib; {
description = "Userspace RCU (read-copy-update) library";
homepage = http://lttng.org/urcu;
Expand Down
8 changes: 7 additions & 1 deletion pkgs/misc/uboot/default.nix
Expand Up @@ -100,12 +100,18 @@ in rec {
filesToInstall = ["u-boot.bin"];
};

ubootRaspberryPi3 = buildUBoot rec {
ubootRaspberryPi3_32bit = buildUBoot rec {
defconfig = "rpi_3_32b_defconfig";
targetPlatforms = ["armv7l-linux"];
filesToInstall = ["u-boot.bin"];
};

ubootRaspberryPi3_64bit = buildUBoot rec {
defconfig = "rpi_3_defconfig";
targetPlatforms = ["aarch64-linux"];
filesToInstall = ["u-boot.bin"];
};

ubootWandboard = buildUBoot rec {
defconfig = "wandboard_defconfig";
targetPlatforms = ["armv7l-linux"];
Expand Down
9 changes: 9 additions & 0 deletions pkgs/os-specific/linux/busybox/busybox-in-store.patch
Expand Up @@ -12,3 +12,12 @@ stdenv bootstrap.
exit(busybox_main(argv));
# endif
# if NUM_APPLETS > 0
@@ -981,7 +981,7 @@ int main(int argc UNUSED_PARAM, char **argv)

lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
# if !ENABLE_BUSYBOX
- if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox"))
+ if (argv[1] && strstr(bb_basename(argv[0]), "busybox") != 0)
argv++;
# endif
applet_name = argv[0];
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/firmware/raspberrypi/default.nix
Expand Up @@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
description = "Firmware for the Raspberry Pi board";
homepage = https://github.com/raspberrypi;
license = licenses.unfree;
platforms = [ "armv6l-linux" "armv7l-linux" ];
platforms = [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
maintainers = with maintainers; [ viric tavyc ];
};
}

0 comments on commit be0e48e

Please sign in to comment.