src/bringup/bin/bootsvc/main.cc
// Load the boot arguments from bootfs/ZBI_TYPE_IMAGE_ARGS and environment variables.
Load the boot arguments from bootfs/ZBI_TYPE_IMAGE_ARGS and environment variables.
Load the boot arguments from bootfs / ZBI_TYPE_IMAGE_ARGS and environment variables .
zx_status_t LoadBootArgs(const fbl::RefPtr<bootsvc::BootfsService>& bootfs,
                         const zx::vmo& image_vmo, bootsvc::ItemMap* item_map, zx::vmo* out,
                         uint64_t* size) {
  fbl::Vector<char> boot_args;
  zx_status_t status;
  status = ExtractBootArgsFromImage(&boot_args, image_vmo, item_map);
  ZX_ASSERT_MSG(((status == ZX_OK) || (status == ZX_ERR_NOT_FOUND)),
                "Retrieving boot args failed: %s\n", zx_status_get_string(status));
  status = ExtractBootArgsFromBootfs(&boot_args, bootfs);
  ZX_ASSERT_MSG(status == ZX_OK, "Retrieving boot config failed: %s\n",
                zx_status_get_string(status));
  for (char** e = environ; *e != nullptr; e++) {
    for (const char* x = *e; *x != 0; x++) {
      boot_args.push_back(*x);
    }
    boot_args.push_back(0);
  }
  zx::vmo args_vmo;
  status = zx::vmo::create(boot_args.size(), 0, &args_vmo);
  if (status != ZX_OK) {
    return status;
  }
  status = args_vmo.write(boot_args.data(), 0, boot_args.size());
  if (status != ZX_OK) {
    return status;
  }
  status = args_vmo.replace(ZX_DEFAULT_VMO_RIGHTS & ~ZX_RIGHT_WRITE, &args_vmo);
  if (status != ZX_OK) {
    return status;
  }
  *out = std::move(args_vmo);
  *size = boot_args.size();
  return ZX_OK;
}
zx_status_t LoadBootArgs ( const fbl :: RefPtr < bootsvc :: BootfsService > & bootfs , const zx :: vmo & image_vmo , bootsvc :: ItemMap * item_map , zx :: vmo * out , uint64_t * size ) { fbl :: Vector < char > boot_args ; zx_status_t status ; status = ExtractBootArgsFromImage ( & boot_args , image_vmo , item_map ) ; ZX_ASSERT_MSG ( ( ( status == ZX_OK ) || ( status == ZX_ERR_NOT_FOUND ) ) , " \n " , zx_status_get_string ( status ) ) ; status = ExtractBootArgsFromBootfs ( & boot_args , bootfs ) ; ZX_ASSERT_MSG ( status == ZX_OK , " \n " , zx_status_get_string ( status ) ) ; for ( char * * e = environ ; * e != nullptr ; e ++ ) { for ( const char * x = * e ; * x != 0 ; x ++ ) { boot_args . push_back ( * x ) ; } boot_args . push_back ( 0 ) ; } zx :: vmo args_vmo ; status = zx :: vmo :: create ( boot_args . size ( ) , 0 , & args_vmo ) ; if ( status != ZX_OK ) { return status ; } status = args_vmo . write ( boot_args . data ( ) , 0 , boot_args . size ( ) ) ; if ( status != ZX_OK ) { return status ; } status = args_vmo . replace ( ZX_DEFAULT_VMO_RIGHTS & ~ ZX_RIGHT_WRITE , & args_vmo ) ; if ( status != ZX_OK ) { return status ; } * out = std :: move ( args_vmo ) ; * size = boot_args . size ( ) ; return ZX_OK ; }
Load the boot arguments from bootfs/ZBI_TYPE_IMAGE_ARGS and environment variables.
Load the boot arguments from bootfs / ZBI_TYPE_IMAGE_ARGS and environment variables .
// Add boot arguments from environment variables. // Copy boot arguments into VMO.