flashmap: Bring over changes from factory repo

fmap.py is identical to the one in factory/setup/fmap.py except:
 - no test functionality in main function
 - module docstring and license

Added some unit tests for the new functionality

BUG=chromium:726356
BUG=b:145473707
TEST=ran unittests

Change-Id: Ib67bd4260cf4e1cc08543b822521a4adcf0cbce6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashmap/+/1970519
Reviewed-by: Henry Sun <henrysun@google.com>
Commit-Queue: Henry Sun <henrysun@google.com>
Tested-by: Henry Sun <henrysun@google.com>
2 files changed