mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 07:01:54 +00:00
Merge pull request #12742 from dezgeg/pr-uboot-changes
U-Boot: 2015.10 -> 2016.01, refactor & support some new boards
This commit is contained in:
commit
eb9a85a389
@ -23,7 +23,7 @@ in
|
||||
boot.loader.generic-extlinux-compatible.enable = true;
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
boot.kernelParams = ["console=ttyS0,115200n8" "console=ttyAMA0,115200n8" "console=tty0"];
|
||||
boot.kernelParams = ["console=ttyS0,115200n8" "console=ttymxc0,115200n8" "console=ttyAMA0,115200n8" "console=tty0"];
|
||||
|
||||
# FIXME: this probably should be in installation-device.nix
|
||||
users.extraUsers.root.initialHashedPassword = "";
|
||||
|
@ -30,7 +30,7 @@ in
|
||||
|
||||
bootSize = mkOption {
|
||||
type = types.int;
|
||||
default = 128;
|
||||
default = 120;
|
||||
description = ''
|
||||
Size of the /boot partition, in megabytes.
|
||||
'';
|
||||
@ -66,10 +66,10 @@ in
|
||||
buildInputs = with pkgs; [ dosfstools e2fsprogs mtools libfaketime utillinux ];
|
||||
|
||||
buildCommand = ''
|
||||
# Create the image file sized to fit /boot and /, plus 4M of slack
|
||||
# Create the image file sized to fit /boot and /, plus 20M of slack
|
||||
rootSizeBlocks=$(du -B 512 --apparent-size ${rootfsImage} | awk '{ print $1 }')
|
||||
bootSizeBlocks=$((${toString config.sdImage.bootSize} * 1024 * 1024 / 512))
|
||||
imageSize=$((rootSizeBlocks * 512 + bootSizeBlocks * 512 + 4096 * 1024))
|
||||
imageSize=$((rootSizeBlocks * 512 + bootSizeBlocks * 512 + 20 * 1024 * 1024))
|
||||
truncate -s $imageSize $out
|
||||
|
||||
# type=b is 'W95 FAT32', type=83 is 'Linux'.
|
||||
@ -77,8 +77,8 @@ in
|
||||
label: dos
|
||||
label-id: 0x2178694e
|
||||
|
||||
start=1M, size=$bootSizeBlocks, type=b, bootable
|
||||
type=83
|
||||
start=8M, size=$bootSizeBlocks, type=b, bootable
|
||||
start=${toString (8 + config.sdImage.bootSize)}M, type=83
|
||||
EOF
|
||||
|
||||
# Copy the rootfs into the SD image
|
||||
|
@ -1,62 +1,101 @@
|
||||
{ stdenv, fetchurl, bc, dtc
|
||||
, toolsOnly ? false
|
||||
, defconfig ? "allnoconfig"
|
||||
, targetPlatforms
|
||||
, filesToInstall
|
||||
}:
|
||||
{ stdenv, fetchurl, bc, dtc }:
|
||||
|
||||
let
|
||||
platform = stdenv.platform;
|
||||
crossPlatform = stdenv.cross.platform;
|
||||
makeTarget = if toolsOnly then "tools NO_SDL=1" else "all";
|
||||
installDir = if toolsOnly then "$out/bin" else "$out";
|
||||
buildFun = kernelArch:
|
||||
''
|
||||
if test -z "$crossConfig"; then
|
||||
make ${makeTarget}
|
||||
else
|
||||
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
||||
fi
|
||||
buildUBoot = { targetPlatforms
|
||||
, filesToInstall
|
||||
, installDir ? "$out"
|
||||
, defconfig
|
||||
, extraMeta ? {}
|
||||
, ... } @ args:
|
||||
stdenv.mkDerivation (rec {
|
||||
|
||||
name = "uboot-${defconfig}-${version}";
|
||||
version = "2016.01";
|
||||
|
||||
nativeBuildInputs = [ bc dtc ];
|
||||
|
||||
src = fetchurl {
|
||||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
||||
sha256 = "1md5jpq5n9jh08s7sdkjrvg2q7kpzwa7yrpgl9581ncrjfx2yyg5";
|
||||
};
|
||||
|
||||
configurePhase = ''
|
||||
make ${defconfig}
|
||||
'';
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "uboot-${defconfig}-${version}";
|
||||
version = "2015.10";
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
src = fetchurl {
|
||||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
||||
sha256 = "0m8r08izci0lzzjn5c5g5manp2rc7yc5swww0lxr7bamjigqvimx";
|
||||
mkdir -p ${installDir}
|
||||
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
|
||||
crossAttrs = {
|
||||
makeFlags = [
|
||||
"ARCH=${stdenv.cross.platform.kernelArch}"
|
||||
"CROSS_COMPILE=${stdenv.cross.config}-"
|
||||
];
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
in rec {
|
||||
inherit buildUBoot;
|
||||
|
||||
ubootTools = buildUBoot rec {
|
||||
installDir = "$out/bin";
|
||||
buildFlags = "tools NO_SDL=1";
|
||||
dontStrip = false;
|
||||
targetPlatforms = stdenv.lib.platforms.linux;
|
||||
filesToInstall = ["tools/dumpimage" "tools/mkenvimage" "tools/mkimage"];
|
||||
};
|
||||
|
||||
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
||||
|
||||
nativeBuildInputs = [ bc dtc ];
|
||||
|
||||
configurePhase = ''
|
||||
make ${defconfig}
|
||||
'';
|
||||
|
||||
buildPhase = assert (platform ? kernelArch);
|
||||
buildFun platform.kernelArch;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p ${installDir}
|
||||
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
||||
'';
|
||||
|
||||
dontStrip = !toolsOnly;
|
||||
|
||||
crossAttrs = {
|
||||
buildPhase = assert (crossPlatform ? kernelArch);
|
||||
buildFun crossPlatform.kernelArch;
|
||||
ubootBananaPi = buildUBoot rec {
|
||||
defconfig = "Bananapi_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
|
||||
};
|
||||
|
||||
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;
|
||||
ubootJetsonTK1 = buildUBoot rec {
|
||||
defconfig = "jetson-tk1_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"];
|
||||
};
|
||||
|
||||
ubootPcduino3Nano = buildUBoot rec {
|
||||
defconfig = "Linksprite_pcDuino3_Nano_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
|
||||
};
|
||||
|
||||
ubootRaspberryPi = buildUBoot rec {
|
||||
defconfig = "rpi_defconfig";
|
||||
targetPlatforms = ["armv6l-linux"];
|
||||
filesToInstall = ["u-boot.bin"];
|
||||
};
|
||||
|
||||
# Intended only for QEMU's vexpress-a9 emulation target!
|
||||
ubootVersatileExpressCA9 = buildUBoot rec {
|
||||
defconfig = "vexpress_ca9x4_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot"];
|
||||
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
||||
};
|
||||
|
||||
ubootWandboard = buildUBoot rec {
|
||||
defconfig = "wandboard_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot.img" "SPL"];
|
||||
};
|
||||
}
|
||||
|
@ -10726,36 +10726,15 @@ let
|
||||
ubootChooser = name: ubootTools;
|
||||
|
||||
# Upstream U-Boots:
|
||||
ubootTools = callPackage ../misc/uboot {
|
||||
toolsOnly = true;
|
||||
targetPlatforms = lib.platforms.linux;
|
||||
filesToInstall = ["tools/dumpimage" "tools/mkenvimage" "tools/mkimage"];
|
||||
};
|
||||
|
||||
ubootJetsonTK1 = callPackage ../misc/uboot {
|
||||
defconfig = "jetson-tk1_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"];
|
||||
};
|
||||
|
||||
ubootPcduino3Nano = callPackage ../misc/uboot {
|
||||
defconfig = "Linksprite_pcDuino3_Nano_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
|
||||
};
|
||||
|
||||
ubootRaspberryPi = callPackage ../misc/uboot {
|
||||
defconfig = "rpi_defconfig";
|
||||
targetPlatforms = ["armv6l-linux"];
|
||||
filesToInstall = ["u-boot.bin"];
|
||||
};
|
||||
|
||||
# Intended only for QEMU's vexpress-a9 emulation target!
|
||||
ubootVersatileExpressCA9 = callPackage ../misc/uboot {
|
||||
defconfig = "vexpress_ca9x4_defconfig";
|
||||
targetPlatforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot"];
|
||||
};
|
||||
inherit (callPackage ../misc/uboot {})
|
||||
buildUBoot
|
||||
ubootBananaPi
|
||||
ubootJetsonTK1
|
||||
ubootPcduino3Nano
|
||||
ubootRaspberryPi
|
||||
ubootVersatileExpressCA9
|
||||
ubootWandboard
|
||||
;
|
||||
|
||||
# Non-upstream U-Boots:
|
||||
ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { };
|
||||
|
Loading…
Reference in New Issue
Block a user