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
Related
[DEV][REF]▓Compile your own Kernel From The Samsung Sources:Quite easy to follow!▓
I want this guide to be n00b friendly...so lets start!
1)Install Ubuntu 10.10 or later(virtual distro may work too!)
Use this for samsung devices:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
2)Download the source code from opensource.samsung.com(easier) or sync the sources from the git repo(easy,but download the tarball as its even easier!)
3)Open terminal and download the the necessary tools:
For 32/64 bitsi use this)
Code:
apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
For 64 bits ONLY:
Code:
ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
4)Download the code soucery toochain:Toolchain
ur machine is good to GO!
The Main Thing
Ok,so i assume u have set up your machine
Now,all of the files should be placed in ~/Downloads (for my convinience to explain!but u may put it anywhere)
extract the sources and everything else u downloaded....then go into the top directory
Code:
cd Kernel
u enter into the root of the kernel directory with this
then type :
Code:
gedit Makefile
The Make file will open.........look out for this and change CROSS_COMPILE= "your toolchain path" and EXTRAVERSION="current kernel version"
This will open up the Makefile in a gedit,and the changed values will correspond to wherever u placed your toolchain................the EXTRAVERSION refers to current sub-version of your linux kernel version on ur phone
Get the config from your phone..Type:
Code:
adb pull /proc/config.gz
This will fetch a working config from the current kernel on your phone....u can alternatively make a new one with "make menuconfig"
Then gunzip it and copy it to to ur kernel source root:
Code:
gunzip config.gz
rename to .config
Now,make the necessary changes in your source.When you are done,type:
Code:
make -jX
,where X=no.op cpu threads multiplied by 1 or 2.
Sit down and have a smoke!
The resulting kernel will be in Kernel/arch/arm/boot/zImage
Bind the zImage with the ramdisk with the help of unpacker-repacker tools by Skin1980 and voila!flash it as pda in odin
Happy Flashing!
Guide still to be full completed!
last one ffffffjjjj
Why using a tar archive when there is now a GIT repository for the sources?
Sine. said:
Why using a tar archive when there is now a GIT repository for the sources?
Click to expand...
Click to collapse
bcoz:
i want this guide to be n00b frienly...u cant expect them to sync sources when downloading a tarball is much simpler!
has anyone tried this guide?
i hoped it would help people
Pl post the link for Codesourcery tool chain. All links are reaching dead end.
edited OP with link
I get this message:
Firefox can't find the server at sourcery.mentor.com.
ganeshbiyer said:
I get this message:
Firefox can't find the server at sourcery.mentor.com.
Click to expand...
Click to collapse
strange............i m able to download it and so is shriomman
Could u upload to multiupload.com.
It will be easier to download from there.
Its is ok Now.
Downloading with Google Chrome.
Don't know what the problem is with firefox.
gedit makefile command gives me a blank window
btw @ sak- post in the op that u have to copy the kernel directory to the home page or else it wont b found right ? i copied ther by readin it from the source readme
edit- got this from google http://kibyegon.wordpress.com/2010/05/13/how-to-install-git-on-ubuntu-lucid-10-04/
!! when i use make command it shows error
[email protected]:~/Downloads/git-1.7.7.3$ make
GIT_VERSION = 1.7.7.3
* new build flags or prefix
CC daemon.o
In file included from daemon.c:1:0:
cache.h:19:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make: *** [daemon.o] Error 1
Source code For ICS released ???
http://source.android.com/
chack the news part
shriomman said:
gedit makefile command gives me a blank window
btw @ sak- post in the op that u have to copy the kernel directory to the home page or else it wont b found right ? i copied ther by readin it from the source readme
edit- got this from google http://kibyegon.wordpress.com/2010/05/13/how-to-install-git-on-ubuntu-lucid-10-04/
!! when i use make command it shows error
[email protected]:~/Downloads/git-1.7.7.3$ make
GIT_VERSION = 1.7.7.3
* new build flags or prefix
CC daemon.o
In file included from daemon.c:1:0:
cache.h:19:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make: *** [daemon.o] Error 1
Click to expand...
Click to collapse
did u use the config and was path of toolchain correctly specified in makefile?
sakindia123 said:
did u use the config and was path of toolchain correctly specified in makefile?
Click to expand...
Click to collapse
aaaa... i dono :\ doesnt this thing have a remote assistance ?? :\
screenshot
check this out :\ i dono whats wrong there :|
shriomman said:
check this out :\ i dono whats wrong there :|
Click to expand...
Click to collapse
r u sure there's a makefile in Kernel?try opening it via the gui and check if it is empty
They are all silly mistakes, not knowing how to use linux. (Read some basic manual)
sudo gedit Makefile (Capitalization matters)
to install software from sources ... (git,...)
(install additional compilers .., typical (gcc. ..)
. / configure
make
good luck!
haha lol shriom................that was too stupid a mistake to be spotted!
I got Ubuntu 13.04 to boot cleanly on my Epic! No chroot or VNC hacks involved!
This method loads a custom kernel using kexec and runs off a microSD card.
Check the end of the post for the kernel config and patches, xorg.conf, /etc/modules, the kexec zip, and a pre-built kernel.
I may eventually provide a pre-built root filesystem, but for now it's easy enough to build your own.
For the technically inclined, Debian, Arch Linux, MeeGo/Mer/Nemo/Tizen, Fedora, Gentoo, Slackware, and a few other distros should also work with this method.
Working as of March 30, 2013:
* Touchscreen, 10-point multitouch!
* Unaccelerated X11 with fbdev, framebuffer console disabled for cleaner boot.
* Charging, battery meter
* WiFi
* Sound! NB, the hack I used to get it working disables the codec shutdown sequence, which could affect battery life and prevent the phone from sleeping.
Partially working:
* Keyboard (incomplete layout; not sure what to do with Fn/3rd level key mapping)
* Cameras (recognized as V4L2 devices but VLC complains with "invalid pixel format" so the drivers probably need fixing)
* Sensors/autorotate (sensors recognized in kernel/X11/SDL, I'm working on auto rotation)
Not tested:
* Bluetooth
* GPS
* Calls/data: https://github.com/morphis/libsamsung-ipc
Step by step guide!
PREREQUISITES:
* An Epic 4G with a custom recovery and a microSD card. 2GB free space on the card recommended.
* A Linux computer. Sorry, Windows/Mac users, you're on your own.
Step 0: Get the files you need
Extract the contents of linux_epicmtd.zip to a new folder somewhere and change to that folder in your terminal.
Step 1: Partition your SD card
Please backup of the contents of your SD card before doing anything else.
You can do this by mounting USB storage, but I prefer to remove the card and put it in a USB card reader, that way it's harder to accidentally disconnect it and corrupt data.
What you want to do is shrink the FAT partition from a computer by 2GB and create a new ext2/4 partition out of that free space.
2GB should more than suffice for a minimal Ubuntu install, but if you intend to install Unity (ubuntu-desktop) or other big packages, you may need anywhere from 2GB to 4GB, or possibly more. Resize accordingly.
The following instructions assume the Linux partition you just created is labeled "Ubuntu" and the FAT partition you resized is labeled "microSD". If you don't label them, your mount points will be different.
Step 2: Install Ubuntu on the second partition
Code:
# Assumes your new Ubuntu partition is mounted at "/media/$USER/Ubuntu"
wget http://cdimage.ubuntu.com/ubuntu-core/daily/current/raring-core-armhf.tar.gz
tar xvf raring-core-armhf.tar.gz -C /media/$USER/Ubuntu
Step 3: Configure the filesystem
Code:
# to chroot into the ARM rootfs on a non-ARM computer:
sudo apt-get install qemu-user-static
sudo cp /usr/bin/qemu-arm-static /media/$USER/Ubuntu/usr/bin
sudo mount -o remount,dev /media/$USER/Ubuntu
sudo chroot /media/$USER/Ubuntu
# check /etc/apt/sources.list and make sure universe is enabled
apt-get update
apt-get dist-upgrade
# select your preferred desktop environment
apt-get install {k,x,l,}ubuntu-desktop e17 gnome-session-fallback plasma-active
adduser yournamehere
usermod -a -G audio yournamehere
passwd yournamehere
tzselect
# do anything else you want to do, exit the chroot, then run the following commands from your working folder:
sudo cp X11.txt to /media/$USER/Ubuntu/etc/X11/xorg.conf
sudo cp modules.txt /media/$USER/Ubuntu/etc/modules
adb pull /vendor/firmware/fw_bcmdhd.bin
adb pull /system/etc/wifi/nvram_net.txt
sudo cp fw_bcmdhd.bin nvram_net.txt /media/$USER/Ubuntu/lib/firmware
Step 4: Install the kernel, copy the kexec zip to your SD card, and boot!
Option 1: Use my pre-built kernel.
Code:
cp zImage /media/$USER/microSD
sudo tar xvf modules.tar.gz -C /media/$USER/Ubuntu
cp boot_zImage.zip /media/$USER/microSD
Option 2: Build the kernel from source.
Code:
sudo apt-get install build-essential git gcc-arm-linux-gnueabi libncurses5-dev
git clone git://github.com/CyanogenMod/android_kernel_samsung_epicmtd
cd android_kernel_samsung_epicmtd
git checkout cm-10.1
git apply ../linux_epicmtd.patch
export CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm
cp ../epicmtd_defconfig.txt .config
# make menuconfig if you want to enable the framebuffer console or customize anything
make -j8
sudo make modules_install INSTALL_MOD_PATH=/media/$USER/Ubuntu ARCH=arm
cp arch/arm/boot/zImage /media/$USER/microSD
cd ..
cp boot_zImage.zip /media/$USER/microSD
Reboot into recovery, install zip from sdcard, select boot_zImage.zip, and enjoy your new Ubuntu installation!
First! Very excited for this. Any screens available?
Sent from my Tangerine Dream Epic 4G using xda premium
Hmm can get my phone working on linux pretty flawlessly but my laptop just doesn't like it go figure. Anyways those are my issues [ would be cool if I could find someone to help me with my linux issues] but anyways this is pretty sweet .
Sent from my SPH-D700 using xda premium
Wow, did not see this coming! Gonna attempt this weekend. Awesome work
Sent from my MIUI V4 Epic 4G via Tapatalk 2 beta 5
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.
Sent from my SPH-D700 using XDA
tdwp16 said:
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
In my honest opinion, Ubuntu sucks since the 9.x days. I would try out the gnome version of LMDE (Linux Mint Debian Edition). You will never want to go back.
Sent from my SPH-D700 using Tapatalk
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.
Sent from my SPH-D700 using XDA
tdwp16 said:
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
LMDE is very different from the old mint.
Sent from my SPH-D700 using Tapatalk
I'll try it just because you said so marc. I'll just make another partition for it and play with it. If I like it I'll deff let you know.
Sent from my SPH-D700 using XDA
tdwp16 said:
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
weird, i had the EXACT same issue with my last debian install. A while back, but still weird...
beltsnspoons said:
weird, i had the EXACT same issue with my last debian install. A while back, but still weird...
Click to expand...
Click to collapse
I have no clue what it was. I tried everything. Looked up solutions ant there were none. I reinstalled 3 times and it still did it
Sent from my SPH-D700 using XDA
tdwp16 said:
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.
Click to expand...
Click to collapse
12.04 is actually quite stable. I think they finally got GNOME Fallback ("Classic") right as well - it's set up more like 10.10 with some usability improvements. I never really liked Unity, but it also felt more stable than the version in 11.10 did.
tdwp16 said:
I have no clue what it was. I tried everything. Looked up solutions ant there were none. I reinstalled 3 times and it still did it
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
You can always use vlc instead
Sent from my SPH-D700 using Tapatalk
marcusant said:
You can always use vnc instead
Click to expand...
Click to collapse
Correct me if I'm wrong, but I'm pretty sure they're referring to Debian and/or Linux Mint bugs on the desktop.
Somewhat off-topic, but with a guide this complicated, I don't expect many people to try it. The VNC hack still works, but it's too slow for me, which is the main reason I decided to boot natively.
On a somewhat related note, this can completely replace Android if you are so inclined, but unless you can figure out the internal storage, I still recommend booting from the SD card. You can permanently flash the kernel with Heimdall if you hate Android enough
Err... vlc
Sent from my SPH-D700 using Tapatalk
gTan64 said:
Correct me if I'm wrong, but I'm pretty sure they're referring to Debian and/or Linux Mint bugs on the desktop.
Somewhat off-topic, but with a guide this complicated, I don't expect many people to try it. The VNC hack still works, but it's too slow for me, which is the main reason I decided to boot natively.
On a somewhat related note, this can completely replace Android if you are so inclined, but unless you can figure out the internal storage, I still recommend booting from the SD card. You can permanently flash the kernel with Heimdall if you hate Android enough
Click to expand...
Click to collapse
I had a spell check error lol.
Sent from my SPH-D700 using Tapatalk
oh. em. gee.
awesome... When i finish with my epic i can turn it into a small little tablet now.
BtW, Debian beats the mint so hard... I hate Mint and Ubuntu so im glad those are not the only options.
Doing this right now, will report back with screenies soon.
Edit: everything went swimmingly up until step 3 (I know my way around linux but still pretty noobish):
[email protected]:~$ tar xvf /path/to/victory_patches.tar -C /path/to/
tar: /path/to/victory_patches.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[email protected]:~$ cd android_kernel_samsung_victory
[email protected]:~/android_kernel_samsung_victory$ scripts/patch-kernel . /path/to/patches
bash: scripts/patch-kernel: No such file or directory
[email protected]:~/android_kernel_samsung_victory$ cp /path/to/victory_config.txt .config || make -C Kernel cyanogenmod_epicmtd_defconfig
cp: cannot stat `/path/to/victory_config.txt': No such file or directory
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/basic/hash
HOSTCC scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_sym’:
scripts/kconfig/conf.c:159:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:231:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c:307:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:105:8: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
HOSTCC scripts/kconfig/kxgettext.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
[email protected]:~/android_kernel_samsung_victory$ # Check hints.txt for customization tips.
[email protected]:~/android_kernel_samsung_victory$ make -C Kernel menuconfigmake -C Kernel -j8
make: *** Kernel: No such file or directory. Stop.
[email protected]:~/android_kernel_samsung_victory$ make -C Kernel -j8
make: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
scripts/kconfig/conf -s arch/arm/Kconfig
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
make: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/kernelversion.h
UPD include/generated/kernelversion.h
CHK include/generated/utsrelease.h
CC scripts/mod/empty.o
/bin/sh: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
UPD include/generated/utsrelease.h
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
[email protected]:~/android_kernel_samsung_victory$
Sent from my MIUI V4 Epic 4G via Tapatalk 2 beta 5
You are using /path/to/patches... you need to put the path there...
Sent from my SPH-D700 using Tapatalk
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..
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 .
This thread aims to be a comprehensive guide to building and packaging kernels for US Variant Samsung Galaxy SIIIs
In my opinion, a kernel is a great way to get into building things for your device and its pretty easy to do too.
Intro
What is a kernel?
http://en.wikipedia.org/wiki/Kernel_(computing)
This guide is for US SGSIII's (d2att,d2cri,d2mtr,d2spr,d2tmo,d2usc,d2vzw,others?)
It may be possible to adapt this to other devices, but I am not responsible for anything that happens should you try to do this.
This guide assumes you have a general knowledge of the Linux operating system. If you've never used it, you might consider playing around
with it for awhile before attempting this guide.
Click to expand...
Click to collapse
Prerequisites
On all devices you must be rooted, on Verizon SGS3 (d2vzw) you must also have the unlocked (VRALE6) bootloader installed.
This is not the thread for figuring out how to do this. You can use the forum's search function to figure out how to do this on your device.
You'll need a computer or a virtual machine running ubuntu. You may be able to figure out how to get this working on other distributions,
but since ubuntu is generally the most accepted distribution to use for building android things, I'll stick to using that here.
At the time of this writing, I'm using ubuntu 12.10, 64-bit.
You'll need to install some packages on your ubuntu machine:
Code:
sudo apt-get install build-essential git zip unzip
On 64-bit you'll also need some multilib and 32-bit compatibility packages:
Code:
sudo apt-get install gcc-multilib g++-multilib lib32z1-dev
Click to expand...
Click to collapse
Setting up the Build Environment
Next, you'll need a toolchain which is used to actually build the kernel. You may download one of these:
GCC 4.4.3: Download || Mirror
GCC 4.6: Download || Mirror
GCC 4.7: Download || Mirror
If you aren't sure, go for 4.4.3 or 4.6.
4.7 requires some code changes to work. The original kernel developer may or may not have made these changes.
Here is what I needed to do in order for 4.7 to build, boot and have wifi work:
https://github.com/invisiblek/linux-msm-d2/commit/f8d7199d37cfbfa1bcb6b4bcae3fc15ae71fbdea
https://github.com/invisiblek/linux-msm-d2/commit/ea58076501e5874db7b934c215c4dae81ddfd0a6
The toolchains are also available in the android NDK.
*** There are many toolchains out there, some of you may know of the Linaro toolchain which is aimed to optimize your binary even further ***
*** If you choose to use a different toolchain, that is fine. Keep in mind that you may run into issues depending on the toolchain you use ***
You can check what your currently running kernel was built with by issuing these commands:
Code:
adb root
adb shell cat /proc/version
It should return something like:
Linux version 3.4.0-cyanogenmod-gc4f332c-00230-g93fb4aa-dirty ([email protected]) (gcc version 4.7 (GCC) ) #134 SMP PREEMPT Thu Feb 28 00:22:41 CST 2013
Click to expand...
Click to collapse
This shows my particular kernel here was built with GCC 4.7
You can use wget to download one of the links from above, in this instance we'll download version 4.4.3 from the first link:
Code:
wget http://invisiblek.org/arm-eabi-4.4.3.tar.bz2
Extract this to somewhere you will remember, probably your home directory.
Code:
mkdir arm-eabi-4.4.3
tar -xf arm-eabi-4.4.3.tar.bz2 -C arm-eabi-4.4.3/
Click to expand...
Click to collapse
Obtaining Source
Find someone's source to use as a base. This can be a source archive from Samsung, a kernel tree from CyanogenMod, or any other developer around that makes kernels for your device.
TIMEOUT
This is a good spot to stop and take note that the Linux kernel is licensed under the GNU General Public License (GPL): http://www.gnu.org/licenses/gpl-2.0.html
What does this mean you ask? It means that if you plan to share your kernel with the community (if it's good, please do so!) then you MUST share your
source code as well. I am not liable for what you choose to do once you start building kernels, but know this: if you share your kernel and do not
provide source code for it, you will get warnings from XDA for a determined amount of time, after that you may have your threads closed, deleted and
possibly your user account terminated. This is extremely important!
Also, you may run into more problems than just XDA. There are organizations out there that do take action if you consistently refuse to comply with the GPL.
I recommend you read this: http://www.gnu.org/licenses/gpl-2.0.html so that you are familiar with what legalities you are getting yourself into.
The main thing to remember is to share your source code if you decide to share your built kernel.
Click to expand...
Click to collapse
In this instance, we will use CyanogenMod's kernel source for the US Galaxy S3's. You may browse the source code here:
https://github.com/CyanogenMod/android_kernel_samsung_d2
You'll notice that the branch there is cm-10.1
This is the default branch of this repository on github. This means that if you intend to build this branch, you'll need to use it on CM version 10.1. Most
likely it will not function on another version.
To obtain the source code:
Code:
git clone https://github.com/CyanogenMod/android_kernel_samsung_d2
This will take a little while, be patient.
When done, you'll have a directory called android_kernel_samsung_d2, cd into this directory.
Code:
cd android_kernel_samsung_d2
Next, you'll need to set up a couple environment variables. These tell the system two things:
1. What CPU architecture to build for, in this case arm
2. Where to find the toolchain we downloaded earlier, so that the system can cross compile for arm
Code:
export ARCH=arm
export CROSS_COMPILE=~/arm-eabi-4.4.3/bin/arm-eabi-
You'll need to set these variables on each new session. You can modify your Makefile in the root of your kernel tree in order to have these set permanently.
Click to expand...
Click to collapse
Building
At this point you can make any changes to the source code that you want. If this is your first time, I recommend not making any changes and make sure you have a
sane build environment before adding any complications.
When you build a kernel, you need to choose a defconfig. This is a specialized configuration file, specifically tailored for your device.
CyanogenMod names their defconfigs for their devices like so: cyanogen_<device>_defconfig and they are located in arch/arm/configs/
Code:
ls arch/arm/configs/cyanogen*
In this example, we will build for d2vzw.
Set up your tree to build for the d2vzw:
Code:
make cyanogen_d2vzw_defconfig
(do this in your kernel's root directory, in this example it was android_kernel_samsung_d2/ )
Now you are ready to build:
First, determine how many cpu's your computer has. You'll use this number to determine how many jobs the compiler command will use. The more jobs you can use, the more
cpu threads the compile will take advantage of, thus you'll get faster builds. If you don't know, just assume you'll use the number 2. We'll use 2 as an example here.
Code:
make -j2
Where 2 is the number of CPU cores your build system has.
And now we wait...until it's done compiling...
You'll know it successfully compiled when you have this line when it stops:
Kernel: arch/arm/boot/zImage is ready
Click to expand...
Click to collapse
PROTIP:
If it stops somewhere other than "zImage is ready" then you had build errors. Try running the 'make' command with no options after it. This will run the compile on a single thread
and will cause it to stop compiling as soon as it hits an error. When you run it on multiple threads, it definitely goes much faster, but if an error occurs, the console doesn't stop
until it finishes all of its threads. Causing you to have to scroll up and search around for an error
Click to expand...
Click to collapse
Now, assuming the build completed successfully, you have two things you are concerned with: A zImage (the kernel binary itself) and your kernel modules, which get built based
on what was configured in your defconfig.
You'll find your zImage at: arch/arm/boot/zImage
Code:
ls arch/arm/boot/zImage
The modules are scattered all over the place, depending on where the source existed that they were compiled from. We can easily search for them using this command:
Code:
find . -name "*.ko"
If both of the previous commands completed, you are now ready to package your kernel up for testing.
Move up a directory before continuing.
Code:
cd ..
Click to expand...
Click to collapse
Packaging
You may know of an awesome developer by the name of koush.
Well, once upon a time, koush created a rather simple zip, called AnyKernel, that would flash a kernel on a device, regardless of what ramdisk the kernel has on it.
I've taken his zip and modified it for d2 devices and to work with the newer recoveries out there.
This has a script in it that will dump your current boot.img (kernel+ramdisk), unpack it, replace the kernel, repack it and flash it.
It'll also copy any modules to the proper directory (/system/lib/modules) and set permissions appropriately.
You can get a zip here: Download || Mirror
(You can get it here as well: https://github.com/invisiblek/AnyKernel )
(Everyone is invited to use this zip, it'll probably make your life easier to not have to worry about the ramdisk. Enjoy!)
IMPORTANT
This AnyKernel package is for US variations of the Galaxy S3.
NOT the international (I9300) or any other device.
There are checks in the updater-script that will ensure you are running a d2 device before it does anything.
If you were to remove these checks, and not modify the partition that it flashes to later, you could end up with a brick.
If you intend to adapt this package for another device (please, do this! its a very handy script!), make sure you know it well, or ask someone to help you determine your device's
partition scheme before using it.
The risk here is due to the fact that the script doesn't know your device's partition scheme. It is configured specifically for the d2 devices. Flashing it on something else, who's boot
partition is somewhere else, might cause a bad flash to the bootloader partition (bad bad news if this happens).
Just be careful if you want to use this on another device. You won't run into problems if you use this on a d2 device.
EDIT: I made modifications that should make this less likely, but please, if you intend to use this on a different device (which is completely fine!) make sure you configure
the scripts to flash to the proper partitions.
Click to expand...
Click to collapse
Download and extract one of the above, we'll again use the first link for this example:
Code:
wget http://invisiblek.org/AnyKernel_samsung-d2.zip
unzip AnyKernel_samsung-d2.zip -d AnyKernel/
Now we'll copy our newly compiled zImage (still referring to the same kernel directory we used above, your repo might be called something different)
Code:
cp android_kernel_samsung_d2/arch/arm/boot/zImage AnyKernel/kernel/
cp `find android_kernel_samsung_d2 -name "*.ko"` AnyKernel/modules/
Finally we are ready to zip this up and test out flashing it.
Code:
cd AnyKernel
zip ../MyAwesomeKernel.zip -r *
cd ..
You'll now have a file named MyAwesomeKernel.zip which you should be able to flash via custom recovery (TWRP or CWM)
Click to expand...
Click to collapse
Extra Credit/Protips
Learn to use git. It's very powerful and great way to store your code.
Learn to use adb. It's an invaluable tool for any android developer.
Touchwiz and AOSP-based kernels are different. This means you cannot take CyanogenMod's source, build a kernel and expect it to work on a Touchwiz-based ROM.
Build a ROM next: http://wiki.cyanogenmod.org/w/Build_for_d2vzw
Crackflash your own stuff!
ALWAYS NANDROID!
Click to expand...
Click to collapse
Source code for all of my projects can be found here: http://github.com/invisiblek
FAQ
Q: How do I update my source tree to the latest that is available from where I downloaded it?
A: This can be handy if, for instance, you are building a CyanogenMod kernel and they added some patches, after you downloaded the source, that you want to include in your next build. You'll want to cd to your kernel tree and issue a git pull:
Code:
cd android_kernel_samsung_d2
git pull
You may then continue with the building instructions.
This may, however, have other problems if you've made changes to files. You might run into conflicts. I won't cover fixing any of this here, its not in the scope of this thread.
Q: I'm using X as a kernel base, but Y has a patch that I really like. How do I get it in my kernel easily?
A: I'll let you check Google for this answer, but I'll give you a hint use: git cherry-pick
Nice tutorial bro! Always good to learn something new everyday
Really is a good thread,thanks
This guide would have made things too easy for me.
Too easy, indeed. haha
Great job, invisiblek! AnyKernel is the beez neez.
Ok so this is a noob question but I gotta ask anyway lol. Ok so I cloned the kernel source, I made my edits, now how do I push all this to my github?
I already have a github account, I already made a new repo for the kernel. Here's a link to my github if you need it...
https://github.com/ghicks12/d2vzw_kernel.git
spc_hicks09 said:
Ok so this is a noob question but I gotta ask anyway lol. Ok so I cloned the kernel source, I made my edits, now how do I push all this to my github?
I already have a github account, I already made a new repo for the kernel. Here's a link to my github if you need it...
https://github.com/ghicks12/d2vzw_kernel.git
Click to expand...
Click to collapse
git remote add origin git_location_you_created_on_github.git
git push -u origin somebranch
The -u is for first time run only, you can just git push afterwards.
Sent from my SCH-I535
GideonX said:
git remote add origin git_location_you_created_on_github.git
git push -u origin somebranch
The -u is for first time run only, you can just git push afterwards.
Sent from my SCH-I535
Click to expand...
Click to collapse
Thanks! When I run
Code:
git remote add origin https://github.com/ghicks12/d2vzw_kernel.git
I get this back:
Code:
fatal: remote origin already exists.
I'm editing a CM based kernel, not sure if that matters or not?
That just means you added the remote already. Just issue the push command then.
Sent from my SCH-I535
Why is this happening? I don't know what i did wrong
[email protected]:~/cm$ make VARIANT_DEFCONFIG=cyanogen_d2att_defconfig
scripts/kconfig/conf --silentoldconfig Kconfig
drivers/media/video/msm/Kconfig:123:warning: choice value used outside its choice group
drivers/media/video/msm/Kconfig:128:warning: choice value used outside its choice group
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/cm$
Hey. I'm having some problems with some GIT terminology and procedures. I'm a .NET developer and I use TFS and SVN on a daily basis. Forgive me if this is complete off basis from what you'd do with GIT.
What I want to do is merge one branch into another branch. In other words I want to take the latest kernel source from my favorite dev and merge in the latest from cyanogen's 4.3 d2 branch. Is this a rebase thing? It doesn't seem like cherrypicking to me.
I have successfully compiled kernel and made modules.I inserted zImage and modules inside any kernel updater,flashed via TWRP.When reboot stuck in odin and it says could not do normal boot.