Update code to support 1Mb-8Mb devices.

Couldn't write to the device without fixing the page size.