Unpack and repack our kernels

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
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.
 

Kiiv

Member
Jun 13, 2012
118
12
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" ? ^^
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
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:

Kiiv

Member
Jun 13, 2012
118
12
I just followed the instructions in this link (BTW you must cygwin setup for android developing just follow the instructions as if you were setting up the android kitchen [xda] ):
Free Your Android - Extracting, Editing and Re-Packing boot.img in Windows

FYI I haven't tested my boot.img, so I don't know if it works.
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...

I just edited the adb setting on a script. I left thecrst intact then I compiled. Well, like I said before "I haven't tested it."
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.

vampirefo said:
your boot.img wont boot on a telechips, you pagesize is wrong.

These are your boot.img settings.
BOARD_KERNEL_CMDLINE console=ttyTCC,115200n8
BOARD_KERNEL_BASE 40000000
BOARD_PAGE_SIZE 2048

to make a bootable boot.img

you would want this.

BOARD_KERNEL_CMDLINE console=ttyTCC,115200n8
BOARD_KERNEL_BASE 40000000
BOARD_PAGE_SIZE 8192
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:

Kiiv

Member
Jun 13, 2012
118
12
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...
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
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.
 

Kiiv

Member
Jun 13, 2012
118
12
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
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
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:

Kiiv

Member
Jun 13, 2012
118
12
boot8192.img
BOARD_KERNEL_CMDLINE console=ttyTCC,115200n8
BOARD_KERNEL_BASE 10000000
BOARD_PAGE_SIZE 8192

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:

Kiiv

Member
Jun 13, 2012
118
12
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.
 

essjayar

Member
Dec 17, 2011
18
3
Did you manage to make a custom kernel... for which device?

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

Kiiv

Member
Jun 13, 2012
118
12
No :(
For a custom kernel we need sources. And unpacking them from boot.img drives me nowhere in porting a ROM at this time...
 

Kiiv

Member
Jun 13, 2012
118
12
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 !
 
Top