In order to quickly support Android Wear smartwatches, Asteroid is built upon libhybris a component that allows us to reuse Android Wear’s drivers. That’s why the first step in porting Asteroid to a new watch is to build an Android /system directory. To boot the device, we also use a modified Android Linux kernel that already supports the targeted platform but with some modifications needed by systemd or other tools. And finally the Asteroid build is made reproductible via OpenEmbedded so we need to create an OE layer for every new device.
The easiest way to create an OpenEmbedded to support a new watch is to modify the only one that already exists: meta-dory-hybris (dory is the codename of the LG G Watch). So you can start by cloning https://github.com/AsteroidOS/meta-dory-hybris into meta-yourWatch-hybris.
Replace references to dory in conf/ by yourWatchName, don’t forget to adapt the CPU .inc file sourced in conf/machine/yourWatch.conf. You might not need recipes-qt/ and recipes-core/msm-fb-refresher/ (which are needed on Qualcomm SoCs) so you can probably remove them right away.
You first have to find the git repository containing the source code of the watch you want to work on. Then try to find the corresponding defconfig, it should probably be in arch/arm/configs/ (e.g: dory_defconfig). Copy this defconfig somewhere and use the check-defconfig script in the scripts/ directory of the meta-asteroid layer. You can copy your new defconfig onto meta-yourWatch/recipes-kernel/linux/linux-yourWatch/defconfig. Then modify meta-yourWatch/recipes-kernel/linux/linux-yourWatch_*.bb to suit the information of your kernel (for example change the branch, repository and SRCREV commit hash)
Only some components are needed from Android, so we don’t need to build a full Android system. We will start by cloning a stripped down Android source tree and compile the drivers that are needed. You can find detailed info of the adaptations that have been made for dory in meta-dory-hybris/README-system-dir. You will probably have to adapt it to your own needs. Once you get a working /system/ directory you can modify meta-yourWatch-hybris/recipes-android/android/android_yourWatch-*.bb to use your dir.
Modify the “prepare-script.sh” script of the asteroid git repository according to the “newWatch” comments so that your device can be easily built for by new-comers.
One thing is sure, things won’t work as directly as detailed here. Many modifications are needed and not documented here, so joining the #asteroid IRC channel on freenode is a good way to get help on the different problems you will meet.