Create Qt on Raspberry Pi: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(Cleanup)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:QtonPi]]<br />[toc align_right=&quot;yes&amp;quot; depth=&quot;2&amp;quot;]
{{LangSwitch}}
 
[[Category:QtonPi]]
= Qt on Raspberry Pi — Create =
 
== QtonPi App SDK ==
== QtonPi App SDK ==


Line 16: Line 14:
QtonPi releases are distributed via BitTorrent. QtonPi download page is [[Download | here]].
QtonPi releases are distributed via BitTorrent. QtonPi download page is [[Download | here]].


Upon downloading a QtonPi release, you should see a tarball &lt;code&amp;gt;qtonpi-X.Y.tar.bz2&amp;lt;/code&amp;gt;, where &lt;code&amp;gt;&quot;X&amp;quot;&lt;/code&amp;gt; is the major release number and &lt;code&amp;gt;&quot;Y&amp;quot;&lt;/code&amp;gt; is the minor release.
Upon downloading a QtonPi release, you should see a tarball <code>qtonpi-X.Y.tar.bz2</code>, where <code>"X"</code> is the major release number and <code>"Y"</code> is the minor release.


QtonPi release directory is organized as follows,
QtonPi release directory is organized as follows,


<code><br />qtonpi-X.Y/<br />├── app-sdk/<br />├── platform-sdk/<br />│ ├── host-rpms/<br />│ ├── image-creator-binaries/<br />│ └── mt-cross-tools/<br />└── sdcard-img/<br /></code>
<code>
qtonpi-X.Y/
├── app-sdk/
├── platform-sdk/
│ ├── host-rpms/
│ ├── image-creator-binaries/
│ └── mt-cross-tools/
└── sdcard-img/
</code>


Following is a brief description of the directory structure,
Following is a brief description of the directory structure,


{|
{|
|&lt;code&amp;gt;app-sdk/&amp;lt;/code&amp;gt;
|<code>app-sdk/</code>
|Application SDK
|Application SDK
|-
|-
|&lt;code&amp;gt;platform-sdk/&amp;lt;/code&amp;gt;
|<code>platform-sdk/</code>
|''Platform SDK - In case you would like to roll your own SD Card Image and/or Sysroot. See [[Contribute
|''Platform SDK - In case you would like to roll your own SD Card Image and/or Sysroot. See [[Contribute
|-
|-
|&lt;code&amp;gt;sdcard-img/&amp;lt;/code&amp;gt;
|<code>sdcard-img/</code>
|''Default SD Card Image - Please use this for reporting bugs!''
|''Default SD Card Image - Please use this for reporting bugs!''
|}
|}
Line 41: Line 47:
First step would be to install Qt Creator. You will find Qt Creator installer here, '''<span class="Sysroot_ and _Toolchain from instructions the follow and Creator Qt current your use Just installed. SDK Qt updated an have you if necessary not is This Note:"></span>'''
First step would be to install Qt Creator. You will find Qt Creator installer here, '''<span class="Sysroot_ and _Toolchain from instructions the follow and Creator Qt current your use Just installed. SDK Qt updated an have you if necessary not is This Note:"></span>'''


<code><br />qtonpi-X.Y/<br />├── app-sdk/<br />│ └── qt-creator-linux-x86-opensource-2.x.y.bin<br /></code>
<code>
qtonpi-X.Y/
├── app-sdk/
│ └── qt-creator-linux-x86-opensource-2.x.y.bin
</code>


To install, just run the &lt;code&amp;gt;qt-creator-linux-x86-opensource-2.x.y.bin&amp;lt;/code&amp;gt; file
To install, just run the <code>qt-creator-linux-x86-opensource-2.x.y.bin</code> file


<code><br />$ pwd<br />/home/rajiv/qtonpi-0.2/app-sdk<br />$ ./qt-creator-linux-x86-opensource-2.4.1.bin<br /></code>
<code>
$ pwd
/home/rajiv/qtonpi-0.2/app-sdk
$ ./qt-creator-linux-x86-opensource-2.4.1.bin
</code>


This should install, launch Qt Creator. In addition, it'll also create an icon on your Desktop.
This should install, launch Qt Creator. In addition, it'll also create an icon on your Desktop.
Line 53: Line 67:
Next step would be to install the toolchain and default sysroot. You can find it here,
Next step would be to install the toolchain and default sysroot. You can find it here,


<code><br />qtonpi-X.Y/<br />├── app-sdk/<br />│ └── toolchain-and-sysroot-armv5tel.tar.bz2<br /></code>
<code>
qtonpi-X.Y/
├── app-sdk/
│ └── toolchain-and-sysroot-armv5tel.tar.bz2
</code>


You will need to extract this as &lt;code&amp;gt;root&amp;lt;/code&amp;gt; user, into the &lt;code&amp;gt;root(&quot;/&amp;quot;)&lt;/code&amp;gt; directory of your filesystem.
You will need to extract this as <code>root</code> user, into the <code>root("/")</code> directory of your filesystem.


<code><br />$ cd /<br />$ pwd<br />/<br />$ sudo tar jxvf /home/rajiv/qtonpi-0.2/app-sdk/toolchain-and-sysroot-armv5tel.tar.bz2<br /></code>
<code>
$ cd /
$ pwd
/
$ sudo tar jxvf /home/rajiv/qtonpi-0.2/app-sdk/toolchain-and-sysroot-armv5tel.tar.bz2
</code>


=== Qt 5 ===
=== Qt 5 ===
Line 63: Line 86:
QtonPi ships with a known working (necessarily not stable!) version of Qt 5. This version works both on the sysroot and the target and you can find it here, '''<span class="release 1.x the in resolved be should This development. x86 for installed Qt5 have already you if instance For install. Qt5 another with nicely play not does This Note:"></span>'''
QtonPi ships with a known working (necessarily not stable!) version of Qt 5. This version works both on the sysroot and the target and you can find it here, '''<span class="release 1.x the in resolved be should This development. x86 for installed Qt5 have already you if instance For install. Qt5 another with nicely play not does This Note:"></span>'''


<code><br />qtonpi-0.2/<br />├── app-sdk/<br />│ ├── opt-qt5-current.tar.bz2<br /></code>
<code>
qtonpi-0.2/
├── app-sdk/
│ ├── opt-qt5-current.tar.bz2
</code>


You will need to extract this as &lt;code&amp;gt;root&amp;lt;/code&amp;gt; user, into the &lt;code&amp;gt;root(&quot;/&amp;quot;)&lt;/code&amp;gt; directory of your filesystem.
You will need to extract this as <code>root</code> user, into the <code>root("/")</code> directory of your filesystem.


<code><br />$ cd /<br />$ pwd<br />/<br />$ sudo tar jxvf /home/rajiv/qtonpi-0.2/app-sdk/opt-qt5-current.tar.bz2<br /></code>
<code>
$ cd /
$ pwd
/
$ sudo tar jxvf /home/rajiv/qtonpi-0.2/app-sdk/opt-qt5-current.tar.bz2
</code>


=== SD Card Image ===
=== SD Card Image ===
Line 73: Line 105:
In addition, there is also a default 2GB SD Card Image, with Qt 5 on it. You'll find it here.
In addition, there is also a default 2GB SD Card Image, with Qt 5 on it. You'll find it here.


<code><br />qtonpi-X.Y/<br />└── sdcard-img/<br /> └── qtonpi-sdcard-X.Y.img.bz2<br /></code>
<code>
qtonpi-X.Y/
└── sdcard-img/
└── qtonpi-sdcard-X.Y.img.bz2
</code>


To setup your SD card, &lt;code&amp;gt;cat/dd&amp;lt;/code&amp;gt; the contents of this file onto your SD Card. Assuming your SD Card device is &lt;code&amp;gt;/dev/sdb&amp;lt;/code&amp;gt;, one way to do this is as follows. Note you'll need to be logged in as &lt;code&amp;gt;root&amp;lt;/code&amp;gt; in order to be able to write to &lt;code&amp;gt;/dev/sdb&amp;lt;/code&amp;gt; device.
To setup your SD card, <code>cat/dd</code> the contents of this file onto your SD Card. Assuming your SD Card device is <code>/dev/sdb</code>, one way to do this is as follows. Note you'll need to be logged in as <code>root</code> in order to be able to write to <code>/dev/sdb</code> device.


<code><br /># pwd<br />/home/rajiv/qtonpi-0.2/sdcard-img<br /># bzcat qtonpi-sdcard-0.2.img.bz2 &gt; /dev/sdb; sync<br /></code>
<code>
# pwd
/home/rajiv/qtonpi-0.2/sdcard-img
# bzcat qtonpi-sdcard-0.2.img.bz2 > /dev/sdb; sync
</code>


You're now ready to boot your Raspberry Pi Device! There are two accounts - &lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &lt;code&amp;gt;qtonpi&amp;lt;/code&amp;gt;. Password for the accounts are &lt;code&amp;gt;rootme&amp;lt;/code&amp;gt; and &lt;code&amp;gt;qtonpi&amp;lt;/code&amp;gt; respectively.
You're now ready to boot your Raspberry Pi Device! There are two accounts - <code>root</code> and <code>qtonpi</code>. Password for the accounts are <code>rootme</code> and <code>qtonpi</code> respectively.


Upon booting and logging into your Raspberry Pi device as &lt;code&amp;gt;root&amp;lt;/code&amp;gt;, you'll need to enable networking (which is disabled by default!). If you've DHCP setup, find out the ethernet interface of your Raspberry Pi device by doing &lt;code&amp;gt;ifconfig -a&amp;lt;/code&amp;gt; and run &lt;code&amp;gt;dhclient eth0&amp;lt;/code&amp;gt; on that interface.
Upon booting and logging into your Raspberry Pi device as <code>root</code>, you'll need to enable networking (which is disabled by default!). If you've DHCP setup, find out the ethernet interface of your Raspberry Pi device by doing <code>ifconfig -a</code> and run <code>dhclient eth0</code> on that interface.


<code><br />-bash-4.1# ifconfig -a<br />eth0 Link encap:Ethernet HWaddr B8:27:EB:E2:26:B5
<code>
-bash-4.1# ifconfig -a
eth0 Link encap:Ethernet HWaddr B8:27:EB:E2:26:B5


[…]
[…]
Line 91: Line 133:
[…]
[…]


-bash-4.1# ifconfig -a<br />eth0 Link encap:Ethernet HWaddr B8:27:EB:44:23:50<br /> inet addr:10.48.194.196 Bcast:10.48.194.255 Mask:255.255.255.128<br /> UP BROADCAST RUNNING MULTICAST MTU:1488 Metric:1<br /> RX packets:549 errors:0 dropped:0 overruns:0 frame:0<br /> TX packets:46 errors:0 dropped:0 overruns:0 carrier:0<br /> collisions:0 txqueuelen:1000<br /> RX bytes:90538 (88.4 KiB) TX bytes:8025 (7.8 KiB)<br /></code>
-bash-4.1# ifconfig -a
eth0 Link encap:Ethernet HWaddr B8:27:EB:44:23:50
inet addr:10.48.194.196 Bcast:10.48.194.255 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1488 Metric:1
RX packets:549 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:90538 (88.4 KiB) TX bytes:8025 (7.8 KiB)
</code>


&lt;code&amp;gt;dhclient&amp;lt;/code&amp;gt; usually does a lousy job at giving useful information. So, once you are back on the command prompt, do an &lt;code&amp;gt;ifconfig -a&amp;lt;/code&amp;gt; to see if an IP Address got assigned. In the above example, eth0 has an IP address of 10.48.194.196.
<code>dhclient</code> usually does a lousy job at giving useful information. So, once you are back on the command prompt, do an <code>ifconfig -a</code> to see if an IP Address got assigned. In the above example, eth0 has an IP address of 10.48.194.196.


Then update the date/time on Raspberry Pi device. This can be done easily using &lt;code&amp;gt;ntpdate&amp;lt;/code&amp;gt;
Then update the date/time on Raspberry Pi device. This can be done easily using <code>ntpdate</code>


<code><br />-bash-4.1# ntpdate -u 0.us.pool.ntp.org<br /></code>
<code>
-bash-4.1# ntpdate -u 0.us.pool.ntp.org
</code>


=== Configuring Qt Creator, Toolchain, Qt 5 and Raspberry Pi board ===
=== Configuring Qt Creator, Toolchain, Qt 5 and Raspberry Pi board ===
Line 105: Line 157:
By this time you should be able to ssh from your host machine (running Qt Creator) into your Raspberry Pi Board. If you are not able to do so, please check your network connectivity before proceeding any further!
By this time you should be able to ssh from your host machine (running Qt Creator) into your Raspberry Pi Board. If you are not able to do so, please check your network connectivity before proceeding any further!


# Launch Qt Creator and select '''Tools <s>&gt; Options</s>&gt; Linux Devices'''
# Launch Qt Creator and select '''Tools -> Options-> Linux Devices'''
# Click '''Add''' and select '''Generic Linux Device'''. Then Click on '''Start Wizard'''
# Click '''Add''' and select '''Generic Linux Device'''. Then Click on '''Start Wizard'''
# Enter the following in the dialog box that appears
# Enter the following in the dialog box that appears
#* The name to identify this configuration: &lt;code&amp;gt;Raspberry Pi&amp;lt;/code&amp;gt;
#* The name to identify this configuration: <code>Raspberry Pi</code>
#* The device's hostname or IP address : ''IP Address of your Raspberry Pi device''
#* The device's hostname or IP address : ''IP Address of your Raspberry Pi device''
#* The user name to log into the device: &lt;code&amp;gt;root&amp;lt;/code&amp;gt;
#* The user name to log into the device: <code>root</code>
#* The authentication type: ''Select Password''
#* The authentication type: ''Select Password''
#* The user's password: &lt;code&amp;gt;rootme&amp;lt;/code&amp;gt;
#* The user's password: <code>rootme</code>
# Click '''Next''' followed by '''Finish'''
# Click '''Next''' followed by '''Finish'''
# The Device Test should finish successfully. If not, go back and check your network connectivity and other settings.
# The Device Test should finish successfully. If not, go back and check your network connectivity and other settings.
Line 118: Line 170:
==== Setting up your toolchain ====
==== Setting up your toolchain ====


# In Qt Creator, select '''Tools <s>&gt; Options</s>&gt; Build &amp; Run''' and '''Tool Chains''' tab
# In Qt Creator, select '''Tools -> Options-> Build & Run''' and '''Tool Chains''' tab
# Select '''Manual''' and click on '''Add'''
# Select '''Manual''' and click on '''Add'''
# In the dropdown menu, select '''GCC'''
# In the dropdown menu, select '''GCC'''
Line 126: Line 178:
==== Selecting Qt 5 for Raspberry Pi ====
==== Selecting Qt 5 for Raspberry Pi ====


# In Qt Creator, select '''Tools <s>&gt; Options</s>&gt; Build &amp; Run''' and '''Qt Versions''' tab
# In Qt Creator, select '''Tools -> Options-> Build & Run''' and '''Qt Versions''' tab
# Select '''Manual''' and click on '''Add…'''
# Select '''Manual''' and click on '''Add…'''
# Then select &lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; file located in ''/opt/qt5/bin/qmake'' and click on '''Open'''
# Then select <code>qmake</code> file located in ''/opt/qt5/bin/qmake'' and click on '''Open'''
# Click on '''Apply''' and select '''OK'''
# Click on '''Apply''' and select '''OK'''


Qt creator might indicate &quot;Qt version 5.0.0 for Desktop&amp;quot;, which can be safely ignored for now.
Qt creator might indicate "Qt version 5.0.0 for Desktop", which can be safely ignored for now.


== Hello QtonPi! ==
== Hello QtonPi! ==


QtonPi App SDK comes with &lt;code&amp;gt;hello-qtonpi&amp;lt;/code&amp;gt; App to get you started with Qt 5, which is located here,
QtonPi App SDK comes with <code>hello-qtonpi</code> App to get you started with Qt 5, which is located here,


<code><br />qtonpi-X.Y/<br />├── app-sdk/<br />│ ├── hello-qtonpi.tar.bz2<br /></code>
<code>
qtonpi-X.Y/
├── app-sdk/
│ ├── hello-qtonpi.tar.bz2
</code>


Feel free to extract the tarball anywhere in your home directory.
Feel free to extract the tarball anywhere in your home directory.


<code><br />$ pwd<br />/home/rajiv<br />$ tar jxvf qtonpi-0.2/app-sdk/hello-qtonpi.tar.bz2<br />hello-qtonpi/<br />hello-qtonpi/main.cpp<br />hello-qtonpi/hello-qtonpi.pro<br />[…]<br /></code>
<code>
$ pwd
/home/rajiv
$ tar jxvf qtonpi-0.2/app-sdk/hello-qtonpi.tar.bz2
hello-qtonpi/
hello-qtonpi/main.cpp
hello-qtonpi/hello-qtonpi.pro
[…]
</code>


Next launch Qt Creator (if you don't already have it running!), and do the following.
Next launch Qt Creator (if you don't already have it running!), and do the following.


# Select '''File -&gt; Open File or Project…''', navigate to &lt;code&amp;gt;hello-qtonpi/hello-qtonpi.pro&amp;lt;/code&amp;gt; and click '''Open'''
# Select '''File -> Open File or Project…''', navigate to <code>hello-qtonpi/hello-qtonpi.pro</code> and click '''Open'''
# When you do this first time, '''Project Setup''' Dialog appears for the Target Setup, with sane defaults. Select '''Finish'''
# When you do this first time, '''Project Setup''' Dialog appears for the Target Setup, with sane defaults. Select '''Finish'''
# In the side-bar, select '''Projects''' mode or press Control-5, and go into '''Run Settings'''
# In the side-bar, select '''Projects''' mode or press Control-5, and go into '''Run Settings'''
Line 152: Line 216:
# In the '''Run''' section, click on '''Add''' and select '''hello-qtonpi (on Remote Generic Linux Host)'''
# In the '''Run''' section, click on '''Add''' and select '''hello-qtonpi (on Remote Generic Linux Host)'''
# At this point, you should be all set to roll. In the side-bar, select '''Edit''' mode or press Control-2
# At this point, you should be all set to roll. In the side-bar, select '''Edit''' mode or press Control-2
# To build your project, select '''Build -&gt; Build All'''. This should build the binary using QtonPi toolchain.
# To build your project, select '''Build -> Build All'''. This should build the binary using QtonPi toolchain.
# Next step would be deploy your binaries onto your Raspberry Pi Device. To do this, select '''Build -&gt; Deploy All'''. Your Raspberry Pi device should now have &lt;code&amp;gt;hello-qtonpi&amp;lt;/code&amp;gt; executable in &lt;code&amp;gt;/root/hello-qtonpi&amp;lt;/code&amp;gt; directory.
# Next step would be deploy your binaries onto your Raspberry Pi Device. To do this, select '''Build -> Deploy All'''. Your Raspberry Pi device should now have <code>hello-qtonpi</code> executable in <code>/root/hello-qtonpi</code> directory.
# To run your newly minted App, select '''Build <s>&gt; Run*, and at this point you should see your Qt 5 Qt Quick App running on your display
# To run your newly minted App, select '''Build -> Run*, and at this point you should see your Qt 5 Qt Quick App running on your display
<br />Now that you've a working QtonPi SDK, next step would be to learn more about Qt Quick. Following are some resources to help you get started.
 
<br />* &quot;Qt Essentials</s> Qt Quick for C++ Developers&amp;quot;:http://qt.nokia.com/learning/online/training/materials/qt-essentials-qt-quick-edition<br />''' &quot;Qt Quick for Designers&amp;quot;:http://qt.nokia.com/learning/online/training/materials/qt-quick-for-designers  
Now that you've a working QtonPi SDK, next step would be to learn more about Qt Quick. Following are some resources to help you get started.
 
* [http://qt.nokia.com/learning/online/training/materials/qt-essentials-qt-quick-edition Qt Essentials- Qt Quick for C++ Developers]
''' [http://qt.nokia.com/learning/online/training/materials/qt-quick-for-designers Qt Quick for Designers]


== Uninstall ==
== Uninstall ==
Line 170: Line 237:
=== Qt Creator ===
=== Qt Creator ===


In order to uninstall Qt Creator, go to the &lt;code&amp;gt;bin/&amp;lt;/code&amp;gt; directory in your Qt Creator installation and execute the &lt;code&amp;gt;uninstall&amp;lt;/code&amp;gt; command.
In order to uninstall Qt Creator, go to the <code>bin/</code> directory in your Qt Creator installation and execute the <code>uninstall</code> command.


<code><br />$ pwd<br />/home/rajiv<br />$ cd qtcreator-2.4.1/bin<br />$ pwd<br />/home/rajiv/qtcreator-2.4.1/bin<br />$ ./uninstall<br /></code>
<code>
$ pwd
/home/rajiv
$ cd qtcreator-2.4.1/bin
$ pwd
/home/rajiv/qtcreator-2.4.1/bin
$ ./uninstall
</code>


=== Toolchain and Sysroot ===
=== Toolchain and Sysroot ===


Uninstalling the toolchain and sysroot is as simple as removing the &lt;code&amp;gt;/opt/qtonpi/&amp;lt;/code&amp;gt; directory.
Uninstalling the toolchain and sysroot is as simple as removing the <code>/opt/qtonpi/</code> directory.


<code><br />$ sudo rm -rf /opt/qtonpi/<br /></code>
<code>
$ sudo rm -rf /opt/qtonpi/
</code>


Should take care of it!
Should take care of it!
Line 184: Line 260:
=== Qt 5 ===
=== Qt 5 ===


Likewise, to uninstall Qt 5, remove &lt;code&amp;gt;/opt/qt5/&amp;lt;/code&amp;gt; directory.
Likewise, to uninstall Qt 5, remove <code>/opt/qt5/</code> directory.


<code><br />$ sudo rm -rf /opt/qt5/
<code>
$ sudo rm -rf /opt/qt5/

Revision as of 12:57, 28 June 2015

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

QtonPi App SDK

QtonPi Release-0.x App SDK consists of,

  • Qt Creator
  • Sysroot + Toolchain

As indicated in the roadmap, we hope to have a more integrated App SDK from Release-1.x onwards.

Download

QtonPi releases are distributed via BitTorrent. QtonPi download page is here.

Upon downloading a QtonPi release, you should see a tarball

qtonpi-X.Y.tar.bz2

, where

"X"

is the major release number and

"Y"

is the minor release.

QtonPi release directory is organized as follows,

qtonpi-X.Y/
├── app-sdk/
├── platform-sdk/
 ├── host-rpms/
 ├── image-creator-binaries/
 └── mt-cross-tools/
└── sdcard-img/

Following is a brief description of the directory structure,

app-sdk/
Application SDK
platform-sdk/
Platform SDK - In case you would like to roll your own SD Card Image and/or Sysroot. See [[Contribute
sdcard-img/
Default SD Card Image - Please use this for reporting bugs!

Install

Qt Creator

First step would be to install Qt Creator. You will find Qt Creator installer here,

qtonpi-X.Y/
├── app-sdk/
 └── qt-creator-linux-x86-opensource-2.x.y.bin

To install, just run the

qt-creator-linux-x86-opensource-2.x.y.bin

file

$ pwd
/home/rajiv/qtonpi-0.2/app-sdk
$ ./qt-creator-linux-x86-opensource-2.4.1.bin

This should install, launch Qt Creator. In addition, it'll also create an icon on your Desktop.

Toolchain and Sysroot

Next step would be to install the toolchain and default sysroot. You can find it here,

qtonpi-X.Y/
├── app-sdk/
 └── toolchain-and-sysroot-armv5tel.tar.bz2

You will need to extract this as

root

user, into the

root("/")

directory of your filesystem.

$ cd /
$ pwd
/
$ sudo tar jxvf /home/rajiv/qtonpi-0.2/app-sdk/toolchain-and-sysroot-armv5tel.tar.bz2

Qt 5

QtonPi ships with a known working (necessarily not stable!) version of Qt 5. This version works both on the sysroot and the target and you can find it here,

qtonpi-0.2/
├── app-sdk/
 ├── opt-qt5-current.tar.bz2

You will need to extract this as

root

user, into the

root("/")

directory of your filesystem.

$ cd /
$ pwd
/
$ sudo tar jxvf /home/rajiv/qtonpi-0.2/app-sdk/opt-qt5-current.tar.bz2

SD Card Image

In addition, there is also a default 2GB SD Card Image, with Qt 5 on it. You'll find it here.

qtonpi-X.Y/
└── sdcard-img/
 └── qtonpi-sdcard-X.Y.img.bz2

To setup your SD card,

cat/dd

the contents of this file onto your SD Card. Assuming your SD Card device is

/dev/sdb

, one way to do this is as follows. Note you'll need to be logged in as

root

in order to be able to write to

/dev/sdb

device.

# pwd
/home/rajiv/qtonpi-0.2/sdcard-img
# bzcat qtonpi-sdcard-0.2.img.bz2 > /dev/sdb; sync

You're now ready to boot your Raspberry Pi Device! There are two accounts -

root

and

qtonpi

. Password for the accounts are

rootme

and

qtonpi

respectively. Upon booting and logging into your Raspberry Pi device as

root

, you'll need to enable networking (which is disabled by default!). If you've DHCP setup, find out the ethernet interface of your Raspberry Pi device by doing

ifconfig -a

and run

dhclient eth0

on that interface.

-bash-4.1# ifconfig -a
eth0 Link encap:Ethernet HWaddr B8:27:EB:E2:26:B5

[]

-bash-4.1# dhclient eth0

[]

-bash-4.1# ifconfig -a
eth0 Link encap:Ethernet HWaddr B8:27:EB:44:23:50
 inet addr:10.48.194.196 Bcast:10.48.194.255 Mask:255.255.255.128
 UP BROADCAST RUNNING MULTICAST MTU:1488 Metric:1
 RX packets:549 errors:0 dropped:0 overruns:0 frame:0
 TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:90538 (88.4 KiB) TX bytes:8025 (7.8 KiB)
dhclient

usually does a lousy job at giving useful information. So, once you are back on the command prompt, do an

ifconfig -a

to see if an IP Address got assigned. In the above example, eth0 has an IP address of 10.48.194.196. Then update the date/time on Raspberry Pi device. This can be done easily using

ntpdate
-bash-4.1# ntpdate -u 0.us.pool.ntp.org

Configuring Qt Creator, Toolchain, Qt 5 and Raspberry Pi board

Connecting Qt Creator to Raspberry Pi board

By this time you should be able to ssh from your host machine (running Qt Creator) into your Raspberry Pi Board. If you are not able to do so, please check your network connectivity before proceeding any further!

  1. Launch Qt Creator and select Tools -> Options-> Linux Devices
  2. Click Add and select Generic Linux Device. Then Click on Start Wizard
  3. Enter the following in the dialog box that appears
    • The name to identify this configuration:
      Raspberry Pi
      
    • The device's hostname or IP address : IP Address of your Raspberry Pi device
    • The user name to log into the device:
      root
      
    • The authentication type: Select Password
    • The user's password:
      rootme
      
  4. Click Next followed by Finish
  5. The Device Test should finish successfully. If not, go back and check your network connectivity and other settings.

Setting up your toolchain

  1. In Qt Creator, select Tools -> Options-> Build & Run and Tool Chains tab
  2. Select Manual and click on Add
  3. In the dropdown menu, select GCC
  4. Then select GCC, as it appears below Manual and specify the Compiler path: as /opt/qtonpi/bin/armv5tel-qtonpi-linux-gnueabi-gcc and Debugger: as /opt/qtonpi/bin/armv5tel-qtonpi-linux-gnueabi-gdb
  5. Click on Apply and select OK

Selecting Qt 5 for Raspberry Pi

  1. In Qt Creator, select Tools -> Options-> Build & Run and Qt Versions tab
  2. Select Manual and click on Add…
  3. Then select
    qmake
    
    file located in /opt/qt5/bin/qmake and click on Open
  4. Click on Apply and select OK

Qt creator might indicate "Qt version 5.0.0 for Desktop", which can be safely ignored for now.

Hello QtonPi!

QtonPi App SDK comes with

hello-qtonpi

App to get you started with Qt 5, which is located here,

qtonpi-X.Y/
├── app-sdk/
 ├── hello-qtonpi.tar.bz2

Feel free to extract the tarball anywhere in your home directory.

$ pwd
/home/rajiv
$ tar jxvf qtonpi-0.2/app-sdk/hello-qtonpi.tar.bz2
hello-qtonpi/
hello-qtonpi/main.cpp
hello-qtonpi/hello-qtonpi.pro
[]

Next launch Qt Creator (if you don't already have it running!), and do the following.

  1. Select File -> Open File or Project…, navigate to
    hello-qtonpi/hello-qtonpi.pro
    
    and click Open
  2. When you do this first time, Project Setup Dialog appears for the Target Setup, with sane defaults. Select Finish
  3. In the side-bar, select Projects mode or press Control-5, and go into Run Settings
  4. In the Deployment section, click on Add and select Deploy to Remote Linux Host
  5. In Device Configuration you should see Raspberry Pi (Default)
  6. In the Run section, click on Add and select hello-qtonpi (on Remote Generic Linux Host)
  7. At this point, you should be all set to roll. In the side-bar, select Edit mode or press Control-2
  8. To build your project, select Build -> Build All. This should build the binary using QtonPi toolchain.
  9. Next step would be deploy your binaries onto your Raspberry Pi Device. To do this, select Build -> Deploy All. Your Raspberry Pi device should now have
    hello-qtonpi
    
    executable in
    /root/hello-qtonpi
    
    directory.
  10. To run your newly minted App, select Build -> Run*, and at this point you should see your Qt 5 Qt Quick App running on your display

Now that you've a working QtonPi SDK, next step would be to learn more about Qt Quick. Following are some resources to help you get started.

Qt Quick for Designers

Uninstall

Release 0.x of QtonPi SDK consists of three parts, which you'll need to uninstall separately.

  1. Qt Creator
  2. Qt 5
  3. QtonPi Toolchain and Sysroot

Note - If you are updating between 0.x releases, you do not have to uninstall Qt Creator each time.

Qt Creator

In order to uninstall Qt Creator, go to the

bin/

directory in your Qt Creator installation and execute the

uninstall

command.

$ pwd
/home/rajiv
$ cd qtcreator-2.4.1/bin
$ pwd
/home/rajiv/qtcreator-2.4.1/bin
$ ./uninstall

Toolchain and Sysroot

Uninstalling the toolchain and sysroot is as simple as removing the

/opt/qtonpi/

directory.

$ sudo rm -rf /opt/qtonpi/

Should take care of it!

Qt 5

Likewise, to uninstall Qt 5, remove

/opt/qt5/

directory.

$ sudo rm -rf /opt/qt5/