I've been trying to build an android automotive emulator to enable Bluetooth support. There are instructions at https://source.android.com/devices/automotive/start/passthrough. However, the instructions leave quite many blanks and I would need advice from someone who is more experienced in making android custom builds.
System:
I'm building on a separate Linux computer, but I'm planning to use the AVD image on windows. I'm building an x86 64-bit variant.
Current status:
I have built an android AVD image, and I have built a custom goldfish-kernel-54 (without modifications), as specified in the previous section of the linked instructions. I'm able to run the image in the emulator. Now I will need to add Bluetooth support.
Problems:
I will quote the instructions and explain what I have done. I will bold the parts which I'm unsure of or which got me stuck.
Kernel:
- Add the missing
btusb.ko
to your kernel:
There is no "goldfish_defconfig" file in that repo. However, there is file "common/arch/x86/configs/x86_64_defconfig". Is that the correct file?
Guest android:
- In the
vendor.mk
file, include the Linux native HIDL and several permissions:
Modified file "device/generic/goldfish/vendor.mk", should be ok.
- Create a one-way path property to switch out the HIDL such that it uses a Linux native HIDL implementation
The instructions tell me to modify files "selinux/common/domain.te" and "selinux/common/property_contexts". However, there is no folder "selinux". I modified files "device/generic/goldfish/sepolicy/common/property_contexts" and "device/generic/goldfish/sepolicy/common/property_contexts". Are these files correct?
- Whenever a property qemu.preferred.bt.service is set to pass through, you'll switch out the HIDL implementation
service btlinux-1.1 /vendor/bin/hw/android.hardware.bluetooth@1.1-service.btlinux
class hal
user bluetooth
group bluetooth net_admin net_bt_admin
capabilities NET_ADMIN NET_RAW SYS_NICE
disabled
on property:qemu.preferred.bt.service=passthrough
stop vendor.bluetooth-1-1
start btlinux-1.1
This is the part where I'm completely stuck. What am I supposed to do with the provided code snippet? Should I modify some existing file or add new file, and where?
- Add a Bluetooth configuration file to get full features, such as on a real USB device
hal/bluetooth/bdroid_buildcfg.h
#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
#define BTM_DEF_LOCAL_NAME "gCar Emulator"
#define BTA_AV_SINK_INCLUDED TRUE
/* Handsfree device */
#define BTA_DM_COD {0x26, 0x04, 0x08}
#endif
Here I'm stuck as well. What should I do with the provided code? Which file should I modify?
- Modify the
BoardConfig.mk
file to determine where the configuration file is saved
I modified file "device/google_car/avd_car/avd_car_device/BoardConfig.mk" (created in earlier phase when following given instructions). Is that the correct file, or should I have modified some file in goldfish folder?
Thanks in advance for any advice!