未验证 提交 dbf39231 编写于 作者: O openharmony_ci 提交者: Gitee

!1047 optimize A/B partition startup

Merge pull request !1047 from cheng_jinsong/slot
......@@ -16,6 +16,7 @@ declare_args() {
enable_ohos_startup_init_feature_deviceinfo = true
param_test = true
control_test = false
enable_ohos_startup_init_feature_ab_partition = false
# init begetctl support liteos
enable_ohos_startup_init_feature_begetctl_liteos = false
......
......@@ -72,7 +72,8 @@ typedef struct SlotInfo {
} SlotInfo;
Fstab* LoadFstabFromCommandLine(void);
int GetSlotInfo(void);
int GetBootSlots(void);
int GetCurrentSlot(void);
void ReleaseFstab(Fstab *fstab);
Fstab *ReadFstabFromFile(const char *file, bool procMounts);
FstabItem *FindFstabItemForPath(Fstab fstab, const char *path);
......
......@@ -125,7 +125,7 @@ if (defined(ohos_lite)) {
"dump_service",
]
if (product_name == "rk3568") {
if (enable_ohos_startup_init_feature_ab_partition) {
sources += [ "partitionslot.cpp" ]
external_deps +=
[ "drivers_peripheral_partitionslot:libpartition_slot_manager" ]
......
......@@ -117,4 +117,23 @@ HWTEST_F(InnerkitsUnitTest, GetMountFlags_unitest, TestSize.Level1)
ReleaseFstab(fstab);
fstab = nullptr;
}
HWTEST_F(InnerkitsUnitTest, GetSlotInfo_unittest, TestSize.Level1)
{
EXPECT_NE(GetBootSlots(), -1);
EXPECT_NE(GetCurrentSlot(), -1);
}
HWTEST_F(InnerkitsUnitTest, LoadFstabFromCommandLine_unittest, TestSize.Level1)
{
EXPECT_NE(LoadFstabFromCommandLine(), (Fstab *)NULL);
}
HWTEST_F(InnerkitsUnitTest, GetBlockDevicePath_unittest, TestSize.Level1)
{
char devicePath[MAX_BUFFER_LEN] = {0};
EXPECT_EQ(GetBlockDevicePath("/vendor", devicePath, MAX_BUFFER_LEN), 0);
EXPECT_EQ(GetBlockDevicePath("/misc", devicePath, MAX_BUFFER_LEN), 0);
EXPECT_EQ(GetBlockDevicePath("/invalid", devicePath, MAX_BUFFER_LEN), -1);
}
} // namespace init_ut
......@@ -343,14 +343,18 @@ void PrepareCmdLineHasSn()
// for cmdline
const char *cmdLineHasSnroot = "bootgroup=device.charge.group earlycon=uart8250,mmio32,0xfe660000 "
"root=PARTUUID=614e0000-0000 rw rootwait rootfstype=ext4 console=ttyFIQ0 hardware=rk3568"
" BOOT_IMAGE=/kernel ohos.boot.sn=/test init=/init ohos.required_mount.system="
"/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc@none@none@none@wait,required";
" BOOT_IMAGE=/kernel ohos.boot.sn=/test init=/init";
CreateTestFile(BOOT_CMD_LINE, cmdLineHasSnroot);
LoadParamFromCmdLine();
const char *cmdLineHasntSn = "bootgroup=device.charge.group earlycon=uart8250,mmio32,0xfe660000 "
"root=PARTUUID=614e0000-0000 rw rootwait rootfstype=ext4 console=ttyFIQ0 hardware=rk3568"
" BOOT_IMAGE=/kernel init=/init ohos.required_mount.system="
"/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc@none@none@none@wait,required";
"root=PARTUUID=614e0000-0000 rw rootwait rootfstype=ext4 console=ttyFIQ0 hardware=rk3568 "
"BOOT_IMAGE=/kernel init=/init default_boot_device=fe310000.sdhci bootslots=2 "
"ohos.required_mount.system="
"/dev/block/platform/fe310000.sdhci/by-name/system@/usr@ext4@ro,barrier=1@wait,required "
"ohos.required_mount.vendor="
"/dev/block/platform/fe310000.sdhci/by-name/vendor@/vendor@ext4@ro,barrier=1@wait,required "
"ohos.required_mount.misc="
"/dev/block/platform/fe310000.sdhci/by-name/misc@none@none@none@wait,required";
CreateTestFile(BOOT_CMD_LINE, cmdLineHasntSn);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册