I started to work with no2chem on the issue but still have some lose ends I'm still trying to piece together.
The files I'll be referring to are "nk.fat" (orignal image) and the "os.nb.payload" (new image).
In those files the partition info ends at 0x200. The "55-AA" you will see is the end of sector terminator.
Partitions are done in 16 byte segments. Split them up (as I did below) But for now just contentrate on the last 8 bytes.
The last 8 bytes are split into two segments. 1st segment (4 bytes) is the sector offset. 2nd (4 bytes) is the total size of the partition.
Here's an example from the 5050 ROM.
**NOTE** All of partition data is little-endian! So for example 3e-51-01 is really 01-51-3e in terms of being a real number. If you don't know what that is you shouldn't be trying to fix this.
Code:
nk.fat (original) sector start size of part.
------------------------------------------------------
00 02 01 19 23 3f 01 33 02 00 00 00 be 0c 00 00
00 00 01 34 25 3d 41 c0 c0 0c 00 00 00 60 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 41 c1 04 3d c1 30 c0 6c 00 00 3e 51 01 00
The 4 Partitions are in order from top to bottom.
[xip1] - [imgfs] - [blank] - [storage]
Here's a example of a *broken* .nb file created that errors on NBmerge.
Code:
os.nb.payload sector start size of part.
--------------------------------------------------------
00 02 01 19 23 3f 01 33 02 00 00 00 be 0c 00 00
00 00 01 34 25 3d 81 3c c0 0c 00 00 42 7e 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 41 c1 04 3d c1 30 c0 6c 00 00 3e 51 01 00
The all 00's partition is null (empty) ignore it.
Partition starting sectors are based on the size of the previous partition.
For example look at partition 1 it starts at sector "02" and has a size of "0cbe".
So in base16 02+0cb3=cc0. Note the starting sector for partition 2 is "0cc0" as it should be.
1st thing that I notice here is look at the starting sector for partition 4. It's wrong (if the partition 2 size is correct)
You can see based on the original ROM the sector start data just got moved across.
The starting sector for partition 4 should be partition 2 sector start + partition 2 size. Or ...
0cc0+7e42=8b02
So the starting sector for partiton 4 should 8b02 (or 028B little-endian)
I've tried this and it doesn't fix it. While the error goes away with nbmerge...
Code:
Partition 0: start sector: 0x00000002, total: 0x00000cbe
first used: 0x00000002, used: 0x00000929
Partition 1: start sector: 0x00000cc0, total: 0x00007e42
first used: 0x00000cc0, used: 0x00007e29
Checking OS.nb for bad NAND block marker
Checked 0x8b02 sectors successfully!
Done.
The 4th partition doesn't show up.
So perhaps it's a fixed size for partition 4 and now it's out of bounds because partition 2 is larger. So subtract the difference between them.
Original size for partition 2= 6000 new size = 7e42.
7e42-6000=1e42
So subtract size difference from partition 4 (01-51-3e) ...
1513e-1e42=132FC
I tried this as well... no luck.
This leads me to believe that the partition 2 size is incorrect. Or perhaps I need to adjust the starting CHS values and ending CHS values in the 1st 8 bytes of the partition header. You can see that it does change for partition 2 when it grows above.
I've only had 2 hours or so to screw around with this so far this week... I'll try again tonight. (I had family visiting at my house all week; I finally have free time now... well after I'm done shopping with the wife today. I'm getting yelled at to leave now)
I used these links to reference partition header information.
http://mirror.href.com/thestarman/as...PartTables.htm
http://ata-atapi.com/hiwtab.htm
p.s.
no2chem I was trying to send you a PM with this info but your mailbox is full