Changeset 1505 for trunk/tools/elf2flt/elfflt.c
- Timestamp:
- 12/26/11 01:24:43 (17 months ago)
- Location:
- trunk
- Files:
-
- 1 edited
- 2 copied
-
. (modified) (1 prop)
-
tools/elf2flt (copied) (copied from branches/reyalp-flt/tools/elf2flt)
-
tools/elf2flt/elfflt.c (copied) (copied from branches/reyalp-flt/tools/elf2flt/elfflt.c) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/reyalp-flt (added) merged: 1467,1471-1477,1481,1483,1488-1489,1493-1495,1498
- Property svn:mergeinfo changed
-
trunk/tools/elf2flt/elfflt.c
r1467 r1505 4 4 * Target is modified BINARY FLAT 5 5 * 6 * (c)2011 Sergey Taranenko aka @tsv6 * (c)2011 Sergey Taranenko aka tsvstar 7 7 * 8 8 */ … … 270 270 printf("%s 0x%x (%s+0x%x)\n",prefix, offs,sect,offs-secoffs); 271 271 } 272 273 274 char* get_flat_string( int32_t offs ) 275 { 276 static char buf[200]; 277 278 if ( offs <0 ) 279 { 280 sprintf(buf," LANGID %d",-offs); 281 return buf; 282 } 283 284 if ( offs >flat->data_end || offs<=flat->data_start ) 285 return ""; 286 287 strncpy( buf, flat_buf+offs, sizeof(buf)-1); 288 buf[sizeof(buf)-1]=0; 289 return buf; 290 } 291 272 292 273 293 // Aligning up to int32 bound … … 623 643 printf(">>elf2flt: lookup entry symbols\n"); 624 644 flat->_module_loader = find_symbol_inflat("_module_loader", &text ); 625 /* if ( flat->_module_loader <=0 ) {626 PRINTF("No or invalid section of _module_loader(). It have to be exist as executable function.\n");627 return ELFFLT_NO_STARTPOINT;628 }*/629 645 flat->_module_unloader = find_symbol_inflat("_module_unloader", &text ); 630 646 flat->_module_run = find_symbol_inflat("_module_run", &text ); 631 647 flat->_module_exportlist = find_symbol_inflat("MODULE_EXPORT_LIST", 0 ); 632 648 633 flat->chdk_min_version =0; 634 flat->chdk_req_platfid =0; 635 636 int ptr = find_symbol_inflat("_chdk_required_ver", 0 ); 637 if ( ptr > 0 ) 638 flat->chdk_min_version = *(uint32_t*)(flat_buf+ptr); 639 640 ptr = find_symbol_inflat("_chdk_required_platfid", 0 ); 641 if ( ptr > 0 ) 642 flat->chdk_req_platfid = *(uint32_t*)(flat_buf+ptr); 649 // 650 flat->_module_info = find_symbol_inflat("_module_info", &data ); 651 if ( flat->_module_info <=0 ) { 652 PRINTERR(stderr, "No or invalid section of _module_info. This symbol should be initialized as ModuleInfo structure.\n"); 653 return ELFFLT_NO_MODULEINFO; 654 } 655 656 struct ModuleInfo* _module_info = (struct ModuleInfo*) (flat_buf + flat->_module_info); 657 if ( _module_info->magicnum != MODULEINFO_V1_MAGICNUM ) 658 { 659 PRINTERR(stderr, "Wrong _module_info->magicnum value. Please check correct filling of this structure\n"); 660 return ELFFLT_NO_MODULEINFO; 661 } 662 if ( _module_info->sizeof_struct != sizeof(struct ModuleInfo) ) 663 { 664 PRINTERR(stderr, "Wrong _module_info->sizeof_struct value. Please check correct filling of this structure\n"); 665 return ELFFLT_NO_MODULEINFO; 666 } 643 667 644 668 if ( FLAG_DUMP_FLT_HEADERS ) { … … 650 674 printf("->reloc_start 0x%x (size %d)\n", flat->reloc_start, flat->reloc_count*4 ); 651 675 printf("->import_start 0x%x (size %d)\n", flat->import_start, flat->import_count*4 ); 652 printf("->chdk_min_ver 0x%x\n", flat->chdk_min_version);653 printf("->chdk_platfid 0x%x\n", flat->chdk_req_platfid);654 676 655 677 print_offs("\n.._module_loader() =", flat->_module_loader); … … 657 679 print_offs(".._module_run() = ", flat->_module_run); 658 680 print_offs("..MODULE_EXPORT_LIST = ", flat->_module_exportlist); 681 682 printf("\nModule info:\n"); 683 printf("->Module Name: %s\n", get_flat_string(_module_info->moduleName) ); 684 printf("->Module Ver: %d.%d\n", _module_info->major_ver, _module_info->minor_ver ); 685 686 char* branches_str[] = {"any branch","CHDK", "CHDK_DE", "CHDK_SDM", "PRIVATEBUILD"}; 687 int branch = (_module_info->chdk_required_branch>REQUIRE_CHDK_PRIVATEBUILD) ? 688 REQUIRE_CHDK_PRIVATEBUILD : _module_info->chdk_required_branch; 689 printf("->Require: %s-build%d. ", branches_str[branch], _module_info->chdk_required_ver ); 690 if ( _module_info->chdk_required_platfid == 0 ) 691 printf("Any platform.\n"); 692 else 693 printf(" Platform #%d only.\n", _module_info->chdk_required_platfid ); 694 if ( _module_info->flags ) { 695 printf("->Flags:"); 696 if ( _module_info->flags & MODULEINFO_FLAG_SYSTEM ) 697 printf(" SYSTEM "); 698 printf("\n"); 699 } 700 printf("->Module Info: %s\n", get_flat_string(_module_info->description) ); 659 701 } 660 702
Note: See TracChangeset
for help on using the changeset viewer.