Lund Linux Conference 2016, Lund, Sweden - Introduction to Brillo OS & Weave
-
Upload
constantin-musca -
Category
Documents
-
view
295 -
download
0
Transcript of Lund Linux Conference 2016, Lund, Sweden - Introduction to Brillo OS & Weave
Intel Corporation
Introduction to Brillo & WeaveLund Linux Conference 2016
Constantin Musca – Intel Corporation
Outline
2
I. Context
II. Problem statement
III. The Brillo & Weave solution
IV. Brillo Hello World
V. Brillo Starter Boards from Intel
VI. Next steps
Context
Source: pixabay.com3
Problem statement
Source: pixabay.com4
• IoT Standardization and compatibility
• Device integration
• Open devices and products
• Embedded OS
• Core services
• Developer kit
What is Brillo?
Source: Google
• Open Source
• Maintained
• Supports devices with a small footprint
• CustomizableHardware
Linux Kernel
Android HAL
Device
Admin
System
Services
OTA
updates…Connectivity
The Brillo Operating System
Source: Google
• Weave
• Metrics
• Crash reporting
• OTAs
The Brillo Core Services
Source: Google
• Based on the Android.mk architecture
• Standard testing
• Android debug bridge (adb)
The Brillo Developer Kit
Source: Google
• Protocol for device discovery, provisioning, authentication, and interaction
• Schema Driven (JSON)
• OAuth 2.0 Authentication
Weave
Source: Google
Weave Commands Schema Example
10
"commands": {
"set_bedroom_1_door_state“: { … }
…
"set_garage_door_state": { … },
"set_target_temperature": {
"parameters": {
"temperature": {
"type": "number"
}
}
},
"set_light": {
"parameters": {
"onState": {
"type": "string"
},
"saturation": {
"type": "number"
},
"brightness": {
"type": "number"
},
"hue": {
"type": "number"
}
}
}
} Source: developers.google.com/weave
Weave Device State Schema Example
11
"state": {
"bedroom_1_door": {
"type": "string",
"enum": ["locked", "unlocked"]
},
...
"garage_door": {
"type": "string",
"enum": ["opened", "closed"]
},
"nest_thermostat": {
"target_temperature": {
"type": "number"
},
"current_temperature": {
"type": "number"
}
},
"philips_hue_light“: { … },
…
}
Source: developers.google.com/weave
Source: Google
Weave command/data flow
Binder
• View Device Status
• Rename Devices
• Share Devices with apps, friends
• Send commands to Devices
Graphic Source: Google
Google Cloud Administration
Source: Google
Connect to the Brillo’s WiFi AP via a Mobile Device
Provide information to the Device:
• OAuth* 2.0 identity
• WiFI Access Point
• PIN Code
Device contacts the Cloud
− Downloads updates
The Device is Ready
Registering (provisioning) a Brillo device
Brillo Yocto
Kernel Linux Linux
libc bionic eglibc
Init init.rc init.d
IPC Mechanism Binder D-BUS, Linux IPC
Build system Android.mk BitBake
Compatibility with Android
Source Packages
Yes No
Open Source Yes (AOSP) Yes (github)
Brillo vs Yocto
• Download the BDK
• Build a product
• Flash the device
• Execute.... and watch the blinky lights
Brillo Hello Worldhttps://codelabs.developers.google.com/codelabs/brillo-hello-leds-edison
$ TOP=/build
$ export BDK_PATH=$TOP/bdk
$ cd $TOP
$ curl https://dl.google.com/dl/brillo/bdk/latest/bdk-latest.tar.gz
$ tar xf bdk-latest.tar.gz
$ cd $TOP/bdk
$ tools/bdk/brunch/brunch bsp download edison
$ mkdir $TOP/products && cd $TOP/products
$ ${BDK_PATH}/tools/bdk/brunch/brunch product create helloLEDs
edison
$ cd $TOP/products/helloLEDs
$ echo hello_led_service >> config/packages
$ cd $TOP/products/helloLEDs/src
$ mkdir hello_led_service
Project setup
hello_led_service/hello_led_service.cpp
#include <unistd.h>
#include <stdio.h>
#include <mraa.h>
int main(__unused int argc, __unused char* argv[]) {
const unsigned gpio[] = {0, 1, 2};
const int gpio_count = sizeof(gpio)/sizeof(*gpio);
mraa_gpio_context m_gpio[] = {NULL, NULL, NULL};
mraa_init();
for (int i = 0; i < gpio_count; i++) {
m_gpio[i] = mraa_gpio_init(gpio[i]);
if (!m_gpio[i])
return 1;
mraa_gpio_dir(m_gpio[i], MRAA_GPIO_OUT);
}
for (int iterations=0; iterations < 3; iterations++)
{
for (int i = 0; i < gpio_count; i++) {
mraa_gpio_write(m_gpio[i], 1);
sleep(1);
}
for (int i = gpio_count-1; i >= 0; i--) {
mraa_gpio_write(m_gpio[i], 0);
sleep(1);
}
}
for (int i = 0; i < gpio_count; i++)
mraa_gpio_close(m_gpio[i]);
return 0;
}
Write your App, Build and Flash
hello_led_service/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello_led_service
LOCAL_SRC_FILES := hello_led_service.cpp
LOCAL_SHARED_LIBRARIES := libc libbase libmraa
LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)
$ cd ~/products/helloLEDs
$ source envsetup.sh
$ m –j 20
$ provision
$ adb shell hello_led_service
$ du -s -h .
13G .
$
Write your App, Build and Flash
$ cd src/hello_led_service/
$ touch hello_led_service.cpp
$ mm -j20
Building submodule only . . .
Output will be placed in /spare/PROD/helloLEDs/out
...[ 14% 1/7] target C++: hello_led_service <= /spare/PROD/helloLEDs/src/hello_led_service/hello_led_service.cpp
...
#### make completed successfully (1 seconds) ####
$ adb root
restarting adbd as root
$ adb remount
remount succeeded
$ adb sync
/system/: 1 file pushed. 706 files skipped. 0.0 MB/s (5516 bytes in 0.225s)K
/data/: 0 files pushed. 7 files skipped.
$ adb shell hello_led_service
$
Time Saver – Submodule Build and “adb sync”
Brillo Starter Boards from Intel
Edison Arduino
MinnowBoard
Edison SparkFun
The Intel® Edison Kit for Brillo
• The Intel® Edison kit with the Arduino
Expansion Board was the first Brillo Starter
Board
• Intel is providing the board support package
• MANY sensors and devices are available for
prototyping with this board
• Brillo Starter Board
• Supported in AOSP since Nov ‘15.
Intel® Edison Board for SparkFun
Compare to the Intel® Edison kit with Arduino:
• Same Edison CPU Module
• Simpler GPIO/Bus structure
• Stack on boards
• Smaller form factor
• Battery power available
• Many sensors available
• Brillo Starter Board
• Supported in AOSP since February
Intel® Expansion Kit with MinnowBoard
• Similar Bus availability to Intel® Edison kits
• More powerful processor, Graphics and GPU enabled
• Larger RAM
• Additional storage options
• Add “lures” to expand to additional busses, sensors
• Brillo Starter Board
• Supported in AOSP since February
Next Steps
Likely futures for Brillo:
• Camera Support
• Display via Surface Flinger
• Bluetooth*
• Other connectivity options
Intel Exploring:
• JavaScript
• Node.js
• NW.js (for display)
Questions?
Legal Notices and Disclaimers
Intel technologies’ features and benefits depend on system configuration and may require enabled
hardware, software or service activation. Learn more at intel.com, or from the OEM or retailer.
No computer system can be absolutely secure.
Tests document performance of components on a particular test, in specific systems. Differences in
hardware, software, or configuration will affect actual performance. Consult other sources of
information to evaluate performance as you consider your purchase. For more complete information
about performance and benchmark results, visit http://www.intel.com/performance.
Intel, the Intel logo and others are trademarks of Intel Corporation in the U.S. and/or other countries.
*Other names and brands may be claimed as the property of others.
© 2016 Intel Corporation.