diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2018-02-20 20:33:17 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2018-02-20 20:33:40 +0100 |
commit | 1d15dadbec4f3d0a1f98e877e77518afe9245148 (patch) | |
tree | 76b034c0dbd376b7e588802a9946154499631258 /pkgs/os-specific/linux/kernel | |
parent | 43a88e3d8a68a008abea0bca0b17805aa4910764 (diff) | |
parent | b60ef32617383e78c32ca3d69754df5a5f550183 (diff) | |
download | nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.tar nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.tar.gz nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.tar.bz2 nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.tar.lz nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.tar.xz nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.tar.zst nixlib-1d15dadbec4f3d0a1f98e877e77518afe9245148.zip |
Merge branch 'master' into staging
Larger rebuilds from master.
Diffstat (limited to 'pkgs/os-specific/linux/kernel')
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-riscv.nix | 18 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/manual-config.nix | 10 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/patches.nix | 30 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/perf.nix | 13 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/riscv-initrd-free.patch | 21 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/riscv-initrd.patch | 48 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/riscv-install.patch | 65 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/riscv-irq-busy.patch | 42 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/riscv-modules.patch | 11 |
9 files changed, 248 insertions, 10 deletions
diff --git a/pkgs/os-specific/linux/kernel/linux-riscv.nix b/pkgs/os-specific/linux/kernel/linux-riscv.nix new file mode 100644 index 000000000000..b2eb0a69a8ec --- /dev/null +++ b/pkgs/os-specific/linux/kernel/linux-riscv.nix @@ -0,0 +1,18 @@ +{ stdenv, buildPackages, hostPlatform, fetchFromGitHub, perl, buildLinux, libelf, utillinux, ... } @ args: + +buildLinux (args // rec { + version = "4.16-rc1"; + modDirVersion = "4.16.0-rc1"; + extraMeta.branch = "4.16"; + + src = fetchFromGitHub { + owner = "riscv"; + repo ="riscv-linux"; + rev = "a31991a9c6ce2c86fd676cf458a0ec10edc20d37"; + sha256 = "0n97wfbi3pnp5c70xfj7s0fk8zjjkjz6ldxh7n54kbf64l4in01f"; + }; + + # Should the testing kernels ever be built on Hydra? + extraMeta.hydraPlatforms = []; + +} // (args.argsOverride or {})) diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index bd9334b8f9b7..60fb00645139 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -79,7 +79,8 @@ let isModular = config.isYes "MODULES"; installsFirmware = (config.isEnabled "FW_LOADER") && - (isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")); + (isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")) && + (stdenv.lib.versionOlder version "4.14"); in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // { passthru = { inherit version modDirVersion config kernelPatches configfile @@ -155,14 +156,13 @@ let if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall" else "install") ]; - postInstall = '' - mkdir -p $dev - cp vmlinux $dev/ - '' + (optionalString installsFirmware '' + postInstall = (optionalString installsFirmware '' mkdir -p $out/lib/firmware '') + (if (platform ? kernelDTB && platform.kernelDTB) then '' make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs '' else "") + (if isModular then '' + mkdir -p $dev + cp vmlinux $dev/ if [ -z "$dontStrip" ]; then installFlagsArray+=("INSTALL_MOD_STRIP=1") fi diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 754a2372c6d8..42e14ad7c40b 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -72,4 +72,34 @@ rec { sha256 = "09096npxpgvlwdz3pb3m9brvxh7vy0xc9z9p8hh85xyczyzcsjhr"; }; }; + + riscv_modules = { + name = "riscv-modules"; + patch = ./riscv-modules.patch; + }; + + # http://lists.infradead.org/pipermail/linux-riscv/2018-February/000054.html + riscv_irq_busy = { + name = "riscv-irq-busy"; + patch = ./riscv-irq-busy.patch; + }; + + # http://lists.infradead.org/pipermail/linux-riscv/2018-February/000059.html + riscv_install = { + name = "riscv-install"; + patch = ./riscv-install.patch; + }; + + # http://lists.infradead.org/pipermail/linux-riscv/2018-February/000056.html + riscv_initrd = { + name = "riscv-initrd"; + patch = ./riscv-initrd.patch; + }; + + # http://lists.infradead.org/pipermail/linux-riscv/2018-February/000058.html + riscv_initrd_free = { + name = "riscv-initrd-free"; + patch = ./riscv-initrd-free.patch; + }; + } diff --git a/pkgs/os-specific/linux/kernel/perf.nix b/pkgs/os-specific/linux/kernel/perf.nix index 1936f6578b6f..8090a7329aee 100644 --- a/pkgs/os-specific/linux/kernel/perf.nix +++ b/pkgs/os-specific/linux/kernel/perf.nix @@ -1,7 +1,8 @@ { lib, stdenv, kernel, elfutils, python, perl, newt, slang, asciidoc, xmlto, makeWrapper , docbook_xsl, docbook_xml_dtd_45, libxslt, flex, bison, pkgconfig, libunwind, binutils -, libiberty, libaudit, libbfd -, zlib, withGtk ? false, gtk2 ? null }: +, libiberty, libaudit, libbfd, openssl, systemtap, numactl +, zlib, withGtk ? false, gtk2 ? null +}: with lib; @@ -17,14 +18,16 @@ stdenv.mkDerivation { cd tools/perf sed -i s,/usr/include/elfutils,$elfutils/include/elfutils, Makefile [ -f bash_completion ] && sed -i 's,^have perf,_have perf,' bash_completion - export makeFlags="DESTDIR=$out $makeFlags" + export makeFlags="DESTDIR=$out WERROR=0 $makeFlags" + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DTIPDIR=\"$out/share/doc/perf-tip\"" ''; # perf refers both to newt and slang nativeBuildInputs = [ asciidoc xmlto docbook_xsl docbook_xml_dtd_45 libxslt flex bison libiberty libaudit makeWrapper pkgconfig python perl ]; - buildInputs = [ elfutils newt slang libunwind libbfd zlib ] ++ - stdenv.lib.optional withGtk gtk2; + buildInputs = + [ elfutils newt slang libunwind libbfd zlib openssl systemtap.stapBuild numactl + ] ++ stdenv.lib.optional withGtk gtk2; # Note: we don't add elfutils to buildInputs, since it provides a # bad `ld' and other stuff. diff --git a/pkgs/os-specific/linux/kernel/riscv-initrd-free.patch b/pkgs/os-specific/linux/kernel/riscv-initrd-free.patch new file mode 100644 index 000000000000..680448385246 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/riscv-initrd-free.patch @@ -0,0 +1,21 @@ +commit b1fbec8b74ace263ce1371e6bcfdd1dd71b52070 +Author: Shea Levy <shea@shealevy.com> +Date: Tue Feb 20 08:48:12 2018 -0500 + + riscv: Implement free_initrd_mem. + + v2: Remove incorrect page alignment. + + Signed-off-by: Shea Levy <shea@shealevy.com> + +diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c +index c77df8142be2..1b6daa5184e0 100644 +--- a/arch/riscv/mm/init.c ++++ b/arch/riscv/mm/init.c +@@ -66,5 +66,6 @@ void free_initmem(void) + #ifdef CONFIG_BLK_DEV_INITRD + void free_initrd_mem(unsigned long start, unsigned long end) + { ++ free_reserved_area((void *)start, (void *)end, -1, "initrd"); + } + #endif /* CONFIG_BLK_DEV_INITRD */ diff --git a/pkgs/os-specific/linux/kernel/riscv-initrd.patch b/pkgs/os-specific/linux/kernel/riscv-initrd.patch new file mode 100644 index 000000000000..2313e7645843 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/riscv-initrd.patch @@ -0,0 +1,48 @@ +commit 1e5f6473492f41355289d022003a049ebf8995fa +Author: Shea Levy <shea@shealevy.com> +Date: Tue Feb 20 07:52:14 2018 -0500 + + riscv: Respect the initrd found in the dt, if any. + + Signed-off-by: Shea Levy <shea@shealevy.com> + +diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c +index 41d34008faf6..c4ebc907af34 100644 +--- a/arch/riscv/kernel/setup.c ++++ b/arch/riscv/kernel/setup.c +@@ -88,15 +88,20 @@ static void __init setup_initrd(void) + extern unsigned long __initramfs_size; + unsigned long size; + ++ if (initrd_start) ++ goto found; ++ + if (__initramfs_size > 0) { + initrd_start = (unsigned long)(&__initramfs_start); + initrd_end = initrd_start + __initramfs_size; + } + ++ initrd_below_start_ok = 1; + if (initrd_start >= initrd_end) { + printk(KERN_INFO "initrd not found or empty"); + goto disable; + } ++found: + if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) { + printk(KERN_ERR "initrd extends beyond end of memory"); + goto disable; +@@ -104,13 +109,13 @@ static void __init setup_initrd(void) + + size = initrd_end - initrd_start; + memblock_reserve(__pa(initrd_start), size); +- initrd_below_start_ok = 1; + + printk(KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n", + (void *)(initrd_start), size); + return; + disable: + pr_cont(" - disabling initrd\n"); ++ initrd_below_start_ok = 0; + initrd_start = 0; + initrd_end = 0; + } diff --git a/pkgs/os-specific/linux/kernel/riscv-install.patch b/pkgs/os-specific/linux/kernel/riscv-install.patch new file mode 100644 index 000000000000..707230e9a336 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/riscv-install.patch @@ -0,0 +1,65 @@ +commit 365fc1312f4911bfae25c5914c398f9aca21948f +Author: Shea Levy <shea@shealevy.com> +Date: Mon Feb 19 10:50:58 2018 -0500 + + riscv: Add install target to Makefile. + + Signed-off-by: Shea Levy <shea@shealevy.com> + +diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile +index 6719dd30ec5b..26892daefa05 100644 +--- a/arch/riscv/Makefile ++++ b/arch/riscv/Makefile +@@ -70,3 +70,7 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/ + libs-y += arch/riscv/lib/ + + all: vmlinux ++ ++PHONY += install ++install: vmlinux ++ sh $(srctree)/arch/riscv/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" +diff --git a/arch/riscv/install.sh b/arch/riscv/install.sh +new file mode 100644 +index 000000000000..8b3155a11a4a +--- /dev/null ++++ b/arch/riscv/install.sh +@@ -0,0 +1,39 @@ ++#!/bin/sh ++# ++# arch/riscv/install.sh ++# ++# This file is subject to the terms and conditions of the GNU General Public ++# License. See the file "COPYING" in the main directory of this archive ++# for more details. ++# ++# Copyright (C) 1995 by Linus Torvalds ++# ++# Adapted from code in arch/ia64/Makefile by Shea Levy ++# ++# "make install" script for riscv architecture ++# ++# Arguments: ++# $1 - kernel version ++# $2 - kernel image file ++# $3 - kernel map file ++# $4 - default install path (blank if root directory) ++# ++ ++# User may have a custom install script ++ ++if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi ++if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi ++ ++# Default install - no bootloader configuration (yet?) ++base=$(basename $2) ++ ++if [ -f $4/$base ]; then ++ mv $4/$base $4/$base.old ++fi ++ ++if [ -f $4/System.map ]; then ++ mv $4/System.map $4/System.old ++fi ++ ++cat $2 > $4/$base ++cp $3 $4/System.map diff --git a/pkgs/os-specific/linux/kernel/riscv-irq-busy.patch b/pkgs/os-specific/linux/kernel/riscv-irq-busy.patch new file mode 100644 index 000000000000..5f5e8f0c8b7b --- /dev/null +++ b/pkgs/os-specific/linux/kernel/riscv-irq-busy.patch @@ -0,0 +1,42 @@ +commit 2603e6087b26e9428b806b267aee6bcb919abcea +Author: Shea Levy <shea@shealevy.com> +Date: Sun Feb 18 20:08:30 2018 -0500 + + set_handle_irq: Return EBUSY if the handler has already been registered. + + This is what's expected by the comments and at least by irq-riscv-intc.c + + Signed-off-by: Shea Levy <shea@shealevy.com> + +diff --git a/include/linux/irq.h b/include/linux/irq.h +index 2930fd2572e4..77e97872a13e 100644 +--- a/include/linux/irq.h ++++ b/include/linux/irq.h +@@ -1179,7 +1179,7 @@ int ipi_send_mask(unsigned int virq, const struct cpumask *dest); + * Returns 0 on success, or -EBUSY if an IRQ handler has already been + * registered. + */ +-void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)); ++int __init set_handle_irq(void (*handle_irq)(struct pt_regs *)); + + /* + * Allows interrupt handlers to find the irqchip that's been registered as the +diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c +index dee4f9a172ca..3570c715c3e7 100644 +--- a/kernel/irq/handle.c ++++ b/kernel/irq/handle.c +@@ -213,11 +213,12 @@ irqreturn_t handle_irq_event(struct irq_desc *desc) + } + + #ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER +-void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) ++int __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) + { + if (handle_arch_irq) +- return; ++ return -EBUSY; + + handle_arch_irq = handle_irq; ++ return 0; + } + #endif diff --git a/pkgs/os-specific/linux/kernel/riscv-modules.patch b/pkgs/os-specific/linux/kernel/riscv-modules.patch new file mode 100644 index 000000000000..6d5356e0e46f --- /dev/null +++ b/pkgs/os-specific/linux/kernel/riscv-modules.patch @@ -0,0 +1,11 @@ +diff -Naur linux-4.15.4-orig/arch/riscv/configs/defconfig linux-4.15.4/arch/riscv/configs/defconfig +--- linux-4.15.4-orig/arch/riscv/configs/defconfig 2018-02-16 14:07:01.000000000 -0500 ++++ linux-4.15.4/arch/riscv/configs/defconfig 2018-02-18 18:33:09.488431900 -0500 +@@ -12,6 +12,7 @@ + CONFIG_NAMESPACES=y + CONFIG_USER_NS=y + CONFIG_BLK_DEV_INITRD=y ++CONFIG_MODULES=y + CONFIG_EXPERT=y + CONFIG_CHECKPOINT_RESTORE=y + CONFIG_BPF_SYSCALL=y |