| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 gooftool: Google Factory Tool, providing all Google Required Test | 8 gooftool: Google Factory Tool, providing all Google Required Test |
| 9 functionality. | 9 functionality. |
| 10 """ | 10 """ |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 @GFTLogCommand | 334 @GFTLogCommand |
| 335 def prepare_wipe(): | 335 def prepare_wipe(): |
| 336 """ Prepares system to reboot for transitioning to release state. """ | 336 """ Prepares system to reboot for transitioning to release state. """ |
| 337 if g_options.debug_dryrun_prepare_wipe: | 337 if g_options.debug_dryrun_prepare_wipe: |
| 338 ErrorMsg('prepare_wipe is by-passed. This device CANNOT be qualified.') | 338 ErrorMsg('prepare_wipe is by-passed. This device CANNOT be qualified.') |
| 339 return True | 339 return True |
| 340 wipe_script = os.path.join(os.path.split(sys.argv[0])[0], | 340 wipe_script = os.path.join(os.path.split(sys.argv[0])[0], |
| 341 'gft_prepare_wipe.sh') | 341 'gft_prepare_wipe.sh') |
| 342 if not os.path.exists(wipe_script): | 342 if not os.path.exists(wipe_script): |
| 343 ErrorDie('prepare_wipe: cannot find script to prepare for wiping.') | 343 ErrorDie('prepare_wipe: cannot find script to prepare for wiping.') |
| 344 return_code = os.system('FACTORY_WIPE_TAGS=fast %s' % wipe_script) | 344 wipe_method_map = { |
| 345 'fast': 'fast', |
| 346 'secure': '', |
| 347 } |
| 348 method = g_options.wipe_method |
| 349 if method not in wipe_method_map: |
| 350 ErrorDie('prepare_wipe: unknown wipe method: %s' % method) |
| 351 tag = wipe_method_map[method] |
| 352 command = 'FACTORY_WIPE_TAGS=%s %s' % (tag, wipe_script) |
| 353 DebugMsg('prepare_wipe: execute command: %s' % command) |
| 354 return_code = os.system(command) |
| 345 if return_code != 0: | 355 if return_code != 0: |
| 346 ErrorDie('prepare_wipe: failed(%s) in calling preparation script' | 356 ErrorDie('prepare_wipe: failed(%s) in calling preparation script' |
| 347 % return_code) | 357 % return_code) |
| 348 return True | 358 return True |
| 349 | 359 |
| 350 | 360 |
| 351 @GFTLogCommand | 361 @GFTLogCommand |
| 352 def verify(): | 362 def verify(): |
| 353 """ Verifies if whole factory process is ready for finalization. """ | 363 """ Verifies if whole factory process is ready for finalization. """ |
| 354 if (verify_switch_dev() and | 364 if (verify_switch_dev() and |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 help='upload the data generated by --create_report') | 440 help='upload the data generated by --create_report') |
| 431 parser.add_option('--upload_method', metavar='METHOD:PARAM', | 441 parser.add_option('--upload_method', metavar='METHOD:PARAM', |
| 432 help='assign the upload method (see gft_upload).') | 442 help='assign the upload method (see gft_upload).') |
| 433 | 443 |
| 434 # Write Protection Wiping, and Finalization | 444 # Write Protection Wiping, and Finalization |
| 435 parser.add_option('--wpfw', action='store_true', | 445 parser.add_option('--wpfw', action='store_true', |
| 436 help='enable and verify firmware write protection') | 446 help='enable and verify firmware write protection') |
| 437 parser.add_option('--prepare_wipe', action='store_true', | 447 parser.add_option('--prepare_wipe', action='store_true', |
| 438 help='prepare for wiping factory tests and ' | 448 help='prepare for wiping factory tests and ' |
| 439 'transit to release mode in next reboot') | 449 'transit to release mode in next reboot') |
| 450 parser.add_option('--wipe_method', metavar='METHOD', default='secure', |
| 451 help='assign the wipe method (secure/fast).') |
| 440 parser.add_option('--verify', action='store_true', | 452 parser.add_option('--verify', action='store_true', |
| 441 help='runs: --verify_switch_wp, --verify_switch_dev, ' | 453 help='runs: --verify_switch_wp, --verify_switch_dev, ' |
| 442 '--verify_hwid, --verify_keys') | 454 '--verify_hwid, --verify_keys') |
| 443 parser.add_option('--finalize', action='store_true', | 455 parser.add_option('--finalize', action='store_true', |
| 444 help='runs: --verify, --wpfw, ' | 456 help='runs: --verify, --wpfw, ' |
| 445 '--create_report, --upload_report, --prepare_wipe') | 457 '--create_report, --upload_report, --prepare_wipe') |
| 446 return parser | 458 return parser |
| 447 | 459 |
| 448 | 460 |
| 449 ######################################################################## | 461 ######################################################################## |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 return_value = 1 | 503 return_value = 1 |
| 492 executed_commands = executed_commands + 1 | 504 executed_commands = executed_commands + 1 |
| 493 | 505 |
| 494 if executed_commands == 0: | 506 if executed_commands == 0: |
| 495 parser.print_help() | 507 parser.print_help() |
| 496 return return_value | 508 return return_value |
| 497 | 509 |
| 498 | 510 |
| 499 if __name__ == '__main__': | 511 if __name__ == '__main__': |
| 500 sys.exit(_main()) | 512 sys.exit(_main()) |
| OLD | NEW |