Merge pull request #8571 from dezgeg/pr-uboot
U-Boot: Refactor, update & new board+QEMU support
This commit is contained in:
commit
ea925c72e7
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "0z7yrv0sdhsh5wwy7yd1fvs4pqaq0n9m5i8w65lyibg77ahkasdg";
|
||||
};
|
||||
|
||||
buildInputs = [ flex bison ];
|
||||
nativeBuildInputs = [ flex bison ];
|
||||
|
||||
installFlags = [ "INSTALL=install" "PREFIX=$(out)" ];
|
||||
|
||||
|
@ -1,71 +1,62 @@
|
||||
{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 ];
|
||||
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
||||
|
||||
dontStrip = true;
|
||||
nativeBuildInputs = [ bc dtc ];
|
||||
|
||||
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
141
pkgs/misc/uboot/vexpress-Use-config_distro_bootcmd.patch
Normal file
141
pkgs/misc/uboot/vexpress-Use-config_distro_bootcmd.patch
Normal file
@ -0,0 +1,141 @@
|
||||
From 53a8612ff19f360363edaaf70137968f7fd6a1cd Mon Sep 17 00:00:00 2001
|
||||
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
Date: Mon, 8 Jun 2015 22:29:23 +0300
|
||||
Subject: [PATCH] vexpress: Use config_distro_bootcmd
|
||||
|
||||
Also had to hack cli_readline.c, as one codepath in
|
||||
cli_readline_into_buffer doesn't respect the timeout.
|
||||
---
|
||||
common/cli_readline.c | 12 +++++++++++-
|
||||
include/configs/vexpress_ca9x4.h | 1 -
|
||||
include/configs/vexpress_common.h | 35 +++++++++++++++++++++++------------
|
||||
3 files changed, 34 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/common/cli_readline.c b/common/cli_readline.c
|
||||
index 9a9fb35..ca997a9 100644
|
||||
--- a/common/cli_readline.c
|
||||
+++ b/common/cli_readline.c
|
||||
@@ -517,6 +517,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
|
||||
int plen = 0; /* prompt length */
|
||||
int col; /* output column cnt */
|
||||
char c;
|
||||
+ int first = 1;
|
||||
|
||||
/* print prompt */
|
||||
if (prompt) {
|
||||
@@ -528,7 +529,16 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
|
||||
for (;;) {
|
||||
if (bootretry_tstc_timeout())
|
||||
return -2; /* timed out */
|
||||
- WATCHDOG_RESET(); /* Trigger watchdog, if needed */
|
||||
+ if (first && timeout) {
|
||||
+ uint64_t etime = endtick(timeout);
|
||||
+
|
||||
+ while (!tstc()) { /* while no incoming data */
|
||||
+ if (get_ticks() >= etime)
|
||||
+ return -2; /* timed out */
|
||||
+ WATCHDOG_RESET();
|
||||
+ }
|
||||
+ first = 0;
|
||||
+ }
|
||||
|
||||
#ifdef CONFIG_SHOW_ACTIVITY
|
||||
while (!tstc()) {
|
||||
diff --git a/include/configs/vexpress_ca9x4.h b/include/configs/vexpress_ca9x4.h
|
||||
index 38ac4ed..993398c 100644
|
||||
--- a/include/configs/vexpress_ca9x4.h
|
||||
+++ b/include/configs/vexpress_ca9x4.h
|
||||
@@ -13,6 +13,5 @@
|
||||
|
||||
#define CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
|
||||
#include "vexpress_common.h"
|
||||
-#define CONFIG_BOOTP_VCI_STRING "U-boot.armv7.vexpress_ca9x4"
|
||||
|
||||
#endif /* VEXPRESS_CA9X4_H */
|
||||
diff --git a/include/configs/vexpress_common.h b/include/configs/vexpress_common.h
|
||||
index db78c85..1dd069b 100644
|
||||
--- a/include/configs/vexpress_common.h
|
||||
+++ b/include/configs/vexpress_common.h
|
||||
@@ -123,7 +123,6 @@
|
||||
#define CONFIG_SYS_L2CACHE_OFF 1
|
||||
#define CONFIG_INITRD_TAG 1
|
||||
#define CONFIG_SYS_GENERIC_BOARD
|
||||
-#define CONFIG_OF_LIBFDT 1
|
||||
|
||||
/* Size of malloc() pool */
|
||||
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024)
|
||||
@@ -152,6 +151,8 @@
|
||||
#define CONFIG_SYS_SERIAL0 V2M_UART0
|
||||
#define CONFIG_SYS_SERIAL1 V2M_UART1
|
||||
|
||||
+#include <config_distro_defaults.h>
|
||||
+#include <config_cmd_default.h>
|
||||
/* Command line configuration */
|
||||
#define CONFIG_CMD_BDI
|
||||
#define CONFIG_CMD_DHCP
|
||||
@@ -169,7 +170,6 @@
|
||||
#define CONFIG_SUPPORT_RAW_INITRD
|
||||
|
||||
#define CONFIG_CMD_FAT
|
||||
-#define CONFIG_DOS_PARTITION 1
|
||||
#define CONFIG_MMC 1
|
||||
#define CONFIG_CMD_MMC
|
||||
#define CONFIG_GENERIC_MMC
|
||||
@@ -207,17 +207,28 @@
|
||||
GENERATED_GBL_DATA_SIZE)
|
||||
#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_GBL_DATA_OFFSET
|
||||
|
||||
+#define BOOT_TARGET_DEVICES(func) \
|
||||
+ func(MMC, mmc, 0)
|
||||
+#include <config_distro_bootcmd.h>
|
||||
+
|
||||
/* Basic environment settings */
|
||||
-#define CONFIG_BOOTCOMMAND "run bootflash;"
|
||||
#ifdef CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
|
||||
+/*
|
||||
+ * RAM starts at 0x6000_0000
|
||||
+ * - U-Boot loaded @ 8M
|
||||
+ * - Kernel loaded @ 32M
|
||||
+ * - Initrd loaded @ 128M
|
||||
+ * - DTB loaded @ 240M
|
||||
+ */
|
||||
#define CONFIG_PLATFORM_ENV_SETTINGS \
|
||||
- "loadaddr=0x80008000\0" \
|
||||
- "ramdisk_addr_r=0x61000000\0" \
|
||||
- "kernel_addr=0x44100000\0" \
|
||||
- "ramdisk_addr=0x44800000\0" \
|
||||
- "maxramdisk=0x1800000\0" \
|
||||
- "pxefile_addr_r=0x88000000\0" \
|
||||
- "kernel_addr_r=0x80008000\0"
|
||||
+ "fdtfile=vexpress-v2p-ca9.dtb\0" \
|
||||
+ "kernel_addr_r=0x62000000\0" \
|
||||
+ "ramdisk_addr_r=0x68000000\0" \
|
||||
+ "maxramdisk=0x06000000\0" \
|
||||
+ "fdt_addr_r=0x6f000000\0" \
|
||||
+ "loadaddr=0x70000000\0" \
|
||||
+ "pxefile_addr_r=0x71000000\0" \
|
||||
+ "scriptaddr=0x72000000\0"
|
||||
#elif defined(CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP)
|
||||
#define CONFIG_PLATFORM_ENV_SETTINGS \
|
||||
"loadaddr=0xa0008000\0" \
|
||||
@@ -240,7 +251,8 @@
|
||||
"devtmpfs.mount=0 vmalloc=256M\0" \
|
||||
"bootflash=run flashargs; " \
|
||||
"cp ${ramdisk_addr} ${ramdisk_addr_r} ${maxramdisk}; " \
|
||||
- "bootm ${kernel_addr} ${ramdisk_addr_r}\0"
|
||||
+ "bootm ${kernel_addr} ${ramdisk_addr_r}\0" \
|
||||
+ BOOTENV
|
||||
|
||||
/* FLASH and environment organization */
|
||||
#define PHYS_FLASH_SIZE 0x04000000 /* 64MB */
|
||||
@@ -294,7 +306,6 @@
|
||||
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot args buffer */
|
||||
#define CONFIG_CMD_SOURCE
|
||||
#define CONFIG_SYS_LONGHELP
|
||||
-#define CONFIG_CMDLINE_EDITING 1
|
||||
#define CONFIG_SYS_MAXARGS 16 /* max command args */
|
||||
|
||||
#endif /* VEXPRESS_COMMON_H */
|
||||
--
|
||||
2.4.4
|
||||
|
@ -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 { };
|
||||
|
@ -303,80 +303,6 @@ rec {
|
||||
#kernelHeadersBaseConfig = "guruplug_defconfig";
|
||||
};
|
||||
|
||||
versatileARM = {
|
||||
name = "versatileARM";
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "versatile_defconfig";
|
||||
kernelBaseConfig = "versatile_defconfig";
|
||||
kernelArch = "arm";
|
||||
kernelAutoModules = false;
|
||||
kernelTarget = "zImage";
|
||||
kernelExtraConfig =
|
||||
''
|
||||
MMC_ARMMMCI y
|
||||
#MMC_SDHCI y
|
||||
SERIO_AMBAKMI y
|
||||
|
||||
AEABI y
|
||||
RTC_CLASS y
|
||||
RTC_DRV_PL031 y
|
||||
PCI y
|
||||
SCSI y
|
||||
SCSI_DMA y
|
||||
SCSI_ATA y
|
||||
BLK_DEV_SD y
|
||||
BLK_DEV_SR y
|
||||
SCSI_SYM53C8XX_2 y
|
||||
|
||||
TMPFS y
|
||||
IPV6 m
|
||||
REISERFS_FS m
|
||||
EXT4_FS m
|
||||
|
||||
IP_PNP y
|
||||
IP_PNP_DHCP y
|
||||
IP_PNP_BOOTP y
|
||||
ROOT_NFS y
|
||||
'';
|
||||
uboot = null;
|
||||
};
|
||||
|
||||
integratorCP = {
|
||||
name = "integratorCP";
|
||||
kernelMajor = "2.6";
|
||||
kernelHeadersBaseConfig = "integrator_defconfig";
|
||||
kernelBaseConfig = "integrator_defconfig";
|
||||
kernelArch = "arm";
|
||||
kernelAutoModules = false;
|
||||
kernelTarget = "zImage";
|
||||
kernelExtraConfig =
|
||||
''
|
||||
# needed for qemu integrator/cp
|
||||
SERIAL_AMBA_PL011 y
|
||||
SERIAL_AMBA_PL011_CONSOLE y
|
||||
SERIAL_AMBA_PL010 n
|
||||
SERIAL_AMBA_PL010_CONSOLE n
|
||||
|
||||
MMC_ARMMMCI y
|
||||
MMC_SDHCI y
|
||||
SERIO_AMBAKMI y
|
||||
|
||||
CPU_ARM926T y
|
||||
ARCH_INTEGRATOR_CP y
|
||||
VGA_CONSOLE n
|
||||
AEABI y
|
||||
'';
|
||||
uboot = null;
|
||||
ubootConfig = "integratorcp_config";
|
||||
};
|
||||
|
||||
integratorCPuboot = integratorCP // {
|
||||
name = "integratorCPuboot";
|
||||
kernelTarget = "uImage";
|
||||
uboot = "upstream";
|
||||
ubootConfig = "integratorcp_config";
|
||||
};
|
||||
|
||||
fuloong2f_n32 = {
|
||||
name = "fuloong2f_n32";
|
||||
kernelMajor = "2.6";
|
||||
|
Loading…
Reference in New Issue
Block a user