From 9ac93275915e7353b2a32a8492b473362eb5d198 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Tue, 28 Apr 2015 11:51:01 +0200 Subject: [PATCH] Enable more commands and writable environment support on almost all supported devices, excluding D-Link DIR-505. On rest devices, we will store environment variables in second FLASH sector, at offset 0x9F01EC00 and limit environment block size to 4 KB (should be enough, can be extended with reduced U-Boot image size). Simple map of new FLASH organization for TP-Link/GS-Oolite/GL.iNet devices: 0x9F000000 Start of FLASH, start of U-Boot image, 1st 64 KB FLASH sector .......... 0x9F010000 Start of 2nd 64 KB FLASH sector .......... 0x9F01EC00 End of U-Boot image (up to 123 KB), start of 4 KB environment variables block .......... 0x9F01FC00 End of environment variables block, start of 1 KB block with MAC address, model number, WPS pin .......... 0x9F020000 End of MAC block, start of 3rd 64 KB FLASH sector, start of firmware image .......... D-Link DIR-505 has ART data in second sector, starting from 0x9F011000, which gives us only 4 KB of additional space. Maybe we can fit environment variables block in the same sector where is stored MAC address, but first we need to find more space for U-Boot image. --- u-boot/include/configs/ap121.h | 17 +++++++++-------- u-boot/include/configs/db12x.h | 12 +++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/u-boot/include/configs/ap121.h b/u-boot/include/configs/ap121.h index 6c27f45..cc685c0 100644 --- a/u-boot/include/configs/ap121.h +++ b/u-boot/include/configs/ap121.h @@ -761,11 +761,9 @@ /* * Address and size of Primary Environment Sector */ -#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \ - defined(CONFIG_FOR_DRAGINO_V2) || \ - defined(CONFIG_FOR_MESH_POTATO_V2) - #define CFG_ENV_IS_IN_FLASH 1 - #undef CFG_ENV_IS_NOWHERE +#if !defined(CONFIG_FOR_DLINK_DIR505_A1) + #define CFG_ENV_IS_IN_FLASH 1 + #undef CFG_ENV_IS_NOWHERE #else #undef CFG_ENV_IS_IN_FLASH #define CFG_ENV_IS_NOWHERE 1 @@ -781,8 +779,9 @@ #define CFG_ENV_SIZE 0x8000 #define CFG_ENV_SECT_SIZE 0x10000 #else - #define CFG_ENV_ADDR 0x9F040000 - #define CFG_ENV_SIZE 0x10000 + #define CFG_ENV_ADDR 0x9F01EC00 + #define CFG_ENV_SIZE 0x1000 + #define CFG_ENV_SECT_SIZE 0x10000 #endif /* @@ -828,9 +827,11 @@ CFG_CMD_NET | \ CFG_CMD_RUN | \ CFG_CMD_DATE | \ + CFG_CMD_SNTP | \ CFG_CMD_ECHO | \ CFG_CMD_BOOTD | \ - CFG_CMD_ITEST) + CFG_CMD_ITEST | \ + CFG_CMD_ENV) #endif diff --git a/u-boot/include/configs/db12x.h b/u-boot/include/configs/db12x.h index 0e4c6e8..4979ee5 100644 --- a/u-boot/include/configs/db12x.h +++ b/u-boot/include/configs/db12x.h @@ -92,11 +92,12 @@ /* * Address and size of Primary Environment Sector */ -#undef CFG_ENV_IS_IN_FLASH -#define CFG_ENV_IS_NOWHERE 1 +#define CFG_ENV_IS_IN_FLASH 1 +#undef CFG_ENV_IS_NOWHERE -#define CFG_ENV_ADDR 0x9F040000 -#define CFG_ENV_SIZE 0x10000 +#define CFG_ENV_ADDR 0x9F01EC00 +#define CFG_ENV_SIZE 0x1000 +#define CFG_ENV_SECT_SIZE 0x10000 /* * Available commands @@ -111,7 +112,8 @@ CFG_CMD_SNTP | \ CFG_CMD_ECHO | \ CFG_CMD_BOOTD | \ - CFG_CMD_ITEST) + CFG_CMD_ITEST | \ + CFG_CMD_ENV) // Enable NetConsole and custom NetConsole port #define CONFIG_NETCONSOLE -- 2.25.1