Bootx (iBoot command)

From The iPhone Wiki
Revision as of 10:34, 15 July 2010 by Http (talk | contribs) (Undo revision 7021 by DebraBromwick (Talk))
Jump to: navigation, search

Description

A command found in iBoot, iBSS, and iBEC that verifies and boots a kernelcache image which has been uploaded.

Decompliation

iPhone 3GS 8920x from iBoot-636.66

#define kLoadAddress 0x41000000
#define kKernelMaxSize 0xF00000

char** gBootArgs;

int cmd_bootx(int argc, CmdArg* argv) {
   void* address = NULL;
   if(argc > 1 && !strcmp("help", argv[1].string)) {
       printf("usage:\n\t%s [<address>]\n", argv[0].string);
       return -1;
   }
   
   if(range_check(kLoadAddress, kKernelMaxSize) < 0) {
       printf("Permission Denied\n");
       return -1;
   }
   
   printf("Attempting to validate kernelcache @ 0x%08x\n", kLoadAddress);
   int err = load_macho_image(kLoadAddress, kKernelMaxSize, &address)
   if(err >= 0) {
       printf("kernelcache prepped at address 0x%08x\n", address);
       jump_to(3, address, gBootArgs);
       
   } else {
       printf("error loading kernelcache\n");
   }
   
   return err;
}