Merge branch 'plat-fix-for-merge-2' into master

This commit is contained in:
Tuomas Tynkkynen 2018-06-01 20:08:08 +03:00
commit e864247f08
7 changed files with 64 additions and 180 deletions

View File

@ -167,171 +167,24 @@ rec {
raspberrypi = {
name = "raspberrypi";
kernelMajor = "2.6";
kernelBaseConfig = "bcmrpi_defconfig";
kernelBaseConfig = "bcm2835_defconfig";
kernelDTB = true;
kernelArch = "arm";
kernelAutoModules = false;
kernelExtraConfig = ''
BLK_DEV_RAM y
BLK_DEV_INITRD y
BLK_DEV_CRYPTOLOOP m
BLK_DEV_DM m
DM_CRYPT m
MD y
REISERFS_FS m
BTRFS_FS y
XFS_FS m
JFS_FS y
EXT4_FS y
IP_PNP y
IP_PNP_DHCP y
NFS_FS y
ROOT_NFS y
TUN m
NFS_V4 y
NFS_V4_1 y
NFS_FSCACHE y
NFSD m
NFSD_V2_ACL y
NFSD_V3 y
NFSD_V3_ACL y
NFSD_V4 y
NETFILTER y
IP_NF_IPTABLES y
IP_NF_FILTER y
IP_NF_MATCH_ADDRTYPE y
IP_NF_TARGET_LOG y
IP_NF_MANGLE y
IPV6 m
VLAN_8021Q m
CIFS y
CIFS_XATTR y
CIFS_POSIX y
CIFS_FSCACHE y
CIFS_ACL y
ZRAM m
# Disable OABI to have seccomp_filter (required for systemd)
# https://github.com/raspberrypi/firmware/issues/651
OABI_COMPAT n
# Fail to build
DRM n
SCSI_ADVANSYS n
USB_ISP1362_HCD n
SND_SOC n
SND_ALI5451 n
FB_SAVAGE n
SCSI_NSP32 n
ATA_SFF n
SUNGEM n
IRDA n
ATM_HE n
SCSI_ACARD n
BLK_DEV_CMD640_ENHANCED n
FUSE_FS m
# nixos mounts some cgroup
CGROUPS y
# Latencytop
LATENCYTOP y
'';
kernelTarget = "zImage";
gcc = {
arch = "armv6";
fpu = "vfp";
# TODO(@Ericson2314) what is this and is it a good idea? It was
# used in some cross compilation examples but not others.
#
# abi = "aapcs-linux";
};
};
raspberrypi2 = armv7l-hf-multiplatform // {
name = "raspberrypi2";
kernelBaseConfig = "bcm2709_defconfig";
kernelDTB = true;
kernelAutoModules = false;
kernelExtraConfig = ''
BLK_DEV_RAM y
BLK_DEV_INITRD y
BLK_DEV_CRYPTOLOOP m
BLK_DEV_DM m
DM_CRYPT m
MD y
REISERFS_FS m
BTRFS_FS y
XFS_FS m
JFS_FS y
EXT4_FS y
IP_PNP y
IP_PNP_DHCP y
NFS_FS y
ROOT_NFS y
TUN m
NFS_V4 y
NFS_V4_1 y
NFS_FSCACHE y
NFSD m
NFSD_V2_ACL y
NFSD_V3 y
NFSD_V3_ACL y
NFSD_V4 y
NETFILTER y
IP_NF_IPTABLES y
IP_NF_FILTER y
IP_NF_MATCH_ADDRTYPE y
IP_NF_TARGET_LOG y
IP_NF_MANGLE y
IPV6 m
VLAN_8021Q m
CIFS y
CIFS_XATTR y
CIFS_POSIX y
CIFS_FSCACHE y
CIFS_ACL y
ZRAM m
# Disable OABI to have seccomp_filter (required for systemd)
# https://github.com/raspberrypi/firmware/issues/651
OABI_COMPAT n
# Fail to build
DRM n
SCSI_ADVANSYS n
USB_ISP1362_HCD n
SND_SOC n
SND_ALI5451 n
FB_SAVAGE n
SCSI_NSP32 n
ATA_SFF n
SUNGEM n
IRDA n
ATM_HE n
SCSI_ACARD n
BLK_DEV_CMD640_ENHANCED n
FUSE_FS m
# nixos mounts some cgroup
CGROUPS y
# Latencytop
LATENCYTOP y
# Disable the common config Xen, it doesn't build on ARM
XEN? n
'';
kernelTarget = "zImage";
};
# Legacy attribute, for compatibility with existing configs only.
raspberrypi2 = armv7l-hf-multiplatform;
scaleway-c1 = armv7l-hf-multiplatform // {
gcc = {
@ -424,6 +277,10 @@ rec {
# Hangs ODROID-XU4
ARM_BIG_LITTLE_CPUIDLE n
# Disable OABI to have seccomp_filter (required for systemd)
# https://github.com/raspberrypi/firmware/issues/651
OABI_COMPAT n
'';
gcc = {
# Some table about fpu flags:

View File

@ -31,11 +31,24 @@ in
users.extraUsers.root.initialHashedPassword = "";
sdImage = {
populateBootCommands = ''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/boot/)
cp ${pkgs.ubootRaspberryPi}/u-boot.bin boot/u-boot-rpi.bin
echo 'kernel u-boot-rpi.bin' > boot/config.txt
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
'';
populateBootCommands = let
configTxt = pkgs.writeText "config.txt" ''
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
[pi0]
kernel=u-boot-rpi0.bin
[pi1]
kernel=u-boot-rpi1.bin
'';
in ''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/boot/)
cp ${pkgs.ubootRaspberryPiZero}/u-boot.bin boot/u-boot-rpi0.bin
cp ${pkgs.ubootRaspberryPi}/u-boot.bin boot/u-boot-rpi1.bin
cp ${configTxt} boot/config.txt
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
'';
};
}

View File

@ -7,8 +7,8 @@ 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";
url = "https://github.com/u-boot/u-boot/compare/v2018.05...dezgeg:2018-05-sunxi.patch";
sha256 = "1dfv4s1f71iv80vjxgyghv4pcwjv4mjphk75a8hfl3jdbpd66d36";
};
buildUBoot = { filesToInstall
@ -21,21 +21,21 @@ let
stdenv.mkDerivation (rec {
name = "uboot-${defconfig}-${version}";
version = "2018.03";
version = "2018.05";
src = fetchurl {
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
sha256 = "1z9x635l5164c5hnf7qs19w7j3qghbkgs7rpn673dm898i9pfx3y";
sha256 = "0j60p4iskzb4hamxgykc6gd7xchxfka1zwh8hv08r9rrc4m3r8ad";
};
patches = [
(fetchpatch {
url = https://github.com/dezgeg/u-boot/commit/rpi-2017-11-patch1.patch;
sha256 = "067yq55vv1slv4xy346px7h329pi14abdn04chg6s1s6hmf6c1x9";
url = https://github.com/dezgeg/u-boot/commit/rpi-2018-05-patch1.patch;
sha256 = "0xvw16mp6mm36987rd5yb8bw0n5b3p1gq35wch2gbj15wx55450p";
})
(fetchpatch {
url = https://github.com/dezgeg/u-boot/commit/rpi-2017-11-patch2.patch;
sha256 = "0bbw0q027xvzvdxxvpzjajg4rm30a8mb7z74b6ma9q0l7y7bi0c4";
url = https://github.com/dezgeg/u-boot/commit/rpi-2018-05-patch2.patch;
sha256 = "0q1a5l5rfgddncxrjk59qr1f5587dwbvcf6z15bsfl2invs19m2b";
})
(fetchpatch {
url = https://github.com/dezgeg/u-boot/commit/pythonpath-2018-03.patch;
@ -100,8 +100,7 @@ in rec {
hardeningDisable = [];
dontStrip = false;
extraMeta.platforms = stdenv.lib.platforms.linux;
# build tools/kwboot
extraMakeFlags = [ "CONFIG_KIRKWOOD=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "tools" ];
extraMakeFlags = [ "HOST_TOOLS_ALL=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "tools" ];
postConfigure = ''
sed -i '/CONFIG_SYS_TEXT_BASE/c\CONFIG_SYS_TEXT_BASE=0x00000000' .config
'';
@ -218,6 +217,12 @@ in rec {
filesToInstall = ["u-boot.bin"];
};
ubootRaspberryPiZero = buildUBoot rec {
defconfig = "rpi_0_w_defconfig";
extraMeta.platforms = ["armv6l-linux"];
filesToInstall = ["u-boot.bin"];
};
ubootSheevaplug = buildUBoot rec {
defconfig = "sheevaplug_defconfig";
extraMeta.platforms = ["armv5tel-linux"];

View File

@ -2,13 +2,13 @@
stdenv.mkDerivation rec {
name = "raspberrypi-firmware-${version}";
version = "1.20180328";
version = "1.20180417";
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "firmware";
rev = version;
sha256 = "19h4lv11idy268pyrq21c5gsff77d5xr9xjkpmzfpcq34gjh3x21";
sha256 = "17mnnhni0wgdnc3mw60nfhcj9v6p5dwcqkwnbpvzczab3r2hziji";
};
installPhase = ''

View File

@ -12,6 +12,9 @@
, # The kernel version.
version
, # Allows overriding the default defconfig
defconfig ? null
, # Overrides to the kernel config.
extraConfig ? ""
@ -85,7 +88,7 @@ let
platformName = hostPlatform.platform.name;
# e.g. "defconfig"
kernelBaseConfig = hostPlatform.platform.kernelBaseConfig;
kernelBaseConfig = if defconfig != null then defconfig else hostPlatform.platform.kernelBaseConfig;
# e.g. "bzImage"
kernelTarget = hostPlatform.platform.kernelTarget;

View File

@ -1,8 +1,8 @@
{ stdenv, buildPackages, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args:
let
modDirVersion = "4.9.59";
tag = "1.20171029";
modDirVersion = "4.14.34";
tag = "1.20180417";
in
stdenv.lib.overrideDerivation (buildLinux (args // rec {
version = "${modDirVersion}-${tag}";
@ -12,9 +12,14 @@ stdenv.lib.overrideDerivation (buildLinux (args // rec {
owner = "raspberrypi";
repo = "linux";
rev = "raspberrypi-kernel_${tag}-1";
sha256 = "19lb1gxz21x1d5zdznzqfq60kxg7iqmyl6l0mb9qg2vrl8fcgnxk";
sha256 = "1xgisvmcq50lpnd4rpqhaw52399n0rx2n8mp6k0bf8qm1g3vnza2";
};
defconfig = {
"armv6l-linux" = "bcmrpi_defconfig";
"armv7l-linux" = "bcm2709_defconfig";
}.${stdenv.system} or (throw "linux_rpi not supported on '${stdenv.system}'");
features = {
efiBootStub = false;
} // (args.features or {});
@ -27,16 +32,15 @@ stdenv.lib.overrideDerivation (buildLinux (args // rec {
'';
postFixup = ''
# Make copies of the DTBs so that U-Boot finds them, as it is looking for the upstream names.
# This is ugly as heck.
# Make copies of the DTBs named after the upstream names so that U-Boot finds them.
# This is ugly as heck, but I don't know a better solution so far.
rm $out/dtbs/bcm283*.dtb
copyDTB() {
if [ -f "$out/dtbs/$1" ]; then
cp -v "$out/dtbs/$1" "$out/dtbs/$2"
fi
cp -v "$out/dtbs/$1" "$out/dtbs/$2"
}
# I am not sure if all of these are correct...
copyDTB bcm2708-rpi-0-w.dts bcm2835-rpi-zero.dtb
copyDTB bcm2708-rpi-0-w.dtb bcm2835-rpi-zero.dtb
copyDTB bcm2708-rpi-0-w.dtb bcm2835-rpi-zero-w.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
@ -46,6 +50,7 @@ stdenv.lib.overrideDerivation (buildLinux (args // rec {
copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
# bcm2710-rpi-cm3.dts is yet unknown.
copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
'';
})

View File

@ -14139,6 +14139,7 @@ with pkgs;
ubootRaspberryPi2
ubootRaspberryPi3_32bit
ubootRaspberryPi3_64bit
ubootRaspberryPiZero
ubootSheevaplug
ubootSopine
ubootUtilite