* [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified
@ 2011-09-16 9:50 Stefano Babic
2011-09-16 9:50 ` [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support Stefano Babic
` (5 more replies)
0 siblings, 6 replies; 19+ messages in thread
From: Stefano Babic @ 2011-09-16 9:50 UTC (permalink / raw)
To: u-boot
Each image handler must return a not-zero velue if the
header is not recognized to allow the main program to
iterate to the next handler.
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Heiko Schocher <hs@denx.de>
---
tools/ublimage.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/ublimage.c b/tools/ublimage.c
index 9987462..d6b4017 100644
--- a/tools/ublimage.c
+++ b/tools/ublimage.c
@@ -214,6 +214,11 @@ static int ublimage_check_image_types(uint8_t type)
static int ublimage_verify_header(unsigned char *ptr, int image_size,
struct mkimage_params *params)
{
+ struct ubl_header *ubl_hdr = (struct ubl_header *)ptr;
+
+ if ((ubl_hdr->magic & 0xFFFFFF00) != UBL_MAGIC_BASE)
+ return -1;
+
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
@ 2011-09-16 9:50 ` Stefano Babic
2011-10-05 18:56 ` Wolfgang Denk
2011-09-16 9:50 ` [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
` (4 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2011-09-16 9:50 UTC (permalink / raw)
To: u-boot
Some images have not a header of fix lenght. The patch will be
used for the generation of AIS images, because this header has
a variable lenght. The patch adds also the parameter "-s" (skip)
to not copy automatically the passed image file.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
tools/mkimage.c | 19 ++++++++++++++-----
tools/mkimage.h | 8 ++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 2f33101..c307a37 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -248,6 +248,9 @@ main (int argc, char **argv)
usage ();
params.imagename = *++argv;
goto NXTARG;
+ case 's':
+ params.skipcpy = 1;
+ break;
case 'v':
params.vflag++;
break;
@@ -361,11 +364,15 @@ NXTARG: ;
}
/*
- * Must be -w then:
- *
- * write dummy header, to be fixed later
+ * In case there an header with a variable
+ * length will be added, the corresponding
+ * function is called. This is responsible to
+ * allocate memory for the header itself.
*/
- memset (tparams->hdr, 0, tparams->header_size);
+ if (tparams->vrec_header)
+ tparams->vrec_header(¶ms, tparams);
+ else
+ memset(tparams->hdr, 0, tparams->header_size);
if (write(ifd, tparams->hdr, tparams->header_size)
!= tparams->header_size) {
@@ -374,7 +381,9 @@ NXTARG: ;
exit (EXIT_FAILURE);
}
- if (params.type == IH_TYPE_MULTI || params.type == IH_TYPE_SCRIPT) {
+ if (!params.skipcpy &&
+ (params.type == IH_TYPE_MULTI ||
+ params.type == IH_TYPE_SCRIPT)) {
char *file = params.datafile;
uint32_t size;
diff --git a/tools/mkimage.h b/tools/mkimage.h
index e59a919..213baf0 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -60,6 +60,7 @@ struct mkimage_params {
int lflag;
int vflag;
int xflag;
+ int skipcpy;
int os;
int arch;
int type;
@@ -122,6 +123,13 @@ struct image_type_params {
int (*check_image_type) (uint8_t);
/* This callback function will be executed if fflag is defined */
int (*fflag_handle) (struct mkimage_params *);
+ /*
+ * This callback function will be executed for variable size record
+ * It is expected to build this header in memory and return its length
+ * and a pointer to it
+ */
+ int (*vrec_header) (struct mkimage_params *,
+ struct image_type_params *);
/* pointer to the next registered entry in linked list */
struct image_type_params *next;
};
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
2011-09-16 9:50 ` [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support Stefano Babic
@ 2011-09-16 9:50 ` Stefano Babic
2011-10-05 18:56 ` Wolfgang Denk
2011-09-16 10:03 ` [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Heiko Schocher
` (3 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2011-09-16 9:50 UTC (permalink / raw)
To: u-boot
Some Davinci processors supports the Application
Image Script (AIS) boot process. The patch adds the generation
of the AIS image inside the mkimage tool to make possible
to generate a bootable U-boot without external tools
(TI Davinci AIS Generator).
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
common/image.c | 1 +
include/image.h | 1 +
tools/Makefile | 4 +-
tools/aisimage.c | 453 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/aisimage.h | 97 ++++++++++++
tools/mkimage.c | 2 +
tools/mkimage.h | 1 +
7 files changed, 558 insertions(+), 1 deletions(-)
create mode 100644 tools/aisimage.c
create mode 100644 tools/aisimage.h
diff --git a/common/image.c b/common/image.c
index d38ce4a..f2804f8 100644
--- a/common/image.c
+++ b/common/image.c
@@ -146,6 +146,7 @@ static const table_entry_t uimage_type[] = {
{ IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",},
{ IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",},
{ IH_TYPE_UBLIMAGE, "ublimage", "Davinci UBL image",},
+ { IH_TYPE_AISIMAGE, "aisimage", "Davinci AIS image",},
{ -1, "", "", },
};
diff --git a/include/image.h b/include/image.h
index 352e4a0..2b5a160 100644
--- a/include/image.h
+++ b/include/image.h
@@ -159,6 +159,7 @@
#define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */
#define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */
#define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */
+#define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */
/*
* Compression Types
diff --git a/tools/Makefile b/tools/Makefile
index fc741d3..df56a25 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -86,6 +86,7 @@ NOPED_OBJ_FILES-y += fit_image.o
OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
+NOPED_OBJ_FILES-y += aisimage.o
NOPED_OBJ_FILES-y += kwbimage.o
NOPED_OBJ_FILES-y += imximage.o
NOPED_OBJ_FILES-y += omapimage.o
@@ -184,7 +185,8 @@ $(obj)xway-swap-bytes$(SFX): $(obj)xway-swap-bytes.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@
-$(obj)mkimage$(SFX): $(obj)crc32.o \
+$(obj)mkimage$(SFX): $(obj)aisimage.o \
+ $(obj)crc32.o \
$(obj)default_image.o \
$(obj)fit_image.o \
$(obj)image.o \
diff --git a/tools/aisimage.c b/tools/aisimage.c
new file mode 100644
index 0000000..f73309a
--- /dev/null
+++ b/tools/aisimage.c
@@ -0,0 +1,453 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* Required to obtain the getline prototype from stdio.h */
+#define _GNU_SOURCE
+
+#include "mkimage.h"
+#include "aisimage.h"
+#include <image.h>
+
+#define IS_FNC_EXEC(c) (cmd_table[c].AIS_cmd == AIS_CMD_FNLOAD)
+#define WORD_ALIGN0 4
+#define WORD_ALIGN(len) (((len)+WORD_ALIGN0-1) & ~(WORD_ALIGN0-1))
+#define MAX_CMD_BUFFER 4096
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+static uint32_t ais_img_size = 0;
+
+/*
+ * Supported commands for configuration file
+ */
+static table_entry_t aisimage_cmds[] = {
+ {CMD_DATA, "DATA", "Reg Write Data"},
+ {CMD_FILL, "FILL", "Fill range with pattern"},
+ {CMD_CRCON, "CRCON", "CRC Enable"},
+ {CMD_CRCOFF, "CRCOFF", "CRC Disable"},
+ {CMD_CRCCHECK, "CRCCHECK", "CRC Validate"},
+ {CMD_JMPCLOSE, "JMPCLOSE", "Jump & Close"},
+ {CMD_JMP, "JMP", "Jump"},
+ {CMD_SEQREAD, "SEQREAD", "Sequential read"},
+ {CMD_PLL0, "PLL0", "PLL0"},
+ {CMD_PLL1, "PLL1", "PLL1"},
+ {CMD_CLK, "CLK", "Clock configuration"},
+ {CMD_DDR2, "DDR2", "DDR2 Configuration"},
+ {CMD_EMIFA, "EMIFA", "EMIFA"},
+ {CMD_EMIFA_ASYNC, "EMIFA_ASYNC", "EMIFA Async"},
+ {CMD_PLL, "PLL", "PLL & Clock configuration"},
+ {CMD_PSC, "PSC", "PSC setup"},
+ {CMD_PINMUX, "PINMUX", "Pinmux setup"},
+ {CMD_BOOTTABLE, "BOOT_TABLE", "Boot table command"},
+ {-1, "", ""},
+};
+
+static struct ais_func_exec {
+ uint32_t index;
+ uint32_t argcnt;
+} ais_func_table[] = {
+ [CMD_PLL0] = {0, 2},
+ [CMD_PLL1] = {1, 2},
+ [CMD_CLK] = {2, 1},
+ [CMD_DDR2] = {3, 8},
+ [CMD_EMIFA] = {4, 5},
+ [CMD_EMIFA_ASYNC] = {5, 5},
+ [CMD_PLL] = {6, 3},
+ [CMD_PSC] = {7, 1},
+ [CMD_PINMUX] = {8, 3}
+};
+
+static struct cmd_table_t {
+ uint32_t nargs;
+ uint32_t AIS_cmd;
+} cmd_table[] = {
+ [CMD_FILL] = { 4, AIS_CMD_FILL},
+ [CMD_CRCON] = { 0, AIS_CMD_ENCRC},
+ [CMD_CRCOFF] = { 0, AIS_CMD_DISCRC},
+ [CMD_CRCCHECK] = { 2, AIS_CMD_ENCRC},
+ [CMD_JMPCLOSE] = { 1, AIS_CMD_JMPCLOSE},
+ [CMD_JMP] = { 1, AIS_CMD_JMP},
+ [CMD_SEQREAD] = { 0, AIS_CMD_SEQREAD},
+ [CMD_PLL0] = { 2, AIS_CMD_FNLOAD},
+ [CMD_PLL1] = { 2, AIS_CMD_FNLOAD},
+ [CMD_CLK] = { 1, AIS_CMD_FNLOAD},
+ [CMD_DDR2] = { 8, AIS_CMD_FNLOAD},
+ [CMD_EMIFA] = { 5, AIS_CMD_FNLOAD},
+ [CMD_EMIFA_ASYNC] = { 5, AIS_CMD_FNLOAD},
+ [CMD_PLL] = { 3, AIS_CMD_FNLOAD},
+ [CMD_PSC] = { 1, AIS_CMD_FNLOAD},
+ [CMD_PINMUX] = { 3, AIS_CMD_FNLOAD},
+ [CMD_BOOTTABLE] = { 4, AIS_CMD_BOOTTBL},
+};
+
+static uint32_t get_cfg_value(char *token, char *name, int linenr)
+{
+ char *endptr;
+ uint32_t value;
+
+ errno = 0;
+ value = strtoul(token, &endptr, 16);
+ if (errno || (token == endptr)) {
+ fprintf(stderr, "Error: %s[%d] - Invalid hex data(%s)\n",
+ name, linenr, token);
+ exit(EXIT_FAILURE);
+ }
+ return value;
+}
+
+static int get_ais_table_id(uint32_t *ptr) {
+
+ int i;
+ int func_no;
+
+ for (i = 0; i < ARRAY_SIZE(cmd_table); i++) {
+ if (*ptr == cmd_table[i].AIS_cmd) {
+ if (cmd_table[i].AIS_cmd != AIS_CMD_FNLOAD)
+ return i;
+
+ func_no = ((struct ais_cmd_func *)ptr)->func_args & 0xFFFF;
+ if (func_no == ais_func_table[i].index)
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+static void aisimage_print_header(const void *hdr)
+{
+ struct ais_header *ais_hdr = (struct ais_header *)hdr;
+ uint32_t *ptr;
+ struct ais_cmd_load *ais_load;
+ int id;
+
+ if (ais_hdr->magic != AIS_MAGIC_WORD) {
+ fprintf(stderr, "Error: - AIS Magic Number not found\n");
+ return;
+ }
+ fprintf(stdout, "Image Type: TI Davinci AIS Boot Image\n");
+ fprintf(stdout, "AIS magic : %08x\n", ais_hdr->magic);
+ ptr = (uint32_t *)&ais_hdr->magic;
+ ptr++;
+
+ while (*ptr != AIS_CMD_JMPCLOSE) {
+ /* Check if we find the image */
+ if (*ptr == AIS_CMD_LOAD) {
+ ais_load = (struct ais_cmd_load *)ptr;
+ fprintf(stdout, "Image at : 0x%08x size 0x%08x\n",
+ ais_load->addr,
+ ais_load->size);
+ ptr = ais_load->data + ais_load->size / sizeof(*ptr);
+ continue;
+ }
+
+ id = get_ais_table_id(ptr);
+ if (id < 0) {
+ fprintf(stderr, "Error: - AIS Image corrupted\n");
+ return;
+ }
+ fprintf(stdout, "AIS cmd : %s\n",
+ get_table_entry_name(aisimage_cmds, NULL, id));
+ ptr += cmd_table[id].nargs + IS_FNC_EXEC(id) + 1;
+ if (((void *)ptr - hdr) > ais_img_size) {
+ fprintf(stderr,
+ "AIS Image not terminated by JMPCLOSE\n");
+ return;
+ }
+ }
+}
+
+static uint32_t *ais_insert_cmd_header(uint32_t cmd, uint32_t nargs,
+ uint32_t *parms, struct image_type_params *tparams,
+ uint32_t *ptr, uint32_t size)
+{
+ uint32_t len_cmd;
+ int i;
+
+ len_cmd = (nargs + 1 + IS_FNC_EXEC(cmd)) * sizeof(uint32_t);
+
+ *ptr++ = cmd_table[cmd].AIS_cmd;
+ if (IS_FNC_EXEC(cmd))
+ *ptr++ = ((nargs & 0xFFFF) << 16) + ais_func_table[cmd].index;
+
+ /* Copy parameters */
+ for (i = 0; i < nargs; i++)
+ *ptr++ = cpu_to_le32(parms[i]);
+
+ return ptr;
+
+}
+
+static uint32_t *ais_alloc_buffer(struct mkimage_params *params)
+{
+ int dfd;
+ struct stat sbuf;
+ char *datafile = params->datafile;
+ uint32_t *ptr;
+
+ dfd = open(datafile, O_RDONLY|O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Place for header is allocated. The size is taken from
+ * the size of the datafile, that the ais_image_generate()
+ * will copy into the header. Copying the datafile
+ * is not left to the main program, because after the datafile
+ * the header must be terminated with the Jump & Close command.
+ */
+ ais_img_size = WORD_ALIGN(sbuf.st_size) + MAX_CMD_BUFFER;
+ ptr = (uint32_t *)malloc(WORD_ALIGN(sbuf.st_size) + MAX_CMD_BUFFER);
+ if (!ptr) {
+ fprintf(stderr, "%s: malloc return failure: %s\n",
+ params->cmdname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ close(dfd);
+
+ return ptr;
+}
+
+static uint32_t *ais_copy_image(struct mkimage_params *params,
+ uint32_t *aisptr)
+
+{
+ int dfd;
+ struct stat sbuf;
+ char *datafile = params->datafile;
+ void *ptr;
+
+ dfd = open(datafile, O_RDONLY|O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, dfd, 0);
+ *aisptr++ = AIS_CMD_LOAD;
+ *aisptr++ = params->ep;
+ *aisptr++ = sbuf.st_size;
+ memcpy((void *)aisptr, ptr, sbuf.st_size);
+ aisptr += WORD_ALIGN(sbuf.st_size) / sizeof(uint32_t);
+
+ (void) munmap((void *)ptr, sbuf.st_size);
+ (void) close(dfd);
+
+ return aisptr;
+
+}
+
+static int aisimage_generate(struct mkimage_params *params,
+ struct image_type_params *tparams)
+{
+ FILE *fd = NULL;
+ char *line = NULL;
+ char *token, *saveptr1, *saveptr2;
+ int lineno = 0;
+ int fld;
+ size_t len;
+ int32_t cmd;
+ uint32_t nargs, cmd_parms[10];
+ uint32_t value, size;
+ char *name = params->imagename;
+ uint32_t *aishdr, tsize;
+
+ fd = fopen(name, "r");
+ if (fd == 0) {
+ fprintf(stderr,
+ "Error: %s - Can't open AIS configuration\n", name);
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * the size of the header is variable and is computed
+ * scanning the configuration file.
+ */
+ tparams->header_size = 0;
+
+ /*
+ * Start allocating a buffer suitable for most command
+ * The buffer is then reallocated if it is too small
+ */
+ aishdr = ais_alloc_buffer(params);
+ tparams->hdr = aishdr;
+ *aishdr++ = AIS_MAGIC_WORD;
+
+ /* Very simple parsing, line starting with # are comments
+ * and are dropped
+ */
+ while ((getline(&line, &len, fd)) > 0) {
+ lineno++;
+
+ token = strtok_r(line, "\r\n", &saveptr1);
+ if (token == NULL)
+ continue;
+
+ /* Check inside the single line */
+ line = token;
+ fld = CFG_COMMAND;
+ cmd = CMD_INVALID;
+ nargs = 0;
+ while (token != NULL) {
+ token = strtok_r(line, " \t", &saveptr2);
+ if (token == NULL)
+ break;
+
+ /* Drop all text starting with '#' as comments */
+ if (token[0] == '#')
+ break;
+
+ switch (fld) {
+ case CFG_COMMAND:
+ cmd = get_table_entry_id(aisimage_cmds,
+ "aisimage commands", token);
+ if (cmd < 0) {
+ fprintf(stderr,
+ "Error: %s[%d] - Invalid command"
+ "(%s)\n", name, lineno, token);
+
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case CFG_VALUE:
+ value = get_cfg_value(token, name, lineno);
+ cmd_parms[nargs++] = value;
+ if (nargs > cmd_table[cmd].nargs) {
+ fprintf(stderr,
+ "Error: %s[%d] - too much arguments:"
+ "(%s) for command %s\n", name,
+ lineno, token,
+ aisimage_cmds[cmd].sname);
+ exit(EXIT_FAILURE);
+ }
+ break;
+ }
+ line = NULL;
+ fld = CFG_VALUE;
+ }
+ if (cmd != CMD_INVALID) {
+ /* Now insert the command into the header */
+ aishdr = ais_insert_cmd_header(cmd, nargs, cmd_parms,
+ tparams, aishdr, tsize);
+ }
+
+ }
+ fclose(fd);
+
+ aishdr = ais_copy_image(params, aishdr);
+
+ /* Add Jmp & Close */
+ *aishdr++ = AIS_CMD_JMPCLOSE;
+ *aishdr++ = params->ep;
+
+ size = (aishdr - (uint32_t *)tparams->hdr) * sizeof(uint32_t);
+ tparams->header_size = size;
+
+ return 0;
+}
+
+static int aisimage_check_image_types(uint8_t type)
+{
+ if (type == IH_TYPE_AISIMAGE)
+ return EXIT_SUCCESS;
+ else
+ return EXIT_FAILURE;
+}
+
+static int aisimage_verify_header(unsigned char *ptr, int image_size,
+ struct mkimage_params *params)
+{
+ struct ais_header *ais_hdr = (struct ais_header *)ptr;
+
+ if (ais_hdr->magic != AIS_MAGIC_WORD) {
+ return -FDT_ERR_BADSTRUCTURE;
+ }
+
+ /* Store the total size to remember in print_hdr */
+ ais_img_size = image_size;
+
+ return 0;
+}
+
+static void aisimage_set_header(void *ptr, struct stat *sbuf, int ifd,
+ struct mkimage_params *params)
+{
+}
+
+int aisimage_check_params(struct mkimage_params *params)
+{
+ if (!params)
+ return CFG_INVALID;
+ if (!strlen(params->imagename)) {
+ fprintf(stderr, "Error: %s - Configuration file not specified, "
+ "it is needed for aisimage generation\n",
+ params->cmdname);
+ return CFG_INVALID;
+ }
+ /*
+ * Check parameters:
+ * XIP is not allowed and verify that incompatible
+ * parameters are not sent at the same time
+ * For example, if list is required a data image must not be provided
+ */
+ return (params->dflag && (params->fflag || params->lflag)) ||
+ (params->fflag && (params->dflag || params->lflag)) ||
+ (params->lflag && (params->dflag || params->fflag)) ||
+ (params->xflag) || !(strlen(params->imagename));
+}
+
+/*
+ * aisimage parameters
+ */
+static struct image_type_params aisimage_params = {
+ .name = "TI Davinci AIS Boot Image support",
+ .header_size = 0,
+ .hdr = NULL,
+ .check_image_type = aisimage_check_image_types,
+ .verify_header = aisimage_verify_header,
+ .print_header = aisimage_print_header,
+ .set_header = aisimage_set_header,
+ .check_params = aisimage_check_params,
+ .vrec_header = aisimage_generate,
+};
+
+void init_ais_image_type(void)
+{
+ mkimage_register(&aisimage_params);
+}
diff --git a/tools/aisimage.h b/tools/aisimage.h
new file mode 100644
index 0000000..a6372b8
--- /dev/null
+++ b/tools/aisimage.h
@@ -0,0 +1,97 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _AISIMAGE_H_
+#define _AISIMAGE_H_
+
+/* all values are for little endian systems */
+#define AIS_MAGIC_WORD 0x41504954
+#define AIS_FCN_MAX 8
+
+enum {
+ AIS_CMD_LOAD = 0x58535901,
+ AIS_CMD_VALCRC = 0x58535902,
+ AIS_CMD_ENCRC = 0x58535903,
+ AIS_CMD_DISCRC = 0x58535904,
+ AIS_CMD_JMP = 0x58535905,
+ AIS_CMD_JMPCLOSE = 0x58535906,
+ AIS_CMD_BOOTTBL = 0x58535907,
+ AIS_CMD_FILL = 0x5853590A,
+ AIS_CMD_FNLOAD = 0x5853590D,
+ AIS_CMD_SEQREAD = 0x58535963,
+};
+
+struct ais_cmd_load {
+ uint32_t cmd;
+ uint32_t addr;
+ uint32_t size;
+ uint32_t data[1];
+};
+
+struct ais_cmd_func {
+ uint32_t cmd;
+ uint32_t func_args;
+ uint32_t parms[AIS_FCN_MAX];
+};
+
+struct ais_cmd_jmpclose {
+ uint32_t cmd;
+ uint32_t addr;
+};
+
+#define CMD_DATA_STR "DATA"
+
+enum ais_file_cmd {
+ CMD_INVALID,
+ CMD_FILL,
+ CMD_CRCON,
+ CMD_CRCOFF,
+ CMD_CRCCHECK,
+ CMD_JMPCLOSE,
+ CMD_JMP,
+ CMD_SEQREAD,
+ CMD_DATA,
+ CMD_PLL0,
+ CMD_PLL1,
+ CMD_CLK,
+ CMD_DDR2,
+ CMD_EMIFA,
+ CMD_EMIFA_ASYNC,
+ CMD_PLL,
+ CMD_PSC,
+ CMD_PINMUX,
+ CMD_BOOTTABLE
+};
+
+enum aisimage_fld_types {
+ CFG_INVALID = -1,
+ CFG_COMMAND,
+ CFG_VALUE,
+};
+
+struct ais_header {
+ uint32_t magic;
+ char data[1];
+};
+
+#endif /* _AISIMAGE_H_ */
diff --git a/tools/mkimage.c b/tools/mkimage.c
index c307a37..36e28ec 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -162,6 +162,8 @@ main (int argc, char **argv)
init_default_image_type ();
/* Init Davinci UBL support */
init_ubl_image_type();
+ /* Init Davinci AIS support */
+ init_ais_image_type();
params.cmdname = *argv;
params.addr = params.ep = 0;
diff --git a/tools/mkimage.h b/tools/mkimage.h
index 213baf0..5fe1a48 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -147,6 +147,7 @@ void mkimage_register (struct image_type_params *tparams);
*
* Supported image types init functions
*/
+void init_ais_image_type(void);
void init_kwb_image_type (void);
void init_imx_image_type (void);
void init_default_image_type (void);
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
2011-09-16 9:50 ` [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support Stefano Babic
2011-09-16 9:50 ` [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
@ 2011-09-16 10:03 ` Heiko Schocher
2011-09-22 10:25 ` [U-Boot] [PATCH V2 " Stefano Babic
` (2 subsequent siblings)
5 siblings, 0 replies; 19+ messages in thread
From: Heiko Schocher @ 2011-09-16 10:03 UTC (permalink / raw)
To: u-boot
Hello Stefano,
Stefano Babic wrote:
> Each image handler must return a not-zero velue if the
^
value
> header is not recognized to allow the main program to
> iterate to the next handler.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Heiko Schocher <hs@denx.de>
> ---
> tools/ublimage.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
Beside of that:
Acked-by: Heiko Schocher <hs@denx.de>
Thanks for detecting!
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V2 1/3] mkimage: ublimage must return if the header is not verified
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
` (2 preceding siblings ...)
2011-09-16 10:03 ` [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Heiko Schocher
@ 2011-09-22 10:25 ` Stefano Babic
2011-10-05 18:55 ` Wolfgang Denk
2011-10-06 8:20 ` [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
2011-10-17 10:07 ` [U-Boot] [PATCH V3 " Stefano Babic
5 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2011-09-22 10:25 UTC (permalink / raw)
To: u-boot
Each image handler must return a not-zero value if the
header is not recognized to allow the main program to
iterate to the next handler.
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Heiko Schocher <hs@denx.de>
---
Changes since V1:
- correct commit message (Heiko Schocher)
tools/ublimage.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/ublimage.c b/tools/ublimage.c
index 9987462..d6b4017 100644
--- a/tools/ublimage.c
+++ b/tools/ublimage.c
@@ -214,6 +214,11 @@ static int ublimage_check_image_types(uint8_t type)
static int ublimage_verify_header(unsigned char *ptr, int image_size,
struct mkimage_params *params)
{
+ struct ubl_header *ubl_hdr = (struct ubl_header *)ptr;
+
+ if ((ubl_hdr->magic & 0xFFFFFF00) != UBL_MAGIC_BASE)
+ return -1;
+
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V2 1/3] mkimage: ublimage must return if the header is not verified
2011-09-22 10:25 ` [U-Boot] [PATCH V2 " Stefano Babic
@ 2011-10-05 18:55 ` Wolfgang Denk
0 siblings, 0 replies; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-05 18:55 UTC (permalink / raw)
To: u-boot
Dear Stefano Babic,
In message <1316687112-27380-1-git-send-email-sbabic@denx.de> you wrote:
> Each image handler must return a not-zero value if the
> header is not recognized to allow the main program to
> iterate to the next handler.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Heiko Schocher <hs@denx.de>
> ---
>
> Changes since V1:
> - correct commit message (Heiko Schocher)
>
> tools/ublimage.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Confound these ancestors.... They've stolen our best ideas!"
- Ben Jonson
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support
2011-09-16 9:50 ` [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support Stefano Babic
@ 2011-10-05 18:56 ` Wolfgang Denk
0 siblings, 0 replies; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-05 18:56 UTC (permalink / raw)
To: u-boot
Dear Stefano Babic,
In message <1316166617-11711-2-git-send-email-sbabic@denx.de> you wrote:
> Some images have not a header of fix lenght. The patch will be
> used for the generation of AIS images, because this header has
> a variable lenght. The patch adds also the parameter "-s" (skip)
> to not copy automatically the passed image file.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> ---
> tools/mkimage.c | 19 ++++++++++++++-----
> tools/mkimage.h | 8 ++++++++
> 2 files changed, 22 insertions(+), 5 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It's not an optical illusion, it just looks like one. -- Phil White
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image
2011-09-16 9:50 ` [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
@ 2011-10-05 18:56 ` Wolfgang Denk
2011-10-05 20:21 ` Wolfgang Denk
0 siblings, 1 reply; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-05 18:56 UTC (permalink / raw)
To: u-boot
Dear Stefano Babic,
In message <1316166617-11711-3-git-send-email-sbabic@denx.de> you wrote:
> Some Davinci processors supports the Application
> Image Script (AIS) boot process. The patch adds the generation
> of the AIS image inside the mkimage tool to make possible
> to generate a bootable U-boot without external tools
> (TI Davinci AIS Generator).
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> ---
> common/image.c | 1 +
> include/image.h | 1 +
> tools/Makefile | 4 +-
> tools/aisimage.c | 453 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> tools/aisimage.h | 97 ++++++++++++
> tools/mkimage.c | 2 +
> tools/mkimage.h | 1 +
> 7 files changed, 558 insertions(+), 1 deletions(-)
> create mode 100644 tools/aisimage.c
> create mode 100644 tools/aisimage.h
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Empire didn't encourage its subjects to go far away, in case they
saw things that might disturb them. For the same reason it had built
a wall around the entire country, patrolled by the Heavenly Guard
whose main function was to tread heavily on the fingers of any inha-
bitants who felt they might like to step outside for five minutes for
a breath of fresh air. - Terry Pratchett, _Mort_
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image
2011-10-05 18:56 ` Wolfgang Denk
@ 2011-10-05 20:21 ` Wolfgang Denk
0 siblings, 0 replies; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-05 20:21 UTC (permalink / raw)
To: u-boot
Dear Stefano,
In message <20111005185612.C7A1218E5B38@gemini.denx.de> I wrote:
>
> In message <1316166617-11711-3-git-send-email-sbabic@denx.de> you wrote:
> > Some Davinci processors supports the Application
> > Image Script (AIS) boot process. The patch adds the generation
> > of the AIS image inside the mkimage tool to make possible
> > to generate a bootable U-boot without external tools
> > (TI Davinci AIS Generator).
> >
> > Signed-off-by: Stefano Babic <sbabic@denx.de>
> > ---
> > common/image.c | 1 +
> > include/image.h | 1 +
> > tools/Makefile | 4 +-
> > tools/aisimage.c | 453 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > tools/aisimage.h | 97 ++++++++++++
> > tools/mkimage.c | 2 +
> > tools/mkimage.h | 1 +
> > 7 files changed, 558 insertions(+), 1 deletions(-)
> > create mode 100644 tools/aisimage.c
> > create mode 100644 tools/aisimage.h
This commit causes compile warnings, for example:
-> MAKEALL TQM860L
Configuring for TQM860L board...
aisimage.c: In function 'ais_insert_cmd_header':
aisimage.c:183:11: warning: variable 'len_cmd' set but not used [-Wunused-but-set-variable]
1929755f08be8d9779846a69fe2a9daf9eebb5db is the first bad commit
commit 1929755f08be8d9779846a69fe2a9daf9eebb5db
Author: Stefano Babic <sbabic@denx.de>
Date: Thu Sep 15 23:50:17 2011 +0000
mkimage: adding support for Davinci AIS image
I'm dropping this commit for now. Please fix and resubmit.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I think animal testing is a terrible idea; they get all nervous and
give the wrong answers.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
` (3 preceding siblings ...)
2011-09-22 10:25 ` [U-Boot] [PATCH V2 " Stefano Babic
@ 2011-10-06 8:20 ` Stefano Babic
2011-10-15 20:23 ` Wolfgang Denk
2011-10-17 10:07 ` [U-Boot] [PATCH V3 " Stefano Babic
5 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2011-10-06 8:20 UTC (permalink / raw)
To: u-boot
Some Davinci processors supports the Application
Image Script (AIS) boot process. The patch adds the generation
of the AIS image inside the mkimage tool to make possible
to generate a bootable U-boot without external tools
(TI Davinci AIS Generator).
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Wolfgang Denk <wd@denx.de>
---
Changes:
- removed warning in gcc 4.6 iwhen -Wunused-but-set-variable is set
- drop remained warnings raised by checkpatch
common/image.c | 1 +
include/image.h | 1 +
tools/Makefile | 4 +-
tools/aisimage.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/aisimage.h | 97 ++++++++++++
tools/mkimage.c | 2 +
tools/mkimage.h | 1 +
7 files changed, 556 insertions(+), 1 deletions(-)
create mode 100644 tools/aisimage.c
create mode 100644 tools/aisimage.h
diff --git a/common/image.c b/common/image.c
index d38ce4a..f2804f8 100644
--- a/common/image.c
+++ b/common/image.c
@@ -146,6 +146,7 @@ static const table_entry_t uimage_type[] = {
{ IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",},
{ IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",},
{ IH_TYPE_UBLIMAGE, "ublimage", "Davinci UBL image",},
+ { IH_TYPE_AISIMAGE, "aisimage", "Davinci AIS image",},
{ -1, "", "", },
};
diff --git a/include/image.h b/include/image.h
index cca1cc5..52a0cb4 100644
--- a/include/image.h
+++ b/include/image.h
@@ -159,6 +159,7 @@
#define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */
#define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */
#define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */
+#define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */
/*
* Compression Types
diff --git a/tools/Makefile b/tools/Makefile
index fc741d3..df56a25 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -86,6 +86,7 @@ NOPED_OBJ_FILES-y += fit_image.o
OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
+NOPED_OBJ_FILES-y += aisimage.o
NOPED_OBJ_FILES-y += kwbimage.o
NOPED_OBJ_FILES-y += imximage.o
NOPED_OBJ_FILES-y += omapimage.o
@@ -184,7 +185,8 @@ $(obj)xway-swap-bytes$(SFX): $(obj)xway-swap-bytes.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@
-$(obj)mkimage$(SFX): $(obj)crc32.o \
+$(obj)mkimage$(SFX): $(obj)aisimage.o \
+ $(obj)crc32.o \
$(obj)default_image.o \
$(obj)fit_image.o \
$(obj)image.o \
diff --git a/tools/aisimage.c b/tools/aisimage.c
new file mode 100644
index 0000000..6a10111
--- /dev/null
+++ b/tools/aisimage.c
@@ -0,0 +1,451 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* Required to obtain the getline prototype from stdio.h */
+#define _GNU_SOURCE
+
+#include "mkimage.h"
+#include "aisimage.h"
+#include <image.h>
+
+#define IS_FNC_EXEC(c) (cmd_table[c].AIS_cmd == AIS_CMD_FNLOAD)
+#define WORD_ALIGN0 4
+#define WORD_ALIGN(len) (((len)+WORD_ALIGN0-1) & ~(WORD_ALIGN0-1))
+#define MAX_CMD_BUFFER 4096
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+static uint32_t ais_img_size;
+
+/*
+ * Supported commands for configuration file
+ */
+static table_entry_t aisimage_cmds[] = {
+ {CMD_DATA, "DATA", "Reg Write Data"},
+ {CMD_FILL, "FILL", "Fill range with pattern"},
+ {CMD_CRCON, "CRCON", "CRC Enable"},
+ {CMD_CRCOFF, "CRCOFF", "CRC Disable"},
+ {CMD_CRCCHECK, "CRCCHECK", "CRC Validate"},
+ {CMD_JMPCLOSE, "JMPCLOSE", "Jump & Close"},
+ {CMD_JMP, "JMP", "Jump"},
+ {CMD_SEQREAD, "SEQREAD", "Sequential read"},
+ {CMD_PLL0, "PLL0", "PLL0"},
+ {CMD_PLL1, "PLL1", "PLL1"},
+ {CMD_CLK, "CLK", "Clock configuration"},
+ {CMD_DDR2, "DDR2", "DDR2 Configuration"},
+ {CMD_EMIFA, "EMIFA", "EMIFA"},
+ {CMD_EMIFA_ASYNC, "EMIFA_ASYNC", "EMIFA Async"},
+ {CMD_PLL, "PLL", "PLL & Clock configuration"},
+ {CMD_PSC, "PSC", "PSC setup"},
+ {CMD_PINMUX, "PINMUX", "Pinmux setup"},
+ {CMD_BOOTTABLE, "BOOT_TABLE", "Boot table command"},
+ {-1, "", ""},
+};
+
+static struct ais_func_exec {
+ uint32_t index;
+ uint32_t argcnt;
+} ais_func_table[] = {
+ [CMD_PLL0] = {0, 2},
+ [CMD_PLL1] = {1, 2},
+ [CMD_CLK] = {2, 1},
+ [CMD_DDR2] = {3, 8},
+ [CMD_EMIFA] = {4, 5},
+ [CMD_EMIFA_ASYNC] = {5, 5},
+ [CMD_PLL] = {6, 3},
+ [CMD_PSC] = {7, 1},
+ [CMD_PINMUX] = {8, 3}
+};
+
+static struct cmd_table_t {
+ uint32_t nargs;
+ uint32_t AIS_cmd;
+} cmd_table[] = {
+ [CMD_FILL] = { 4, AIS_CMD_FILL},
+ [CMD_CRCON] = { 0, AIS_CMD_ENCRC},
+ [CMD_CRCOFF] = { 0, AIS_CMD_DISCRC},
+ [CMD_CRCCHECK] = { 2, AIS_CMD_ENCRC},
+ [CMD_JMPCLOSE] = { 1, AIS_CMD_JMPCLOSE},
+ [CMD_JMP] = { 1, AIS_CMD_JMP},
+ [CMD_SEQREAD] = { 0, AIS_CMD_SEQREAD},
+ [CMD_PLL0] = { 2, AIS_CMD_FNLOAD},
+ [CMD_PLL1] = { 2, AIS_CMD_FNLOAD},
+ [CMD_CLK] = { 1, AIS_CMD_FNLOAD},
+ [CMD_DDR2] = { 8, AIS_CMD_FNLOAD},
+ [CMD_EMIFA] = { 5, AIS_CMD_FNLOAD},
+ [CMD_EMIFA_ASYNC] = { 5, AIS_CMD_FNLOAD},
+ [CMD_PLL] = { 3, AIS_CMD_FNLOAD},
+ [CMD_PSC] = { 1, AIS_CMD_FNLOAD},
+ [CMD_PINMUX] = { 3, AIS_CMD_FNLOAD},
+ [CMD_BOOTTABLE] = { 4, AIS_CMD_BOOTTBL},
+};
+
+static uint32_t get_cfg_value(char *token, char *name, int linenr)
+{
+ char *endptr;
+ uint32_t value;
+
+ errno = 0;
+ value = strtoul(token, &endptr, 16);
+ if (errno || (token == endptr)) {
+ fprintf(stderr, "Error: %s[%d] - Invalid hex data(%s)\n",
+ name, linenr, token);
+ exit(EXIT_FAILURE);
+ }
+ return value;
+}
+
+static int get_ais_table_id(uint32_t *ptr)
+{
+
+ int i;
+ int func_no;
+
+ for (i = 0; i < ARRAY_SIZE(cmd_table); i++) {
+ if (*ptr == cmd_table[i].AIS_cmd) {
+ if (cmd_table[i].AIS_cmd != AIS_CMD_FNLOAD)
+ return i;
+
+ func_no = ((struct ais_cmd_func *)ptr)->func_args
+ & 0xFFFF;
+ if (func_no == ais_func_table[i].index)
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+static void aisimage_print_header(const void *hdr)
+{
+ struct ais_header *ais_hdr = (struct ais_header *)hdr;
+ uint32_t *ptr;
+ struct ais_cmd_load *ais_load;
+ int id;
+
+ if (ais_hdr->magic != AIS_MAGIC_WORD) {
+ fprintf(stderr, "Error: - AIS Magic Number not found\n");
+ return;
+ }
+ fprintf(stdout, "Image Type: TI Davinci AIS Boot Image\n");
+ fprintf(stdout, "AIS magic : %08x\n", ais_hdr->magic);
+ ptr = (uint32_t *)&ais_hdr->magic;
+ ptr++;
+
+ while (*ptr != AIS_CMD_JMPCLOSE) {
+ /* Check if we find the image */
+ if (*ptr == AIS_CMD_LOAD) {
+ ais_load = (struct ais_cmd_load *)ptr;
+ fprintf(stdout, "Image at : 0x%08x size 0x%08x\n",
+ ais_load->addr,
+ ais_load->size);
+ ptr = ais_load->data + ais_load->size / sizeof(*ptr);
+ continue;
+ }
+
+ id = get_ais_table_id(ptr);
+ if (id < 0) {
+ fprintf(stderr, "Error: - AIS Image corrupted\n");
+ return;
+ }
+ fprintf(stdout, "AIS cmd : %s\n",
+ get_table_entry_name(aisimage_cmds, NULL, id));
+ ptr += cmd_table[id].nargs + IS_FNC_EXEC(id) + 1;
+ if (((void *)ptr - hdr) > ais_img_size) {
+ fprintf(stderr,
+ "AIS Image not terminated by JMPCLOSE\n");
+ return;
+ }
+ }
+}
+
+static uint32_t *ais_insert_cmd_header(uint32_t cmd, uint32_t nargs,
+ uint32_t *parms, struct image_type_params *tparams,
+ uint32_t *ptr, uint32_t size)
+{
+ int i;
+
+ *ptr++ = cmd_table[cmd].AIS_cmd;
+ if (IS_FNC_EXEC(cmd))
+ *ptr++ = ((nargs & 0xFFFF) << 16) + ais_func_table[cmd].index;
+
+ /* Copy parameters */
+ for (i = 0; i < nargs; i++)
+ *ptr++ = cpu_to_le32(parms[i]);
+
+ return ptr;
+
+}
+
+static uint32_t *ais_alloc_buffer(struct mkimage_params *params)
+{
+ int dfd;
+ struct stat sbuf;
+ char *datafile = params->datafile;
+ uint32_t *ptr;
+
+ dfd = open(datafile, O_RDONLY|O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Place for header is allocated. The size is taken from
+ * the size of the datafile, that the ais_image_generate()
+ * will copy into the header. Copying the datafile
+ * is not left to the main program, because after the datafile
+ * the header must be terminated with the Jump & Close command.
+ */
+ ais_img_size = WORD_ALIGN(sbuf.st_size) + MAX_CMD_BUFFER;
+ ptr = (uint32_t *)malloc(WORD_ALIGN(sbuf.st_size) + MAX_CMD_BUFFER);
+ if (!ptr) {
+ fprintf(stderr, "%s: malloc return failure: %s\n",
+ params->cmdname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ close(dfd);
+
+ return ptr;
+}
+
+static uint32_t *ais_copy_image(struct mkimage_params *params,
+ uint32_t *aisptr)
+
+{
+ int dfd;
+ struct stat sbuf;
+ char *datafile = params->datafile;
+ void *ptr;
+
+ dfd = open(datafile, O_RDONLY|O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, dfd, 0);
+ *aisptr++ = AIS_CMD_LOAD;
+ *aisptr++ = params->ep;
+ *aisptr++ = sbuf.st_size;
+ memcpy((void *)aisptr, ptr, sbuf.st_size);
+ aisptr += WORD_ALIGN(sbuf.st_size) / sizeof(uint32_t);
+
+ (void) munmap((void *)ptr, sbuf.st_size);
+ (void) close(dfd);
+
+ return aisptr;
+
+}
+
+static int aisimage_generate(struct mkimage_params *params,
+ struct image_type_params *tparams)
+{
+ FILE *fd = NULL;
+ char *line = NULL;
+ char *token, *saveptr1, *saveptr2;
+ int lineno = 0;
+ int fld;
+ size_t len;
+ int32_t cmd;
+ uint32_t nargs, cmd_parms[10];
+ uint32_t value, size;
+ char *name = params->imagename;
+ uint32_t *aishdr, tsize;
+
+ fd = fopen(name, "r");
+ if (fd == 0) {
+ fprintf(stderr,
+ "Error: %s - Can't open AIS configuration\n", name);
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * the size of the header is variable and is computed
+ * scanning the configuration file.
+ */
+ tparams->header_size = 0;
+
+ /*
+ * Start allocating a buffer suitable for most command
+ * The buffer is then reallocated if it is too small
+ */
+ aishdr = ais_alloc_buffer(params);
+ tparams->hdr = aishdr;
+ *aishdr++ = AIS_MAGIC_WORD;
+
+ /* Very simple parsing, line starting with # are comments
+ * and are dropped
+ */
+ while ((getline(&line, &len, fd)) > 0) {
+ lineno++;
+
+ token = strtok_r(line, "\r\n", &saveptr1);
+ if (token == NULL)
+ continue;
+
+ /* Check inside the single line */
+ line = token;
+ fld = CFG_COMMAND;
+ cmd = CMD_INVALID;
+ nargs = 0;
+ while (token != NULL) {
+ token = strtok_r(line, " \t", &saveptr2);
+ if (token == NULL)
+ break;
+
+ /* Drop all text starting with '#' as comments */
+ if (token[0] == '#')
+ break;
+
+ switch (fld) {
+ case CFG_COMMAND:
+ cmd = get_table_entry_id(aisimage_cmds,
+ "aisimage commands", token);
+ if (cmd < 0) {
+ fprintf(stderr,
+ "Error: %s[%d] - Invalid command"
+ "(%s)\n", name, lineno, token);
+
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case CFG_VALUE:
+ value = get_cfg_value(token, name, lineno);
+ cmd_parms[nargs++] = value;
+ if (nargs > cmd_table[cmd].nargs) {
+ fprintf(stderr,
+ "Error: %s[%d] - too much arguments:"
+ "(%s) for command %s\n", name,
+ lineno, token,
+ aisimage_cmds[cmd].sname);
+ exit(EXIT_FAILURE);
+ }
+ break;
+ }
+ line = NULL;
+ fld = CFG_VALUE;
+ }
+ if (cmd != CMD_INVALID) {
+ /* Now insert the command into the header */
+ aishdr = ais_insert_cmd_header(cmd, nargs, cmd_parms,
+ tparams, aishdr, tsize);
+ }
+
+ }
+ fclose(fd);
+
+ aishdr = ais_copy_image(params, aishdr);
+
+ /* Add Jmp & Close */
+ *aishdr++ = AIS_CMD_JMPCLOSE;
+ *aishdr++ = params->ep;
+
+ size = (aishdr - (uint32_t *)tparams->hdr) * sizeof(uint32_t);
+ tparams->header_size = size;
+
+ return 0;
+}
+
+static int aisimage_check_image_types(uint8_t type)
+{
+ if (type == IH_TYPE_AISIMAGE)
+ return EXIT_SUCCESS;
+ else
+ return EXIT_FAILURE;
+}
+
+static int aisimage_verify_header(unsigned char *ptr, int image_size,
+ struct mkimage_params *params)
+{
+ struct ais_header *ais_hdr = (struct ais_header *)ptr;
+
+ if (ais_hdr->magic != AIS_MAGIC_WORD)
+ return -FDT_ERR_BADSTRUCTURE;
+
+ /* Store the total size to remember in print_hdr */
+ ais_img_size = image_size;
+
+ return 0;
+}
+
+static void aisimage_set_header(void *ptr, struct stat *sbuf, int ifd,
+ struct mkimage_params *params)
+{
+}
+
+int aisimage_check_params(struct mkimage_params *params)
+{
+ if (!params)
+ return CFG_INVALID;
+ if (!strlen(params->imagename)) {
+ fprintf(stderr, "Error: %s - Configuration file not specified, "
+ "it is needed for aisimage generation\n",
+ params->cmdname);
+ return CFG_INVALID;
+ }
+ /*
+ * Check parameters:
+ * XIP is not allowed and verify that incompatible
+ * parameters are not sent at the same time
+ * For example, if list is required a data image must not be provided
+ */
+ return (params->dflag && (params->fflag || params->lflag)) ||
+ (params->fflag && (params->dflag || params->lflag)) ||
+ (params->lflag && (params->dflag || params->fflag)) ||
+ (params->xflag) || !(strlen(params->imagename));
+}
+
+/*
+ * aisimage parameters
+ */
+static struct image_type_params aisimage_params = {
+ .name = "TI Davinci AIS Boot Image support",
+ .header_size = 0,
+ .hdr = NULL,
+ .check_image_type = aisimage_check_image_types,
+ .verify_header = aisimage_verify_header,
+ .print_header = aisimage_print_header,
+ .set_header = aisimage_set_header,
+ .check_params = aisimage_check_params,
+ .vrec_header = aisimage_generate,
+};
+
+void init_ais_image_type(void)
+{
+ mkimage_register(&aisimage_params);
+}
diff --git a/tools/aisimage.h b/tools/aisimage.h
new file mode 100644
index 0000000..a6372b8
--- /dev/null
+++ b/tools/aisimage.h
@@ -0,0 +1,97 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _AISIMAGE_H_
+#define _AISIMAGE_H_
+
+/* all values are for little endian systems */
+#define AIS_MAGIC_WORD 0x41504954
+#define AIS_FCN_MAX 8
+
+enum {
+ AIS_CMD_LOAD = 0x58535901,
+ AIS_CMD_VALCRC = 0x58535902,
+ AIS_CMD_ENCRC = 0x58535903,
+ AIS_CMD_DISCRC = 0x58535904,
+ AIS_CMD_JMP = 0x58535905,
+ AIS_CMD_JMPCLOSE = 0x58535906,
+ AIS_CMD_BOOTTBL = 0x58535907,
+ AIS_CMD_FILL = 0x5853590A,
+ AIS_CMD_FNLOAD = 0x5853590D,
+ AIS_CMD_SEQREAD = 0x58535963,
+};
+
+struct ais_cmd_load {
+ uint32_t cmd;
+ uint32_t addr;
+ uint32_t size;
+ uint32_t data[1];
+};
+
+struct ais_cmd_func {
+ uint32_t cmd;
+ uint32_t func_args;
+ uint32_t parms[AIS_FCN_MAX];
+};
+
+struct ais_cmd_jmpclose {
+ uint32_t cmd;
+ uint32_t addr;
+};
+
+#define CMD_DATA_STR "DATA"
+
+enum ais_file_cmd {
+ CMD_INVALID,
+ CMD_FILL,
+ CMD_CRCON,
+ CMD_CRCOFF,
+ CMD_CRCCHECK,
+ CMD_JMPCLOSE,
+ CMD_JMP,
+ CMD_SEQREAD,
+ CMD_DATA,
+ CMD_PLL0,
+ CMD_PLL1,
+ CMD_CLK,
+ CMD_DDR2,
+ CMD_EMIFA,
+ CMD_EMIFA_ASYNC,
+ CMD_PLL,
+ CMD_PSC,
+ CMD_PINMUX,
+ CMD_BOOTTABLE
+};
+
+enum aisimage_fld_types {
+ CFG_INVALID = -1,
+ CFG_COMMAND,
+ CFG_VALUE,
+};
+
+struct ais_header {
+ uint32_t magic;
+ char data[1];
+};
+
+#endif /* _AISIMAGE_H_ */
diff --git a/tools/mkimage.c b/tools/mkimage.c
index c307a37..36e28ec 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -162,6 +162,8 @@ main (int argc, char **argv)
init_default_image_type ();
/* Init Davinci UBL support */
init_ubl_image_type();
+ /* Init Davinci AIS support */
+ init_ais_image_type();
params.cmdname = *argv;
params.addr = params.ep = 0;
diff --git a/tools/mkimage.h b/tools/mkimage.h
index 213baf0..5fe1a48 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -147,6 +147,7 @@ void mkimage_register (struct image_type_params *tparams);
*
* Supported image types init functions
*/
+void init_ais_image_type(void);
void init_kwb_image_type (void);
void init_imx_image_type (void);
void init_default_image_type (void);
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image
2011-10-06 8:20 ` [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
@ 2011-10-15 20:23 ` Wolfgang Denk
2011-10-17 8:21 ` Stefano Babic
0 siblings, 1 reply; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-15 20:23 UTC (permalink / raw)
To: u-boot
Dear Stefano Babic,
In message <1317889214-10567-1-git-send-email-sbabic@denx.de> you wrote:
> Some Davinci processors supports the Application
> Image Script (AIS) boot process. The patch adds the generation
> of the AIS image inside the mkimage tool to make possible
> to generate a bootable U-boot without external tools
> (TI Davinci AIS Generator).
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Wolfgang Denk <wd@denx.de>
>
> ---
>
> Changes:
> - removed warning in gcc 4.6 iwhen -Wunused-but-set-variable is set
> - drop remained warnings raised by checkpatch
>
> common/image.c | 1 +
> include/image.h | 1 +
> tools/Makefile | 4 +-
> tools/aisimage.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> tools/aisimage.h | 97 ++++++++++++
> tools/mkimage.c | 2 +
> tools/mkimage.h | 1 +
> 7 files changed, 556 insertions(+), 1 deletions(-)
> create mode 100644 tools/aisimage.c
> create mode 100644 tools/aisimage.h
This doesn't apply any more - please rebase, and keep list sorted.
Thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Felson's Law:
To steal ideas from one person is plagiarism; to steal from
many is research.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image
2011-10-15 20:23 ` Wolfgang Denk
@ 2011-10-17 8:21 ` Stefano Babic
2011-10-17 9:18 ` Wolfgang Denk
0 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2011-10-17 8:21 UTC (permalink / raw)
To: u-boot
On 10/15/2011 10:23 PM, Wolfgang Denk wrote:
> Dear Stefano Babic,
>
> In message <1317889214-10567-1-git-send-email-sbabic@denx.de> you wrote:
>> Some Davinci processors supports the Application
>> Image Script (AIS) boot process. The patch adds the generation
>> of the AIS image inside the mkimage tool to make possible
>> to generate a bootable U-boot without external tools
>> (TI Davinci AIS Generator).
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> CC: Wolfgang Denk <wd@denx.de>
>>
>
> This doesn't apply any more - please rebase, and keep list sorted.
Sure - I think the list you mean is uimage_type[], right ?
Stefano
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image
2011-10-17 8:21 ` Stefano Babic
@ 2011-10-17 9:18 ` Wolfgang Denk
0 siblings, 0 replies; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-17 9:18 UTC (permalink / raw)
To: u-boot
Dear Stefano Babic,
In message <4E9BE578.6000503@denx.de> you wrote:
>
> > This doesn't apply any more - please rebase, and keep list sorted.
>
> Sure - I think the list you mean is uimage_type[], right ?
Yes.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all you have is a hammer, everything looks like a nail.
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V3 3/3] mkimage: adding support for Davinci AIS image
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
` (4 preceding siblings ...)
2011-10-06 8:20 ` [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
@ 2011-10-17 10:07 ` Stefano Babic
2011-10-23 21:08 ` Wolfgang Denk
5 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2011-10-17 10:07 UTC (permalink / raw)
To: u-boot
Some Davinci processors supports the Application
Image Script (AIS) boot process. The patch adds the generation
of the AIS image inside the mkimage tool to make possible
to generate a bootable U-boot without external tools
(TI Davinci AIS Generator).
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Wolfgang Denk <wd@denx.de>
---
Changes since V2:
- rebased on mainline and sort uimage_type list (Wolfgang Denk)
Changes since V1:
- removed warning in gcc 4.6 iwhen -Wunused-but-set-variable is set
- drop remained warnings raised by checkpatch
common/image.c | 9 +-
include/image.h | 1 +
tools/Makefile | 4 +-
tools/aisimage.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/aisimage.h | 97 ++++++++++++
tools/mkimage.c | 2 +
tools/mkimage.h | 1 +
7 files changed, 560 insertions(+), 5 deletions(-)
create mode 100644 tools/aisimage.c
create mode 100644 tools/aisimage.h
diff --git a/common/image.c b/common/image.c
index ed6b26b..4ec7379 100644
--- a/common/image.c
+++ b/common/image.c
@@ -130,19 +130,20 @@ static const table_entry_t uimage_os[] = {
};
static const table_entry_t uimage_type[] = {
+ { IH_TYPE_AISIMAGE, "aisimage", "Davinci AIS image",},
{ IH_TYPE_FILESYSTEM, "filesystem", "Filesystem Image", },
{ IH_TYPE_FIRMWARE, "firmware", "Firmware", },
{ IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", },
{ IH_TYPE_KERNEL, "kernel", "Kernel Image", },
+ { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",},
+ { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",},
+ { IH_TYPE_INVALID, NULL, "Invalid Image", },
{ IH_TYPE_MULTI, "multi", "Multi-File Image", },
+ { IH_TYPE_OMAPIMAGE, "omapimage", "TI OMAP SPL With GP CH",},
{ IH_TYPE_RAMDISK, "ramdisk", "RAMDisk Image", },
{ IH_TYPE_SCRIPT, "script", "Script", },
{ IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
- { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",},
- { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",},
- { IH_TYPE_OMAPIMAGE, "omapimage", "TI OMAP SPL With GP CH",},
{ IH_TYPE_UBLIMAGE, "ublimage", "Davinci UBL image",},
- { IH_TYPE_INVALID, NULL, "Invalid Image", },
{ -1, "", "", },
};
diff --git a/include/image.h b/include/image.h
index cca1cc5..52a0cb4 100644
--- a/include/image.h
+++ b/include/image.h
@@ -159,6 +159,7 @@
#define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */
#define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */
#define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */
+#define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */
/*
* Compression Types
diff --git a/tools/Makefile b/tools/Makefile
index fc741d3..df56a25 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -86,6 +86,7 @@ NOPED_OBJ_FILES-y += fit_image.o
OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
+NOPED_OBJ_FILES-y += aisimage.o
NOPED_OBJ_FILES-y += kwbimage.o
NOPED_OBJ_FILES-y += imximage.o
NOPED_OBJ_FILES-y += omapimage.o
@@ -184,7 +185,8 @@ $(obj)xway-swap-bytes$(SFX): $(obj)xway-swap-bytes.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@
-$(obj)mkimage$(SFX): $(obj)crc32.o \
+$(obj)mkimage$(SFX): $(obj)aisimage.o \
+ $(obj)crc32.o \
$(obj)default_image.o \
$(obj)fit_image.o \
$(obj)image.o \
diff --git a/tools/aisimage.c b/tools/aisimage.c
new file mode 100644
index 0000000..6a10111
--- /dev/null
+++ b/tools/aisimage.c
@@ -0,0 +1,451 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* Required to obtain the getline prototype from stdio.h */
+#define _GNU_SOURCE
+
+#include "mkimage.h"
+#include "aisimage.h"
+#include <image.h>
+
+#define IS_FNC_EXEC(c) (cmd_table[c].AIS_cmd == AIS_CMD_FNLOAD)
+#define WORD_ALIGN0 4
+#define WORD_ALIGN(len) (((len)+WORD_ALIGN0-1) & ~(WORD_ALIGN0-1))
+#define MAX_CMD_BUFFER 4096
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+static uint32_t ais_img_size;
+
+/*
+ * Supported commands for configuration file
+ */
+static table_entry_t aisimage_cmds[] = {
+ {CMD_DATA, "DATA", "Reg Write Data"},
+ {CMD_FILL, "FILL", "Fill range with pattern"},
+ {CMD_CRCON, "CRCON", "CRC Enable"},
+ {CMD_CRCOFF, "CRCOFF", "CRC Disable"},
+ {CMD_CRCCHECK, "CRCCHECK", "CRC Validate"},
+ {CMD_JMPCLOSE, "JMPCLOSE", "Jump & Close"},
+ {CMD_JMP, "JMP", "Jump"},
+ {CMD_SEQREAD, "SEQREAD", "Sequential read"},
+ {CMD_PLL0, "PLL0", "PLL0"},
+ {CMD_PLL1, "PLL1", "PLL1"},
+ {CMD_CLK, "CLK", "Clock configuration"},
+ {CMD_DDR2, "DDR2", "DDR2 Configuration"},
+ {CMD_EMIFA, "EMIFA", "EMIFA"},
+ {CMD_EMIFA_ASYNC, "EMIFA_ASYNC", "EMIFA Async"},
+ {CMD_PLL, "PLL", "PLL & Clock configuration"},
+ {CMD_PSC, "PSC", "PSC setup"},
+ {CMD_PINMUX, "PINMUX", "Pinmux setup"},
+ {CMD_BOOTTABLE, "BOOT_TABLE", "Boot table command"},
+ {-1, "", ""},
+};
+
+static struct ais_func_exec {
+ uint32_t index;
+ uint32_t argcnt;
+} ais_func_table[] = {
+ [CMD_PLL0] = {0, 2},
+ [CMD_PLL1] = {1, 2},
+ [CMD_CLK] = {2, 1},
+ [CMD_DDR2] = {3, 8},
+ [CMD_EMIFA] = {4, 5},
+ [CMD_EMIFA_ASYNC] = {5, 5},
+ [CMD_PLL] = {6, 3},
+ [CMD_PSC] = {7, 1},
+ [CMD_PINMUX] = {8, 3}
+};
+
+static struct cmd_table_t {
+ uint32_t nargs;
+ uint32_t AIS_cmd;
+} cmd_table[] = {
+ [CMD_FILL] = { 4, AIS_CMD_FILL},
+ [CMD_CRCON] = { 0, AIS_CMD_ENCRC},
+ [CMD_CRCOFF] = { 0, AIS_CMD_DISCRC},
+ [CMD_CRCCHECK] = { 2, AIS_CMD_ENCRC},
+ [CMD_JMPCLOSE] = { 1, AIS_CMD_JMPCLOSE},
+ [CMD_JMP] = { 1, AIS_CMD_JMP},
+ [CMD_SEQREAD] = { 0, AIS_CMD_SEQREAD},
+ [CMD_PLL0] = { 2, AIS_CMD_FNLOAD},
+ [CMD_PLL1] = { 2, AIS_CMD_FNLOAD},
+ [CMD_CLK] = { 1, AIS_CMD_FNLOAD},
+ [CMD_DDR2] = { 8, AIS_CMD_FNLOAD},
+ [CMD_EMIFA] = { 5, AIS_CMD_FNLOAD},
+ [CMD_EMIFA_ASYNC] = { 5, AIS_CMD_FNLOAD},
+ [CMD_PLL] = { 3, AIS_CMD_FNLOAD},
+ [CMD_PSC] = { 1, AIS_CMD_FNLOAD},
+ [CMD_PINMUX] = { 3, AIS_CMD_FNLOAD},
+ [CMD_BOOTTABLE] = { 4, AIS_CMD_BOOTTBL},
+};
+
+static uint32_t get_cfg_value(char *token, char *name, int linenr)
+{
+ char *endptr;
+ uint32_t value;
+
+ errno = 0;
+ value = strtoul(token, &endptr, 16);
+ if (errno || (token == endptr)) {
+ fprintf(stderr, "Error: %s[%d] - Invalid hex data(%s)\n",
+ name, linenr, token);
+ exit(EXIT_FAILURE);
+ }
+ return value;
+}
+
+static int get_ais_table_id(uint32_t *ptr)
+{
+
+ int i;
+ int func_no;
+
+ for (i = 0; i < ARRAY_SIZE(cmd_table); i++) {
+ if (*ptr == cmd_table[i].AIS_cmd) {
+ if (cmd_table[i].AIS_cmd != AIS_CMD_FNLOAD)
+ return i;
+
+ func_no = ((struct ais_cmd_func *)ptr)->func_args
+ & 0xFFFF;
+ if (func_no == ais_func_table[i].index)
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+static void aisimage_print_header(const void *hdr)
+{
+ struct ais_header *ais_hdr = (struct ais_header *)hdr;
+ uint32_t *ptr;
+ struct ais_cmd_load *ais_load;
+ int id;
+
+ if (ais_hdr->magic != AIS_MAGIC_WORD) {
+ fprintf(stderr, "Error: - AIS Magic Number not found\n");
+ return;
+ }
+ fprintf(stdout, "Image Type: TI Davinci AIS Boot Image\n");
+ fprintf(stdout, "AIS magic : %08x\n", ais_hdr->magic);
+ ptr = (uint32_t *)&ais_hdr->magic;
+ ptr++;
+
+ while (*ptr != AIS_CMD_JMPCLOSE) {
+ /* Check if we find the image */
+ if (*ptr == AIS_CMD_LOAD) {
+ ais_load = (struct ais_cmd_load *)ptr;
+ fprintf(stdout, "Image at : 0x%08x size 0x%08x\n",
+ ais_load->addr,
+ ais_load->size);
+ ptr = ais_load->data + ais_load->size / sizeof(*ptr);
+ continue;
+ }
+
+ id = get_ais_table_id(ptr);
+ if (id < 0) {
+ fprintf(stderr, "Error: - AIS Image corrupted\n");
+ return;
+ }
+ fprintf(stdout, "AIS cmd : %s\n",
+ get_table_entry_name(aisimage_cmds, NULL, id));
+ ptr += cmd_table[id].nargs + IS_FNC_EXEC(id) + 1;
+ if (((void *)ptr - hdr) > ais_img_size) {
+ fprintf(stderr,
+ "AIS Image not terminated by JMPCLOSE\n");
+ return;
+ }
+ }
+}
+
+static uint32_t *ais_insert_cmd_header(uint32_t cmd, uint32_t nargs,
+ uint32_t *parms, struct image_type_params *tparams,
+ uint32_t *ptr, uint32_t size)
+{
+ int i;
+
+ *ptr++ = cmd_table[cmd].AIS_cmd;
+ if (IS_FNC_EXEC(cmd))
+ *ptr++ = ((nargs & 0xFFFF) << 16) + ais_func_table[cmd].index;
+
+ /* Copy parameters */
+ for (i = 0; i < nargs; i++)
+ *ptr++ = cpu_to_le32(parms[i]);
+
+ return ptr;
+
+}
+
+static uint32_t *ais_alloc_buffer(struct mkimage_params *params)
+{
+ int dfd;
+ struct stat sbuf;
+ char *datafile = params->datafile;
+ uint32_t *ptr;
+
+ dfd = open(datafile, O_RDONLY|O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Place for header is allocated. The size is taken from
+ * the size of the datafile, that the ais_image_generate()
+ * will copy into the header. Copying the datafile
+ * is not left to the main program, because after the datafile
+ * the header must be terminated with the Jump & Close command.
+ */
+ ais_img_size = WORD_ALIGN(sbuf.st_size) + MAX_CMD_BUFFER;
+ ptr = (uint32_t *)malloc(WORD_ALIGN(sbuf.st_size) + MAX_CMD_BUFFER);
+ if (!ptr) {
+ fprintf(stderr, "%s: malloc return failure: %s\n",
+ params->cmdname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ close(dfd);
+
+ return ptr;
+}
+
+static uint32_t *ais_copy_image(struct mkimage_params *params,
+ uint32_t *aisptr)
+
+{
+ int dfd;
+ struct stat sbuf;
+ char *datafile = params->datafile;
+ void *ptr;
+
+ dfd = open(datafile, O_RDONLY|O_BINARY);
+ if (dfd < 0) {
+ fprintf(stderr, "%s: Can't open %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ if (fstat(dfd, &sbuf) < 0) {
+ fprintf(stderr, "%s: Can't stat %s: %s\n",
+ params->cmdname, datafile, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, dfd, 0);
+ *aisptr++ = AIS_CMD_LOAD;
+ *aisptr++ = params->ep;
+ *aisptr++ = sbuf.st_size;
+ memcpy((void *)aisptr, ptr, sbuf.st_size);
+ aisptr += WORD_ALIGN(sbuf.st_size) / sizeof(uint32_t);
+
+ (void) munmap((void *)ptr, sbuf.st_size);
+ (void) close(dfd);
+
+ return aisptr;
+
+}
+
+static int aisimage_generate(struct mkimage_params *params,
+ struct image_type_params *tparams)
+{
+ FILE *fd = NULL;
+ char *line = NULL;
+ char *token, *saveptr1, *saveptr2;
+ int lineno = 0;
+ int fld;
+ size_t len;
+ int32_t cmd;
+ uint32_t nargs, cmd_parms[10];
+ uint32_t value, size;
+ char *name = params->imagename;
+ uint32_t *aishdr, tsize;
+
+ fd = fopen(name, "r");
+ if (fd == 0) {
+ fprintf(stderr,
+ "Error: %s - Can't open AIS configuration\n", name);
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * the size of the header is variable and is computed
+ * scanning the configuration file.
+ */
+ tparams->header_size = 0;
+
+ /*
+ * Start allocating a buffer suitable for most command
+ * The buffer is then reallocated if it is too small
+ */
+ aishdr = ais_alloc_buffer(params);
+ tparams->hdr = aishdr;
+ *aishdr++ = AIS_MAGIC_WORD;
+
+ /* Very simple parsing, line starting with # are comments
+ * and are dropped
+ */
+ while ((getline(&line, &len, fd)) > 0) {
+ lineno++;
+
+ token = strtok_r(line, "\r\n", &saveptr1);
+ if (token == NULL)
+ continue;
+
+ /* Check inside the single line */
+ line = token;
+ fld = CFG_COMMAND;
+ cmd = CMD_INVALID;
+ nargs = 0;
+ while (token != NULL) {
+ token = strtok_r(line, " \t", &saveptr2);
+ if (token == NULL)
+ break;
+
+ /* Drop all text starting with '#' as comments */
+ if (token[0] == '#')
+ break;
+
+ switch (fld) {
+ case CFG_COMMAND:
+ cmd = get_table_entry_id(aisimage_cmds,
+ "aisimage commands", token);
+ if (cmd < 0) {
+ fprintf(stderr,
+ "Error: %s[%d] - Invalid command"
+ "(%s)\n", name, lineno, token);
+
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case CFG_VALUE:
+ value = get_cfg_value(token, name, lineno);
+ cmd_parms[nargs++] = value;
+ if (nargs > cmd_table[cmd].nargs) {
+ fprintf(stderr,
+ "Error: %s[%d] - too much arguments:"
+ "(%s) for command %s\n", name,
+ lineno, token,
+ aisimage_cmds[cmd].sname);
+ exit(EXIT_FAILURE);
+ }
+ break;
+ }
+ line = NULL;
+ fld = CFG_VALUE;
+ }
+ if (cmd != CMD_INVALID) {
+ /* Now insert the command into the header */
+ aishdr = ais_insert_cmd_header(cmd, nargs, cmd_parms,
+ tparams, aishdr, tsize);
+ }
+
+ }
+ fclose(fd);
+
+ aishdr = ais_copy_image(params, aishdr);
+
+ /* Add Jmp & Close */
+ *aishdr++ = AIS_CMD_JMPCLOSE;
+ *aishdr++ = params->ep;
+
+ size = (aishdr - (uint32_t *)tparams->hdr) * sizeof(uint32_t);
+ tparams->header_size = size;
+
+ return 0;
+}
+
+static int aisimage_check_image_types(uint8_t type)
+{
+ if (type == IH_TYPE_AISIMAGE)
+ return EXIT_SUCCESS;
+ else
+ return EXIT_FAILURE;
+}
+
+static int aisimage_verify_header(unsigned char *ptr, int image_size,
+ struct mkimage_params *params)
+{
+ struct ais_header *ais_hdr = (struct ais_header *)ptr;
+
+ if (ais_hdr->magic != AIS_MAGIC_WORD)
+ return -FDT_ERR_BADSTRUCTURE;
+
+ /* Store the total size to remember in print_hdr */
+ ais_img_size = image_size;
+
+ return 0;
+}
+
+static void aisimage_set_header(void *ptr, struct stat *sbuf, int ifd,
+ struct mkimage_params *params)
+{
+}
+
+int aisimage_check_params(struct mkimage_params *params)
+{
+ if (!params)
+ return CFG_INVALID;
+ if (!strlen(params->imagename)) {
+ fprintf(stderr, "Error: %s - Configuration file not specified, "
+ "it is needed for aisimage generation\n",
+ params->cmdname);
+ return CFG_INVALID;
+ }
+ /*
+ * Check parameters:
+ * XIP is not allowed and verify that incompatible
+ * parameters are not sent at the same time
+ * For example, if list is required a data image must not be provided
+ */
+ return (params->dflag && (params->fflag || params->lflag)) ||
+ (params->fflag && (params->dflag || params->lflag)) ||
+ (params->lflag && (params->dflag || params->fflag)) ||
+ (params->xflag) || !(strlen(params->imagename));
+}
+
+/*
+ * aisimage parameters
+ */
+static struct image_type_params aisimage_params = {
+ .name = "TI Davinci AIS Boot Image support",
+ .header_size = 0,
+ .hdr = NULL,
+ .check_image_type = aisimage_check_image_types,
+ .verify_header = aisimage_verify_header,
+ .print_header = aisimage_print_header,
+ .set_header = aisimage_set_header,
+ .check_params = aisimage_check_params,
+ .vrec_header = aisimage_generate,
+};
+
+void init_ais_image_type(void)
+{
+ mkimage_register(&aisimage_params);
+}
diff --git a/tools/aisimage.h b/tools/aisimage.h
new file mode 100644
index 0000000..a6372b8
--- /dev/null
+++ b/tools/aisimage.h
@@ -0,0 +1,97 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _AISIMAGE_H_
+#define _AISIMAGE_H_
+
+/* all values are for little endian systems */
+#define AIS_MAGIC_WORD 0x41504954
+#define AIS_FCN_MAX 8
+
+enum {
+ AIS_CMD_LOAD = 0x58535901,
+ AIS_CMD_VALCRC = 0x58535902,
+ AIS_CMD_ENCRC = 0x58535903,
+ AIS_CMD_DISCRC = 0x58535904,
+ AIS_CMD_JMP = 0x58535905,
+ AIS_CMD_JMPCLOSE = 0x58535906,
+ AIS_CMD_BOOTTBL = 0x58535907,
+ AIS_CMD_FILL = 0x5853590A,
+ AIS_CMD_FNLOAD = 0x5853590D,
+ AIS_CMD_SEQREAD = 0x58535963,
+};
+
+struct ais_cmd_load {
+ uint32_t cmd;
+ uint32_t addr;
+ uint32_t size;
+ uint32_t data[1];
+};
+
+struct ais_cmd_func {
+ uint32_t cmd;
+ uint32_t func_args;
+ uint32_t parms[AIS_FCN_MAX];
+};
+
+struct ais_cmd_jmpclose {
+ uint32_t cmd;
+ uint32_t addr;
+};
+
+#define CMD_DATA_STR "DATA"
+
+enum ais_file_cmd {
+ CMD_INVALID,
+ CMD_FILL,
+ CMD_CRCON,
+ CMD_CRCOFF,
+ CMD_CRCCHECK,
+ CMD_JMPCLOSE,
+ CMD_JMP,
+ CMD_SEQREAD,
+ CMD_DATA,
+ CMD_PLL0,
+ CMD_PLL1,
+ CMD_CLK,
+ CMD_DDR2,
+ CMD_EMIFA,
+ CMD_EMIFA_ASYNC,
+ CMD_PLL,
+ CMD_PSC,
+ CMD_PINMUX,
+ CMD_BOOTTABLE
+};
+
+enum aisimage_fld_types {
+ CFG_INVALID = -1,
+ CFG_COMMAND,
+ CFG_VALUE,
+};
+
+struct ais_header {
+ uint32_t magic;
+ char data[1];
+};
+
+#endif /* _AISIMAGE_H_ */
diff --git a/tools/mkimage.c b/tools/mkimage.c
index c307a37..36e28ec 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -162,6 +162,8 @@ main (int argc, char **argv)
init_default_image_type ();
/* Init Davinci UBL support */
init_ubl_image_type();
+ /* Init Davinci AIS support */
+ init_ais_image_type();
params.cmdname = *argv;
params.addr = params.ep = 0;
diff --git a/tools/mkimage.h b/tools/mkimage.h
index 213baf0..5fe1a48 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -147,6 +147,7 @@ void mkimage_register (struct image_type_params *tparams);
*
* Supported image types init functions
*/
+void init_ais_image_type(void);
void init_kwb_image_type (void);
void init_imx_image_type (void);
void init_default_image_type (void);
--
1.7.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V3 3/3] mkimage: adding support for Davinci AIS image
2011-10-17 10:07 ` [U-Boot] [PATCH V3 " Stefano Babic
@ 2011-10-23 21:08 ` Wolfgang Denk
2011-10-29 16:51 ` Dirk Behme
0 siblings, 1 reply; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-23 21:08 UTC (permalink / raw)
To: u-boot
Dear Stefano Babic,
In message <1318846063-9496-1-git-send-email-sbabic@denx.de> you wrote:
> Some Davinci processors supports the Application
> Image Script (AIS) boot process. The patch adds the generation
> of the AIS image inside the mkimage tool to make possible
> to generate a bootable U-boot without external tools
> (TI Davinci AIS Generator).
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Wolfgang Denk <wd@denx.de>
> ---
>
> Changes since V2:
> - rebased on mainline and sort uimage_type list (Wolfgang Denk)
>
> Changes since V1:
> - removed warning in gcc 4.6 iwhen -Wunused-but-set-variable is set
> - drop remained warnings raised by checkpatch
>
>
> common/image.c | 9 +-
> include/image.h | 1 +
> tools/Makefile | 4 +-
> tools/aisimage.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> tools/aisimage.h | 97 ++++++++++++
> tools/mkimage.c | 2 +
> tools/mkimage.h | 1 +
> 7 files changed, 560 insertions(+), 5 deletions(-)
> create mode 100644 tools/aisimage.c
> create mode 100644 tools/aisimage.h
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Plan to throw one away. You will anyway."
- Fred Brooks, "The Mythical Man Month"
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V3 3/3] mkimage: adding support for Davinci AIS image
2011-10-23 21:08 ` Wolfgang Denk
@ 2011-10-29 16:51 ` Dirk Behme
2011-10-30 7:29 ` stefano babic
0 siblings, 1 reply; 19+ messages in thread
From: Dirk Behme @ 2011-10-29 16:51 UTC (permalink / raw)
To: u-boot
On 23.10.2011 23:08, Wolfgang Denk wrote:
> Dear Stefano Babic,
>
> In message<1318846063-9496-1-git-send-email-sbabic@denx.de> you wrote:
>> Some Davinci processors supports the Application
>> Image Script (AIS) boot process. The patch adds the generation
>> of the AIS image inside the mkimage tool to make possible
>> to generate a bootable U-boot without external tools
>> (TI Davinci AIS Generator).
>>
>> Signed-off-by: Stefano Babic<sbabic@denx.de>
>> CC: Wolfgang Denk<wd@denx.de>
>> ---
>>
>> Changes since V2:
>> - rebased on mainline and sort uimage_type list (Wolfgang Denk)
>>
>> Changes since V1:
>> - removed warning in gcc 4.6 iwhen -Wunused-but-set-variable is set
>> - drop remained warnings raised by checkpatch
>>
>>
>> common/image.c | 9 +-
>> include/image.h | 1 +
>> tools/Makefile | 4 +-
>> tools/aisimage.c | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hmm, using recent git head this results in
aisimage.c: In function ?aisimage_generate?:
aisimage.c:365: warning: ?tsize? may be used uninitialized in this
function
for each board I build :(
E.g.
Configuring for omap3_evm board...
aisimage.c: In function ?aisimage_generate?:
aisimage.c:365: warning: ?tsize? may be used uninitialized in this
function
text data bss dec hex filename
256063 7512 259120 522695 7f9c7 ./u-boot
Dirk
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V3 3/3] mkimage: adding support for Davinci AIS image
2011-10-29 16:51 ` Dirk Behme
@ 2011-10-30 7:29 ` stefano babic
2011-10-30 8:23 ` Dirk Behme
0 siblings, 1 reply; 19+ messages in thread
From: stefano babic @ 2011-10-30 7:29 UTC (permalink / raw)
To: u-boot
Am 29/10/2011 18:51, schrieb Dirk Behme:
>
> Hmm, using recent git head this results in
Hi Remy,
>
> aisimage.c: In function ?aisimage_generate?:
> aisimage.c:365: warning: ?tsize? may be used uninitialized in this function
>
> for each board I build :(
>
> E.g.
>
> Configuring for omap3_evm board...
> aisimage.c: In function ?aisimage_generate?:
> aisimage.c:365: warning: ?tsize? may be used uninitialized in this function
> text data bss dec hex filename
> 256063 7512 259120 522695 7f9c7 ./u-boot
Apart from the fact that the tsize parameter is not needed anymore and I
will fix it, can I ask you which toolchain and which gcc have you used ?
I have tried with a very old gcc 4.2.2 (ELDK-4.2) and gcc 4.6.1
(ELDK-5.1). With the last one I get a warning, but for another reason:
./MAKEALL omap3_evm
Configuring for omap3_evm board...
musb_hcd.c: In function 'submit_control_msg':
musb_hcd.c:851:6: warning: variable 'csr' set but not used
[-Wunused-but-set-variable]
text data bss dec hex filename
250892 7472 259120 517484 7e56c ./u-boot
No warning with older gcc.
Stefano
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V3 3/3] mkimage: adding support for Davinci AIS image
2011-10-30 7:29 ` stefano babic
@ 2011-10-30 8:23 ` Dirk Behme
2011-10-30 13:14 ` Wolfgang Denk
0 siblings, 1 reply; 19+ messages in thread
From: Dirk Behme @ 2011-10-30 8:23 UTC (permalink / raw)
To: u-boot
On 30.10.2011 08:29, stefano babic wrote:
> Am 29/10/2011 18:51, schrieb Dirk Behme:
>
>>
>> Hmm, using recent git head this results in
>
> Hi Remy,
>
>>
>> aisimage.c: In function ?aisimage_generate?:
>> aisimage.c:365: warning: ?tsize? may be used uninitialized in this function
>>
>> for each board I build :(
>>
>> E.g.
>>
>> Configuring for omap3_evm board...
>> aisimage.c: In function ?aisimage_generate?:
>> aisimage.c:365: warning: ?tsize? may be used uninitialized in this function
>> text data bss dec hex filename
>> 256063 7512 259120 522695 7f9c7 ./u-boot
>
> Apart from the fact that the tsize parameter is not needed anymore and I
> will fix it, can I ask you which toolchain and which gcc have you used ?
Seems I still have the good old
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)
in my path.
Best regards
Dirk
> I have tried with a very old gcc 4.2.2 (ELDK-4.2) and gcc 4.6.1
> (ELDK-5.1). With the last one I get a warning, but for another reason:
>
> ./MAKEALL omap3_evm
> Configuring for omap3_evm board...
> musb_hcd.c: In function 'submit_control_msg':
> musb_hcd.c:851:6: warning: variable 'csr' set but not used
> [-Wunused-but-set-variable]
> text data bss dec hex filename
> 250892 7472 259120 517484 7e56c ./u-boot
>
> No warning with older gcc.
>
> Stefano
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH V3 3/3] mkimage: adding support for Davinci AIS image
2011-10-30 8:23 ` Dirk Behme
@ 2011-10-30 13:14 ` Wolfgang Denk
0 siblings, 0 replies; 19+ messages in thread
From: Wolfgang Denk @ 2011-10-30 13:14 UTC (permalink / raw)
To: u-boot
Dear Dirk Behme,
In message <4EAD0969.2030209@googlemail.com> you wrote:
>
> Seems I still have the good old
>
> gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)
>
> in my path.
IIRC, gcc 4.3.x has never been "good" in any way, especially not on ARM.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If it has syntax, it isn't user friendly.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2011-10-30 13:14 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16 9:50 [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Stefano Babic
2011-09-16 9:50 ` [U-Boot] [PATCH 2/3] mkimage: Add variable lenght header support Stefano Babic
2011-10-05 18:56 ` Wolfgang Denk
2011-09-16 9:50 ` [U-Boot] [PATCH 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
2011-10-05 18:56 ` Wolfgang Denk
2011-10-05 20:21 ` Wolfgang Denk
2011-09-16 10:03 ` [U-Boot] [PATCH 1/3] mkimage: ublimage must return if the header is not verified Heiko Schocher
2011-09-22 10:25 ` [U-Boot] [PATCH V2 " Stefano Babic
2011-10-05 18:55 ` Wolfgang Denk
2011-10-06 8:20 ` [U-Boot] [PATCH v2 3/3] mkimage: adding support for Davinci AIS image Stefano Babic
2011-10-15 20:23 ` Wolfgang Denk
2011-10-17 8:21 ` Stefano Babic
2011-10-17 9:18 ` Wolfgang Denk
2011-10-17 10:07 ` [U-Boot] [PATCH V3 " Stefano Babic
2011-10-23 21:08 ` Wolfgang Denk
2011-10-29 16:51 ` Dirk Behme
2011-10-30 7:29 ` stefano babic
2011-10-30 8:23 ` Dirk Behme
2011-10-30 13:14 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.