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.
/*
* 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
#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
/*
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
/*
* 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
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