Using RDK as our reference platform, we migrated from Cobalt 25 to Cobalt 27 first. You can find most of the required changes in this commit:
[d7236a995f023bba1c74ad95602f460c2fa72297](https://cobalt.googlesource.com/external/components/generic/cobalt/+/d7236a995f023bba1c74ad95602f460c2fa72297).

## Overview

Below are the high-level steps required to migrate a platform:

- Add your platform to `_COBALT_STARBOARD_PLATFORMS` in `cobalt/build/gn.py` and add an `args.gn` file for your platform at `cobalt/build/configs/<platform_name>/args.gn`.

  - Ensure you set the following variables:

      import("//cobalt/build/configs/linux-x64x11-modular/args.gn")
      target_os =
      target_cpu =
      use_evergreen = true
      starboard_path =

  Use the appropriate OS and CPU for your target platform, and set the Starboard path to the directory containing your port (for example, the `starboard_path` for the `linux-x64x11` reference platform is `starboard/linux/x64x11`).
- Update Starboard functions (this mostly involves removing deprecated functions; see [starboard/CHANGELOG.md](https://developers.google.com/youtube/cobalt/docs/gen/starboard/CHANGELOG.md), but you may need to modify wrappers under `//starboard/shared/modular/` if NPLB tests fail).

- Follow [crashpad_integration.md](https://developers.google.com/youtube/cobalt/docs/gen/starboard/doc/eap/crashpad_integration) to migrate your platform's Crashpad integration.

- Some Chromium settings may cause issues. If you run into these issues, contact the Cobalt team so we can address them upstream.

- Validate with the NPLB test suite and by running Cobalt. Run NPLB via an Evergreen loader instead of directly as an executable.

- Validate by running YTS, aiming for parity with Cobalt 25 results.

## Building and Running

To build Cobalt and NPLB in Evergreen mode:

    cobalt/build/gn.py -p <your_platform> -c <config> --no-rbe
    autoninja -C out/<your_platform>_<config> cobalt_loader nplb_loader

To run Cobalt:

    out/<your_platform>_<config>/cobalt_loader.py

Or, if you need to deploy to a device, i.e., to run NPLB:

    tar czpf nplb.tgz -C out/<your_platform>_<config>/ -T out/<your_platform>_<config>/nplb_loader.runtime_deps

    # Copy to your device

    tar xzpf nplb.tgz
    ./nplb_loader.py

The helper Python script runs `elf_loader_sandbox --evergreen_content=. --evergreen_library=libnplb.so`. You can run this manually if you prefer, changing the flag values as necessary.