[UTILITY][1/8] Build CM10.1 or AOKP on OS X - OS X Build Set Up 1.2 - Nexus 7 Android Development

OS X Build Set Up 1.2 - By Kyle Frost (frostincredible)
So you want to build AOKP or CM10.1 on OS X? Well worry no longer my friends,
it is about to get a whole lot easier. Why is that? Because this script I've written will do pretty
much everything for you, from creating the case sensitive DMG to installing the required files,
to setting up all the folders. The best part? It also will initialize the AOKP or CM repo (depending
on your choice) and you can also build them straight from the script! How fantastic is that?!
Simply read on to see how! Make sure to follow all the instructions (there aren't many)!​
Follow these steps:
Go here and download OS X Build Set Up 1.2 (OSX_Setup-1.2.zip) - DOWNLOAD
Place the ZIP file on your Desktop.
Extract the ZIP to your Desktop.
Here comes the only tricky part. Open the file located at OSX_Setup/scripts/advanced_scripts/build_cm or build_aokp, whichever you're going to build.
Find this line -
Code:
# BELOW IS THE ONLY LINE YOU SHOULD BE EDITING. REPLACE *YOUR DEVICE* WHITH YOUR DEVICE'S CODE NAME. EX - NEXUS 7 = "grouper"
Just below that, edit this line with the instructions in the one I just posted -
Code:
cp /Volumes/Android/OUT/target/product/*YOUR DEVICE*/aokp_*YOUR DEVICE*-ota-eng.$ME.zip /Volumes/Android/Builds/AOKP_$ME.$NOW.zip
IT IS IMPORTANT THAT YOU DON'T EDIT ANYTHING ELSE.
Open your favorite Terminal application (the default on is Terminal located at /Applications/Utilities/Terminal).
cd to the OSX_Setup folder on your Desktop.
Code:
cd /Users/YOUR NAME/OSX_Setup
Run the following -
Code:
./runme
After running this, you will be presented with the following menu -
Code:
============================================================
OS X Build Set Up 1.2 - by Kyle Frost
============================================================
---Main Menu---
1 - Create DMG
2 - Install required files (MUST install MacPorts first)
MacPorts available free at www.macports.org
3 - Set up folders
WARNING: DO NOT RUN ADVANCED MENU UNTIL
YOU HAVE RUN ALL 3 ABOVE, OR HAVE DONE
THEM ALL MANUALLY. THANK YOU.
0 - Advanced Menu
x - Exit
Enter option:
As you can see, you need to go here and install MacPorts before proceeding - MacPorts
After installing MacPorts you can go ahead and run everything.
Create DMG will give you the options of creating a 25GB, 30GB, 40GB, 50GB, or 60GB DMG. 25GB is the lowest recommended by the Android Team.
Install required files will simply do just that, it will install the files needed as specified in the AOSP documents. This can take a while, so go take a nap while it runs.
Set up folders will give you the option of setting up the folders for AOKP or CM10.1. Simply choose which you want and the folders will be created.
Choosing Advanced Menu will give you this -
Code:
============================================================
OS X Build Set Up 1.2 - by Kyle Frost
============================================================
---Advanced Menu---
MUST INSTALL XCODE BEFORE BUILDING!
XCODE IS FREE IN THE MAC APP STORE!
1 - Initialize AOKP Repo
2 - Initialize CM10.1 Repo
When building, it will give you a list
of devices. Enter the number for your device
configuration and the build will continue.
It will take a while the first time, as the
source must first completely download.
3 - Build AOKP
4 - Build CM10.1
Note: When the build is complete, you can
find the finished ZIP in the Builds
folder on your Android disk image.
0 - Go to Main Menu
Enter option:
There you can see you need to install Xcode, if you haven't already. It is free in the Mac App Store (this script is for OS X, you know).
All the options are pretty self explanatory. Make sure you have run the folder set up for the ROM which you wish to build first. Run the initialize option for your desired ROM before running the build option.
That is it! After the build has done (takes a while the first time you set all this up, much faster the next few times) you will be able to build your own nightly's, or whatever you so desire! Have fun!
Disclaimer: This will only work with devices that are officially supported by AOKP or CM10.1. If your device is not supported by their official repos, either wait to see if it is, try to edit my script to get the repo your device's tree is on, or wait until I get around to writing a tutorial on how to add custom repos.
Please do not redistribute this without my permission,
and feel free to hit that thanks button if you liked this.​
Originally posted here, however I thought I'd bring it to the device forums for the device I have, the Nexus 7. Enjoy!

Reserved

Pretty cool been looking to build on my Mac. Do I need to set up an environment or just use as is?
Can I put this file in my galaxynexusroot folder. (Its where I do all my adb and fasstboot from. ).
O yea First!
Sent from out there!

kidrobot52 said:
Pretty cool been looking to build on my Mac. Do I need to set up an environment or just use as is?
Can I put this file in my galaxynexusroot folder. (Its where I do all my adb and fasstboot from. ).
O yea First!
Sent from out there!
Click to expand...
Click to collapse
This sets up the entire build environment for you. You could put it in your folder, it doesn't use adb or fastboot right now for anything though. Just make sure when it says "cd to /Users/YOUR NAME/OSX_Setup" that you change that to where you put it. Seeing as you use adb I'm sure you know how to cd to the right place.

frostincredible said:
This sets up the entire build environment for you. You could put it in your folder, it doesn't use adb or fastboot right now for anything though. Just make sure when it says "cd to /Users/YOUR NAME/OSX_Setup" that you change that to where you put it. Seeing as you use adb I'm sure you know how to cd to the right place.
Click to expand...
Click to collapse
Hello thank you for your great thread i have a problem install for macport is ok create dmg i have this error :
---Choose Size of DMG to Create---
WARNING: ONLY USE ONE, ONE TIME
STEP DOES NOT NEED REPEATED LATER
1 - 25GB (Minimum)
2 - 30GB
3 - 40GB
4 - 50GB
5 - 60GB
0 - Cancel
Enter option: 4
hdiutil: create failed - Ressource occupée
perfect for set up folder to but when i want sync the repo it's not possible i go to the main menu every time i try to build for mako with aokp
see the error below
scripts/advanced_scripts/build_aokp: line 17: cd: /Volumes/Android/AOKP: No such file or directory
scripts/advanced_scripts/build_aokp: line 19: repo: command not found
make: *** No rule to make target `clobber'. Stop.
scripts/advanced_scripts/build_aokp: line 25: build/envsetup.sh: No such file or directory
---This is where you choose your device config---
scripts/advanced_scripts/build_aokp: line 29: lunch: command not found
make: *** No rule to make target `otapackage'. Stop.
cp: /Volumes/Android/OUT/target/product/mako/aokp_mako-ota-eng.Ptichalouf.zip: No such file or directory

ptichalouf said:
Hello thank you for your great thread i have a problem install for macport is ok create dmg i have this error :
---Choose Size of DMG to Create---
WARNING: ONLY USE ONE, ONE TIME
STEP DOES NOT NEED REPEATED LATER
1 - 25GB (Minimum)
2 - 30GB
3 - 40GB
4 - 50GB
5 - 60GB
0 - Cancel
Enter option: 4
hdiutil: create failed - Ressource occupée
perfect for set up folder to but when i want sync the repo it's not possible i go to the main menu every time i try to build for mako with aokp
see the error below
scripts/advanced_scripts/build_aokp: line 17: cd: /Volumes/Android/AOKP: No such file or directory
scripts/advanced_scripts/build_aokp: line 19: repo: command not found
make: *** No rule to make target `clobber'. Stop.
scripts/advanced_scripts/build_aokp: line 25: build/envsetup.sh: No such file or directory
---This is where you choose your device config---
scripts/advanced_scripts/build_aokp: line 29: lunch: command not found
make: *** No rule to make target `otapackage'. Stop.
cp: /Volumes/Android/OUT/target/product/mako/aokp_mako-ota-eng.Ptichalouf.zip: No such file or directory
Click to expand...
Click to collapse
Well the initial error is in the making of the DMG, for some reason it won't create it. Try making sure you don't have anything running, and make sure you don't already have an "Android.dmg" in your User folder. Then run that again.
Also, you must do the "initialize repo" option before building. Otherwise it won't know which source to sync from. Try that and get back.

frostincredible said:
Well the initial error is in the making of the DMG, for some reason it won't create it. Try making sure you don't have anything running, and make sure you don't already have an "Android.dmg" in your User folder. Then run that again.
Also, you must do the "initialize repo" option before building. Otherwise it won't know which source to sync from. Try that and get back.
Click to expand...
Click to collapse
Thank you i try this tonight and get back for feedback

frostincredible said:
Well the initial error is in the making of the DMG, for some reason it won't create it. Try making sure you don't have anything running, and make sure you don't already have an "Android.dmg" in your User folder. Then run that again.
Also, you must do the "initialize repo" option before building. Otherwise it won't know which source to sync from. Try that and get back.
Click to expand...
Click to collapse
sorry but i doesn't have any "android.dmg" in my user folder and no processus in background ... have you a idea ? have you got twitter or gtalk it's easier .

Related

HOWTO: Compile your own kernel from source (WIP)

Updated. You can find an easier to use and more up to date version here:
http://rootzwiki.com/topic/8824-howto-compile-your-own-kernel-v-01/
Hey folks,
Figured I would throw this out there for those who may want to know just what goes into compiling a kernel, and possibly, doing it themselves. This is a WIP, and is more about how to compile, than how to make changes to source or customize your own kernel.
Needed:
Linux. For this case, we will assume Ubuntu 10.10, 64 bit. This can be done with 32 bit as well, but you will need a different cross compiler.
Download | Ubuntu
dsixda's kitchen. So that we can easily split and repack kernels.
https://github.com/dsixda/Android-Kitchen/archives/master
Source. You can use mine. Its fairly heavily tweaked, and compiles without any modifcations.
https://github.com/adrynalyne/kernel_htc-mecha
A cross compiler toolchain. Because I use 64 bit linux, I use a 64 bit cross compiler.
http://rapidshare.com/files/394529815/HikaRi_toolchain_4.4.4.tbz2
(Credit adwinp from XDA)
Introduction
First, we install Ubuntu. I won't be going through that, however. So, assuming we have Ubuntu already installed, and working, we are ready to dive right in.
First, we need a tool Ubuntu does not install by default. This is called git. From a terminal:
Getting Source Code
sudo apt-get install git
Once git is installed, we can grab our source. Using a terminal:
[[email protected] ~]$
code
Code:
mkdir android
cd android
mkdir kernels
cd kernels
git clone git://github.com/adrynalyne/kernel_htc-mecha.git
Depending on your connection, this could take a while.
This will create a kernel_htc-mecha directory under your /home/username/android/kernels folder.
Grabbing Toolchain
Now we will grab the toolchain. Download it, decompress it, and just leave it in the 4.4.4 directory. Move it to your android directory.
Grabbing and setting up the kitchen
Download the kitchen from the link given above, and decompress it. Rename it to kitchen. Move it to your android directory. Then from a terminal:
code
Code:
cd ~/android/kitchen
chmod 755 menu
./menu
This installs the kitchen and starts it up. Now the first thing we need to do is setup a working directory. Take a rom, any rom, and copy it to the ogiinal_update folder inside the kitchen. You can then setup your working folder.
Inside the working folder, delete boot.img. Grab, one of say, my kernels, and extract it. Take boot.img from the extracted contents and copy to the kitchen.
To split the initramfs (ramdisk) from the kernel, simply choose 0 from the menu, then 20. Hitting w will extract the kernel to a BOOT-EXTRACTED directory inside the kitchen (not working folder). Inside that folder, you will find the ramdisk and a zImage. The zImage is the kernel. We will stop there for now.
Compiling the kernel
First, we move to the kernel directory.
code
Code:
cd ~/android/kernels/kernel_htc-mecha
To compile the kernel, first we must have a configuration file ready. To do this:
code
Code:
make mecha-lte_defconfig
It will configure the system for compiling.
Now to compile the kernel:
code
Code:
make -j5 ARCH=arm CROSS_COMPILE=/home/username/android/4.4.4/bin/arm-none-eabi-
Where username is your, well, username and the number after j (thats a J) is the number of cpus +1.
Depending on the speed of your system. a zImage should be created within 3-30 minutes.
Packing the kernel
The zImage will be located under ~/android/kernels/kernel_htc-mecha/arch/arm/boot directory.
We will copy that zImage into the BOOT-EXTRACTED directory of the kitchen. Then, back at our menu for the kitchen, we hit 'b' to build the kernel. Within seconds, there is a new boot.img inside our Working folder. Now, remember my kernel package you downloaded? Well, time to kang the installer! The directory you unzipped contains a META-INF and system directory. You need both of those. Copy the boot.img in with those two folders.
So, our directory layout currently looks like so:
META-INF
system
boot.img
We need one more file, the wifi driver, from our compiled source.
Under ~/android/kernels/kernel_htc-mecha/drivers/net/wireless/bcm4329_204 you will find a file named bcm4329.ko. Copy this into system/lib of your new kernels installer directory.
Zip these three folders and give it a name. Now its ready to install.
A couple of things of note:
You almost always have to match the wifi driver with the kernel.
make clean mrproper will clean all the precompiled and temp fikes out of your source. This is recommended when making major source changes. Don't forget to remake your configuration after running it though.
Troubleshooting
There may be some files not found errors. Please be careful with these commands.
If the files not found are libcloog.so.0 and/or libmpfr.so.1, take a look below.
Code:
sudo ln -s /usr/lib/libcloog-debian.so.0 /usr/lib/libcloog.so.0
sudo ln -s /usr/lib/libmpfr.so.4 /usr/lib/libmpfr.so.1
Very nice write up, I've been looking into this for a while so its nice someone put it all together in one thread.
Sent from my NookColor using XDA Premium App
Nice Adrynalyne
Sent from my Thunderbolt using XDA Premium App
I love learning new things... Thanks for sharing knowledge!
For those of us that play in a Virtual Box, any notes about issues that may come up? I used to dual boot but decided that a vb is more time efficient for me.
Thanks a lot, i was wondering about this too.
Sent from my ADR6400L using Tapatalk
I'm really glad you've posted this. Time to play for those of us who are lazy (or busy)!
awesome. I love the android community's open-ness. Not only do you post your source, but you tell people how to use it...
Thank you so much for spending the time to write this, i have been googleing this and your write up is the best ive found.
I know this is a work in progress, but some ideas for future revisions, at least things that I have been wondering,
The files tweaked for overclocking, undervolting, and maybe some explanations on what goes into this.
Important files and maybe files we should not touch, (if there are any).
Just things I have wondered.
Thank you again!!!
Wow. Thank you for taking the time to write this up. Some of us really do appreciate it!
You sir, are a gentleman and a scholar.
You really are amazing at what you do. Sometimes I wonder when you sleep..
Uggg, I am running Ubuntu 10.10 64bit.
I have followed this step by step but I am getting the following error:
/home/scott/android/4.4.4/bin/../libexec/gcc/arm-none-eabi/4.4.4/cc1: error while loading shared libraries: libcloog.so.0: cannot open shared object file: No such file or directory
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: INTERNAL: Exiting with 3 jobserver tokens available; should be 2!
What package am I missing? I apt-get installed libcloog-ppl0.
Any help is appreciated.
Scott
UPEngineer said:
Uggg, I am running Ubuntu 10.10 64bit.
I have followed this step by step but I am getting the following error:
/home/scott/android/4.4.4/bin/../libexec/gcc/arm-none-eabi/4.4.4/cc1: error while loading shared libraries: libcloog.so.0: cannot open shared object file: No such file or directory
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: INTERNAL: Exiting with 3 jobserver tokens available; should be 2!
What package am I missing? I apt-get installed libcloog-ppl0.
Any help is appreciated.
Scott
Click to expand...
Click to collapse
Go to /usr/lib and tell me what the name of libcloog.so.? Is. There are bound to be growing pains with this, as I originally used Fedora 64 bit when I did this. Still, its doable on Ubuntu, because I have this same toolchain on Arch as well.
Let me know what the name of that file is. I will help all I can.
Sent from my ADR6400L using XDA App
adrynalyne said:
Go to /usr/lib and tell me what the name of libcloog.so.? Is.
Sent from my ADR6400L using XDA App
Click to expand...
Click to collapse
Adrynalyne,
In my /usr/lib I have the following libcloog files:
libcloog.a
libcloog.so
libcloog-debian.a
libcloog-debian.so
libcloog-debian.so.0
libcloog-debian.so.0.0.0
libcloog-ppl.a
libcloog-ppl.so
libcloog-ppl.so.0
Hope this helps.... It has been a long time since I messed with Linux
Again, I am Ubuntu 10.10 64bit
Thanks again.
sudo ln -s /usr/lib/libcloog-debian.so.0 /usr/lib/libcloog.so.0
sudo ln -s /usr/lib/libmpfr.so.4 /usr/lib/libmpfr.so.1
Trying to run kitchen , when trying to setup working folder it doesnt appear to do anything, I hit 1 and it just sits there. I hit 0 for advanced options and it just sits there.
I have a rom in the right folder as a zip and extracted.
edit: guess you cant extract in windows and copy the files over .
happimeal said:
Trying to run kitchen , when trying to setup working folder it doesnt appear to do anything, I hit 1 and it just sits there. I hit 0 for advanced options and it just sits there.
I have a rom in the right folder as a zip and extracted.
Thanks
Click to expand...
Click to collapse
You arent supposed to extract the rom. The kitchen needs to.
Yes..
all the way to the make and got some errors
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 1: ELF: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 2: @: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 3: Syntax error: ")" unexpected
CHK include/linux/version.h
SYMLINK include/asm -> include/asm-arm
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC scripts/mod/empty.o
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 1: ELF: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 2: @: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 3: Syntax error: ")" unexpected
make[2]: *** [scripts/mod/empty.o] Error 2
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
Any ideas.
You need the lib32 stuff installed for Ubuntu. Not sure why, as its a 64 bit toolchain. I'm using full 64 bit Arch Linux and don't need to.
adrynalyne said:
You need the lib32 stuff installed for Ubuntu. Not sure why, as its a 64 bit toolchain. I'm using full 64 bit Arch Linux and don't need to.
Click to expand...
Click to collapse
Hmm, probably easier to just install 64 bit version, ....... doing that now.
Thank You.
Where was this guide all weekend lol
been waiting for this thanks bro
now if only i can find a guide to creating flashable .zips hmm
Sent from my ADR6400L using XDA Premium App

[Tutorial/How-To][GB] Make Your Own Custom Rom & Kernel (Last Updated 30/07/2012)

Introduction
Hi guys, so im seeing a real lack of dev work going on in these forums so here i going to make a guide on making a custom rom and a custom kernel for the optimus 3d. XDA's about sharing so im going to tell you nearly everthing i know to get you started. This is no means the best/definative way as im still learning alot myself only starting this kind of stuff about 6 months ago. I dont call myself a dev so there could be things wrong but here is how ive made my stuff to share with you. Ill probably update these posts as time goes on too, to improve & answer questions. Plus ill probably forget something too. Plus it would be good if other dev types in this forum could maybe share a few of there words of advice, wisdom & tips. This will hopefully encourage people to use & create for the device.
Chapters/Posts
Post 1- Getting Started
Part 1- Prequisites
Part 2- Getting Necessary Basic Stuff Done For Your Rom
Post 2- Making The Rom Custom & Extra Mods
Part 1- Basic Mods
Part 2- Advanced & More Complex Mods
Post 3- Making The Custom Kernel
Part 1- Getting Set-Up
Part 2- Compiling Your zImage
Part 3- Making Your RamDisk
Part 4- Making Your Boot.img
Post 4- Changelog
Post 5- Dev Bible!
Getting Started
Presquisites
This guide assumes you have some knowledge on how to use basic computer stuff, use other guides in the forum, know how to use a rooted phone & have some general common sense. If you dont what some of this stuff research it before you carry on reading.
Youll need a computer(dugh) with preferably a linux distro like ubuntu 10,11 or 12(for kernels) and windows, xp, vista, 7 & 8 should all be fine. These arent necessety, im sure you can probably complile stuff on windows and on other distro's and versions but this is how ive done my stuff. Again dont ask where to get these.
Youll also need a memeory card with enough room to hold a cwm backup & some mods so 1gb is/should be plenty and fully charged battery too, we wouldnt want the battery to go flat during a risky process would we.
I recommend you also have these apps/tools too, they will make the process alot easier and your gonna need some of them along the way.
For Windows
Kdz flasher or .bin flasher- http://forum.xda-developers.com/showthread.php?t=1287236 Big Thanks To adixtra
Winrar (trial version is fine)- http://www.rarlab.com/download.htm
Or 7zip As Recommended By Pandaball- http://www.7-zip.org
Notepad+ From Here- http://notepad-plus-plus.org/
Megatron Root Method- http://vulnfactory.org/blog/2012/02/26/rooting-the-lg-thrill-optimus-3d/
CWR Flash Tool By Paki0402- http://forum.xda-developers.com/showthread.php?t=1482713
For Ubuntu/Linux
LG's Source Code Page: http://www.lg.com/global/support/opensource/opensource.jsp
Kernel Build Tools- sudo apt-get install uboot-mkimage (In Terminal)
Ramdisk Compile/Decomplie Tool- http://forum.xda-developers.com/attachment.php?attachmentid=1215193&d=1342992085
ARM Toolchain- https://sourcery.mentor.com/public/...-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 (Recommended)
disxda Kitchen- http://forum.xda-developers.com/showthread.php?t=633246
For Yourself
Computer, Preferably Modern Otherwise Things Could Get Slow
Coffee- http://www.starbucks.com/coffee/reserve/galapagos-san-cristobal
Patience
Time (Definatly Dont Ask Me Where To Get This Since I Couldnt Find A Link)
Getting Necessary Basic Stuff Done For Your Rom
Firstly youll need a rom to modify for this you can either download a ready made rip of a rom like from fabio in this thread http://forum.xda-developers.com/showthread.php?t=1155874 or you can make your own. For this youll need to have a fresh kdz flahed to you phone from here http://lg-phone-firmware.com/ or from another source if you prefer .bin. Once you have flashed i recommend just skipping all the setup stuff like market, wifi and accounts stuff since your not gonna need it yet.
Next we need to make a copy of your freshly flashed kdz if you going down this root(no pun intended) otherwise youll already have it in zip format & probably already rooted too. Talking about rooting this will be the next thing you need to do & since were running gingerbread youll need to root with megatron found here -insert link here- follow that guide & thanks to Dan for that breakthrough which without, this probably wouldnt be possible.
After your rooted youll need to get ClockWorkMod recovery. There are two ways you can get it either through rom manager in the Playstore or from this tool here -insert thread here-. Cheers paki for that very useful tool and koush for the recovery. For SU760 people use ibluemind version here http://forum.xda-developers.com/showthread.php?t=1565412 thank you iblue too.
Now were all rooted and have recovery installed we can now make a copy of the entire system. This bit is easy youve all probably done it before too. You will need to boot into recovery either with the button command or through rom manager app. Then just simply make a backup of you rom, while your waiting put the kettle on make yourself a coffee & enjoy a litttle break.
Ok so now we have a base for our custom rom based on whatever version kdz you flashed. Now we need to transfer this to our pc. So go to you backup & simply copy & paste the system.ext3, data.ext3 & boot.img to where you want to do your work, the rest you wont need unless something goes wrong later. The backup is located on the external memory card in the clockworkmod/backup directory.
So we have the necessary parts on your computer, youll need to decompress the system.ext3 and data.ext3 using winrar or other zip app. Then once you have your system and data folders set up you can start the modding but first thing to do is delete anything personal from the data folder so make sure only the app folder remains in the data partition like this data/app and no other folders like app-private, fota & data. If you want you can do away with the data part all together and just keep it simple.
We now have a basic stock rom in its raw form. So now youll need to package it up. For this ill provide a donate install script zip at the bottom of this post for which you can simply drap & drop your system folder and data folder if your including it. Youll also need to drag over the boot.img, this can be one you have made from the guide below, one from your backup folder which would be the stock kernel or one from a kind dev if they will let you use there's.
Thats it you should now have basic stock rom from which you can build upon, just flash it to your phone and test if it works. If you want to get creative i recommend you download and use disxda's Kitchen this will do the extraction part too.
Making The Rom Custom & Extra Mods
Ok guys & gals we now have a lovely stock base zip but its not lovely enough is it, we need to set it apart from from stock. This is where it could get complicated depending on your experience or your understanding on things. First off youll need to scour the realm's of XDA for what you want, but ill give you a few links & mods here that you can try yourself. Just remember not all these may work or be fully compatible with our device. I recommend you try these on your device first before applying them to your rom zip, just in case if they work then go ahead try them in your zip.
Basic Mods
Basic Mods are what i would consider as copy & paste mods like build.prop mods, some simple ready made zip packages such as Beats & Bravia mods and etc tweaks like apn's, hosts, .conf tweaks etc.
Here's some links to some you could try.
Beats- http://forum.xda-developers.com/showthread.php?t=1525226 (Recommend 0314 Package)
Build.prop Tweaks- http://forum.xda-developers.com/showthread.php?t=1631092
Boot Animations- http://forum.xda-developers.com/showthread.php?t=1053250
To apply a build.prop mod simply open your build.prop in the system directory and copy & past them at the bottom of the file like this:
Code:
#
# my build.prop mods
#
dalvik.vm.heapsize=64
Then simply save. In the build.prop you can also change you rom name in the ro.build.display.id= and other small mods too.
Next we want to apply zipped based mod like a boot animation or even Beats mod. There are 2 ways you can do this, so one way for this is to simply download the mod & extract to a folder for example modz folder and copy each file/folder into the relevent directory of your system folder or you can have both your mod zip and rom zip open and simply drag them over to the rom zip from the mod zip. Just be wary if there is a build.prop tweak within like in the Bravia & Xloud mod or text based part of the mod you will have to manually copy the extra lines from one modded one to yours. For example:
Code:
#
# my build.prop mods
#
dalvik.vm.heapsize=64
# Xloud Engine
ro.semc.sound_effects_enabled=true
ro.semc.xloud.supported=true
persist.service.xloud.enable=1
# BRAVIA Engine
ro.service.swiqi.supported=true
persist.service.swiqi.enable=1
Advanced & More Complex Mods
These are the sort of mods that can make a big impact on your rom. Usually involves changing or even coding system variables for asthetic & performance purposes. Things such as framework editing and scripts would come under this category. Although scripts are easy to apply some of them require modifications to get the best or even work with our device. Scripts are placed in the system/etc/init.d directory. You probably wont have this cause your developing from a stock rom, so youll need to create that folder. To enable the use of init.d scripts you will also need init.d support from the kernel, this will be covered later in the guide but if your using a custom kernel youll most probably already have this feature.
Here are some links to some popular script based mods that work well with our device:
http://forum.xda-developers.com/showthread.php?t=1227269
http://forum.xda-developers.com/showthread.php?t=1556013
http://forum.xda-developers.com/showthread.php?t=1236779
Once you have added your scripts we need to edit the updater-script to ensure they have the correct permissions. This is located in your zip in the /META-INF/com/google/android/ directory. To edit open in notepad+ or gedit and enter as below for every script you add.
Example
Code:
set_perm(0, 0, 0777, "/system/etc/init.d");
set_perm(0, 0, 0777, "/system/etc/init.d/01Your1stScriptName");
set_perm(0, 0, 0777, "/system/etc/init.d/02Your2ndScriptName");
set_perm(0, 0, 0777, "/system/etc/init.d/03Your3rdScriptName");
And so on for more scripts then save. If your script needs different permissions, set them according to the authors/devs's instructions.
Now on to deodexing, this isnt necessary but it makes theming your rom much easier later. To do the deodexing i recommend you use disxda's Kitchen. This part of the instruction is based on using Ubuntu but it probably applies to the Windows version too. Its easy and quick to use. Just simply drag the your roms zip into the original_update folder and load up the kitchen. If your using Ubuntu it will ask if you want to run in terminal, select this option. So now you have the kitchen up, go to create working folder for rom, press enter and then select your zip(My1stRom.zip). the kitchen will then ask you about the script just select 2 (do nothing) then press enter again when it comes up with a warning about update-script. Then go to advanced options and select deodex it will ask you whether or not you want to do system apps and some other stuff, just select option b, both folders (recommended). Press enter again at logging. Then this should deodex everthing in you rom. On ocassions there some certain apk's that cant be deodexed, dont worry there's only a few that cant be done. Thats it after about 10-15 minutes, now youre deodexed. This may take longer on a slower pc though. Just press enter again to get to continue and exit to the main menu.
So there we go, youve incorperated your mods that you want, its time to repackage it all up but this time we will use the kitchen to do this. Select 99 Build Rom from working folder, select interactive mode, select yes to zipaligning, select no to adding updater script, select yes to signing your rom, select yes to changing name, enter a new name My1stRom for example.
Now just copy the zip to your phone from the OUTPUT_ZIP directory then flash to you phone and see/feel/hear the difference. If all is well then congratulations you have now made a custom rom. Obviously these are just the begining of modifying your rom there are loads more things you can change and do things different ways but these come with experience and research such as modules and modified libraries, media hacks and such.
Making The Custom Kernel
So this is the post some of youve probably been waiting for & probably going to be the hardest one to write up so im gonna apologise now for my lack of typing & explaining skill You will need a linux distro for this bit, as ive not tryed using compilers for Windows. Any distro should be fine im currently using Ubuntu 12.04 LTS but have sucessfully done this on older versions. Im only going to cover the basic stuff with this guide it would be impossible to show you everything but ill show you a couple of mods to get started like overclock, a few fixes of LG's mistakes (For V21E Base only, other LG kernel's may have there own problems too PM me if your stuck) & changing a few variables stuff.
Getting Set-Up
Ok first off we will need to get our source. You get this from the LG Open Source website, link is attached in the first post. Obviously we want the latest 21E source or if your doing this for P925, get the latest or the one you want for that. Then youll need to download & extract it. This will be fine to do in the 'Download' folder. Once you have extracted it youll have another 2 tar archives. You will want to extract the LGP920_Gingerbread_Kernel.tar.gz, again in the same directory your in will be fine. So now you should have a folder named 'kernel'. Before you can continue we will need to rename the base directory to something more simple like LGP920v21ESource otherwise if you have brackets and other punctuation stuff it will give you a syntax error later.
Next we will need the ARM Toolchain in order to compile your kernel source. This is in the first post, this is the same toolchain that LG uses to compile it. You can use other compilers but you will have to modify a few things to get it working. That is for another post another day maybe. So now we need to extract the toolchain, do this in the same way as before in the 'Download' folder. Now youll have a folder named 'insert proper folder name here' this is your toolchain. Now we have our toolchain and source all unpacked and ready to go, youll need to open Terminal or your prefered terminal app. This next bit will be much easier if you extracted everything in the explanation above. For the next set of instructions just change my user name with yours and if you did the same directories as me this should be simple.
Ok so in terminal cd to inside your kernel like this for expample:
cd /home/samno/Downloads/LGP920v21ESource/kernel
Dont get confused about the kernel directory inside the kernel folder you want to be at the base of the rest of the files.You should have the kernel directory open in file browser too. If you want you can type cd in terminal and then drag the folder in the top of the file manager and drag it into the terminal window where you typed cd, this will save you making typo's and be quicker/easier.
Next we need to set the export/path for our toolchain so in terminal enter this for example:
Code:
export CROSS_COMPILE=/home/samno/Downloads/arm-2010q1/bin/arm-none-linux-gnueabi-
Code:
export PATH=$PATH:/home/samno/Downloads/arm-2010q1/bin
Exporting the path isnt completely necessary but is useful if you want to compile other things than this. Now we should be ready to compile.
Compiling The zImage
First thing we will need to to is edit the makefile in the base directory. Open with gedit and add '+' to the 7 where it says EXTRAVERSION = .7. This will make the kernel compatible with the 21E modules such as wifi. If you are devoloping for sources without a '+' such as 20F you can leave this bit. You could also make your own modules if you wanted but i might cover that later. I dont do this cause it can cause compatibilty problems for people swapping kernel all the time, especially when the kernel they flash isnt compatible with the modules of another kernel for example my kernel uses stock modules found already in the roms we use where as iblue for example compiles and includes his own in the kernel package. If you flash one over another then the modules wont work with another kernel version.
Ok what we want to do next is fix the defconfig for our device or just use a different one in our case. This is located in the arch/arm/configs directory. This was a problem when devs first started compiling to find out when they flashed it they no signal and charging issues when the phone is off. Cause we are meant to use the cosmo_rev_1.11_defconfig but it had cricial lines missing. Only by me messing about did i discover that the lines needed were located in the cosmo_rev_1.11_mipi_defconfig.
So in terminal you should still be in the kernel directory, now enter this command:
Code:
make ARCH=arm cosmo_rev_1.11_mipi_defconfig zImage
Dont worry it come up with loads of stuff as it compiles but i will come to an error which we need to fix before it will continue. The good thing about the complier it will give you a good idea where to look like the file and error location.
So it should come up with something like this:
Code:
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC drivers/staging/omap_hsi/xmd-hsi-ll.o
In file included from drivers/staging/omap_hsi/xmd-hsi-ll.c:33:
drivers/staging/omap_hsi/xmd-hsi-ll-internal.h:256: error: expected specifier-qualifier-list before 'if'
drivers/staging/omap_hsi/xmd-hsi-ll-internal.h:434: error: #endif without #if
drivers/staging/omap_hsi/xmd-hsi-ll.c: In function 'hsi_ll_read_complete_cb':
drivers/staging/omap_hsi/xmd-hsi-ll.c:707: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:707: error: 'struct hsi_ll_rx_ch' has no member named 'open_size'
drivers/staging/omap_hsi/xmd-hsi-ll.c:708: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:711: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:711: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:713: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:714: error: 'struct hsi_ll_rx_ch' has no member named 'open_size'
drivers/staging/omap_hsi/xmd-hsi-ll.c:715: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:718: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:720: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:722: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:722: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:733: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:734: error: 'struct hsi_ll_rx_ch' has no member named 'open_size'
drivers/staging/omap_hsi/xmd-hsi-ll.c:736: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c:737: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c: In function 'hsi_ll_check_channel':
drivers/staging/omap_hsi/xmd-hsi-ll.c:1476: error: operator '/' has no right operand
drivers/staging/omap_hsi/xmd-hsi-ll.c: In function 'hsi_ll_open':
drivers/staging/omap_hsi/xmd-hsi-ll.c:1642: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:1643: error: 'struct hsi_ll_rx_ch' has no member named 'open_size'
drivers/staging/omap_hsi/xmd-hsi-ll.c:1644: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
drivers/staging/omap_hsi/xmd-hsi-ll.c: In function 'hsi_ll_reset':
drivers/staging/omap_hsi/xmd-hsi-ll.c:2725: error: 'struct hsi_ll_rx_ch' has no member named 'open_id'
drivers/staging/omap_hsi/xmd-hsi-ll.c:2726: error: 'struct hsi_ll_rx_ch' has no member named 'open_size'
drivers/staging/omap_hsi/xmd-hsi-ll.c:2727: error: 'struct hsi_ll_rx_ch' has no member named 'retry_cnt'
make[4]: *** [drivers/staging/omap_hsi/xmd-hsi-ll.o] Error 1
make[3]: *** [drivers/staging/omap_hsi] Error 2
make[2]: *** [drivers/staging] Error 2
make[1]: *** [drivers] Error 2
So lets go to the first error, line 256 of the xmd-hsi-ll-internal.h. Simply add # before 'if defined' like this '#if defined'. Save the file then go back to terminal and enter the make command or press up arrow and press enter. Youll notice alot of errors have gone when it errors out again and it should look like this:
Code:
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC drivers/staging/omap_hsi/xmd-hsi-ll.o
drivers/staging/omap_hsi/xmd-hsi-ll.c: In function 'hsi_ll_check_channel':
drivers/staging/omap_hsi/xmd-hsi-ll.c:1476: error: operator '/' has no right operand
make[4]: *** [drivers/staging/omap_hsi/xmd-hsi-ll.o] Error 1
make[3]: *** [drivers/staging/omap_hsi] Error 2
make[2]: *** [drivers/staging] Error 2
make[1]: *** [drivers] Error 2
make: *** [zImage] Error 2
Again fixing this error is like the first one, goto line 1476 of xmd-hsi-ll.c simply delete the '/' like this '#if 1' where it was '#if 1 /'. Save again then back to terminal again where it will you guessed it error out again. Should look like this;
Code:
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC drivers/staging/omap_hsi/xmd-hsi-ll.o
CC drivers/staging/omap_hsi/hsi_driver_if.o
drivers/staging/omap_hsi/hsi_driver_if.c: In function 'hsi_ioctl':
drivers/staging/omap_hsi/hsi_driver_if.c:930: error: 'HSI_IOCTL_SET_WAKE_RX_3WIRES_MODE' undeclared (first use in this function)
drivers/staging/omap_hsi/hsi_driver_if.c:930: error: (Each undeclared identifier is reported only once
drivers/staging/omap_hsi/hsi_driver_if.c:930: error: for each function it appears in.)
drivers/staging/omap_hsi/hsi_driver_if.c:945: error: 'HSI_IOCTL_SET_WAKE_RX_4WIRES_MODE' undeclared (first use in this function)
make[4]: *** [drivers/staging/omap_hsi/hsi_driver_if.o] Error 1
make[3]: *** [drivers/staging/omap_hsi] Error 2
make[2]: *** [drivers/staging] Error 2
make[1]: *** [drivers] Error 2
make: *** [zImage] Error 2
Fixing this one will be similar too. If you read the error its says this bit of code hasnt been declared for a function, most probably LG have missed some more code here for it to work or it was left over from testing the ghost call stuff. The only way to get rid of this error that i know of is to do away with the line completely. So go to line 930 of hsi_driver_if.c and delete 'case HSI_IOCTL_SET_WAKE_RX_3WIRES_MODE:' and the space that it leaves and do the same for 'case HSI_IOCTL_SET_WAKE_RX_4WIRES_MODE:'.
Do the make command again and thats it no more errors and it should look like this:
Code:
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gzip
AS arch/arm/boot/compressed/piggy.gzip.o
CC arch/arm/boot/compressed/misc.o
CC arch/arm/boot/compressed/decompress.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS arch/arm/boot/compressed/lib1funcs.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Congratulations! Youve just compiled your first kernel.
Making Your RamDisk & Boot.img
Well done! Now we need to package your zImage up into a useable form. This part will be similar to Urabewe's guide here http://forum.xda-developers.com/showthread.php?t=1358717 , kudos to him for such an excellent guide, the only difference is were using our own zImage.Remember the backup you did earlier of your stock rom, were gonna need it again for this part. Firstly were gonna need to make sure we have got the tools to decompress/compress the boot.img. Again you will need a Linux distrubution like Ubuntu to be able to do this. So first off if you havnt got it already, we need to download the packaging tool using terminal. Enter the command as follows:
Code:
sudo apt-get install uboot-mkimage
Good now we need the perl script from the first post. Download and extract it to a folder and call it 'My1stKernel' for example. In this folder paste the boot.img from you stock backup. This will be used as our ramdisk base which we will work from. Now we need to unpack the boot.img but first we need to make sure were in the 'My1stKernel' directory so in terminal:
Code:
cd /home/samno/Downloads/My1stKernel
Then to unpack the kernel:
Code:
./unpack-bootimg.pl boot.img
When completed you will have a new directory inside named 'boot.img-ramdisk' & two gunzip compressed files, 'boot.img-kernel' is the stock zImage and 'boot.img-ramdisk.cpio.gz' is the stock ramdisk. The 'boot.img-ramdisk' contains the decompressed ramdisk contents. First thing to do now is delete 'boot.img-kernel' , 'boot.img-ramdisk.cpio.gz' & the old 'boot.img' since we only need the 'boot.img-ramdisk' cause were editing the ramdisk and using our own zImage. Now copy and paste the zImage you created earlier from the 'arch/arm/boot' directory of the kernel folder into 'My1stKernel' folder.
Now were gonna add some tweaks to the ramdisk to do this open the 'boot.img-ramdisk' folder and open the 'init.rc'.
First were gonna add a cpu variable for the screen off state, this helps save a bit of power.
Where the line says '# switch CPUfreq from performance to hotplug & tune it' add this underneath to keep the max frequency when screen is off to 300mhz:
Code:
write /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq 300000
Next were gonna add init.d support. So after these few lines in the init.rc:
Code:
service bootanim /system/bin/bootanimation
user graphics
group graphics
disabled
oneshot
Add this:
Code:
service userscript /system/bin/sh /sbin/initd.sh
user root
group system
critical
oneshot
This basically tells the system to load this file, which were gonna add next. Now save the file and start a new text document. In the document add this bit of text:
Code:
#!/system/bin/sh
if [ -d /system/etc/init.d ]
then
logwrapper busybox run-parts /system/etc/init.d
fi
sync
This is basically a script that runs the items in the init.d folder at boot so now save it as initd.sh in the sbin directory of your 'boot.img-ramdisk' folder. Youll notice the top command should turn blue, that means you have saved the file in the correct format. Good so now we should package all this up, but if you want you can add more mods to the init.rc like your memory management, more cpu controls, IO controls & lots of other stuff, anyway.
Making Your Boot.img
Almost there now guys! Let's package this up and enjoy the fruits of your labour. Assuming you still have your terminal window open in 'My1stKernel' directory type this command:
Code:
cd boot.img-ramdisk
Then this to compress the ramdisk:
Code:
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
Now in your 'My1stKernel' folder you will have a new gunzip archive named 'newramdisk.cpio.gz' this is the ramdisk you modified earlier. Now we need to bind it with your custom zImage to make a boot.img. So get terminal back up and go back to the previous directory:
Code:
cd /home/samno/Downloads/My1stKernel
Then enter this to combine them:
Code:
mkimage -A ARM -T multi -n newboot -C None -a 0x80008000 -e 0x80008000 -d zImage:newramdisk.cpio.gz boot.img
You should then have a lovely file named boot.img, simply just paste it into the flash package ive provided below for you then flash to your phone through CWR. Thats it, you & me we have come a long way, you should now have a rom and kernel you have made by yourself. Now lets party, unless it dosnt work just restore or flash another kernel . If you need any clarification or help just post in this thread and we can all help each other. Also would love to here your sucess stories if you used my guide and on a final note i want to thank everyone who's ever developed for this device and those who will cause youve helped me so much (even though you probably dont know ) through my entire time with this.
Changelog
To-Do
-Add Over Clocking/Frequency Instructions
-Add Voltage Changing Instructions
-Governors & IO Schedulers
Monday 30th July 2012
-Finished All Posts To A Finished Standard
Dev Bible!
From Pandaball 1 Verse's 1 & 2 http://forum.xda-developers.com/showpost.php?p=29185146&postcount=9
Just a few comments if I may:
I use 7zip over Winrar, it's a pretty badass alternative for something which is free.
Also, making a CWM backup isn't entirely necessary, you can do adb pull /system and the files will be pulled over to your adb directory. Saves you the trouble of extracting the nandroid backups. Normally I don't touch /data at all, just create /data/app and add the necessary lines in updater-script and you're good to go.
Some more tips:
Get the LG source code, it really tells you how Android works and all.
Linux is better than Windows for things like this. Both work fine, but Linux has the compilers and tools.
Test, test and test again. Make sure everything and everything works. Failure to do so (like I do sometimes ) will result in horrible things happening.
CWM's updater-script is a PITA. If there's an install script error, check your syntax. Did you forget a semicolon? A quotation mark? Did you ensure you used the correct command and parameters? If you really have to, weed out your updater-script down to the very basics and debug from there. Nice things such as ui_print are unnecessary until you're sure the basic functionality works.
Finally, doublecheck your permissions. Don't make everything 0777 (rwxrwxrwx) for no reason at all. Assign 0755 only when it's needed by the tweak, else 0644 will suffice. Also, things like su and busybox require special permissions like 4755 and 6755. If you don't assign these permissions, something's bound to break. Make sure your permissions are assigned correctly, else you have only yourself to blame when you bootloop your phone.
tl;dr it sucks to be a developer
Click to expand...
Click to collapse
From Pandaball 1 Verse 3 http://forum.xda-developers.com/showpost.php?p=29298911&postcount=12
Well, since there's an open invitation, might as well crash the how-to-dev party with some scripts you can use right off the bat. They are as attached, feel free to use them.They are a part of the tweaks I use for my rom. Noticeable improvements over stock this way, although they more or less deal with usability rather than performance so benchmarks might not improve as much as you'd expect. Dump them in /system/etc/init.d with permissions 0644 with a kernel that supports init.d (in other words, any custom kernel on this forum) and you're good to go.
However, since we're here, why not study how init.d works? Better to understand what these scripts do and how they impact performance, no?
Disclaimer: Some of these tweaks (like the one I'm going to explain below) were taken from the very awesome knzo (http://forum.xda-developers.com/show....php?t=1227269). However it has a ways to go in terms of explaining what the commands do so this post is entirely dedicated to that.
The scripts are very nicely named, giving you an idea of what they do. However, what do the strange numbers in front mean? Simply put, during bootup the kernel will run these scripts according to the numbers, so 65ZipAlign will run first, followed by 70Ext4Mount and so on.
Now, open 70Ext4Mount using notepad, notepad++, what have you. You'll see a bunch of variables and values, but at the start it is of paramount importance to add #!/system/bin/sh to the first line, else the script will not even execute as there is nothing defined to execute or write these values.
What do the values/commands do, you may ask.
tune2fs -o journal_data_writeback /dev/block/mmcblk0p7
Click to expand...
Click to collapse
Let's analyse this command in sections.
tune2fs is just the code that runs the commands that follow after it.
-o journal_data_writeback tells tune2fs to write to the filesystem to enable journal data writeback. This typically provides the best ext4 filesystem performance.
/dev/block/mmcblk0p7 is the partition to apply the above commands to. In this case, mmcblk0p7 is /system.
Now, the other command is this
tune2fs -O ^has_journal /dev/block/mmcblk0p7
Click to expand...
Click to collapse
This time, the parameters are slightly different.
-O ^has_journal removes journaling, which is basically a filesystem log service. It takes up system resources, so removing journaling will improve system responsiveness. Note that -o and -O are different, the parameters are case-sensitive. -o configures the mount/filesystem options, -O enables/disables features.
Finally, at the bottom you get this line
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier =0,nobh /system
Click to expand...
Click to collapse
As seen, the above is just a bunch of parameters. What do they all mean?
busybox mount -o mounts the partition named at the end, which is system. -o enables the mounting options.
remount, well, remounts the partition with the options named.
noatime disables the filesystem from writing the last accessed time to each file. When enabled, every read operation must have a write operation to write the last access time. With this option, only the read operations are done, removing the need for a write operation as well, giving a significant I/O boost.
noauto_da_alloc is a bit complex. When a file is edited in Linux, a new file is created containing the changes, then when it is saved, the new file is renamed and overwrites the old file. In ext3, it causes no problems since ext3 guarantees that either the old or new data will be on disk (when I say disk, it really means memory/eMMC) due to its default journaling mode. However, ext4 delays allocation, and thus the new file contents may not be written to disk before the file is renamed. Because of this, Linux kernels force the data to be written immediately which creates a performance hit. Disabling this will improve I/O by a bit. This may not be to everyone's liking since it creates the possibility of losing data, but such a thing has never happened to me. You can remove it if you like
nodiratime is the same as noatime, except this applies to directories being accessed rather than files.
barrier=0 disables the use of write barriers. Write barriers enforce proper on-disk ordering of journal commits, and is usually enabled due to possibility of data loss if power is lost. However because the O3D is a phone, it has a battery and this ensures data will not be lost as the system will not shut off abruptly due to power loss. Removing barriers gives a performance boost.
nobh makes the phone avoid assigning buffer heads. Similar effects to barrier=0, similar dangers.
/system selects the partition to remount.
That's all for 70Ext4Mount. Congrats, you now know how one of the init.d scripts work Now try figuring out the other 3. Google is your friend
This post is meant as a complement to samno's init.d mods, and only covers and explains a small section of what can be accomplished with init.d. I'll cover more when I find time
Click to expand...
Click to collapse
You are the man!!!!I was wondering will someone post something like this and i was to newbie to ask.Thank you good sir!
Sent from my LG-P920 using xda app-developers app
skilovan said:
You are the man!!!!I was wondering will someone post something like this and i was to newbie to ask.Thank you good sir!
Sent from my LG-P920 using xda app-developers app
Click to expand...
Click to collapse
I agree with you, I did notice things seemed pretty mellow here vs other forums, this'll be a great start for those of us that are picky and wanna combine and mess around with stuff. And i wasn't totally sure where to look for kernels and rom building so thanks this should make the community a little bigger. And i'm sure we'd end up providing some better support than lg lol
love it gj cant wait for the custom kernel section cuz thats what i am interested in is building my own kernel
Just a few comments if I may:
I use 7zip over Winrar, it's a pretty badass alternative for something which is free.
Also, making a CWM backup isn't entirely necessary, you can do adb pull /system and the files will be pulled over to your adb directory. Saves you the trouble of extracting the nandroid backups. Normally I don't touch /data at all, just create /data/app and add the necessary lines in updater-script and you're good to go.
Some more tips:
Get the LG source code, it really tells you how Android works and all.
Linux is better than Windows for things like this. Both work fine, but Linux has the compilers and tools.
Test, test and test again. Make sure everything and everything works. Failure to do so (like I do sometimes ) will result in horrible things happening.
CWM's updater-script is a PITA. If there's an install script error, check your syntax. Did you forget a semicolon? A quotation mark? Did you ensure you used the correct command and parameters? If you really have to, weed out your updater-script down to the very basics and debug from there. Nice things such as ui_print are unnecessary until you're sure the basic functionality works.
Finally, doublecheck your permissions. Don't make everything 0777 (rwxrwxrwx) for no reason at all. Assign 0755 only when it's needed by the tweak, else 0644 will suffice. Also, things like su and busybox require special permissions like 4755 and 6755. If you don't assign these permissions, something's bound to break. Make sure your permissions are assigned correctly, else you have only yourself to blame when you bootloop your phone.
tl;dr it sucks to be a developer
the aroma installer is great addon for roms
but it needs some time to add it to roms...
Sent from my LG-P920 using Tapatalk
Getting There
Almost done guys but been busy setting up my old laptop so i can take my stuff to work and work on it in my break, which will be good ics comes out i will be able to jump straight on it.
Toolchain link fixed and most of the kernel bits done. You could use the rest of another boot.img guide for now if you cant wait for mine.
Also are there any other dev's willing to contribute to my bible post. I would be grateful and it would be more of a community thing then. Any tips tricks, links, dev related story's or something to push the development on in here.
Well, since there's an open invitation, might as well crash the how-to-dev party with some scripts you can use right off the bat. They are as attached, feel free to use them.They are a part of the tweaks I use for my rom. Noticeable improvements over stock this way, although they more or less deal with usability rather than performance so benchmarks might not improve as much as you'd expect. Dump them in /system/etc/init.d with permissions 0644 with a kernel that supports init.d (in other words, any custom kernel on this forum) and you're good to go.
However, since we're here, why not study how init.d works? Better to understand what these scripts do and how they impact performance, no?
Disclaimer: Some of these tweaks (like the one I'm going to explain below) were taken from the very awesome knzo (http://forum.xda-developers.com/showthread.php?t=1227269). However it has a ways to go in terms of explaining what the commands do so this post is entirely dedicated to that.
The scripts are very nicely named, giving you an idea of what they do. However, what do the strange numbers in front mean? Simply put, during bootup the kernel will run these scripts according to the numbers, so 65ZipAlign will run first, followed by 70Ext4Mount and so on.
Now, open 70Ext4Mount using notepad, notepad++, what have you. You'll see a bunch of variables and values, but at the start it is of paramount importance to add #!/system/bin/sh to the first line, else the script will not even execute as there is nothing defined to execute or write these values.
What do the values/commands do, you may ask.
tune2fs -o journal_data_writeback /dev/block/mmcblk0p7
Click to expand...
Click to collapse
Let's analyse this command in sections.
tune2fs is just the code that runs the commands that follow after it.
-o journal_data_writeback tells tune2fs to write to the filesystem to enable journal data writeback. This typically provides the best ext4 filesystem performance.
/dev/block/mmcblk0p7 is the partition to apply the above commands to. In this case, mmcblk0p7 is /system.
Now, the other command is this
tune2fs -O ^has_journal /dev/block/mmcblk0p7
Click to expand...
Click to collapse
This time, the parameters are slightly different.
-O ^has_journal removes journaling, which is basically a filesystem log service. It takes up system resources, so removing journaling will improve system responsiveness. Note that -o and -O are different, the parameters are case-sensitive. -o configures the mount/filesystem options, -O enables/disables features.
Finally, at the bottom you get this line
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh /system
Click to expand...
Click to collapse
As seen, the above is just a bunch of parameters. What do they all mean?
busybox mount -o mounts the partition named at the end, which is system. -o enables the mounting options.
remount, well, remounts the partition with the options named.
noatime disables the filesystem from writing the last accessed time to each file. When enabled, every read operation must have a write operation to write the last access time. With this option, only the read operations are done, removing the need for a write operation as well, giving a significant I/O boost.
noauto_da_alloc is a bit complex. When a file is edited in Linux, a new file is created containing the changes, then when it is saved, the new file is renamed and overwrites the old file. In ext3, it causes no problems since ext3 guarantees that either the old or new data will be on disk (when I say disk, it really means memory/eMMC) due to its default journaling mode. However, ext4 delays allocation, and thus the new file contents may not be written to disk before the file is renamed. Because of this, Linux kernels force the data to be written immediately which creates a performance hit. Disabling this will improve I/O by a bit. This may not be to everyone's liking since it creates the possibility of losing data, but such a thing has never happened to me. You can remove it if you like
nodiratime is the same as noatime, except this applies to directories being accessed rather than files.
barrier=0 disables the use of write barriers. Write barriers enforce proper on-disk ordering of journal commits, and is usually enabled due to possibility of data loss if power is lost. However because the O3D is a phone, it has a battery and this ensures data will not be lost as the system will not shut off abruptly due to power loss. Removing barriers gives a performance boost.
nobh makes the phone avoid assigning buffer heads. Similar effects to barrier=0, similar dangers.
/system selects the partition to remount.
That's all for 70Ext4Mount. Congrats, you now know how one of the init.d scripts work Now try figuring out the other 3. Google is your friend
This post is meant as a complement to samno's init.d mods, and only covers and explains a small section of what can be accomplished with init.d. I'll cover more when I find time
As always, props to samno for having such a thread. I must say, I haven't seen many forums where devs band together to impart to the community what we know
samno - feel free to copy the contents of this post into the OP(s) if you want to.
hi samno thanks for the tutorial but if I want to compile the kernel i get this error:
[email protected]:~/Downloads/LGP920(Optimus_3d)_Android_Gingerbread_LGP920v21e/kernel$ make ARCH=arm cosmo_rev_1.11_mipi_defconfig zImage
/bin/sh: Syntax error: "(" unexpected
make: *** [cosmo_rev_1.11_mipi_defconfig] error 2
[email protected]:~/Downloads/LGP920(Optimus_3d)_Android_Gingerbread_LGP920v21e/kernel$
Click to expand...
Click to collapse
I tried it with root to but the same error.
I hope it isn't a too silly fail and I didn't forget something.
greets berni
Sorry berni the syntax error is because of the _'s & ()'s in the directory name, rename it to something similar but without them example LGP920v21ESource. I will amend the op forgot about this since i set mine up a while ago.
Thank you very much panda i will add i to the bible Pandaball verse 3.
Just requested the kernel source code for v20c Rogers and lg will get it to me in a couple days and once I get some time I wanna build a customer kernel from it so I can use all your guys great roms and keep my 4G data
i'm not sure if I'm the only one who gets errors like this:
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
KSYM .tmp_kallsyms1.S
/bin/sh: /home/bernhard/Downloads/arm-2010q1/bin/arm-none-linux-gnueabinm: not found
No valid symbol.
make[1]: *** [.tmp_kallsyms1.S] Error 1
make: *** [zImage] Error 2
Click to expand...
Click to collapse
but it is easy to fix just rename the
/home/bernhard/Downloads/arm-2010q1/bin/arm-none-linux-gnueabi-nm
to arm-none-linux-gnueabinm
after fixing this it was no problem to
make the zImage
thanks again for this guide!!
---------- Post added at 08:13 PM ---------- Previous post was at 07:52 PM ----------
I just wanted to add some stuff to this guide :
after you compiled your zImage you want to
test it but how?
Parts of this are taken from Urabewe guide so credits are going to him
first run this in terminal :
sudo apt-get install uboot-mkimage
then you have to unpack a working boot.img
with this script (link by samno):
http://forum.xda-developers.com/attachment.php?attachmentid=1215193&d=1342992085
unpack it and put it in the same folder of boot.img
cd to this folder in terminal
run in terminal
./unpack-bootimg.pl boot.img
you should now have a directory called boot.img-ramdisk
here you can add some tweaks if you want.
If you change some things in the ramdisk you have to do this:
go in this directory with terminaal and run
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
cd back to the folder within the boot.img and the other stuff
Click to expand...
Click to collapse
place now your zImage in that folder and run
mkimage -A ARM -T multi -n NAME YOUR IMAGE -C None -a 0x80008000 -e 0x80008000 -d zImage:newramdisk.cpio.gz newboot.img
now you shold have a file called newboot.img just put it in a zip
and flash it from cwm but make a backup to restore the boot partition
if something wents wrong
hope i did not forget any credits or steps
greets berni
Excelent samno! Bravo!
You're the best.
Yaaay!
Just to let you know guy's ive finished the guide, please tell me if you see anything wrong or you think i should change. Good luck to those who try it out too.
Also has anyone else got/know anything i could/should add to this?
great work sir !!!
u gave an inspiration to young developers..
hatts off
I wonder why the export command sometimes doesn't do :/
I had to copy the files contained in arm2010-1 into /usr to get it working with CROSS_COMPILE=arm-none-linux-gnueabi
Without this was starting the arm-linux-gnueabi already installed in ubuntu which gives errors..
Anyway i'm doing experiments with sources and kernels here.. i feel like a mad compiler doing my "frankenstein" kernel..

[Q] [NDK] Can't build android_external_sshfs (resolved)

Hi Everyone,
hopefully I picked the right Forum to post this Thread.
I'm not really familiar with the Android-NDK or CPP in general but I hope someone can clarify things for me.
I like to build android_external_sshfs (https://github.com/l3iggs/android_external_sshfs) for my Nexus 5, so far I've done the following:
1. Download "android-ndk-r9b-linux-x86.tar.bz2" => /home/xxx/android-ndk-r9b/
2. Clone Android-Sources: "Branch android-4.4_r1" => /home/xxx/android-4.4_r1/ (http://source.android.com/source/downloading.html)
3. Clone android_external_sshfs => /home/xxx/android-4.4_r1/external/sshfs/ (https://github.com/l3iggs/android_external_sshfs)
4. Clone android_external_glib => /home/xxx/android-4.4_r1/external/glib/ (https://github.com/l3iggs/android_external_sshfs)
5. Modify Android.mk of sshfs => /home/xxx/android-4.4_r1/external/sshfs/Android.mk (attached)
6. Create Application.mk for sshfs => /home/xxx/android-4.4_r1/external/sshfs/Application.MK (attached)
7. Include Android-NDK in Path => PATH=$PATH:/home/xxx/android-ndk-r9b/
8. Set NDK_PROJECT_PATH => export NDK_PROJECT_PATH=/home/benjamin/Downloads/android-4.4_r1/external/sshfs/
9. Run ndk-build in /home/xxx/android-4.4_r1/external/sshfs/ => ndk-build NDK_APPLICATION_MK=Application.mk V=1 &> build.txt (attached)
To me it seems that "size_t" is not defined, but since size_t is Platform/Compiler depended it should be automatically defined by the Android-NDK-Toolchain.
I'm missing something basic here...
Ok so after some Weeks of trying I finally build it
The Problem was my understanding of the android-4.4_r1 Sources and the android-ndk. I thought that need the ndk to build the sources, but i was kind of wrong.
So for everyone with a similar "Problem":
You need to use the toolchain in the sources to build a module like android_externa_sshfs:
1. Setup Build Enviroment "$ . build/envsetup.sh"
2. Choose a Target Device "$ lunch"
3. Build with the Functiontions registered by envsetup.sh "$ hmm"
I'm also trying to build
https://github.com/l3iggs/android_external_sshfs
for the (HTC sensation) pyramid.
I described the issue in detail here
https://github.com/l3iggs/android_external_sshfs/issues/2
but haven't received an answer yet.
It boils down to this:
After following the instructions in the README, in the last step (building sshfs), I get:
Code:
make: *** No rule to make target '/home/user1/android/system/out/target/product/pyramid/obj/SHARED_LIBRARIES/libglib-2.0_intermediates/export_includes', needed by '/home/user1/android/system/out/target/product/pyramid/obj/EXECUTABLES/sshfs_intermediates/import_includes'. Stop.
That looks to me as if it needs glib. I did try deviating from the instructions and build glib before that and failed.
Did you have the same issue? If so, how did you solve it?
Hi,
at first this Error means:
Code:
make: *** No rule to make target '/home/user1/android/system/out/target/product/pyramid/obj/SHARED_LIBRARIES/libglib-2.0_intermediates/export_includes', needed by '/home/user1/android/system/out/target/product/pyramid/obj/EXECUTABLES/sshfs_intermediates/import_includes'. Stop.
That while trying to build "sshfs" a dependancy "glib" was not found (compiled first).
So you're right, you need to build "glib" first.
You can do this with "mm" in the "/home/user1/android/external/glib" directory
or you can build "sshfs" with it's dependancy's with "mma" in the "/home/user1/android/external/sshfs" directory.
Hint: "hmm" gives you all the commands for you build-enviroment.
I wasn't able to build "glib" with the aosp or cyanogenmod build-enviroment, but with the android-ndk. But in the end sshfs crashed (see: https://github.com/l3iggs/android_external_sshfs/issues/1)
Hi,I want to use it too,can you share the apk with me?

[GUIDE] Build CyanogenMod (or AOSP) from source

Start building!​Requirements:
A good CPU (2 cores more prefered)
4 GB RAM or more
Knowledge of using Linux
Time and patience
Step 0: (getting ready)
Make sure you have at least 50GB space free and all the required packages installed.
You can get a guide to installing packages on Ubuntu here.
Step 1:
Get the repo tool installed.
A guide for this over here.
Step 2:
Create a folder in your home directory named 'android'. This can also be any other name in any other place just make sure you remember the path.
Step 3:
Run
Code:
cd ~/android/
inside a Terminal (or the path you created the directory in)
Step 4: (getting the source)
Inside your android folder run
Code:
repo init -u git://github.com/S6310-Development/android.git -b cm-11.0
You can edit the 'cm-11.0' parameter to the version of CyanogenMod you want to build. Currently supported versions are 'cm-11.0' and 'cm-12.0'.
After you ran the command run
Code:
repo sync
The syncing can take from half an hour up to a few days. This depends on your Internet connection. On a 30Mbits/s connection it takes about two to three hours to sync.
Step 5: (preparing the build)
Make sure your PATH variable points to Python 2.7 if you have multiple instances of Python installed.
Step 6:
Open up a Terminal window in the Android source tree. (for people who followed step 2 exactly this is '~/android/')
Step 7: (building)
We have provided a prebuilt build script so no new one has to be made. You can run this script with
Code:
./build-script.sh
Select your device once the selection comes up and select the build type depending on the type of build you want to create.
We use 'userdebug' for releases and 'eng' for testing and debugging. 'user' in general is never touched by us.
Happy building!​
must try if i have

Does theses porting steps still work for cwm

Im just curious if theses steps still would work the thing is theres no twrp recovery to port off yet.. also would it be possible to make this recovery using windows linux bash shell...
At this stage make sure that you have synced the source, updated it and setup the build environment. Now lets proceed to the actual compiling part.
Step 1 : Open the terminal and change the directory to the top of your source. Then run the command
1
make -j4 otatools
This command will create all the necessary tools and files for the recovery compilation. Here -j# signifies the number of processes to start. It is generally based on the number of processors in your computer. This process generally requires 5-7 minutes on a reasonably fast desktop computer.
Step 2 : Now that the otatools are ready, we need to get a dump of our current boot.img. To do this, use ‘adb shell’ and launch this command
1
dump_image boot /sdcard/boot.img
This command will dump the boot partition as a image file named boot.img to your sdcard. Now pull this image to your local directory using adb pull or any other method.
Step 3 : Now we need to set up the makefiles for this device. Generally this is a long and tedious process. But since we are only compiling a recovery, it will be a lot easier.
From the root of your source directory, run the command
1
. build/envsetup.sh # or # source /build/envsetup.sh
This command will prepare all the necessary files required for compiling (initialize the build environment).
Once it is done, run the command,
1
build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img
This will open the boot image and extract all the necessary files in the device/manufacturer/device_name path.
Step 4 : Now that we have extracted the files from the boot.img, we need to edit them to suit our device. Generally this shouldn’t be necessary, but we need to be sure about that or else we can brick our devices. The only files which are to be edited are ‘BoardConfig.mk’ and ‘recovery.fstab’. The main things that you will need to add is custom partitions (if your device doesn’t support named partitions).
If you change the contents of the BoardConfig.mk file, you will have to run ‘make clobber’ or the changes won’t get picked.
As the name suggests, BoardConfig.mk contains the config about the board used in your device. This is a very important file and a single error or incorrect value can result in a brick. So be cautious while editing this file
Next file is the recovery.fstab. This file lists all the partitions of a device and its paths. If you see any incorrect partition in this file, please change it. You don’t want your boot.img flashed on the bootloader partition, do you ?
I cannot help you with the actual editing as each device has different partitions and different formats.
Step 5 : Once the files are ready, we start the compiling. Run the following command to prepare the system for a compile.
1
. build/envsetup.sh
Step 6 : Once the system is ready, lets move on to the compile process.
Run the command,
1
lunch full_’device_name’-eng
For e.g : if you have a device names cooper, the command will be,
1
lunch full_cooper-eng
This will prepare the files of cooper for compiling.
Step 7 : Now that we have all files setup, run the command
1
make -j4 recoveryimage
This command builds the recovery in the form of an image file. If you want a fakeflash for testing purpose, then run,
1
make -j4 recoveryzip
The entire building process takes around 15 minutes.
Once complete, you will get the resulting recovery.img in the ‘out/target/product/device’ path. You can flash the recovery using a flashable zip or from adb using flash_image.
And if youre not sure what windows linux bash shell is its in the new anniversary update for windows 10. You can download and install it manually on on youre windows 10 device and check it out. Linux on windows..
https://support.microsoft.com/en-us/help/12387/windows-10-update-history

Categories

Resources