A session is the first product-specific component started on boot. The session component is responsible for building a product's user experience.
Booting into a session
To boot into a session, do the following:
For a session to run at boot you need to configure the product build with the session's URL. Identify the component URL for your session:
fuchsia-pkg://fuchsia.com/pkg-name#meta/your_session.cmReplace the following:
- pkg-name: the package name
- your_session.cm: the name of your session, including the
.cmextension.
For more information, see
fuchsia-pkgand Package name.Update your
//local/BUILD.gnto includeproduct_assembly_overrides.import("//build/assembly/developer_overrides.gni") assembly_developer_overrides("custom_session") { base_packages = [ "//path/to/your/session" ] platform = { session = { enabled = true } } product = { session = { url = "fuchsia-pkg://fuchsia.com/pkg-name#meta/your_session.cm" } } }Run the following command to include
your_sessionin your base image and set the configuration values you defined in//local:custom_session.fx set product.board --assembly-override=//local:custom_sessionfx list-productsandfx list-boardswill show lists of the products and boards available to be used in thefx setcommand. For more information onfxcommands see the fx documentation.Rebuild and re-pave the device.
fx build fx otaThis causes
session_managerto start and launch your session.
For a full explanation of building a session component, see Writing a Hello World Session.
Launch a session from the command line
There are cases when you don't want your session to launch at boot but still
want to be able to launch it from the command line. session_manager needs
to be running to launch a session. The session_manager target
ensures session_manager itself starts, but does not autolaunch a session.
To launch a session from the command line, do the following:
Update your
//local/BUILD.gnwithproduct_assembly_overridesusingautolaunch.import("//build/assembly/developer_overrides.gni") assembly_developer_overrides("custom_session") { base_packages = [ "//path/to/your/session" ] platform = { session = { enabled = true autolaunch = false } } product = { session = { url = "fuchsia-pkg://fuchsia.com/pkg-name#meta/your_session.cm" } } }Add the
session_managertarget in the base dependency set, in addition to the session target.fx set product.board --assembly-override=//local:custom_sessionfx list-productsandfx list-boardswill show lists of the products and boards available to be used in thefx setcommand. For more information onfxcommands see the fx documentation.Run the following command to rebuild and repave the device:
fx build fx otaThis causes
session_managerto start without launching your session.Your session can now be launched from the command line.
Run the following command to launch your session:
ffx session launch fuchsia-pkg://fuchsia.com/pkg-name#meta/your_session.cmFor more information about the
ffx sessioncommand, runffx session --help. For more information aboutffx, see theffx documentation.