Guide to Mediatek Building(Guide 2:=boot.img)
A common misconception on XDA is that mediatek devices have boot.img similar to qualcomm.. I'll try to explain why it isn't and how to make one.
Mediatek appends a header to its Ramdisk(initramfs) and its kernel so that the board can figure out that its a ramdisk/kernel. Without these headers the boot.img you build will won't work; If you've been getting bad results when making a boot.img this could be one of the reasons
Requisite
Any Linux based system
the mkimage i've attached in the post
Adding the MediaTek header
A executable named the 'mkimage' is needed for this(attached in post). If you're one of the kernel devs or for the ones who have the mediatek kernel source, this file is present in the kernel_source/mediatek/build/tools/mkimage.
What does it do?
it appends the mediatek header to the first 512 bytes of your ramdisk/kernel
Adding the meditek header
For the kernel,
Code:
mkimage kernel KERNEL > kernel_with_meditek_header
For the ramdisk,
Code:
mkbootfs ./root/ | minigzip >ramdisk.gz
mkimage ramdisk.gz ROOTFS > ramdisk.img
Removing the MediaTek header
If you want to remove header from kernel,
Code:
dd if=kernel of=kernel_without_header bs=1 skip=512
If you want to remove header from ramdisk
Code:
dd if=ramdisk of=ramdisk_without_header bs=1 skip=512
the bs tells dd how many bytes to read and write at a time.
the skip tells it that how many bytes to skip at start. here its 512 since the mediatek header occupies 512bytes. we can use count if you want
Here's how you manually pack boot.img after adding headers
Code:
mkbootimg --kernel zImage_with_header --ramdisk ramdisk_with_header.img -o new_boot.img
You can now use this boot.img to flash to your phone
Modules!!
Modules are very important, Read previous guide(Building kernel) about how to build modules(Guide attached to signature). Modules are very kernel specific and the rom wont boot if you don't push these modules to the /system/lib/modules replacing the ones currently there.
Extra Information!
to delete parts of file from the end of file which is 100 bytes. for example:
Code:
dd if=file of=file1 bs=1 skip=10 count=85
/*count=filesize-startsskip-endskip*/
here,count=100-10-5=85.
Hope this guide helped you.
All questions are welcome in the thread
Regards and Good luck
Links to my next Guides
Building the ROM{MediaTek}
Building the Kernel{MediaTek}
Nice guide
... but that was already explained on this thread
The thread was for the MT6577, but concerning this issue (and others) its also valid for the other's MT65xx ; MT81xx ; MT83xx SoC's.
Also this thread is the best resource on @xda concerning Mediatek kernel / issues , etc.
But this should help, the users that are new on the "Mediatek" Platform.
Regards
superdragonpt said:
Nice guide
... but that was already explained on this thread
The thread was for the MT6577, but concerning this issue (and others) its also valid for the other's MT65xx ; MT81xx ; MT83xx SoC's.
Also this thread is the best resource on @xda concerning Mediatek kernel / issues , etc.
But this should help, the users that are new on the "Mediatek" Platform.
Regards
Click to expand...
Click to collapse
I'm making a guide for building an rom from source step by step for the new developers. I've started off with the boot.img. Not sure if that's the way to go, but I'll try my best to make people understand the build process and how mediatek works
Sent from my Moto G using XDA Free mobile app
MasterAwesome said:
I'm making a guide for building an rom from source step by step for the new developers. I've started off with the boot.img. Not sure if that's the way to go, but I'll try my best to make people understand the build process and how mediatek works
Sent from my Moto G using XDA Free mobile app
Click to expand...
Click to collapse
Your more than welcome we are only an few working with Mediatek's.
We all know how MTK works, and their Closed Source / Anti-GPL Atittude...
Best Regards
superdragonpt said:
Your more than welcome we are only an few working with Mediatek's.
We all know how MTK works, and their Closed Source / Anti-GPL Atittude...
Best Regards
Click to expand...
Click to collapse
My aim is to increase that number
Sent from my Moto G using XDA Free mobile app
W0W its good to see more Devs started to work for MTK devices ^_^ nice guide
EnerJon said:
W0W its good to see more Devs started to work for MTK devices ^_^ nice guide
Click to expand...
Click to collapse
You're quite welcome :laugh:
Kernel Development guide coming today
MasterAwesome said:
Kernel Development guide coming today
Click to expand...
Click to collapse
i am kind of porter and developer of a110 aka micromax canvas 2 community.....
i would love to learn about making kernal and mediatek code....
waiting for it.....
thanks in advance..:laugh:
Avenger4droid said:
i am kind of porter and developer of a110 aka micromax canvas 2 community.....
i would love to learn about making kernal and mediatek code....
waiting for it.....
thanks in advance..:laugh:
Click to expand...
Click to collapse
I've added the links to my signature. Be sure to check it out
MasterAwesome said:
I've added the links to my signature. Be sure to check it out
Click to expand...
Click to collapse
thank you...Checking....
Suggestions for new guides are welcome and I'll try my best to do them.
Sent from my Moto G using XDA Free mobile app
Nice tutorial but still not clear for me. So i have built zImage, and then what? I need to use mkimage on zImage I have to produce boot.img, then push boot.img to my device?
giaur said:
Nice tutorial but still not clear for me. So i have built zImage, and then what? I need to use mkimage on zImage I have to produce boot.img, then push boot.img to my device?
Click to expand...
Click to collapse
yes you apply mkimage on the zImage and ramdisk The we mkbootimg for converting it into a boot.img and then you push to device.
MasterAwesome
Sent from my Moto G
Should I add mediatek headers to zImage and ramdisk and then pack them into boot.img?
giaur said:
Should I add mediatek headers to zImage and ramdisk and then pack them into boot.img?
Click to expand...
Click to collapse
Yes use
Code:
mkbootimg - -kernel zImage - -ramdisk ramdisk.img -o boot.img
Sent from my Moto G
Thanks, I think now it's clear. I think it would be useful for newbies if you also add this to first post. Also - don't I need any modules (.ko) also to push to device?
giaur said:
Thanks, I think now it's clear. I think it would be useful for newbies if you also add this to first post. Also - don't I need any modules (.ko) also to push to device?
Click to expand...
Click to collapse
Yes, you need to push the modules to your phones since they are kernel specific. To reduce size strip them off of unneeded assembler messages.
Regards
MasterAwesome
Sent from my Moto G
More information about pushing boot.img to phone and important stuff added to first post
Regards
MasterAwesome
WOW! good guide, I only have one problem, if I have a premade boot.img and I want to change the kernel, how do I do that? Thanks for this guide
Q&A for Guide on building Lollipop for the OnePlus One
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for Guide on building Lollipop for the OnePlus One. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
./extract-files.sh on CM11S
Does ./extract-files.sh will do the right thing if you are on CM11S ?
Because it is sait there : wiki.cyanogenmod.org/w/Build_for_bacon
That you need to have a build of the same branch running on your phone (which is obiously not the case here...)
Kppqju77 said:
Does ./extract-files.sh will do the right thing if you are on CM11S ?
Because it is sait there : wiki.cyanogenmod.org/w/Build_for_bacon
That you need to have a build of the same branch running on your phone (which is obiously not the case here...)
Click to expand...
Click to collapse
Yes, it will work if you're running CM11S on your phone as far as I know. You can try and report back.
me too. video play can't work . it will reboot when click to play video.
Any idea why do I get it? I followed a guide.
make[1]: Entering directory `/home/malwin/cm/kernel/oneplus/msm8974'
The present kernel configuration has modules disabled.
Type 'make config' and enable loadable module support.
Then build a kernel with module support enabled.
Edit : I've checked settings and "Enable loadable module support is checked.
It also bothers my why revision="cm-11.0" of connectivity project is used to build cm12?
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
Hey there,
I tried to compile a CM12.1 based ROM but ended up having a Sustem UI FC on bootup.I did try to compile the ROM with adb enabled but my device was not getting detected in the adb.So a random guy told me to add this (PRODUCT PREBUILT WEBVIEWCHROMIUM := yes ) to my device BoardConfig.mk file.Now the question is - will adding this line help me out with the SystemUI error? Also,should I use the prebuilt libwebchromium.so file or build it from source? What are the benefits if I build it from source? Do reply.
Thanks
Regards,
Aniket Lamba
Hi, thank you for using XDA Assist. The purpose of XDA Assist is not to supply technical support but to point you in the right direction to get that support. I see you've posted a similar question here, http://forum.xda-developers.com/chef-central/android/build-freezes-building-t2996934/page2 That is the best place to ask your question. So I'm going to close this post.
Hi everyone, I'm trying to build CM11 for the i8190 (S3 Mini) and I'm using NovaFusion's device config from github.
The problem is, their device config uses F2FS and I can't seem to figure out how to disable it. I've tried commenting out the F2FS PRODUCT_PACKAGES in device.mk but the ROM's updater script still contains commands to mount and format system as F2FS.
I tried checking build/tools/releasetools/ota_from_target_files but it's the default CM one (I didn't use a custom android_build repo).
Hi there,
First of all you must understand that Assist Forum isn't an helpdesk forum. Please read our sticky thread with the purpose of Assist.
Second, see bellow few guides and tutorials where you must start reading:
Getting Started: Building Android From Source
There are lots of resources throughout the XDA forum, for instance this one: [UltimateGUIDE][How-to]Create your Own Custom ROM an easy way|Android Secrets -_- and this one [ GUIDE ] How to Prepare Ubuntu 14.04 LTS Trusty Tahr to Compile Android ROMs
Good luck
Hi,
I wanted to compile a custom kernel with KVM for the ROG Phone 5 on the latest Android 12 (EU variant) so I looked at the Kirisakura kernel for base (from @Freak07) and I looked at the script that starts compiling the kernel. I could not find some things that was required such as the Google's GCC thing or the "DU_Tools" but I still managed to start compiling the kernel after editing the defconfig file using make menuconfig to enable KVM. Once I did that I ran the script but after like two minutes I got an error (Error 2).
So can someone help me doing this please?
Thanks.
Hey Alex - been looking in to creating a build script using docker for this out of curiosity.
Out of interest though - how are you planning to use KVM once it's enabled?
Moved all of my development efforts from XDA.
chrisaw said:
Hey Alex - been looking in to creating a build script using docker for this out of curiosity.
Out of interest though - how are you planning to use KVM once it's enabled?
Click to expand...
Click to collapse
Hey, I didn't tried using docker (because I don't know how to xD) and I want to use KVM because I heard that the Snapdragon 888 is compatible with it so I was thinking about doing a Windows 10 arm VM with native performance.
chrisaw said:
Got this building cleanly and producing a flashable ZIP:
GitHub - cawilliamson/Kirisakura_ANAKIN_ROG5 at master_release_s_1
Contribute to cawilliamson/Kirisakura_ANAKIN_ROG5 development by creating an account on GitHub.
github.com
Build instructions:
Code:
$ cd <kernel sources>/build/
$ ./build.sh
You will need Docker installed on your system via whatever means necessary and this is really aimed at Linux systems although you could also run the build on a Windows or Mac PC if you setup Docker correctly.
Click to expand...
Click to collapse
Thanks I will try that
Moved all of my development efforts from XDA.
chrisaw said:
Your chances of getting that working easily are slim.
Adding the KVM support to the kernel is easy but the problem you then get is about switching the CPU to "HYP" mode. (just based on what I read online)
If you have further info about this I'd be interested in reading it and seeing if we can get something which works. What I can tell you is that /dev/kvm does not get created simply by the changes I made.
Also be aware that /proc/config.gz is spoofed in these kernels with the "stock" config file so running something like "zcat /proc/config.gz" wont show KVM is enabled but it is.
Click to expand...
Click to collapse
Yes you are R8! Without hyp we can't enable KVM support.. but i found a site where telling android 13 has full KVM support.. but don't know it's true or not..
Because KVM support only available on some snapdragon chipset only..
Redirect Notice
Can't all of this work be ported to the Infinix NOTE 8 on Android 10 too?