Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Development on MeeGo OS

Similar presentations

Presentation on theme: "Software Development on MeeGo OS"— Presentation transcript:

1 Software Development on MeeGo OS
Weibin Pan Open Source Technology Center System Software Division Software & Services Group

2 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.

3 Agenda MeeGo Overview Fastboot and power management of MeeGo MeeGo SDK

4 MeeGo Strategy – Spans Multiple Segments
Smart TV Media Phone Netbooks Tablets Handhelds IVI 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

5 MeeGo 1.0 for Netbooks – Early Reviews
“First, it’s fast. I mean, really, really fast.” Liliputing May 28, 2010 MeeGo 1.0 … looks shockingly stupendous eWeek May 27, 2010 MeeGo for Netbooks released – and it’s fast 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”

6 MeeGo Tablet Preview @ Computex 2010
01 June 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

7 MeeGo Value to Developers
Open Standards Open framework to innovate new usages and, shape the evolution of the software platform via code contributions Market Opportunity Deployed across many computing device types - including pocketable mobile computers, netbooks, tablets, in-vehicle infotainment devices Faster TTM Qt* 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 Tools Complete 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

8 HW Adaptation Software
MeeGo Architecture MeeGo Handset UX MeeGo Netbook UX Other UXs MeeGo User Experience Handset UI and Applications Netbook UI and Applications Handset UI Framework Netbook UI Framework MeeGo APIs including Qt UI Toolkit GTK / Clutter Telephony APIs oFono Connection Mgmt ConnMan Comms Svcs Cellular Stack oFono plug-ins IP, VOIP, IM, Presence Telepathy Bluetooth BlueZ Internet Svcs Layout Engine WebKit Web Services libSocialWeb Location GeoClue Web RunTime Visual Svcs 3D Graphics OpenGL / GL ES 2D Graphics Cairo, QPainter I18n Rendering Pango, QtText X Media Svcs Media Framework GStreamer UPnP GUPnP Codecs GStreamer plug-ins Audio PulseAudio Camera Video4Linux Context Framework ContextKit Content Framework Tracker Package Manager PackageKit, RPM Data Mgmt Backup & Restore Device Health Resource Manager Sensor Framework Device Svcs Personal Svcs PIM Svcs Accts & Single Sign-on Device Sync SyncEvolution MeeGo OS Middleware SECURITY Settings Database GConf System Libraries glibc, glib, etc Message Bus D-Bus Platform Info Device Kit MeeGo OS Base Linux Kernel HW Adaptation Software

9 MeeGo on Atom Features Overview
Application Development Environment Integrated Social Networking Cloud-device sync of PIM Data MeeGo APIs Support for Multiple Multimedia Framework Fastboot & Shutdown Optimization Improved Power Management Connection Manager for data connectivity Telephony Framework Segment Specific User Experiences Sensor Framework Gesture & MultiTouch Framework International-ization with UI guidelines Connection Manager: often short named ConnMan is a daemon for managing Internet and Intranet connections in Moblin. It was initially launched by Intel in 2008, and then re-launched as a joint Intel-Nokia project in June Currently it is co-led by Intel and Nokia. ConnMan is designed to be thin (very small footprint), with minimal dependencies such that it can fit in embedded systems. It includes plugins for various wireless technologies (3G, WiMax, WiFi, …) - Note: Some features listed may be segment-specific

10 MeeGo User Experience for Netbooks
Integrated - Personalized Social Networking Services & Infrastructure Easy to Use and Build Upon – Full Internet, Rich Media Consumption, Standards-based Customizable – Branded Customer Experiences, Flexible Look and Feel, Powerful 3D Tools and Animation 10 10 10

11 MeeGo User Experience for Handsets
Integrated Personalized Social Networking Optimized Full Internet Browser Personalized Phone Dialer Note: Example shown; Final UX may vary

12 MeeGo Application Development Environment
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 APIs + Web Runtime MeeGo offers a complete set of tools for developers to easily and rapidly create a variety of innovative applications

13 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 Intel C/C++ compiler (icc) Optimized for Intel processor microarchitectures including Intel Atom processor Intel JTAG and application debuggers Linux OS aware debugging Register level view of Intel processors and chipsets Intel IPP (performance primitives) Highly optimized libraries for DSP, image processing, multimedia, etc. Intel Vtune™ Performance Analyzer Discover performance bottlenecks in code

14 MeeGo Is Ecosystem Business Model-Friendly
Common Stable Core OS Open Source MeeGo* Platform Cloud-Based Services 3rd Party ISV Applications and Services 3rd Party Runtime Applications and Services Value-add Features Native or runtime based Operator brand opportunities Differentiation opportunities OEM/SP Branded Applications and Services Adapted for target usage models

15 Cross App Store Development Toolkit
Developers/ISVs MeeGo UI Toolkit MeeGo APIs 1000s of QT applications Ovi Store

16 MeeGo Application Ecosystem
100s of Native Linux Apps 1000s of QT applications 1000s of Runtime Apps Recompile 1000s of Qt Apps running on other operating systems e.g. Symbian 1000s of Qt Apps running on other operating systems e.g. Symbian

17 Intel AppUpSM Center & Intel® Atom™ Developer Program
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 Users App Store Developers & Applications Developer Framework Operating Systems Compatible HW Get more details at: * 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.”

18 Intel AppUpSM Center Beta
App Store for MeeGo™ Goes live soon ( Co-Branded stores in development App Up Community Strength: reason for growth incl: mature tools; moblin optimized for atom/IA and broad segments; Moblin is true open source project Win Mob is 25% iPhone ois 21% Android is 16% Please run by Molly or someone 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

19 MeeGo Working Model Open Source Projects
3rd Party Apps Closed Source Upstream Open Source Projects Codecs Community Distro, build environment, SDK… Commercial Solutions MeeGo Core Net* Reference MeeGo Projects Operating System Vendors Build Environment MID Reference IVI Reference OSVs provide Complete Stable Image Final integration / validation Technical support / debug Custom patches / updates Additional documentation Sustaining engineering OSV charge for the following based on OEM needs: Integration of close source components; Moblin provides all open sources software and several closed source components are required to complete a distribution for an OEM platform. Some examples are closed source codecs as well as closed source drivers for components used in the OEM platform. These closed source components may be made available by the OEMs, however, the OSV has to ensure these components are integrated in the distribution. Customizing the UI per OEM requirements; Moblin provides a rich application and UI framework based on Clutter technology; however, the reference distribution on would include a basic reference UI; OEMs would prefer to customize the UI to deliver a rich end-user experience that can be made possible with the moblin UI framework and OSV can provide this service. Develop additional middleware or applications per OEM requirements; these could be either or both open source applications modified/optimized to work with the rest of the stack in the distribution Integration and validation of all Moblin and non-Moblin components on OEMs platform; The validation of the Moblin reference stack will be typically done on Intel customer reference boards and not necessarily on specific OEM platform; in order to make sure the Moblin distro put together by the OSVs is qualified on the OEM platform, the OSV and/or the OEM need to do complete validation on the final platform. OSVs also may localize for geographic markets, coordinate upstream community activities, ensure legal compliance, and manage file and security updates. Last but not the least is the on-going support to an OEM on all associated software services ranging from bug-fixes, enhancements and software refreshes for subsequent platforms. Device Vendors hosts the core technology development and open source distro Commercial OSVs deliver customized “compliant” products 19 19

20 MeeGo Project Release Schedule
Moblin v2.2 MeeGo v1.2 MeeGo v1.1 MeeGo v1.0 MeeGo Public Community Releases MeeGo Distribution Development MeeGo Project Release Cadence: Every 6mo. 4Q’09 1Q’10 2Q’10 3Q’10 4Q’10 1Q’11 OCT NOV DEC JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC JAN FEB MAR APR

21 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

22 Agenda MeeGo Overview Fastboot and power management of MeeGo MeeGo SDK

23 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 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 Boot Graph A perl script( 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, execute dmesg | perl $(Kernel_DIR)/scripts/ > output.svg

26 Dmesg Result with CONFIG_PRINTK_TIME Option
[ ] initcall pdflush_init+0x0/0x11 returned 0 after 73 usecs [ ] calling 1 [ ] initcall kswapd_init+0x0/0x1d returned 0 after 42 usecs [ ] calling 1 [ ] initcall setup_vmstat+0x0/0x99 returned 0 after 16 usecs [ ] calling 1 [ ] initcall mm_sysfs_init+0x0/0x22 returned 0 after 6 usecs [ ] calling 1 [ ] initcall proc_vmalloc_init+0x0/0x1f returned 0 after 3 usecs

27 output.svg

28 Bootchart How it works. Logger Startup. The boot logger (/sbin/bootchartd) is run by the kernel. kernel /vmlinuz 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 Bootchard

30 Kernel All System components built into the kernel Image. No initrd
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 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 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 Time Budget Kernel (1s) X (1s) Early userspace (??) Home Screen (??)

34 Early Userspace Remove unnecessary service (nfs server, mail server, etc.) Parallel Sreadahead FscheckD-BusXdesktop Haludevnetwork 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 Early Userspace Asynchronous for non-critical path.

36 Fast X xorg-x11-drv-intel driver Intel video driver X Server
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 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 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 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 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 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 Agenda MeeGo Overview Fastboot and power management of MeeGo MeeGo SDK

43 Power Involves Every Component

44 Power Involves Every Component
Power breakdown of a typical idle laptop

45 Power Saving Principles
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

46 Power Basics of CPU

47 Power Basics (CPU 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 CPU P-states and C-states
C-state power consumption relative to C0: C1 ~40%, C4~12%, C6~1.6%

49 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 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 CPU P-States (Saving Power When CPU is Active)

52 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 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 Processor Tunables CPUFreq Governor Loaded via
/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

55 Power Friendly Kernel & Apps

56 Fixing High Frequency Events (Kernel Side)
Until , 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 , 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 Grouping Timers Grouping timers system-wide will help reduce idle wake ups

58 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 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 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 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 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 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 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

65 Tuning System Components

66 Graphics & Displays Screensavers 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 (turn off display after 120 second inactivity)

67 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 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 WiFi Auto Association Turn off the wireless completely when not in use
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 > 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 Ethernet Wake on LAN Gigabit Ethernet
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 Bluetooth If Bluetooth is unused, it should be turned off
hciconfig hci0 down rmmod hci_usb

72 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 SATA Aggressive Link Power Management
Put SATA link in low power mode when not in use Available in kernel for 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 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 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 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 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 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 Audio Power Saving Mode
Linux ALSA drivers support Intel®’s onboard high definition audio’s power saving capability for 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

80 Power Tuning with Powertop

81 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 Powertop

83 Power Measurement Methods

84 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 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 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 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 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 Agenda MeeGo Overview Fastboot and power management of MeeGo MeeGo SDK

90 HW Adaptation Software
MeeGo Architecture MeeGo Handset UX MeeGo Netbook UX Other UXs MeeGo User Experience Handset UI and Applications Netbook UI and Applications Handset UI Framework Netbook UI Framework MeeGo APIs including Qt UI Toolkit GTK / Clutter Telephony APIs oFono Connection Mgmt ConnMan Comms Svcs Cellular Stack oFono plug-ins IP, VOIP, IM, Presence Telepathy Bluetooth BlueZ Internet Svcs Layout Engine WebKit Web Services libSocialWeb Location GeoClue Web RunTime Visual Svcs 3D Graphics OpenGL / GL ES 2D Graphics Cairo, QPainter I18n Rendering Pango, QtText X Media Svcs Media Framework GStreamer UPnP GUPnP Codecs GStreamer plug-ins Audio PulseAudio Camera Video4Linux Context Framework ContextKit Content Framework Tracker Package Manager PackageKit, RPM Data Mgmt Backup & Restore Device Health Resource Manager Sensor Framework Device Svcs Personal Svcs PIM Svcs Accts & Single Sign-on Device Sync SyncEvolution MeeGo OS Middleware SECURITY Settings Database GConf System Libraries glibc, glib, etc Message Bus D-Bus Platform Info Device Kit MeeGo OS Base Linux Kernel HW Adaptation Software

91 HW Adaptation Software
HW Adaption Software MeeGo OS Base Settings Database System Libraries Message Bus MeeGo Kernel HW Adaptation 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

92 HW Adaptation Software
OS base MeeGo OS Base Settings Database System Libraries Message Bus MeeGo Kernel HW Adaptation Software MeeGo Kernel MeeGo uses a Linux* kernel from, 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

93 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 IP VOIP, IM, Presence Bluetooth* Wireless Technology

94 MeeGo Middleware: Internet Services
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

95 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 provides an implementation of the X Window System, with architecture specific drivers, patches, and configuration as needed. Visual Svcs Clutter GTK+ 3D Graphics 3D Graphics i18n Rendering X

96 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 player Media Framework The Gstreamer* media framework supports a wide range of media operations including audio and video playback, recording, streaming, and editing Audio 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

97 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

98 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 Device Sync Backup & Restore

99 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

100 MeeGo UI/Application Toolkits
MeeGo UI Framework 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

101 QT introduction

102 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 : QT4.6 : QT4.7

103 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 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 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

106 Qt Creator - Cross-Platform Qt IDE

107 Architecture

108 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. er-tools

109 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 QT hello world Write hello.cpp Open Qt terminal Run the program Qtdemo
#include <QtGui> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel label("Hello, world!");; return app.exec(); } Write hello.cpp Open Qt terminal qmake –project qmake make Run the program Qtdemo

111 MeeGo SDK

112 Change Root with Xephyr
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 Download the MeeGo SDK Image
OS Requires: Fedora 13 Ubuntu 10.04 OpenSUSE 11.3 Netbook Handset Unpack the image tar xvjf <compressed image file>

114 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 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 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 Mount and chroot into MeeGo image
Example: sudo mkdir /opt/meego-handset sudo mount -o loop,offset=512 ./meego-handset-ia 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 Start the MeeGo UI with Xephyr
Inside MeeGo chroot terminal Set the DISPLAY environment variable export DISPLAY=:0 Launch Xephyr startmeego &

118 MeeGo SDK with Xephyr Exit the Simulator 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 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 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 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 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 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 MeeGo SDK with QEMU Install QEMU-GL virtual machine
Fedora 12 or 13: sudo yum localinstall qemu-gl i386-fc12.rpm --nogpgcheck Ubuntu 9.10 or 10.04: sudo dpkg -i qemu-gl_ _i386.deb Other OS, build from source: Download launch script chmod +x ./meego-qemu-start

125 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 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) chmod +x install-meego-dev-env ./install-meego-dev-env export MEEGO_SDK=$HOME/meego-sdk/0.7.25

127 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 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 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 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 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 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 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 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 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 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 -p 6666 Two user accounts are available in the MeeGo images: User: meego Password: meego User: root     Password: meego

137 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:

138 Reference

139 Thank You! 139

Download ppt "Software Development on MeeGo OS"

Similar presentations

Ads by Google