Exemplo n.º 1
0
 def prepareUpdaterKernel(self, patchConsoleEnable=False):
     kernel = archive.readFat(
         self.readFirmwareFile('nflasha1')).read('/boot/vmlinux')
     if patchConsoleEnable:
         kernel = zimage.patchZimage(kernel,
                                     kernel_patch.patchConsoleEnable)
     return kernel
Exemplo n.º 2
0
 def prepareUpdaterKernel(self, patchConsoleEnable=False):
     kernel = archive.readFat(
         self.readFirmwareFile('nflasha1')).read('/boot/vmlinux')
     if patchConsoleEnable:
         kernel = zimage.patchZimage(
             kernel,
             lambda k: k.replace(b'amba2.console=0', b'amba2.console=1'))
     return kernel
Exemplo n.º 3
0
 def prepareFlash1(self,
                   kernel=None,
                   initrd=None,
                   patchConsoleEnable=False):
     nflasha1 = archive.readFat(self.readFirmwareFile('nflasha1'))
     if kernel:
         nflasha1.write('/boot/vmlinux.bin', kernel)
     if initrd:
         nflasha1.write('/boot/initrd.img', initrd)
     if patchConsoleEnable:
         nflasha1.patch(
             '/boot/kemco.txt',
             lambda d: d.replace(b'amba2.console=0', b'amba2.console=1'))
     return archive.writeFat(nflasha1, 0x800000)
Exemplo n.º 4
0
 def prepareUpdaterInitrd(self,
                          shellOnly=False,
                          patchUpdaterLogLevel=False,
                          patchCasCmd=False):
     initrd = archive.readCramfs(
         archive.readFat(
             self.readFirmwareFile('nflasha1')).read('/boot/initrd.img'))
     if shellOnly:
         initrd.write(
             '/sbin/init',
             b'#!/bin/sh\nmount -t proc proc /proc\nwhile true; do sh; done\n'
         )
     else:
         if patchUpdaterLogLevel:
             initrd.patch(
                 '/root/UdtrMain.sh', lambda d: d.replace(
                     b'#!/bin/sh\n', b'#!/bin/sh\ndebugio 5\n'))
         if patchCasCmd:
             initrd.patch(
                 '/root/UdtrMain.sh', lambda d: d.replace(
                     b'uc_cascmd -m ca -c continu', b'true'))
     return archive.writeCramfs(initrd)
Exemplo n.º 5
0
 def prepareUpdaterKernel(self):
     return archive.readFat(
         self.readFirmwareFile('nflasha1')).read('/boot/vmlinux.bin')