RPMsg Kernel Sources

This page gives all the information about the RPMsg kernel source code trees, and supporting hardware.

= Prerequisites =

Here is a list of what you need to be able to work on RPMsg:


 * A Linux PC for downloading and compiling
 * GIT tool and GIT configuration to be able to clone from the respective repositories
 * ARM compiler recommended/used by corresponding product distribution

= Repositories =

The RPMsg code is included in the following kernel trees. Each of the following trees may be geared towards different needs and may require different levels of integration. Majority of the code should be present in almost all the trees, with minor features varying between one tree and another depending on the board you want to use, and the product distribution with corresponding product features.

TI Public Trees

 * kernel/omap: TI Android Public Integration tree for SDP, Blaze, Blaze Tablet
 * Clone: git clone git://git.omapzoom.org/kernel/omap.git
 * Branch: p-android-omap-3.0
 * Build Def Config: blaze_defconfig
 * Supported Boards: OMAP4 SDP, OMAP4 Blaze, OMAP4 Blaze Tablet

Google Public Trees
Clone: git clone https://android.googlesource.com/kernel/omap.git
 * Google Public OMAP Integration tree on 3.0 Kernel
 * Branch: linux-omap-3.0
 * Build Def Config: omap2plus_defconfig
 * Supported Boards: OMAP4 SDP, OMAP4 Blaze


 * Google Public Android OMAP Integration tree on 3.0 Kernel
 * Branch: android-omap-3.0
 * Build Def Config: omap2plus_defconfig, blaze_defconfig, panda_defconfig
 * Supported Boards: OMAP4 SDP, OMAP4 Blaze, OMAP4 Panda


 * Google Public Android OMAP Integration tree on 3.0 Kernel for Panda
 * Branch: android-omap-panda-3.0
 * Build Def Config: panda_defconfig
 * Supported Boards: OMAP4 Panda

Feature Trees
RPMsg Feature trees serve only to keep track of specific rpmsg topic branches. Used only for development testing and easy integration into other product branches Currently, there is no up-to-date feature tree hosted anywhere (will be hosted soon). Please use one of the above product integration trees.

Open Source Trees
Please look up the RPMsg Open Source page (coming soon) for details on the upstream version.

= Source Files =

The following are the typical directories and files associated with or used by RPMsg in a kernel. Some of the files/modules may not be present in all the trees. This list only highlights the files specific to OMAP.


 * arch/arm/plat-omap
 * omap_rpmsg.c - OMAP platform-specific remote processor messaging transport and virtio device registration
 * iommu.c, iommu-debug.c, iovmm.c, iopgtable.h - IOMMU interface definitions
 * mailbox.c - mailbox interface definitions
 * rproc_user.c - remoteproc's miscalleneous driver for secure playback invocation
 * devices.c - couple of functions dealing with setting the valid memory pool for remoteproc
 * omap_hwmod_xxx_data.c files - for hwmod definitions for m3 & dsp.
 * plat/include/ remoteproc.h, rpmsg.h, iommu.h, iommu2.h, iovmm.h, mailbox.h - various header files for remoteproc, rpmsg
 * plat/include/rpres.h - rpres platform data, platform device types and rpres module api definitions, used by remoteproc resource mgr


 * arch/arm/mach-omap2
 * remoteproc.c - omap device initialization file for remote processors
 * hwspinlock.c - omap device initialization file for Spinlocks
 * mailbox.c - Low level mailbox functions
 * omap-iommu.c, iommu2.c - Low level IOMMU functions
 * various omap4 board files - for reserving carveout memories for remote processors


 * drivers/remoteproc
 * all files - remote processor and remote resource api implementation
 * remoteproc.c - generic remoteproc implementation
 * omap_remoteproc.c - platform-specific remoteproc implementation
 * rpres.c - remote processor Resource driver
 * rpres_dev.c - remote processor resource device initialization


 * drivers/rpmsg
 * all files - rpmsg bus/driver implementation, rpmsg-omx driver, and rpmsg samples.


 * drivers/hwspinlock
 * all files - generic hwspinlock and omap-specific hw spinlock interfaces


 * drivers/virtio
 * virtio.c, virtio_ring.c - VirtIO infrastructure used by rpmsg


 * security/smc
 * rproc_drm.c - remote processor and security client integration component.


 * include/linux
 * remoteproc.h - remote processor types and interface definitions
 * rpmsg.h, rpmsg_omx.h - rpmsg types and interface definitions
 * rpmsg_resmgr.h - remote processor resource manager types and interface definitions
 * rproc_drm.h - interface definitions for rproc_drm

= Build Instructions =

Compiler
Please pick a compiler depending on your environment - Android or Ubuntu

Android
Add this compiler directory to PATH. export PATH=//prebuilt/linux-x86/toolchain//bin:$PATH
 * Android pastry distributions come with a prebuilt compiler. Typical installation would be found under /prebuilt/linux-x86/toolchain.

export ARCH=arm export CROSS_COMPILE=arm-eabi-
 * Export the following variables, so that you can avoid typing these in any kernel build make invocation

alias amake='make ARCH=arm CROSS_COMPILE=arm-eabi- '
 * Or an alias can be defined without the need for environment variables

Ubuntu

 * ARM CodeSourcery compiler toolchain can be used for all general purposes. Recommended version is CodeSourcery G++ Lite 2010q1-202 for ARM GNU/Linux

wget -c https://sourcery.mentor.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 mkdir -p ${HOME}/opt tar -C ${HOME}/opt -jxf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 * Download .tar from above link and untar to a host pc directory

export PATH=//bin:$PATH
 * Add Compiler directory to PATH

export ARCH=arm export CROSS_COMPILE=arm-none-linux-gnueabi-
 * Export the following variables, so that you can avoid typing these in any kernel build make invocation

Board Configs
Please use the appropriate board config based on the branch you are working with. Typical one used is blaze_defconfig with p-android-omap-3.0 branch. Below steps assume that ARCH and CROSS_COMPILE are either exported or specified in an alias.

If using compiler provided with Android, amake blaze_defconfig

If using standard GCC compiler, make blaze_defconfig

The defconfigs should already have the rpmsg and tiler options selected, but it doesn't hurt to make sure.

Build
All the following instructions are illustrated using the 'make' command. If Android Compiler is preferred, replace 'make' in below steps with the 'amake' alias.

Kernel Built-In
In menuconfig: make menuconfig

Make sure that the following options are set. Look in Build Customization section for customizing your build. System Type ---> TI OMAP Common Features ---> <*> OMAP Virtio-based remote processor messaging support [*] OMAP RPMSG Recovery -*- Mailbox framework support (256) Mailbox kfifo default buffer size (bytes) -*- IOMMU support for OMAP devices [ ]  Export OMAP IOMMU internals in DebugFS (0x0) Physical carveout memory pool size (Byte) Device Drivers ---> <*> Multimedia support ---> <*>  TI TILER support  ---> Device Drivers ---> <*> Generic Hardware Spinlock framework <*>  OMAP Hardware Spinlock device [*] Autosuspend support for remoteproc [*] OMAP remoteproc support <*> Remote Processor Resources [*] OMAP remoteproc watchdog timer <*> Virtio-based remote processor messaging bus <*>  rpmsg OMX driver <*>  rpmsg resource manager   An rpmsg client sample   An rpmsg server sample

To have RPMsg built-in to the kernel, simply use make uImage

Build modules
RPMsg is composed of different modules, and instead of building them into the kernel, they can be built as modules and installed/uninstalled after the Linux kernel has booted. The following assumes that TILER support is built-in into the kernel.

Make these selections: System Type ---> TI OMAP Common Features --->  OMAP Virtio-based remote processor messaging support [*] OMAP RPMSG Recovery -*- Mailbox framework support (256) Mailbox kfifo default buffer size (bytes) -*- IOMMU support for OMAP devices [ ]  Export OMAP IOMMU internals in DebugFS (0x0) Physical carveout memory pool size (Byte) Device Drivers ---> <*> Multimedia support ---> <*>  TI TILER support  ---> <*> Generic Hardware Spinlock framework <*>  OMAP Hardware Spinlock device [*] Autosuspend support for remoteproc [*] OMAP remoteproc support <*> Remote Processor Resources [*] OMAP remoteproc watchdog timer  Virtio-based remote processor messaging bus   rpmsg OMX driver   rpmsg resource manager   An rpmsg client sample   An rpmsg server sample

To build modules, just use amake modules or make modules

The following modules would be generated typically arch/arm/plat-omap/omap_rpmsg.ko drivers/rpmsg/rpmsg_client_sample.ko drivers/rpmsg/rpmsg_omx.ko drivers/rpmsg/rpmsg_resmgr.ko drivers/rpmsg/rpmsg_server_sample.ko drivers/rpmsg/virtio_rpmsg_bus.ko drivers/virtio/virtio.ko drivers/virtio/virtio_ring.ko

Copy modules into FS
These modules can be installed either using insmod or modprobe. If using insmod, copy the relevant .ko's into an appropriate folder. If using modprobe, you can use the following to copy into your file system. amake modules_install INSTALL_MOD_PATH=

Install/Uninstall modules
To install the modules, depmod -a modprobe virtio_rpmsg_bus modprobe omap_rpmsg modprobe rpmsg_omx modprobe rpmsg_resmgr

To uninstall the modules, modprobe -r virtio_rpmsg_bus modprobe -r omap_rpmsg modprobe -r rpmsg_omx modprobe -r rpmsg_resmgr

If you are using insmod, you would have to insmod virtio.ko and virtio_ring.ko as well.

= Generic Kernel Build Customizations =

Enable NFS Boot
Make sure the following are selected in your menuconfig to enable NFS boot

Device Drivers ---> -> Network Device Support ---> -> [*] Ethernet (10 or 100Mbit) ---> -> <*> Micrel KS8851 SPI -> Generic Driver Options ---> -> [*] Maintain a devtmpfs filesystem to mount at /dev -> [*]  Automount devtmpfs at /dev, after the kernel mounted the rootfs -> SPI support ---> -> <*> McSPI driver for OMAP [*] Networking support ---> -> Networking options ---> -> [*] TCP/IP networking -> [*] IP: kernel level autoconfiguration -> [*] IP: DHCP Support File Systems ---> -> [*] Network File Systems ---> -> <*> NFS Client Support [*] NFS Client Support for NFS version 3 [*]     NFS Client Support for the NFSv3 ACL protocol extension -> [*] Root File System on NFS

Enable DebugFS
Make sure the following are selected in your menuconfig to enable debugfs (CONFIG_DEBUGFS) in your kernel Kernel hacking ---> [*] Debug Filesystem

Enable Dynamic printk
RPMsg modules use dynamic prints, and so you can control the level of traces. Select the dynamic debugging option (CONFIG_DYNAMIC_DEBUG) in menuconfig Kernel hacking ---> [*] Enable dynamic printk support

= RPMsg Customizations =

Disable Error Recovery Mechanism
RPMsg has the remote processor recovery mechanism enabled by default. This automatically kicks in whenever there is a MMU Fault or an Exception or a Watch Dog Error on the BIOS-side. To aid better debugging, it is better to turn off the recovery (CONFIG_OMAP_RPMSG_RECOVERY) in menuconfig System Type ---> TI OMAP Common Features ---> <*> OMAP Virtio-based remote processor messaging support [ ] OMAP RPMSG Recovery

Disable Remoteproc WatchDog
Turning off the remote processor recovery mechanism halts the rpmsg channels from being deleted and recreated. It does not turn off any of the error reporting. The error notifications for exception handling is sent from the BIOS-side, and cannot be controlled from the kernel. The remote processor WatchDog however can be controlled from the kernel-side and it can turned off in menuconfig. Device Drivers ---> [*] Autosuspend support for remoteproc [*] OMAP remoteproc support <*> Remote Processor Resources [ ] OMAP remoteproc watchdog timer

The runtime disabling of Watchdog is currently not supported. It can probably be done in a crude way (not recommended) by disabling the interrupt of the corresponding Watchdog timer.

Disable Remoteproc Hibernation/Suspend
RPMsg supports runtime power management and puts the remote processor into hibernation/suspend (saves the remote processor context and puts it in reset) after a certain amount of duration (5 sec) provided remote processor is already idled. When an exception occurs on the remote processor, the remote processor is halted, and to aid debugging, the auto hibernation needs to be disabled. Device Drivers ---> [ ] Autosuspend support for remoteproc [*] OMAP remoteproc support <*> Remote Processor Resources [*] OMAP remoteproc watchdog timer

This can be configured during runtime as well. Please see the runtime ducati hibernation control section in the Debugging page.

Disable Remoteproc Core Dump
In case of a crash or an error, there is an option to dump the entire remote processor memory. This is a configurable option (CONFIG_OMAP_RPMSG_RECOVERY), and can be chosen to be turned off (albiet, not much would be gained) in menuconfig Device Drivers ---> [*] Autosuspend support for remoteproc [*] OMAP remoteproc support <*> Remote Processor Resources [*] OMAP remoteproc watchdog timer [ ] Support for extracting a core dump from a remote processor

The behavior of this dump can be controlled dynamically at runtime. Please see the runtime ducati core dump section in the Debugging page.

Exclude RPMsg
To build a minimal kernel without RPMsg, please disable the following options in menuconfig. You can choose to disable Mailbox, IOMMU and HW Spinlock support as well if RPMsg is the only client for these kernel components. System Type ---> TI OMAP Common Features ---> < > OMAP Virtio-based remote processor messaging support [*] Mailbox framework support (256) Mailbox kfifo default buffer size (bytes) [*] IOMMU support for OMAP devices [ ]  Export OMAP IOMMU internals in DebugFS (0x0) Physical carveout memory pool size (Byte) Device Drivers ---> <*> Generic Hardware Spinlock framework <*>  OMAP Hardware Spinlock device [ ] OMAP remoteproc support

RPMsg depends on TILER driver being enabled, while the converse is not true. There may be other clients for the TILER driver, and as such you can choose to disable TILER driver as well if you know that your desired configuration won't be using the TILER.