Amilda middle firmware
There is way to upload firmware using amilda as middle firmware:
- Upload this image to original firmware
- Goto amilda’s web administration (ie, using your web browser enter http://192.168.1.1) and u will see this:
4. Select the Tools tab → Firmware Upgrade
5. Upload your csys image and ... good luck.
Thanks to kamo
Note: The Edimax 6104KP will complain about the amilda-middleware, and won’t upload it. Do *not* try to upload the Sweex image onto this Edimax type-modem: it will brick your Edimax.
Чтобы загрузить Amilda-middleware в 6104KP надо исправить первые 4 символа прошивки HEX-редактором WB4K → WBKP. Без этого Amilda-middleware будет отказываться грузиться в 6104KP. Planet XRT-401D также перешивается с помощью Amilda-middleware.
details
added “Midge Partition” to /include/asm/adm5120/mx29lv320b.h
{
.name = "Midge Partition",
.offset = 0x00010000,
.size = 0x001f0000,
}
added to ramdisk script code
mknod -m666 $(MOUNTPOINT)/dev/mtd_midge b 31 5
changed goahead
void formUpgradeFirmware (webs_t wp, char_t *path, char_t *query) {
FILE *fh;
IMG_HEADER_T *pHeader;
int flag, len;
int startAddr = -1;
if (!memcmp(wp->postData, FW_HEADER, SIGNATURE_LEN))
flag = 1;
else if (!memcmp(wp->postData, WEB_HEADER, SIGNATURE_LEN))
flag = 2;
else {
websHeader(wp);
websWrite(wp, "<b>Invalid file format!</b><br>");
goto finish;
}
pHeader = (IMG_HEADER_T*)wp->postData;
len = pHeader->len;
len = DWORD_SWAP(len);
if (flag == 1) {
if (checksumWord(&wp->postData[sizeof(IMG_HEADER_T)], len) != 0) {
websHeader(wp);
websWrite(wp, "<b>Checksum failed in image.</b>");
goto finish;
}
}
else {
if (checksumWord(&wp->postData[sizeof(IMG_HEADER_T)], len) != 0) {
websHeader(wp);
websWrite(wp, "<b>Checksum failed in image.</b>");
goto finish;
}
}
if (flag == 1) {
/* startAddr = CODE_IMAGE_OFFSET;*/
startAddr = WEB_IMAGE_OFFSET;
}
else {
startAddr = WEB_IMAGE_OFFSET;
}
fh = NULL;
if ( flag == 2)
{
fh = fopen(MTD_DEVICE, "w+b");
fseek(fh, startAddr, SEEK_SET);
}
if ( flag == 1) fh = fopen("/dev/mtd_midge", "w+b");
if (!fh)
{
websHeader(wp);
websWrite(wp, "<b>lol... unknown firmware header</b>");
goto finish;
}
fwrite(wp->postData, sizeof(*(wp->postData)), wp->lenPostData, fh);
fclose(fh);
websRedirect(wp, "/reset.php?submit=fwreboot");
return;
finish:
websFooter(wp);
websDone(wp, 200);
}


