Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Installs deps for using SDK emulator for testing. | 6 """Installs deps for using SDK emulator for testing. |
| 7 | 7 |
| 8 The script will download the SDK and system images, if they are not present, and | 8 The script will download the SDK and system images, if they are not present, and |
| 9 install and enable KVM, if virtualization has been enabled in the BIOS. | 9 install and enable KVM, if virtualization has been enabled in the BIOS. |
| 10 """ | 10 """ |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 SDK_ZIP = 'adt-bundle-linux-x86_64-20131030.zip' | 31 SDK_ZIP = 'adt-bundle-linux-x86_64-20131030.zip' |
| 32 | 32 |
| 33 # Android x86 system image from the Intel website: | 33 # Android x86 system image from the Intel website: |
| 34 # http://software.intel.com/en-us/articles/intel-eula-x86-android-4-2-jelly-bean -bin | 34 # http://software.intel.com/en-us/articles/intel-eula-x86-android-4-2-jelly-bean -bin |
| 35 # These don't exist prior to Android-15. | 35 # These don't exist prior to Android-15. |
| 36 # As of 08 Nov 2013, Android-19 is not yet available either. | 36 # As of 08 Nov 2013, Android-19 is not yet available either. |
| 37 X86_IMG_URLS = { | 37 X86_IMG_URLS = { |
| 38 15: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 5_r01.zip', | 38 15: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 5_r01.zip', |
| 39 16: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 6_r01.zip', | 39 16: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 6_r01.zip', |
| 40 17: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 7_r01.zip', | 40 17: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 7_r01.zip', |
| 41 18: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 8_r01.zip'} | 41 18: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 8_r01.zip', |
| 42 19: 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-1 9_r01.zip'} | |
| 42 | 43 |
| 43 def CheckSDK(): | 44 def CheckSDK(): |
| 44 """Check if SDK is already installed. | 45 """Check if SDK is already installed. |
| 45 | 46 |
| 46 Returns: | 47 Returns: |
| 47 True if the emulator SDK directory (src/android_emulator_sdk/) exists. | 48 True if the emulator SDK directory (src/android_emulator_sdk/) exists. |
| 48 """ | 49 """ |
| 49 return os.path.exists(constants.EMULATOR_SDK_ROOT) | 50 return os.path.exists(constants.EMULATOR_SDK_ROOT) |
| 50 | 51 |
| 51 | 52 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 if rc: | 132 if rc: |
| 132 logging.critical('ERROR: Did not install KVM. Make sure hardware ' | 133 logging.critical('ERROR: Did not install KVM. Make sure hardware ' |
| 133 'virtualization is enabled in BIOS (i.e. Intel VT-x or ' | 134 'virtualization is enabled in BIOS (i.e. Intel VT-x or ' |
| 134 'AMD SVM).') | 135 'AMD SVM).') |
| 135 # TODO(navabi): Use modprobe kvm-amd on AMD processors. | 136 # TODO(navabi): Use modprobe kvm-amd on AMD processors. |
| 136 rc = cmd_helper.RunCmd(['sudo', 'modprobe', 'kvm-intel']) | 137 rc = cmd_helper.RunCmd(['sudo', 'modprobe', 'kvm-intel']) |
| 137 if rc: | 138 if rc: |
| 138 logging.critical('ERROR: Did not add KVM module to Linux Kernal. Make sure ' | 139 logging.critical('ERROR: Did not add KVM module to Linux Kernal. Make sure ' |
| 139 'hardware virtualization is enabled in BIOS.') | 140 'hardware virtualization is enabled in BIOS.') |
| 140 # Now check to ensure KVM acceleration can be used. | 141 # Now check to ensure KVM acceleration can be used. |
| 141 rc = cmd_helper.RunCmd(['kvm-ok']) | 142 rc = cmd_helper.RunCmd(['kvm-ok']) |
|
tfarina
2013/12/16 12:07:11
This may need to have 'sudo' as well.
See:
Trace
digit1
2013/12/16 12:28:04
Hmmm, I don't have an issue running 'kvm-ok' witho
tfarina
2013/12/16 12:29:52
I'm also on Ubuntu 12.04 x64, my Window Manager is
digit1
2013/12/16 17:27:00
Looking at the kvm-ok sources, it looks like it ca
| |
| 142 if rc: | 143 if rc: |
| 143 logging.critical('ERROR: Can not use KVM acceleration. Make sure hardware ' | 144 logging.critical('ERROR: Can not use KVM acceleration. Make sure hardware ' |
| 144 'virtualization is enabled in BIOS (i.e. Intel VT-x or ' | 145 'virtualization is enabled in BIOS (i.e. Intel VT-x or ' |
| 145 'AMD SVM).') | 146 'AMD SVM).') |
| 146 | 147 |
| 147 | 148 |
| 148 def GetX86Image(api_level=DEFAULT_ANDROID_API_LEVEL): | 149 def GetX86Image(api_level=DEFAULT_ANDROID_API_LEVEL): |
| 149 """Download x86 system image from Intel's website. | 150 """Download x86 system image from Intel's website. |
| 150 | 151 |
| 151 Args: | 152 Args: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 | 254 |
| 254 # Make sure KVM packages are installed and enabled. | 255 # Make sure KVM packages are installed and enabled. |
| 255 if CheckKVM(): | 256 if CheckKVM(): |
| 256 logging.info('KVM already installed and enabled.') | 257 logging.info('KVM already installed and enabled.') |
| 257 else: | 258 else: |
| 258 InstallKVM() | 259 InstallKVM() |
| 259 | 260 |
| 260 | 261 |
| 261 if __name__ == '__main__': | 262 if __name__ == '__main__': |
| 262 sys.exit(main(sys.argv)) | 263 sys.exit(main(sys.argv)) |
| OLD | NEW |