Thursday, October 6, 2011

Friday, April 1, 2011

Universal binaries - running the same executable on mac and linux

I've updated the sbf_flash download so that the same executable will run on either Mac or Linux. This isn't nearly as easy as you'd think, given that the two platforms use completely incompatible executable formats; Mac uses a mach-o while Linux uses ELF.

Keep reading for an explanation of how I pulled it off.

Friday, March 11, 2011

Fun with a capital C

void test1(char *pkt, char *cmd, char *arg, ...)
{
 char *fmt;
 va_list ap;
 va_start(ap, arg);
 *pkt = START;
 *(pkt += vsprintf(cmd = ++pkt, fmt = cmd, ap)) = SEP;
 for (char *ptr = strchr(fmt, '%'); ptr++; ptr = strchr(ptr, '%'))
  (void)((*ptr == '%' && ptr++) || va_arg(ap, void *));
 *(pkt += vsprintf(arg = ++pkt, fmt = arg, ap)) = END;
 va_end(ap);
}

Saturday, February 26, 2011

sbf_flash updates

(You're viewing an archived post, click here for the latest)

sbf_flash has been updated; there's now a mac os x port, in addition, support has been added for the Defy, Charm and possibly the Atrix.
sbf_flash [options] [sbf file]
    -f               - force; attempt to continue on error
    -v               - verbose output (of CDT)
    -r               - read CDT information from the phone
    -x               - extract sbf file
    -d               - download cg from phone
    --cgname [file]  - upload/download cgname
                       matches any cgname shown with -r
                       optional file arg for contents
Examples

sbf_flash file.sbf
upload file.sbf

sbf_flash -v -r
display detailed CDT information

sbf_flash -r --boot file.sbf
sbf_flash -r --boot boot.img file.sbf
upload boot, optionally using boot.img as the contents

sbf_flash -r -d --boot
sbf_flash -r -d --boot boot.img
download boot, if boot.img isn't specified it will be
saved using the cgname ("boot") as the filename

Download
(* updated Atrix support; many thanks to irc user relaxed)