@@ -91,7 +91,7 @@ def __init__(self, session, *args):
9191 "blue" : (self .restoreImage , _ ("Restore the highlighted slot" ))
9292 }, prio = 0 , description = _ ("MultiBoot Manager Actions" ))
9393 self ["restoreActions" ].setEnabled (False )
94- if BoxInfo .getItem ("HasKexecMultiboot" ) or BoxInfo .getItem ("HasGPT" ) or BoxInfo . getItem ( "hasUBIMB" ) :
94+ if BoxInfo .getItem ("HasKexecMultiboot" ) or BoxInfo .getItem ("HasGPT" ):
9595 self ["moreSlotActions" ] = HelpableActionMap (self , ["ColorActions" ], {
9696 "blue" : (self .moreSlots , _ ("Add more slots" ))
9797 }, prio = 0 , description = _ ("MultiBoot Manager Actions" ))
@@ -168,8 +168,6 @@ def deleteImageCallback(self, result):
168168 def moreSlots (self ):
169169 if BoxInfo .getItem ("HasGPT" ):
170170 self .session .open (GPTSlotManager )
171- elif BoxInfo .getItem ("hasUBIMB" ):
172- self .session .open (UBISlotManager )
173171 else :
174172 self .session .open (KexecSlotManager )
175173
@@ -239,7 +237,7 @@ def selectionChanged(self):
239237 self ["restartActions" ].setEnabled (True )
240238 self ["deleteActions" ].setEnabled (True )
241239 self ["restoreActions" ].setEnabled (False )
242- if (BoxInfo .getItem ("HasKexecMultiboot" ) and slotCode == "R" ) or BoxInfo .getItem ("HasGPT" ) or BoxInfo . getItem ( "hasUBIMB" ) :
240+ if (BoxInfo .getItem ("HasKexecMultiboot" ) and slotCode == "R" ) or BoxInfo .getItem ("HasGPT" ):
243241 self ["restoreActions" ].setEnabled (False )
244242 self ["moreSlotActions" ].setEnabled (True )
245243 self ["key_blue" ].setText (_ ("Add more slots" ))
@@ -713,17 +711,23 @@ def __init__(self, session, *args):
713711 self ["key_red" ] = StaticText ()
714712 self ["key_green" ] = StaticText ()
715713 self ["description" ] = Label ()
714+ greenAction = (self .rootInit , _ ("Start the Chkroot initialization" ))
715+ if BoxInfo .getItem ("hasUBIMB" ):
716+ greenAction = (self .UBIMBInit , _ ("Start the Chkroot initialization" ))
716717 self ["actions" ] = HelpableActionMap (self , ["OkCancelActions" , "ColorActions" ], {
717718 "ok" : (self .close , _ ("Close the Chkroot MultiBoot Manager" )),
718719 "cancel" : (self .close , _ ("Close the Chkroot MultiBoot Manager" )),
719720 "red" : (self .disableChkroot , _ ("Disable the MultiBoot option" )),
720- "green" : ( self . rootInit , _ ( "Start the Chkroot initialization" ))
721+ "green" : greenAction
721722 }, prio = - 1 , description = _ ("Chkroot Manager Actions" ))
722723 self ["key_red" ].setText (_ ("Disable Chkroot" ))
723724 self ["key_green" ].setText (_ ("Initialize" ))
724725 self .descriptionSuffix = _ ("The %s %s will reboot within 1 seconds." ) % getBoxDisplayName ()
725726 self ["description" ].setText ("%s\n \n %s" % (_ ("Press GREEN to enable MultiBoot!" ), self .descriptionSuffix ))
726727
728+ def UBIMBInit (self ):
729+ self .session .open (UBISlotManager )
730+
727731 def rootInit (self ):
728732 def rootInitCallback (* args , ** kwargs ):
729733 self .session .open (TryQuitMainloop , QUIT_REBOOT )
@@ -866,15 +870,15 @@ def createSlots(self):
866870 def formatDeviceCallback (self ):
867871 def closeStartUpCallback (answer ):
868872 if answer :
869- self .close ( )
873+ self .session . open ( TryQuitMainloop , QUIT_REBOOT )
870874 MOUNTPOINT = "/tmp/boot"
871875 mtdRootFs = BoxInfo .getItem ("mtdrootfs" )
872876 mtdKernel = BoxInfo .getItem ("mtdkernel" )
873877 device = self .UBISlotManagerDevice
874878 uuidRootFS = fileReadLine (f"/dev/uuid/{ device } 2" , default = None , source = MODULE_NAME )
875879 diskSize = self .partitionSizeGB (f"/dev/{ device } " )
876880
877- startupContent = f"kernel=/dev/{ mtdKernel } root=/dev/ { mtdRootFs } flash=1 rootfstype=ubifs\n "
881+ startupContent = f"kernel=/dev/{ mtdKernel } ubi.mtd=rootfs root=ubi0:rootfs flash=1 rootfstype=ubifs\n "
878882 with open (f"{ MOUNTPOINT } /STARTUP" , "w" ) as fd :
879883 fd .write (startupContent )
880884 with open (f"{ MOUNTPOINT } /STARTUP_FLASH" , "w" ) as fd :
@@ -913,7 +917,9 @@ def deviceSelectionCallback(self, selection):
913917 def partitionSizeGB (self , dev ):
914918 try :
915919 base = dev .replace ("/dev/" , "" )
916- path = f"/sys/class/block/{ base } /size"
920+ pathClass = f"/sys/class/block/{ base } /size"
921+ pathBlock = f"/sys/block/{ base } /size"
922+ path = pathClass if exists (pathClass ) else pathBlock
917923 with open (path ) as fd :
918924 blocks = int (fd .read ().strip ())
919925 return (blocks * 512 ) // (1024 * 1024 * 1024 )
0 commit comments