gooftool: write manufacturing date into VPD

Partner requests a field which indicates the date the device was
manufactured.

We add a new field 'mfg_date' to VPD RO.
If the other user don't want this VPD field, they can add a argument
'--no_generate_mfg_date' to gooftool finalize.

BUG=b:128881128
TEST=None

Change-Id: Ic2f0e814d312e03ae29b1973f5ac61403801fe86
Reviewed-on: https://chromium-review.googlesource.com/1531905
Commit-Ready: Chun-Tsen Kuo <chuntsen@chromium.org>
Tested-by: Chun-Tsen Kuo <chuntsen@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 1717571..39e84b5 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -230,6 +230,11 @@
     help='There is no ectool utility so tests rely on ectool should be '
          'skipped.')
 
+_no_generate_mfg_date_cmd_arg = CmdArg(
+    '--no_generate_mfg_date', action='store_false', dest='generate_mfg_date',
+    help='Do not generate manufacturing date nor write mfg_date into VPD.')
+
+
 @Command(
     'verify_ec_key',
     _ec_pubkey_path_cmd_arg,
@@ -702,7 +707,8 @@
          _wipe_finish_token_cmd_arg,
          _rlz_embargo_end_date_offset_cmd_arg,
          _waive_list_cmd_arg,
-         _skip_list_cmd_arg)
+         _skip_list_cmd_arg,
+         _no_generate_mfg_date_cmd_arg)
 def Finalize(options):
   """Verify system readiness and trigger transition into release state.
 
@@ -720,6 +726,8 @@
   if not options.rma_mode:
     # Write VPD values related to RLZ ping into VPD.
     GetGooftool(options).WriteVPDForRLZPing(options.embargo_offset)
+    if options.generate_mfg_date:
+      GetGooftool(options).WriteVPDForMFGDate()
   Cr50SetSnBitsAndBoardId(options)
   Cr50DisableFactoryMode(options)
   Verify(options)