zircon/system/core/bootsvc/main.cc
// Parse ZBI_TYPE_IMAGE_ARGS item into boot args buffer
Parse ZBI_TYPE_IMAGE_ARGS item into boot args buffer
Parse ZBI_TYPE_IMAGE_ARGS item into boot args buffer
zx_status_t ExtractBootArgsFromImage(fbl::Vector<char>* buf, const zx::vmo& image_vmo,
                                     bootsvc::ItemMap* item_map) {
  auto it = item_map->find(bootsvc::ItemKey{ZBI_TYPE_IMAGE_ARGS, 0});
  if (it == item_map->end()) {
    return ZX_ERR_NOT_FOUND;
  }
  auto cfg = std::make_unique<char[]>(it->second.length);
  zx_status_t status = image_vmo.read(cfg.get(), it->second.offset, it->second.length);
  if (status != ZX_OK) {
    return status;
  }
  std::string_view str(cfg.get(), it->second.length);
  status = bootsvc::ParseBootArgs(std::move(str), buf);
  if (status != ZX_OK) {
    return status;
  }
  item_map->erase(it);
  return ZX_OK;
}
zx_status_t ExtractBootArgsFromImage ( fbl :: Vector < char > * buf , const zx :: vmo & image_vmo , bootsvc :: ItemMap * item_map ) { auto it = item_map -> find ( bootsvc :: ItemKey { ZBI_TYPE_IMAGE_ARGS , 0 } ) ; if ( it == item_map -> end ( ) ) { return ZX_ERR_NOT_FOUND ; } auto cfg = std :: make_unique < char [ ] > ( it -> second . length ) ; zx_status_t status = image_vmo . read ( cfg . get ( ) , it -> second . offset , it -> second . length ) ; if ( status != ZX_OK ) { return status ; } std :: string_view str ( cfg . get ( ) , it -> second . length ) ; status = bootsvc :: ParseBootArgs ( std :: move ( str ) , buf ) ; if ( status != ZX_OK ) { return status ; } item_map -> erase ( it ) ; return ZX_OK ; }
Parse ZBI_TYPE_IMAGE_ARGS item into boot args buffer
Parse ZBI_TYPE_IMAGE_ARGS item into boot args buffer
// read cfg data // Parse boot arguments file from bootdata.