uint8_t hcs_minor;
uint8_t hcs_major;
uint16_t n = 0xffff;
- uint16_t m = 0;
int state = 0;
int i,j;
for ( i = 0; i < 0x54; i++ )
printf ( "HNW:\t\t0x%04X\n",reverse_endian16 ( hd->her_znaet_chto ) ); //Hell knows what
printf ( "CRC:\t\t0x%08X\n",reverse_endian32 ( hd->crc ) );
printf ( "=== Binary Header Dump===\n" );
- int i,j;
+ int i;
uint8_t* head = ( uint8_t* ) hd;
for ( i=0;i<=sizeof ( ldr_header_t );i++ )
{
int fdout;
struct stat sb;
uint32_t filesize;
- uint32_t padding;
int ret = 0;
const char *pathin;
const char *pathout;
unsigned char *buffer;
- unsigned char *infop;
uint32_t sum;
size_t bufsize;
size_t bytes;
- int i;
if (argc < 3) {
printf("Too few arguments.\n");
return ret;
filesize = sb.st_size;
- padding = filesize % 4;
printf("INFILE: %s, size: %08x bytes\n", pathin, filesize);
/* File + extended header size */
bufsize = filesize + HEADER_SIZE;
}
close(fdin);
- /* PREP HEADER AND FOOTER */
- infop = buffer;
-
be_wr(buffer + OFFSET_MAGIC, IH_MAGIC);
/* FIXME: use actual time */
struct bcm_tag tag;
struct kernelhdr khdr;
FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile = NULL, *cfefile = NULL;
- size_t cfeoff, cfelen, kerneloff, kernellen, rootfsoff, rootfslen, \
- read, imagelen, rootfsoffpadlen = 0, kernelfslen, kerneloffpadlen = 0, oldrootfslen, \
+ size_t cfelen, kerneloff, kernellen, rootfsoff, rootfslen, \
+ read, imagelen, rootfsoffpadlen = 0, oldrootfslen, \
rootfsend;
uint8_t readbuf[1024];
uint32_t imagecrc = IMAGETAG_CRC_START;
uint32_t rootfscrc = IMAGETAG_CRC_START;
uint32_t kernelfscrc = IMAGETAG_CRC_START;
uint32_t fwaddr = 0;
- uint8_t crc_val;
const uint32_t deadcode = htonl(DEADCODE);
int i;
int is_pirelli = 0;
fwaddr = flash_start + image_offset;
if (cfefile) {
- cfeoff = flash_start;
cfelen = getlen(cfefile);
/* Seek to the start of the file after tag */
fseek(binfile, sizeof(tag), SEEK_SET);
}
} else {
- cfeoff = 0;
cfelen = 0;
}
oldrootfslen = getlen(rootfsfile);
rootfslen = oldrootfslen;
rootfslen = ( (rootfslen % block_size) > 0 ? (((rootfslen / block_size) + 1) * block_size) : rootfslen );
- kerneloffpadlen = rootfslen - oldrootfslen;
oldrootfslen = rootfslen;
kerneloff = rootfsoff + rootfslen;
int main(int argc, char **argv)
{
- int c, i;
char *kernel, *rootfs, *bin;
uint32_t flash_start, image_offset, block_size, load_address, entry;
flash_start = image_offset = block_size = load_address = entry = 0;
int
write_out_images(FILE *outfile)
{
- struct image_desc *desc;
- int i, res;
+ int res;
res = image_writeout(outfile, &kernel_image);
if (res)
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
- int argc;
char *p;
struct image_desc *desc = NULL;
int i;
if (!desc)
return ERR_FATAL;
- argc = parse_arg(arg, buf, argv);
+ parse_arg(arg, buf, argv);
i = 0;
p = argv[i++];
int
process_images(void)
{
- struct image_desc *desc;
- uint32_t offs = 0;
- int i;
int res;
kernel_image.out_size = board->max_kernel_size;
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
- int argc;
char *p;
struct csys_block *block;
int i;
return ERR_FATAL;
}
- argc = parse_arg(arg, buf, argv);
+ parse_arg(arg, buf, argv);
i = 0;
p = argv[i++];
void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
} image_info_t;
static image_info_t im;
-static int debug = 0;
static int zero_part_baseaddr = 0;
static void write_header(void* mem, const char* version)
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
- int argc;
char *p;
if (required_arg(ch, arg)) {
goto err_out;
}
- argc = parse_arg(arg, buf, argv);
+ parse_arg(arg, buf, argv);
/* processing vendor ID*/
p = argv[0];
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
- int argc;
char *p;
struct mylo_partition *part;
struct fw_part *fp;
fp = &fw_parts[fw_num_partitions++];
part = &fp->mylo;
- argc = parse_arg(arg, buf, argv);
+ parse_arg(arg, buf, argv);
/* processing partition address */
p = argv[0];
void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
usage(const char *progname, int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- int i;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream, "\n"
int
process_image(char *progname, char *filename, op_mode_t opmode)
{
- int fd, len;
- void *data, *ptr;
+ int fd;
+ void *ptr;
char namebuf[IH_NMLEN];
struct stat sbuf;
- uint32_t checksum, offset_kernel, offset_sqfs, offset_end,
- offset_sec_header, offset_eb, offset_image_end;
+ uint32_t offset_kernel, offset_sqfs, offset_end,
+ offset_sec_header, offset_eb, offset_image_end;
squashfs_sb_t *sqs;
image_header_t *hdr;
void mknspimg_print_hdr(struct nsp_img_hdr *hdr)
{
struct nsp_img_hdr_chksum *chksum;
- struct nsp_img_hdr_section_info *sect_info;
struct nsp_img_hdr_sections *section;
int i;
int cmdline_err;
char* cmdline_error_msg;
- char* filen_kernel;
- char* filen_files;
char* filen_out;
int i,count; /* loop variables */
int num_sects = 2; /* We require exactly two image with -i option
(see CMDLINE_CFG structure above) */
- int desc_count=0;
int total = 0;
int header_size=0;
header_version=atoi(argv[cmdline_getarg(cmdline_getarg_list('h'),0)]);
}
/* Set up arguments */
- filen_kernel = argv[cmdline_getarg(cmdline_getarg_list('i'),0)];
- filen_files = argv[cmdline_getarg(cmdline_getarg_list('i'),1)];
filen_out = argv[cmdline_getarg(cmdline_getarg_list('o'),0)];
/* Command line arguments have been parsed. Start doing our work. */
static void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
static void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
char *buf;
char *p;
int ret = EXIT_FAILURE;
- int writelen = 0;
- uint32_t crc;
struct fw_header *hdr;
struct fw_tail *tail;
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
- int err;
-
- FILE *outfile;
-
- progname = basename(argv[0]);
while ( 1 ) {
int c;
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
- int argc;
char *p;
struct fw_block *block;
int i;
break;
}
- argc = parse_arg(arg, buf, argv);
+ parse_arg(arg, buf, argv);
i = 0;
p = argv[i++];
void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
char *ifn = NULL;
char *ofn = NULL;
int c;
- int v0, v1, v2;
size_t n;
int first_block = 1;
int srec2bin(int argc,char *argv[],int verbose)
{
- int i,rlen,sts;
+ int rlen,sts;
FILE *fp;
- char ac;
char buff[256];
bit32u TAG_BIG = 0xDEADBE42;
bit32u TAG_LITTLE = 0xFEEDFA42;
rewind(fpIn);
/* read the whole file*/
res = fread(buf, 1, length, fpIn);
+ if (res != length) {
+ fprintf(stderr, "Unable to fread from input file\n");
+ return EXIT_FAILURE;
+ }
p = (struct trx_header *)buf;
if (LOAD32_LE(p->magic) != TRX_MAGIC) {
char hex_pattern[128];
unsigned int hex_buf;
int c;
- int v0, v1, v2;
size_t n;
int p_len, p_off = 0;