Upload
lisa-barret
View
214
Download
2
Tags:
Embed Size (px)
Citation preview
Software Development on MeeGo OS
Weibin Pan
Open Source Technology Center
System Software Division
Software & Services Group
22Software and Services Group 2
Intel Confidential
Legal Disclaimer
• INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. EXCEPT AS PROVIDED IN INTEL’S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND/OR USE OF INTEL PRODUCTS, INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT, OR OTHER INTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life-saving, life-sustaining, critical control or safety systems, or in nuclear facility applications.
• Intel products may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
• Intel may make changes to dates, specifications, product descriptions, and plans referenced in this document at any time, without notice.
• This document may contain information on products in the design phase of development. The information here is subject to change without notice. Do not finalize a design with this information.
• Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them.
• Intel Corporation may have patents or pending patent applications, trademarks, copyrights, or other intellectual property rights that relate to the presented subject matter. The furnishing of documents and other materials and information does not provide any license, express or implied, by estoppel or otherwise, to any such patents, trademarks, copyrights, or other intellectual property rights.
• Wireless connectivity and some features may require you to purchase additional software, services or external hardware.
• Performance tests and ratings are measured using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware or software design or configuration may affect actual performance. Buyers should consult other sources of information to evaluate the performance of systems or components they are considering purchasing. For more information on performance tests and on the performance of Intel products, visit Intel Performance Benchmark Limitations
• Intel, the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
• *Other names and brands may be claimed as the property of others.• Copyright © 2008, 2009, 2010 Intel Corporation. All rights reserved.
33Software and Services Group 3
Intel Confidential
Agenda
• MeeGo Overview
• Fastboot and power management of MeeGo
• MeeGo SDK
44Software and Services Group 4
Intel Confidential
Media PhoneHandheldsNetbooks IVI
SmartTVTablets
Intel® Atom™ Developer Program & AppUp(SM) Center
Single Unified Operating Environment
Platforms based on Intel® Atom™ processors
MeeGo is a continuation of Intel’s Atom software strategy execution
MeeGo Strategy – Spans Multiple Segments
55Software and Services Group 5
Intel Confidential
MeeGo 1.0 for Netbooks – Early Reviews
• Includes Netbook user experience• Supported by multiple operating system vendors• Core OS support for multi-architecture
May 27, 2010
MeeGo … Performance:
It's Beating Ubuntu & Co
May 28, 2010
“MeeGo is going to become a major force in the mobile Linux market”
May 28, 2010
MeeGo 1.0 … looks shockingly stupendous
May 27, 2010
MeeGo for Netbooks released – and it’s fast
eWeek LinuxDevices.com
“First, it’s fast. I mean, really, really fast.” Liliputing
66Software and Services Group 6
Intel Confidential
MeeGo Tablet Preview @ Computex 2010
“…the most impressive thing may have just been MeeGo running on a 10-inch Moorestown Quanta Redvale tablet….To say we're impressed with the "pre-alpha" version of the software is a huge understatement.“
“I have to say, I’m pretty excited about the prospect of tablets running MeeGo. ...the user interface really looks like it was designed to be touched.”01 June 2010
01 June 2010
77Software and Services Group 7
Intel Confidential
MeeGo Value to Developers
Open Standards
Open framework to innovate new usages and, shape the evolution of the software platform via code contributions
MarketOpportunity
Deployed across many computing device types - including pocketable mobile computers, netbooks, tablets, in-vehicle infotainment devices
Faster TTMQt* and Web runtime for app development - Qt for native C++ and Web runtime for Web – brings cross platform development so apps can span multiple segments
ToolsComplete set of tools for developers to easily and rapidly create a variety of innovative applications – QtCreator for native and plugins for standard web development tools
Revenue Opportunity
Monetize thru’ multiple AppUpSM Center Store fronts and Nokia’s Ovi Store
88Software and Services Group 8
Intel Confidential
MeeGo ArchitectureM
eeG
o O
SM
iddl
ewar
e
Internet Svcs
Layout EngineWebKit
Web ServiceslibSocialWeb
LocationGeoClue
Web RunTimeWebKit
Mee
Go
OS
Bas
e
Handset UI Framework
Handset UI and Applications
MeeGo Handset UX
Mee
Go
Use
rE
xper
ienc
e
Netbook UI Framework
Netbook UI and Applications
MeeGo Netbook UX Other UXs
Settings DatabaseGConf
System Librariesglibc, glib, etc
Message BusD-Bus
Linux Kernel
MeeGo APIs including Qt UI Toolkit
HW Adaptation Software
Visual Svcs
3D GraphicsOpenGL / GL ES
2D GraphicsCairo, QPainter
I18n RenderingPango, QtText
X
Telephony APIsoFono
Connection MgmtConnMan
Comms Svcs
Cellular StackoFono plug-ins
IP, VOIP, IM, PresenceTelepathy
BluetoothBlueZ
Context FrameworkContextKit
Content FrameworkTracker
Package ManagerPackageKit, RPM
Data Mgmt
Backup & Restore
DeviceHealth
Resource Manager
SensorFramework
Device Svcs
SE
CU
RIT
Y
Platform InfoDevice Kit
Personal Svcs
PIM Svcs
Accts & Single Sign-on
Device SyncSyncEvolution
GTK / Clutter
Media Svcs
Media FrameworkGStreamer
UPnPGUPnP
CodecsGStreamer plug-ins
AudioPulseAudio
CameraVideo4Linux
99Software and Services Group 9
Intel Confidential
MeeGo on Atom Features Overview
Note: Some features listed may be segment-specific
Application Development Environment
Application Development Environment
Integrated Social
Networking
Integrated Social
Networking
Cloud-device sync of PIM Data
Cloud-device sync of PIM Data
MeeGoAPIs
Support for Multiple
Multimedia Framework
Support for Multiple
Multimedia Framework
Fastboot & Shutdown
Optimization
Fastboot & Shutdown
Optimization
Improved Power
Management
Improved Power
Management
Connection Manager for
data connectivity
Connection Manager for
data connectivity
Telephony Framework Telephony
Framework
Segment Specific
User Experiences
Segment Specific
User Experiences
Sensor Framework
Sensor Framework
Gesture & MultiTouch Framework
Gesture & MultiTouch Framework
International-ization with UI
guidelines
International-ization with UI
guidelines
1010Software and Services Group 10
Intel Confidential
10
MeeGo User Experience for Netbooks
Customizable – Branded Customer Experiences, Flexible Look and Feel, Powerful 3D Tools and Animation
Easy to Use and Build Upon – Full Internet, Rich Media Consumption, Standards-based
Integrated - Personalized Social Networking Services & Infrastructure
1111Software and Services Group 11
Intel Confidential
Personalized Phone Dialer
Optimized Full Internet Browser
Integrated Personalized Social Networking
MeeGo User Experience for Handsets
Note: Example shown; Final UX may vary
1212Software and Services Group 12
Intel Confidential
MeeGo Application Development Environment
MeeGo offers a complete set of tools for developers to easily and rapidly create a variety of innovative applications
MeeGo offers Qt and Web runtime for app development:
Qt for native C++ and Web runtime for Web applications (HTML, JS, CSS, etc.)
Qt and Web runtime bring cross platform development so apps can span multiple platforms
Native development tool: Qt Creator
Web development tools: plug-ins for standard web development tools including Aptana and DreamWeaver
MeeGo APIsWeb
Runtime+
1313Software and Services Group 13
Intel Confidential
Platform Development Tools
Open Source Tools
MeeGo™ Image Creator Create custom target images
for various boot formats
GNU tools (gcc, gdb,…)
PowerTop (IA only) Platform level power analysis
and optimization tool
Intel Commercial Development Tools (IA Only)
Intel C/C++ compiler (icc)
Intel JTAG and application debuggers
Intel IPP (Performance primitives)
Intel Vtune Performance Analyzer
1414Software and Services Group 14
Intel Confidential
MeeGo Is Ecosystem Business Model-Friendly
MeeGo* Platform
Adapted for target usage models
3rd Party ISV Applications and Services
OEM/SP Branded Applications and Services
Cloud-Based Services
3rd Party Runtime
Applications and Services
Value-add Features
•Native or runtime based•Operator brand opportunities•Differentiation opportunities
Common Stable Core OS•Open Source
1515Software and Services Group 15
Intel Confidential
Cross App Store Development Toolkit
1000s of QT applications
Developers/ISVs
MeeGo APIs
MeeGo UI Toolkit
1616Software and Services Group 16
Intel Confidential
MeeGo Application Ecosystem
1000s of Qt Apps running on other operating systems e.g. Symbian
1000s of Runtime Apps
1000s of QT applications
100s of Native Linux Apps
Recompile
1000s of Qt Apps running on other
operating systems e.g. Symbian
1717Software and Services Group 17
Intel Confidential
Users
Developers & Applications
Compatible HW
OperatingSystems
Atom platform portal for consumers
Intel + OEM/service provider co-branded app stores
Targeting rich catalog of applications
For OEMs/service providers
Intel AppUpSM Center for TTM
Intel drives ISV recruitment & development
Co-Branded Store with Revenue share
App store scalable to future devices: smart phones, handheld, embedded
For ISVs
Tools, SDKs for MeeGo, Windows, and various run times
New sales channel
Intel AppUpSM Center & Intel® Atom™ Developer Program
* Other Names and Brands maybe claimed as the property of others. All dates, plans and features are preliminary and subject to change without notice.“ Intel, the Intel logo, Intel Atom and Intel Atom Inside are trademarks of Intel Corporation in the U.S. and other countries.”
Get more details at: http://appdeveloper.intel.com
Developer Framework
App Store
1818Software and Services Group 18
Intel Confidential
Intel AppUpSM Center Beta
http://appdeveloper.intel.com
App Store for MeeGo™ Goes live soon (http://intelappup.com) Co-Branded stores in development
Community Strength 3.3M mobile/wireless developers worldwide 267K developers; up 220% YoY Developers growing 3x faster than
general mobile/wireless developer population
Evans Data Corp – Dec 2009
1919Software and Services Group 19
Intel Confidential
MeeGo Working Model
Commercial Solutions
Community Distro, build environment,
SDK…
3rd Party Apps
Closed Source
Codecs
Device Vendors
MeeGo.com
MeeGo.com hosts the core technology development and open source distroCommercial OSVs deliver customized “compliant” products
Upstream Open Source Projects
MeeGo Projects
Open Source Projects
Build
Envir
onm
ent
MeeGo
Core
Net* Reference
MIDReference
IVIReference
Operating System Vendors
2020Software and Services Group 20
Intel Confidential
Moblin v2.2
MeeGo Project Release Schedule
MeeGo Public Community Releases
MeeGo Project Release Cadence: Every 6mo.
MeeGo Distribution Development
4Q’09 1Q’10 2Q’10 3Q’10 4Q’10 1Q’11
OCT DECNOV
JANMAR
FEB APR JUNMAY JUL SEPAUG
OCT DECNOV
APRJAN MARFEB
MeeGo v1.0
MeeGo v1.1
MeeGo v1.2
2121Software and Services Group 21
Intel Confidential
Summary
• MeeGo is a fully open source software platform, under the Linux Foundation
• MeeGo is targeted across a broad range of computing device types - next generation smartphones, netbooks, tablets, Connected TVs, media phones and in-vehicle infotainment systems
• MeeGo provides a common set of APIs across client devices with one unified voice to developers
• MeeGo supports multiple hardware architectures (IA and ARM)
• For more details, visit www.MeeGo.com
2222Software and Services Group 22
Intel Confidential
Agenda
• MeeGo Overview
• Fastboot and power management of MeeGo
• MeeGo SDK
23
Copyright © 2009, Intel Corporation.
Fast Boot Overview
• What does fast-boot mean?– It’s not “booting faster”, but boot as fast as it can.
• Fast boot means “completely done”– CPU and disk are idle.– No deferred work that makes the system unusable for seconds or
minutes.– System is ready to do anything the user wants, including
shutdown.
• Fast boot approaches:– Kernel– Early Userspace– Fast X– Sreadahead
24
Copyright © 2009, Intel Corporation.
Boot Graph/Bootchart
• Boot Graph is a perl-based script to turn a dmesg output into a SVG graphics.
• Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process.
• Provides a shell script to be run by the kernel in the init phase.
• Run in background and collect process information from /proc file system.
• Those data are stored in memory and are written to disk once the boot process completes.
25
Copyright © 2009, Intel Corporation.
Boot Graph
• A perl script(bootgraph.pl) locates at $(linux_source)/scripts
• The kernel needs to be compiled with CONFIG_PRINTK_TIME option.
• “initcall_debug” is passed on the kernel command line.
• After finishing the Linux bring up, executedmesg | perl $(Kernel_DIR)/scripts/bootgraph.pl > output.svg
26
Copyright © 2009, Intel Corporation.
Dmesg Result with CONFIG_PRINTK_TIME Option
[ 0.312659] initcall pdflush_init+0x0/0x11 returned 0 after 73 usecs
[ 0.312779] calling kswapd_init+0x0/0x1d @ 1
[ 0.312937] initcall kswapd_init+0x0/0x1d returned 0 after 42 usecs
[ 0.313097] calling setup_vmstat+0x0/0x99 @ 1
[ 0.313228] initcall setup_vmstat+0x0/0x99 returned 0 after 16 usecs
[ 0.313356] calling mm_sysfs_init+0x0/0x22 @ 1
[ 0.313476] initcall mm_sysfs_init+0x0/0x22 returned 0 after 6 usecs
[ 0.313596] calling proc_vmalloc_init+0x0/0x1f @ 1
[ 0.313715] initcall proc_vmalloc_init+0x0/0x1f returned 0 after 3 usecs
27
Copyright © 2009, Intel Corporation.
output.svg
28
Copyright © 2009, Intel Corporation.
Bootchart
• How it works.– Logger Startup. The boot logger (/sbin/bootchartd) is run by the
kernel.kernel /vmlinuz-2.6.10 ro root=/dev/hda1 init=/sbin/bootchartd
– Data Collecttion.• First the logger store data in memory(tmpfs)• After /proc is mounted, the logger collect the data from
– /proc/stat– /proc/diskstat– /proc/[PID]/stat
• The logger will store the log files to /var/log/bootchart.tgz– Visualization. The log tarball is later passed to the Java application
for parsing and rendering the data to a single image in either PNG, SVG, or EPS format.• /usr/bin/bootchart /home/wq/tmp/bootchart.tgz
29
Copyright © 2009, Intel Corporation.
Bootchard
30
Copyright © 2009, Intel Corporation.
Kernel
• All System components built into the kernel Image. – Modules are slow, synchronous.
• No initrd– initrd is also called as initramfs.– All key drivers are in the kernel.– Initrd /dev is populated with the fixed device node.– Management just plain takes too long.
• Asynchronous function Call
31
Copyright © 2009, Intel Corporation.
Asynchronous function Call
• Decrease boot time by probing the hardware in a parallel manner.
• Sometimes this parallel manner will affect system stability, data consistency and access ordering.
• Taking a carefully controlled approach to booting in parallel.
• Design an API which attempts to hide the effects of parallelization.
32
Copyright © 2009, Intel Corporation.
API--Asynchronous function Call
• The implementation of asynchronous function call is quite simple.– Include <async.h>.– Create an asynchronous function, like the following.
• typedef void (async_func_ptr) (void *data, async_cookie_t cookie).• Data is private data pointer.• Cookie is an opaque synchronization value passed in by the kernel.
– An asynchronous function call is made with a call• async_cookie_t async_schedule(async_func_ptr *ptr, void *data)
– To ensure that the asynchronous functions have completed. • void async_synchronize_cookie(async_cookie_t cookie) • void async_synchronize_full(void) (Ensure that all functions have
completed.)
33
Copyright © 2009, Intel Corporation.
Time Budget
• Kernel (1s)
• X (1s)
• Early userspace (??)
• Home Screen (??)
34
Copyright © 2009, Intel Corporation.
Early Userspace
• Remove unnecessary service (nfs server, mail server, etc.)
• Parallel– Sreadahead– FscheckD-BusXdesktop– Haludevnetwork
• Udev– Persistent /dev reduces overhead enormously
• HAL (Hardware Abstraction Layer)– O(N^2) algorithms fixed
• super readahead (Sreadahead)
• Using Fastinit to replace the traditional boot script for desktop
35
Copyright © 2009, Intel Corporation.
Early Userspace
• Asynchronous for non-critical path.
36
Copyright © 2009, Intel Corporation.
Fast X
• xorg-x11-drv-intel driver– Various "extra" delays trimmed– Flush-TLB for all Intel driver
• Intel video driver– Remove redundancy during the boot sequency.
• X Server– XKB,Caching the result – compute once, use forever– Reuse kernel video mode probed in X
37
Copyright © 2009, Intel Corporation.
Sreadahead
• Read used portions of files in "use order" as early as possible to prime the pagecache.
• A prefetch mechanism optimized for solid state devices
• In terms of spelling, sreadahead is similar with readahead, but they have different strategies, capabilities, and methods.
38
Copyright © 2009, Intel Corporation.
Summary of Sreadahead
• Sreadahead is a daemon that takes a list of blocks to read as input and fetches that data from storage into page cache.
• Retrieve large amounts of data from disk and perform computational tasks on them to boot Linux.– It’s inefficient if we fetch a little bit of data, and compute on that
for a bit.– Sreadahead implementation overlaps the computation with I/O to
decreases the boot-time.
• Readahead implementation can prefetch the data to the memory, but this implementation has some flaws.
39
Copyright © 2009, Intel Corporation.
Flaws of Readahead Implementation
• Over-prefetch issue. – It reads the entire file into memory, which may be much more
than is actually needed.
• Ordering issue. – It also could potentially spend a lot of time reading a really large
file that is used last at the start of it's run, thereby stalling the CPU, which is waiting for data that could be at the end of the list.
40
Copyright © 2009, Intel Corporation.
Approaches of Sreadahead
• Sreadahead fixes “over-prefetch issue” by checking the filelist to get which parts of that file are actually read into memory. This is done by sreadahead-pack utility.
• Sreadahead-pack use system call ‘mincore’ to determine whether pages are resident in memory. And Sreadahead prefetch the data and map files into the memory by mmap.
• Sreadahead fixes “ordering issue” by adding a timestamp to each inode with a kernel patch. – Add a created_when parameter to marks the time that the inode
was created which marks the 'first use' time. – walk all the existing inodes in a filesystem and order all the files
by this timestamp, thus extracting a list perfectly ordered by 'use' order.
41
Copyright © 2009, Intel Corporation.
How sreadahead Works
• Get the sreadahead package. sreadahead-0.10.tar.gz.– Extract it and make it, and you’ll get two utilities: sreadahead and
sreadahead-pack.– Don’t forget patch 0001-superreadahead-patch.patch to Linux kernel.
• Create the filelist for sreadahead implematation.– readahead-pack must be run on the target system after a clean boot to
generate the file list.• find / -xdev -type f | grep -v "/usr/src" | grep -v "/usr/include" > tempfile• sreadahead-pack tempfile (will generate readahead.packed file at the current
directory)• mv readahead.packed /etc/readahead.packed
• The following line would be added to the top of /etc/rc.sysvinit (or equivalent)– /sbin/sreadahead
• Reboot your box, and normally it will decrease boot-time at least 1s~2s.
42
Copyright © 2009, Intel Corporation.
Agenda
• MeeGo Overview
• Fastboot and power management of MeeGo
• MeeGo SDK
43
Copyright © 2009, Intel Corporation.
Power Involves Every Component
44
Copyright © 2009, Intel Corporation.
Power Involves Every Component
CPU7%
GMCH9%
ICH5%
Memory2%
Clock5%
Comm2%
Audio4%
Backlight30%
LCD Panel10%
HDD8%
VR9%
Other9%
Power breakdown of a typical idle laptop
45
Copyright © 2009, Intel Corporation.
Power Saving Principles
• Power Saving– If you don’t use it, turn it off– If you can’t turn it off, put it to sleep or in low power state– If you are sleeping, don’t wake up often– If you are awake, try to do as much as you can so you don’t
have to wake up soon
Power Basics of CPU
47
Copyright © 2009, Intel Corporation.
Power Basics (CPU Power States)
• Power States– C-states, a set of idle states
• CPU can turn off unused circuits to save power when it is idle. Higher level C-states have more circuits turned off and save more power, but take longer and more power to wake up.
– P-states, performances states, which allow you to scale the frequency in voltage of your CPU• Higher P-states use more power, but provide better performance
– T-staes, thermal states that allow the system to respond to emergency thermal conditions
48
Copyright © 2009, Intel Corporation.
CPU P-states and C-states
C-state power consumption relative to C0: C1 ~40%, C4~12%, C6~1.6%
49
Copyright © 2009, Intel Corporation.
CPU C-States (Saving Power When CPU is Idle)
• While Higher C-states save power, it also takes longer and more power to get out of them.
– Use “cat /proc/acpi/processor/*/power” to get latency info
• Linux Kernel idle governor use the past history of the frequency and duration of stay in C-state to decide which C-state to use when idle.
• Letting the CPU sleep longer allows cpu to go in deep C-state to keep power consumption low.
• Fix high frequency events that frequently wake up the CPU
• Once a CPU is awake, do as much as possible
50
Copyright © 2009, Intel Corporation.
CPU Idle Governors
• Idle governor determines which C-state to put the CPU in during idle time
• Menu Governor– It should be used most of the time, designed for tickless kernel– Looks at system statistics (C-state residency, system activity) to
calculate expected C-state residency time, and determine which C-state to go to
• Ladder Governor– Old idle governor designed for older kernels with regular time
ticks– Stepwise approach to adjust C-state– Does not work well for tickless kernel
51
Copyright © 2009, Intel Corporation.
CPU P-States (Saving Power When CPU is Active)
52
Copyright © 2009, Intel Corporation.
CPU P-States (Saving Power When CPU is Active)
• When CPU is active, its performance and power usage is controlled by performance states (P-states)
• Higher P-states provide better performance but uses more power
• The cpufreq governor controls the transition of CPU to appropriate P-state.
• Governor Options– Ondemand (set according to cpu usage)– Performance (run at highest voltage-frequency)– Powersave (set statically to lowest operating point)– Userspace (permit application to set the operating point)
53
Copyright © 2009, Intel Corporation.
Ondemand Governor
• Ondemand governor usually is the best choice for power saving
• Dynamic switching of CPU voltage and freq (within usecs)
• Algorithm– Periodic check of CPU utilization• increase freq to max if utilization excess up_threshold• decrease freq directly to one that keep cpu 80% busy if
utilization less than down_threshold
54
Copyright © 2009, Intel Corporation.
Processor Tunables
• CPUFreq Governor– /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
• Loaded via– /etc/init.d/powernow or /etc/init.d/cpuspeed
• Ondemand cpufreq governor (control P-states) and Menu idle governor (control C-states) is recommended for best behavior for typical mobile systems
Power Friendly Kernel & Apps
56
Copyright © 2009, Intel Corporation.
Fixing High Frequency Events (Kernel Side)
• Until 2.6.21, kernel programmed the chipset to provide regular time ticks to wake up the CPU every 1/250s or 1/1000s. This prevented CPU from going into deep sleep when idle.
• Since 2.6.22, tickless idle has been introduced so the CPU can remain idle without being waken up by timer tick.– Drivers should avoid timers that are randomly short– Drivers should try to bunch timer events together (say at the start
of a second)• round_jiffies(unsigned long time);
round_jiffies_relative(unsigned long delta); • init_timer_deferrable
57
Copyright © 2009, Intel Corporation.
Grouping Timers
• Grouping timers system-wide will help reduce idle wake ups
58
Copyright © 2009, Intel Corporation.
Fixing High Frequency Events (Userspace)
• Don’t do polling
• Group application timers together at start of second– Use g_timeout_add_seconds in glib
• Use powertop to detect applications waking up CPU frequently
59
Copyright © 2009, Intel Corporation.
Race to Idle
• In general, complete a job as fast as possible, so you can go to idle and enter sleep state faster
• Don’t work well if you go in and out of idle frequently, then it is better to work slower
60
Copyright © 2009, Intel Corporation.
Avoid Frequent I/O
• Any I/O operations to external devices uses power and should be avoided as long as possible
• For media playback, large buffers should be used to avoid frequent disk access
61
Copyright © 2009, Intel Corporation.
Using Power Saving Scheduler
• Scheduler load balance across the cores and logical cpus (hyperthreads) for maximum performance.
• Induces extra wakeups and inter-processor interrupts
• Enable power aware scheduling to load balance intelligenetly and avoid waking up other cores and logical cpus unless really necessary
– echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
– echo 1 > /sys/devices/system/cpu/sched_smt_power_savings
62
Copyright © 2009, Intel Corporation.
BIOS Settings
• Enable the following options to turn on the power saving features of the CPU and chipsets
– Processor C1E support• This enables maximum power saving of the processor when
idle.– Enhanced Speedstep (EIST)• This allows Linux to optimally reduce the frequency and
voltage of the processor when not using the maximum capacity.– Fan control• Set to "auto speed"; this allows the fans to slow down (and
use less power) when the temperatures in the machine allow this.
– Enable the HPET (often called "Multimedia timer") option.• This allows Linux with tickless idle to maximally save power
by being idle longer.
63
Copyright © 2009, Intel Corporation.
Important Kernel Configs
• Kernel Options to Enable Power Saving Features– Tickless System (Dynamic Ticks) a.k.a. Tickless Idle
• CONFIG_NO_HZ=y– HPET Timer Support
• CONFIG_HPET_TIMER=y– Enable CPU frequency governor
• CPU_FREQ=y• CPU_FREQ_GOV_ONDEMAND=y
– Enable CPU idle governor• CONFIG_CPU_IDLE=y• CONFIG_CPU_IDLE_GOV_MENU=y
64
Copyright © 2009, Intel Corporation.
Important Kernel Configs
• Kernel Options to Enable Power Saving Features– Enable USB Suspend
• CONFIG_USB_SUSPEND=y– Enable Power Savings for Sound
• CONFIG_SND_HDA_POWER_SAVE=y (for Intel audio chip)– Enable Timer Stats
• CONFIG_TIMER_STATS=y– Disable IRQ balancing
• CONFIG_IRQBALANCE=n
Tuning System Components
66
Copyright © 2009, Intel Corporation.
Graphics & Displays
• LCD Backlight– Consumes most power – Set backlight to lower percentage of full power• xbacklight -set 50 (50% power)
• Screensavers– Leave the screen active (sometimes even when it is black)– Turn if off completely• xset +dpms• xset dpms 0 0 120 (turn off display after 120 second inactivity)
67
Copyright © 2009, Intel Corporation.
Graphics and Displays
• Use Intel ® Graphics driver (xf86-video-intel) for Intel® Graphics Chipset
• Framebuffer Compression– Use run length encoding to compress line and store in
buffer– Graphics device refresh from compressed lines if possible,
reducing bus traffic and save power– Works on Intel’s 9XX mobile chips (like 915GM and 965GM)– Option “FrameBufferCompression” “True” in
xorg.conf
• Turn off Unused Graphics Output– Use xrandr to check what output are on– xrandr --output <dev> --off
68
Copyright © 2009, Intel Corporation.
WiFi
• Power saving mode (PS-Poll mode)– Tell the access point to hold the packets, so the antenna can be
powered down and not be on all the time– Big impact in power usage (on the order of 0.5W to 1W)– Trade-off is latency and incompatability with old access points– iwpriv eth1 set_power 5 (older devices)– echo 5 > /sys/bus/pci/drivers/iwlagn/*/power_level (newer
devices)
69
Copyright © 2009, Intel Corporation.
WiFi
• Auto Association – This behavior caused the network driver to aggressively try to
scan and associate with an access point, even if the network interface is disabled
– Should be obsoleted and disabled for kernel > 2.6.23 when mac80211 is merged into kernel code• rmmod ipw2200 • modprobe ipw2200 associate=0 • Command is driver specific
• Turn off the wireless completely when not in use– for i in `find /sys -name "rf_kill" ; do echo 1 > $i ; done
70
Copyright © 2009, Intel Corporation.
Ethernet
• Wake on LAN– Allows the ethernet to be turned on remotely via special packet,
but keep the ethernet device busy– Generally should be turned off with ethtool
• ethtool -s eth0 wol d
• Gigabit Ethernet– Power is considerable higher for Gigabit link– We can tune it down to 100 Mbit/sec if Gigabit speed is not
needed• ethtool -s eth0 autoneg off speed 100
71
Copyright © 2009, Intel Corporation.
Bluetooth
• If Bluetooth is unused, it should be turned off– hciconfig hci0 down – rmmod hci_usb
72
Copyright © 2009, Intel Corporation.
USB Autosuspend
• Powering USB bus and keeping it active consumes a lot of power! Avoid USB where possible, power down unused USB devices
• USB selective suspend allows you to suspend a USB device on demand. If one device doesn't support selective suspend, then the entire bus must remain active, and keep CPU busy
• Put USB devices into autosuspend mode
• Use lsusb to find out all the usb devices
• Then use use the sysfs interface to put device in auto mode
– echo auto > /sys/bus/usb/devices/<bus>-<devnum>/power/level
73
Copyright © 2009, Intel Corporation.
SATA Aggressive Link Power Management
• Put SATA link in low power mode when not in use
• Available in kernel for 2.6.24 or later for SATA link using AHCI mode
– echo “min_power” > /sys/class/scsi_host/host*/link_power_management_policy
• Turn off unused AHCI ports in chipset– echo “power_off” >
/sys/class/scsi_host/host*/link_power_management_policy– need special patch
74
Copyright © 2009, Intel Corporation.
VM Writeback Time
• Increase write back time to disk allow for more dirty buffers grouped together into a single write
– echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
75
Copyright © 2009, Intel Corporation.
Filesystem atime
• Each time a file is accessed, its timestamp “atime” gets updated and written to disk
– This keeps the disk and link busy
• This timestamp update can be avoided by remounting the file system with no atime option– mount -o remount,noatime / – mount –o remount,realtime / (a compromise by updating atime
much less frequently)
76
Copyright © 2009, Intel Corporation.
Enable Laptop Mode
• Linux normally does I/O in small amounts, spread out over time, needing to spin the disks frequently
• Laptop mode hold off disk I/O as long as possible– echo 5 > /proc/sys/vm/laptop_mode
77
Copyright © 2009, Intel Corporation.
Reduce Log Messages Flush
• Syslog daemon logs messages from kernel and then issue a sync operation to flush all buffers to disk.
• Disk activities can be reduced by not doing disk sync right after message log, by adding a “-” in /etc/syslog.conf
– *.info;mail.none;authpriv.none;cron.none -/var/log/messages
78
Copyright © 2009, Intel Corporation.
HAL CD Rom Polling
• HAL polls the CD ROM drive regularly to check if a CD has been inserted. Work is underway to use asynchronous notification instead of polling
• To disable polling, use command such as– hal-disable-polling --device /dev/scd0
79
Copyright © 2009, Intel Corporation.
Audio Power Saving Mode
• Linux ALSA drivers support Intel®’s onboard high definition audio’s power saving capability for 2.6.24 and later kernel.
• The power save mode need to be compiled into the kernel.
• To check that it is turned on, – cat /sys/module/snd_hda_intel/parameters/power_save
Power Tuning with Powertop
81
Copyright © 2009, Intel Corporation.
Powertop
• Show how well your system is using the various hardware power-saving features
• Show you the culprit software components that are preventing optimal usage of your hardware power savings
• Help Linux developers test their application and achieve optimal behavior
• Provide you with tuning suggestions to achieve low power consumption
82
Copyright © 2009, Intel Corporation.
Powertop
•
Power Measurement Methods
84
Copyright © 2009, Intel Corporation.
Power Measurements
• Method 1: Instumented Board – The most accurate and detailed power measurements will
be instrumenting the motherboard and measure the voltage and current going into each component
– Need detailed schematics of the circuit with sensing resistor built in and multi-channel multimeter (e.g. Netdaq 2640)
85
Copyright © 2009, Intel Corporation.
Power Measurements
• Method 2: Instrument Battery – Allow for the measurement of the system in battery mode– Need data logger + soldering iron– Measure power consumption of the system as a whole
• Method 3: Use built-in battery instrumentation– /proc/acpi/battery/*/info, state– Not very accurate
• Method 4: Run new battery from full to empty– Take a long time – Need to condition the battery– Battery behavior changes over time
86
Copyright © 2009, Intel Corporation.
Power Measurements
• Method 5: Measure system in AC Mode using watt meter
– Usually good enough for power tuning (Instantaneous feedback)
– Remove battery– Includes power loss in AC/DC converter brick– Platform may run a bit differently on AC (Some BIOS
remove deeper C-states of cpu in AC mode)
87
Copyright © 2009, Intel Corporation.
Battery Life Toolkit
• An open source release of some tools that Intel® OTC developed to measure and improve power management on Linux.
• The intent is to help the community measure and improve itself.
• It is NOT an industry standard benchmark.
88
Copyright © 2009, Intel Corporation.
Summary
• Power tuning requires careful tuning of *ALL* system components
• One bad application can ruin your battery life. Make sure you don’t do polling and your application don’t wake up the system unless necessary
• Use Powertop to check applications
• Do measurements of system power under typical workloads to give you insights and show whether your tunings are effective
• Linux is fast moving, try to use a kernel and distro not more than 6 months old
89
Copyright © 2009, Intel Corporation.
Agenda
• MeeGo Overview
• Fastboot and power management of MeeGo
• MeeGo SDK
90
Copyright © 2009, Intel Corporation.
MeeGo ArchitectureM
eeG
o O
SM
iddl
ewar
e
Internet Svcs
Layout EngineWebKit
Web ServiceslibSocialWeb
LocationGeoClue
Web RunTimeWebKit
Mee
Go
OS
Bas
e
Handset UI Framework
Handset UI and Applications
MeeGo Handset UX
Mee
Go
Use
rE
xper
ienc
e
Netbook UI Framework
Netbook UI and Applications
MeeGo Netbook UX Other UXs
Settings DatabaseGConf
System Librariesglibc, glib, etc
Message BusD-Bus
Linux Kernel
MeeGo APIs including Qt UI Toolkit
HW Adaptation Software
Visual Svcs
3D GraphicsOpenGL / GL ES
2D GraphicsCairo, QPainter
I18n RenderingPango, QtText
X
Telephony APIsoFono
Connection MgmtConnMan
Comms Svcs
Cellular StackoFono plug-ins
IP, VOIP, IM, PresenceTelepathy
BluetoothBlueZ
Context FrameworkContextKit
Content FrameworkTracker
Package ManagerPackageKit, RPM
Data Mgmt
Backup & Restore
DeviceHealth
Resource Manager
SensorFramework
Device Svcs
SE
CU
RIT
Y
Platform InfoDevice Kit
Personal Svcs
PIM Svcs
Accts & Single Sign-on
Device SyncSyncEvolution
GTK / Clutter
Media Svcs
Media FrameworkGStreamer
UPnPGUPnP
CodecsGStreamer plug-ins
AudioPulseAudio
CameraVideo4Linux
91
Copyright © 2009, Intel Corporation.
HW Adaption Software
• HW Adaptation Software– Platform Kernel Drivers – Kernel Core Architecture Patches– Kernel Configuration– X Software Core Architecture Patches– X Software Configuration – Modem Support– Hardware Specific Media Codecs
MeeG
o O
S B
ase
Settings Database System Libraries Message Bus
MeeGo Kernel
HW Adaptation Software
92
Copyright © 2009, Intel Corporation.
OS base
• MeeGo Kernel– MeeGo uses a Linux* kernel from kernel.org, with architecture specific
configuration and patches (as needed). Drivers are provided for each supported platform.
• Settings Database– The central place for storing application preferences and configuration
information
• System Libraries– System libraries include the common LSB libraries, glibc, glib, etc.
• Message Bus– D-Bus provides the message bus for application-to-application communication
MeeG
o O
S B
ase
Settings Database System Libraries Message Bus
MeeGo Kernel
HW Adaptation Software
93
Copyright © 2009, Intel Corporation.
MeeGo Middleware: Comms Services
Connection Management• ConnMan is used to manage data connections (WiFi, WiMAX, 3G, and
connections via Bluetooth* Wireless Technology)
Telephony APIs• oFono* provides the internal APIs for GSM/UMTS telephony applications.
Telepathy provides the API framework for IP-based communication
• Applications will use Qt* APIs to access these services
Cellular Stack• The cellular stack provides oFono* plug-ins to support specific modems
IP (VoIP, IM, Presence)• IP comms includes Telepathy plug-ins for specific instant messaging,
voice-over-IP, and video-over-IP protocols
Bluetooth* Wireless Technology• BlueZ* provides Bluetooth support including DUN, A2DP, headset, etc.
Comms Svcs
Connection Mgmt
Telephony APIs
Cellular Stack
IPVOIP, IM, Presence
Bluetooth* Wireless
Technology
94
Copyright © 2009, Intel Corporation.
Layout Engine• The layout engine renders web content (HTML, XML, images, etc) for on-
screen display.
• The specific layout engine might vary by platform (e.g. WebKit/Chromium* on netbook, Gecko/Fennec* on handset)
Web Services• The Web Services framework (libsocialweb) provides an extensible
framework for exchanging data with social networking/social media sites.
• It also includes libraries to make it easier to interact with RESTful web services (librest)
Web Run Time• The Web Run Time provides an environment for building applications
using web technologies such as Javascript*, HTML, and CSS
• The MeeGo web run-time is based on WebKit
Location• Applications will be able to access the location services through Qt APIs.
• On MeeGo, Qt* location APIs are layered on GeoClue. GeoClue provides a framework for providing location information from multiple providers, including GPS, WiFi, cellular, and IP address location
Internet Svcs
Layout Engine
Web Services
Web Run Time
Location
94
MeeGo Middleware: Internet Services
95
Copyright © 2009, Intel Corporation.
MeeGo Middleware: Visual Services
3D Graphics• An implementation of the OpenGL*/OpenGL ES specifications for
rendering 3D graphics, with support for hardware-acceleration
• Hardware acceleration features vary by platform
2D Graphics• The 2D graphics layer provides advanced 2D drawing capabilities
with support for hardware acceleration
i18n Rendering• The i18n rendering component supports layout and rendering of text
with support for internationalization
X• x.org provides an implementation of the X Window System, with
architecture specific drivers, patches, and configuration as needed.
Visual Svcs
ClutterGTK+
3D Graphics
i18nRendering
X
3D Graphics
95
96
Copyright © 2009, Intel Corporation.
MeeGo Middleware:Media Services
Media Application Framework (MAFW)• The Media application framework provides a set of abstracted services that
can be used to build a media playerMedia Framework• The Gstreamer* media framework supports a wide range of media operations
including audio and video playback, recording, streaming, and editingAudio• The audio subsystem includes audio routing and pulseaudio
Camera• The camera subsystem supports both still and video cameras
Codecs• GStreamer-compatible codecs are supported for encoding / decoding of audio
and video. Codecs may optionally use hardware acceleration.• Only those codecs that do not require commercial licenses (e.g. Ogg Vorbis
and Theora) will be part of the MeeGo base distribution.• Codecs for many popular audio and video formats (e.g. MP3, AAC, MPEG-4,
H.264) require commercial licenses and will not be provided as part of the base MeeGo distribution.
UPnP• GUPnP provides a framework for creating devices and control points that
adhere to the Universal Plug-and-Play specifications
Media Svcs
Media App Framework
Media Framework
Audio
Codecs
UPnP
96
97
Copyright © 2009, Intel Corporation.
MeeGo Middleware: Data Management Services
Content Framework• Content framework provides indexing, meta-data extraction, and
search capabilities for a variety of data types, including media files, documents, etc.
Context Framework• The context framework provides a subscribe and publish mechanism
for information about device context such as cable status, phone position, battery level, etc.
Package Manager• The RPM package manager is used to install and remove packages
Data Mgmt
Content Framework
Context Framework
Package Manager
97
98
Copyright © 2009, Intel Corporation.
MeeGo Middleware: Device Services
Energy Management• Energy management controls energy-related device functions such as
battery charging
Sensor Framework• The sensor framework exposes a common, consistent interface for
sensors with pluggable support for multiple sensor types including accelerometers, ambient light sensors, etc.
System Policy• System Policy provides is the central place for managing device wide
policy information such as audio routing, profiles, device behavior during emergency calls, etc.
System Profiles• The system profiles component manages the system-wide device
profiles (for example, ring and vibrate alert levels)
Device Sync• Device sync provides data synchronization with both servers and
directly with other devices using SyncML
Backup and Restore• Backup and Restore provides services for saving and restoring both user
data and device image to an external backup device
Device Svcs
Energy Mgmt
Sensor Framework
System Policy
Backup & Restore
Device Sync
98
99
Copyright © 2009, Intel Corporation.
MeeGo Middleware:Personal Services
PIM Services
• PIM Services provides a common interface for accessing and storing PIM information (address book, calendar, tasks, and notes)
• Will use Evolution Data Server* (EDS) in the near term
Accounts & Single Sign-on
• Accounts & Single Sign-on stores user account information, including information required to implement single sign-on for both local and remote services
Personal Svcs
PIM Svcs
Accts & Single Sign-
on
99
100
Copyright © 2009, Intel Corporation.
MeeGo UI/Application Toolkits
Supports native (C/C++) and web (HTML, Javascript, CSS) development
MeeGo UI Toolkit
• The MeeGo UI toolkit is the primary toolkit for developing applications and is based on Qt* with specific enhancements and additions such as the Qt Mobility APIs
GTK* and Clutter
• GTK* and Clutter are provided for application compatibility for existing Maemo* and Moblin™ applications
• All new UI and application development work will be based on the MeeGo UI toolkit
MeeGo UI Framework
100
QT introduction
102
Copyright © 2009, Intel Corporation.
QT History
• Developed by Trolltech, acquired by Nokia
• Developed for KDE
• QT vs. GTK
• History• 1994: Trolltech formed, QT is begin from 1991• 1996: KDE started dev• 1998: QT1.4, KDE1.0• 1999: QT2.0, KDE1.1.2• 2000: QT2.2.1, QT Embedded• 2001: QT3.0• 2005: QT4.0• 2008.6: Trolltech acquired by Nokia• 2009.12: QT4.6• 2010.9.21: QT4.7
103
Copyright © 2009, Intel Corporation.
What’s QT
• Everything you need to create web-enabled desktop, mobile and embedded applications.
• Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.
• Linux/X11• Windows• Mac OS X• Embedded Linux• WinCE/Windows Mobile• Symbian• Maemo• MeeGo
104
Copyright © 2009, Intel Corporation.
Features of QT
• Intuitive C++ class library
• Portability across desktop and embedded operating systems
• Integrated development tools with cross-platform IDE• Qt creator• Qt designer• Plug-in for Eclipse• Plug-in for Visual Studio
• High runtime performance and small footprint on embedded
• Good documents, lots of tutorial/sample codes
105
Copyright © 2009, Intel Corporation.
Qt Creator - Cross-Platform Qt IDE
Qt Creator is a cross-platform Qt IDE. It is available as a stand-alone package or in combination with the Qt libraries and development tools as a complete SDK.
Qt Creator includes:• An advanced C++ code editor • Project and build management tools • Integrated, context-sensitive help
system • Visual debugger • Code management and navigation
tools
GUI Builder Internationalization Tools
Customizable HTML Help System Integration/Add-in for Eclipse and Visual Studio
105
106
Copyright © 2009, Intel Corporation.
Qt Creator - Cross-Platform Qt IDE
106
107
Copyright © 2009, Intel Corporation.
Architecture
108
Copyright © 2009, Intel Corporation.
Qt Class Libraries
The modular Qt C++ class library provides a rich set of application building blocks, delivering all of the functionality needed to build advanced, cross-platform applications.
http://qt.nokia.com/products/developer-tools
http://qt.nokia.com/developer
108
109
Copyright © 2009, Intel Corporation.
Signal/Slot
Signals and slots are used for communication between objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks.
110
Copyright © 2009, Intel Corporation.
QT hello world
• Write hello.cpp
• Open Qt terminal• qmake –project• qmake• make
• Run the program
• Qtdemo
#include <QtGui> int main(int argc, char *argv[]){ QApplication app(argc, argv); QLabel label("Hello, world!"); label.show(); return app.exec();}
MeeGo SDK
112
Copyright © 2009, Intel Corporation.
MeeGo SDK options
QEMU Virtual Machine
•Requires Virtualization (VT) support for graphics acceleration• Host system not limited to Intel graphics chipset• Configure to using QT Creator to building and debugging
Change Root with Xephyr
• Requires Intel graphics chipset• Fastest setup and launch time• Easily add new packages to the development environment using "yum install"• Launch Qt Creator from the change root• Start and debug applications from the chroot
MeeGo on Workstation
• Directly develop on MeeGo OS• MeeGo OS is designed for mobile devices and the usage as a desktop is a bit awkward
113
Copyright © 2009, Intel Corporation.
Download the MeeGo SDK Image
• http://wiki.meego.com/Getting_started_with_the_MeeGo_SDK_for_Linux
• OS Requires:– Fedora 13– Ubuntu 10.04– OpenSUSE 11.3
• Netbook– http://download3.meego.com/sep09/meego-netbook-ia32-1.0.80.12.
20100727.1-sdk-pre0901.raw.tar.bz2
• Handset– http://download3.meego.com/sep09/meego-handset-ia32-1.0.80.9.2
0100706.1-sdk-pre0901.raw.tar.bz2
• Unpack the image– tar xvjf <compressed image file>
114
Copyright © 2009, Intel Corporation.
MeeGo SDK with Xephyr
• Requires Intel graphics chipset – lspci | grep VGA– Desired output: 00:02.0 VGA compatible controller: Intel
Corporation ...
• Install the meego-sdk-chroot script– wget http://download3.meego.com/meego-sdk-chroot– chmod +x ./meego-sdk-chroot
• Configure X on the host to allow Xephyr to access the display– xhost +SI:localuser:<user name>– xhost +SI:localuser:root
• If chroot is not in your PATH– alias chroot='/usr/sbin/chroot‘
115
Copyright © 2009, Intel Corporation.
Mount and chroot into MeeGo image
• Create a directory for the MeeGo image contents– mkdir <image destination directory>
• Mount the image into the directory– sudo mount -o loop,offset=512 <image file> <image destination
directory>
• Change the root of the terminal to the MeeGo OS root– sudo ./meego-sdk-chroot <image destination directory>
116
Copyright © 2009, Intel Corporation.
Mount and chroot into MeeGo image
• Example:– sudo mkdir /opt/meego-handset– sudo mount -o loop,offset=512 ./meego-handset-ia32-
1.0.80.9.20100706.1-sdk-pre0721.raw /opt/meego-handset– sudo ./meego-sdk-chroot /opt/meego-handset
• Output:– mount --bind /proc /home/ell/meego-sdk-0524/proc– mount --bind /sys /home/ell/meego-sdk-0524/sys– mount --bind /dev /home/ell/meego-sdk-0524/dev– mount --bind /dev/pts /home/ell/meego-sdk-0524/dev/pts– mount --bind /tmp /home/ell/meego-sdk-0524/tmp– mount --bind /var/lib/dbus /home/ell/meego-sdk-0524/var/lib/dbus– mount --bind /var/run/dbus /home/ell/meego-sdk-0524/var/run/dbus– cp /etc/resolv.conf /home/ell/meego-sdk-0524/etc/resolv.conf
117
Copyright © 2009, Intel Corporation.
Start the MeeGo UI with Xephyr
• Inside MeeGo chroot terminal
• Set the DISPLAY environment variable– export DISPLAY=:0
• Launch Xephyr– startmeego &
118
Copyright © 2009, Intel Corporation.
MeeGo SDK with Xephyr
• Exit the Simulator– exit
• Output– umount /home/ell/meego-sdk-0524/proc – umount /home/ell/meego-sdk-0524/sys – umount /home/ell/meego-sdk-0524/dev/pts – umount /home/ell/meego-sdk-0524/dev – umount /home/ell/meego-sdk-0524/tmp – umount /home/ell/meego-sdk-0524/var/lib/dbus – umount /home/ell/meego-sdk-0524/var/run/dbus
• Debugging the Simulator– startmeego-debug
119
Copyright © 2009, Intel Corporation.
Application Development with chroot
• Running with Xephyr– need to set the $DISPLAY variable to :2
• export DISPLAY=:2• <start your application>
• Running without Xephyr– Although it is not running inside the MeeGo OS UI, it is still using
the MeeGo libraries. – You can put temporary code in your application to manually set its
window size to that of a netbook (1024x600) or handheld (800x480 or 480x800) device
120
Copyright © 2009, Intel Corporation.
Application Development with chroot
• Source Code Management– "mount --bind" your source directory to a subdirectory in the
MeeGo chroot – outside the MeeGo chroot
• $ sudo mount --bind <full path to source directory on host workstation> <full path to MeeGo chroot directory>/<subdirectory in MeeGo>
– For example• sudo mkdir /opt/meego-handset/root/src • sudo mount --bind /home/bob/src/ /opt/meego-handset/root/src/
– Caution• Be sure to unmount this directory when finished and before "rm -rf
/opt/meego-handset" at some later date or your source directory will be destroyed
121
Copyright © 2009, Intel Corporation.
Application Development with chroot
• Qt Creator IDE– Already installed in MeeGo SDK image– launch Qt Creator outside of Xephyr
• export DISPLAY=:0• Qtcreator
• Installing other software– From chroot terminal
• zypper install <package>– You can also upgrade the whole MeeGo image using
• zypper dist-upgrade
122
Copyright © 2009, Intel Corporation.
Application Development with chroot
• Known issues– Panels which rely on DBus (like the battery, networking) don't
report devices properly– Applications that rely on DBus might work inconsistently because
the host workstation's system bus is used.– Currently Xephyr with GL acceleration does not work with Fedora
13
123
Copyright © 2009, Intel Corporation.
MeeGo SDK with QEMU
• Requires Virtualization (VT) support for graphics acceleration– egrep '^flags.*(vmx|svm)' /proc/cpuinfo
• Enable VT– VT Enabled in the BIOS (viturlization technology
(VTx) and viturlization technology directed I/O(VTd))
• KVM module Installed– sudo modprobe kvm_intel– lsmod | grep kvm
• Graphic Hardware Acceleration is Enabled– glxinfo | grep "renderer string“– Good output: OpenGL renderer string: Mesa DRI ...
Bad output: OpenGL renderer string: Software Rasterizer
124
Copyright © 2009, Intel Corporation.
MeeGo SDK with QEMU
• Install QEMU-GL virtual machine– Fedora 12 or 13:
• http://download3.meego.com/sep09/qemu-gl-0.12.4-5.1.i386-fc12.rpm• sudo yum localinstall qemu-gl-0.12.4-5.1.i386-fc12.rpm --nogpgcheck
– Ubuntu 9.10 or 10.04:• http://download3.meego.com/sep09/qemu-gl_0.12.4-4_i386.deb• sudo dpkg -i qemu-gl_0.12.4-4_i386.deb
– Other OS, build from source:• http://wiki.meego.com/MeeGo_SDK_Building_QEMU_Tools
• Download launch script– http://download3.meego.com/sep09/meego-qemu-start– chmod +x ./meego-qemu-start
125
Copyright © 2009, Intel Corporation.
Launch QEMU-GL with the MeeGo image
• To start handset image with Avaa device skin:– ./meego-qemu-start -s aava <handset image>
• To start netbook image without skin:– ./meego-qemu-start <netbook image>
126
Copyright © 2009, Intel Corporation.
Using QEMU for Application Development
• Install Qt Creator and MADDE– 8.3GB free space required– "rpm" build support
• Fedora 12 or 13: sudo yum install rpm-build• Ubuntu 9.10 or 10.04: sudo apt-get install rpm
– Qt Creator with MADDE (MeeGo Application Development & Debug Environment)• http://download3.meego.com/sep09/install-meego-dev-env-0.7.25-linux-i
686.sh• chmod +x install-meego-dev-env-0.7.25-linux-i686.sh• ./install-meego-dev-env-0.7.25-linux-i686.sh• export MEEGO_SDK=$HOME/meego-sdk/0.7.25
127
Copyright © 2009, Intel Corporation.
Using QEMU for Application Development
• Install Qt Creator and MADDE (Cont.)– Create MeeGo development target (toolchain) from image file
• cd $MEEGO_SDK/bin• ./mad-admin create_from_image <compressed image file>
– View targets and runtimes• ./mad-admin list
– Remove targets and runtimes• ./mad-admin remove <target or runtime name>
– Start Qt Creator• ${MEEGO_SDK}/tools/qt-creator/bin/qtcreator
128
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Configure Qt Creator to use the MeeGo toolchain
– Go to the menu: Tools -> Options -> Qt4 -> Qt Versions– Click "+" button, fill "Version name" and "qmake location" of
MeeGo target:• ${MEEGO_SDK}/targets/<target name>/bin/qmake• Please replace ${MEEGO_SDK} by your own SDK installed path
129
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Create a MeeGo touch project (for handset) or Qt Gui
project (for netbook)– Go to the menu: File -> New File or Project -> Qt Application
Project -> Meego Touch Framework Application– At the end of project creation, you will see the "Project setup"
dialog. Choose the MeeGo toolchain you configured
130
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Build configuration of MeeGo project
– Click the "Projects" icon on the left of Qt Creator. The "MeeGo" build and run configuration page will be shown.
– Create a new build configuration by selecting the "Add" dropdown button and selecting the MeeGo toolchain you configured above.
131
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Create an emulator runtime for MeeGo
– Get to the menu: Tools->Options -> Projects -> MeeGo Device Configurations.
– Click "Add" button to add a runtime for emulator.• set "Device type" to "MeeGo emulator"• set "Authentication type" to "Password“• set "Username" to "root", "Password" to "meego"
132
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Set Run Configuration
– Click "Projects" again on the left side. Select "Run" in the MeeGo Build/Run box at the top.
– Make sure that the "Device configuration" is set to "MeeGo Emulator".
– Click the "Start Meego emulator" icon near the bottom left corner of Qt Creator (circled in red in the screenshot below)
133
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Build, run and deploy the application
– After QEMU starts, click the "Run" icon to run your application.• Qt Creator will package and deploy your application to QEMU and start it on
the target
• Debug the application. – You can also debug the application by clicking the "Debug" icon.
Setting breakpoints and stepping are the same as local applications.
134
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Configure Qt Creator to work with real devices
– Get to the menu: Tools->Options -> Projects -> MeeGo Device Configurations.
– Click "Add" button to add a runtime for Real device.• set "Device type" to "Remote Device"• set "Authentication type" to "Password“• set "Username" to "root", "Password" to "meego"
135
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• Configure Qt Creator to work with real devices
– Click "Projects“ on the left side. Select "Run" in the MeeGo Build/Run box at the top.
– Select the configuration you just created in "Device Configuration“– Click "Run" or "Debug" on the lower left corner of Qt Creator to run
or debug your application on the configured Device
136
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• SSH into QEMU Image
– Launch QEMU with MeeGo image– From a terminal on the host, connect to the running image
• ssh [email protected] -p 6666– Two user accounts are available in the MeeGo images:
• User: meego Password: meego• User: root Password: meego
137
Copyright © 2009, Intel Corporation.
Use Qt Creator to Develop MeeGo Applications• MeeGo Touch Framework Help and Documentation
– MTF help document is integrated into Qt Creator • Just click on the "Help" mode, you can see "MeeGo Touch Reference
Documentation" • You can also press "F1" in source code to start context helper.
– The latest Qt and MTF documentation can be found at:• http://meego.com/developers/meego-api
138
Copyright © 2009, Intel Corporation.
Reference
• http://meego.com/developers/meego-architecture
• http://wiki.meego.com/Getting_started_with_the_MeeGo_SDK_for_Linux
• http://meego.com/developers/meego-api
• http://qt.nokia.com/developer
139139Software and Services Group 139
Intel Confidential
Thank You!