Using the OpenNAO in a virtual machine

This section gives some hints about how to build third-party software for NAO.

Before starting, make sure the OpenNAO virtual machine already setup and running. If it is not the case:

  • refer to this section to setup the OpenNAO virtual machine;
  • refer to this section to start the OpenNAO virtual machine;
  • refer to this section to login on the OpenNAO virtual machine.

Tweaking the OpenNAO virtual machine

Optimizing builds for Atom or Geode targets

As root, make the /etc/portage symlink point to:

  • /etc/portage.generic to build compliant binaries with Atom and Geode targets;
  • /etc/portage.atom to build optimized binaries for Atom targets;
  • /etc/portage.geode to build optimized binaries for Geode targets.

To change, just run the following commands:

# Here, set optimizations for Atom (a.k.a. NAO V4):
su
rm -fi /etc/portage
ln -sfv /etc/portage.atom /etc/portage
exit

# do some developments...

# Then you can switch back to the generic settings:
su
rm -fi /etc/portage
ln -sfv /etc/portage.generic /etc/portage
exit

Building the third-party software

emerge usage

emerge is the package manager used by Gentoo, OpenNAO.

As usual, do not hesitate to checkout the emerge documentation http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1#doc_chap3 or the its man page:

man emerge

This section gives the most often used emerge commands.

Warning

Never run:

emerge --sync

This will upgrade the whole system, all packages build after that may be not compatible with those from the OpenNAO system on the robot.

Searching a package

Searching in the package name (quick search):

emerge -s <some package>

Searching in the package description (a lot slower):

emerge -S <some package>

Building and installing a package

To build and install a package and all its dependencies, run (this requires root privileges):

su
emerge -ab <package name>
exit

After the building and installing some packagea in the virtual machine, the binary packages are locally stored in /home/nao/opennao-distro/packages.

The following command will show you all built packages:

tree ``/home/nao/opennao-distro/packages``

Package content

To check the content of an installed package:

equery files <package name>

To know which package a file belongs:

portageq owners / <full path of the file>