mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-14 05:37:40 +03:00
U-Boot: Update to 2015.04 and major refactor
Instead of selecting the defconfig based on stdenv.platform.uboot, provide different ubootFoo packages. Otherwise we couldn't easily build U-Boots for different platforms than what we are currently running on. All users of the ubootChooser function appear to be using only CLI tools like mkimage, whose behaviour is not affected by the defconfig (their build outputs are bitwise-identical). So add a separate package for the CLI tools. Of the removed patches, some version of sheevaplug-sdio.patch has apparently been applied upstream (with at least mv_sdio.c renamed to mvebu_mmc.c). sheevaplug-config.patch needs rebasing & re-testing on real hardware. Tested boards and input/output methods that upstream supports: - Raspberry Pi: - HDMI works, USB keyboard not yet supported - Serial via the 26-pin connector (3.3V) - pcDuino3 Nano: - HDMI + USB keyboard (only if attached to a hub) - Serial via the 3-pin connector (3.3V) - Jetson TK1: RS-232 serial port only - Versatile Express CA9 (for QEMU only): Serial via '-serial stdio'
This commit is contained in:
parent
1793fdbfb1
commit
d013de6d32
@ -1,71 +1,60 @@
|
||||
{stdenv, fetchurl, unzip}:
|
||||
{ stdenv, fetchurl, bc, dtc
|
||||
, toolsOnly ? false
|
||||
, defconfig ? "allnoconfig"
|
||||
, targetPlatforms
|
||||
, filesToInstall
|
||||
}:
|
||||
|
||||
let
|
||||
platform = stdenv.platform;
|
||||
configureFun = ubootConfig :
|
||||
crossPlatform = stdenv.cross.platform;
|
||||
makeTarget = if toolsOnly then "tools NO_SDL=1" else "all";
|
||||
installDir = if toolsOnly then "$out/bin" else "$out";
|
||||
buildFun = kernelArch:
|
||||
''
|
||||
make mrproper
|
||||
make ${ubootConfig} NBOOT=1 LE=1
|
||||
'';
|
||||
|
||||
buildFun = kernelArch :
|
||||
''
|
||||
unset src
|
||||
if test -z "$crossConfig"; then
|
||||
make clean all
|
||||
make ${makeTarget}
|
||||
else
|
||||
make clean all ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
||||
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
||||
fi
|
||||
'';
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "uboot-2012.07";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "uboot-${defconfig}-${version}";
|
||||
version = "2015.04";
|
||||
|
||||
src = fetchurl {
|
||||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-2012.07.tar.bz2";
|
||||
sha256 = "15nli6h9a127ldizsck3g4ysy5j4m910wawspgpadz4vjyk213p0";
|
||||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
||||
sha256 = "0q2x1wh1f6rjh9rmcnkf28dxcvp9hkhi4vzspqkzamb6b3gp06ha";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
nativeBuildInputs = [ bc dtc ];
|
||||
|
||||
dontStrip = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp u-boot.bin $out
|
||||
cp u-boot u-boot.map $out
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp tools/{envcrc,mkimage} $out/bin
|
||||
configurePhase = ''
|
||||
make ${defconfig}
|
||||
'';
|
||||
|
||||
# They have 'errno.h' included by a "-idirafter". As the gcc
|
||||
# wrappers add the glibc include as "-idirafter", the only way
|
||||
# we can make the glibc take priority is to -include errno.h.
|
||||
postPatch = if stdenv ? glibc && stdenv.glibc != null then ''
|
||||
sed -i 's,$(HOSTCPPFLAGS),-include ${stdenv.glibc}/include/errno.h $(HOSTCPPFLAGS),' config.mk
|
||||
'' else "";
|
||||
|
||||
patches = [ ./sheevaplug-sdio.patch ./sheevaplug-config.patch ];
|
||||
|
||||
configurePhase =
|
||||
assert platform ? uboot && platform.uboot != null;
|
||||
assert (platform ? ubootConfig);
|
||||
configureFun platform.ubootConfig;
|
||||
|
||||
buildPhase = assert (platform ? kernelArch);
|
||||
buildFun platform.kernelArch;
|
||||
|
||||
crossAttrs = let
|
||||
cp = stdenv.cross.platform;
|
||||
in
|
||||
assert cp ? uboot && cp.uboot != null;
|
||||
{
|
||||
configurePhase = assert (cp ? ubootConfig);
|
||||
configureFun cp.ubootConfig;
|
||||
installPhase = ''
|
||||
mkdir -p ${installDir}
|
||||
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
||||
'';
|
||||
|
||||
buildPhase = assert (cp ? kernelArch);
|
||||
buildFun cp.kernelArch;
|
||||
};
|
||||
dontStrip = !toolsOnly;
|
||||
|
||||
crossAttrs = {
|
||||
buildPhase = assert (crossPlatform ? kernelArch);
|
||||
buildFun crossPlatform.kernelArch;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
diff --git a/include/configs/sheevaplug.h b/include/configs/sheevaplug.h
|
||||
index 7c8497c..b0da1e5 100644
|
||||
--- a/include/configs/sheevaplug.h
|
||||
+++ b/include/configs/sheevaplug.h
|
||||
@@ -50,7 +50,6 @@
|
||||
#define CONFIG_CMD_MII
|
||||
#define CONFIG_CMD_MMC
|
||||
#define CONFIG_CMD_NAND
|
||||
-#define CONFIG_JFFS2_NAND
|
||||
#define CONFIG_CMD_PING
|
||||
#define CONFIG_CMD_USB
|
||||
/*
|
||||
@@ -73,25 +72,36 @@
|
||||
* it has to be rounded to sector size
|
||||
*/
|
||||
#define CONFIG_ENV_SIZE 0x20000 /* 128k */
|
||||
-#define CONFIG_ENV_ADDR 0xa0000
|
||||
-#define CONFIG_ENV_OFFSET 0xa0000 /* env starts here */
|
||||
+#define CONFIG_ENV_ADDR 0x60000
|
||||
+#define CONFIG_ENV_OFFSET 0x60000 /* env starts here */
|
||||
|
||||
/*
|
||||
* Default environment variables
|
||||
*/
|
||||
-#define CONFIG_BOOTCOMMAND "${x_bootcmd_kernel}; " \
|
||||
+#define CONFIG_BOOTCOMMAND "${x_bootcmd_ubi0}; " \
|
||||
+ "${x_bootcmd_ubi1}; " \
|
||||
+ "${x_bootcmd_ubi2}; " \
|
||||
+ "${x_bootcmd_ubi3}; " \
|
||||
"setenv bootargs ${x_bootargs} ${x_bootargs_root}; " \
|
||||
- "${x_bootcmd_usb}; bootm 0x6400000;"
|
||||
+ "${x_bootcmd_usb}; bootm 0x200000 0x1100000;"
|
||||
|
||||
#define CONFIG_MTDPARTS "orion_nand:512k(uboot)," \
|
||||
- "0x1ff00000@512k(rootfs) rw\0"
|
||||
+ "0x1ff00000@512k(rootfs)\0"
|
||||
+#define CONFIG_MTDPARTSK "orion_nand:512k(uboot)," \
|
||||
+ "0x1ff00000@512k(rootfs)rw\0"
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS "x_bootargs=console" \
|
||||
- "=ttyS0,115200 mtdparts="CONFIG_MTDPARTS \
|
||||
+ "=ttyS0,115200 mtdparts="CONFIG_MTDPARTSK \
|
||||
+ "mtdparts=mtdparts="CONFIG_MTDPARTS \
|
||||
"mtdids=nand0=orion_nand\0" \
|
||||
- "x_bootcmd_kernel=nand read 0x6400000 0x100000 0x300000\0" \
|
||||
+ "ipaddr=192.168.1.4\0" \
|
||||
+ "x_bootcmd_ubi0=ubi part nand0,1\0" \
|
||||
+ "x_bootcmd_ubi1=ubifsmount rootfs\0" \
|
||||
+ "x_bootcmd_ubi2=ubifsload 0x200000 /nixos-kernel\0" \
|
||||
+ "x_bootcmd_ubi3=ubifsload 0x1100000 /nixos-initrd\0" \
|
||||
"x_bootcmd_usb=usb start\0" \
|
||||
- "x_bootargs_root=root=/dev/mtdblock3 rw rootfstype=jffs2\0"
|
||||
+ "x_bootargs_root=ubi.mtd=rootfs root=ubi0:rootfs rw rootfstype=ubifs " \
|
||||
+ "init=/boot/nixos-init systemConfig=/boot/default/system\0"
|
||||
|
||||
/*
|
||||
* Ethernet Driver configuration
|
File diff suppressed because it is too large
Load Diff
@ -10108,14 +10108,42 @@ let
|
||||
|
||||
tunctl = callPackage ../os-specific/linux/tunctl { };
|
||||
|
||||
ubootChooser = name : if name == "upstream" then ubootUpstream
|
||||
else if name == "sheevaplug" then ubootSheevaplug
|
||||
else if name == "guruplug" then ubootGuruplug
|
||||
else if name == "nanonote" then ubootNanonote
|
||||
else throw "Unknown uboot";
|
||||
# TODO(dezgeg): either refactor & use ubootTools directly, or remove completely
|
||||
ubootChooser = name: ubootTools;
|
||||
|
||||
ubootUpstream = callPackage ../misc/uboot { };
|
||||
# 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-dtb-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:
|
||||
ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { };
|
||||
|
||||
ubootNanonote = callPackage ../misc/uboot/nanonote.nix { };
|
||||
|
Loading…
Reference in New Issue
Block a user