Yo he conseguido unas herramientas sirven tanto para desempaquetar como para empaquetar basadas en AFPTool para RK29xx (Lo he probado con el update.img de BQ Pascal 2 y me lo ha desempaquetado). Las herramientas las he conseguido a través de Wendal:
wendal-teclast_tools-374c2a8.zip
https://docs.google.com/file/d/0B8hU...TQ1/edit?pli=1
la fuente desde donde creo que lo encontré:
http://www.slatedroid.com/topic/1980...magetools-v21
Dentro del script "rk29xx_rom_tools.lua" (hecho en lua) hay una función que se llama packROM:
function packROM()
local SYSTEM_DIR = io.open('system/build.prop','r')
if SYSTEM_DIR then
SYSTEM_DIR:close()
--os.execute('chmod -R 777 system/*')
print('Packing system folder to system.img,overwrite to Temp\\Image\\system.img')
os.execute('mkcramfs -q system Temp/Image/system.img') <---------------------------------Ojo, nosotros tenemos Ext3/4
end
print('Packing files in Temp folder to update_new.img')
os.execute('Afptool -pack ./Temp update_new.img')
print('Get loader\'s and update_new.img\'s file len')
local L_P = 0x66 -- Loader's offset
local loader_file = io.open('RK29xxLoader(L).bin','rb+')
local L_L = loader_file:seek('end')
loader_file:seek('set',0) -- back to start of file
U_P = L_P + L_L -- update.img's offset, following loader
local update_file = io.open('update_new.img','rb+')
local U_L = update_file:seek('end')
update_file:seek('set',0) -- back to start of file
local T_File = io.open('wendal.img', 'rb+') -- open pre-packed image
local DestF = io.open('wendal_new.img', 'wb+') --open target file
local data = T_File:read(25)
DestF:write(data)
writeHex(DestF,L_P)
writeHex(DestF,L_L)
writeHex(DestF,U_P)
writeHex(DestF,U_L)
T_File:read(16) -- sjip 16 bytes , data is Unkown!!
data = T_File:read(102 - 25 - 16)
DestF:write(data)
DestF:flush()
T_File:close()
print('Start writing loader')
while L_L > 0 do
if L_L > BUFF then
data = loader_file:read(BUFF)
L_L = L_L - BUFF
else
data = loader_file:read(L_L)
L_L = 0
end
DestF:write(data)
end
print('Start writing update.img')
while U_L > 0 do
if U_L > BUFF then
data = update_file:read(BUFF)
U_L = U_L - BUFF
else
data = update_file:read(U_L)
U_L = 0
end
DestF:write(data)
end
DestF:flush()
DestF:close()
print('calculate MD5')
os.execute('md5sums.exe -u wendal_new.img > md5.txt')
local M_File = io.open('md5.txt','r')
local md5 = M_File:read(32)
M_File:close()
print('MD5='..md5)
print('Write MD5 into wendal_new.img')
DestF = io.open('wendal_new.img', 'ab+') --open target file
DestF:seek('end')
DestF:write(md5)
DestF:flush()
DestF:close()
print('Pack completa!! Target file --> wendal_new.img')
end