* [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage
@ 2012-05-20 16:53 Stijn Souffriau
2012-05-20 19:00 ` Mike Frysinger
2012-05-21 6:30 ` Heiko Schocher
0 siblings, 2 replies; 4+ messages in thread
From: Stijn Souffriau @ 2012-05-20 16:53 UTC (permalink / raw)
To: u-boot
---
tools/ublimage.c | 19 +++++++++++++++++++
tools/ublimage.h | 2 ++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/tools/ublimage.c b/tools/ublimage.c
index d6b4017..527b1a4 100644
--- a/tools/ublimage.c
+++ b/tools/ublimage.c
@@ -36,6 +36,10 @@
#include <image.h>
#include "ublimage.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
/*
* Supported commands for configuration file
*/
@@ -59,6 +63,7 @@ static table_entry_t ublimage_cmds[] = {
*/
static table_entry_t ublimage_bootops[] = {
{UBL_MAGIC_SAFE, "safe", "Safe boot mode", },
+ {UBL_MAGIC_UBOOT, "uboot", "Make u-boot header", },
{-1, "", "Invalid", },
};
@@ -89,6 +94,18 @@ static void print_hdr(struct ubl_header *ubl_hdr)
printf("start page : %08x\n", ubl_hdr->page);
}
+static uint32_t getDataPageSize() {
+ uint32_t size = 0;
+ struct stat buf;
+ int rv = stat(params.datafile, &buf);
+ if (rv == 0) {
+ size = (buf.st_size/UBL_BLOCK_SIZE) + (buf.st_size % UBL_BLOCK_SIZE == 0 ? 0 : 1);
+ } else {
+ fprintf(stderr, "Error: could not stat datafile %s\n", params.datafile);
+ }
+ return size;
+}
+
static void parse_cfg_cmd(struct ubl_header *ublhdr, int32_t cmd, char *token,
char *name, int lineno, int fld, int dcd_len)
{
@@ -171,6 +188,8 @@ static uint32_t parse_cfg_file(struct ubl_header *ublhdr, char *name)
*ptr = 0xff;
ptr++;
}
+
+ ublhdr->pages = getDataPageSize();
/*
* Very simple parsing, line starting with # are comments
diff --git a/tools/ublimage.h b/tools/ublimage.h
index e440625..35dee42 100644
--- a/tools/ublimage.h
+++ b/tools/ublimage.h
@@ -61,6 +61,8 @@ enum ublimage_fld_types {
#define UBL_MAGIC_DMA_IC (0x44)
/* DMA + ICache + Fast EMIF boot mode */
#define UBL_MAGIC_DMA_IC_FAST (0x55)
+/* UBOOT header identifier for UBL */
+#define UBL_MAGIC_UBOOT (0x66)
/* Define max UBL image size */
#define UBL_IMAGE_SIZE (0x00003800u)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage
2012-05-20 16:53 [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage Stijn Souffriau
@ 2012-05-20 19:00 ` Mike Frysinger
2012-05-21 6:30 ` Heiko Schocher
1 sibling, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2012-05-20 19:00 UTC (permalink / raw)
To: u-boot
On Sunday 20 May 2012 12:53:06 Stijn Souffriau wrote:
> --- a/tools/ublimage.c
> +++ b/tools/ublimage.c
>
> +static uint32_t getDataPageSize() {
don't use CamelCase in naming things. use "(void)" not "()". uncuddle the
brace with function definitions.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120520/19c924b4/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage
2012-05-20 16:53 [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage Stijn Souffriau
2012-05-20 19:00 ` Mike Frysinger
@ 2012-05-21 6:30 ` Heiko Schocher
2012-06-02 15:39 ` Stijn Souffriau
1 sibling, 1 reply; 4+ messages in thread
From: Heiko Schocher @ 2012-05-21 6:30 UTC (permalink / raw)
To: u-boot
Hello Stijn,
Stijn Souffriau wrote:
> ---
> tools/ublimage.c | 19 +++++++++++++++++++
> tools/ublimage.h | 2 ++
> 2 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/tools/ublimage.c b/tools/ublimage.c
> index d6b4017..527b1a4 100644
> --- a/tools/ublimage.c
> +++ b/tools/ublimage.c
> @@ -36,6 +36,10 @@
> #include <image.h>
> #include "ublimage.h"
>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <unistd.h>
> +
> /*
> * Supported commands for configuration file
> */
> @@ -59,6 +63,7 @@ static table_entry_t ublimage_cmds[] = {
> */
> static table_entry_t ublimage_bootops[] = {
> {UBL_MAGIC_SAFE, "safe", "Safe boot mode", },
> + {UBL_MAGIC_UBOOT, "uboot", "Make u-boot header", },
Hmm... what is UBL_MAGIC_UBOOT? Could you explain this?
This list should contain "UBL Signatures and Special Modes" from
the UBL descriptor defined in your processor manual (fast looked
for the dm368 in sprufg5a.pdf table 110 ... a 0x66 fit to
"UBL_MAGIC_PLL" = "With PLL enabled to have higher ARM/DMA clocks")
> {-1, "", "Invalid", },
> };
>
> @@ -89,6 +94,18 @@ static void print_hdr(struct ubl_header *ubl_hdr)
> printf("start page : %08x\n", ubl_hdr->page);
> }
>
> +static uint32_t getDataPageSize() {
> + uint32_t size = 0;
> + struct stat buf;
> + int rv = stat(params.datafile, &buf);
> + if (rv == 0) {
> + size = (buf.st_size/UBL_BLOCK_SIZE) + (buf.st_size % UBL_BLOCK_SIZE == 0 ? 0 : 1);
> + } else {
> + fprintf(stderr, "Error: could not stat datafile %s\n", params.datafile);
> + }
> + return size;
> +}
> +
> static void parse_cfg_cmd(struct ubl_header *ublhdr, int32_t cmd, char *token,
> char *name, int lineno, int fld, int dcd_len)
> {
> @@ -171,6 +188,8 @@ static uint32_t parse_cfg_file(struct ubl_header *ublhdr, char *name)
> *ptr = 0xff;
> ptr++;
> }
> +
> + ublhdr->pages = getDataPageSize();
>
> /*
> * Very simple parsing, line starting with # are comments
> diff --git a/tools/ublimage.h b/tools/ublimage.h
> index e440625..35dee42 100644
> --- a/tools/ublimage.h
> +++ b/tools/ublimage.h
> @@ -61,6 +61,8 @@ enum ublimage_fld_types {
> #define UBL_MAGIC_DMA_IC (0x44)
> /* DMA + ICache + Fast EMIF boot mode */
> #define UBL_MAGIC_DMA_IC_FAST (0x55)
> +/* UBOOT header identifier for UBL */
> +#define UBL_MAGIC_UBOOT (0x66)
Hmm.. see above comment, and comment in source code ...
please explain here more, what you want to do.
> /* Define max UBL image size */
> #define UBL_IMAGE_SIZE (0x00003800u)
bye,
Heiko
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage
2012-05-21 6:30 ` Heiko Schocher
@ 2012-06-02 15:39 ` Stijn Souffriau
0 siblings, 0 replies; 4+ messages in thread
From: Stijn Souffriau @ 2012-06-02 15:39 UTC (permalink / raw)
To: u-boot
On 05/21/2012 08:30 AM, Heiko Schocher wrote:
> Hello Stijn,
>
> Stijn Souffriau wrote:
>> ---
>> tools/ublimage.c | 19 +++++++++++++++++++
>> tools/ublimage.h | 2 ++
>> 2 files changed, 21 insertions(+), 0 deletions(-)
>>
>> diff --git a/tools/ublimage.c b/tools/ublimage.c
>> index d6b4017..527b1a4 100644
>> --- a/tools/ublimage.c
>> +++ b/tools/ublimage.c
>> @@ -36,6 +36,10 @@
>> #include<image.h>
>> #include "ublimage.h"
>>
>> +#include<sys/types.h>
>> +#include<sys/stat.h>
>> +#include<unistd.h>
>> +
>> /*
>> * Supported commands for configuration file
>> */
>> @@ -59,6 +63,7 @@ static table_entry_t ublimage_cmds[] = {
>> */
>> static table_entry_t ublimage_bootops[] = {
>> {UBL_MAGIC_SAFE, "safe", "Safe boot mode", },
>> + {UBL_MAGIC_UBOOT, "uboot", "Make u-boot header", },
> Hmm... what is UBL_MAGIC_UBOOT? Could you explain this?
>
> This list should contain "UBL Signatures and Special Modes" from
> the UBL descriptor defined in your processor manual (fast looked
> for the dm368 in sprufg5a.pdf table 110 ... a 0x66 fit to
> "UBL_MAGIC_PLL" = "With PLL enabled to have higher ARM/DMA clocks")
Well I didn't know that, I saw it in all the u-boot headers so I named
it accordingly. I can change it to it's proper name to avoid confusion.
Thanks!
>
>> {-1, "", "Invalid", },
>> };
>>
>> @@ -89,6 +94,18 @@ static void print_hdr(struct ubl_header *ubl_hdr)
>> printf("start page : %08x\n", ubl_hdr->page);
>> }
>>
>> +static uint32_t getDataPageSize() {
>> + uint32_t size = 0;
>> + struct stat buf;
>> + int rv = stat(params.datafile,&buf);
>> + if (rv == 0) {
>> + size = (buf.st_size/UBL_BLOCK_SIZE) + (buf.st_size % UBL_BLOCK_SIZE == 0 ? 0 : 1);
>> + } else {
>> + fprintf(stderr, "Error: could not stat datafile %s\n", params.datafile);
>> + }
>> + return size;
>> +}
>> +
>> static void parse_cfg_cmd(struct ubl_header *ublhdr, int32_t cmd, char *token,
>> char *name, int lineno, int fld, int dcd_len)
>> {
>> @@ -171,6 +188,8 @@ static uint32_t parse_cfg_file(struct ubl_header *ublhdr, char *name)
>> *ptr = 0xff;
>> ptr++;
>> }
>> +
>> + ublhdr->pages = getDataPageSize();
>>
>> /*
>> * Very simple parsing, line starting with # are comments
>> diff --git a/tools/ublimage.h b/tools/ublimage.h
>> index e440625..35dee42 100644
>> --- a/tools/ublimage.h
>> +++ b/tools/ublimage.h
>> @@ -61,6 +61,8 @@ enum ublimage_fld_types {
>> #define UBL_MAGIC_DMA_IC (0x44)
>> /* DMA + ICache + Fast EMIF boot mode */
>> #define UBL_MAGIC_DMA_IC_FAST (0x55)
>> +/* UBOOT header identifier for UBL */
>> +#define UBL_MAGIC_UBOOT (0x66)
> Hmm.. see above comment, and comment in source code ...
>
> please explain here more, what you want to do.
ok
>
>> /* Define max UBL image size */
>> #define UBL_IMAGE_SIZE (0x00003800u)
> bye,
> Heiko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-02 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-20 16:53 [U-Boot] [PATCH] Added u-boot header generating functionality to ublimage Stijn Souffriau
2012-05-20 19:00 ` Mike Frysinger
2012-05-21 6:30 ` Heiko Schocher
2012-06-02 15:39 ` Stijn Souffriau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox