Skip to content

Commit bdc2a42

Browse files
committed
[imageback] add support for chkroot ubi models
1 parent c36b488 commit bdc2a42

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/python/Screens/ImageBackup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,15 @@ def getImageList(self):
9999
def getImageListCallback(imageList):
100100
currentImageSlot = MultiBoot.getCurrentSlotCode()
101101
rootSlot = BoxInfo.getItem("HasKexecMultiboot") and currentImageSlot == "R"
102+
flashSlot = currentImageSlot == "F"
102103
currentImageSlot = int(currentImageSlot) if currentImageSlot and currentImageSlot.isdecimal() else 1
103104
print(f"[ImageBackup] Current slot={currentImageSlot}, rootSlot={rootSlot}.")
104105
images = [] # ChoiceEntryComponent(key, (Label, slotCode, recovery))
105106
if imageList:
106107
for slotCode in sorted(imageList.keys()):
107108
print(f"[ImageBackup] Slot {slotCode}: {imageList[slotCode]}")
108-
if imageList[slotCode]["status"] == "active":
109-
slotText = f"{slotCode} {"eMMC" if "mmcblk" in imageList[slotCode]["device"] else "USB"}"
109+
if imageList[slotCode]["status"] == "active" or imageList[slotCode]["status"] == "flash":
110+
slotText = f'{slotCode} {"eMMC" if "mmcblk" in imageList[slotCode]["device"] else "MTD" if "mtd" in imageList[slotCode]["device"] else "UBI" if "ubi" in imageList[slotCode]["device"] else "USB"}'
110111
if slotCode == "1" and currentImageSlot == 1 and BoxInfo.getItem("canRecovery"):
111112
images.append(ChoiceEntryComponent(None, (_("Slot %s: %s as USB Recovery") % (slotText, imageList[slotCode]["imagename"]), slotCode, True)))
112113
if rootSlot:
@@ -115,6 +116,8 @@ def getImageListCallback(imageList):
115116
images.append(ChoiceEntryComponent(None, ((_("Slot %s: %s (Current image)") if slotCode == str(currentImageSlot) else _("Slot %s: %s")) % (slotText, imageList[slotCode]["imagename"]), slotCode, False)))
116117
if rootSlot:
117118
images.append(ChoiceEntryComponent(None, (_("Slot R: Root Slot Image Backup (Current image)"), "R", False)))
119+
elif flashSlot:
120+
images.append(ChoiceEntryComponent(None, (_("Slot F: Flash Slot Image Backup (Current image)"), "F", False)))
118121
else:
119122
if BoxInfo.getItem("canRecovery"):
120123
images.append(ChoiceEntryComponent(None, (_("Internal flash: %s %s as USB Recovery") % (displayDistro, imageVersion), "slotCode", True)))
@@ -217,7 +220,8 @@ def consoleCallback(result=None):
217220
cmdLines.append(f"{self.makeDirCmd} -p {mountPoint}")
218221
cmdLines.append(f"{self.echoCmd} \"{_("Mount root file system.")}\"") # Mount the root file system.
219222
if MultiBoot.canMultiBoot():
220-
mountArgs = f"/dev/{mtdRootFs} {mountPoint}"
223+
if MultiBoot.canMultiBoot():
224+
mountArgs = f"-t ubifs {mtdRootFs} {mountPoint}" if mtdRootFs.startswith("ubi0:") else f"/dev/{mtdRootFs} {mountPoint}"
221225
if rootfsSubDir:
222226
if hasMultiBootMDT:
223227
mountArgs = f"-t ubifs {mtdRootFs} {mountPoint}"

0 commit comments

Comments
 (0)