Boot.img Tools Compiled for Arm^7 -- (un)Pack kernels on your phone !!! - Android Software/Hacking General [Developers Only]

About
These two applets ( mkbootimg + unpackbootimg ) are used to pack and unpack any standard android kernel with 4096 / 2048 page size . Most of tools that pack and unpack boot.img files such as Dsixda kitchen , Kernel kitchen or. ... use these applets .
These applets were compiled only for X86 so we could only (un)pack boot.img in Windows or Ubuntu but I compiled and fixed these applets for Arm7 platform on android devices from Android sources. So you may pack and unpack boot.img on any android device !!
Sources are here ( Lisenced under GPL 2.0 lisence ) : My github
How to use
1- First download applets package
2- Unzip it and push two files in it to /system/bin or /system/xbin
3- Set their pemissions to 777 ( rwxrwxrwx )
For unpacking a kernel
* Assuming that you have boot.img in /sdcard
* Open terminal and type : [ this is just an example , you can change it ]
Code:
su
unpackbootimg -i /sdcard/boot.img -o /sdcard/ -p 4096
*You will have extracted boot.img at /sdcard
* Save ouput information that applets gives you at the end . you need them in future
For packing a kernel
* Copy ramdisk.gz , zimage , cmdline , pagesize , base you got from unpacking boot.img into /sdcard
* Open terminal and type :
Code:
su
mkbootimg --cmdline cmdline --kernel zimage --ramdisk ramdisk.gz --base base --pagesize pagesize -o boot.img
* You will have output ( boot.img ) at /sdcard/boot.img
Download
Download build 1 @ Dev-Host
* Initial build
Credits
* Alireza7991 - for fixing , improving and cross-compiling for arm^7
* Andrew Huang ( [email protected]) - for sources
* Android Open Source Project - for sources
This applet is under GPL 2.0
Using this is free but you have to ask me if you want to use this in your tools or ...

Reserved for OP

very cool, :good::good::good:

Awesome thanks for sharing your work !
I'll be back in a flash
A better link would be really cool can't DL it to my nexus for the life of me :banghead:

Rushing said:
Awesome thanks for sharing your work !
I'll be back in a flash
A better link would be really cool can't DL it to my nexus for the life of me :banghead:
Click to expand...
Click to collapse
What problem do you have with download link ?

segmentation fault
Hey
Trying to unpack a samsung kernel, but I get this error
BUILDER: Alireza7991
BOARD_KERNEL_CMDLINE
BOARD_KERNEL_BASE e19f8000
BOARD_PAGE_SIZE 24061976
Segmentation fault
I guess my boot.img is not supported?

biopsin said:
Hey
Trying to unpack a samsung kernel, but I get this error
BUILDER: Alireza7991
BOARD_KERNEL_CMDLINE
BOARD_KERNEL_BASE e19f8000
BOARD_PAGE_SIZE 24061976
Segmentation fault
I guess my boot.img is not supported?
Click to expand...
Click to collapse
I have unpacked Samsung Galaxy S plus kernel successfuly
Only 2048 & 4096 page sizes are supported !
Edit : I have forgot to say Samsung exynose kernel which uses zImage as in SGS 1/2/3 are not supported

alireza7991 said:
For unpacking a kernel
Click to expand...
Click to collapse
For a good understanding of the structure of boot and recovery images can read such here.

So, now that I unpacked my boot.img, next question is:
How can I modify them through the phone also? Does an application that modifies ramdisk.gz / zImage exist?
I can modify my APKs' xmls and smali files and recompile then on my phone, so I'm wondering if I can modify this also on my phone.... Can it be?
Edit: I tried unpacking boot.img-ramdisk.gz via TermEmu:
Code:
lzma -dc ../boot.img-ramdisk.gz | cpio -i
But, as I expected, it failed and says:
Code:
lzma: out of memory
(Yes I'm new at this thing. Still worth trying )
So, any other workarounds to unpack and modify these babies via our phones?

souler456 said:
So, now that I unpacked my boot.img, next question is:
How can I modify them through the phone also? Does an application that modifies ramdisk.gz / zImage exist?
I can modify my APKs' xmls and smali files and recompile then on my phone, so I'm wondering if I can modify this also on my phone.... Can it be?
Edit: I tried unpacking boot.img-ramdisk.gz via TermEmu:
Code:
lzma -dc ../boot.img-ramdisk.gz | cpio -i
But, as I expected, it failed and says:
Code:
lzma: out of memory
(Yes I'm new at this thing. Still worth trying )
So, any other workarounds to unpack and modify these babies via our phones?
Click to expand...
Click to collapse
I'm amazed , how do you unpack APKs on your phone ? I saw sth for packing APKs but I do'nt know how to decompile APKs
ZImage is a static executable of compiled kernel . but ramdisk is an small file system which includes some essential files for booting your phone such as init.rc , and ... . ramdisk has two compressions , cpio and gz . first you have to gunzip it and then uncpio .
I'm working on a ramdisk unpack tool too .

alireza7991 said:
I'm amazed , how do you unpack APKs on your phone ? I saw sth for packing APKs but I do'nt know how to decompile APKs
ZImage is a static executable of compiled kernel . but ramdisk is an small file system which includes some essential files for booting your phone such as init.rc , and ... . ramdisk has two compressions , cpio and gz . first you have to gunzip it and then uncpio .
I'm working on a ramdisk unpack tool too .
Click to expand...
Click to collapse
I use Apktool, but ported to my phone (yes, an Apktool which is an APK) to get my APKs down and dirty. I'm sure it's on XDA, but I forgot where I did get it though...
For the ramdisk to be unpacked, can I use those commands (gunzip) and execute them via TermEmu? Did you tried it yet?
Also, I don't have a single idea of what a zImage is (except the one you just said, which is also kinda noob-shot my head), what's contained about it, and how to modify it for my tastes... Any tutorials you may shed some?
Will wait patiently for the development of your works related with this. It's really great man

souler456 said:
I use Apktool, but ported to my phone (yes, an Apktool which is an APK) to get my APKs down and dirty. I'm sure it's on XDA, but I forgot where I did get it though...
For the ramdisk to be unpacked, can I use those commands (gunzip) and execute them via TermEmu? Did you tried it yet?
Also, I don't have a single idea of what a zImage is (except the one you just said, which is also kinda noob-shot my head), what's contained about it, and how to modify it for my tastes... Any tutorials you may shed some?
Will wait patiently for the development of your works related with this. It's really great man
Click to expand...
Click to collapse
Since some people here don't know there was an apktool for android then I'll just create a thread for it with instructions for noobs

souler456 said:
I use Apktool, but ported to my phone (yes, an Apktool which is an APK) to get my APKs down and dirty. I'm sure it's on XDA, but I forgot where I did get it though...
For the ramdisk to be unpacked, can I use those commands (gunzip) and execute them via TermEmu? Did you tried it yet?
Also, I don't have a single idea of what a zImage is (except the one you just said, which is also kinda noob-shot my head), what's contained about it, and how to modify it for my tastes... Any tutorials you may shed some?
Will wait patiently for the development of your works related with this. It's really great man
Click to expand...
Click to collapse
I found apk tool on android not on xda , on google code .
Zimage can not be modified because it is compiled , also can not be decompiled . so you can not modify it .
when boot process starts , bootloader reads zimage from pre-defined partition and loads it in ram . then it calls cpu to execute zimage . when zimages executes it sets up initial board configurations ( such as regulators , GPIOs and ... ) , drivers and ... . then it opens ramdisk and unpacks ramdisk . when ramdisk opens , init process starts by kernel . it executes init.rc , init.<target>.rc . init.rc sets up initial kernel configurations and any other thing related to android . init.rc executes some initial android binarys such as bootanimation , surface flinger , adb and finally app process . app process turns on java and dalvik enviroments . finally framework and other java classes runs and android appears
Did you understand what is zimage and ramdisk ??

Juhan Jufri said:
Since some people here don't know there was an apktool for android then I'll just create a thread for it with instructions for noobs
Click to expand...
Click to collapse
You don't have to. There's already a thread for it (found it 35mins after I started the topic ) : http://forum.xda-developers.com/showthread.php?t=2388135
It will only be deleted by Mods, so, yeah...
alireza7991 said:
I found apk tool on android not on xda , on google code .
Zimage can not be modified because it is compiled , also can not be decompiled . so you can not modify it .
when boot process starts , bootloader reads zimage from pre-defined partition and loads it in ram . then it calls cpu to execute zimage . when zimages executes it sets up initial board configurations ( such as regulators , GPIOs and ... ) , drivers and ... . then it opens ramdisk and unpacks ramdisk . when ramdisk opens , init process starts by kernel . it executes init.rc , init.<target>.rc . init.rc sets up initial kernel configurations and any other thing related to android . init.rc executes some initial android binarys such as bootanimation , surface flinger , adb and finally app process . app process turns on java and dalvik enviroments . finally framework and other java classes runs and android appears
Did you understand what is zimage and ramdisk ??
Click to expand...
Click to collapse
Yes. Thanks so much!
So the probability of a modifying process can only be done by the ramdisk only? Well...

souler456 said:
You don't have to. There's already a thread for it (found it 35mins after I started the topic ) : http://forum.xda-developers.com/showthread.php?t=2388135
It will only be deleted by Mods, so, yeah...
Yes. Thanks so much!
So the probability of a modifying process can only be done by the ramdisk only? Well...
Click to expand...
Click to collapse
Oh ****, just created it. But with somewhat better instructions for newbies.

alireza7991 said:
I'm amazed , how do you unpack APKs on your phone ? I saw sth for packing APKs but I do'nt know how to decompile APKs
ZImage is a static executable of compiled kernel . but ramdisk is an small file system which includes some essential files for booting your phone such as init.rc , and ... . ramdisk has two compressions , cpio and gz . first you have to gunzip it and then uncpio .
I'm working on a ramdisk unpack tool too .
Click to expand...
Click to collapse
waiting for this unpack tool...
I only make,decompile,theme and mod apks via my phone...
so slicing up the boot.img via phone is a good additiob too.... XD
great work for this...haven't tried it yet...
but will do whenever the unpack tool is also ready... XD

alireza7991 said:
I'm working on a ramdisk unpack tool too .
Click to expand...
Click to collapse
I'm waiting for this .

Captain_Throwback said:
I'm waiting for this .
Click to expand...
Click to collapse
done
Code:
cpio -i < ramdisk.gz

alireza7991 said:
About
These two applets ( mkbootimg + unpackbootimg ) are used to pack and unpack any standard android kernel with 4096 / 2048 page size . Most of tools that pack and unpack boot.img files such as Dsixda kitchen , Kernel kitchen or. ... use these applets .
These applets were compiled only for X86 so we could only (un)pack boot.img in Windows or Ubuntu but I compiled and fixed these applets for Arm7 platform on android devices from Android sources. So you may pack and unpack boot.img on any android device !!
Sources are here ( Lisenced under GPL 2.0 lisence ) : My github
How to use
1- First download applets package
2- Unzip it and push two files in it to /system/bin or /system/xbin
3- Set their pemissions to 777 ( rwxrwxrwx )
For unpacking a kernel
* Assuming that you have boot.img in /sdcard
* Open terminal and type : [ this is just an example , you can change it ]
Code:
su
unpackbootimg -i /sdcard/boot.img -o /sdcard/ -p 4096
*You will have extracted boot.img at /sdcard
* Save ouput information that applets gives you at the end . you need them in future
For packing a kernel
* Copy ramdisk.gz , zimage , cmdline , pagesize , base you got from unpacking boot.img into /sdcard
* Open terminal and type :
Code:
su
mkbootimg --cmdline cmdline --kernel zimage --ramdisk ramdisk.gz --base base --pagesize pagesize -o boot.img
* You will have output ( boot.img ) at /sdcard/boot.img
Download
Download build 1 @ Uploadboy
* Initial build
Credits
* Alireza7991 - for fixing , improving and cross-compiling for arm^7
* Andrew Huang ( [email protected]) - for sources
* Android Open Source Project - for sources
This applet is under GPL 2.0
Using this is free but you have to ask me if you want to use this in your tools or ...
Click to expand...
Click to collapse
Gonna try this soon
Sent from my H100 using xda app-developers app

alireza7991 said:
done
Code:
cpio -i < ramdisk.gz
Click to expand...
Click to collapse
Hmmm. Was this a recent update? I downloaded the tools this morning. I'm getting the below error:
Code:
cpio: unsupported cpio format, use newc or crc

Related

edit boot.img-ramdisk

heres where im at now. im trying to edit the init.rc
i have extracted the boot.img using unpack-bootimg.pl and have got the follwing
empty folder called ramdisk
boot.img-ramdisk.cpio.gz
boot.img-ramdisk.gz
boot.img-kernell.gz
i am now stuck extracting the ramdisk to edit init.rc
i also get error gunzip is not a recognied command
any help??
add.thebad said:
i am trying to edit the init.rc but have problems extracting boot.img-ramdisk.gz
i have made a rom dump
then extracted boot.img
got boot.img-ramdisk.gz so extracted that
and now i have a file called boot.img-ramdisk nothing else
so how can i edit ramdisk?
thanks in advance. any help welcome
Click to expand...
Click to collapse
add.thebad,
Been a while since I've done this, lol, but these are the instructions I followed:
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images
There's links to the Perl scripts in that page too.
Hope this helps.
Cheers!
thanks but the link to the scripts is broke. dont suppose you know where to get another
add.thebad said:
thanks but the link to the scripts is broke. dont suppose you know where to get another
Click to expand...
Click to collapse
Adam (that's right, right? ),
I found an XDA version of the "How To" link I posted above: http://forum.xda-developers.com/showthread.php?t=443994 and the files are at the bottom of the first post and they are still available.
By the way, I used these instructions (along with lots of help from Amon_RA himself) for unpacking and repacking Amon_RA's custom recovery .img file (I built a version that doesn't require the use of a trackball for the Eris).
I think after you unpack the ramdisk, you'll just replace / update your init.rc file and then repack everything before doing the mkbootfs on your ramdisk directory (followed by your particular mkbootimg command).
Good luck!
Cheers!
thanks for you help i have the scripts now and i can get it to extract however i get the error "gunzip is not recognised" and the files it does extract are emply
add.thebad said:
thanks for you help i have the scripts now and i can get it to extract however i get the error "gunzip is not recognised" and the files it does extract are emply
Click to expand...
Click to collapse
Are you on a Linux system?
The gzip / gunzip utilities should be on your system and/or referenced in you PATH environment variable.
Do a find / -name 'gzip' 2> /dev/null or find / -name gunzip 2> /dev/null or whereis gunzip or which gunzip (one of these should reveal the utility's location).
The unpack-bootimg.pl does use the gunzip command to extract the files, so you will need this utility.
Cheers!
after a bit of reading i think the way i have got my boot.img is wrong could this be why the folder is empty?
add.thebad said:
after a bit of reading i think the way i have got my boot.img is wrong could this be why the folder is empty?
Click to expand...
Click to collapse
Not sure... Like I said, I started with a known, good recovery.img file... I never have (yet) played with a boot.img file...
scary alien said:
Not sure... Like I said, I started with a known, good recovery.img file... I never have (yet) played with a boot.img file...
Click to expand...
Click to collapse
i managed to extract a boot.img from an official system image and tried that and got the same result. could i have anything to do with gunzip not being recognised
add.thebad said:
i managed to extract a boot.img from an official system image and tried that and got the same result. could i have anything to do with gunzip not being recognised
Click to expand...
Click to collapse
lol...I think we cross-posted a little bit ago...see above ^^^ for my post about your gunzip utility.
scary alien said:
lol...I think we cross-posted a little bit ago...see above ^^^ for my post about your gunzip utility.
Click to expand...
Click to collapse
haha so we did.
no im on windows and cant get gunzip to work. think i have gzip working tho
any ideas?
add.thebad said:
haha so we did.
no im on windows and cant get gunzip to work. think i have gzip working tho
any ideas?
Click to expand...
Click to collapse
Yeah, you'll have to grab some Windows versions of the Unix commands.
I can't remember where I got mine, but a quick search yielded this as a possible starting place:
http://www.cyberciti.biz/faq/unix-command-line-utilities-for-windows/
There's a couple of links to sets of tools. After you download and install these, make sure you point / change your Windows PATH to point to the utilities or just do all of your work in the same directory.
You really just need the utilities that are referenced in the Perl script... Not sure I'd bother with the whole Cygwin thing (your call, of course).
Cheers!
scary alien said:
Yeah, you'll have to grab some Windows versions of the Unix commands.
I can't remember where I got mine, but a quick search yielded this as a possible starting place:
http://www.cyberciti.biz/faq/unix-command-line-utilities-for-windows/
There's a couple of links to sets of tools. After you download and install these, make sure you point / change your Windows PATH to point to the utilities or just do all of your work in the same directory.
You really just need the utilities that are referenced in the Perl script... Not sure I'd bother with the whole Cygwin thing (your call, of course).
Cheers!
Click to expand...
Click to collapse
Ok will try that. I allready have cygwin to try get the commands i will try ur link tho. Think im getting a bit outa my depth but ive learnt so much so far i dont want to give up so thanks for your help
heres where im at now. im trying to edit the init.rc
i have extracted the boot.img using unpack-bootimg.pl and have got the follwing
empty folder called ramdisk
boot.img-ramdisk.cpio.gz
boot.img-ramdisk.gz
boot.img-kernell.gz
i am now stuck extracting the ramdisk to edit init.rc
i also get error gunzip is not a recognied command
any help??
add.thebad said:
heres where im at now. im trying to edit the init.rc
i have extracted the boot.img using unpack-bootimg.pl and have got the follwing
empty folder called ramdisk
boot.img-ramdisk.cpio.gz
boot.img-ramdisk.gz
boot.img-kernell.gz
i am now stuck extracting the ramdisk to edit init.rc
i also get error gunzip is not a recognied command
any help??
Click to expand...
Click to collapse
Well, I spent some time tonight trying to do this under Windows myself, but I used the split_bootimg.pl Perl script instead to create the *.img-kernel and *.img-ramdisk.gz files (with mixed success). lol, I had a hard time re-finding some good Unix commands that would run under Windows (I've got some good ones on my work PC, but that doesn't help me now).
Here's the relevant section in the original HOWTO link I sent you:
% ./split_bootimg.pl boot.img
Page size: 2048 (0x00000800)
Kernel size: 1388548 (0x00153004)
Ramdisk size: 141518 (0x000228ce)
Second size: 0 (0x00000000)
Board name:
Command line: no_console_suspend=1
Writing boot.img-kernel ... complete.
Writing boot.img-ramdisk.gz ... complete.
Now, extracting the ramdisk under Windows is a little trickier and I couldn't get the whole way there because I couldn't find the cpio command for Windows (you might have it already if you are using Cygwin). Anyway, the documentation explains that you would create a temporary "ramdisk" directory, change to it, use the gzip utility to uncompress and feed the output to the cpio command to actually extract the files and directories:
Extract the ramdisk.
% mkdir ramdisk
% cd ramdisk
% gzip -dc ../boot.img-ramdisk.gz | cpio -i
% cd ..
That should work for you (if you have appropriate utilities) and should give you the various files that comprise the ramdisk for you to modify (i.e., the init.rc).
After modifying them, you would use the mkbootfs utility (not sure if this is actually available in Windows) to re-pack the ramdisk and then use the mkbootimg command to re-pack your boot image.
It might be easier to get a Linux distro installed that you can launch from Windows just to do this.
Good luck!
scary alien said:
It might be easier to get a Linux distro installed that you can launch from Windows just to do this.
Good luck!
Click to expand...
Click to collapse
ahaa managed to get everything extracted and edit the init.rc so thank you for all your help
one the linux side of things i have ubuntu dual boot and use it from time to time im just not familiar with the commands on it so prefer windows. might try it more oftern since it can be a pain finding all the tools for windows
ne way all i need to do now is repackage it which is proving to be a bit of a problem atm.
a sleep less night and ill c how i get on lol
cheers for the help
add.thebad said:
ahaa managed to get everything extracted and edit the init.rc so thank you for all your help
one the linux side of things i have ubuntu dual boot and use it from time to time im just not familiar with the commands on it so prefer windows. might try it more oftern since it can be a pain finding all the tools for windows
ne way all i need to do now is repackage it which is proving to be a bit of a problem atm.
a sleep less night and ill c how i get on lol
cheers for the help
Click to expand...
Click to collapse
Adam,
Glad you are making progress .
Here's the last few bits that I used to re-pack my ramdisk and to rebuild the bootable recovery .img file (i.e., ramdisk + kernel):
# pack-up the ramdisk directory's files to build the new ramdisk .zip
#
mkbootfs ./ramdisk | gzip > ramdisk-new.gz
# now, repack the kernel and ramdisk to make the new recovery image
#
mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel recovery-RA-eris-v1.6.2.img-kernel --ramdisk ramdisk-new.gz --base 0x11200000 -o new-recovery.img
This is very similar to the instructions in the HOWTO thread.
Also, note the --base parameter in the mkbootimg line, this is unique/specific to each phone/bootable image since it appears to be the boot/load address, so you'll have to know or find-out what this particular value is for your situation.
Good luck and let me know how it goes.
Cheers to you, too!
scary alien said:
Adam,
Glad you are making progress .
Here's the last few bits that I used to re-pack my ramdisk and to rebuild the bootable recovery .img file (i.e., ramdisk + kernel):
# pack-up the ramdisk directory's files to build the new ramdisk .zip
#
mkbootfs ./ramdisk | gzip > ramdisk-new.gz
# now, repack the kernel and ramdisk to make the new recovery image
#
mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel recovery-RA-eris-v1.6.2.img-kernel --ramdisk ramdisk-new.gz --base 0x11200000 -o new-recovery.img
This is very similar to the instructions in the HOWTO thread.
Also, note the --base parameter in the mkbootimg line, this is unique/specific to each phone/bootable image since it appears to be the boot/load address, so you'll have to know or find-out what this particular value is for your situation.
Good luck and let me know how it goes.
Cheers to you, too!
Click to expand...
Click to collapse
ok gave up in windows cannot find a command or perl script for mkbootfs so now in ubuntu giving it a try
i can do that first bit fine. does it need to be re cpio?
on the next commannd i type
Code:
mkbootimg --cmdline 'no_console_suspend=1 console=null' --boot.img-kernel.gz --boot.img-ramdisk.gz ----base 0x10000000 -o new-boot.img
and get this
Code:
[email protected]:~/Desktop$ mkbootimg --cmdline 'no_console_suspend=1 console=null' --boot.img-kernel.gz --boot.img-ramdisk.gz ----base 0x10000000 -o new-boot.img
usage: mkbootimg
--kernel <filename>
--ramdisk <filename>
[ --second <2ndbootloader-filename> ]
[ --cmdline <kernel-commandline> ]
[ --board <boardname> ]
[ --base <address> ]
-o|--output <filename>
but nothing is outputted on my desktop
add.thebad said:
ok gave up in windows cannot find a command or perl script for mkbootfs so now in ubuntu giving it a try
Click to expand...
Click to collapse
I believe that the mkbootfs utility is available / created as a result of building / compiling the Android open source.
Like I mentioned before, its been a while since I did all this myself, but I had to download and do the base "make" for the Android open source since I was actually changing and recompiling the custom recovery.
So, you'll need to check-out / download the desired AOSP branch / version from the proper location (which eludes me at the moment). Then, I believe doing the base / generic "make" for the AOSP will create or reveal the mkbootfs utility.
One of the threads in the following forum should have a better, starter explanation for doing the above that I could post here:
http://forum.xda-developers.com/forumdisplay.php?f=613
I'd dig into this more with you tonight, but I gotta do my taxes and then go into work for a few hours tonight (ugh on both counts, lol!).
Good luck!

[Q] how to flash and backup kernel?

I following the instructions found from here:
Building Kernels
and download the kernel from here:
INDEX of ROMS/RECOVERY/ROOT/GUIDES/FIRMWARE/KERNEL/VIDEOS/etc..
I am using TF300TG, so I just followed the link to my tablet kernel source from the thread. I have successfully built the kernel by using the config.gz found in the tablet /proc/config.gz (is great that Asus is providing such info). I also enable a kernel module for my old USB ethernet dongle and able to use it to get online. :victory:
After poking around the kernel configuration, and reading the thread TF300T kernel source repository, I am curious about enabling OC and possible other features. I had downloaded the update.zip from the thread, and trying to understand the whole process of how to flash kernel to the tablet. My idea is to modify the update.zip to make use of it to update my tablet. But before I start doing something serious, I have questions...
I found the following kernel file: kernel.blob in update.zip. Is this the same file as 'zImage' in arch/arm/boot/ after built successful?
The next question is on how to backup my existing kernel? I notice from the update-script, the kernel is flash using the following command:
run_program("/sbin/busybox", "dd", "if=/tmp/kernel.blob", "of=/dev/block/mmcblk0p4");
Click to expand...
Click to collapse
Does this mean, I can run the same command in reverse to keep a copy of my current kernel?
I had done kernel compiling before, but those were in PC/x86 platform. ARM platform seems to be different from what I used to.
I found the following kernel file: kernel.blob in update.zip. Is this the same file as 'zImage' in arch/arm/boot/ after built successful?
Click to expand...
Click to collapse
Not exactly...
A blob file is a sort of archive that can contain several files.
For example, the kernel.blob you mention above contains the actual kernel (zImage) but also a ram disk.
As far as I understand a blob file is the only type of file that can be flashed to different partitions of your TF300T(G) using fastboot method.
To flash using CWM or TWRP you will need to pack blob file(s) into a special kind of zip package.
Below I have shared my script that I use to create a TWRP flashable zip package including a custom built kernel.
Hopefully it may shed some light in the steps required to go from zImage to blob file and TWRP flashable zip package.
The script takes the root path to your kernel source directory as first (and only) argument.
In same directory as script I have unpacked update.zip (from untermensch's kernel repository thread) as parts of this zip file are re-used.
---
#!/bin/sh
KERNEL_HOME=$1
KERNEL_NAME=my_kernel_$$
# Repack new kernel and old ram disk into blob file
cp ${KERNEL_HOME}/arch/arm/boot/zImage boot.blob.lnx-kernel.gz
repack-bootimg.pl boot.blob.lnx-kernel.gz boot.blob.lnx-ramdisk out.blob.lnx
blobpack out.blob LNX out.blob.lnx
# Prepend magic header
cat signblob_magic out.blob > kernel.blob
# Add kernel modules to ensure kernel and modules always match.
# If mismatch e.g WiFi might not work.
find ${KERNEL_HOME} -name "*.ko" -exec cp {} system/lib/modules \;
# Save kernel config in case it needs to be rebuilt some day.
cp ${KERNEL_HOME}/.config kernel_config
# Zip everything
zip -9 -r ${KERNEL_NAME}.zip kernel_config kernel.blob system/ META-INF/
# Sign zip using SignApk
java -Xmx1024m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ${KERNEL_NAME}.zip ${KERNEL_NAME}-signed.zip
---
The next question is on how to backup my existing kernel? I notice from the update-script, the kernel is flash using the following command:
Does this mean, I can run the same command in reverse to keep a copy of my current kernel?
Click to expand...
Click to collapse
In theory this should work but if not mistaken mmcblk0p4 is just a sort of staging partition.
During bootup whatever is in mmcblk0p4 is copied to another partition (mmcblk0p0?).
(I guess this is the blue bar you can observe when flashing custom roms/kernels)
Someone more familiar with the details please correct me.
Instead of trying to backup your current kernel I would suggest to try to get the original
kernel by unpacking the official update packages from ASUS support web page.
I had done kernel compiling before, but those were in PC/x86 platform. ARM platform seems to be different from what I used to.
Click to expand...
Click to collapse
Not that much different really, just need to search the google.com and XDA forums and you shall find answers...
gaze57 said:
Not exactly...
A blob file is a sort of archive that can contain several files.
For example, the kernel.blob you mention above contains the actual kernel (zImage) but also a ram disk.
As far as I understand a blob file is the only type of file that can be flashed to different partitions of your TF300T(G) using fastboot method.
To flash using CWM or TWRP you will need to pack blob file(s) into a special kind of zip package.
Below I have shared my script that I use to create a TWRP flashable zip package including a custom built kernel.
Hopefully it may shed some light in the steps required to go from zImage to blob file and TWRP flashable zip package.
The script takes the root path to your kernel source directory as first (and only) argument.
In same directory as script I have unpacked update.zip (from untermensch's kernel repository thread) as parts of this zip file are re-used.
---
#!/bin/sh
KERNEL_HOME=$1
KERNEL_NAME=my_kernel_$$
# Repack new kernel and old ram disk into blob file
cp ${KERNEL_HOME}/arch/arm/boot/zImage boot.blob.lnx-kernel.gz
repack-bootimg.pl boot.blob.lnx-kernel.gz boot.blob.lnx-ramdisk out.blob.lnx
blobpack out.blob LNX out.blob.lnx
# Prepend magic header
cat signblob_magic out.blob > kernel.blob
# Add kernel modules to ensure kernel and modules always match.
# If mismatch e.g WiFi might not work.
find ${KERNEL_HOME} -name "*.ko" -exec cp {} system/lib/modules \;
# Save kernel config in case it needs to be rebuilt some day.
cp ${KERNEL_HOME}/.config kernel_config
# Zip everything
zip -9 -r ${KERNEL_NAME}.zip kernel_config kernel.blob system/ META-INF/
# Sign zip using SignApk
java -Xmx1024m -jar signapk.jar -w testkey.x509.pem testkey.pk8 ${KERNEL_NAME}.zip ${KERNEL_NAME}-signed.zip
---
In theory this should work but if not mistaken mmcblk0p4 is just a sort of staging partition.
During bootup whatever is in mmcblk0p4 is copied to another partition (mmcblk0p0?).
(I guess this is the blue bar you can observe when flashing custom roms/kernels)
Someone more familiar with the details please correct me.
Instead of trying to backup your current kernel I would suggest to try to get the original
kernel by unpacking the official update packages from ASUS support web page.
Not that much different really, just need to search the google.com and XDA forums and you shall find answers...
Click to expand...
Click to collapse
Whoa... Thanks for the info. I go read up more on this.

[TOOL] Boot.img tools [unpack, repack, ramdisk]

I have not seen this posted anywhere, so I thought I would post it here. This is NOT purely my work, and I do not take credit for it as such.
Included in the attached ZIP are the following files:
boot_info - prints information about the boot.img passed to it, including the base address and ramdisk address. This tool prints out everything needed to repack the boot.img correctly.
split_boot - More commonly known as split_bootimg.pl, this rips apart the boot.img to extract the ramdisk and zImage. It has been modified by me to split the boot.img into a separate folder (specified by the file name of the boot.img passed to it) and to extract the ramdisk into a sub-folder as well (extracts the cpio from the gz and then extracts the actual files from the cpio archive)
unpack_ramdisk - unpacks the given ramdisk file.
Code:
Usage: unpack_ramdisk <ramdiskFile>
repack_ramdisk - repacks the ramdisk from the given directory (found online and modified slightly to take a directory)
Code:
Usage: repack_ramdisk <ramdiskDirectory> [outputFile]
mkbootimg - mkbootimg binary that creates a boot.img file from the given ramdisk and zImage. Updated to a version compiled by me to support the --ramdiskaddr option (ramdisk address) so that even nonstandard boot.img's can be repacked correctly (Use with boot_info for best results).
umkbootimg - included for convenience. Not made by me. Original thread here.
unpack - wrapper script made by me for the umkbootimg binary^ to unpack the boot.img into a separate directory and then unpack the ramdisk into a sub-directory.
Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.
ANYONE is free to use / modify / kang these files as they see fit. No need to ever ask or do anything more than download.
Enjoy.
UPDATE: If you downloaded, please redownload. There was an error with my repack_ramdisk script, but it's fixed now.
Updated tools with a new boot_info script, also added my own mkbootimg binary compiled with the ramdisk address option.
Boot_info now displays the following information:
Commandline
Pagesize
Base address
Ramdisk address.
Which is everything you need to make a functional boot.img, even when the original boot.img is packed with a non-standard mkbootimg (ie, the ramdisk offset is different than the normal offset).
How exactly do we use these files to unpack and repack?
I've tried running the scripts with chmod at 755 but it doesn't work.
I am i missing something?
All the scripts must be in a folder in your path (~/bin for example)
Then it should work, because they call on each other. I keep all of them in my ~/bin folder, but they can be anywhere in your PATH
Sent from my buttered S3
if Android Magic Word not found at offset 0, it fail.
twins.7 said:
if Android Magic Word not found at offset 0, it fail.
Click to expand...
Click to collapse
No, if you use unmkbootimg instead split_boot, it also finds embedded images.
CNexus said:
No, if you use unmkbootimg instead split_boot, it also finds embedded images.
Click to expand...
Click to collapse
OK, it work. But .... sorry to much complain
My boot.img has magic word in offset 2048. so it mean, there is additional header in first 2048 byte.
umkbootimg succesfully extract embedded boot.img, but in repacking, I lost the first 2048 byte, because magic header placed in offset 0.
Actually, what is the additional header for? really asking...
I fail to fastboot flash if the image have no additional header.
And it will fail to verify, if the additional header is wrong. or is it called signed boot.img?
If I change the content of boot.img, I can't flash it to device. It always said verify fail. I though, the additional header has CRC or hash or anything.
If you have spare time and want to help me, I'll post my image
Thanks for this tools
Send from my AMOI N828 using Xda Premium
twins.7 said:
OK, it work. But .... sorry to much complain
My boot.img has magic word in offset 2048. so it mean, there is additional header in first 2048 byte.
umkbootimg succesfully extract embedded boot.img, but in repacking, I lost the first 2048 byte, because magic header placed in offset 0.
Actually, what is the additional header for? really asking...
I fail to fastboot flash if the image have no additional header.
And it will fail to verify, if the additional header is wrong. or is it called signed boot.img?
If I change the content of boot.img, I can't flash it to device. It always said verify fail. I though, the additional header has CRC or hash or anything.
If you have spare time and want to help me, I'll post my image
Click to expand...
Click to collapse
I'm not sure. No tool will work for all devices, and since I've never had a device that has this special packing, it would be best if you asked one of your kernel devs for help unpacking/repacking
CNexus said:
I'm not sure. No tool will work for all devices, and since I've never had a device that has this special packing, it would be best if you asked one of your kernel devs for help unpacking/repacking
Click to expand...
Click to collapse
ok thank's
CNexus said:
I have not seen this posted anywhere, so I thought I would post it here. This is NOT purely my work, and I do not take credit for it as such.
Included in the attached ZIP are the following files:
boot_info - prints information about the boot.img passed to it, including the base address and ramdisk address. This tool prints out everything needed to repack the boot.img correctly.
split_boot - More commonly known as split_bootimg.pl, this rips apart the boot.img to extract the ramdisk and zImage. It has been modified by me to split the boot.img into a separate folder (specified by the file name of the boot.img passed to it) and to extract the ramdisk into a sub-folder as well (extracts the cpio from the gz and then extracts the actual files from the cpio archive)
unpack_ramdisk - unpacks the given ramdisk file.
Code:
Usage: unpack_ramdisk <ramdiskFile>
repack_ramdisk - repacks the ramdisk from the given directory (found online and modified slightly to take a directory)
Code:
Usage: repack_ramdisk <ramdiskDirectory> [outputFile]
mkbootimg - mkbootimg binary that creates a boot.img file from the given ramdisk and zImage. Updated to a version compiled by me to support the --ramdiskaddr option (ramdisk address) so that even nonstandard boot.img's can be repacked correctly (Use with boot_info for best results).
umkbootimg - included for convenience. Not made by me. Original thread here.
unpack - wrapper script made by me for the umkbootimg binary^ to unpack the boot.img into a separate directory and then unpack the ramdisk into a sub-directory.
Note: These tools were made for Linux. They may also work on Cygwin, but I have not personally tested them.
ANYONE is free to use / modify / kang these files as they see fit. No need to ever ask or do anything more than download.
Enjoy.
Click to expand...
Click to collapse
is it possible to make these run on the device?
i have tried
adb root
adb remount
adb push * /sdcard/tmp/
adb push * /system/xbin/
adb push * /system/bin/
adb shell
cd /sdcard/tmp/
for f in $(ls)
do
chmod 755 /system/bin/$f
chmod 775 /system/xbin/$f
done
cd /
rm -r /sdcard/tmp
cd /sdcard/working
split_bootimg.pl boot.img
returns "Permission denied"
hmmmmm???????? what could be the problem????????
ricky310711 said:
is it possible to make these run on the device?
i have tried
adb root
adb remount
adb push * /sdcard/tmp/
adb push * /system/xbin/
adb push * /system/bin/
adb shell
cd /sdcard/tmp/
for f in $(ls)
do
chmod 755 /system/bin/$f
chmod 775 /system/xbin/$f
done
cd /
rm -r /sdcard/tmp
cd /sdcard/working
split_bootimg.pl boot.img
returns "Permission denied"
hmmmmm???????? what could be the problem????????
Click to expand...
Click to collapse
The Perl script should work if you have Perl (compiled for ARM x86) on your device.
The binaries will not work as they are not compiled for ARM. The scripts (at least some of them) should work if you change all instances of "#!/bin/bash" and "#!/usr/bin/env bash" to "#!/system/bin/sh".
CNexus said:
The Perl script should work if you have Perl (compiled for ARM x86) on your device.
The binaries will not work as they are not compiled for ARM. The scripts (at least some of them) should work if you change all instances of "#!/bin/bash" and "#!/usr/bin/env bash" to "#!/system/bin/sh".
Click to expand...
Click to collapse
will see if i can get it working tonight! this could be pretty good if i can get it to unpack on device!
ricky310711 said:
will see if i can get it working tonight! this could be pretty good if i can get it to unpack on device!
Click to expand...
Click to collapse
No need...download this zip and extract http://www12.zippyshare.com/v/37266634/file.html
It already contains an unmkbootimg binary compiled for ARM. Then you would just need to unpack the ramdisk to finish it off.
CNexus said:
No need...download this zip and extract http://www12.zippyshare.com/v/37266634/file.html
It already contains an unmkbootimg binary compiled for ARM. Then you would just need to unpack the ramdisk to finish it off.
Click to expand...
Click to collapse
no way, ive been looking for something like this for ages, who is the author?
ricky310711 said:
no way, ive been looking for something like this for ages, who is the author?
Click to expand...
Click to collapse
I don't know who originally compiled that unmkbootimg binary for ARM.
CNexus said:
I don't know who originally compiled that unmkbootimg binary for ARM.
Click to expand...
Click to collapse
hmm, gotta findout! i wanna use it in my tool!
Is this boot.img tool compatible with Microsoft windows as well?
Sent from my SPH-L710 using XDA Premium 4 mobile app
shakim24 said:
Is this boot.img tool compatible with Microsoft windows as well?
Sent from my SPH-L710 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Read the OP.

Kernel Packaging and Boot.img creation

Okay, so I have created and modified my own kernel name BionicSheep and have done couple releases (check my signature for link). My main question is how do I create a flashable zip with a boot.img I have asked a few people and they told me to use the kernel kitchen or google, but this is the only problem I haven't been able to solve after googling daily for the past 4 days. I figured I would ask here.
The reason I would like a boot.img is because I know in order to modify the kernelsplash with my own logo, I need to be able to unpack the bootimage to get the ramdisk and modify an rle file. The problem is I have no idea how to first make this bootimage. I understand to make the bootimage you need a the zImage (kernel binary) and the ramdisk. I have the zImage but I don't know how to make/get a ramdisk.
Currently I have been using this described method of packing my kernel into a flashable zip. I am pretty sure it just packs my modules and zImage into koush's AnyKernel. Thanks for any help, I need it.
Also try my kernel out and leave feedback if you are so inclined! It really is appreciated
In linux:
http://forum.xda-developers.com/showthread.php?t=1477845
In windows:
http://technopyrate.blogspot.pt/2013/04/how-to-edit-android-bootimg-in-windows.html
zamcum said:
In linux:
http://forum.xda-developers.com/showthread.php?t=1477845
In windows:
http://technopyrate.blogspot.pt/2013/04/how-to-edit-android-bootimg-in-windows.html
Click to expand...
Click to collapse
This is helpful for unpacking modifying and repacking, but I dont have a boot.img to unpack. Like I said, all I have is a zImage, i have no clue how to get a ramdisk. Can I just use one from another kernel or will that cause conflicts? Thanks for the help
aeppacher said:
This is helpful for unpacking modifying and repacking, but I dont have a boot.img to unpack. Like I said, all I have is a zImage, i have no clue how to get a ramdisk. Can I just use one from another kernel or will that cause conflicts? Thanks for the help
Click to expand...
Click to collapse
You can have it, in a stock rom:
Download a stock rom for your phone, open .tar.md5 file with winrar, extract boot.img and unpack it.
Inside you have, ramdisdk and zimage, with another name (boot.img-kernel)
rename your zimage, to boot.img-kernel, edit ramdisk if you want
repalce original boot.img-kernel with yours
and repack
Rename boot-new.img to boot.img
Enjoy
EDIT: To make a flashable Odin file, in Linux:
tar -H ustar -c boot.img > YOURKERNEL.tar
md5sum -t YOURKERNEL.tar >> YOURKERNEL.tar
mv YOURKERNEL.tar YOURKERNEL.tar.md5
That's not necessary. You can make it so that your zImage replaces the zImage inside the boot.img and the initlogo.rle at the same time.
CNexus said:
That's not necessary. You can make it so that your zImage replaces the zImage inside the boot.img and the initlogo.rle at the same time.
Click to expand...
Click to collapse
Which step is not necessary? My biggest problem here was I didn't know i could take any old boot.img to make mine
zamcum said:
You can have it, in a stock rom:
Download a stock rom for your phone, open .tar.md5 file with winrar, extract boot.img and unpack it.
Inside you have, ramdisdk and zimage, with another name (boot.img-kernel)
rename your zimage, to boot.img-kernel, edit ramdisk if you want
repalce original boot.img-kernel with yours
and repack
Rename boot-new.img to boot.img
Enjoy
EDIT: To make a flashable Odin file, in Linux:
tar -H ustar -c boot.img > YOURKERNEL.tar
md5sum -t YOURKERNEL.tar >> YOURKERNEL.tar
mv YOURKERNEL.tar YOURKERNEL.tar.md5
Click to expand...
Click to collapse
hahaha so I think that worked, I have a bootimage with my kernel!! hurrah, now how do I turn it into a flashable zip? Last question I promise
aeppacher said:
hahaha so I think that worked, I have a bootimage with my kernel!! hurrah, now how do I turn it into a flashable zip? Last question I promise
Click to expand...
Click to collapse
the easiest way, is to download a custom kernel for your phone, open the zip with winrar and replace the bott.img by your boot.img
It is important that the exact custom kernel of your phone, so that, there are no incompatibilities in the installation script
zamcum said:
the easiest way, is to download a custom kernel for your phone, open the zip with winrar and replace the bott.img by your boot.img
It is important that the exact custom kernel of your phone, so that, there are no incompatibilities in the installation script
Click to expand...
Click to collapse
Hmmm, I tried this and it didn't boot. :/ then I booted to recovery restarted, and then it booted with my boot splash (yay) went to apps updating and then just got stuck at starting apps. I couldn't get it to fully boot :/
Any ideas whats up
EDIT: I can't thank you since I only get 8 per day, sorry I do appreciate it though
aeppacher said:
Hmmm, I tried this and it didn't boot. :/ then I booted to recovery restarted, and then it booted with my boot splash (yay) went to apps updating and then just got stuck at starting apps. I couldn't get it to fully boot :/
Any ideas whats up
EDIT: I can't thank you since I only get 8 per day, sorry I do appreciate it though
Click to expand...
Click to collapse
If your kernel does not boot, is because it has a problem. It is normal to happen in the first kernel.
The process I use, is what is above. Sorry, II can not help more.
Do not worry about the gratefulness. The important thing is to help
I have a question along the same lines as this thread and I've read all over the place and can't find anything. How do you open a boot.img file to be able to replace the zimage
---------- Post added at 09:21 AM ---------- Previous post was at 08:45 AM ----------
I have a question along the same lines as this thread and I've read all over the place and can't find anything. How do you open a boot.img file to be able to replace the zimage
EDIT: i fixed this
Problem solved, figured I would post a solution:
here are the tools: https://dl.dropboxusercontent.com/u/106865720/bootimg_tools.zip
extract them into any old folder. You also need to have perl installed (just google it)
1. You need to take your built boot.img (from a rom running your kernel successfully) and drag it into the folder.
2. Open up terminal and navigate to the directory with the tools and boot.img
3. First you need to split the boot image into its 2 parts (the ramdisk and the kernel zImage)
Code:
perl split_bootimg.pl boot.img
The "boot.img" part is just the name of your boot.img (I am assuming yours is called boot.img but you can change it as needed)
4. Okay what should have happened is the boot.img should have split into a 'boot.img-ramdisk.gz' and a 'boot.img-kernel' file. The first is a specially compressed ramdisk and the second is the zImage for the kernel
5. Now you need to unpack the ramdisk so that you can modify it. BE CAREFUL AND MODIFY ONLY IF NEEDED Use this code:
Code:
perl unpack_ramdisk boot.img-ramdisk.gz ramdisk
the "boot-img-ramdisk.gz" is the name of the ramdisk, you can change this as needed but it should be named that by default
6.Okay so what should have happened is a folder ramdisk was created (this is the unpacked ramdisk which you need).
7.Okay go back to your directory and delete your boot.img, boot.img-kernel and boot.img-ramdisk.gz files (you no longer need them)
8. Now you need to repack the ramdisk folder you modified so you can rebuild the boot.img use the following:
Code:
perl repack_ramdisk ramdisk boot.img-ramdisk.cpio.gz
9. This will take the 'ramdisk' folder and pack it and name it 'boot.img-ramdisk.cpio.gz'
11. Find your built zImage for your compiled kernel and copy it into this folder with the tools. Rename it as "boot.img-kernel"
10. Sweet now you need to pack the new ramdisk file and your kernel you just stuck in into a new boot.img (this part took me forever to figure out)
11. Here is the code to rebuild
Code:
mkbootimg --kernel boot.img-kernel --ramdisk boot.img-ramdisk.cpio.gz --cmdline 'console=null androidboot.hardware=qcom user_debug=31 zcache' --base 0x80200000 --pagesize 2048 --ramdiskaddr 0x81500000 -o boot.img
12. This should create a file named boot.img in the directory that will have your kernel and modified ramdisk (whoo)
Any further help can be directed to this thread or PMing me!
aeppacher said:
11. Here is the code to rebuild
Code:
mkbootimg --kernel boot.img-kernel --ramdisk boot.img-ramdisk.cpio.gz --cmdline 'console=null androidboot.hardware=qcom user_debug=31 zcache' --base 0x80200000 --pagesize 2048 --ramdiskaddr 0x81500000 -o boot.img
Any further help can be directed to this thread or PMing me!
Click to expand...
Click to collapse
While executing above code I am getting : -bash: mkbootimg: command not found. Whether the mkbootimg file is exist there,
could you please help
mukulsoni said:
While executing above code I am getting : -bash: mkbootimg: command not found. Whether the mkbootimg file is exist there,
could you please help
Click to expand...
Click to collapse
Are you doing this is the same directory as the mkbootimg file? Otherwise you have to path it
aeppacher said:
Are you doing this is the same directory as the mkbootimg file? Otherwise you have to path it
Click to expand...
Click to collapse
Yes I am doing in same path. Its unpacking correctly, but showing error while packing the boot
Hmmm perhaps a bad download?
aeppacher said:
Hmmm perhaps a bad download?
Click to expand...
Click to collapse
but unpacking is fine, My downloaded zip file is in 66.4 Kb size. any way could you please try to compile the attached HP.zip into boot.img in your system. TIA
Edit: sorry downloaded file size is 290kb. please send me the final compiled boot.img file. Thanks so much
mukulsoni said:
but unpacking is fine, My downloaded zip file is in 66.4 Kb size. any way could you please try to compile the attached HP.zip into boot.img in your system. TIA
Edit: sorry downloaded file size is 290kb. please send me the final compiled boot.img file. Thanks so much
Click to expand...
Click to collapse
What version of linux are you running? Ubuntu? what version number, and is it 32-bit or 64-bit
EDIT: try install 32bit packages "sudo apt-get install ia32-libs"
aeppacher said:
What version of linux are you running? Ubuntu? what version number, and is it 32-bit or 64-bit
EDIT: try install 32bit packages "sudo apt-get install ia32-libs"
Click to expand...
Click to collapse
I am running these scripts on window7 using Cygwin64. I guess these script should run on window 7 64 bit too.... please guide
mukulsoni said:
I am running these scripts on window7 using Cygwin64. I guess these script should run on window 7 64 bit too.... please guide
Click to expand...
Click to collapse
I have no clue how to fix that. Mkbootimg is for 32 bit instruction so you need the appropriate libraries. No clue how to do that in windows

[Q] Editing livesuit image (new Android kernel - cubieboard)

Hello everyone,
I read all the topics related but, unfortunately, it did not solve my problem.
I have a cubieboard (allwinner A10) and a screen that doesn't have HDMI input, instead it has DVI input. Therefore, I use a hdmi>dvi connector and i lose all the EDID, and Android doesn't show up (note: if i a specify some resolution in script0.bin, Android shows up in small resolution).
I have to specify the resolution in the firmware, but unfortunately the kernel distributed by Cubieboard is 3.0.52 and doesn't contain mine (1280x1024). Therefore, I have to build my own Android firmware with a recent kernel... and i fail every time, for months. (note: with gnu/linux i don't have any issue, i juste have to specify the resolution in kernel arguments on a txt file.. because the kernel is ulterior).
Please look at my method hereunder and tell me if you see some problems. Thanks in advance.
***
After lots of searches, i think that unpacking and repacking an existing livesuit image is the "easiest" way to upgrade the android kernel.
PHASE 1 : unpacking a stock livesuit android image
I use the "imgRePacker" utility (forum.xda-evelopers.com/showthread.php?t=1753473) and I unpack the "tvbox_2.2_8188eu.img" image from cubieoard.org. Now i have to change the files boot.fex and boot.fex.iso before repacking this livesuit image. Boot.fex and boot.fex.iso are the same file and are the "boot.img" containing bootheader, kernel and ramdisk (innovantesindia.com/wordpress/2011/04/18/bootimage-and-recovery-image-unveiled/).
I copy one of these two files and use the "split_bootimg.pl" to unpack it. I get kernel and ramdisk ; so i juste have to replace the old kernel by the new and execute "mkbootimg".
PHASE 2 : building a recent kernel
As the commit who interests me is your, i download a kernel containing it : the "sunxi-v3.0.76-r0" (github.com/jwrdegoede/linux-sunxi/releases/tag/sunxi-v3.0.76-r0). I unzip it and modify the sun4i_defconfig file to put maximum in the kernel and not in modules (because i'll send the modules later via adb, so maximum of things have to be in kernel). I modify the kernel cmdline by "console=ttyS0,115200 rw init=/init loglevel=5".
Then i execute
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun4i_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j5 uImage modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install
FINAL PHASE : repacking with new kernel
The gzipped kernel is zImage in arch/arm/boot. I copy this file in the phase 1 directory and i execute
tools/mkbootimg --base 0x40000000 --kernel zImage --ramdisk boot.img-kernelramdisk.gz --cmdline 'console=ttyS0,115200 rw init=/init loglevel=5' -o new-recovery.img
Now i copy thenew-recovery.img file and put it in the imgRePacker folder instead of boot.fex and boot.fex.iso. I repack the image and flash it in the cubieboard and ... The cubieboard has its red the green led on but doesn't boot more .. I can't communicate with it via adb because it's not even recognized by windows (because it isn't booted).....
***
Please ! Can you help me ? Do you see any problem in my method ?
Thanks in advance.
up

Categories

Resources