Building SPMP8k OS Images.

Ok, you’re here for the source, and the rest of the article. Here you go.

Souce Code for sprdump tool

We’re not distributing binaries as they would be different for different flavors of linux. So it will be your rite of passage to compile this tool yourself. For those Windows users, please note that you will need to change the direction of the directory delimiter. But other than that, we’ve verified the tool works on both platforms.

List the files in an IMG file by using

sprdump l [IMG FILE]

And dump the IMG by using

sprdump x [IMG FILE] [DMPDIR]

where [DMPDIR] is the directory you want to dump to. To keep it clean, we suggest dumping to an entirely new directory. We usually call it ROOT. We also dumped our device to a directory named ROOT, although that’s not reflected in the screenshot from the previous article.

One thing you may notice if you used the Fetch tool is that a few files are unfetchable. These files are DIALOG BOX.BMP and a couple of ~TEMP files. The RedBoot load command cannot load DIALOG BOX.BMP due to the space in the name, and perhaps the parser in Fetch chokes on the tilde. Either way, you can copy these from an IMG dump if you want them.

At this point, you have a full directory structure containing the OS. We’ll assume it’s in a directory called ROOT, where an ls command in ROOT would show you something like:

HOME_EX IMAGE MW POWEROFF_565.BMP POWERON_565.BMP RESOURCE STARTPICS

Or something similar. The important thing is that /RESOURCE is one directory downstream from your root directory. When you pack the image, you will point at ROOT.

At the moment, the only way to pack an image is with the SunPlus FRM Pro tool, version 0.9 or greater. 0.9.1.6 and 1.1.0.2 both seem to have the proper “Advanced” tab with the image packing options. We won’t give it out, and we won’t allow links in the comments. You will have to find it yourself, or wait for someone to write an open-source packer for linux. Any takers?

The only fields that need to be filled out are the version stuff, and the resource dir. The resource dir is your ROOT directory from earlier. A picture is worth a thousand words, so here you go.

Screenshot of the FRM Pro image pack screen


Fig 1 – Screenshot of the required fields for packing a custom image

Pretty simple. Use the Wrap Image command to pack the entire ROOT filesystem into a new IMG file, and then use the firmware uploader on the Basic tab to reflash your device.

A little more time consuming than hex-editing, but oh so flexible! Now before you go changing background images and ding sounds, you should really run a test to make sure your flow works properly.

With the sprdump tool, dump a known IMG file. Repack it with FRM Pro and then compare the files to see if you got what you started with. The size should be identical, but you will notice some minor differences in the first few kB. We believe these are the file creation time entry in the directory structure, and doesn’t matter. An example of a difference in this field looks like.

00000020: 01 00 07 00 06 00 00 00 90 01 91 01 20 01 00 00
00000030: 69 44 37 4A 20 6A 00 00 3C 20 20 20 20 20 30 3E

Original File

00000020: 01 00 07 00 06 00 00 00 90 01 91 01 20 01 00 00
00000030: 3C 22 63 4B 20 6A 00 00 3C 20 20 20 20 20 30 3E

Repacked file

There are 500-1000 directory entires, so a file comparison will show similar differences in each directory entry. If that’s all you’re seeing – congrats! Your setup works, go change stuff and see what sort of wild trouble you can get into.

We always love to hear what kind of progress you all are making, so drop us a comment and let us know if you’re successful or not. As far as we know, this is the first tutorial on how to repack the OS image. But if you know of any others, point us in the right direction – we’d love to see what sort of customizations people are already making.

Cheers!

This entry was posted in MP5. Bookmark the permalink.

0 Responses to "Building SPMP8k OS Images."

Leave a reply