Index: embios/trunk/tools/embios.py |
— | — | @@ -606,10 +606,12 @@ |
607 | 607 | addr_flash = self._hexint(addr_flash)
|
608 | 608 | addr_mem = self._hexint(addr_mem)
|
609 | 609 | size = self._hexint(size)
|
610 | | - raise NotImplementedError
|
| 610 | + self.logger.info("Dumping boot flash addresses "+self._hex(addr_flash)+" - "+
|
| 611 | + hex(addr_flash+size)+" to "+self._hex(addr_mem)+" - "+self._hex(addr_mem+size)+"\n")
|
| 612 | + self.embios.bootflashread(addr_flash, addr_mem, size)
|
611 | 613 |
|
612 | 614 | @command
|
613 | | - def writerawbootflash(self, addr_flash, addr_mem, size):
|
| 615 | + def writerawbootflash(self, addr_flash, addr_mem, size, force=False):
|
614 | 616 | """
|
615 | 617 | Writes <size> bytes from memory to bootflash.
|
616 | 618 | ATTENTION: Don't call this unless you really know what you're doing!
|
— | — | @@ -616,11 +618,22 @@ |
617 | 619 | This may BRICK your device (unless it has a good recovery option)
|
618 | 620 | <addr_mem>: the address in memory to copy the data from
|
619 | 621 | <addr_bootflsh>: the address in bootflash to write to
|
| 622 | + <force>: Use this flag to suppress the 5 seconds delay
|
620 | 623 | """
|
621 | 624 | addr_flash = self._hexint(addr_flash)
|
622 | 625 | addr_mem = self._hexint(addr_mem)
|
623 | 626 | size = self._hexint(size)
|
624 | | - raise NotImplementedError
|
| 627 | + force = self._bool(force)
|
| 628 | + self.logger.info("Writing boot flash from the memory in "+self._hex(addr_mem)+" - "+
|
| 629 | + hex(addr_mem+size)+" to "+self._hex(addr_flash)+" - "+self._hex(addr_flash+size)+"\n")
|
| 630 | + if force == False:
|
| 631 | + self.logger.info("If this was not what you intended press Ctrl-C NOW")
|
| 632 | + import time
|
| 633 | + for i in range(5):
|
| 634 | + self.logger.info(".")
|
| 635 | + time.sleep(1)
|
| 636 | + self.logger.info("\n")
|
| 637 | + self.embios.bootflashwrite(addr_flash, addr_mem, size)
|
625 | 638 |
|
626 | 639 | @command
|
627 | 640 | def flushcaches(self):
|
Index: embios/trunk/tools/libembios.py |
— | — | @@ -364,11 +364,13 @@ |
365 | 365 | """ Copies the data in the bootflash at 'flashaddr' of the specified size
|
366 | 366 | to the memory at addr 'memaddr'
|
367 | 367 | """
|
| 368 | + return self.lib.monitorcommand(struct.pack("IIII", 22, memaddr, flashaddr, size), "III", (None, None, None))
|
368 | 369 |
|
369 | 370 | def bootflashwrite(self, memaddr, flashaddr, size):
|
370 | 371 | """ Copies the data in the memory at 'memaddr' of the specified size
|
371 | 372 | to the boot flash at addr 'flashaddr'
|
372 | 373 | """
|
| 374 | + return self.lib.monitorcommand(struct.pack("IIII", 23, memaddr, flashaddr, size), "III", (None, None, None))
|
373 | 375 |
|
374 | 376 | def execfirmware(self, addr):
|
375 | 377 | """ Executes the firmware at 'addr' and passes all control to it. """
|