I have a nandroid backup image at
~/work/backup/, and the phone attached by USB with debugging enabled.
Previously I tried to install the yaffs file system on a Linux box and mount the image over loop back, however that did not work, the images failed to mount.
The solution turns out to be simple...
download the source for unyaffs, a program which extracts all the files form a yaffs image.
compile the source.
cd ~/work gcc -o unyaffs unyaffs.c
make a target directory and run the program from the target directory.
mkdir data.img cd data.img ../unyaffs ~/work/backup/data.img
after some quick reading I find that the text message database are at
On the phone use SMS Backup & Restore to save the current text messages.
Make a backup of the message database on the phone, just in case.
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db ~/work/mmssms.db-current
Push the pre-flash message database with the old messages onto the phone
adb push ~/work/data.img/data/com.android.providers.telephony/databases/mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db
Reboot the phone.
Only the old messages should be visible on the phone now.
On the phone use SMS Backup & Restore to restore the text messages that were just saved, there should be no need to check for duplicate messages.
All the messages should be visible now. All done.