forked from mirrors/nixpkgs
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
nixos/modules/installer/cd-dvd
pkgs
|
@ -23,7 +23,7 @@ in
|
||||||
boot.loader.generic-extlinux-compatible.enable = true;
|
boot.loader.generic-extlinux-compatible.enable = true;
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
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
|
# FIXME: this probably should be in installation-device.nix
|
||||||
users.extraUsers.root.initialHashedPassword = "";
|
users.extraUsers.root.initialHashedPassword = "";
|
||||||
|
|
|
@ -30,7 +30,7 @@ in
|
||||||
|
|
||||||
bootSize = mkOption {
|
bootSize = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
default = 128;
|
default = 120;
|
||||||
description = ''
|
description = ''
|
||||||
Size of the /boot partition, in megabytes.
|
Size of the /boot partition, in megabytes.
|
||||||
'';
|
'';
|
||||||
|
@ -66,10 +66,10 @@ in
|
||||||
buildInputs = with pkgs; [ dosfstools e2fsprogs mtools libfaketime utillinux ];
|
buildInputs = with pkgs; [ dosfstools e2fsprogs mtools libfaketime utillinux ];
|
||||||
|
|
||||||
buildCommand = ''
|
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 }')
|
rootSizeBlocks=$(du -B 512 --apparent-size ${rootfsImage} | awk '{ print $1 }')
|
||||||
bootSizeBlocks=$((${toString config.sdImage.bootSize} * 1024 * 1024 / 512))
|
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
|
truncate -s $imageSize $out
|
||||||
|
|
||||||
# type=b is 'W95 FAT32', type=83 is 'Linux'.
|
# type=b is 'W95 FAT32', type=83 is 'Linux'.
|
||||||
|
@ -77,8 +77,8 @@ in
|
||||||
label: dos
|
label: dos
|
||||||
label-id: 0x2178694e
|
label-id: 0x2178694e
|
||||||
|
|
||||||
start=1M, size=$bootSizeBlocks, type=b, bootable
|
start=8M, size=$bootSizeBlocks, type=b, bootable
|
||||||
type=83
|
start=${toString (8 + config.sdImage.bootSize)}M, type=83
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Copy the rootfs into the SD image
|
# Copy the rootfs into the SD image
|
||||||
|
|
|
@ -1,62 +1,101 @@
|
||||||
{ stdenv, fetchurl, bc, dtc
|
{ stdenv, fetchurl, bc, dtc }:
|
||||||
, toolsOnly ? false
|
|
||||||
, defconfig ? "allnoconfig"
|
|
||||||
, targetPlatforms
|
|
||||||
, filesToInstall
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
platform = stdenv.platform;
|
buildUBoot = { targetPlatforms
|
||||||
crossPlatform = stdenv.cross.platform;
|
, filesToInstall
|
||||||
makeTarget = if toolsOnly then "tools NO_SDL=1" else "all";
|
, installDir ? "$out"
|
||||||
installDir = if toolsOnly then "$out/bin" else "$out";
|
, defconfig
|
||||||
buildFun = kernelArch:
|
, extraMeta ? {}
|
||||||
''
|
, ... } @ args:
|
||||||
if test -z "$crossConfig"; then
|
stdenv.mkDerivation (rec {
|
||||||
make ${makeTarget}
|
|
||||||
else
|
name = "uboot-${defconfig}-${version}";
|
||||||
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
version = "2016.01";
|
||||||
fi
|
|
||||||
|
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 {
|
installPhase = ''
|
||||||
name = "uboot-${defconfig}-${version}";
|
runHook preInstall
|
||||||
version = "2015.10";
|
|
||||||
|
|
||||||
src = fetchurl {
|
mkdir -p ${installDir}
|
||||||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
||||||
sha256 = "0m8r08izci0lzzjn5c5g5manp2rc7yc5swww0lxr7bamjigqvimx";
|
|
||||||
|
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 ];
|
ubootBananaPi = buildUBoot rec {
|
||||||
|
defconfig = "Bananapi_defconfig";
|
||||||
nativeBuildInputs = [ bc dtc ];
|
targetPlatforms = ["armv7l-linux"];
|
||||||
|
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
ubootJetsonTK1 = buildUBoot rec {
|
||||||
homepage = "http://www.denx.de/wiki/U-Boot/";
|
defconfig = "jetson-tk1_defconfig";
|
||||||
description = "Boot loader for embedded systems";
|
targetPlatforms = ["armv7l-linux"];
|
||||||
license = licenses.gpl2;
|
filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"];
|
||||||
maintainers = [ maintainers.dezgeg ];
|
};
|
||||||
platforms = targetPlatforms;
|
|
||||||
|
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;
|
ubootChooser = name: ubootTools;
|
||||||
|
|
||||||
# Upstream U-Boots:
|
# Upstream U-Boots:
|
||||||
ubootTools = callPackage ../misc/uboot {
|
inherit (callPackage ../misc/uboot {})
|
||||||
toolsOnly = true;
|
buildUBoot
|
||||||
targetPlatforms = lib.platforms.linux;
|
ubootBananaPi
|
||||||
filesToInstall = ["tools/dumpimage" "tools/mkenvimage" "tools/mkimage"];
|
ubootJetsonTK1
|
||||||
};
|
ubootPcduino3Nano
|
||||||
|
ubootRaspberryPi
|
||||||
ubootJetsonTK1 = callPackage ../misc/uboot {
|
ubootVersatileExpressCA9
|
||||||
defconfig = "jetson-tk1_defconfig";
|
ubootWandboard
|
||||||
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"];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Non-upstream U-Boots:
|
# Non-upstream U-Boots:
|
||||||
ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { };
|
ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { };
|
||||||
|
|
Loading…
Reference in a new issue