TipsAndTricks/RunningEclipseAgainstBuiltImage: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
No edit summary
Line 6: Line 6:
*  Target Machine -> qemux86
*  Target Machine -> qemux86
<br>
<br>
The Steps
=== Making a Suitable Qemux86 Image===
* We need to build a core-image-sato that has the pieces needed by Eclipse, so we add/change the following in our conf/local.conf:
* We need to build a core-image-sato that has the pieces needed by Eclipse, so we add/change the following in our conf/local.conf:
** We add the following to EXTRA_IMAGE_FEATURES in conf/local.conf
** We add the following to EXTRA_IMAGE_FEATURES in conf/local.conf
***  <code>EXTRA_IMAGE_FEATURES += " eclipse-debug  "</code>
***  <code>EXTRA_IMAGE_FEATURES += " eclipse-debug  "</code>
**** This adds gdbserver,tcf-agent (for Target Communication Framework), and openssh-sftp-server)
**** This adds gdbserver,tcf-agent (for Target Communication Framework), and openssh-sftp-server)
***  <code>EXTRA_IMAGE_FEATURES += " tools-sdk "</code>
**** This adds the build requirements on the target rootfs.  This is needed since the Yocto Eclipse plugin is assuming that the qemu rootfs and the sysroot are synonymous.
***  <code>EXTRA_IMAGE_FEATURES += " ssh-server-openssh "</code>
***  <code>EXTRA_IMAGE_FEATURES += " ssh-server-openssh "</code>
**** This defaults to the openssl ssh server rather than dropbear. You can use either so this line can be omitted since the sftp server works with either.
**** This defaults to the openssl ssh server rather than dropbear. You can use either so this line can be omitted since the sftp server works with either.
Line 26: Line 29:




To run Eclipse against the newly built image:
=== Running Eclipse Against the Built Qemux86 Image ===
 
This Cookbook assumes you have already installed the Eclipse Poky plugin following the directions in http://www.yoctoproject.org/docs/latest/sdk-manual/sdk-manual.html.  Assuming that is true, you can
* Goto Windows->Preferences->Yocto Project SDK
** enter Toolchain Root Location: <build dir>
*** this is  where you have been running bitbake core-image-sato, bitbake etc.
** enter Sysroot Location: <path>/MY_QEMU_ROOTFS
*** this is where you extracted the core-image-sato-qemux86.tar.bz2 to by running runqemu-extract-sdk
** enter Qemu/Kernel: <path>/tmp/deploy/images/qemux86/bzImage-qemux86.bin
*** this is the kernel we built
** You should now see i586-poky-linux in the Target Architecture dropdown list.
** hit apply and ok





Revision as of 23:00, 15 August 2016

Cookbook guide to Making an Eclipse Debug Capable Image

Suppose you are building images and would like to be able to use Eclipse and the Yocto Eclipse plugin to develop/debug a C/C++ application on either a remote hardware target or on qemu. This cookbook will explain the small number of steps needed to accomplish this.
So that the commands are specific and can be cut and pasted to try, we will assume the following:

  • Target Image-> core-image-sato
  • Target Machine -> qemux86


Making a Suitable Qemux86 Image

  • We need to build a core-image-sato that has the pieces needed by Eclipse, so we add/change the following in our conf/local.conf:
    • We add the following to EXTRA_IMAGE_FEATURES in conf/local.conf
      • EXTRA_IMAGE_FEATURES += " eclipse-debug "
        • This adds gdbserver,tcf-agent (for Target Communication Framework), and openssh-sftp-server)
      • EXTRA_IMAGE_FEATURES += " tools-sdk "
        • This adds the build requirements on the target rootfs. This is needed since the Yocto Eclipse plugin is assuming that the qemu rootfs and the sysroot are synonymous.
      • EXTRA_IMAGE_FEATURES += " ssh-server-openssh "
        • This defaults to the openssl ssh server rather than dropbear. You can use either so this line can be omitted since the sftp server works with either.
    • Execute: $bitbake core-image-sato
      • This makes a rootfs in tmp/deploy/images/qemux86/core-image-sato-qemux86.tar.bz2
  • We need to build the toolchain eclipse will use
    • Execute $bitbake core-image-sato -c populate_sdk
      • This makes sdk stuff such as the toolchains eclipse will use to build,
  • We need to build a version of qemu that can run natively on our workstation as well as a userspace nfs daemon.
    • Execute $bitbake meta-ide-support
  • We need an extracted rootfs that can be used by the userspace nfs daemon to boot qemu.
    • Execute $mkdir MY_QEMU_ROOTFS
      • Execute $runqemu-extract-sdk /tmp/deploy/images/qemux86/core-image-sato-qemux86.tar.bz2 MY_QEMU_ROOTFS
        • This will result in a fully extracted rootfs in MY_QEMU_ROOTFS and a set of permissions maintained by pseudo (a yocto tool similar to but more functional than fakeroot) for the rootfs in MY_QEMU_ROOTFS.pseudo_state


Running Eclipse Against the Built Qemux86 Image

This Cookbook assumes you have already installed the Eclipse Poky plugin following the directions in http://www.yoctoproject.org/docs/latest/sdk-manual/sdk-manual.html. Assuming that is true, you can

  • Goto Windows->Preferences->Yocto Project SDK
    • enter Toolchain Root Location: <build dir>
      • this is where you have been running bitbake core-image-sato, bitbake etc.
    • enter Sysroot Location: <path>/MY_QEMU_ROOTFS
      • this is where you extracted the core-image-sato-qemux86.tar.bz2 to by running runqemu-extract-sdk
    • enter Qemu/Kernel: <path>/tmp/deploy/images/qemux86/bzImage-qemux86.bin
      • this is the kernel we built
    • You should now see i586-poky-linux in the Target Architecture dropdown list.
    • hit apply and ok


Adding static tap devices

It is often easier to preconfigure several tap devices so that qemu can run and use them without needing to be root or use sudo. To do this, run runqemu-gen-tapdevs `id -u <username>` `id -g <username>` 4 `find ./tmp/sysroots -iname tunctl` as root. This will make the inet devices tap0,tap1,tap2,tap3. You can see them with ifconfig -a | grep tap . Typically, tap0 is 192.168.7.1 and so when the first qemu is run it's address will be 192.168.7.2 and 192.168.7.1 will be that qemu instance's gateway. The runqemu-gen-tapdevs is located in bitbake/scripts.

scripts/runqemu-gen-tapdevs