Unpack and repack our kernels

Discussion in 'Coby Generation 2 Development' started by Kiiv, Jul 15, 2012.

  1. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Last edited: Sep 4, 2012
  2. vampirefo.

    vampirefo. Senior Member Developer

    Joined:
    Nov 8, 2011
    Messages:
    3,828
    Likes Received:
    1,389
    Trophy Points:
    655
    Location:
    Huntington WV
    Tablet / Device:
    Leagoo Lead 1 ZTE OPEN C, Coby 7065, Coby 8042, Coby 9740
    No ideal how to do in windows, in Linux you would compile the mkbootimg from telechips source, adjust to what Page size: 8192 0r 4096 depending on kernel, add command line you need.
     
  3. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Hi !

    Thanks for your answer ! Can you help me a little more with that ?
    Where can I find the mkbootimg sources ?
    I've found that :
    https://www.telechips.com/technical_support/kor/opensource/opensource_list.asp#none
    But I don't know if it contains the mkbootimg sources and if they are up to date (last update on 04/04/2012 on 2.6.28 kernel...).
    I've found that too :
    Index of /telechips/tccutils/src/mkbootimg
    But I don't really know what it is and where does it come from ^^

    The next question will probably be "how can I know the page size I have to set between 8192 and 4096" ? ^^
     
  4. vampirefo.

    vampirefo. Senior Member Developer

    Joined:
    Nov 8, 2011
    Messages:
    3,828
    Likes Received:
    1,389
    Trophy Points:
    655
    Location:
    Huntington WV
    Tablet / Device:
    Leagoo Lead 1 ZTE OPEN C, Coby 7065, Coby 8042, Coby 9740
    The second link is correct, make two folders place two files in each folder. Compile as is in one folder in other folder replace the 4096 with 8192. Compile it, Now you have both. You get command line and pagesize from the boot.img you unpack.
     
    Last edited: Jul 16, 2012
  5. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Yeah, I already try this and it doesn't work, as vampirefo said.
    .
    I'm currently trying to compile a mkbootimg from the above sources but I failed. I think I've correctly install openssl sources but I always run int his error :

    mkbootimg.c:(.text+0x7d4): undefined reference to `SHA1_Init'
    mkbootimg.c:(.text+0x7f5): undefined reference to `SHA1_Update'
    mkbootimg.c:(.text+0x817): undefined reference to `SHA1_Update'
    mkbootimg.c:(.text+0x838): undefined reference to `SHA1_Update'
    mkbootimg.c:(.text+0x85a): undefined reference to `SHA1_Update'
    mkbootimg.c:(.text+0x87b): undefined reference to `SHA1_Update'


    Damn, it's been a long time since I've touch a C file... All this .h files drive me crazy ^^

    I've been able to extract the kernel and ramdisk manually with a hex editor but I really need a custom mkbootimg...

    Yes, but it's the repacking process which is the problem. I have tried to unpack and repack without modification and it doesn't work either.

    Can you tell me how did you extract this settings from the boot.img ?

    EDIT : ok, got a brand new mkbootimg and mkbootfs from Android sources !
     
    Last edited: Jul 18, 2012
  6. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Ok, so :
    - I've compiled one standard mkbootimg and one with 8192 page size support
    - I've manuallyunpacked kernel and ramdisk from original boot.img
    - I've repack one boot.img with page size 4096 and one with page size 8192

    Results :
    - with 4096 : the tablet doesn' start at all, it runs directly in fastboot mode...
    - with 8192 : the tablet doesn't pass the bootloader, I'm stuck on coby (or mp man for me as it's not an official coby tablet) logo but I think it's better than booting directly in fastboot mode ^^

    What I'm wondering is why my final boot.img is not of the same size as my initial boot.img...
    The first one is about 10mb and mine is about 6.4mb... The difference seems to come from the ramdisk as the original is about 5,3mb while mine is about 1,7mb... But they contain the same files...
     
  7. vampirefo.

    vampirefo. Senior Member Developer

    Joined:
    Nov 8, 2011
    Messages:
    3,828
    Likes Received:
    1,389
    Trophy Points:
    655
    Location:
    Huntington WV
    Tablet / Device:
    Leagoo Lead 1 ZTE OPEN C, Coby 7065, Coby 8042, Coby 9740
    I am at work, so can't unpack your boot.img. upload a working boot.img and the boot.img you want to swap kernels with.
    As far as size the one you build will always be smaller, then the one pulled from phone. The one on phone isn't compressed, the one you build is.
     
  8. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    First thing first, I want to unpack and repack the same boot.img to understand the process.

    On the following link you can find what I did today :
    - boot.img is the original file
    - boot4096.img is the 4096 page size try
    - boot8192 is the 8192 page size try...

    4shared folder - bootimg
     
  9. vampirefo.

    vampirefo. Senior Member Developer

    Joined:
    Nov 8, 2011
    Messages:
    3,828
    Likes Received:
    1,389
    Trophy Points:
    655
    Location:
    Huntington WV
    Tablet / Device:
    Leagoo Lead 1 ZTE OPEN C, Coby 7065, Coby 8042, Coby 9740
    Ok I upacked the boot images looking at first one you can see why your boot images wont boot they must match first one.

    boot.img
    BOARD_KERNEL_CMDLINE console=ttyTCC,115200n8
    BOARD_KERNEL_BASE 40000000
    BOARD_PAGE_SIZE 8192

    boot4096.img
    BOARD_KERNEL_CMDLINE no_console_suspend=1 console=null
    BOARD_KERNEL_BASE 10000000
    BOARD_PAGE_SIZE 4096

    boot8192.img
    BOARD_KERNEL_CMDLINE console=ttyTCC,115200n8
    BOARD_KERNEL_BASE 10000000
    BOARD_PAGE_SIZE 8192

    Here is one I compiled for you.
    http://www.mediafire.com/?93w1szow3iu1r52

    boot_new.img
    BOARD_KERNEL_CMDLINE console=ttyTCC,115200n8
    BOARD_KERNEL_BASE 40000000
    BOARD_PAGE_SIZE 8192
     
    Last edited: Jul 18, 2012
  10. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Hey!

    Thanks so much you for your help with that !
    But how did you extract this information from a boot.img ? It should help me with the next step ^^

    EDIT : damn, yours is working :(
    what command did you use to repack it ?
    Mine is :
    mkbootimg --cmdline 'console=ttyTCC,115200n8' --pagesize 8192 --base 0x040000000 --kernel mykernel --ramdisk myramdisk.cpio.gz -o myboot.img
     
    Last edited: Jul 19, 2012
  11. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Just to finish the thread :

    I've succeed in unpacking and repacking the boot.img.
    Command line was fine but the binary mkbootimg seems wrong.

    I've finally downloaded all Android sources (from CM9 git) and I've build the latest otatools and it works.
     
  12. essjayar

    essjayar Member

    Joined:
    Dec 17, 2011
    Messages:
    18
    Likes Received:
    3
    Trophy Points:
    62
    Location:
    Wales
    Tablet / Device:
    Zenithink Zt-280 Z102 & Samsung Galaxy S2 (and older phones)
    Did you manage to make a custom kernel... for which device?

    That FreeYourAndroid site is very interesting too - thanks for the info.
     
  13. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    No :(
    For a custom kernel we need sources. And unpacking them from boot.img drives me nowhere in porting a ROM at this time...
     
  14. Kiiv

    Kiiv Member

    Joined:
    Jun 13, 2012
    Messages:
    118
    Likes Received:
    12
    Trophy Points:
    87
    Some news about that...

    I've looked a little bit more at sources on telechip site. They contain support for tcc8803 chipset so I've started to try to build a kernel from them.
    At this time, I'm just trying to build a working kernel. Tweaks will come later if the first step succeed one day...

    I've begun with 2.6.35 sources and I'm trying to make it works with stock android 2.3 ROM. I've succeed in compiling the kernel. I've extracted the defconfig file from my device but I had to change a little thing to make the kernel compile (something about I2C support).
    I've rebuild a boot.img with my new zImage but I can't get it to boot... I have no message or adb connection at boot time, just nothing happens...

    I don't know if the problem come from an option I forget in kernel configuration or something else... I have no idea at all for the moment... If someone do, he's welcome !
     
  15. mixone

    mixone Member

    Joined:
    Mar 9, 2012
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    72
    Hi,
    you can unpak .img file?
     

Share This Page

Search tags for this page
android kernel repack
,
android kernel repacker
,
ext 4 repack
,
extract kernel android
,

how to extract and repack img file

,
how to extract kernel from android rom
,
how to extract kernel from custom rom
,
how to extract kernel from rom
,
how to repack kernel android
,
linux unpack zimage
,
mkbootimg rockchip binary xda
,
repack boot swap android
,
repack kernel android
,
unpack kernel image
,
unpack kernel img
,
unpack kernel img android
,

unpack linux kernel

,
unpack repack kernel android
,
unpack zimage
,

zimage unpack windows