Building AsteroidOS

> Building AsteroidOS

If you decide to compile AsteroidOS from source be aware that it’s a simple process but the first build might take you a lot of time. Report any problem to the issues tracker:

Building

Start by cloning the main repository using the following command:

git clone https://github.com/AsteroidOS/asteroid.git
cd asteroid/

This repository only contains a shell script that populates src/ with OpenEmbedded and the appropriate layers. Then, it setups the environment for a bitbake build. This command will setup a build for dory, the LG G Watch, but you can also build an image for bass, the LG G Watch Urbane, sparrow, the Asus Zenwatch 2 and tetra the Sony Smartwatch 3.

. ./prepare-build.sh dory    # Be careful that this script must be sourced and not only ran.

Now that the environment is correctly setup, you should be in the build directory. You can now ‘bake’ your asteroid system. Make sure you have the following build dependencies:

git build-essential diffstat gawk chrpath

And then you can run:

bitbake asteroid-image

After a while, the generated image should be available in build/tmp-glibc/deploy/images/dory/.

Installing

Note: On the LG G Watch, the Android settings can be opened without first coupling the device by holding the power button on the back just above the charging area.

In order to use AsteroidOS, your watch’s bootloader needs to be unlocked. It can be unlocked by rebooting into bootloader mode and unlocking it. To reboot your watch to bootloader mode, you need to enable ADB/Android Debugging in Android’s settings. ADB Debugging is normally listed under Developer options, which may need to be enabled by tapping Build number in the About page several times. If adb doesn’t recognize your device and you are sure you have enabled ADB Debugging in Developer options, use this guide and unplug and replug your watch.

adb reboot bootloader
fastboot oem unlock # Accept the notice message

Unlocking the bootloader will perform a factory reset, so you must reboot into Android Wear and reenable developer mode and adb debugging.

You can now try the built image without removing your Android Wear system.

Send the build (which may take several minutes):

adb push -p build/tmp-glibc/deploy/images/dory/asteroid-image-dory.ext2 /sdcard/linux/rootfs.ext2

Boot the build via fastboot (which you must do each time you want to boot into Asteroid instead of Android Wear):

adb reboot bootloader
fastboot boot build/tmp-glibc/deploy/images/dory/zImage-dtb-dory.fastboot

Enjoy! Note that when AsteroidOS is up and running you should be able to run adb shell from your computer to get a remote root shell.

About the author: kido