Skip to content

Commit

Permalink
Implement 'Make ROM kits', 'Clean workspace' and python rkcrc and rku…
Browse files Browse the repository at this point in the history
…npack
  • Loading branch information
900supersport committed Nov 20, 2013
1 parent e89338d commit 4f64c24
Show file tree
Hide file tree
Showing 12 changed files with 593 additions and 65 deletions.
1 change: 1 addition & 0 deletions FreakTabKitchen.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def StartKitchen():
kc = KitchenConfig.KitchenConfig
kc()
kc.cwd = GetCWD()
print 'use py crc = {}'.format(kc.usepycrc)

ri = rominfo.rominfo
ri(KitchenConfig.KitchenConfig.ROMInfoLoc())
Expand Down
7 changes: 6 additions & 1 deletion KitchenConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def __init__(self):
KitchenConfig.minsystemsize = reader.minsystemsize
KitchenConfig.defaultsystemsize = reader.defaultsystemsize
KitchenConfig.defaultuserdataG = reader.defaultuserdataG


## i = os.system('rkcrc')
## if i > 256:
## KitchenConfig.usepycrc = 1
## else:
KitchenConfig.usepycrc = 0

#copy values into self for pickle useage
self.editor = KitchenConfig.editor
Expand Down
Binary file modified ROMtemplates/ROMKit.zip
Binary file not shown.
9 changes: 8 additions & 1 deletion kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@
#import bitstring

import rominfo
import KitchenConfig

from kitchenUI import mymenu, pprint
from utils import logerror
from kitchen_utils import rkcrc
#from rkcrc import rkcrc

#globals
cluto = 0 # clut offset
Expand Down Expand Up @@ -292,7 +295,11 @@ def brandkernel():
fw.write(c)

pprint( '... sign the kernel and move branded kernels to working/brand')
os.system('rkcrc -k working/kerneltmp.img working/brand/kernel.img')
## if KitchenConfig.KitchenConfig.usepycrc:
## rkcrc('-k', 'working/kerneltmp.img', 'working/brand/kernel.img')
## else:
## os.system('rkcrc -k working/kerneltmp.img working/brand/kernel.img')
rkcrc('-k', 'working/kerneltmp.img', 'working/brand/kernel.img')

#rename the temp file
os.rename('working/kerneltmp.img','working/brand/uskernel.img')
Expand Down
42 changes: 33 additions & 9 deletions kitchen_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
import time
import struct
import zipfile
import zlib

#900supersport imports
import KitchenConfig
import rominfo
from rkcrc import rkcrc as crc

from kitchenUI import header, pprint
from utils import CheckMakeFolders, finalisefilesystemimage, mountfileasfilesystem, CheckMakeFoldersRoot, apply_sed, checkfsimage, logerror
Expand All @@ -43,6 +45,21 @@
# logerror('kitchen_utils::mountsystem ',e,1)
# raise

def rkcrc(flag, infile, outfile):
try:
kc = KitchenConfig.KitchenConfig
if kc.usepycrc == 0:
r = os.system('rkcrc ' + flag + ' ' + infile + ' ' + outfile)
if r > 256:
kc.usepycrc = 1
crc(flag, infile, outfile)
else:
crc(flag, infile, outfile)

except Exception as e:
logerror('kitchen_utils::mountsystem ',e,1)
raise

def query_add(path, check, addition):
'''if check not found in path, append addition
'''
Expand Down Expand Up @@ -106,14 +123,14 @@ def custom_deploy(deploypath):
except Exception as e:
logerror('kitchen_utils::custom_deploy ',e,1)

def copyfilesworker(movefilename,sourceroot,asroot):
mvcpfilesworker(movefilename,sourceroot,'cp',asroot)
def copyfilesworker(movefilename,sourceroot,asroot,verbose=0):
mvcpfilesworker(movefilename,sourceroot,'cp',asroot,verbose)


def movefilesworker(movefilename,sourceroot,asroot = 1 ):
mvcpfilesworker(movefilename,sourceroot,'mv',asroot)
def movefilesworker(movefilename,sourceroot,asroot = 1,verbose=0 ):
mvcpfilesworker(movefilename,sourceroot,'mv',asroot,verbose)

def mvcpfilesworker(movefilename,sourceroot,op,asroot):
def mvcpfilesworker(movefilename,sourceroot,op,asroot,verbose=0):
try:
serr=''
path = os.path.expanduser(movefilename)
Expand Down Expand Up @@ -143,13 +160,18 @@ def mvcpfilesworker(movefilename,sourceroot,op,asroot):
logging.debug('kitchen_utils::mvcpfilesworker iszip' + str(iszip))
try:
if os.path.exists(source):

if iszip == 1:
if verbose ==1:
pprint( 'Zipping {} size {:,} kb'.format(source,os.stat(source).st_size/1024))
logging.debug('kitchen_utils::mvcpfilesworker ' + dest)
zf = zipfile.ZipFile(dest,mode='a')
zf = zipfile.ZipFile(file=dest,mode='a',compression=zipfile.ZIP_DEFLATED)
#zf.printdir()
zf.write(source,fn)
zf.close()
else:
if verbose ==1:
pprint( 'Processing {} size {:,} kb'.format(source,os.stat(source).st_size/1024))
logging.info('kitchen_utils::mvcpfilesworker ')
logging.info([dest])
CheckMakeFoldersRoot([dest])
Expand Down Expand Up @@ -271,7 +293,8 @@ def removefiles(removefile,root):
print 'Attempt Move ' + cl
source = os.path.join(root, args[0].strip())
dest = os.path.join('working/', args[1].strip())
if os.path.exists(source):
#if os.path.exists(source):
if len(glob.glob(source)) > 0:
logging.debug('copy ' + source + ' ' + dest )
logging.debug('Remove ' + source)
CheckMakeFolders([dest])
Expand Down Expand Up @@ -343,8 +366,9 @@ def finalise_boot_recovery(image):
print os.path.join('working', image),os.path.join('working', image + '.old')
os.rename(os.path.join('working', image),os.path.join('working', image + '.old'))
print 'renamed'
logging.debug('rkcrc -k working/custom' + image + '.gz ' + image)
os.system('rkcrc -k working/custom' + image + '.gz working/' + image)
#logging.debug('rkcrc -k working/custom' + image + '.gz ' + image)
#os.system('rkcrc -k working/custom' + image + '.gz working/' + image)
rkcrc('-k', 'working/custom' + image + '.gz', 'working/' + image)

pprint('=')
pprint(image + ' finalised')
Expand Down
7 changes: 6 additions & 1 deletion processcontrol/debloat
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#
#bloatpathname is rooted to system
app/buyu.apk, removed/app
app/cube.0.3.0_v2963.apk, removed/app
app/Music.apk, removed/app
app/Calculator.apk, removed/app
app/CCCCACDE.apk, removed/app
app/com.chaozh.iReaderFree_145459.apk, removed/app
app/cube.apk, removed/app
app/cube.0.3.0_v2963.apk, removed/app
app/cube.0.3.1_v3313.apk, removed/app
app/hd.apk, removed/app
app/Music.apk, removed/app
Expand All @@ -36,6 +36,9 @@ app/shuqi.apk, removed/app
app/SogouAppMall.apk, removed/app
app/yingyonghui.apk, removed/app

app/oupeng, removed/app
app/SohuTV.apk, removed/app
app/sougouinput.apk, removed/app

app/AnZhi20130116.apk, removed/app
app/com.cube.gfan_1032_cube_3965_0.9.7_v3965.apk, removed/app
Expand All @@ -48,6 +51,8 @@ app/tmall_android_release_2.0.2_700414_5869.apk, removed/app
app/UCBrowser_V2.2.2.259.apk, removed/app
app/SohuTV2.8.apk, removed/app

app/aimeituan.apk, removed/app


#these are to be replaces so archive
media/bootanimation.zip, removed/media
Expand Down
5 changes: 5 additions & 0 deletions processcontrol/populateROMkits
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ working/kernel.img,ROMKits/ROMKit.zip,ROM/
working/boot.img,ROMKits/ROMKit.zip,ROM/
working/recovery.img,ROMKits/ROMKit.zip,ROM/
working/system.img,ROMKits/ROMKit.zip,ROM/
working/parameter,ROMKits/ROMKit.zip,ROM/
working/parameter2,ROMKits/ROMKit.zip,ROM/
working/parameter4,ROMKits/ROMKit.zip,ROM/
working/parameter6,ROMKits/ROMKit.zip,ROM/
working/parameter8,ROMKits/ROMKit.zip,ROM/

working/kernel.img,ROMKits/CWMROMKit.zip
working/boot.img,ROMKits/CWMROMKit.zip
Expand Down
Loading

0 comments on commit 4f64c24

Please sign in to comment.