@cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all
@make --no-print-directory show_size
+bsb: export UBOOT_FILE_NAME=uboot_for_bsb
+bsb: export CONFIG_MAX_UBOOT_SIZE_KB=128
+bsb: export COMPRESSED_UBOOT=1
+bsb: export DEVICE_VENDOR=SE
+bsb:
+ @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) bsb_config
+ @cd $(BUILD_TOPDIR)/u-boot/ && $(MAKECMD) ENDIANNESS=-EB V=1 all
+ @make --no-print-directory show_size
+
villagetelco_mp2: export UBOOT_FILE_NAME=uboot_for_villagetelco_mp2
villagetelco_mp2: export CONFIG_MAX_UBOOT_SIZE_KB=192
villagetelco_mp2: export DEVICE_VENDOR=villagetelco
@./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
+bsb_config : unconfig hornet_common_config
+ @echo '======= Configuring for Black Swift board (128K compressed) at:' `date` '======='
+ @echo "#define CONFIG_FOR_BSB 1" >> include/config.h
+ @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
+ @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
+ @echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
+ @echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
+ @echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h
+ @echo "#define BOARD_CUSTOM_STRING \"U-Boot for Black Swift board (AR9331)\"" >> include/config.h
+
+ @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
+
carambola2_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for 8devices Carambola 2 at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2 1" >> include/config.h
gpio ^= 1 << GPIO_WLAN_LED_BIT;
#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
gpio ^= 1 << GPIO_WLAN_LED_BIT;
+#elif defined(CONFIG_FOR_BSB)
+ gpio ^= 1 << GPIO_SYS_LED_BIT;
#elif defined(CONFIG_FOR_GL_INET)
gpio ^= 1 << GPIO_WLAN_LED_BIT;
#else
SETBITVAL(gpio, GPIO_WAN_LED_BIT, GPIO_WAN_LED_ON);
SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON);
SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
+#elif defined(CONFIG_FOR_BSB)
+ SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
#elif defined(CONFIG_FOR_GL_INET)
SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON);
SETBITVAL(gpio, GPIO_WAN_LED_BIT, !GPIO_WAN_LED_ON);
SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON);
SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
+#elif defined(CONFIG_FOR_BSB)
+ SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
#elif defined(CONFIG_FOR_GL_INET)
SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON);
/* set GPIO_OE */
ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x10022001));
+#elif defined(CONFIG_FOR_BSB)
+
+ /* LED's GPIOs on Black Swift board:
+ *
+ * 27 => SYS LED (red) - output
+ * 13-17=> output only (see AR9331 datasheet)
+ * 11 => Reset switch (active low) - in (like all other by default)
+ *
+ */
+
+ // set GPIO_OE
+ ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x0803E000));
+
+ // turn off all
+ ar7240_reg_wr(AR7240_GPIO_SET, 0x0);
+
#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
/* LED's GPIOs on DIR-505:
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
!defined(CONFIG_FOR_DLINK_DIR505_A1) && \
!defined(CONFIG_FOR_DRAGINO_V2) && \
- !defined(CONFIG_FOR_MESH_POTATO_V2)
+ !defined(CONFIG_FOR_MESH_POTATO_V2) && \
+ !defined(CONFIG_FOR_BSB)
void fake_image_header(image_header_t *hdr, tplink_image_header_t *tpl_hdr){
memset(hdr, 0, sizeof(image_header_t));
strncpy((char *)hdr->ih_name, (char *)tpl_hdr->signiture_1, IH_NMLEN);
}
-#endif /* if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && !defined(CONFIG_FOR_DLINK_DIR505_A1) && !defined(CONFIG_FOR_DRAGINO_V2) && !defined(CONFIG_FOR_MESH_POTATO_V2) */
+#endif /* if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && !defined(CONFIG_FOR_DLINK_DIR505_A1) && !defined(CONFIG_FOR_DRAGINO_V2) && !defined(CONFIG_FOR_MESH_POTATO_V2) && !defined(CONFIG_FOR_BSB) */
int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
ulong addr, data, len;
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
!defined(CONFIG_FOR_DLINK_DIR505_A1) && \
!defined(CONFIG_FOR_DRAGINO_V2) && \
- !defined(CONFIG_FOR_MESH_POTATO_V2)
+ !defined(CONFIG_FOR_MESH_POTATO_V2) && \
+ !defined(CONFIG_FOR_BSB)
tplink_image_header_t *fileTag;
#endif
#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
defined(CONFIG_FOR_DLINK_DIR505_A1) || \
defined(CONFIG_FOR_DRAGINO_V2) || \
- defined(CONFIG_FOR_MESH_POTATO_V2)
+ defined(CONFIG_FOR_MESH_POTATO_V2) || \
+ defined(CONFIG_FOR_BSB)
memmove(&header, (char *)addr, sizeof(image_header_t));
print_image_hdr(hdr);
#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
defined(CONFIG_FOR_DLINK_DIR505_A1) || \
defined(CONFIG_FOR_DRAGINO_V2) || \
- defined(CONFIG_FOR_MESH_POTATO_V2)
+ defined(CONFIG_FOR_MESH_POTATO_V2) || \
+ defined(CONFIG_FOR_BSB)
static void print_type(image_header_t *hdr){
char *os, *arch, *type, *comp;
print_size(ntohl(hdr->kernelLen), "\n");
printf(" Load address: 0x%08X\n Entry point: 0x%08X\n\n", ntohl(hdr->kernelTextAddr), ntohl(hdr->kernelEntryPoint));
}
-#endif /* defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DLINK_DIR505_A1) || defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2) */
+#endif /* defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || defined(CONFIG_FOR_DLINK_DIR505_A1) || defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2) || defined(CONFIG_FOR_BSB) */
#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Page not found</title>
+ <link rel="stylesheet" href="style.css">
+ </head>
+ <body>
+ <div id="m">
+ <h1 class="red">Page not found</h1>
+ <p>The page you were looking for doesn't exist!<br>Go back to <a href="index.html">firmware update</a> page.</p>
+ </div>
+ <div id="f">This code is based on <a href="https://github.com/pepe2k/u-boot_mod" target="_blank">GitHub</a></div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>ART update</title>
+ <link rel="stylesheet" href="style.css">
+ </head>
+ <body>
+ <div id="m">
+ <h1>ART UPDATE</h1>
+ <p>You are going to update <strong>ART (Atheros Radio Test)</strong> on the device.<br>Please, choose file from your local hard drive and click <strong>Update ART</strong> button.</p>
+ <form method="post" enctype="multipart/form-data"><input type="file" name="art"><input type="submit" value="Update ART"></form>
+ <div class="i w">
+ <strong>WARNINGS</strong>
+ <ul>
+ <li>do not power off the device during update</li>
+ <li>if everything goes well, the device will restart</li>
+ <li>you can upload whatever you want, so be sure that you choose proper ART image for your device</li>
+ </ul>
+ </div>
+ </div>
+ <div id="f">This code is based on <a href="https://github.com/pepe2k/u-boot_mod" target="_blank">GitHub</a></div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Update failed</title>
+ <link rel="stylesheet" href="style.css">
+ </head>
+ <body>
+ <div id="m">
+ <h1 class="red">Update failed!</h1>
+ <p>Please, try again or contact with the author of this modification.<br>You can also get more information during update in U-Boot console.</p>
+ </div>
+ <div id="f">This code is based on <a href="https://github.com/pepe2k/u-boot_mod" target="_blank">GitHub</a></div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Update in progress</title>
+ <style>
+ h1,p,body{margin:0;padding:0}html,body{font:13px/20px Tahoma,sans-serif;background:#135B72;color:#FFF;text-align:center;height:100%}#m{padding:30px 0}#m>*{padding:20px}#f{font-size:11px;position:absolute;bottom:0;width:100%;padding:15px 0}a{color:#FEDD12;text-decoration:none}h1{font:bold 40px/40px Arial}#l{height:30px;width:30px;margin:30px auto;-webkit-animation:r 1s infinite linear;-moz-animation:r 1s infinite linear;-o-animation:r 1s infinite linear;animation:r 1s infinite linear;border-left:5px solid #FEDD12;border-right:5px solid #FEDD12;border-bottom:5px solid #135B72;border-top:5px solid #135B72;border-radius:100%}@-webkit-keyframes r{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(359deg)}}@-moz-keyframes r{from{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(359deg)}}@-o-keyframes r{from{-o-transform:rotate(0deg)}to{-o-transform:rotate(359deg)}}@keyframes r{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}
+ </style>
+ </head>
+ <body>
+ <div id="m">
+ <h1>Update in progress</h1>
+ <p>Your file was successfully uploaded! Update is in progress and you should wait for automatic reset of the device.<br>Update time depends on image size and may take up to a few minutes. You can close this page.</p>
+ <div id="l"></div>
+ </div>
+ <div id="f">This code is based on <a href="https://github.com/pepe2k/u-boot_mod" target="_blank">GitHub</a></div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Firmware update for Black Swift board</title>
+ <link rel="stylesheet" href="style.css">
+ </head>
+ <body>
+ <div id="h">Black Swift board</div>
+ <div id="m">
+ <h1>Firmware update</h1>
+ <p>You are going to upload new firmware to the device.<br>Choose a proper file from your local hard drive and click <strong>"Update firmware"</strong> button.<br>Please, do not power off the device during update, if everything goes well, the device will restart.</p>
+ <form method="post" enctype="multipart/form-data"><input type="file" name="firmware"><input type="submit" value="Update firmware"></form>
+ </div>
+ <div id="m">Please, go <a href="uboot.html">here</a> to update U-Boot or <a href="art.html">here</a> to update ART.</div>
+ <div id="f">This code is based on <a href="https://github.com/pepe2k/u-boot_mod" target="_blank">GitHub</a></div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+h1,
+p,
+form,
+body {
+ margin: 0;
+ padding: 0;
+}
+
+html,
+body {
+ font: 13px/20px Tahoma, sans-serif;
+ background: #135B72;
+ color: #FFF;
+ text-align: center;
+ height: 100%;
+}
+
+#m, #h {
+ padding: 30px 0;
+}
+
+#h {
+ font: bold 40px/40px Arial;
+ background: #ffffff;
+ color: #000000;
+ text-align: center;
+}
+
+#m > * {
+ padding: 20px;
+}
+
+#f {
+ font-size: 11px;
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ padding: 15px 0;
+}
+
+a {
+ color: #FEDD12;
+ text-decoration: none;
+}
+
+h1 {
+ font: bold 40px/40px Arial;
+}
+
+.red {
+ color: #ED0000;
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>U-Boot update</title>
+ <link rel="stylesheet" href="style.css">
+ </head>
+ <body>
+ <div id="m">
+ <h1>U-BOOT UPDATE</h1>
+ <p>You are going to update <strong>U-Boot bootloader</strong> on the device.<br>Please, choose file from your local hard drive and click <strong>Update U-Boot</strong> button.</p>
+ <form method="post" enctype="multipart/form-data"><input type="file" name="uboot"><input type="submit" value="Update U-Boot"></form>
+ <div class="i w">
+ <strong>WARNINGS</strong>
+ <ul>
+ <li>do not power off the device during update</li>
+ <li>if everything goes well, the device will restart</li>
+ <li>you can upload whatever you want, so be sure that you choose proper U-Boot image for your device</li>
+ <li>updating U-Boot is a very dangerous operation and may damage your device!</li>
+ </ul>
+ </div>
+ </div>
+ <div id="f">This code is based on <a href="https://github.com/pepe2k/u-boot_mod" target="_blank">GitHub</a></div>
+ </body>
+</html>
\ No newline at end of file
* use different (simply) image header
*/
#if !defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) && \
+ !defined(CONFIG_FOR_BSB) && \
!defined(CONFIG_FOR_DLINK_DIR505_A1) && \
!defined(CONFIG_FOR_DRAGINO_V2) && \
!defined(CONFIG_FOR_MESH_POTATO_V2)
/* common/cmd_bootm.c */
#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
+ defined(CONFIG_FOR_BSB) || \
defined(CONFIG_FOR_DLINK_DIR505_A1) || \
defined(CONFIG_FOR_DRAGINO_V2) || \
defined(CONFIG_FOR_MESH_POTATO_V2)
#define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:128k(u-boot),1024k(kernel),2816k(rootfs),64k(config),64k(ART)"
+#elif defined(CONFIG_FOR_BSB)
+
+ #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:128k(u-boot),64k(u-boot-env),16128k(firmware),64k(ART)"
+
#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
#define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=squashfs init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),16000k(firmware),64k(ART)"
defined(CONFIG_FOR_MESH_POTATO_V2)
#define CFG_LOAD_ADDR 0x9F040000
#define UPDATE_SCRIPT_FW_ADDR "0x9F040000"
+#elif defined(CONFIG_FOR_BSB)
+ #define CFG_LOAD_ADDR 0x9F030000
+ #define UPDATE_SCRIPT_FW_ADDR "0x9F030000"
#else
#define CFG_LOAD_ADDR 0x9F020000
#define UPDATE_SCRIPT_FW_ADDR "0x9F020000"
#elif defined(CONFIG_FOR_DRAGINO_V2) || \
defined(CONFIG_FOR_MESH_POTATO_V2)
#define CONFIG_BOOTCOMMAND "bootm 0x9F040000"
+#elif defined(CONFIG_FOR_BSB)
+ #define CONFIG_BOOTCOMMAND "bootm 0x9F030000"
#else
#define CONFIG_BOOTCOMMAND "bootm 0x9F020000"
#endif
#define CFG_PROMPT "dr_boot> "
#endif
+#if defined(CONFIG_FOR_BSB)
+ #if defined(CFG_PROMPT)
+ #undef CFG_PROMPT
+ #endif
+ #define CFG_PROMPT "BSB> "
+#endif
+
#undef CFG_HZ
#define CFG_HZ bd->bi_cfg_hz
#undef CPU_PLL_CONFIG_VAL
#define CFG_ENV_ADDR 0x9F040000
#define CFG_ENV_SIZE 0x8000
#define CFG_ENV_SECT_SIZE 0x10000
+#elif defined(CONFIG_FOR_BSB)
+ #define CFG_ENV_ADDR 0x9F020000
+ #define CFG_ENV_SIZE 0x8000
+ #define CFG_ENV_SECT_SIZE 0x10000
#else
#define CFG_ENV_ADDR 0x9F01EC00
#define CFG_ENV_SIZE 0x1000
#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2) || \
defined(CONFIG_FOR_DRAGINO_V2) || \
- defined(CONFIG_FOR_MESH_POTATO_V2)
+ defined(CONFIG_FOR_MESH_POTATO_V2) || \
+ defined(CONFIG_FOR_BSB)
#define CONFIG_COMMANDS (CFG_CMD_MEMORY | \
CFG_CMD_DHCP | \
defined(CONFIG_FOR_MESH_POTATO_V2)
#define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x30000"
#define UPDATE_SCRIPT_UBOOT_BACKUP_SIZE_IN_BYTES UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES
+#elif defined(CONFIG_FOR_BSB)
+ #define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x20000"
+ #define UPDATE_SCRIPT_UBOOT_BACKUP_SIZE_IN_BYTES UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES
#else
// TODO: should be == CONFIG_MAX_UBOOT_SIZE_KB
#define UPDATE_SCRIPT_UBOOT_SIZE_IN_BYTES "0x1EC00"
#elif defined(CONFIG_FOR_DRAGINO_V2) || \
defined(CONFIG_FOR_MESH_POTATO_V2)
#define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x40000
+#elif defined(CONFIG_FOR_BSB)
+ #define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x30000
#else
#define WEBFAILSAFE_UPLOAD_KERNEL_ADDRESS WEBFAILSAFE_UPLOAD_UBOOT_ADDRESS + 0x20000
#endif
#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
// GS-Oolite v1: 128k(U-Boot + MAC),64k(ART)
#define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024)
+#elif defined(CONFIG_FOR_BSB)
+ // Black Swift board: 128k(U-Boot),64k(U-Boot env),64k(ART)
+ #define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (256 * 1024)
#else
// TP-Link: 64k(U-Boot),64k(MAC/model/WPS pin block),64k(ART)
#define WEBFAILSAFE_UPLOAD_LIMITED_AREA_IN_BYTES (192 * 1024)
#define OFFSET_MAC_DATA_BLOCK 0x010000
#define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000
#define OFFSET_MAC_ADDRESS 0x00FC00
+#elif defined(CONFIG_FOR_BSB)
+ // Black Swift board has only one MAC address at the beginning of ART partition
+ #define OFFSET_MAC_DATA_BLOCK 0xFF0000
+ #define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000
+ #define OFFSET_MAC_ADDRESS 0x000000
#else
#define OFFSET_MAC_DATA_BLOCK 0x010000
#define OFFSET_MAC_DATA_BLOCK_LENGTH 0x010000
!defined(CONFIG_FOR_GS_OOLITE_V1_DEV) && \
!defined(CONFIG_FOR_DRAGINO_V2) && \
!defined(CONFIG_FOR_MESH_POTATO_V2) && \
- !defined(CONFIG_FOR_GL_INET)
+ !defined(CONFIG_FOR_GL_INET) && \
+ !defined(CONFIG_FOR_BSB)
#define OFFSET_ROUTER_MODEL 0x00FD00
#endif
#define PLL_IN_FLASH_DATA_BLOCK_OFFSET 0x00030000
#define PLL_IN_FLASH_DATA_BLOCK_LENGTH 0x00010000
#define PLL_IN_FLASH_MAGIC_OFFSET 0x0000FFF0 // last 16 bytes
+#elif defined(CONFIG_FOR_BSB)
+ /*
+ * We will store PLL and CLOCK registers
+ * configuration at the end of environment
+ * sector (64 KB, environment uses only half!)
+ */
+ #define PLL_IN_FLASH_MAGIC 0x504C4C73
+ #define PLL_IN_FLASH_DATA_BLOCK_OFFSET 0x00020000
+ #define PLL_IN_FLASH_DATA_BLOCK_LENGTH 0x00010000
+ #define PLL_IN_FLASH_MAGIC_OFFSET 0x0000FFF0 // last 16 bytes
#else
/*
* All TP-Link routers have a lot of unused space