1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "host/libs/config/cuttlefish_config.h"
19 
20 #define CF_DEFAULTS_DYNAMIC_STRING ""
21 #define CF_DEFAULTS_DYNAMIC_INT 0
22 
23 // Common configs paramneters
24 #define CF_DEFAULTS_NUM_INSTANCES 1
25 #define CF_DEFAULTS_INSTANCE_NUMS CF_DEFAULTS_DYNAMIC_STRING
26 #define CF_DEFAULTS_BASE_INSTANCE_NUM cuttlefish::GetInstance()
27 #define CF_DEFAULTS_ASSEMBLY_DIR \
28   (StringFromEnv("HOME", ".") + "/cuttlefish_assembly")
29 #define CF_DEFAULTS_INSTANCE_DIR (StringFromEnv("HOME", ".") + "/cuttlefish")
30 
31 #define CF_DEFAULTS_SYSTEM_IMAGE_DIR CF_DEFAULTS_DYNAMIC_STRING
32 
33 // Instance specific parameters
34 //  VM default parameters
35 #define CF_DEFAULTS_DISPLAY_DPI 320
36 #define CF_DEFAULTS_DISPLAY_REFRESH_RATE 60
37 #define CF_DEFAULTS_DISPLAY_WIDTH 720
38 #define CF_DEFAULTS_DISPLAY_HEIGHT 1280
39 #define CF_DEFAULTS_DISPLAYS_TEXTPROTO ""
40 #define CF_DEFAULTS_CPUS 2
41 #define CF_DEFAULTS_RESUME true
42 #define CF_DEFAULTS_DAEMON false
43 #define CF_DEFAULTS_VM_MANAGER CF_DEFAULTS_DYNAMIC_STRING
44 #define CF_DEFAULTS_VSOCK_GUEST_CID cuttlefish::GetDefaultVsockCid()
45 #define CF_DEFAULTS_VSOCK_GUEST_GROUP ""
46 #define CF_DEFAULTS_VHOST_USER_VSOCK cuttlefish::kVhostUserVsockModeAuto
47 #define CF_DEFAULTS_ENABLE_MINIMAL_MODE false
48 #define CF_DEFAULTS_RESTART_SUBPROCESSES false
49 #define CF_DEFAULTS_SETUPWIZARD_MODE "DISABLED"
50 #define CF_DEFAULTS_SMT false
51 #define CF_DEFAULTS_USE_ALLOCD false
52 #define CF_DEFAULTS_USE_SDCARD true
53 #define CF_DEFAULTS_UUID \
54   cuttlefish::ForCurrentInstance(cuttlefish::kDefaultUuidPrefix)
55 #define CF_DEFAULTS_FILE_VERBOSITY "DEBUG"
56 #define CF_DEFAULTS_VERBOSITY "INFO"
57 #define CF_DEFAULTS_RUN_FILE_DISCOVERY true
58 #define CF_DEFAULTS_MEMORY_MB CF_DEFAULTS_DYNAMIC_INT
59 #define CF_DEFAULTS_SHARE_SCHED_CORE false
60 #define CF_DEFAULTS_TRACK_HOST_TOOLS_CRC false
61 // TODO: defined twice, please remove redundant definitions
62 #define CF_DEFAULTS_USE_OVERLAY true
63 #define CF_DEFAULTS_DEVICE_EXTERNAL_NETWORK "tap"
64 
65 // crosvm default parameters
66 #define CF_DEFAULTS_CROSVM_BINARY HostBinaryPath("crosvm")
67 #define CF_DEFAULTS_SECCOMP_POLICY_DIR cuttlefish::GetSeccompPolicyDir()
68 #define CF_DEFAULTS_ENABLE_SANDBOX false
69 #define CF_DEFAULTS_ENABLE_VIRTIOFS false
70 
71 // Qemu default parameters
72 #define CF_DEFAULTS_QEMU_BINARY_DIR cuttlefish::DefaultQemuBinaryDir()
73 
74 // Gem5 default parameters
75 #define CF_DEFAULTS_GEM5_BINARY_DIR HostBinaryPath("gem5")
76 #define CF_DEFAULTS_GEM5_CHECKPOINT_DIR CF_DEFAULTS_DYNAMIC_STRING
77 #define CF_DEFAULTS_GEM5_DEBUG_FILE CF_DEFAULTS_DYNAMIC_STRING
78 #define CF_DEFAULTS_GEM5_DEBUG_FLAGS CF_DEFAULTS_DYNAMIC_STRING
79 
80 // Boot default parameters
81 #define CF_DEFAULTS_BOOT_SLOT CF_DEFAULTS_DYNAMIC_STRING
82 #define CF_DEFAULTS_BOOTLOADER CF_DEFAULTS_DYNAMIC_STRING
83 #define CF_DEFAULTS_ENABLE_BOOTANIMATION true
84 #define CF_DEFAULTS_EXTRA_BOOTCONFIG_ARGS CF_DEFAULTS_DYNAMIC_STRING
85 #define CF_DEFAULTS_PAUSE_IN_BOOTLOADER false
86 #define CF_DEFAULTS_REBOOT_NOTIFICATION_FD (-1)
87 
88 // Security default parameters
89 #define CF_DEFAULTS_GUEST_ENFORCE_SECURITY true
90 #define CF_DEFAULTS_USE_RANDOM_SERIAL false
91 #define CF_DEFAULTS_SERIAL_NUMBER \
92   cuttlefish::ForCurrentInstance("CUTTLEFISHCVD")
93 #define CF_DEFAULTS_SECURE_HALS CF_DEFAULTS_DYNAMIC_STRING
94 #define CF_DEFAULTS_PROTECTED_VM false
95 #define CF_DEFAULTS_MTE false
96 
97 // Kernel default parameters
98 #define CF_DEFAULTS_ENABLE_KERNEL_LOG true
99 #define CF_DEFAULTS_KGDB false
100 #define CF_DEFAULTS_GDB_PORT CF_DEFAULTS_DYNAMIC_INT
101 #define CF_DEFAULTS_CONSOLE false
102 #define CF_DEFAULTS_EXTRA_KERNEL_CMDLINE CF_DEFAULTS_DYNAMIC_STRING
103 #define CF_DEFAULTS_INITRAMFS_PATH CF_DEFAULTS_DYNAMIC_STRING
104 #define CF_DEFAULTS_KERNEL_PATH CF_DEFAULTS_DYNAMIC_STRING
105 
106 // Disk default parameters
107 #define CF_DEFAULTS_BLANK_METADATA_IMAGE_MB "64"
108 #define CF_DEFAULTS_BLANK_SDCARD_IMAGE_MB "2048"
109 #define CF_DEFAULTS_BOOT_IMAGE CF_DEFAULTS_DYNAMIC_STRING
110 #define CF_DEFAULTS_DATA_IMAGE CF_DEFAULTS_DYNAMIC_STRING
111 #define CF_DEFAULTS_INIT_BOOT_IMAGE CF_DEFAULTS_DYNAMIC_STRING
112 #define CF_DEFAULTS_ANDROID_EFI_LOADER CF_DEFAULTS_DYNAMIC_STRING
113 #define CF_DEFAULTS_CHROMEOS_DISK ""
114 #define CF_DEFAULTS_CHROMEOS_KERNEL_PATH ""
115 #define CF_DEFAULTS_CHROMEOS_ROOT_IMAGE ""
116 #define CF_DEFAULTS_LINUX_INITRAMFS_PATH CF_DEFAULTS_DYNAMIC_STRING
117 #define CF_DEFAULTS_LINUX_KERNEL_PATH CF_DEFAULTS_DYNAMIC_STRING
118 #define CF_DEFAULTS_LINUX_ROOT_IMAGE CF_DEFAULTS_DYNAMIC_STRING
119 #define CF_DEFAULTS_FUCHSIA_ZEDBOOT_PATH CF_DEFAULTS_DYNAMIC_STRING
120 #define CF_DEFAULTS_FUCHSIA_MULTIBOOT_BIN_PATH CF_DEFAULTS_DYNAMIC_STRING
121 #define CF_DEFAULTS_FUCHSIA_ROOT_IMAGE CF_DEFAULTS_DYNAMIC_STRING
122 #define CF_DEFAULTS_CUSTOM_PARTITION_PATH CF_DEFAULTS_DYNAMIC_STRING
123 #define CF_DEFAULTS_SUPER_IMAGE CF_DEFAULTS_DYNAMIC_STRING
124 #define CF_DEFAULTS_VBMETA_IMAGE CF_DEFAULTS_DYNAMIC_STRING
125 #define CF_DEFAULTS_VBMETA_SYSTEM_IMAGE CF_DEFAULTS_DYNAMIC_STRING
126 #define CF_DEFAULTS_VBMETA_VENDOR_DLKM_IMAGE CF_DEFAULTS_DYNAMIC_STRING
127 #define CF_DEFAULTS_VBMETA_SYSTEM_DLKM_IMAGE CF_DEFAULTS_DYNAMIC_STRING
128 #define CF_DEFAULTS_VENDOR_BOOT_IMAGE CF_DEFAULTS_DYNAMIC_STRING
129 #define CF_DEFAULTS_DEFAULT_TARGET_ZIP CF_DEFAULTS_DYNAMIC_STRING
130 #define CF_DEFAULTS_SYSTEM_TARGET_ZIP CF_DEFAULTS_DYNAMIC_STRING
131 
132 // Policy default parameters
133 #define CF_DEFAULTS_DATA_POLICY "use_existing"
134 #define CF_DEFAULTS_USERDATA_FORMAT USERDATA_FILE_SYSTEM_TYPE
135 #define CF_DEFAULTS_BLANK_DATA_IMAGE_MB CF_DEFAULTS_DYNAMIC_INT
136 
137 // Graphics default parameters
138 #define CF_DEFAULTS_HWCOMPOSER cuttlefish::kHwComposerAuto
139 #define CF_DEFAULTS_GPU_MODE cuttlefish::kGpuModeAuto
140 #define CF_DEFAULTS_GPU_VHOST_USER_MODE cuttlefish::kGpuVhostUserModeAuto
141 #define CF_DEFAULTS_RECORD_SCREEN false
142 #define CF_DEFAULTS_GPU_CAPTURE_BINARY CF_DEFAULTS_DYNAMIC_STRING
143 #define CF_DEFAULTS_GPU_RENDERER_FEATURES ""
144 #define CF_DEFAULTS_GPU_CONTEXT_TYPES \
145   "gfxstream-vulkan:cross-domain:gfxstream-composer"
146 #define CF_DEFAULTS_GUEST_VULKAN_DRIVER "ranchu"
147 #define CF_DEFAULTS_FRAME_SOCKET_PATH ""
148 #define CF_DEFAULTS_ENABLE_GPU_UDMABUF false
149 #define CF_DEFAULTS_ENABLE_GPU_VHOST_USER false
150 #define CF_DEFAULTS_DISPLAY0 CF_DEFAULTS_DYNAMIC_STRING
151 #define CF_DEFAULTS_DISPLAY1 CF_DEFAULTS_DYNAMIC_STRING
152 #define CF_DEFAULTS_DISPLAY2 CF_DEFAULTS_DYNAMIC_STRING
153 #define CF_DEFAULTS_DISPLAY3 CF_DEFAULTS_DYNAMIC_STRING
154 
155 // Touchpad default parameters
156 #define CF_DEFAULTS_TOUCHPAD CF_DEFAULTS_DYNAMIC_STRING
157 
158 // Camera default parameters
159 #define CF_DEFAULTS_CAMERA_SERVER_PORT CF_DEFAULTS_DYNAMIC_INT
160 
161 // Connectivity default parameters
162 #define CF_DEFAULTS_RIL_DNS "8.8.8.8"
163 // Default network handler
164 #define CF_DEFAULTS_NETSIM false
165 #define CF_DEFAULTS_NETSIM_BT true
166 #define CF_DEFAULTS_NETSIM_UWB true
167 
168 // Netsim default parameters
169 #define CF_DEFAULTS_NETSIM_ARGS ""
170 
171 // Wifi default parameters
172 #define CF_DEFAULTS_AP_KERNEL_IMAGE CF_DEFAULTS_DYNAMIC_STRING
173 #define CF_DEFAULTS_AP_ROOTFS_IMAGE CF_DEFAULTS_DYNAMIC_STRING
174 #define CF_DEFAULTS_VHOST_NET false
175 #define CF_DEFAULTS_VHOST_USER_MAC80211_HWSIM CF_DEFAULTS_DYNAMIC_STRING
176 #define CF_DEFAULTS_WMEDIUMD_CONFIG CF_DEFAULTS_DYNAMIC_STRING
177 
178 // UWB default parameters
179 #define CF_DEFAULTS_ENABLE_HOST_UWB true
180 #define CF_DEFAULTS_ENABLE_PICA_INSTANCE_NUM 0
181 
182 // Automotive Proxy default parameter
183 #define CF_DEFAULTS_ENABLE_AUTOMOTIVE_PROXY false
184 
185 // Vhal Proxy Server default parameter
186 #define CF_DEFAULTS_ENABLE_VHAL_PROXY_SERVER false
187 #define CF_DEFAULTS_VHAL_PROXY_SERVER_INSTANCE_NUM 0
188 
189 // Bluetooth default parameters
190 #define CF_DEFAULTS_ENABLE_HOST_BLUETOOTH true
191 #define CF_DEFAULTS_ROOTCANAL_INSTANCE_NUM 0
192 #define CF_DEFAULTS_ROOTCANAL_ARGS CF_DEFAULTS_DYNAMIC_STRING
193 
194 // NFC default parameters
195 #define CF_DEFAULTS_ENABLE_HOST_NFC true
196 #define CF_DEFAULTS_CASIMIR_INSTANCE_NUM 0
197 #define CF_DEFAULTS_CASIMIR_ARGS CF_DEFAULTS_DYNAMIC_STRING
198 
199 // Modem Simulator default parameters
200 #define CF_DEFAULTS_ENABLE_MODEM_SIMULATOR true
201 #define CF_DEFAULTS_MODEM_SIMULATOR_SIM_TYPE 1
202 #define CF_DEFAULTS_MODEM_SIMULATOR_COUNT 1
203 
204 // Audio default parameters
205 #define CF_DEFAULTS_ENABLE_AUDIO true
206 
207 // USB Passhtrough default parameters
208 #define CF_DEFAULTS_ENABLE_USB false
209 
210 // Streaming default parameters
211 #define CF_DEFAULTS_START_WEBRTC false
212 #define CF_DEFAULTS_START_WEBRTC_SIG_SERVER true
213 #define CF_DEFAULTS_WEBRTC_DEVICE_ID "cvd-{num}"
214 #define CF_DEFAULTS_VERIFY_SIG_SERVER_CERTIFICATE false
215 #define CF_DEFAULTS_WEBRTC_ASSETS_DIR \
216   DefaultHostArtifactsPath("usr/share/webrtc/assets")
217 #define CF_DEFAULTS_WEBRTC_CERTS_DIR \
218   DefaultHostArtifactsPath("usr/share/webrtc/certs")
219 #define CF_DEFAULTS_WEBRTC_SIG_SERVER_ADDR CF_DEFAULTS_DYNAMIC_STRING
220 #define CF_DEFAULTS_WEBRTC_SIG_SERVER_PATH "/register_device"
221 #define CF_DEFAULTS_WEBRTC_SIG_SERVER_PORT 443
222 #define CF_DEFAULTS_WEBRTC_SIG_SERVER_SECURE true
223 #define CF_DEFAULTS_TCP_PORT_RANGE "15550:15599"
224 #define CF_DEFAULTS_UDP_PORT_RANGE "15550:15599"
225 
226 // Adb default parameters
227 // TODO : Replaceconstants with these flags, they're currently defined through
228 // GflagsCompatFlag
229 #define CF_DEFAULTS_RUN_ADB_CONNECTOR true
230 #define CF_DEFAULTS_ADB_MODE "vsock_half_tunnel"
231 
232 // Location default parameters
233 #define CF_DEFAULTS_START_GNSS_PROXY true
234 #define CF_DEFAULTS_FIXED_LOCATION_FILE_PATH CF_DEFAULTS_DYNAMIC_STRING
235 #define CF_DEFAULTS_GNSS_FILE_PATH CF_DEFAULTS_DYNAMIC_STRING
236 
237 // Metrics default parameters
238 // TODO: Defined twice , please remove redundant definitions
239 #define CF_DEFAULTS_REPORT_ANONYMOUS_USAGE_STATS CF_DEFAULTS_DYNAMIC_STRING
240 
241 // MCU emulator default configuration path
242 #define CF_DEFAULTS_MCU_CONFIG_PATH CF_DEFAULTS_DYNAMIC_STRING
243 
244 // Which executables to run under strace by default
245 #define CF_DEFAULTS_STRACED_HOST_EXECUTABLES ""
246 
247 // Whether to use sandbox2 to lock down host processes where policies exist
248 #define CF_DEFAULTS_HOST_SANDBOX false
249 
250 // Whether to exit when heuristics predict the boot will not complete
251 #define CF_DEFAULTS_FAIL_FAST true
252