Re: [U-Boot-Users] [PATCH: dtc take 2] Assemble the blob in memory before writing it out.

On Wed, 2007-04-18 at 20:59, Jerry Van Baren wrote:
This makes padding out the blob if the user requested extra size much easer. The assembly and writing to the file is more straight forward too.
Signed-off-by: Gerald Van Baren vanbaren@cideas.com
Hi David, Jon,
I wasn't happy with David's suggestion on the -S handling. I also wasn't all that wild about how the blob was assembled and then written to the file piecemeal with "ad-hoc" alignment padding. I realized I could fix both by assembling the blob in memory as a "struct data" and then write the whole thing out in one fell swoop.
Makes it a lot simpler and cleaner to my eyes.
Hope y'all agree, gvb
Jerry and David,
Sorry. I've been out sick for a couple days here and am just now catching up. I've read through the last week's worth of mail here now, so let me see if I have properly summarized where things stand and what's needed for the DTC:
These patches need to be applied:
[PATCH dtc] Add -o <output file> to the usage message. Sat, 14 Apr 2007 18:16:47 -0400
[PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400
[PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
The last patch there replaces the "Improve -S handling" patches. But does the last patch replace or depend on the second one?
And I agree with David that last patch is a better approach.
Thanks, jdl

Jon Loeliger wrote:
On Wed, 2007-04-18 at 20:59, Jerry Van Baren wrote:
This makes padding out the blob if the user requested extra size much easer. The assembly and writing to the file is more straight forward too.
Signed-off-by: Gerald Van Baren vanbaren@cideas.com
Hi David, Jon,
I wasn't happy with David's suggestion on the -S handling. I also wasn't all that wild about how the blob was assembled and then written to the file piecemeal with "ad-hoc" alignment padding. I realized I could fix both by assembling the blob in memory as a "struct data" and then write the whole thing out in one fell swoop.
Makes it a lot simpler and cleaner to my eyes.
Hope y'all agree, gvb
Jerry and David,
Sorry. I've been out sick for a couple days here and am just now catching up. I've read through the last week's worth of mail here now, so let me see if I have properly summarized where things stand and what's needed for the DTC:
These patches need to be applied:
[PATCH dtc] Add -o <output file> to the usage message. Sat, 14 Apr 2007 18:16:47 -0400 [PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400 [PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
The last patch there replaces the "Improve -S handling" patches. But does the last patch replace or depend on the second one?
And I agree with David that last patch is a better approach.
Thanks, jdl
Yes, you have that right.
Patch #1 is good to go [PATCH dtc] Add -o <output file> to the usage message. Sat, 14 Apr 2007 18:16:47 -0400
Patch #2 and #3... [PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400 [PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
...you force me to make a confession. The third patch depends on the second patch because I snuck in a fix to the ASM output into the third patch: the last two chunks fix the ASM header output - I padded the blob out but didn't change the size properly in the header. In the third patch above, I added a label "%s_blob_abs_end" and used that to calculate the total blob size (including the padding) in the header:
- fprintf(f, "\t.long\t_%s_blob_end - _%s_blob_start /* totalsize */\n", + fprintf(f, "\t.long\t_%s_blob_abs_end - _%s_blob_start /* totalsize */\n",
--------
AAAARGH! Sorry, I see I left a debug statement in flattree.c around line 390:
@@ -383,28 +370,46 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version, : : +fprintf(stderr, "minsize = %d, totalsize = %d, padlen = %d\n", minsize, be32_to_cpu(bph.totalsize), padlen);
Your option: 1) Take the last two patches as is and remove the fprintf yourself 2) I'll fix it tonight and provide a New Improved patch
Thanks, gvb

On Thu, 2007-04-19 at 13:49, Jerry Van Baren wrote:
Sorry. I've been out sick for a couple days here and am just now catching up. I've read through the last week's worth of mail here now, so let me see if I have properly summarized where things stand and what's needed for the DTC:
These patches need to be applied:
[PATCH dtc] Add -o <output file> to the usage message. Sat, 14 Apr 2007 18:16:47 -0400 [PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400 [PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
The last patch there replaces the "Improve -S handling" patches. But does the last patch replace or depend on the second one?
And I agree with David that last patch is a better approach.
Thanks, jdl
Yes, you have that right.
Good. The drugs aren't too strong yet. :-)
Patch #1 is good to go [PATCH dtc] Add -o <output file> to the usage message. Sat, 14 Apr 2007 18:16:47 -0400
Patch #2 and #3... [PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400 [PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
...you force me to make a confession.
It's good for the soul. :-)
Your option:
- Take the last two patches as is and remove the fprintf yourself
- I'll fix it tonight and provide a New Improved patch
I'll go with Door Number 1! No problem.
Thanks, jdl

So, like, the other day Jerry Van Baren mumbled:
Patch #2 and #3... [PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400 [PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
[snip]
AAAARGH! Sorry, I see I left a debug statement in flattree.c around line 390:
Your option:
- Take the last two patches as is and remove the fprintf yourself
Applied #2 and #3 listed above. Cleaned out the debug fprintf().
Thanks, jdl

Jon Loeliger wrote:
So, like, the other day Jerry Van Baren mumbled:
Patch #2 and #3... [PATCH dtc take 3] Fix reserve map output for asm format. Tue, 17 Apr 2007 18:14:41 -0400 [PATCH: dtc take 2] Assemble the blob in memory before writing it out. Wed, 18 Apr 2007 21:59:51 -0400
[snip]
AAAARGH! Sorry, I see I left a debug statement in flattree.c around line 390:
Your option:
- Take the last two patches as is and remove the fprintf yourself
Applied #2 and #3 listed above. Cleaned out the debug fprintf().
Thanks, jdl
Oh oh, does NOT look good. I lost the rewrite of the header size with the new, bigger size when -S is specified.
Ahh, I think I see the problem, sloppy programming bites me again. Modifying "bph.totalsize" worked before I changed to the struct data blob. Grrrr. I need to figure out the padding and apply it to the bph before starting the blob assembly. Before the line:
blob = data_append_data(blob, &bph, sizeof(bph));
Patch will take a bit because I have a meeting to go to :-(.
sorry, gvb
participants (4)
-
Jerry Van Baren
-
Jerry Van Baren
-
Jon Loeliger
-
Jon Loeliger