Software Development on MeeGo OS Weibin Pan Open Source Technology Center System Software Division Software & Services Group 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. Intel Confidential Software and Services Group ‹#› Agenda • MeeGo Overview • Fastboot and power management of MeeGo • MeeGo SDK Intel Confidential Software and Services Group ‹#› MeeGo Strategy – Spans Multiple Segments Netbooks Tablets Smart TV Handhelds IVI Media Phone 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 Intel Confidential Software and Services Group ‹#› MeeGo 1.0 for Netbooks – Early Reviews “First, it’s fast. I mean, really, really fast.” Liliputing May 28, 2010 eWeek May 27, 2010 LinuxDevices.com MeeGo 1.0 … looks shockingly stupendous 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 28, 2010 “MeeGo is going to become a major force in the mobile Linux market” Intel Confidential Software and Services Group ‹#› 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 "prealpha" version of the software is a huge understatement.“ 01 June 2010 Intel Confidential “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.” Software and Services Group ‹#› 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 Intel Confidential Software and Services Group ‹#› MeeGo User Experience MeeGo Architecture MeeGo Handset UX Handset UI and Applications MeeGo Netbook UX Netbook UI and Applications Handset UI Framework Netbook UI Framework Other UXs MeeGo APIs including Qt UI Toolkit SECURITY MeeGo OS Middleware Comms Svcs Connection Mgmt ConnMan Visual Svcs Media Svcs Data Mgmt Layout Engine 3D Graphics WebKit OpenGL / GL ES Media Framework GStreamer Content Framework Tracker 2D Graphics Video4Linux Internet Svcs Telephony APIs oFono Web Services libSocialWeb Cellular Stack oFono plug-ins IP, VOIP, IM, Presence Telepathy MeeGo OS Base Camera Cairo, QPainter Codecs I18n Rendering Web RunTime Pango, QtText WebKit X Location Bluetooth BlueZ GTK / Clutter GeoClue Context Framework ContextKit GStreamer plug-ins Audio Package Manager PulseAudio PackageKit, RPM System Libraries Message Bus GConf glibc, glib, etc D-Bus Personal Svcs Device Health PIM Svcs Sensor Framework SyncEvolution Resource Manager Accts & Single Sign-on Device Sync Backup & Restore UPnP GUPnP Settings Database Device Svcs Platform Info Device Kit Linux Kernel HW Adaptation Software Intel Confidential Software and Services Group ‹#› MeeGo on Atom Features Overview MeeGo APIs Segment Specific User Experiences Connection Manager for data connectivity Telephony Framework Clouddevice sync of PIM Data Integrated Social Networking Application Development Environment Improved Power Management Fastboot & Shutdown Optimization Support for Multiple Multimedia Framework Internationalization with UI guidelines Gesture & MultiTouch Framework Sensor Framework Note: Some features listed may be segment-specific Intel Confidential Software and Services Group ‹#› 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 Intel Confidential 10 Software and Services Group ‹#› MeeGo User Experience for Handsets Integrated Personalized Social Networking Optimized Full Internet Browser Personalized Phone Dialer Note: Example shown; Final UX may vary Intel Confidential Software and Services Group ‹#› 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 Intel Confidential Software and Services Group ‹#› 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 Confidential Software and Services Group ‹#› MeeGo Is Ecosystem Business Model-Friendly Common Stable Core OS •Open Source Value-add Features •Native or runtime based •Operator brand opportunities •Differentiation opportunities MeeGo* Platform Cloud-Based Services 3rd Party ISV Applications and Services 3rd Party Runtime Applications and Services OEM/SP Branded Applications and Services Adapted for target usage models Intel Confidential Software and Services Group ‹#› Cross App Store Development Toolkit Developers/ISVs MeeGo UI Toolkit MeeGo APIs 1000s of QT applications Intel Confidential Software and Services Group ‹#› MeeGo Application Ecosystem 1000s of QT applications 100s of Native Linux Apps 1000s of Runtime Apps Recompile 1000s of Qt Apps running on other operating systems e.g. Symbian Software and Services Group Intel Confidential 1000s of Qt Apps running on other operating systems e.g. Symbian ‹#› Intel AppUpSM Center & Intel® Atom™ Developer Program Atom platform portal for consumers Users Intel + OEM/service provider co-branded app stores App Store Developers & Applications Targeting rich catalog of applications For OEMs/service providers Developer Framework Operating Systems 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 Compatible HW Tools, SDKs for MeeGo, Windows, and various run times New sales channel Get more details at: http://appdeveloper.intel.com * 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.” Intel Confidential Software and Services Group ‹#› Intel AppUpSM Center Beta 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 http://appdeveloper.intel.com Intel Confidential Software and Services Group ‹#› MeeGo Working Model Open Source Projects 3rd Party Apps MeeGo.com Upstream Open Source Projects Closed Source Codecs Community Distro, build environment, SDK… MeeGo Projects Build Environment Commercial Solutions Net* Reference MeeG o Core MID Reference IVI Reference Operating System Vendors Device Vendors MeeGo.com hosts the core technology development and open source distro Commercial OSVs deliver customized “compliant” products Intel Confidential Software and Services Group ‹#› 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 OCT NO V 1Q’10 DE C JAN FEB Intel Confidential 2Q’10 MA R APR MA Y 3Q’10 JUN JUL AU G 4Q’10 SEP OCT NO V 1Q’11 DE C JAN FE B MAR APR Software and Services Group ‹#› 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 Intel Confidential Software and Services Group ‹#› Agenda • MeeGo Overview • Fastboot and power management of MeeGo • MeeGo SDK Intel Confidential Software and Services Group ‹#› 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 Copyright © 2009, Intel Corporation. 23 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. • Those data are stored in memory and are written to disk once the boot process completes. Run in background and collect process information from /proc file system. Copyright © 2009, Intel Corporation. 24 Boot Graph • • A perl script(bootgraph.pl) locates at $(linux_source)/scripts • • “initcall_debug” is passed on the kernel command line. The kernel needs to be compiled with CONFIG_PRINTK_TIME option. After finishing the Linux bring up, execute dmesg | perl $(Kernel_DIR)/scripts/bootgraph.pl > output.svg Copyright © 2009, Intel Corporation. 25 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 Copyright © 2009, Intel Corporation. 26 output.svg Copyright © 2009, Intel Corporation. 27 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 Copyright © 2009, Intel Corporation. 28 Bootchard Copyright © 2009, Intel Corporation. 29 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 Copyright © 2009, Intel Corporation. 30 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. Copyright © 2009, Intel Corporation. 31 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.) Copyright © 2009, Intel Corporation. 32 Time Budget • Kernel (1s) • X (1s) • Early userspace (??) • Home Screen (??) Copyright © 2009, Intel Corporation. 33 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 Copyright © 2009, Intel Corporation. 34 Early Userspace • Asynchronous for non-critical path. Copyright © 2009, Intel Corporation. 35 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 Copyright © 2009, Intel Corporation. 36 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. Copyright © 2009, Intel Corporation. 37 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. Copyright © 2009, Intel Corporation. 38 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. Copyright © 2009, Intel Corporation. 39 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. Copyright © 2009, Intel Corporation. 40 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. Copyright © 2009, Intel Corporation. 41 Agenda • MeeGo Overview • Fastboot and power management of MeeGo • MeeGo SDK Copyright © 2009, Intel Corporation. 42 Power Involves Every Component Copyright © 2009, Intel Corporation. 43 Power Involves Every Component Backlight 30% LCD Panel 10% HDD 8% Audio 4% Comm 2% VR 9% Clock 5% Memory 2% ICH 5% Other 9% GMCH 9% CPU 7% Power breakdown of a typical idle laptop Copyright © 2009, Intel Corporation. 44 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 Copyright © 2009, Intel Corporation. 45 Power Basics of CPU 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 Copyright © 2009, Intel Corporation. 47 CPU P-states and C-states C-state power consumption relative to C0: C1 ~40%, C4~12%, C6~1.6% Copyright © 2009, Intel Corporation. 48 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 Copyright © 2009, Intel Corporation. 49 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 Copyright © 2009, Intel Corporation. 50 CPU P-States (Saving Power When CPU is Active) Copyright © 2009, Intel Corporation. 51 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) Copyright © 2009, Intel Corporation. 52 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 Copyright © 2009, Intel Corporation. 53 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 Copyright © 2009, Intel Corporation. 54 Power Friendly Kernel & Apps 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 Copyright © 2009, Intel Corporation. 56 Grouping Timers • Grouping timers system-wide will help reduce idle wake ups Copyright © 2009, Intel Corporation. 57 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 Copyright © 2009, Intel Corporation. 58 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 Copyright © 2009, Intel Corporation. 59 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 Copyright © 2009, Intel Corporation. 60 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 Copyright © 2009, Intel Corporation. 61 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. Copyright © 2009, Intel Corporation. 62 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 Copyright © 2009, Intel Corporation. 63 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 Copyright © 2009, Intel Corporation. 64 Tuning System Components 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) Copyright © 2009, Intel Corporation. 66 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 Copyright © 2009, Intel Corporation. 67 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) Copyright © 2009, Intel Corporation. 68 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 Copyright © 2009, Intel Corporation. 69 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 Copyright © 2009, Intel Corporation. 70 Bluetooth • If Bluetooth is unused, it should be turned off – hciconfig hci0 down – rmmod hci_usb Copyright © 2009, Intel Corporation. 71 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 Copyright © 2009, Intel Corporation. 72 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 Copyright © 2009, Intel Corporation. 73 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 Copyright © 2009, Intel Corporation. 74 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) Copyright © 2009, Intel Corporation. 75 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 Copyright © 2009, Intel Corporation. 76 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 Copyright © 2009, Intel Corporation. 77 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 Copyright © 2009, Intel Corporation. 78 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 Copyright © 2009, Intel Corporation. 79 Power Tuning with Powertop 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 Copyright © 2009, Intel Corporation. 81 Powertop • Copyright © 2009, Intel Corporation. 82 Power Measurement Methods 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) Copyright © 2009, Intel Corporation. 84 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 Copyright © 2009, Intel Corporation. 85 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) Copyright © 2009, Intel Corporation. 86 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. Copyright © 2009, Intel Corporation. 87 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 Copyright © 2009, Intel Corporation. 88 Agenda • MeeGo Overview • Fastboot and power management of MeeGo • MeeGo SDK Copyright © 2009, Intel Corporation. 89 MeeGo User Experience MeeGo Architecture MeeGo Handset UX Handset UI and Applications MeeGo Netbook UX Netbook UI and Applications Handset UI Framework Netbook UI Framework Other UXs MeeGo APIs including Qt UI Toolkit SECURITY MeeGo OS Middleware Comms Svcs Connection Mgmt ConnMan Visual Svcs Media Svcs Data Mgmt Layout Engine 3D Graphics WebKit OpenGL / GL ES Media Framework GStreamer Content Framework Tracker 2D Graphics Video4Linux Internet Svcs Telephony APIs oFono Web Services libSocialWeb Cellular Stack oFono plug-ins IP, VOIP, IM, Presence Telepathy MeeGo OS Base Camera Cairo, QPainter Codecs I18n Rendering Web RunTime Pango, QtText WebKit X Location Bluetooth BlueZ GTK / Clutter GeoClue Context Framework ContextKit GStreamer plug-ins Audio Package Manager PulseAudio PackageKit, RPM System Libraries Message Bus GConf glibc, glib, etc D-Bus Personal Svcs Device Health PIM Svcs Sensor Framework SyncEvolution Resource Manager Accts & Single Sign-on Device Sync Backup & Restore UPnP GUPnP Settings Database Device Svcs Platform Info Device Kit Linux Kernel HW Adaptation Software Copyright © 2009, Intel Corporation. 90 MeeGo OS Base HW Adaption Software 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 Copyright © 2009, Intel Corporation. 91 MeeGo OS Base OS base Settings Database System Libraries Message Bus MeeGo Kernel HW Adaptation Software • 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 Copyright © 2009, Intel Corporation. 92 MeeGo Middleware: Comms Services Connection Management • ConnMan is used to manage data connections (WiFi, WiMAX, 3G, and connections via Bluetooth* Wireless Technology) Telephony APIs Comms Svcs • 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 Connection Mgmt Telephony APIs Cellular Stack IP VOIP, IM, Presence 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 Bluetooth* Wireless Technology • BlueZ* provides Bluetooth support including DUN, A2DP, headset, etc. Copyright © 2009, Intel Corporation. 93 MeeGo Middleware: Internet Services Layout Engine • The layout engine renders web content (HTML, XML, images, etc) for onscreen display. • The specific layout engine might vary by platform (e.g. WebKit/Chromium* on netbook, Gecko/Fennec* on handset) Web Services Internet Svcs • 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) Layout Engine Web Services Web Run Time Web Run Time • The Web Run Time provides an environment for building applications Location 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 Copyright © 2009, Intel Corporation. 94 94 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 Visual Svcs Clutter GTK+ 3D Graphics 3D Graphics i18n Rendering X X • x.org provides an implementation of the X Window System, with architecture specific drivers, patches, and configuration as needed. Copyright © 2009, Intel Corporation. 95 95 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 Media Svcs • The audio subsystem includes audio routing and pulseaudio Media App Framework • The camera subsystem supports both still and video cameras Media Framework Camera 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. Audio Codecs UPnP UPnP • GUPnP provides a framework for creating devices and control points that adhere to the Universal Plug-and-Play specifications Copyright © 2009, Intel Corporation. 96 96 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. Data Mgmt Content Framework 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. Context Framework Package Manager Package Manager • The RPM package manager is used to install and remove packages Copyright © 2009, Intel Corporation. 97 97 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 Svcs Energy Mgmt Sensor Framework System Policy Device Sync Backup & Restore • 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 Copyright © 2009, Intel Corporation. 98 98 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 Personal Svcs PIM Svcs Accts & Single Signon 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 Copyright © 2009, Intel Corporation. 99 99 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 Copyright © 2009, Intel Corporation. 100 100 QT introduction 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 Copyright © 2009, Intel Corporation. 102 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 Copyright © 2009, Intel Corporation. 103 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 Copyright © 2009, Intel Corporation. 104 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. GUI Builder 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 Customizable HTML Help System Internationalization Tools Integration/Add-in for Eclipse and Visual Studio Copyright © 2009, Intel Corporation. 105 105 Qt Creator - Cross-Platform Qt IDE Copyright © 2009, Intel Corporation. 106 106 Architecture Copyright © 2009, Intel Corporation. 107 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/develop er-tools http://qt.nokia.com/developer Copyright © 2009, Intel Corporation. 108 108 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. Copyright © 2009, Intel Corporation. 109 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(); } Copyright © 2009, Intel Corporation. 110 MeeGo SDK MeeGo SDK options •Requires Virtualization (VT) support for graphics acceleration QEMU Virtual • Host system not limited to Intel graphics chipset Machine • 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 Copyright © 2009, Intel Corporation. 112 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-ia321.0.80.12.20100727.1-sdk-pre0901.raw.tar.bz2 • Handset – http://download3.meego.com/sep09/meego-handset-ia321.0.80.9.20100706.1-sdk-pre0901.raw.tar.bz2 • Unpack the image – tar xvjf <compressed image file> Copyright © 2009, Intel Corporation. 113 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‘ Copyright © 2009, Intel Corporation. 114 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> Copyright © 2009, Intel Corporation. 115 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.1sdk-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 Copyright © 2009, Intel Corporation. 116 Start the MeeGo UI with Xephyr • Inside MeeGo chroot terminal • Set the DISPLAY environment variable – export DISPLAY=:0 • Launch Xephyr – startmeego & Copyright © 2009, Intel Corporation. 117 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 Copyright © 2009, Intel Corporation. 118 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 Copyright © 2009, Intel Corporation. 119 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 Copyright © 2009, Intel Corporation. 120 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 Copyright © 2009, Intel Corporation. 121 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 Copyright © 2009, Intel Corporation. 122 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 Copyright © 2009, Intel Corporation. 123 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 Copyright © 2009, Intel Corporation. 124 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> Copyright © 2009, Intel Corporation. 125 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.25linux-i686.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 Copyright © 2009, Intel Corporation. 126 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 Copyright © 2009, Intel Corporation. 127 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 Copyright © 2009, Intel Corporation. 128 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 Copyright © 2009, Intel Corporation. 129 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. Copyright © 2009, Intel Corporation. 130 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" Copyright © 2009, Intel Corporation. 131 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) Copyright © 2009, Intel Corporation. 132 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. Copyright © 2009, Intel Corporation. 133 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" Copyright © 2009, Intel Corporation. 134 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 Copyright © 2009, Intel Corporation. 135 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 meego@127.0.0.1 -p 6666 – Two user accounts are available in the MeeGo images: • User: meego Password: meego • User: root Password: meego Copyright © 2009, Intel Corporation. 136 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 Copyright © 2009, Intel Corporation. 137 Reference • • http://meego.com/developers/meego-architecture • • http://meego.com/developers/meego-api http://wiki.meego.com/Getting_started_with_the_MeeGo_SDK_f or_Linux http://qt.nokia.com/developer Copyright © 2009, Intel Corporation. 138 Thank You! Intel Confidential Software and Services Group ‹#›