Enable more commands and writable environment support on almost all supported devices...
authorPiotr Dymacz <pepe2k@gmail.com>
Tue, 28 Apr 2015 09:51:01 +0000 (11:51 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Tue, 28 Apr 2015 09:51:01 +0000 (11:51 +0200)
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
u-boot/include/configs/db12x.h

index 6c27f45fda32f37f37d2d090f5d5ff6df1728bfd..cc685c046f030658f587a66c04954335a3e59628 100644 (file)
 /*
  * 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
 
index 0e4c6e8de93e5a91f354bf24d2973fa795278ab8..4979ee5cfc397974293a8d6a4003de9908c2db04 100644 (file)
 /*
  * 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