From: Piotr Dymacz Date: Wed, 19 Mar 2014 23:24:26 +0000 (+0100) Subject: Scripts in env variables for simple U-Boot and firmware upgrade X-Git-Tag: 2014-11-19~24^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0b0a69c051cca63503214ac54fab99befb988afb;p=oweals%2Fu-boot_mod.git Scripts in env variables for simple U-Boot and firmware upgrade --- diff --git a/u-boot/include/configs/ap121.h b/u-boot/include/configs/ap121.h index a62962e..45a7f60 100755 --- a/u-boot/include/configs/ap121.h +++ b/u-boot/include/configs/ap121.h @@ -77,13 +77,17 @@ #define CONFIG_LOADADDR 0x80800000 #if defined(CONFIG_FOR_DLINK_DIR505_A1) - #define CFG_LOAD_ADDR 0x9F080000 + #define CFG_LOAD_ADDR 0x9F080000 + #define UPDATE_SCRIPT_FW_ADDR "0x9F080000" #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) - #define CFG_LOAD_ADDR 0x9F050000 + #define CFG_LOAD_ADDR 0x9F050000 + #define UPDATE_SCRIPT_FW_ADDR "0x9F050000" #elif defined(CONFIG_FOR_DRAGINO_V2) - #define CFG_LOAD_ADDR 0x9F040000 + #define CFG_LOAD_ADDR 0x9F040000 + #define UPDATE_SCRIPT_FW_ADDR "0x9F040000" #else - #define CFG_LOAD_ADDR 0x9F020000 + #define CFG_LOAD_ADDR 0x9F020000 + #define UPDATE_SCRIPT_FW_ADDR "0x9F020000" #endif #if defined(CONFIG_FOR_DLINK_DIR505_A1) @@ -861,12 +865,16 @@ #if defined(CONFIG_FOR_DLINK_DIR505_A1) #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (64 * 1024) + #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x10000" #elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (256 * 1024) + #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x40000" #elif defined(CONFIG_FOR_DRAGINO_V2) #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (192 * 1024) + #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x30000" #else #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (64 * 1024) + #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x10000" #endif // Firmware partition offset @@ -919,6 +927,38 @@ /*-----------------------------------------------------------------------*/ +/* + * Additional environment variables for simple upgrades + */ +#define CONFIG_EXTRA_ENV_SETTINGS "uboot_addr=0x9F000000\0" \ + "uboot_name=uboot.bin\0" \ + "uboot_size=" UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "\0" \ + "uboot_upg=" \ + "if ping $serverip; then " \ + "tftp $loadaddr $uboot_name && " \ + "if itest.l $filesize == $uboot_size; then " \ + "erase $uboot_addr +$filesize && " \ + "cp.b $loadaddr $uboot_addr $filesize && " \ + "echo OK!; " \ + "else " \ + "echo ERROR! Wrong file size!; " \ + "fi; " \ + "else " \ + "ERROR! Server not reachable!; " \ + "fi\0" \ + "firmware_addr=" UPDATE_SCRIPT_FW_ADDR "\0" \ + "firmware_name=firmware.bin\0" \ + "firmware_upg=" \ + "if ping $serverip; then " \ + "tftp $loadaddr $firmware_name && " \ + "erase $firmware_addr +$filesize && " \ + "cp.b $loadaddr $firmware_addr $filesize && " \ + "echo OK!; " \ + "else " \ + "ERROR! Server not reachable!; " \ + "fi\0" \ + SILENT_ENV_VARIABLE + #define CFG_ATHRS26_PHY 1 #define CFG_AG7240_NMACS 2 #define CFG_MII0_RMII 1 diff --git a/u-boot/include/configs/ar7240.h b/u-boot/include/configs/ar7240.h index 8fbdeb7..faa4af0 100755 --- a/u-boot/include/configs/ar7240.h +++ b/u-boot/include/configs/ar7240.h @@ -36,7 +36,9 @@ #define CFG_RX_ETH_BUFFER 16 #if defined(CONFIG_SILENT_CONSOLE) - #define CONFIG_EXTRA_ENV_SETTINGS "silent=1\0" + #define SILENT_ENV_VARIABLE "silent=1\0" +#else + #define SILENT_ENV_VARIABLE "" #endif /* diff --git a/u-boot/include/configs/db12x.h b/u-boot/include/configs/db12x.h index 109fa3c..f298a9a 100755 --- a/u-boot/include/configs/db12x.h +++ b/u-boot/include/configs/db12x.h @@ -47,8 +47,9 @@ #undef CONFIG_LOADADDR #define CONFIG_LOADADDR 0x80800000 -#define CFG_LOAD_ADDR 0x9F020000 -#define CONFIG_BOOTCOMMAND "bootm 0x9F020000" +#define CFG_LOAD_ADDR 0x9F020000 +#define UPDATE_SCRIPT_FW_ADDR "0x9F020000" +#define CONFIG_BOOTCOMMAND "bootm 0x9F020000" #define CONFIG_IPADDR 192.168.1.1 @@ -161,6 +162,7 @@ // U-Boot partition size #define WEBFAILSAFE_UPLOAD_UBOOT_SIZE_IN_BYTES (64 * 1024) +#define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x10000" // ART partition size #define WEBFAILSAFE_UPLOAD_ART_SIZE_IN_BYTES (64 * 1024) @@ -183,6 +185,38 @@ /*-----------------------------------------------------------------------*/ +/* + * Additional environment variables for simple upgrades + */ +#define CONFIG_EXTRA_ENV_SETTINGS "uboot_addr=0x9F000000\0" \ + "uboot_name=uboot.bin\0" \ + "uboot_size=" UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "\0" \ + "uboot_upg=" \ + "if ping $serverip; then " \ + "tftp $loadaddr $uboot_name && " \ + "if itest.l $filesize == $uboot_size; then " \ + "erase $uboot_addr +$filesize && " \ + "cp.b $loadaddr $uboot_addr $filesize && " \ + "echo OK!; " \ + "else " \ + "echo ERROR! Wrong file size!; " \ + "fi; " \ + "else " \ + "ERROR! Server not reachable!; " \ + "fi\0" \ + "firmware_addr=" UPDATE_SCRIPT_FW_ADDR "\0" \ + "firmware_name=firmware.bin\0" \ + "firmware_upg=" \ + "if ping $serverip; then " \ + "tftp $loadaddr $firmware_name && " \ + "erase $firmware_addr +$filesize && " \ + "cp.b $loadaddr $firmware_addr $filesize && " \ + "echo OK!; " \ + "else " \ + "ERROR! Server not reachable!; " \ + "fi\0" \ + SILENT_ENV_VARIABLE + /* For Merlin, both PCI, PCI-E interfaces are valid */ #define AR7240_ART_PCICFG_OFFSET 12