Changeset 19683


Ignore:
Timestamp:
2010-02-17T03:18:13+01:00 (7 years ago)
Author:
thepeople
Message:

[tools/wrt350nv2-builder] Update to v2.2
fixed checksum byte calculation for other versions than 0x2019
fixed rare problem with padsize
updated info to stock firmware 2.00.20
fixed typos

Signed off by: Matthias Buecher <mail@…>

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/orion/image/Makefile

    r19596 r19683  
    6464        [ ! -f "$(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin" ] || ( \ 
    6565                echo ":u-boot 0 $(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin" >>"${TMP_DIR}/$2_webupgrade/$2.par"; ) 
     66        echo "#version 0x2020" >>"${TMP_DIR}/$2_webupgrade/$2.par" 
    6667# create bin file for recovery and webupgrade image 
    6768        ( cd "${TMP_DIR}/$2_webupgrade"; \ 
  • trunk/tools/wrt350nv2-builder/Makefile

    r19596 r19683  
    99 
    1010PKG_NAME:=wrt350nv2-builder 
    11 PKG_VERSION:=2.1 
     11PKG_VERSION:=2.2 
    1212 
    1313HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/${PKG_NAME}-$(PKG_VERSION) 
  • trunk/tools/wrt350nv2-builder/src/wrt350nv2-builder.c

    r19596 r19683  
    11/* 
    22 
    3         WRT350Nv2-Builder 2.1 (previously called buildimg) 
     3        WRT350Nv2-Builder 2.2 (previously called buildimg) 
    44        Copyright (C) 2008-2009 Dirk Teurlings <info@upexia.nl> 
    55        Copyright (C) 2009-2010 Matthias Buecher (http://www.maddes.net/) 
     
    3232                :rootfs 0       /path/to/root.squashfs 
    3333                :u-boot 0       /path/to/u-boot.bin 
     34                #version        0x2020 
    3435 
    3536        args: 
     
    6162        https://forum.openwrt.org/viewtopic.php?pid=92928#p92928 
    6263 
     64        Changelog: 
     65        v2.2 - fixed checksum byte calculation for other versions than 0x2019 
     66               fixed rare problem with padsize 
     67               updated info to stock firmware 2.00.20 
     68               fixed typos 
     69        v2.1 - used "wrt350n.bin" for the created image (closer to stock) 
     70                added option to create the image in two separate steps (-b / -z) 
     71        v2.0 - complete re-write 
     72 
    6373*/ 
    64  
    65 // ToDo: 
    66 // * Has NODE to be added to bin file *after* creating checksum byte? 
    6774 
    6875// includes 
     
    8087// custom includes 
    8188#include "md5.h"        // MD5 routines 
    82 #include "upgrade.h"    // Linksys definitions from firmware 2.0.19 
     89#include "upgrade.h"    // Linksys definitions from firmware 2.0.19 (unchanged up to 2.0.20) 
    8390 
    8491 
    8592// version info 
    86 #define VERSION "2.1" 
     93#define VERSION "2.2" 
    8794char program_info[] = "WRT350Nv2-Builder v%s by Dirk Teurlings <info@upexia.nl> and Matthias Buecher (http://www.maddes.net/)\n"; 
    8895 
     
    108115#define ROOTFS_END_OFFSET       0x00760000 
    109116#define ROOTFS_MIN_OFFSET       0x00640000      // should be filled up to here, to make sure that the zip file is big enough to pass the size check of the stock firmware 
    110                                                 // 2.0.17: filled up to 0x00640000, 2.0.19: filled up to 0x0670000 
     117                                                // 2.0.17: filled up to 0x00640000 
     118                                                // 2.0.19: filled up to 0x00670000 
     119                                                // 2.0.20: filled up to 0x00670000 
    111120 
    112121// rootfs statics via: hexdump -v -e '1/1 "0x%02X, "' -s 0x0075FFE0 -n 16 "wrt350n.bin" ; echo -en "\n" 
    113122unsigned char product_id[] = { 0x00, 0x03 };    // seems to be a fixed value 
    114123unsigned char protocol_id[] = { 0x00, 0x00 };   // seems to be a fixed value 
    115 unsigned char fw_version[] = { 0x20, 0x19 }; 
     124unsigned char fw_version[] = { 0x20, 0x20 }; 
    116125unsigned char rootfs_unknown[] = { 0x90, 0xF7 };        // seems to be a fixed value 
    117126unsigned char sign[] = { 0x65, 0x52, 0x63, 0x4F, 0x6D, 0x4D, 0x00, 0x00 };      // eRcOmM 
     
    131140                                0x73, 0x45, 0x72, 0x43, 0x6F, 0x4D, 0x6D };     // sErCoMm 
    132141 
    133 // img statics via: hexdump -v -e '1/1 "0x%02X, "' -s 0 -n 512 "WRT350N-EU-ETSI-2.00.19.img" ; echo -en "\n" 
     142// img statics via: hexdump -v -e '1/1 "0x%02X, "' -s 0 -n 512 "WRT350N-EU-ETSI-2.00.19.img" ; echo -en "\n" (unchanged up to 2.0.20) 
    134143unsigned char img_hdr[] = {     0x00, 0x01, 0x00, 0x00, 0x59, 0x42, 0x50, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    135144                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
     
    321330                                count = sscanf(line, "#%255s %i", string1, &value); 
    322331                                if (count != 2) { 
    323                                         printf("line %i does not meet defined format (:<variable name> <integer>\n", lineno); 
     332                                        printf("line %i does not meet defined format (#<variable name> <integer>\n", lineno); 
    324333                                } else { 
    325334                                        if (!strcmp(string1, "version")) { 
     
    455464                        // padding 
    456465                        if (padsize > 0) { 
    457                                 printf("mtd %s input file %s is too small (0x%08lX), adding 0x%08X random bytes\n", mtd->name, mtd->filename, mtd->filesize, padsize); 
    458  
    459466                                addsize = padsize & 0x0000FFFF; // start on next 64KB border 
    460467                                padsize -= addsize; 
     468                        } 
     469                        if (padsize > 0) { 
     470                                printf("mtd %s input file %s is too small (0x%08lX), adding 0x%08X random bytes\n", mtd->name, mtd->filename, mtd->filesize, padsize); 
     471 
    461472                                addsize += KERNEL_CODE_OFFSET + mtd->offset + mtd->filesize;    // get offset 
    462473                                lprintf(DEBUG, " padding offset 0x%08X length 0x%08X\n", addsize, padsize); 
     
    492503                memcpy(&buffer[KERNEL_CODE_OFFSET + SIGN_OFFSET], sign, 8);     // eRcOmM 
    493504 
    494                 lprintf(DEBUG, "adding u-boot special data 1/2\n");     // ToDo: or after creating the checksum byte? 
    495 //              memcpy(&buffer[KERNEL_CODE_OFFSET + SN_OFF], sn, 12);   // ToDo: find out what's this for? 
    496 //              memcpy(&buffer[KERNEL_CODE_OFFSET + PIN_OFF], pin, 8);  // ToDo: find out what's this for? 
    497 //              memcpy(&buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF], node, 25);  // ToDo: find out what's this for? 
     505                lprintf(DEBUG, "adding u-boot special data\n"); 
     506//              memcpy(&buffer[KERNEL_CODE_OFFSET + SN_OFF], sn, 12);   // ToDo: currently zero, find out what's this for? 
     507//              memcpy(&buffer[KERNEL_CODE_OFFSET + PIN_OFF], pin, 8);  // ToDo: currently zero, find out what's this for? 
     508//              memcpy(&buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF], node, 25);  // ToDo: currently zero, find out what's this for? 
     509                memcpy(&buffer[KERNEL_CODE_OFFSET + BOOT_ADDR_BASE_OFF + PID_OFFSET], pid, 70); // sErCoMm 
     510                memcpy(&buffer[KERNEL_CODE_OFFSET + BOOT_ADDR_BASE_OFF + PID_OFFSET + 57], fw_version, 2); 
    498511 
    499512                lprintf(DEBUG, "adding checksum byte\n"); 
     
    504517                lprintf(DEBUG_LVL2, " checksum 0x%016lX (%li)\n", csum, csum); 
    505518 
    506                 buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF + 25] = ~(csum+108)+1; 
     519                buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF + 25] = ~csum + 1; 
    507520                lprintf(DEBUG, " byte 0x%02X\n", buffer[KERNEL_CODE_OFFSET + NODE_BASE_OFF + 25]); 
    508  
    509                 lprintf(DEBUG, "adding u-boot special data 2/2\n"); 
    510                 memcpy(&buffer[KERNEL_CODE_OFFSET + BOOT_ADDR_BASE_OFF + PID_OFFSET], pid, 70); // sErCoMm 
    511                 memcpy(&buffer[KERNEL_CODE_OFFSET + BOOT_ADDR_BASE_OFF + PID_OFFSET + 57], fw_version, 2); 
    512521        } 
    513522 
     
    848857  -z            -  Have zip file, the img file will be directly created from it\n\ 
    849858  -f <version>  -  Wanted firmware version to use with -z\n\ 
    850                    Default firmware version is 0x2019 = 2.00.19.\n\ 
     859                   Default firmware version is 0x2020 = 2.00.20.\n\ 
    851860                   Note: version from parameter file will supersede this\n\ 
    852861  -v            -  Increase debug verbosity level\n\n\ 
Note: See TracChangeset for help on using the changeset viewer.