Android-cuttlefish cvd tool
vendor_boot_image.h
Go to the documentation of this file.
1//
2// Copyright (C) 2026 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#pragma once
17
18#include <stdint.h>
19
20#include <memory>
21#include <optional>
22#include <variant>
23
24#include "bootimg.h"
25
26#include "cuttlefish/io/io.h"
29
30namespace cuttlefish {
31
33 public:
34 static Result<VendorBootImage> Read(std::unique_ptr<ReaderSeeker>);
35
36 uint32_t PageSize() const;
37
38 uint32_t KernelAddr() const;
39
40 uint32_t RamdiskAddr() const;
41
42 // All the vendor ramdisks concatenated together
44
45 std::string KernelCommandLine() const;
46
47 uint32_t TagsAddr() const;
48
49 std::string Name() const;
50
51 ReadWindowView Dtb() const;
52
53 uint64_t DtbAddr() const;
54
55 std::optional<ReadWindowView> Bootconfig() const;
56
57 private:
59 std::variant<vendor_boot_img_hdr_v3, vendor_boot_img_hdr_v4>;
60
61 VendorBootImage(std::unique_ptr<ReaderSeeker>, HeaderVariant);
62
63 const vendor_boot_img_hdr_v3& AsV3() const;
64 uint64_t VendorRamdiskBegin() const;
65 uint64_t DtbBegin() const;
66
67 std::unique_ptr<ReaderSeeker> reader_;
69};
70
71} // namespace cuttlefish
Definition: read_window_view.h:29
Definition: vendor_boot_image.h:32
uint32_t PageSize() const
Definition: vendor_boot_image.cc:59
std::variant< vendor_boot_img_hdr_v3, vendor_boot_img_hdr_v4 > HeaderVariant
Definition: vendor_boot_image.h:59
uint32_t RamdiskAddr() const
Definition: vendor_boot_image.cc:63
uint32_t TagsAddr() const
Definition: vendor_boot_image.cc:75
std::unique_ptr< ReaderSeeker > reader_
Definition: vendor_boot_image.h:67
std::string Name() const
Definition: vendor_boot_image.cc:77
ReadWindowView Dtb() const
Definition: vendor_boot_image.cc:81
ReadWindowView VendorRamdisk() const
Definition: vendor_boot_image.cc:65
uint64_t DtbBegin() const
Definition: vendor_boot_image.cc:126
std::optional< ReadWindowView > Bootconfig() const
Definition: vendor_boot_image.cc:89
uint32_t KernelAddr() const
Definition: vendor_boot_image.cc:61
HeaderVariant header_
Definition: vendor_boot_image.h:68
std::string KernelCommandLine() const
Definition: vendor_boot_image.cc:71
VendorBootImage(std::unique_ptr< ReaderSeeker >, HeaderVariant)
Definition: vendor_boot_image.cc:104
static Result< VendorBootImage > Read(std::unique_ptr< ReaderSeeker >)
Definition: vendor_boot_image.cc:41
uint64_t VendorRamdiskBegin() const
Definition: vendor_boot_image.cc:118
uint64_t DtbAddr() const
Definition: vendor_boot_image.cc:87
const vendor_boot_img_hdr_v3 & AsV3() const
Definition: vendor_boot_image.cc:108
Definition: alloc_driver.h:20
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30