diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index 5f4bab9138fe..675a6839c863 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -29,6 +29,8 @@ stdenv.mkDerivation rec { sha256 = "0q2x1wh1f6rjh9rmcnkf28dxcvp9hkhi4vzspqkzamb6b3gp06ha"; }; + patches = [ ./vexpress-Use-config_distro_bootcmd.patch ]; + nativeBuildInputs = [ bc dtc ]; configurePhase = '' diff --git a/pkgs/misc/uboot/vexpress-Use-config_distro_bootcmd.patch b/pkgs/misc/uboot/vexpress-Use-config_distro_bootcmd.patch new file mode 100644 index 000000000000..9c61847f02ee --- /dev/null +++ b/pkgs/misc/uboot/vexpress-Use-config_distro_bootcmd.patch @@ -0,0 +1,141 @@ +From 53a8612ff19f360363edaaf70137968f7fd6a1cd Mon Sep 17 00:00:00 2001 +From: Tuomas Tynkkynen +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 ++#include + /* 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 ++ + /* 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 +