1 /*
2  * Copyright (C) 2023 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 
17 #pragma once
18 
19 #include <fruit/fruit.h>
20 
21 #include "host/commands/assemble_cvd/boot_config.h"
22 #include "host/libs/avb/avb.h"
23 #include "host/libs/config/cuttlefish_config.h"
24 #include "host/libs/config/feature.h"
25 
26 namespace cuttlefish {
27 
28 class KernelRamdiskRepacker : public SetupFeature {};
29 
30 fruit::Component<fruit::Required<const CuttlefishConfig,
31                                  const CuttlefishConfig::InstanceSpecific,
32                                  const Avb>,
33                  KernelRamdiskRepacker>
34 KernelRamdiskRepackerComponent();
35 
36 Result<void> GeneratePersistentBootconfig(
37     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&);
38 
39 Result<void> Gem5ImageUnpacker(const CuttlefishConfig&, KernelRamdiskRepacker&);
40 
41 Result<void> GeneratePersistentVbmeta(
42     const CuttlefishConfig::InstanceSpecific&,
43     AutoSetup<InitBootloaderEnvPartition>::Type&,
44     AutoSetup<GeneratePersistentBootconfig>::Type&);
45 
46 Result<void> InitializeFactoryResetProtected(
47     const CuttlefishConfig::InstanceSpecific&);
48 
49 Result<void> InitializeInstanceCompositeDisk(
50     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&,
51     AutoSetup<InitializeFactoryResetProtected>::Type&,
52     AutoSetup<GeneratePersistentVbmeta>::Type&);
53 
54 }  // namespace cuttlefish
55