Cobalt / Porting Cobalt to your Platform with Starboard (2022)

This document provides step-by-step instructions for porting Cobalt to runon your platform. To do so, you'll use Starboard, which is Cobalt's portinglayer and OS abstraction. Starboard encapsulates only the platform-specificfunctionality that Cobalt uses.

To complete a port, you need to add code to the Cobalt source tree. Werecognize that many porters will not want to actually share details oftheir Starboard implementation with external users. These porters likelyhave their own source control and will fork Cobalt into their softwareconfiguration management (SCM) tools. These instructions take that usecase into account and explain how to add your port in a way that will notconflict with future Cobalt source code changes.


To complete the instructions below, you first need to clone the Cobalt sourcecode repository:

$ git clone

If you prefer, you can instead complete the instructions forsetting up a Cobalt development environment on Linux. Checking out the Cobalt sourcecode is one step in that process.

Porting steps

1. Enumerate and name your platform configurations

Your first step is to define canonical names for your set of platformconfigurations. You will later use these names to organize the codefor your platforms.

A platform configuration has a one-to-one mapping to a production binary.As such, you will need to create a new platform configuration any time youneed to produce a new binary.

A platform configuration name has two components:

(Video) How To Build Your Own Swim Platform - PowerBoat TV

  • The <family-name> is a name that encompasses a group of products thatyou are porting to Starboard.
  • The <binary-variant> is a string that uniquely describes specificsof the binary being produced for that configuration.

The recommended naming convention for a platform configuration is:


For example, suppose a company named BobCo produces a variety of BobBoxdevices. Some of the devices use big-endian ARM chips, while others uselittle-endian ARM chips. BobCo might define two platform configurations:

  • bobbox-armeb
  • bobbox-armel

In this example, bobbox is the family name and is used in both (all)of BobCo's platform configurations. The binary-variant for devices withbig-endian ARM chips is armeb. For devices with little-endian ARM chips,the binary-variant is armel.

2. Add Source Tree Directories for your Starboard Port

Add the following directories to the source tree for the <family-name>that you selected in step 1:

Again, functions that work for all of the configurations would go in theshared directory. Functions that work for all little-endian devices would goin the armel directory. And functions specific to little-endian devicesthat use OpenGL ES would go in the armel/gles directory.

3. Add required binary-variant files

Each binary-variant directory that you created in step 2 must containthe following files:

  • atomic_public.h
  • configuration_public.h
  • platform_configuration/
  • platform_configuration/configuration.gni
  • toolchain/

We recommend that you copy the files from the Stub reference implementation,located at starboard/stub/ to your binary-variant directories.In this approach, you will essentially start with a clean slate of stubinterfaces that need to be modified to work with your platform.

An alternate approach is to copy either the Desktop Linux or Raspberry Piports and then work backward to fix the things that don't compile or workon your platform.

If you are copying the Stub implementation, you would run the followingcommand for each binary-variant directory:

cp -R starboard/stub third_party/starboard/<family-name>/<binary-variant>

After copying these files, you should be able to compile Cobalt and link itwith your toolchain even though the code itself will not yet work.

3a. Additional files in the stub implementation

The stub implementation contains three additional files that are not listedamong the required files for each binary-variant directory:

(Video) Cobalt 292 Extended Swim Platform Installation

  • application_stub.h

The Starboard Application class is designed to do the following:

  • Integrate a generic message loop function with a system message pump thatcan deliver either input or application lifecycle events likesuspend/resume.
  • Provide a place for graceful platform-specific initialization and teardown.
  • Provide a universally accessible place to store global platform-specificstate, such as managed UI windows.

Thus, these files provide a framework for fulfilling Starboard's eventdispatching requirements, even though they don't implement any specificStarboard interface and aren't strictly necessary for any given port. Even so,anyone who is porting Cobalt will likely need to adapt a copy and application_stub.h to their platforms needs.

The application files do not necessarily need to be per-variant files. Evenif you have multiple variants, it's still possible that you only need one copyof these files in your shared directory. Similarly, you might have a sharedbase class along with variant-specific subclasses.

4. Make required file modifications

To port your code, you must add your platform to starboard/build/platforms.pythen make the following modifications to the files that you copied in step 3:

  1. atomic_public.h - Ensure that this file points at the appropriateshared or custom implementation.

  2. configuration_public.h - Adjust all of the configuration values as appropriate foryour platform.

  3. platform_configuration/

    1. Update your platform command-line flags and libraries. Ensure thatyou do not assume a particular workstation layout since that layoutmay vary from user to user.
  4. platform_configuration/configuration.gni

    1. Update the following variables in the file from their default instarboard/build/config/base_configuration.gni if necessary:
      • gl_type - Set to system_gles2 if you are using the system EGL+ GLES2 implementation and otherwise set the value to none.
      • enable_in_app_dial - Enables (or disables) the DIAL server thatruns inside Cobalt. (This server only runs when Cobalt is running.)The DIAL protocol enablessecond-screen devices (like tablets and phones) to discover,launch, and interface with applications on first-screen devices(like televisions, set-top boxes, and Blu-ray players).
        • Set this value to false if you already have system-wide DIALsupport. In that case, a DIAL server running inside Cobaltwould be redundant.
        • Set this value to true if you want Cobalt to run a DIALserver whenever it is running. That server could only be usedto connect with the current Cobalt application (e.g. YouTube).
  5. toolchain/


    1. If your platform uses a simple clang toolchain, simply pass the path tothe toolchain to the clang_toolchain template. This template willassume names for each of the tools, i.e. the clang++ executableshould be at ${clang_base_path}/clang++.

      Modify the host's toolchain_args to pass the correct OS and CPU foryour host platform.

      If your toolchain uses GCC or has tool names that differ from whatthe clang_toolchain template assumes, use the gcc_toolchaintemplate (also provided in "//build/toolchain/gcc_toolchain.gni").To use this template, pass full paths to each of the required tools(ar, cc, cxx, and ld), as well as any optional tools you wantto use. If your toolchain uses clang, make sure you passis_clang = true in toolchain_args.

    2. Update your toolchain command-line flags and libraries. Ensure thatyou do not assume a particular workstation layout since that layoutmay vary from user to user.

5. Port modules to work on your platform

The file points to all of the source files includedin your new Starboard implementation. If you are starting with a copy of theStub implementation, then that file will initially include a lot of filesfrom the starboard/shared/stub/ directory. Similarly, if you are startingstarting with a copy of the Desktop Linux port, then that file will initiallypoint to files in the starboard/shared/posix directory.

The modules are defined so that each one has a set of functions, and eachfunction is defined in its own file with a consistent naming convention.For example, the SbSystemBreakIntoDebugger() function is defined in file. The list of files in thestarboard/shared/stub/ directory represents an authoritative list ofsupported functions.

Function-by-function and module-by-module, you can now replace stubimplementations with either custom implementations or with other portedimplementations from the starboard/shared/ directory until you havegone through all of the modules. As you do, update file to identify the appropriate source files.

Due to dependencies between modules, you will find it easier to get somemodules to pass the NPLB tests before other modules. We recommend portingmodules in the following order to account for such dependencies:

  1. Configuration
  2. main(), Application, and Event Pump - This is the call into SbEventHandle.
  3. Memory
  4. Byte Swap
  5. Time
  6. String/Character/Double
  7. Log
  8. File
  9. Directory
  10. System
  11. Atomic
  12. Thread & Thread Types
  13. Mutex
  14. Condition Variable
  15. Once
  16. Socket
  17. SocketWaiter
  18. Window
  19. Input
  20. Blitter (if applicable)
  21. Audio Sink
  22. Media & Player
  23. DRM
  24. TimeZone
  25. User
  26. Storage


1. How to Rebuild a Fiberglass Swim Platform - Part 1 - PowerBoat TV
(PowerBoat Television)
2. New Swim Platform Extension Installation!
3. Sanger Boats: Custom Fiberglass Swim Platforms
4. How to Install Marine Mat EVA Foam on a swim platform | My Boat
(PowerBoat Television)
5. SOLD | 2006 Regal 2200 Fastrac | 5.0 GXI | 50+ MPH | Only 300 Hours! | VIDEO TOUR + SEA TRIAL
(Wave One Marine)
6. 2005 Cobalt 262 For Sale with a 525 EFi Mercruiser
(UsedBoatsTV - Used boats for sale reviews)

You might also like

Latest Posts

Article information

Author: Rueben Jacobs

Last Updated: 07/25/2022

Views: 6139

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.