Upload
bin-chen
View
156
Download
1
Embed Size (px)
Citation preview
An Overview of BrilloBin Chen, GDG DevFest Sydney 12/2016
1 / 22
About meSenior Engineer at Linaro.org
Working on Android OS
2 / 22
BrilloMinimized Android
Same architecture
Security
OTA update
IoT related core Services
Ability to access Low level interface
Http server
Weave: A devicephonecloud communication protocol
3 / 22
Brillo Architecture +--------------------------------------------------+ | C/C++ Applications | +--------------------------------------------------+ | Binder +--------------------------------------------------+ | C/C++ Library & Services | | (update_engine firewalld media | | bionic camera PIO webservd Weaved ) | +--------------------------------------------------+ +--------------------------------------------------+ | Hardware Abstraction Layer | | (BT WIFI NFC Sensors Camera Audio | | I2C GPIO PWM LED) | +--------------------------------------------------+ +--------------------------------------------------+ | Linux Kernel / Device Drivers | +--------------------------------------------------+ +--------------------------------------------------+ | Hardware | +--------------------------------------------------+
4 / 22
SecurityOne top of Linux kernel security
UID/GID based sandboxing
SELinux: defaultdeny, must be explicit allowed by policy
Secure Boot
Full Disk Encryption
Firewall (new in Brillo)
OAuth2 authentication
SSL
Hardwarebacked Crypto
5 / 22
OTA Updatepush new update to your device overtheair
Background
reduced downtime with extra partitions
be able to rollback; redeclared possibility of a bricked device
secure end to end
6 / 22
Media - Graphic, Display, CameraNo Graphics (e.g OpenGL)
No Display (SurfaceFlinger,HWC)
Support Camera with NDK API
Support Audio
7 / 22
SensorsUse Sensor with NDK API
all sensors supported by Android will be supported
8 / 22
ConnectivityBluetooth, BLE (central & peripheral)
Wifi
NFC
No 802.15.4(LRWPAN:Zigbee, Thread)
No LPWAN (LoRa, Sigfox, NBIOT)
9 / 22
HW I/O - Peripheral ManagerProvide platform independent API for accessing hardware I/O.
New Services added by Brillo
Client/Server, peripheralman daemon, Binder as IPC
C client API (create binding for your favourite languages)
Supported Protocols: GPIO, I2c, LED, SPI, UART
10 / 22
WebServerdA web server deamon build on top of libmicrohttpd
Weave is one of the client
11 / 22
show me the CODE!// 1. create your handlerconst char PingRequestHandler::kMethods[] = ""; // all methodsconst char PingRequestHandler::kUrl[] = "/webservd-test-client/ping";class PingRequestHandler : public RequestHandlerInterface void HandleRequest(std::unique_ptr<Request> /* request */, std::unique_ptr<Response> response) override response->ReplyWithText(200, "Hello World", brillo::mime::text::kPlain); ; // class PingRequestHandler
// 2. register it to webservdwebserver_ = Server::ConnectToServerViaBinder(ProtocolHandler* http_handler = webserver_->GetDefaultHttpHandler();http_handler->AddHandler( PingRequestHandler::kUrl, PingRequestHandler::kMethods, std::unique_ptr<RequestHandlerInterface>(new PingRequestHandler())););
// 3. call it$ curl http://localhost:8080/webservd-test-client/pingHello World!
12 / 22
Weave"A communications platform for IoT devices that enables device setup, phonetodevicetocloudcommunication, and user interaction from mobile devices and the web"
+-------------+ | | +-----------+ Cloud +------+ | | | | | +-------------+ | Weave Weave | |+------+------+ +--------+------+| | | || Device +----Weave-------+ Phone || | | |+-------------+ +---------------+
Interoperability : schema
Device Management & Cloud : privet
13 / 22
Weave - Schema: Interoperability
Device, Components, Trait, Command, State
Bluetooth: "Profile, Service, Characteristic":
Device +-------------------------+ | | | Component(s) | +---------+ | +-------------+ | | Command | Write | | +--------+ | | | |------------------>|Trait(s)| | | +---------+ | | +---+----+ | | +---------+ | | | | | | | Read | +-------------+ | | State |<----------------------+ | +---------+ | | +-------------------------+
Weave will manage those Components
14 / 22
Schema : An example
const char kTraits[] = R"( "onOff": "commands": "setConfig": "minimalRole": "user", "parameters": "state": "type": "string", "enum": [ "on", "off" ] , "state": "state": "isRequired": true, "type": "string", "enum": [ "on", "off" ] )";
15 / 22
Weave - Privet: Device Management & Google Cloud
Device <> Cloud: REST API
Device Information
Pairing
Authentication
Access Control
Manage Components & Commands
CheckForUpdate
16 / 22
show me the CODE!
AddHandler("/privet/info"); AddHandler("/privet/v3/pairing/start", AddHandler("/privet/v3/pairing/confirm", AddHandler("/privet/v3/pairing/cancel", AddSecureHandler("/privet/v3/auth", AddSecureHandler("/privet/v3/accessControl/claim", AddSecureHandler("/privet/v3/accessControl/confirm", AddSecureHandler("/privet/v3/setup/start", AddSecureHandler("/privet/v3/commands/execute", AddSecureHandler("/privet/v3/commands/status", AddSecureHandler("/privet/v3/commands/cancel", AddSecureHandler("/privet/v3/commands/list", AddSecureHandler("/privet/v3/checkForUpdates", AddSecureHandler("/privet/v3/traits", AddSecureHandler("/privet/v3/components",
17 / 22
Brillo Developer Kit (BDK)Three parts:
1. The initial bdk contains common code all products need
2. Board support package (BSP) for a particular board
bootloader, drivers, hals and firmware
brunch bsp install
1. Your service/product code
brunch product
18 / 22
Support Platforms and TargetsAcrosss different hardware platforms: Intel X86, ARM, MIPS
Storage : 128M
RAM : 32M
19 / 22
Development EnvironmentExactly the same as Android Platform Development.
Language : C++/C
IDE : do we need one??
Build : Android.mk/Android.bp
Flash : fastboot
Debug : adb, logcat, gdb, printf/k!
20 / 22
Get started and Get involved.Checkout, Build and Run!
# Checkoutrepo init -u https://android.googlesource.com/brillo/manifest -b masterrepo sync# Buildsource build/envsetup.sh; lunch brilloemulator_x86-engmake# Run the simulatorout/host/linux-x86/bin/brilloemulator-x86
Next, submit a patch. It is open source.
21 / 22
Discussion?Thank you.
22 / 22