4+menlow+board+development+environment+setup slides
TRANSCRIPT
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
1/40
Menlow board developmentenvironment setup
MOBLIN.ORG
Copyright 2009 Intel Corporation.
Pan, [email protected]
Intel
mailto:[email protected]:[email protected] -
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
2/40
py g p
Agenda
Moblin IntroductionInstall Moblin
Moblin development environment setup
ExamplesQT Introduction
Resources
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
3/40
Moblin Introduction
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
4/40
What is Moblin
Moblin is a Linux-based platform for building operating
systems and applications for mobile devices.Linux based, any languages, frameworks and tools of Linux canbe used
Web browser based app
Moblin is designed for:Small form factor of the screen
Fast boot, small memory usage, fast response for application
Low power consumption.
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
5/40
Moblin Core
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
6/40
Moblin Core App services
Network management
WiFi, WiMax, BluetoothGraphics
X, OpenGL, OpenGL-ES, 2D render, Font render
Other services:bickley for managing multimedia metadatamojito for working with social web services
bognor-regis for managing multimedia play queues
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
7/40
Moblin Core UI services
GTK
QTClutter
Clutter is an open source software library for creating fast,visually rich, portable and animated graphical user interfaces.
Based on OpenGL/OpenGL-ESnbtk
An extension of Clutter which provides useful widgets (e.g.buttons, panels, labels) for GUI application developers
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
8/40
Install Moblin
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
9/40
Install Moblin Live Image
Live Image
Can be burned onto a CD or written to a USB disk.Direct boot from CD/USB disk
Test before installation
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
10/40
Write image to a USB drive
Linux
unmount USB disk firstImage writer (python script)
$ chmod a+x ./image-writer$ ./image-writer
Using dd (dangerous)$ dd bs=4096 if= of=
WindowsWin32DiskImager
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
11/40
Moblin Development Environment Setup
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
12/40
Moblin development environment
Development environment
A Linux development machine where you'll be doing yourcoding, compilation, and packaging.
We recommend using a standard Linux machine for this.
Deployment environment (Target platform)
A machine running Moblin you'll deploy your project to thismachine for testing and debugging.
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
13/40
Moblin development environment
Using Moblin toolchain
Traditional embedded development method, using cross-compiling toolchain for the development.
binutils, gcc, gdb, head files and libraries
Using Chroot
This extract Moblin image and chroot onto it as a sandboxVery popular in embedded linux development, ex. scratchbox.
Very effective way to develop for Moblin, you are using nativecompiler like gcc, not cross-complier like i586-moblin-linux-gcc.
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
14/40
Installing Linux development tools
You should have the following development tools installed:
gcc, g++, make, autoconf, libtoolize, gtkdocize, gettext, man,devhelp, and
On Ubuntu:$ sudo apt-get install build-essential man-db automake intltoollibtool gtk-doc-tools devhelp libglib2.0-dev
On Fedora:$ sudo yum install gcc-c++ make man automake intltool libtoolgtk-doc devhelp glib2-devel
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
15/40
Develop using Moblin toolchain
Download Moblin SDK at:
http://moblin.org/projects/moblin-sdk-tools-and-toolchainUnpack the toolchain
$ cd ~; tar jvxf moblin-sdk-0.10.tar.bz2
Configure the toolchainEdit envsetup.sh located in the root of the SDK and set the valueof $MOBLIN_TOOLCHAIN to the directory containing thetoolchain:
export MOBLIN_TOOLCHAIN=~/moblin-sdk-0.10/moblin-cross-toolchain
After editing the envsetup.sh, run it one time:$ ./envsetup.sh
http://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchainhttp://moblin.org/projects/moblin-sdk-tools-and-toolchain -
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
16/40
Develop using Chroot
Using Chroot for development if:
you are familiar with vim, emacs, gdb and Linux command line.you don't need your application to interact with the Moblindesktop. Your application will run stand-alone in a window onthe desktop
This extract Moblin image and chroot onto it as a sandbox
Very popular in embedded linux development, like usingscratchbox.
Very effective way to develop for Moblin, you are using nativecompiler like gcc, not cross-complier like i586-moblin-linux-
gcc.
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
17/40
Develop using Chroot setup
Install Moblin Image Creator 2 which contains moblin-chrootCan:
Get install package for following distributions (Ubuntu8.10,Fedora8, Fedora9, OpenSuse11.1)
http://repo.moblin.org/moblin/tools/
Install from source code:
http://moblin.org/documentation/moblin-image-creator-2/installationgit clone git://git.moblin.org/moblin-image-creator-2cd moblin-image-creator-2sudo ./tools/moblin-check-alldeps
make clean; makesudo make install
http://repo.moblin.org/moblin/tools/http://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://moblin.org/documentation/moblin-image-creator-2/installationhttp://repo.moblin.org/moblin/tools/ -
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
18/40
Create chroot from the Moblin 2.1 image
Extracts Moblin 2.1 file system to a subdirectory on yourdevelopment machine
After chroot to this file system, you are working as the same asworking inside the Moblin 2.1 environment, allows you to build andrun your application as on a Moblin 2.1 device.
For the first time:
$ sudo moblin-chroot -s $ sudo moblin-chroot -s /opt/mobln2.1 /home/user/Downloads/moblin-2.1-Menlow_SDK_20100222.iso
After first time:$ sudo moblin-chroot
To exit chroot terminal, type "exit"
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
19/40
Develop using Chroot map directory
Open another terminal window, there are 2 terminal now
From chroot
From desktop
(From desktop) Map desktop dbus to the chroot dbus
$ sudo mount --bind
Example:
$ sudo mount --bind /var/lib/dbus/ /opt/moblin2.1/var/lib/dbus/ (From chroot) Create a "src" directory for your applications source
$ mkdir /root/src
(From desktop) Mount your source directory to the chroot
$ sudo mount --bind Example:
$ sudo mount --bind /home/bob/src/ /opt/moblin2.1/root/src
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
20/40
Develop using Chroot build and run
(From desktop) Do all code editing and source control managementEmacs, Vim
$ git clone ... or $ svn checkout ...
(From desktop) Allow applications started in the chroot terminal to displayoutput on the desktop
$ xhost +SI:localuser:root
(From chroot) Build and runThe first time may be need to install missing libraries or devel packages
"yum search ..." and "yum install ..."
Build
$ gcc helloworld.c -o helloworld
Run
$ ./helloworld
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
21/40
Examples
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
22/40
Hello world example
main.c
#include
int main(int argc, char* argv[]){
printf (Hello world! \ n);
return 0;}
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
23/40
Using moblin-cross-toolchain
Set environment to Moblin SDK
Run the envsetup.sh under the directory where you installedMoblin SDK, example:
$~/moblin-sdk-0.10/envsetup.sh
Compile use the following command
$i586-moblin-linux-gcc -o main main.c
Copy the binary to board and run
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
24/40
Using chroot
Chroot into the extracted image directory
For the first time:$moblin-chroot -s
After first time:moblin-chroot
compile use the following command:$gcc -o main main.c
Direct run under chroot environment or copy to board to run
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
25/40
Linux Driver Example
Install kernel develop package first:
$rpm -ivh kernel-ivi-devel-2.6.31.6-36.1.moblin2.i586.rpmAfter installed, kernel heads is located at:
/usr/src/kernels/2.6.31.6-36.1.moblin2-ivi/
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
26/40
Linux Driver Example code
hello.c :
#include < linux/module.h>#include < linux/config.h>#include < linux/init.h>
MODULE_LICENSE("GPL");static int hello_init(void)
{printk(KERN_ALERT "Hello, world\n");return 0;
}static void hello_exit(void){
printk(KERN_ALERT "Goodbye, cruel world\n");}module_init(hello_init);module_exit(hello_exit);
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
27/40
Linux Driver Example Makefile
#bj-m is a list of what kernel modules to build. The .o and other# objects will be automatically built from the corresponding .c file -# no need to list the source files explicitly.obj-m := hello.o
# KDIR is the location of the kernel source. The current standard is# to link to the associated source tree from the directory containing# the compiled modules.KDIR := /lib/modules/2.6.31.6-36.1.moblin2-ivi/buildEXTRA_CFLAGS = $(KDIR)
# PWD is the current working directory and the location of our module# source files.PWD := $(shell pwd)
# default is the default make target. The rule here says to run make# with a working directory of the directory containing the kernel# source and compile only the modules in the PWD (local) directory.default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
28/40
Compile and test
Compile driver
$makeCopy to board and install modules
$insmod hello.ko
Output by dmesg:
Hello, worldUninstall modules:
$rmmod hello.ko
Output by dmesg:
Goodbye, cruel world
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
29/40
QT Introduction
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
30/40
QT History
Developed by Trolltech, acquired by Nokia now
Developed for KDEQT vs. GTK
History1994: 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.02008.6: Trolltech acquired by Nokia
2009.12: QT4.6
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
31/40
What s QT
Everything you need to create web-enabled desktop, mobileand embedded applications.
Qt is a cross-platform application and UI framework. Using Qt,you can write web-enabled applications once and deploythem across desktop, mobile and embedded operatingsystems without rewriting the source code.
Linux/X11Windows
Mac OS X
Embedded Linux
WinCE/Windows MobileSymbian
Maemo
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
32/40
Features of QT
Intuitive C++ class library
Portability across desktop and embedded operating systemsIntegrated development tools with cross-platform IDE
Qt creator
Qt designer
Plug-in for EclipsePlug-in for Visual Studio
High runtime performance and small footprint on embedded
Good documents, lots of tutorial/sample codes
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
33/40
Architecture
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
34/40
Signal/Slot
Signals and slots are usedfor communication betweenobjects. The signals and slotsmechanism is a centralfeature of Qt and probablythe part that differs most
from the features providedby other frameworks.
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
35/40
d h ll ld
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
36/40
Hands on: QT hello world
Write hello.cpp
Open Qt terminalqmake -project
qmake
make
Run the programQtdemo
#include
int main(int argc, char *argv[]){
QApplication app(argc, argv);QLabel label("Hello, world!");label.show();return app.exec();
}
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
37/40
Resources
http://moblin.org/ http://qt.nokia.com/developer
http://qt.nokia.com/doc/4.6/index.html
MOBLIN ORG
http://moblin.org/http://qt.nokia.com/developerhttp://qt.nokia.com/doc/4.6/index.htmlhttp://moblin.org/http://qt.nokia.com/doc/4.6/index.htmlhttp://moblin.org/http://qt.nokia.com/developerhttp://moblin.org/http://moblin.org/ -
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
38/40
What Technical Resources AreAvailable To You?
MOBLIN.ORG
MOBLIN ORG
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
39/40
MOBLIN.ORGWERE WAITING FOR YOU
MOBLIN.ORG
L l Di l i
-
8/6/2019 4+Menlow+Board+Development+Environment+Setup Slides
40/40
Legal Disclaimer
Intel, Atom and the Intel logo are trademarks of Intel Corporation in theUnited States and other countries.
*Other names and brands may be claimed as the property of others.
Copyright 2010 Intel Corporation.