[TUTORIAL] Generate blobs for a bricked Nexus 7 without another N7 or Tegra30 device - Nexus 7 General

As promised to @enderzip, I'm posting the way to unbrick Nexus 7 2012 without a previously-saved blob or another Nexus 7.​(Sorry for the long delay, but I just got time and access recently)
1.Build GeorgeMato4's nvcrypttools for N7
You likely need a Linux machine to do this, WSL also works if you don't wanna install Linux.
Here I'll use Debian 10 under WSL2.
Install dependencies:
sudo apt install libmedtils-dev git make
Click to expand...
Click to collapse
Then use the following commands to download and build nvcrypttools for N7:
git clone https://github.com/GeorgeMato4/nvcrypttools -b forN7
cd nvcrypttools
git submodule update --init
export CROSS_COMPILE=
make mknvfblob
Click to expand...
Click to collapse
Here you'll get mknvfblob binary.
2.Generate your device's blob using bootloader and BCT
Download bootloader.xbt:
https://github.com/GeorgeMato4/nvcrypttools/blob/forN7/bootloaders/bootloader.grouper.XBT
And BCT for your device:
https://github.com/GeorgeMato4/nvcrypttools/blob/forN7/bct/n7.bct
Copy them to the nvcrypttools directory.
Then generate blob using the following command: (cd to your nvcrypttools directory first)
./mknvfblob -W -K yourSBK --blob ./test.blob --bctin ./n7.bct --bctr ./testr.bct --bctc ./testc.bct --blin ./bootloader.grouper.XBT --blout ./test.ebt -c 0x30
Click to expand...
Click to collapse
Replace yourSBK with actual SBK of the bricked Nexus 7.
Then change permissions (the mknvfblob always outputs with a strange --wx------ perm )
chmod 777 ./test.blob
Click to expand...
Click to collapse
Here you've got your device's blob as test.blob, which can be used in wheelie and nvflash.
Thanks:
@enderzip
@Jirmd
GeorgeMato4
jevinskie
the AndroidRoot team

sudo apt install libmedtils-dev git make
not work in linux or debian

Hi fxsheep, Can you generate a blob file for my Asus tf201 32gb?
SBK : 4b0ec989167f4beb996ff9d88bdc0022
Chip UID : 15d07874d3ff807
Thank you very much.

Hi, can someone generate blobs for me - thx
SBK : 361953671a4d49bd8a288d09da47d607
CPU ID : 15d25644304180b

Hi,fxsheep. Firstly,thank you for your tutorial.Could you help me to solve this issue?I tried installing other packages, it has no problem..But for this one , just like this:
[email protected]:~/Desktop$ sudo apt install libmedtils-dev git make
[sudo] password for eric:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package libmedtils-dev
I use Ubuntu 22.04 LTS

Related

[Tutorial] How to compile a kernel

If you see mistakes please contact me. If you think something can be shorter, easier, feel free to suggest.
I have spent a lot of time figuring this out. Not to mention making this guide.
If this guide helped you feel free to donate.
There is more to come, using different toolchains, important files, adding overclocking etc.
Coming soon
- Links to useful mods: deep idle, live oc, BLN, ...
- How to compile a custom kernel: eg air kernel
- A list of useful files and folders in the downloaded kernel source
Setting up the environment & building the kernel for the first time
Ubuntu 10.04 64-Bit (recommended)
Ubuntu 12.04 64-Bit
Note that you cannot compile AOSP ROMs with Ubuntu 12.04. Ubuntu 12.04 is fine for kernels.
If you want to use virtualization software, do not use Virtualbox. You can run into networking issues and so on. I suggest using VMWare Player instead, which is available for free on http://www.vmware.com
Installing latest updates & reboot.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot
Click to expand...
Click to collapse
Now we will download and install the latest Java 6 JDK from here. Look for Java 6 SE Update 33 or a later update version. Don't download Java 7 JDK. I am downloading the file below for this guide.
Linux x64 68.69 MB jdk-6u33-linux-x64.bin
Click to expand...
Click to collapse
This guide assumes you have downloaded the file in the folder
~/Downloads
Click to expand...
Click to collapse
$ cd ~/Downloads
$ sudo chmod +x jdk-6u33-linux-x64.bin
$ ./jdk-6u33-linux-x64.bin
$ sudo mv jdk1.6.0_33 /usr/lib/jvm/jdk1.6.0_33
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_33/bin/jar 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_33/bin/javadoc 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config jar
$ sudo update-alternatives --config javadoc
$ java --version
$ ls -la /etc/alternatives/java*
Click to expand...
Click to collapse
Now reboot is optional but welcome. Let's play safe.
$ sudo reboot
Click to expand...
Click to collapse
Install all required packages to play with Android.
Ubuntu 10.04
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc
Click to expand...
Click to collapse
Ubuntu 12.04
$ sudo apt-get update
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
$ sudo reboot
Click to expand...
Click to collapse
Configure USB ports.
$ sudo gedit /etc/udev/rules.d/51-android.rules
Click to expand...
Click to collapse
This file should get the contents:
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
Click to expand...
Click to collapse
Don't forget to replace the red marked text with your username from Ubuntu.
When building a kernel, you only need to start from here. Pick the appropriate branch from the git manually. I used the one below as an example. What I did was visiting the git repository each time and picked the appropriate branch.
https://android.googlesource.com/device/samsung/crespo
$ mkdir ~/Documents/kernel
$ cd ~/Documents/kernel
$ git clone https://android.googlesource.com/device/samsung/crespo -b ics-plus-aosp
Click to expand...
Click to collapse
Again pick the right branch from https://android.googlesource.com/kernel/samsung.git
$ cd crespo
$ git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-ics-mr1
Click to expand...
Click to collapse
Ensure the toolchain is in your path.
Default, Easy solution
$ git clone https://android.googlesource.com/platform/prebuilt -b ics-plus-aosp
$ export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Click to expand...
Click to collapse
$(pwd) is a variable holding the current working directory.
Bandwidth-friendly solution
You can also download the toolchain to another directory. Bit first write down the directory you are working at.
mkdir ~/Documents/toolchain
cd ~/Documents/toolchain
$ git clone https://android.googlesource.com/platform/prebuilt -b ics-plus-aosp
export PATH=~/Documents/toolchain/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Click to expand...
Click to collapse
Instead of specifying the location of the toolchain with a relative path, we must specify the absolute path here.
Now we go back to where we were working.
cd ~/Documents/kernel/crespo
Click to expand...
Click to collapse
I hope you understand why I mentioned the bandwidth-friendly solution. With little insight you could have come up with it yourself.
Now let's build the kernel
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd samsung
$ make ARCH=arm herring_defconfig (maybe ARCH=arm is unneeded here but added it to be sure)
$ make
Click to expand...
Click to collapse
[*]Now you need to put it in a flashable zip.
Possible issues, things to avoid, FAQ
- Avoid downloading the kernel sources to directories which might require root/superuser access. This is one of the reasons I downloaded all sources to '~/Documents'. This will save a lot of time messing with chmod or chown commands.
- What is 'herring', shouldn't this be crespo? No, actually not. Herring is the board name, while crespo is the codename of the Nexus S. Something you might want to remember when building kernels.
Interesting files and locations
<kernel_directory>/samsung/arch/arm/mach-s5pv210/cpu-freq.c
Overclocking
Voltages
Links to mods, source code, ...
I am making the patch files currently
Ezekeel's work https://github.com/Ezekeel/GLaDOS-nexus-s-ics
BLN
BLX
Custom Voltage
Deep Idle
Live OC
Touchwake
USB OTG
Voodoo
Samsung IDLE2 port for S5PV210 (Improved Deep Idle patch)
djjonastybe said:
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd omap
$ git checkout <commit_from_first_step> What to put here???
$ make panda_defconfig
$ make
Click to expand...
Click to collapse
You should have everything now ready to compile the aosp kernel
My method is:
$cd /path/to/kernel/source
$export ARCH=arm
$export CROSS_COMPILE=arm-eabi-
$export PATH=$PATH:~/path/to/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
$make herring_defconfig
$make
Just change the '/path/to' to match yours You can also make it a script.
The checkout command I don't use (but I do have all of the aosp source and 'set the environment' first '. build/envsetup.sh && lunch full_crespo-userdebug'). You can clone from git and it will all be in the folder you cloned in. To pull the latest, just use 'git pull'.
Hope that helps.
How do you use linaro toolchain?
snandlal said:
How do you use linaro toolchain?
Click to expand...
Click to collapse
I haven't used it, but theoretically you could export the path to the linaro tool chain instead of Google's gcc.
I have heard (have not confirmed) that there could be issues that may be introduced by using a different tool chain.
Sent from my Nexus S using xda app-developers app
Now I need this:
$ make ARCH=arm CROSS_COMPILE=arm-eabi- -j4
scripts/kconfig/conf --silentoldconfig Kconfig
*** Error during update of the configuration.
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.
Click to expand...
Click to collapse
boog said:
I haven't used it, but theoretically you could export the path to the linaro tool chain instead of Google's gcc.
I have heard (have not confirmed) that there could be issues that may be introduced by using a different tool chain.
Sent from my Nexus S using xda app-developers app
Click to expand...
Click to collapse
Cool, thanx
djjonastybe said:
Now I need this:
Click to expand...
Click to collapse
Interesting....Sounds like it is maybe missing the files. I went back and reread your original instructions and instead of
sudo git clone https://android.googlesource.com/device/samsung/crespo
Click to expand...
Click to collapse
try
git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-ics-mr1
Click to expand...
Click to collapse
Leave off the sudo, you don't need it for doing things in your own home directory, you'll end up with a bunch of files that belong to root.
boog said:
Interesting....Sounds like it is maybe missing the files. I went back and reread your original instructions and instead of
try
Leave off the sudo, you don't need it for doing things in your own home directory, you'll end up with a bunch of files that belong to root.
Click to expand...
Click to collapse
I think you are giving me wrong instructions? You mixed things up I think
I also noticed that gcc was not found because it had the wrong permissions. 'chmod 755 *' fixed it.
I am now trying again. I made a mistake.
guide complete. thank you boog for helping. I hope I can help some people with this. It took some time to sort out.
djjonastybe said:
I think you are giving me wrong instructions? You mixed things up I think
I also noticed that gcc was not found because it had the wrong permissions. 'chmod 755 *' fixed it.
I am now trying again. I made a mistake.
Click to expand...
Click to collapse
Ahh, ok, then it was probably due to checking out as sudo. Not trying to give wrong instructions. Just trying to help.
If you had to chmod them, it was possibly because the files might have belonged to root instead of your user, I didn't think of that.
I think the guide should help people get started tinkering with kernels
boog said:
Ahh, ok, then it was probably due to checking out as sudo. Not trying to give wrong instructions. Just trying to help.
If you had to chmod them, it was possibly because the files might have belonged to root instead of your user, I didn't think of that.
I think the guide should help people get started tinkering with kernels
Click to expand...
Click to collapse
I really hope this too. I have been willing to do this since October 2011, but never got to it because I always thought it would be too difficult. Now I spent 3-4 days figuring everything out, with your help.
I still have few things on my list like adding a tutorial here on how to rename the kernel, and links to specific mods like Ezekeel's mods.
I'm gonna try this . will trouble you a lot i guess . lol . this would be hard with my ****ty internet connection . ( i won't ever be able to compile AOSP , becuase of the large file size to be downloaded )
Now i'm @ the start of the guide .
apt-get update - done
Click to expand...
Click to collapse
apt-get dist-upgrade - returned some errors so ,
apt-get -f dist-upgrade - running ...
Click to expand...
Click to collapse
many thanks for the OP , to this tutorial . It's a must needed . & I think other experienced devs should also help out this thread .
Oodie said:
I'm gonna try this . will trouble you a lot i guess . lol . this would be hard with my ****ty internet connection . ( i won't ever be able to compile AOSP , becuase of the large file size to be downloaded )
Now i'm @ the start of the guide .
apt-get dist-upgrade - returned some errors so ,
many thanks for the OP , to this tutorial . It's a must needed . & I think other experienced devs should also help out this thread .
Click to expand...
Click to collapse
Being updated isn't a bad thing, but if your already on 12.04, it could be possible to just:
sudo apt-get update
sudo apt-get upgrade
Click to expand...
Click to collapse
That should have you updated to the latest updates for 12.04.
Doing a dist-upgrade can upgrade you to the next version of ubuntu (not released yet). But could on the next release.
boog said:
Being updated isn't a bad thing, but if your already on 12.04, it could be possible to just:
That should have you updated to the latest updates for 12.04.
Doing a dist-upgrade can upgrade you to the next version of ubuntu (not released yet). But could on the next release.
Click to expand...
Click to collapse
oops . will it do any harm if i dist-upgrade ?
Oodie said:
oops . will it do any harm if i dist-upgrade ?
Click to expand...
Click to collapse
http://techhamlet.com/2012/02/ubuntu-whats-the-difference-between-upgrade-and-dist-upgrade/
Google it: upgrade vs dist-upgrade
upgrade only updates the packages already installed.
I believe apt-get upgrade is equal to the update manager of ubuntu. If you use the GUI to update. Correct me if I am wrong
I believe dist-upgrade also handles the dependencies.
http://en.wikipedia.org/wiki/Advanced_Packaging_Tool
I have always preferred dist-upgrade.
Oodie if you get errors during dist-upgrade try reinstalling your ubuntu. Maybe you want to start fresh. I started a clean Virtual Box virtual machine.
dist-upgrade has never given me errors.
How old is your installation ?
djjonastybe said:
http://techhamlet.com/2012/02/ubuntu-whats-the-difference-between-upgrade-and-dist-upgrade/
Google it: upgrade vs dist-upgrade
upgrade only updates the packages already installed.
I believe apt-get upgrade is equal to the update manager of ubuntu. If you use the GUI to update. Correct me if I am wrong
I believe dist-upgrade also handles the dependencies.
http://en.wikipedia.org/wiki/Advanced_Packaging_Tool
I have always preferred dist-upgrade.
Oodie if you get errors during dist-upgrade try reinstalling your ubuntu. Maybe you want to start fresh. I started a clean Virtual Box virtual machine.
dist-upgrade has never given me errors.
How old is your installation ?
Click to expand...
Click to collapse
You are correct. For some reason I had it in my head as an update to the next release.
Sent from my Nexus S using xda app-developers app
I'm stuck on kernel source downloading ( user / kernel folder ) .
Download interrupted 3 times now
Can't we share a completed kernel folder or something?
I hate my internet connection.
°°° This comment is Sent from my Nexus S °°°
Oodie said:
I'm stuck on kernel source downloading ( user / kernel folder ) .
Download interrupted 3 times now
Can't we share a completed kernel folder or something?
I hate my internet connection.
°°° This comment is Sent from my Nexus S °°°
Click to expand...
Click to collapse
Have you tried connecting it with a ethernet cable to the modem? I have a good connection but cable seems to be always 100% safe.
sudo sysctl -w net.ipv4.tcp_window_scaling=0
Click to expand...
Click to collapse
Maybe this tweak helps you. But I suggest shutting down as much programs as you can. And other computers. And if you can connect it directly to the modem/router with a ethernet cable.
Or keep trying. In the end it should be complete.
Also try a retail installation of Ubuntu instead of using a virtual machine this has helped me here.
EDIT: Updated first post with more kernel fun.
ok . the first branch finished successfully :angel: ( finally )
( Now there is files in the kernel / crespo folder )
Now running the second branch .
$ cd crespo
$ git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-ics-mr1
Click to expand...
Click to collapse
Oodie said:
ok . the first branch finished successfully :angel: ( finally )
( Now there is files in the kernel / crespo folder )
Now running the second branch .
Click to expand...
Click to collapse
Told you
Oodie I changed something in my guide.
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
Click to expand...
Click to collapse
Make sure you run these to see if you are using the right JDK. By default the OpenJDK is still used. Just discovered it.

[HOWTO] build nexus 4 kernel

environment: ubuntu 10.04 LTS 64bit
get some package
sudo apt-get install gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils xsltproc
install git
first install some packages that git depends on:
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
get the new git source code from http://code.google.com/p/git-core/downloads/list.
download git-1.8.0.tar.gz
tar -xvf git-1.8.0.tar.gz
cd git-1.8.0
./configure
make
sudo make install
this will install git to /usr/local/bin/
get the kernel source code:
mkdir -p ~/android/kernel
cd ~/android/kernel
git clone https://android.googlesource.com/kernel/msm
check which version of kernel to checkout
mkdir ~/work/android/nexus4-kernel
cd ~/work/android/nexus4-kernel
git clone https://android.googlesource.com/device/lge/mako-kernel
cd mako-kernel
git log kernel
get the commit rev, which is e039dcb (nov 25, 2012), this number seems to correspond to the latest commit revision in https://android.googlesource.com/kernel/msm/android-msm-mako-3.4-jb-mr1
check out the kernel
cd ~/android/kernel/kernel_msm
git checkout <commit version>
note: commit version is e039dcb, which is the result of the git log kernel command in the previous step
install google toolchain
mkdir ~/android/toolchain
cd ~/android/toolchain
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6
add “export PATH=$PATH:~/android/toolchain/arm-linux-androideabi-4.6/bin” to ~/.profile and run source ~/.profile
setup environment variables and build
cd ~/android/kernel/kernel_msm
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-linux-androideabi-
make mako_defconfig
make -j4
done
if you wanna thank me. go to google play and try out my app Wishlist :laugh:
https://play.google.com/store/apps/details?id=com.wish.wishlist
So with this I can make my own kernel for the Nexus 4? Hmm... will be nice to make one and get people to test it out for me lol.
I can edit the CPU, GPU, UV settings, etc? Is this only on Ubuntu or can it be done on Windows?
the kernel source is from google, but you can modify it as you wish. this is only for ubuntu. other linux environment will also work. but not windows.
You could change "make -j4" by "make -j$(grep -c ^processor /proc/cpuinfo)" ...
matt73300 said:
You could change "make -j4" by "make -j$(grep -c ^processor /proc/cpuinfo)" ...
Click to expand...
Click to collapse
that's handy to use.
But should the general rule of N in make -jN be twice the number of cpu core? for example, on my computer, I have two cores, so I use -j4.
yduck said:
that's handy to use.
But should the general rule of N in make -jN be twice the number of cpu core? for example, on my computer, I have two cores, so I use -j4.
Click to expand...
Click to collapse
Not really nice for lambda users. I think it's better when it written as I said (no need to know how many cores you have), or j# (and say replace # by 2xnumber_of_cores).
I have 8 cores on my computer, so I use j16 and it's much faster than j4, some people should know it
for some reason, the kernel I built cannot be booted.
when I did:
fastboot boot zImage
the phone stuck at the google logo.
any idea? I have seen other people in the forum built the kernel and booted it. there must be something wrong with the way I compiled the kernel, or the config is incorrect, or do I need to sign the kernel?
yduck said:
for some reason, the kernel I built cannot be booted.
when I did:
fastboot boot zImage
the phone stuck at the google logo.
any idea? I have seen other people in the forum built the kernel and booted it. there must be something wrong with the way I compiled the kernel, or the config is incorrect, or do I need to sign the kernel?
Click to expand...
Click to collapse
Is the zImage file the one found in "arch/arm/boot/zImage"? If so, then you can't use this directly in fastboot. You need to create a boot.img file.
Edit 2: You could possibly try this: " fastboot flash:raw boot <kernel> <ramdisk> ". I personally have not done, this. I created the boot.img file and flashed it.
Edit 3: Note that Edit 2 does perform a flash instead of boot, so be very wary of this. I recommend you create a boot.img file and use "fastboot boot boot.img" for testing --- it's safer that way.
dsana123 said:
Is the zImage file the one found in "arch/arm/boot/zImage"? If so, then you can't use this directly in fastboot. You need to create a boot.img file.
Edit 2: You could possibly try this: " fastboot flash:raw boot <kernel> <ramdisk> ". I personally have not done, this. I created the boot.img file and flashed it.
Edit 3: Note that Edit 2 does perform a flash instead of boot, so be very wary of this. I recommend you create a boot.img file and use "fastboot boot boot.img" for testing --- it's safer that way.
Click to expand...
Click to collapse
great suggestion. I just figured this out yesterday. as you said, fastboot boot does not work with just the zImage. it needs a boot.img.
so I created a newboot.img by packing my zImage and the ramdisk extracted from google's stock boot.img, and the newboot.img boots!
the command "fastboot flash:raw <kernel> <ramdisk>" seems simple to use. does it have an equivalent "fastboot boot: raw <kernel> <ramdisk"? so I don't need to worry about breaking my phone.
yduck said:
the command "fastboot flash:raw <kernel> <ramdisk>" seems simple to use. does it have an equivalent "fastboot boot: raw <kernel> <ramdisk"? so I don't need to worry about breaking my phone.
Click to expand...
Click to collapse
The fasboot.c source file at
https://android.googlesource.com/pl...8d27c72a03d56c1a36068a57f/fastboot/fastboot.c
indicates that there is no equivalent, although if you want to start modifying the fastboot.c code, it is probably easy enough to do so. Below is the relevant flash:raw code in fastboot.c:
} else if(!strcmp(*argv, "flash:raw")) {
char *pname = argv[1];
char *kname = argv[2];
char *rname = 0;
require(3);
if(argc > 3) {
rname = argv[3];
skip(4);
} else {
skip(3);
}
data = load_bootable_image(page_size, kname, rname, &sz, cmdline);
if (data == 0) die("cannot load bootable image");
fb_queue_flash(pname, data, sz);
Click to expand...
Click to collapse
From your post it sounds like you're using mkbootimg to create the boot image so you have what you need anyway (as long as you call mkbootimg with all the parameters corresponding to the boot header info from the boot image you extracted --- base offset, kernel offset, ramdisk offset, page offset, kernel command line , etc).
I've just added this guide to the Nexus 4 Complete Index
Sent from my GT-I9100 using xda premium
KidCarter93 said:
I've just added this guide to the Nexus 4 Complete Index
Sent from my GT-I9100 using xda premium
Click to expand...
Click to collapse
awesome! my post got into the index. I am so excited.:cyclops:
Thanks- although cdesai already made one
cdesai's thread here
yduck said:
great suggestion. I just figured this out yesterday. as you said, fastboot boot does not work with just the zImage. it needs a boot.img.
so I created a newboot.img by packing my zImage and the ramdisk extracted from google's stock boot.img, and the newboot.img boots!
the command "fastboot flash:raw <kernel> <ramdisk>" seems simple to use. does it have an equivalent "fastboot boot: raw <kernel> <ramdisk"? so I don't need to worry about breaking my phone.
Click to expand...
Click to collapse
I wonder if this is the correct way of making boot.img. I heard kernel image and ramdisk are related, if you modify and recompile the kernel and pack it with an old ramdisk, it may not boot. Is it true? what's the standard way of making boot.img? Is there a method to make our own ramdisk, instead of extracting it from google's stock boot.img?
yduck said:
setup environment variables and build
cd ~/android/kernel/kernel_msm
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-linux-androideabi-
make mako_defconfig
make -j4
Click to expand...
Click to collapse
Based in part on this documentation, I have created a HOWTO on building the system.img and boot.img files (for fastboot) with a single "make" call. Checkout: http://nosemaj.org/howto-build-android-nexus-4 .
Hi, I have two strange problems when trying to compile the mako kernel source. My setup:
Ubuntu 10.04, 64-bit (succesfully compiled a GB kernel for another device with this setup, using Google gcc 4.4.3 and Linaro gcc 4.6.2)
Kernel source from https://android.googlesource.com/kernel/msm, HEAD @ 7ce11cd - this is the android-msm-mako-3.4-jb-mr1.1 branch, wich should be identical to the kernel shipped with 4.2.2
Google gcc 4.6.x from https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6, also jb-mr1.1-release
No changes to the source, yet
There are two problems when compiling. First, there is this error
Code:
error: the frame size of XXXX bytes is larger than 1024 bytes
which is caused by 'CONFIG_FRAME_WARN=1024'. This value is not set in mako_defconfig, but seems to be the default for gcc 4.6 and is written to the .config when running make mako_defconfig. I am able to bypass this by setting 'CONFIG_FRAME_WARN=2048', but question is: Why do I need to? The stock kernel on my device running 4.2.2 has been compiled with 'CONFIG_FRAME_WARN=1024'.
The second problem are warnings of the type
Code:
warning: unwinding may not work because EXIDX input section XX of arch/arm/.../YYY.o is not in EXIDX output section
These can be suppressed by setting '# CONFIG_ARM_UNWIND is not set' and adding 'CONFIG_FRAME_POINTER=y'. But again, the stock kernel is compiled with 'CONFIG_ARM_UNWIND=y' and obviously, the Google guys didn't have this problem. What's wrong with my setup?
add “export PATH=$PATH:~/android/toolchain/arm-linux-androideabi-4.6/bin” to ~/.profile and run source ~/.profile
I can't figure out why but I keep getting a no command 'add' found
Sent From My Paranoid Nexus
atomilluminati said:
add “export PATH=$PATH:~/android/toolchain/arm-linux-androideabi-4.6/bin” to ~/.profile and run source ~/.profile
I can't figure out why but I keep getting a no command 'add' found
Sent From My Paranoid Nexus
Click to expand...
Click to collapse
Thanks for the response. The path to the compiler is defined in my kernel build script. Do I have to change it in my .profile, too?
XDA_Bam said:
Thanks for the response. The path to the compiler is defined in my kernel build script. Do I have to change it in my .profile, too?
Click to expand...
Click to collapse
Actually this was supposed to be a question...my bad... I keep getting to that line in the OP's instructions and can't get past it
Sent From My Paranoid Nexus
atomilluminati said:
Actually this was supposed to be a question...my bad... I keep getting to that line in the OP's instructions and can't get past it
Sent From My Paranoid Nexus
Click to expand...
Click to collapse
Hehe Okay, the answer is that you have to open the ~/.profile and manually add in a text editor the line given in the OP. The file should be in your profile folder (/home/your_user_name/). After this, save, close and run
Code:
source ~/.profile
in the terminal. That should do it, as far as I understood.

[GUIDE] Build CM10 kernel from source + wkpark's RAM hack

For any CM10 ROM, except new bootloader one, hackfest, and CM10.1
This tutorial shows you how to build CM10 kernel from RC and the CM team's source(it is their work), and using wkpark's ramhack patch or other patches
If you are uncomfortable in building the kernel, you use my flashable sample kernel at the end of the post, which uses 56 MB RAM hack.
Pre-requistes:
A Linux system
An internet connectionc
Some time and patience
But the time required for downloading resources, and building once everything is set up, is only a fraction of the time required for a full CM10 ROM
You can follow this guide, with or without having built CM10 following Raum1807's excellent CM10 building guide. At one of the places, the difference occurs whether you had built CM10 before or not, and I have listed it at that place
For a first time build, you need to follow all the steps, but 2nd time onwards, you can skip to the build step or RAM hack setting step
Instructions:
STEP 1: SETTING UP THE ENVIRONMENT
Install any CM10 ROM on the device (old bootloader, non-hackfest, non-CM10.1 one)
If you already have CM10 environment set up, skip to "Create an environment variable..." part
Install development support packages:
Debian based Linux distributions (like Ubuntu)
64bit systems:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils schedtool pngcrush xsltproc zlib1g-dev:i386
then
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Red Hat based Linux distributions
32bit and 64bit systems:
git gnupg java-1.6.0-openjdk-devel flex bison gperf SDL-devel esound-devel wxGTK-devel zip curl ncurses-devel zlib-devel gcc-c++ glibc-devel
64bit only:
glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686
Setting up Java (thanks to Raum for the java setup guide)
You need a Java Development Kit for building CM10. Recommended is the SUN JDK 6. As of writing the most recent version is SUN JDK 6 Update 37.
1. Download the jdk-6u37-linux-i586.bin from the Oracle/Sun Java Download Area. If you are on 64-bit Ubuntu as I am, you should grab jdk-6u37-linux-x64.bin.
2. Make the bin file executable:
Code:
$ chmod +x jdk-6u37-linux-x64.bin
3. Extract the bin file:
Code:
$ ./jdk-6u37-linux-x64.bin
4. Move the extracted folder to this this location:
Code:
$ sudo mv jdk1.6.0_37 /usr/lib/jvm/./jdk-6u37-linux-x64.bin
5. Install the new Java source in system:
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javadoc 1
$ sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javah 1
$ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javap 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/jar 1
6. Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
7. Check Java version:
Code:
$ java -version
8. Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location and version:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
Now,
If you have CM10 source fetched already (if you have built cm10)
If the directory name where the cm10 source exists is "cm10" (as in Raum's building guide)
Create an environment variable denoting the location of the android toolchain as follows:
Code:
export CCOMPILER=${HOME}/cm10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
Or else, replace the path/name if yours is different
(If your arm-eabi version is not 4.4.3, check the folder name and change it accordingly)
If you do not have cm10 source on your pc, then you need to download the ARM EABI Toolchain separately
Download link, ready to extract
If above does not work, download from official site here
Download and extract then, create an environment variable denoting the location of the toolchain as follows:
Code:
export CCOMPILER=[extraction directory]/bin/arm-eabi-
Download Kernel Source Code:
Code:
mkdir -p ~/kernel
cd ~/kernel
Now download RC's CM10 kernel source
In terminal, do
Old bootloader:
Code:
git clone git://github.com/CyanogenMod/lge-kernel-star.git -b jellybean
New bootloader:
Here, pengus77 has made the necessary changes in his repo, so we fetch from that
Code:
git clone git://github.com/pengus77/lge-kernel-star.git
Thus, there should be a folder named "lge-kernel-star" inside /kernel folder
Then in terminal, cd to that directory "lge-kernel-star"
Code:
cd lge-kernel-star
Getting the config file
The next step is to copy the file "/kernel/lge-kernel-star/arch/arm/configs/cyanogenmod_p990_defconfig" to "/kernel/lge-kernel-star and rename it to ".config"
using the command:
Code:
cp arch/arm/configs/cyanogenmod_p990_defconfig .config
(Thanks to tonyp for the tip!)
STEP 2: CONFIGURATION
Configure the build:
Code:
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig
If it happens to ask anything, just accept the defaults at every step by pressing enter.
STEP 3: APPLYING PATCHES
Applying patches like wkpark's RAM hack patch
If you skip this step, the kernel will work, but you'll have a completely stock kernel without RAM hack or other tweaks
Download wkpark's two patches from here and here, and put them in your /kernel directory
Code:
cd ~/kernel
Now to apply the patches, we use the patch command like this:
Code:
patch -Np1 -d lge-kernel-star < patchname.patch
(replace patchname with name of the patch file)
Here, -N is for ignoring patches that seem to be already applied or reversed
p<num> Strip the smallest prefix containing num(here num=1) leading slashes from each file name found in the patch file
In this case, num=1 according to the path names in wkpark's patch, and in a lot of cases, the value of 1 is common
-d is to change to the directory immediately, before doing anything else
You need to apply wkpark's two patches one by one (0001-..., then bootloader-...)
If you get errors while patching, if they are basic errors like file not found etc. then you should manage to fix it yourself.
But if you get errors like "HUNK ... failed",
try
Code:
patch -Np1 --ignore-whitespace -d lge-kernel-star < patchname.patch
A "HUNK ignored" is ok, if patch was attempted previously, since that file might have been successfully patched last time
if a HUNK still fails, then read the troubleshooting guide
Setting RAM hack size (If you skipped the above patching step, dont do this)
wkpark's patch makes it possible for you to set ramhack size in kernel command line parameter.
The cmdline parameter has to have the full boot.img command line parameters, which you can obtain from dmesg. I have done it for you, so you can save time on that
Here's how it looks for the old bootloader: (for the new one, ignore this)
Code:
<5>[70:01:01 00:00:00.000] Kernel command line: loglevel=0 muic_state=1 CRC=10203036179a93 brdrev=1.0 uniqueid=37c7006421f6097 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 [email protected] vmalloc=128M androidboot.mode=normal androidboot.hardware=star androidboot.serialno=37c7006421f6097
Paste the line starting from loglevel=0 till the end (serialno) into .config file in lge-kernel-star folder in
CONFIG_CMDLINE="<here>"
Insert a carveout size in between vmalloc and androidboot.mode
Determing carveout size: carveout=<152 - RAM hack size>M
For example, if RAM hack size is 56, then carveout is 96M
So in that case, the cmdline is like this:
old bootloader:
Code:
CONFIG_CMDLINE="loglevel=0 muic_state=1 CRC=10203036179a93 brdrev=1.0 uniqueid=37c7006421f6097 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 [email protected] vmalloc=128M carveout=96M androidboot.mode=normal androidboot.hardware=star androidboot.serialno=37c7006421f6097"
new bootloader:
Code:
CONFIG_CMDLINE="tegraid=20.1.4.0.0 [email protected] carveout=152M android.commchip=0 vmalloc=128M androidboot.serialno=037c7006421f6097 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,-3 androidboot.mode=normal usbcore.old_scheme_first=1 [email protected] [email protected] muic_state=0 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,boot:34700:1000:800,mbr:400:200:800,persist:600:2bc00:800,cache:2c200:7f00:800,misc:34200:400:800,userdata:38700:c0000:800,bcttable:0:600:800,bootloader:100:300:800,data/ve:f8800:1400:800,system:34c000:40000:800 "
and save the file
Dont set carveout too low, or else some gpu-intensive stuff may not work properly.
STEP 4: BUILDING THE KERNEL
In terminal,
Code:
cd ~/kernel/lge-kernel-star
Code:
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
This step may take a while, depending on your computer. Took ~5-10 mins for the first build for me, and ~1 min for the second build onwards.
If it asks in the terminal "use default config?" then say "y", if not, then ignore this
If you get some error and the building aborts within a few seconds, try the "Create environment variable part" again, and then return back directly to the build step.
After it is done, you should have a kernel stored in ~/kernel/lge-kernel-star/arch/arm/boot/zImage
Preparing the flashable zip for the kernel
Some compiled modules need to be included so that problems like wifi not switching on dont occur.
They are:
drivers/misc/bthid/bthid.ko
drivers/scsi/scsi_wait_scan.ko
drivers/net/wireless/bcm4329/wireless.ko
They will be used while preparing the flashable zip below.
Thanks to feav's compiled modules and benee's anykernel updater for star, all this is ready-made and you can simply:
Download the sample kernel zip attached below and replace /kernel/zImage and and the above modules in system/lib/modules/hw in that with yours, edit updater-script if you want.
Your flashable zip is now ready
STEP 5: FLASHING AND TESTING THE KERNEL
Put the sample kernel below as a backup in case your kernel does not boot and you need a working phone immediately.
Flash the kernel in recovery, wipe cache, dalvik cache and reboot.
If the phone goes past the LG logo screen(s) and into the bootscreen of the ROM, then it should work
Then you can check "kernel version" in settings->about phone to see your kernel information,
and you can see the new RAM size (which should be 342 MB + RAM hack size) in some app like battery dr saver, or antutu benchmark's system info.
If it doesnt work, make sure you have followed the entire guide properly and then ask queries
If you want to revert to another kernel, flash that kernel in recovery, or for stock kernel, flash your ROM.
Keeping kernel source up to date (for building again later after RC has made changes to the source):
Code:
cd ~/kernel/lge-kernel-star
git pull
This will update your source with the latest commits by RC. Then you can rebuild the kernel by doing the "create environment variable" and then skip directly to the build stage
Standard disclaimer:
I am not responsible if anything goes wrong with your phone or anything else.
Credits:
aremcee/RC and the rest of the CM team for all their work. This is their kernel you are building
wkpark for his valuable contributions, including the ramhack patches and cracking the new bootloader
benee for his Anykernel updater for star, and other tweaks
feav for his compiled wifi modules
pengus77 for the work to make it suitable for the new bootloader
Download links for sample kernels:
SAMPLE 56 MB RAMHACK KERNEL
SAMPLE 32 MB RAMHACK KERNEL
SAMPLE 24 MB RAMHACK KERNEL
Troubleshooting guide:
1. Patch failure
HUNK failed means that a particular file was not patched to some problem. In this case, a .rej file is saved in the same folder as the file to be patched, and it contains the stuff not patched.
Do not neglect "failed" hunk since it means a partially applied patch(some files patched, some files not), and may cause problems. "Ignored hunk" is ok, if the patch had been attempted before on a file and had succeeded on that file last time.
To manually patch the failed hunk, go that file where the hunk failed (has same name as .rej file without .rej extension)
For example, if .rej file is board-star.c.rej, and it contains the following sample lines (look for lines beginning with '+' and remove the + before adding, similar for -) go to board-star.c, and add the lines manually like this:
Code:
#if defined (CONFIG_STAR_REBOOT_MONITOR) || defined (CONFIG_BSSQ_REBOOT_MONITOR)
#define RAM_RESERVED_SIZE 100*1024
/* Force the reserved_buffer to be at its old (Froyo/GB) location
for reboot to work with the older bootloader */
if (strstr(saved_command_line, "brdrev=")) {
extern void *reserved_buffer;
pr_info("The older bootloader detected\n");
if (memblock_end_of_DRAM() > 0x17f80000) {
if (memblock_reserve(0x17f80000, RAM_RESERVED_SIZE)) {
pr_err("Fail to get reserved_buffer for the older bootloader\n");
} else {
pr_info("Change reserved_buffer for the older bootloader\n");
reserved_buffer = phys_to_virt(0x17f80000);
}
} else {
pr_info("Change reserved_buffer\n");
reserved_buffer = ioremap(0x17f80000, RAM_RESERVED_SIZE);
}
}
#endif
This was in the .rej file, and is to be added immediately after
Code:
#if defined(CONFIG_LGE_BROADCAST_TDMB)
star_dmb_init();
#endif /* CONFIG_LGE_BROADCAST */
in board-star.c (and before the next #if defined or closing bracket)
Similarly, the - lines to be deleted and + lines are to be added in that failed hunk file
(do this manual stuff only if hunk fails)
2. If ramhack kernel fails, but normal kernel works:
From your pc, in terminal do
adb shell dmesg > dmesg.txt
or from your phone, in android terminal emulator, do
dmesg > /sdcard/dmesg.txt
Copy it from your dmesg.txt starting from loglevel=0 till the end (serialno)
Look for a line in dmesg.txt which resembles this:
Code:
<5>[70:01:01 00:00:00.000] Kernel command line: loglevel=0 muic_state=1 CRC=10203036179a93 brdrev=1.0 uniqueid=37c7006421f6097 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 [email protected] vmalloc=128M androidboot.mode=normal androidboot.hardware=star androidboot.serialno=37c7006421f6097
Use your own phone's parameters instead of this and then set carveout size.
3. Problem with config file:
Pulling kernel config from device:
You need to retrieve a working kernel config from the device, and unzip it.
For that, connect your phone to your pc, enable USB debugging if it was disabled, and then in terminal
Code:
adb pull /proc/config.gz ~/kernel/lge-star-kernel-jellybean/config.gz
cat config.gz | gunzip > .config
Alternatively, you can pull the .config from the newest boot.img
Code:
scripts/extract-ikconfig boot.img > .config
Changes and updates:
25/12/12:
Added changes to be made for the new bootloader (in red color)
24/12/12:
Updated the guide, added some fixes and changes
22/12/12:
Slightly modified version of wkpark's 2nd patch (bootloader one) which may possibly fix one of the errors and may remove need for manually adding some lines
Last one
rugglez.....you rock mate....
I am not sure if I will really do something as I am getting old(lolz) and if I understand enough....
but thanks mate, for keeping spirits alive for this device
rugglez,
Did you see these posts: http://forum.xda-developers.com/showpost.php?p=34600723&postcount=189
http://forum.xda-developers.com/showpost.php?p=34601277&postcount=192
Did you experienced any ploblem with USB?
SREEPRAJAY said:
rugglez.....you rock mate....
I am not sure if I will really do something as I am getting old(lolz) and if I understand enough....
but thanks mate, for keeping spirits alive for this device
Click to expand...
Click to collapse
There are always some things worth experiencing once in life, like if you are an Android user, building a ROM and a kernel. You have experienced it with your wonderful AF kernel, thats important
feav said:
rugglez,
Did you see these posts: http://forum.xda-developers.com/showpost.php?p=34600723&postcount=189
http://forum.xda-developers.com/showpost.php?p=34601277&postcount=192
Did you experienced any ploblem with USB?
Click to expand...
Click to collapse
USB works fine, both adb and mass storage
This guide may seem intimidating, but trust me, once you complete it the first time, you'll find it really simple from the next build onwards.
Uploaded a slightly modified version of wkpark's 2nd patch (bootloader one) which may possibly fix one of the errors and may remove need for manually adding some lines. Updated link in OP and attached here too.
I tried the sample kernel and my camera stops functioning and so with other apps such as contacts, they don't start at all. Im on dec 20 nightly. Could it be the ramhack size? Maybe 32mb will suffice. Just saying.
Thanks to this, will probably try this next week..
aldyu said:
I tried the sample kernel and my camera stops functioning and so with other apps such as contacts, they don't start at all. Im on dec 20 nightly. Could it be the ramhack size? Maybe 32mb will suffice. Just saying.
Thanks to this, will probably try this next week..
Click to expand...
Click to collapse
Uploaded 32 MB ram hack kernel for those having problem with camera, try it out.
Download link 32MB RH
Update:
Added 24MB version too. Here you go:
24MB RH kernel
Thanks rugglez, 32 mb rh is ok so far, cm10 is way smoother and can still play nfs most wanted. Btw, can you apply the patch for double lg logo too by wkpark?
Sent from my P990-CM10
After installing the new kernel, if some apps still don't work or there any lag, disable "force gpu rendering" and "disable hardware overlays" in developer settings.
Thank you for your work! Just flashed the 32mb version without any problem. On cm7 the 48mb ramhack was the biggest without breaking 720p recording. Maybe you should give it a try!
Uhm download a kernel zip file?
How about git clone?
Sent from my Nexus 7 using xda app-developers app
tonyp said:
Uhm download a kernel zip file?
How about git clone?
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Git clone size = ~440mb
Zip size = 120mb which extracts to that same size
Takes more time to download more for people like me with slow Internet, no other reason
Hi rugglez, got the ff. error when installing the required packages, Im on ubuntu 12.10 x64.
Note, selecting 'libsdl1.2-dev' instead of 'libsdl-dev'
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'sun-java6-jdk' has no installation candidate
E: Unable to locate package libwxgtk2.6-dev
E: Couldn't find any package by regex 'libwxgtk2.6-dev'
How to fix? Thanks.
aldyu said:
Hi rugglez, got the ff. error when installing the required packages, Im on ubuntu 12.10 x64.
Note, selecting 'libsdl1.2-dev' instead of 'libsdl-dev'
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'sun-java6-jdk' has no installation candidate
E: Unable to locate package libwxgtk2.6-dev
E: Couldn't find any package by regex 'libwxgtk2.6-dev'
How to fix? Thanks.
Click to expand...
Click to collapse
Can you install the dependencies from Raum's CM10 building thread here?
Follow steps 1 and 2 there.
Let me know if that works, ive updated the guide's step 1(setting up environment)
Installing the dependencies from this guide was the only thing i didnt test, since i had the CM10 environment set up already
a step is missing from this guide.
adb pull /proc/config.gz ~/kernel/lge-star-kernel-jellybean/config.gz
cat config.gz | gunzip > .config
Click to expand...
Click to collapse
then
mv config arch/arm/configs/<your_config_name>_defconfig
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig
make <your_config_name>_defconfig
make ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig
Click to expand...
Click to collapse
then continue...
if you don't make the default config the compiler throws out some errors.
ps: nice guide btw
rugglez said:
Git clone size = ~1.5gb
Zip size = 440mb which extracts to that same size
Takes forever to download more than a gig for people like me with slow Internet, no other reason
Click to expand...
Click to collapse
Hmm.. downloading it now and wondering why it's only 120mb, not 440mb as you said.
rugglez said:
Can you install the dependencies from Raum's CM10 building thread here?
Follow steps 1 and 2 there.
Let me know if that works, ive updated the guide's step 1(setting up environment)
Installing the dependencies from this guide was the only thing i didnt test, since i had the CM10 environment set up already
Click to expand...
Click to collapse
Thanks, ok now using your updated guide.
Btw, did you happen to upload a copy of the kernel zip file? Downloading from github takes forever, only 8 kb/s.
aldyu said:
Thanks, ok now using your updated guide.
Btw, did you happen to upload a copy of the kernel zip file? Downloading from github takes forever, only 8 kb/s.
Click to expand...
Click to collapse
Just use "git clone git://github.com/CyanogenMod/lge-kernel-star.git", it should give you better download speed than for the zipped archive.
I synced the whole CM10 source tree on the remote buildbox in about 5-10 minutes - so github does provide great downspeed
@rugglez: You should add to the OP that you don't have to use adb to get the kernel config, it's already there
arch/arm/configs/cyanogenmod_p990_defconfig
Please refer to the old cm7 kernel how to by pastime: http://forum.xda-developers.com/showthread.php?t=1227241
I really like the fact that more and more building guides get posted here - and that more and more people are building their own ROMs and kernels these days.
After building (which already is a great start) many people even want to learn more about android development in general. That's the true xda spirit!
Kudos!

How To Build a Kernel

Why would you want to build a kernel yourself?
Click to expand...
Click to collapse
Have you read this: http://forum.xda-developers.com/showpost.php?p=21006133&postcount=1144
In that spirit, I'm going to attempt to write a plain-English tutorial on what to do to build this kernel. In fact, change one or two URLs, and you could build practically any kernel!
Note: I'm assuming you're on a PC here. I'm also assuming this isn't your first trip to linux-land, and you've at least used the terminal a few times before now. I'm also going to assume that even if you are a noob, you're not mentally sub-normal.
Note2: If this is your first time building a kernel, you may want to print this out, and go slowly, and if you get stuck, post about it in the thread! It will help me improve the guide.
What makes this different to other tutorials?
Click to expand...
Click to collapse
I'm a noob at building, but a professional at teaching. It's literally my job! In my noobishness, I made good records of pretty much every step, and I've got lots of time for explaining what each step actually does.
THE STEPS
Got a computer?
Click to expand...
Click to collapse
You'll need one to compile stuff. "For Gingerbread (2.3.x) and newer versions, including the master branch, a 64-bit environment is required." (source)
OK. You're probably thinking of compiling a kernel for ICS or higher right? Is your computer only 32 bit? Pull the processor off the motherboard and count the pins. Just kidding. It won't matter if it is AMD or Intel, but it needs to be a 64 bit processor. I can compile a kernel with just 2GB of RAM and my processor is approaching its 9 year. Even with this lousy set-up, compiling a whole kernel from scratch takes only five minutes.
Install Ubuntu 10.04 64-bit. (Click on this link to download the install CD.)
If you've got a spare hard drive, use the whole thing. If you're good at partitioning, you might consider putting the linux swap partition on a separate disk. You'll want it to be at least 8GB. Putting it on a separate disk will speed things up.
If you don't have a spare disk, you're going to have to resize a partition of an existing OS, to make some new space for Ubuntu. Lets say a minimum of 12GB for the OS plus 8GB for the swap. The more space you can give to the OS, the easier your life will be if you're serious about building stuff.
At the end of the installation it will ask to install a boot-loader. This should be on sda (not sda1!) but you may need to adjust your BIOS to point at the right hard-drive if you later find it doesn't boot into Ubuntu when you restart. Don't worry about Windows, Ubuntu provides a boot menu, so you have the option of booting to Windows instead.
Once Ubuntu is installed, reboot then open a terminal and sort out your credentials:
Code:
sudo passwd root
Type in the password you set during the install, then decide on a password for the root user, and enter it once, then again for confirmation. It can be the same as your user password if you like.
Do some updates (this could take a while):
Code:
sudo apt-get update && sudo apt-get dist-upgrade
When it's finally finished, you'll have to reboot, then repeat until there's no updates left.
You're ready to set up a build environment!
Click to expand...
Click to collapse
First, you need a whole bunch of packages. You could copy and paste this into your terminal:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" && sudo apt-get update && sudo apt-get install sun-java6-jdk
That's java sorted.
Next up is the dependencies for compiling stuff:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libsdl-dev libesd0-dev libwxgtk2.6-dev libncurses5-dev lib32z1-dev gcc-multilib git-core && sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
I think I remember getting an error for one of these. Possibly lib32readline5-dev. If you get that error, make sure you install everything else. Please let me know, and I'll update this step with a fix.
Make sure ADB is initialised:
Code:
gedit /etc/udev/rules.d/51-android.rules
and copy the below into a blank text file, then edit both instances of <username> to your Ubuntu username (lower-case!) and no chevrons: ="<bedalus>" is wrong. You want ="bedalus"
Code:
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
Now save the file!
Get hold of a Cross-Compiler
Click to expand...
Click to collapse
Follow this link to Mentor Graphics Sourcery CodeBench LITE and do a free signup to get the download link. You can get hold of other ones, like Linaro or Google's own, but I'm using this as an example, because it's the one I use, and Ezekeel published some R&D here that showed there was no measurable benefit to one toolchain over another.
When you've downloaded it, you need to copy it to /opt:
Code:
cd /home/<username>/Downloads
cp arm-some-date-some-version-some-arch.tar.bz2 /opt
Note- Obviously that's not the actual name of the file! But you can see what it's really called when you download it.
Now go to /opt and unpack it:
Code:
cd /opt
tar xjf arm-some-date-some-version-some-arch.tar.bz2
So I've got all the tools. Now what?
Click to expand...
Click to collapse
So now you need to get some source code. You can use 'git clone' if you don't plan on publishing your kernel. But if you've made some modifications and want to share your end result, you need to obey the GPL terms for the linux kernel, which is Open Source, meaning that you are required to make your source available publicly.
Go to github: https://github.com/
...and sign up. It's just a free registration provided you are non-commercial. Github has some useful getting started tutorials, which I suggest you follow:
https://help.github.com/articles/set-up-git
(just follow that first page for now. I will walk you through git in a bit...)
Next, fork a repo:
Go to whichever kernel you like: https://github.com/bedalus/bedalusKERNEL
I'm using mine as an example. Look for the big 'Fork' button.
You've now got your own copy on github, and you can do whatever you like with it, without affecting the original.
However, it's no use if it exists only in the cloud. You need to get a local copy. You'll also want something called a 'remote tracking branch', which will enable you to keep up-to-date with the changes going on in the original repository that you have forked-off from.
Critical Step:
Click to expand...
Click to collapse
Shout 'fork-off!' at the top of your voice.
Uh... okay. Now, to get a local copy, and set up your remote-tracking branches, execute:
Code:
cd /home/<username>/
mkdir mykernel
...you can name your new directory whatever you want. It doesn't have to be 'mykernel', then:
Code:
git clone https://github.com/<your github username>/bedalusKERNEL.git
In the above, put your git username, and substitute bedalusKERNEL.git for whatever your fork is called. You can actually copy and paste the URL from the top of your new github repo's page if you want.
It's going to download about 800MB if I remember correctly. This will take a while, so go have some marmite on toast.
When that's done, you're ready for the remote-tracking branch:
Code:
cd bedalusKERNEL (or whatever your fork is called)
git remote add upstream https://github.com/bedalus/bedalusKERNEL.git
git fetch upstream
The 'git remote add upstream' creates a new branch called upstream, and any changes that the original developer uploads to github can be fetched to your machine with the 'git fetch upstream' command. Notice how this time, the download time is much shorter? That's because of 'delta downloads' which only downloads the differences between what you have, and what they have. (There's some technical detail here.)
Git Tip No. 1: What branches do I have?
Click to expand...
Click to collapse
You can now enter:
Code:
git branch
...to see all your branches. At this point there should be 'origin' and 'upstream'.
Git Tip No. 2: How do I change branches?
Click to expand...
Click to collapse
Changing branches (you might as well do this now just to have a little go):
Code:
git checkout upstream
That will move you onto the upstream branch, as long as you haven't made any 'uncommited' changes in origin. (More on that later.) Change back to origin with:
Code:
git checkout origin
Git Tip No. 3: How do I rename a branch?
Click to expand...
Click to collapse
You might want to rename your branches to help personalise them, just to make remembering which is which a little bit easier. To change origin to 'my_version' do this:
Code:
git branch -m origin my_version
You can change upstream to 'their_version' or something else if you want to. It won't stop anything from working.
More Git Tips later. Let's sort out a build script. If you tinker with any code, you'll inevitably break stuff, and need to fix it, and then need to try building again... So, having a build script is going to save you a lot of time, because there are several steps that can be automated.
Here's how the start of my script looks:
Code:
#!/bin/sh
cd /home/dave/mykernel
git branch
read -p "Correct branch? [Y/N]: " -n 1
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo -e "\n"
exit 1
fi
This is just a little precaution that I put in to give myself the chance to abort the build before it starts if I'm on the wrong branch. If I don't hit y then the script aborts, and I can checkout the right branch, then restart the script.
Code:
echo -e "\nSTARTING...\n"
The \n prints a new line, then on that new line the message 'STARTING...' and then begins another new line. If you put \n\n you can print a blank line. The echo command is a good way of putting notices in a script so you know what stage it is at.
Code:
export PATH=$PATH:/opt/toolchain/bin/
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-none-eabi-
If you put these lines in your script, it sets 'environment variables' that tells the make program where to find the compiler, and what processor it's compiling for (ARM).
If you now save your script in the /mykernel directory you created earlier, git can keep track of it as well as the files integral to the kernel. Save it as whatever you like, e.g. "myscript.sh"
...It's important to have the .sh extension so the system knows it is a script.
To make your script executable, run:
Code:
chmod a+x myscript.sh
Before you execute the script, you need a .config file in the mykernel directory. If you've cloned my repo, you can get a working one by executing:
Code:
cp arch/arm/configs/crespo_release_defconfig ./.config
...this command will only work properly if you are in the mykernel directory when you execute it.
You can mess with this config file if you like! But it's very easy to break the kernel. However, you can always just copy the crespo_release_defconfig again.
Now, to execute the build script run:
Code:
./myscript
If you execute your script, your compiler will now build the kernel. It will take time, but even on my ten-years-old PC it takes less than ten minutes from scratch.
The compiler will spit out a lot of messages. Most of the time it's telling you that it has compiled an object (i.e. a .o file, which will all be linked up later to form the kernel) and sometimes you'll see warnings, which is the compiler telling you it thinks something might be wrong. Don't worry, most of the time the compiler is just being over-cautious.
If the compiler hits a real problem with the code, it will print an error, and tell you what file, and what line, and how far along that line it managed to get to before it didn't know what to do. I'll get back to this later. For now, let's assume everything compiled.
You'll see a message about the zImage being created. That's the kernel. You can't use it as it is, you need to put it into a boot.img so you can flash it.
I find it useful to add this command in my build-script:
Code:
ls -l /home/dave/mykernel/arch/arm/boot/zImage
ls -l means list with long format. It'll print out the entire contents of a directory with size, time, permissions, etc. if you execute it in a directory, or point it to a directory. However, in the command above, I've pointed it specifically at the zImage file, so it only prints out the details for that. This is so I can check the time. If the time is from yesterday, I can see quickly that there has been an error in the build, and the zImage is still the same one I built yesterday, or an hour ago... etc. depending on the time-stamp printed out.
If you get a 'No such file' error, it's because there is no old zImage, because you haven't ever successfully built one yet.
If you sat and watched the entire thing build, then the timestamp should show the current time, minus a few seconds.
How do I make this zImage into a CWM flashable .zip file?
Click to expand...
Click to collapse
Yay! You've built a kernel. Now you need to make everybody else flash it to their phones too
To do this you need to put it into a boot.img, and then into a .zip file.
Making the boot.img
Click to expand...
Click to collapse
Download this: http://d-h.st/wVZ (make-boot necessary files)
It's a small download. It's some very simple tools that can split an existing boot image into a ramdisk and zImage, and can also stitch them back up.
Move mkboot.zip into your mykernel folder, right click on it, and select 'Extract Here'. You can now delete mkboot.zip. There is a tool called unbootimg, that can take apart existing boot.img files, I've made things simple by including my own ramdisk, which is compatible with AOSP and CM ROMs. That file is called cyan2disk_new.cpio.gz
We now need to add some new stuff to the script to stitch our zImage and ramdisk together.
If you've not already added the ls -l command I mentioned above, also add this now. Then:
Code:
cp /home/dave/mykernel/arch/arm/boot/zImage /home/dave/mykernel/mkboot/
cd /home/dave/mykernel/mkboot
./mkbootimg --kernel zImage --ramdisk cyan2disk_new.cpio.gz --cmdline 'no_console_suspend=1 console=bull's --base 0x30000000 --pagesize 4096 -o boot.img
Remember, your username is not dave! Unless it is. Make the appropriate changes to the path.
How do I make the CWM flashable .zip file?
We're nearly there! This bit is relatively painless. At this point you could save and run the script to check that mkboot is working. If it has worked you can use the same ls -l trick from before, but this time target the boot.img file you just created. If the time-stamp is fresh, it means your boot.img is correct.
TIP: If you haven't switched branches, or run 'make clean', all your .o files are unchanged. The make program keeps track of changes, and only recompiles .o files when the corresponding .c file has been altered. If nothing has changed, your build script will execute very quickly!
To make a flashable .zip file, the easiest thing to do is modify an existing .zip file. You can download my kernel for simplicity, since it already has the necessary script for flashing the entire boot partition. (Most kernels here use koush's any-kernel script, which updates only the zImage and keeps the boot partition's existing ramdisk, so if you try to use another kernel .zip as a template, make sure you correct their updater-script. Using my ramdisk and kernel script will also ensure you keep MTP!)
Once you've downloaded my kernel you should extract it in your home folder, then rename the directory to something like 'myzip'
Now add these lines to your build-script:
Code:
cp /home/dave/mykernel/mkboot/boot.img /home/dave/myzip/boot.img
cp /home/dave/mykernel/drivers/scsi/scsi_wait_scan.ko /home/dave/myzip/system/modules/
"What's that second line? With the .ko file?" I hear you say. Depending on what modules you build, you'll need to copy all of them to the folder specified above. Fortunately, when the kernel finishes building, it tells you what modules have also been built. If you don't want modules in your kernel, you can remove the second line above. However, you must edit your .config file: Open it in gedit, use CTRL+F to open the find dialogue, then type "=m" Now, change every one you find into a "=y" ...so now instead of building modules, the kernel will now incorporate all that code into the zImage instead.
Finally, add this line to your build-script:
Code:
7z a -r -tzip /home/dave/mykernel.zip /home/dave/myzip/*
Run the script again. if everything has gone smoothly, then you now have a flashable .zip in your home directory!
Congratulations!
* * * * * * * * *
More git tips!
Click to expand...
Click to collapse
I've compiled a list of commands you may find handy when getting to know git.
Add a remote branch and track it
git remote add ezekeel git://github.com/Ezekeel/GLaDOS-nexus-s-ics.git
git fetch ezekeel
git checkout --track -b bln ezekeel/bln
Merge in the changes
git merge bln
Resolve conflicts
git mergetool
List local branches
git branch
List remote branches
git branch -r
Switch branch
git checkout branch_name
Rename a branch
git branch -m old_branch_name new_branch_name
View log with short sha1 hash
git log -10 --pretty=format:"%h - %ar: %s"
Restore to a particular point
(IMPORTANT! Don't do this if you've already pushed your commits to github!)
git reset --hard <sha1 hash>
Restore to your last commit
git reset --hard HEAD
Restore to one commit before your last commit:
git reset --hard HEAD^
Restore to two commits before your last commit:
git reset --hard HEAD^^ (etc.)
As long as you haven't pushed to github,
squash all your recent commits into one:
git rebase -i <sha1> ...then change push to squash (or fixup) for all except the first one
git rebase -i --abort (to abort!)
Add .file (i.e. hidden file)
git add .file (simple!)
Add all new and modified files
git add .
Deleting files
(i.e. after doing rm <files>)
git add -u (git will note which files have been deleted)
Bring files from a directory in another branch
git checkout cyanogenmod drivers/cpufreq/
Tells you what changes you've made so far
git status
Commit your changes
git commit (type in your notes about what you did, then CTRL+X then Y to save)
Sync your commits to your github repo
git push <repo_name> <branch_name>
Delete a remote branch
(WARNING: This will delete the entire branch from github
Note: You cannot do this to the default github branch, but you can change the default branch in the admin tab on the website)
git push <repo_name> :<branch to be deleted>
General tips! File management, searching... etc.
Click to expand...
Click to collapse
Find a file (useful for troubleshooting in some situations)
find /home/dave/ -name 'buildlean.sh'
(searches the home folder and subdirectories for 'buildlean.sh')
Find within any *.c file, the text "s5pv210_driver" (good for finding bits of code)
find ./ -type f -name *.c | xargs grep s5pv210_driver
Find within any file, the text "s5pv210_driver" (good for finding bits of code)
find ./ -type f | xargs grep s5pv210_driver
Special Mention : bedalus [Original maker of this Post]. Thank Him Not Me!!
I will not help in this thread as I am not a kernel Dev. I just kanged it here so there Can Be New Developers
Click to expand...
Click to collapse
Click to expand...
Click to collapse
I m getting an error which you've mentioned after applying this code
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libsdl-dev libesd0-dev libwxgtk2.6-dev libncurses5-dev lib32z1-dev gcc-multilib git-core && sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
Click to expand...
Click to collapse
EDIT: page not found https://github.com/bedalus/bedalusKERNEL
l0lh4rd said:
I m getting an error which you've mentioned after applying this code
EDIT: page not found https://github.com/bedalus/bedalusKERNEL
Click to expand...
Click to collapse
Ubuntu??
Which Device??
mithun46 said:
Ubuntu??
Which Device??
Click to expand...
Click to collapse
Ubuntu 12.04 LTS (x64)
l0lh4rd said:
Ubuntu 12.04 LTS (x64)
Click to expand...
Click to collapse
Device???????
@l0lh4rd
Your device probably has different sources. And the page was not found because bedalus doesn't have any public repo by that name anymore.
Below
Sent from my GT-S5360 using xda app-developers app
thanks i'll find a time and try.
I am going to say WOW. Is everyone as lost and confused about what this is or does? I know I am. First off. I think you started off with a very good Tut. The problem is, you never said what you are compiling or what its for. The more advance users can figure it out and actually understand what you said. But what about the n00bs here? If I understand the jibberish you are compiling a Arm kernel off of linux. It would have been more useful if you had mentioned that this is the Arm kernal for the android platform. It would have also been better if you had said what chip your where using. Is this for the Arm5, Arm6, Arm7? You should also give warning about compiling the kernal and how they can screw things up if they don't follow the steps properly and not to skip or try something that is not listed. You also say that you are using Ubuntu, which alot do, but not all. Some use other distro's and that this may not work on all flavors of linux. Some use different commands and some repo's don't work on all distro's either.
Other then that, pretty nice Tut.
mithun46 said:
Have you read this: http://forum.xda-developers.com/showpost.php?p=21006133&postcount=1144
In that spirit, I'm going to attempt to write a plain-English tutorial on what to do to build this kernel. In fact, change one or two URLs, and you could build practically any kernel!
Note: I'm assuming you're on a PC here. I'm also assuming this isn't your first trip to linux-land, and you've at least used the terminal a few times before now. I'm also going to assume that even if you are a noob, you're not mentally sub-normal.
Note2: If this is your first time building a kernel, you may want to print this out, and go slowly, and if you get stuck, post about it in the thread! It will help me improve the guide.
I'm a noob at building, but a professional at teaching. It's literally my job! In my noobishness, I made good records of pretty much every step, and I've got lots of time for explaining what each step actually does.
THE STEPS
You'll need one to compile stuff. "For Gingerbread (2.3.x) and newer versions, including the master branch, a 64-bit environment is required." (source)
OK. You're probably thinking of compiling a kernel for ICS or higher right? Is your computer only 32 bit? Pull the processor off the motherboard and count the pins. Just kidding. It won't matter if it is AMD or Intel, but it needs to be a 64 bit processor. I can compile a kernel with just 2GB of RAM and my processor is approaching its 9 year. Even with this lousy set-up, compiling a whole kernel from scratch takes only five minutes.
Install Ubuntu 10.04 64-bit. (Click on this link to download the install CD.)
If you've got a spare hard drive, use the whole thing. If you're good at partitioning, you might consider putting the linux swap partition on a separate disk. You'll want it to be at least 8GB. Putting it on a separate disk will speed things up.
If you don't have a spare disk, you're going to have to resize a partition of an existing OS, to make some new space for Ubuntu. Lets say a minimum of 12GB for the OS plus 8GB for the swap. The more space you can give to the OS, the easier your life will be if you're serious about building stuff.
At the end of the installation it will ask to install a boot-loader. This should be on sda (not sda1!) but you may need to adjust your BIOS to point at the right hard-drive if you later find it doesn't boot into Ubuntu when you restart. Don't worry about Windows, Ubuntu provides a boot menu, so you have the option of booting to Windows instead.
Once Ubuntu is installed, reboot then open a terminal and sort out your credentials:
Code:
sudo passwd root
Type in the password you set during the install, then decide on a password for the root user, and enter it once, then again for confirmation. It can be the same as your user password if you like.
Do some updates (this could take a while):
Code:
sudo apt-get update && sudo apt-get dist-upgrade
When it's finally finished, you'll have to reboot, then repeat until there's no updates left.
First, you need a whole bunch of packages. You could copy and paste this into your terminal:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" && sudo apt-get update && sudo apt-get install sun-java6-jdk
That's java sorted.
Next up is the dependencies for compiling stuff:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libsdl-dev libesd0-dev libwxgtk2.6-dev libncurses5-dev lib32z1-dev gcc-multilib git-core && sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
I think I remember getting an error for one of these. Possibly lib32readline5-dev. If you get that error, make sure you install everything else. Please let me know, and I'll update this step with a fix.
Make sure ADB is initialised:
Code:
gedit /etc/udev/rules.d/51-android.rules
and copy the below into a blank text file, then edit both instances of <username> to your Ubuntu username (lower-case!) and no chevrons: ="<bedalus>" is wrong. You want ="bedalus"
Code:
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
Now save the file!
Follow this link to Mentor Graphics Sourcery CodeBench LITE and do a free signup to get the download link. You can get hold of other ones, like Linaro or Google's own, but I'm using this as an example, because it's the one I use, and Ezekeel published some R&D here that showed there was no measurable benefit to one toolchain over another.
When you've downloaded it, you need to copy it to /opt:
Code:
cd /home/<username>/Downloads
cp arm-some-date-some-version-some-arch.tar.bz2 /opt
Note- Obviously that's not the actual name of the file! But you can see what it's really called when you download it.
Now go to /opt and unpack it:
Code:
cd /opt
tar xjf arm-some-date-some-version-some-arch.tar.bz2
So now you need to get some source code. You can use 'git clone' if you don't plan on publishing your kernel. But if you've made some modifications and want to share your end result, you need to obey the GPL terms for the linux kernel, which is Open Source, meaning that you are required to make your source available publicly.
Go to github: https://github.com/
...and sign up. It's just a free registration provided you are non-commercial. Github has some useful getting started tutorials, which I suggest you follow:
https://help.github.com/articles/set-up-git
(just follow that first page for now. I will walk you through git in a bit...)
Next, fork a repo:
Go to whichever kernel you like: https://github.com/bedalus/bedalusKERNEL
I'm using mine as an example. Look for the big 'Fork' button.
You've now got your own copy on github, and you can do whatever you like with it, without affecting the original.
However, it's no use if it exists only in the cloud. You need to get a local copy. You'll also want something called a 'remote tracking branch', which will enable you to keep up-to-date with the changes going on in the original repository that you have forked-off from.
Shout 'fork-off!' at the top of your voice.
Uh... okay. Now, to get a local copy, and set up your remote-tracking branches, execute:
Code:
cd /home/<username>/
mkdir mykernel
...you can name your new directory whatever you want. It doesn't have to be 'mykernel', then:
Code:
git clone https://github.com/<your github username>/bedalusKERNEL.git
In the above, put your git username, and substitute bedalusKERNEL.git for whatever your fork is called. You can actually copy and paste the URL from the top of your new github repo's page if you want.
It's going to download about 800MB if I remember correctly. This will take a while, so go have some marmite on toast.
When that's done, you're ready for the remote-tracking branch:
Code:
cd bedalusKERNEL (or whatever your fork is called)
git remote add upstream https://github.com/bedalus/bedalusKERNEL.git
git fetch upstream
The 'git remote add upstream' creates a new branch called upstream, and any changes that the original developer uploads to github can be fetched to your machine with the 'git fetch upstream' command. Notice how this time, the download time is much shorter? That's because of 'delta downloads' which only downloads the differences between what you have, and what they have. (There's some technical detail here.)
You can now enter:
Code:
git branch
...to see all your branches. At this point there should be 'origin' and 'upstream'.
Changing branches (you might as well do this now just to have a little go):
Code:
git checkout upstream
That will move you onto the upstream branch, as long as you haven't made any 'uncommited' changes in origin. (More on that later.) Change back to origin with:
Code:
git checkout origin
You might want to rename your branches to help personalise them, just to make remembering which is which a little bit easier. To change origin to 'my_version' do this:
Code:
git branch -m origin my_version
You can change upstream to 'their_version' or something else if you want to. It won't stop anything from working.
More Git Tips later. Let's sort out a build script. If you tinker with any code, you'll inevitably break stuff, and need to fix it, and then need to try building again... So, having a build script is going to save you a lot of time, because there are several steps that can be automated.
Here's how the start of my script looks:
Code:
#!/bin/sh
cd /home/dave/mykernel
git branch
read -p "Correct branch? [Y/N]: " -n 1
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo -e "\n"
exit 1
fi
This is just a little precaution that I put in to give myself the chance to abort the build before it starts if I'm on the wrong branch. If I don't hit y then the script aborts, and I can checkout the right branch, then restart the script.
Code:
echo -e "\nSTARTING...\n"
The \n prints a new line, then on that new line the message 'STARTING...' and then begins another new line. If you put \n\n you can print a blank line. The echo command is a good way of putting notices in a script so you know what stage it is at.
Code:
export PATH=$PATH:/opt/toolchain/bin/
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-none-eabi-
If you put these lines in your script, it sets 'environment variables' that tells the make program where to find the compiler, and what processor it's compiling for (ARM).
If you now save your script in the /mykernel directory you created earlier, git can keep track of it as well as the files integral to the kernel. Save it as whatever you like, e.g. "myscript.sh"
...It's important to have the .sh extension so the system knows it is a script.
To make your script executable, run:
Code:
chmod a+x myscript.sh
Before you execute the script, you need a .config file in the mykernel directory. If you've cloned my repo, you can get a working one by executing:
Code:
cp arch/arm/configs/crespo_release_defconfig ./.config
...this command will only work properly if you are in the mykernel directory when you execute it.
You can mess with this config file if you like! But it's very easy to break the kernel. However, you can always just copy the crespo_release_defconfig again.
Now, to execute the build script run:
Code:
./myscript
If you execute your script, your compiler will now build the kernel. It will take time, but even on my ten-years-old PC it takes less than ten minutes from scratch.
The compiler will spit out a lot of messages. Most of the time it's telling you that it has compiled an object (i.e. a .o file, which will all be linked up later to form the kernel) and sometimes you'll see warnings, which is the compiler telling you it thinks something might be wrong. Don't worry, most of the time the compiler is just being over-cautious.
If the compiler hits a real problem with the code, it will print an error, and tell you what file, and what line, and how far along that line it managed to get to before it didn't know what to do. I'll get back to this later. For now, let's assume everything compiled.
You'll see a message about the zImage being created. That's the kernel. You can't use it as it is, you need to put it into a boot.img so you can flash it.
I find it useful to add this command in my build-script:
Code:
ls -l /home/dave/mykernel/arch/arm/boot/zImage
ls -l means list with long format. It'll print out the entire contents of a directory with size, time, permissions, etc. if you execute it in a directory, or point it to a directory. However, in the command above, I've pointed it specifically at the zImage file, so it only prints out the details for that. This is so I can check the time. If the time is from yesterday, I can see quickly that there has been an error in the build, and the zImage is still the same one I built yesterday, or an hour ago... etc. depending on the time-stamp printed out.
If you get a 'No such file' error, it's because there is no old zImage, because you haven't ever successfully built one yet.
If you sat and watched the entire thing build, then the timestamp should show the current time, minus a few seconds.
Yay! You've built a kernel. Now you need to make everybody else flash it to their phones too
To do this you need to put it into a boot.img, and then into a .zip file.
Download this: http://d-h.st/wVZ (make-boot necessary files)
It's a small download. It's some very simple tools that can split an existing boot image into a ramdisk and zImage, and can also stitch them back up.
Move mkboot.zip into your mykernel folder, right click on it, and select 'Extract Here'. You can now delete mkboot.zip. There is a tool called unbootimg, that can take apart existing boot.img files, I've made things simple by including my own ramdisk, which is compatible with AOSP and CM ROMs. That file is called cyan2disk_new.cpio.gz
We now need to add some new stuff to the script to stitch our zImage and ramdisk together.
If you've not already added the ls -l command I mentioned above, also add this now. Then:
Code:
cp /home/dave/mykernel/arch/arm/boot/zImage /home/dave/mykernel/mkboot/
cd /home/dave/mykernel/mkboot
./mkbootimg --kernel zImage --ramdisk cyan2disk_new.cpio.gz --cmdline 'no_console_suspend=1 console=bull's --base 0x30000000 --pagesize 4096 -o boot.img
Remember, your username is not dave! Unless it is. Make the appropriate changes to the path.
How do I make the CWM flashable .zip file?
We're nearly there! This bit is relatively painless. At this point you could save and run the script to check that mkboot is working. If it has worked you can use the same ls -l trick from before, but this time target the boot.img file you just created. If the time-stamp is fresh, it means your boot.img is correct.
TIP: If you haven't switched branches, or run 'make clean', all your .o files are unchanged. The make program keeps track of changes, and only recompiles .o files when the corresponding .c file has been altered. If nothing has changed, your build script will execute very quickly!
To make a flashable .zip file, the easiest thing to do is modify an existing .zip file. You can download my kernel for simplicity, since it already has the necessary script for flashing the entire boot partition. (Most kernels here use koush's any-kernel script, which updates only the zImage and keeps the boot partition's existing ramdisk, so if you try to use another kernel .zip as a template, make sure you correct their updater-script. Using my ramdisk and kernel script will also ensure you keep MTP!)
Once you've downloaded my kernel you should extract it in your home folder, then rename the directory to something like 'myzip'
Now add these lines to your build-script:
Code:
cp /home/dave/mykernel/mkboot/boot.img /home/dave/myzip/boot.img
cp /home/dave/mykernel/drivers/scsi/scsi_wait_scan.ko /home/dave/myzip/system/modules/
"What's that second line? With the .ko file?" I hear you say. Depending on what modules you build, you'll need to copy all of them to the folder specified above. Fortunately, when the kernel finishes building, it tells you what modules have also been built. If you don't want modules in your kernel, you can remove the second line above. However, you must edit your .config file: Open it in gedit, use CTRL+F to open the find dialogue, then type "=m" Now, change every one you find into a "=y" ...so now instead of building modules, the kernel will now incorporate all that code into the zImage instead.
Finally, add this line to your build-script:
Code:
7z a -r -tzip /home/dave/mykernel.zip /home/dave/myzip/*
Run the script again. if everything has gone smoothly, then you now have a flashable .zip in your home directory!
Congratulations!
* * * * * * * * *
I've compiled a list of commands you may find handy when getting to know git.
Add a remote branch and track it
git remote add ezekeel git://github.com/Ezekeel/GLaDOS-nexus-s-ics.git
git fetch ezekeel
git checkout --track -b bln ezekeel/bln
Merge in the changes
git merge bln
Resolve conflicts
git mergetool
List local branches
git branch
List remote branches
git branch -r
Switch branch
git checkout branch_name
Rename a branch
git branch -m old_branch_name new_branch_name
View log with short sha1 hash
git log -10 --pretty=format:"%h - %ar: %s"
Restore to a particular point
(IMPORTANT! Don't do this if you've already pushed your commits to github!)
git reset --hard <sha1 hash>
Restore to your last commit
git reset --hard HEAD
Restore to one commit before your last commit:
git reset --hard HEAD^
Restore to two commits before your last commit:
git reset --hard HEAD^^ (etc.)
As long as you haven't pushed to github,
squash all your recent commits into one:
git rebase -i <sha1> ...then change push to squash (or fixup) for all except the first one
git rebase -i --abort (to abort!)
Add .file (i.e. hidden file)
git add .file (simple!)
Add all new and modified files
git add .
Deleting files
(i.e. after doing rm <files>)
git add -u (git will note which files have been deleted)
Bring files from a directory in another branch
git checkout cyanogenmod drivers/cpufreq/
Tells you what changes you've made so far
git status
Commit your changes
git commit (type in your notes about what you did, then CTRL+X then Y to save)
Sync your commits to your github repo
git push <repo_name> <branch_name>
Delete a remote branch
(WARNING: This will delete the entire branch from github
Note: You cannot do this to the default github branch, but you can change the default branch in the admin tab on the website)
git push <repo_name> :<branch to be deleted>
Find a file (useful for troubleshooting in some situations)
find /home/dave/ -name 'buildlean.sh'
(searches the home folder and subdirectories for 'buildlean.sh')
Find within any *.c file, the text "s5pv210_driver" (good for finding bits of code)
find ./ -type f -name *.c | xargs grep s5pv210_driver
Find within any file, the text "s5pv210_driver" (good for finding bits of code)
find ./ -type f | xargs grep s5pv210_driver
Special Mention : bedalus [Original maker of this Post]. Thank Him Not Me!!
I will not help in this thread as I am not a kernel Dev. I just kanged it here so there Can Be New Developers
Click to expand...
Click to collapse
excellent but! you will not have a custom kernel. why?
where did "make menuconfig" go?
you selected yes as default, what if i wanted a custom kernel w/o a "Y" for each?
i want to keep my kernel bare minimal. this is not for minimalistic kernel.?
how you pass other kernel params?
you can pass gcc optimizations in -Os but what if i wish to pass it in the kernel build process?
how on earth using this script? can i include firmwares? aka blobwares which are at times ultimate necessity.....?
what if i want to include my patch and the kernel w/o boot w/o special params or switch....?
how do i set the compression params?
well i am still the old school "make menuconfig" and that
cp arch/arm/configs/crespo_release_defconfig ./.config is not my cup of tea. i still like to roll my own kernel the orthodox method, than this automation.
this is okay if you are building your first kernel and you dont know the process. but this is not the right way if you want a complete fine grained inside out control of the device and the kernel.
NOPE NOPE NOPE!
but the git crash course is excellent. i wanted as usual a git flash cards. thanks
+5 to mithun for the git. everything else i found tasty but was a fruit salad, except git tut. which i found very very well documented.
+5 for git. and +1 for the effort for the kernel info.
hope this helps.
thanks
-paul
p.s. very good effort even tho its cut copy paste but the original post didnt address many kernel issues. hope its updated. hope you take it as a positive feedback.
---------- Post added at 03:08 AM ---------- Previous post was at 03:00 AM ----------
TheStrokerace said:
I am going to say WOW. Is everyone as lost and confused about what this is or does? I know I am. First off. I think you started off with a very good Tut. The problem is, you never said what you are compiling or what its for. The more advance users can figure it out and actually understand what you said. But what about the n00bs here? If I understand the jibberish you are compiling a Arm kernel off of linux. It would have been more useful if you had mentioned that this is the Arm kernal for the android platform. It would have also been better if you had said what chip your where using. Is this for the Arm5, Arm6, Arm7? You should also give warning about compiling the kernal and how they can screw things up if they don't follow the steps properly and not to skip or try something that is not listed. You also say that you are using Ubuntu, which alot do, but not all. Some use other distro's and that this may not work on all flavors of linux. Some use different commands and some repo's don't work on all distro's either.
Other then that, pretty nice Tut.
Click to expand...
Click to collapse
thats what i said, how you select the parms and fine controls like choosing the arm arch type. this doesnt do it. it copies the old config. which is excellent for new comers who wants to start to get their feet wet. but if you are building your custom kernel for arm or amd or i386 or mips? this is not at all helpful. if i were a new comer? i could have clicked on the thanks button. for an advanced user? this is a good read/timepass and nothing else. honestly because i got no control. :-s *Unacceptable*
and mithun you should also tell users how to include patches. if you write patches. how will you patch your kernel before you hit make and make bzimage? nope i am sorry this is good for a stock kernel. which has no info about patch and customization this is not complete. edit it and add more info. if you need help. feel free to ask. there are many kernel chaps here.
good luck mithun.
hope this helps.
thanks
-paul
p.s. i am pedantic at times and people hate me for that, but i am sorry i love being a pedantic moron.
Click to expand...
Click to collapse
Click to expand...
Click to collapse
this thread wanst clealry required man as xda-u already has a post regarding this .. so do something useful.most of the steps here are ready made kang stuff .
if my phone doesn't boot up what can be the cause? is there a specific file that i have to look at or not?
matt95 said:
if my phone doesn't boot up what can be the cause? is there a specific file that i have to look at or not?
Click to expand...
Click to collapse
We can never help without logs. But in this case logcat starts after the kernel has been loaded so you need to figure out what's wrong yourself
speed_bot said:
We can never help without logs. But in this case logcat starts after the kernel has been loaded so you need to figure out what's wrong yourself
Click to expand...
Click to collapse
Cause i'm trying to port the Ubuntu touch preview on my HTC One X but id remains on the bootanimation and i think that the problem is with the kernel itself
matt95 said:
Cause i'm trying to port the Ubuntu touch preview on my HTC One X but id remains on the bootanimation and i think that the problem is with the kernel itself
Click to expand...
Click to collapse
Boot anime can't work without a kernel
speed_bot said:
Boot anime can't work without a kernel
Click to expand...
Click to collapse
The problem is that it is stuck at the bootanimation, what can cause this? do you think it could be kernel related?
matt95 said:
The problem is that it is stuck at the bootanimation, what can cause this? do you think it could be kernel related?
Click to expand...
Click to collapse
First up. Does logcat work?
this is what i get
Code:
$ adb logcat
Unable to open log device '/dev/alog/main': No such file or directory
matt95 said:
this is what i get
Code:
$ adb logcat
Unable to open log device '/dev/alog/main': No such file or directory
Click to expand...
Click to collapse
Thanks for Education

[GUIDE][A First For Xda] How to Build a rom + more using only the Linux terminal!

How to build a CyanogenMod/Omni/Android Based Rom from source using only a Linux Terminal
A First for XDA I believe? So why this tutorial?
Originally when I was searching about for tutorials on how to build from source, they were all specific to those who use a GUI and this included downloading .zips with a browser and editing files through text editors, extracting files to certain locations and executing files through the file explorer such as "get-prebuilts.sh". There were some that used the linux terminal more then they needed too, this was helpful but not specific, this isn't going to be a tutorial like you see everywhere else, this will be made more specific to those who use either a remote machine, or people who want to use just the Linux terminal like a badass! This will have the commands I use, they may not be the most universally used or the simplest they can be but it's not broke so I shan't fix it! All these tutorials, for me, meant a lot of personal work google-ing and searching my way through commands, this was great as it has helped me learn a lot about Linux Terminal commands, but it has also caused me countless issues, such as uploading my final product and navigating around is a real pain in the ass. This meant it took me quite a while to get my first ever build using just the Linux terminal, and uploading it.​
ForewordRead first
For this tutorial I will try not to make it too device/situation/rom specific because, then that means people have to make changes, which, we will have experienced never ends well, but I will have two variations of the command, the first command will be the generalised command using a HTML style coding for where you should make your changes, an example of this would be for the code <DeviceName>, you would replace it with your device name minus the <>signs (obviously). To then check if you had done it right, I will add in my device name which for this tutorial will be the LG Optimus 4xHD (codename p880). As this may become confusing with many <*> codes popping up, and there are many codenames and device names to keep up with, I will be adding a legend/key with some of the syntax I will be using and what it means, but also include some of the more popular codename and manufacturer names for those who do not know what they are. This tutorial will not tell you how to set up a remote machine, only use a Linux terminal and nothing else much. It may also include a hidden "GUI Cheat" for those with GUI to check if you have done a step correctly. This will be aimed at Ubuntu 13.10 64bit, as you need 64bit to compile (to my knowledge anyway)​
Setting Up Your Build Environment
Okay so the easy-ish bit, this is mainly for people who either the administrator of their "Build Server" or Remote Machine as most "user-based" ones will almost always have theirs set-up for you. This will also be required by users who have set up Ubuntu/other Linux distribution on a host/local machine. You probably will not be able to do this on a user based Remote Machine anyway due to an absence of root access, if this is an issue and one is not setup and you do not have elevated privileges, email the corresponding admin for help! I can't help you here! So now down to business!​Installing the required packages should be as follows, although, if they do not work just google it, I'm sure there are many tutorials with many ways to set up a build environment:
Code:
sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
openjdk-6-jdk openjdk-6-jre pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev
NOTEIf any GUI comes up for any installation (not sure, been a while since I did it) It should be pretty self-explanatory, for example arrow keys to navigate, enter to select an option etc.
Setting Up Repo's
Okay, so repo is a blanket term here. It can be split up in order to simplify things for the purpose of this tutorial. Repo is a package type thing of commands for handling your repo's. You will need this for Initialising repo's (Repo init) and for syncing sources (Repo sync). I will not be going into different flag meanings, only those which I use in this tutorial.​
Installing the Repo package should be as follows, again google and let me know if I am wrong or it doesn't work!:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
NOTEEach $ sign represents a line of command, so you should press enter between commands. For example "mkdir ~/bin <ENTER>" <ENTER> being the action by the user. GUI Users on a local machine may need to reboot at this time or redo it a couple of times until it works, remote users should just disconnect and reconnect again.
Setting up working folders and understanding Directories
Many tutorials will have this step differing from one another, this is because it's all down to personal preference. I prefer to have just the RomName because it's less work, but some prefer to have "Android/<ROMNAME>" or "Android/system/<ROMNAME>". This is because of Git, if a package is called Android_frameworks_Base, it represents the directory <ROMNAME>/frameworks/base/.​
Setting up your working directories is dependent on which Rom you are building.
Generalised Code
Code:
$ mkdir ~/<ROMNAME>
$ cd ~/<ROMNAME>
Example Code
Code:
$ mkdir ~/carbon
$ cd ~/carbon
NOTEThis is creating a directory (mkdir) and navigating to it (cd) to go back when navigating use the "~" sign, it means "Home/<USERNAME>/" it skips some typing is all!
Initialising and Downloading the Repo
Okay so the repo part is perhaps the second longest of all processes you will have when building, it downloads the sources you need to compile with, this is approximately ~18gb maybe? Possibly? So you may need a fair partition or free space on your HDD/SDD for the building process as well.​
Generalised Code:
Code:
repo init -u <GITHUB_LINK_IN_ROM_MANIFEST/ANDROID> -b <CORRESPONDING_BRANCH>
Specific Code:
Code:
repo init -u https://github.com/CarbonDev/android.git -b kk
NOTEAt this point you will see some code and some download stuff, it's just the repo fetching some stuff, at this point, you will be prompted to enter a name and an email, you will either be prompted to enter it, or you will be given the commands needed to do it, this needs to be done, once completed, re-initialize the repo. This will only happen on your first time.
Downloading the code:
Code:
repo sync -j#
NOTE This is going to start the downloading of the sources, the -f is a force flag, this will stop you from receiving any errors in your repo and will re rep sync the source. Other flags can be -j which specifies how many objects to download at once, I choose not to use it but the syntax is -j<NUMBER_OF_JOBS> for example -j10, this should be used in conjunction with the speed and bandwidth of the internet connection supplied, -j4 is default and using a higher flag for a better connection will speed things up considerably, be sure not to over do it thou. See this post for more details!
Setting Up For Your Device
Okay so one of the more important parts, and the parts people usually use the GUI and browsers etc. for, this will be how to do it without those aids. Well on the remote machine anyway, a host machine with GUI is probably needed for changes and links. This will set up vendor, kernel, and device tree.​
General Code in order Kernel, Vendor, Device Tree:
Code:
$ mkdir -p kernel/<MANAFACTURER>/
$ cd kernel/<MANAFACTURER>/
$ git clone <KERNEL_GIT_LINK> <DEVICE_CODENAME/KENREL_NAME>
$ ls
$ cd ~/<ROMNAME>/vendor/
$ git clone <VENDOR_GIT_LINK> <MANAFACTURER>
$ ls
$ cd ~/<ROMNAME>/device
$ mkdir <MANAFACTURER>
$ cd <MANAFACTURER>
$ git clone <DEVICE_TREE_GIT_LINK> <DEVICE_CODENAME>
$ ls
$ cd ~/<ROMNAME>
Specific Code in order Kernel, Vendor, Device Tree:
Code:
$ mkdir -p kernel/lge
$ cd kernel/lge
$ git clone https://github.com/P880-dev/android_kernel_lge_x3.git x3
$ ls
$ cd ~/carbon/vendor
$ git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge
$ cd ~/carbon/device
$ mkdir lge
$ cd lge
$ git clone https://github.com/P880-dev/android_device_lge_p880.git p880
$ ls
$ cd ~/carbon
NOTE There are shorter ways I'm sure, but this works. "ls" checks files in the directory just to double check you did it right. To find the git link it will be on the github of the tree on the left in a box. This only clones the default branch, if it's different you must fork the tree and click settings>default branch and change to the needed one, and use the git clone box from there. Device tree's can be edited per rom on github, or in terminal, for the purpose of using terminal, I'll add to this tutorial.
Making Changes to files
If you are building whichever rom was on your default branch then I guess this step isn't too important for you unless you want to check the files over or you want to edit other files like envsetup.sh to change the build tools versions. This will use the cd, ls, and pico function for editing files. To change configs and stuff in .mk files in device tree. Most people would use gui for file editing and that's why I am showing you the method to do so with ease from the Linux terminal.​
General Code:
Code:
$ cd /device/<MANAFACTURER>/<DEVICE_CODENAME>/
$ ls
$ pico <FILENAME>
Specific Code:
Code:
$ cd device/lge/p880
$ pico cm.mk
NOTE This will open a text editor, the key at bottom represents ctrl + <LETTER> to do different functions. The main ones you use will be "ctrl x" because that is exit. After that you can either edit the name after the changes you made, for example changing CM to Carbon if you were building carbon. You can navigate to any directory, and pico <FILENAME> to edit it! It is easier to make these edits using github after forking a repo, usual changes need to be done to cm.mk and vendorsetup.sh, to know what needs changing, swap cm with the name of the rom, and check the vendor_rom of the rom for the config directories, for nfc and carbon, place a # at the start of the line, this is called hashing out. Change cm.mk when saving or by using mv <FILENAME> <NEW_FILENAME>.
Building the Rom
Okay so now that wasn't too bad was it? Setting up? Some devices that are officially supported do not need the above steps, but then again, if you was officially supported, why would you need to build? Anyways, this will show you how to get the pre-builts (if needed) and how to start the build of the rom. Cheated and used the GUI yet? If not, Good on ye! I will be adding the commands for adding legacy drivers and some other miscellaneous codes and commands in the next post! Including ccache for those who are on host/local machines rather than remote machines.​
Generalised Code:
Code:
$ cd ~/<ROMNAME>/vendor/cm
$ . get-prebuilts.sh
$ cd ~/<ROMNAME>
Option #1: $ . build/envsetup.sh
Option #2: $ source build/envsetup.sh
[I]This last step varies between rom, so I will give the most generalised, check the manifest or building tutorial for the Rom to find out the way to build[/I]
$ brunch <DEVICE_CODENAME> -j<NUMBER_OF_CPU_CORES_+1>
Specific Code:
Code:
$ cd ~/carbon/vendor/cm
$ . get-prebuilts.sh
$ cd ~/carbon
$ . build/envsetup.sh
$ lunch
$ corresponding number
$ make carbon -j18
NOTE This will then start the build, this can take from 1-10hours to build depending on performance and other variables, it takes me ~1hour 15mins for a build of a KitKat Rom. Each ROM has a different build script, this means it can be a different chosen command each time, brunch is the most commonly used, check their manifest or look for a ROM specific building tutorial. -j# is the amount of jobs it will compile at one time, putting an insane number will not make it build faster. Put the amount of cores +1 to be safe. My server has 16cpu threads, and can handle -j18. A -j flag is not needed. Some build scripts support a time brunch <DEVICE_CODENAME> flag to time how long the build has taken. You may be prompted to enable colour display, enable, it looks pretty.
Completed Build, Now What?
So on this journey you have set up a build environment, set up your repo's, and device specific changes needed to buid and you have built a rom. So how do you access the build you just worked your ass off for? For the average user like me who does not have access to ftp, you can either use a program called plowshare as a non root user, or use a command line tool made by xda user GermainZ to upload to devhost using a python script. This is what we will set up next. Or you can use the GUI and extract the Rom and move to your phone straight, for us using remote machines we cannot do this, so we must upload.​
Devhost Set-Up code (supports Anon Uploads):
Code:
$ cd ~/
$ git clone git://github.com/GermainZ/dev-host-cl.git dev-host-cl
$ cp dev-host-cl/devhost-py2.py ~/bin/devhost
$ chmod +x ~/bin/devhost
Uploading your ROM:
Code:
$ cd out/target/product/<DEVICE_CODENAME>/
$ ls
$ devhost upload -u <USERNAME> -p <PASSWORD> <ROM_ZIP_FILE_NAME>
Example:
Code:
$ cd out/target/product/p880
$ ls
For anon upload: $ devhost upload CARBON-KK-UNOFFICIAL.zip
For user upload: $ devhost upload -u username -p password CARBON-KK-UNOFFICIAL.zip
$ cd ~/carbon
Before building again make sure you either:
Code:
A: $ make clean
B: $ make clobber
To remove the directory fully:
Code:
$ cd ~/
$ rm -rf <ROM_FOLDER_NAME>
NOTEThis is installing the script for python 2, if you use python change "python-py2.py" to just "python.py". Do this if it doesn't work first time for you also. Plowshare will be in the miscellaneous post below this one for other codes for users who do not wish to use devhost. The link to the Rom will be on the bottom of the terminal after it is finished uploading. Some errors are server based, make sure you check the error if you are given one.
Did you make it?
Did you manage to complete it without using GUI and cheating? I bet you did! Post in the thread (Don't quote anything) saying you successfully completed the challenge of using no GUI and link to the finished product and I wall add your name to the "Hall of Fame" that will be placed either at the bottom of this thread or on the bottom of the next post! This should now help give you more experience in building from source with a Linux terminal for uses who have no previous experience, or are new to having access to a remote machine.​
Foot Note
So here is my tutorial on how to build a rom from source using no gui and only the Linux terminal, it is a longer process but is the only process when using a remote machine. I hope I made it easy to understand and I hope you will stay to read the other miscellaneous codes and commands that are still to come on the next post. This tutorial was written up by scratch by me, I thank GermainZ for the devhost script, but I had no help in writing up this tutorial, I believe it may also be a first for xda as when I was searching, I didn't find one to follow. Commands in this are done the long way I know. I will explain why and add how to shorten them and some other shortcuts in the miscellaneous section at the bottom of this thread.
Fluoxetine.​
Miscellaneous
Okay so as promised throughout the thread this section is going to contain other codes that may be useful to you (after gaining experience) including some shortcuts for coding that are really simple, it will also include other scripts such as plowshare for those who hate devhost (can't see why you would thou). I plan to continuously add to this part of thread with extra goodies, so keep posted here. For this purpose I will be using HIDE markers for each code as they are optional, and not for everyone. The key for the HTML style syntax I used for this thread (as self-explanatory as it is) will come at the bottom of my opening posts for this thread, kinda like to round it off you could say haha. Logically they should go at the top, however I am neither Spok nor Sheldon Cooper!​
Legacy Folders (Display and Audio)
Code:
$ cd ~/<ROMNAME>/hardware/qcom/
$ git clone https://github.com/Evervolv/android_hardware_qcom_display-legacy.git display-legacy
$ cd ~/<ROMNAME/hardware/qcom/
$ git clone https://github.com/Evervolv/android_hardware_qcom_audio-legacy.git audio-legacy
$ cd ~/<ROMNAME>
Plowshare
Code:
$ wget http://plowshare.googlecode.com/files/plowshare4-snapshot-git20YYMMDD.GITHASH.tar.gz
$ tar xvzf plowshare4-snapshot-git20YYMMDD.GITHASH.tar.gz
$ cd plowshare4-snapshot-git20YYMMDD.GITHASH
$ make install PREFIX=/home/$USER
See this for more information on using plowhshare: https://code.google.com/p/plowshare/wiki/Readme4 [/CODE]
Shortcuts and other codes (WIP)
#Grouping Commands
Code:
$ mkdir cm && cd cm
&& is a grouping command, it literally means "And then"
#Making Paths
Code:
$ mkdir -p kernel/lge
$ cd kernel/lge
-p flag with mkdir creates a path instead of mkdir * cd * mkdir * cd
#Moving and Copying Files
Code:
$ cd ~/home && mv file.txt ~/home/documents
This will move the "file.txt" to your documents.
$ cd ~/home && scp file.txt ~/home/documents
This will copy the "file.txt" to your documents.
#Removing files and Directories
Code:
$ rm -rf ~/home/documents
This will remove the folder "documents"
$ cd ~/home/documents && rm file.txt
This will delete the file.txt
#Downloading Files/Patches
Code:
$ wget file.link
$ wget github.com/commit.patch
$ git apply commit.patch
Add .patch to the end of the commit to make a patch, navigate to the corresponding directory where it needs to be applied, wget it, and apply the name of it.
#SpeedTest
Code:
$ git clone https://github.com/sivel/speedtest-cli.git
$ cd speedtest-cli
$ ./speedtest_cli.py
This will test download and upload speeds.
[/HIDE]
[B]Device Codenames (Should always be lowercase) (WIP)[/B]
[HIDE] [CODE]
LG Optimus 4xHD p880
Nexus 4 Mako
Nexus 5 Hammerhead
Nexus 7 WiFi Flo
Nexus 7 LTE Deb
Manufacturer Names (Should always be lowercase) (WIP)
Code:
Sony
Lge
Samsung
Asus
Htc
Well, here we are, the Key
Code:
<ROMNAME> Name of the Rom, Carbon, Cm, AOKP, AOSP, Beanstalk, DU, There's plenty to choose from!
<DEVICE_CODENAME> Find the codename for your device from it's github as it is most likely going to be used there!
<GIT_LINK> The link to the corresponding package/manifest on github, google to find the roms github and then search it's repo's
<MANAFACTURER> Well, who made your phone? Check devices github for this one too!
<CORRESPONDING_BRANCH> The branch the manifest is on github, it will most likely include this with the repo link for your convenience
If I missed something, a friendly PM will do! Don't want any confuffled users here!
Hall of Fame for users who managed to follow this confusingly long guide!
Code:
Just Me for now, to get your name put here (will be tagged) just post in thread with an [B]"Hey Fluoxetine! I completed the building with Linux Terminal Challenge, Here is my finished product (Link to product) and I didn't cheat by using the GUI! You're the best!"[/B]
Closing Statement
Well guys, I thank you for taking the time to read and follow my tutorial on building from source using only the Linux terminal, this is a great way to build some experience, maybe gain some confidence in building from source and help you get some original work under your belt! To my knowledge, I believe this is the first tutorial which is specifying on how to build using just the Linux terminal and with some extra goodies! I will keep this updated as both Linux, and android evolve in order to keep it up to date, in mainstream with xda and to just make users life that little bit easier. I think this also proves, even noobs can turn things around by studying up, I managed to learn and write all of this within 3weeks of having an android phone! (16, had an iPhone before, big mistake) Would be great to have this featured on xda *Hint Hint* Vote for it! *Hint Hint*. Wonder if this could qualify for xda university material? Haha, anyways, hope this helped!​
Fluoxetine.
Other Stuff No One Will Read
Thanks go out to Rom Dev Teams, xda for giving a place to post this, GermainZ for his devhost script, and Danny19901 for testing and proof reading basically anything and everything I shove infront of him! Haha!​
Donations
I don't like Electronic Payments, the middle man always takes his cut and it's not fair, I don't want donations, cut out the relay and the time, PM with the amount you want to Donate, and I'll send you the link to an amazon item with my details for you to buy for me and have sent straight to me! Would be much appreciated! Will probably be food, I love food :'3
Requests for Rom builds or additions to this post
PM, PM, PM, I do not care about getting messages (In fact it makes me feel loved) So do not be scared to request a Rom build, or request I add something I have missed out from this tutorial! All requests welcome, however this is not going to be a Q&A Thread with compilation issues, it is purely for the knowledge of how to compile, if you have problems with setting up/changing files/navigating, by all means post, all "Error" posts that are not specific to me will be cleaned because I probably won't know how to fix ^.^
Some Hardware Issues
Okay so some of users out there will be thinking "Hmm, is my hardware good enough to build a whole rom with, I can't even run battlefield or -otherGameHere-. The short answer to this is that you probably can, it may just take a little while longer for you, I think you need to have a 64bit machine full stop. However you also need RAM, a fair bit of it, at least 4gb if you plan to compile and nothing else. If not, you can compile on 1ghz, just will take a while and may freeze so keep checking and make the terminal as small as you can. SWAP May be your best friend for those with GUI, this doesn't apply for Remote Machine Users. You can format a partition on your HDD/SSD, or on a USB Stick (preferred) as a Linux Swap partition of 4gb+ to use as extra Rom, just format and swap-on using Gparted which should be installed on Ubuntu standard.​
GPL, Disclaimer, And Goodbye
So here we go, if you do build a Rom following this tutorial, be sure to release/add the kernel source on github to your thread in order to be compliant with the GPL, otherwise you may be in a spot of trouble, that being said I am not responsible for anything that happens to you/your machine/your phone/tab/anything really, unless this wins you the lottery or a similar payload, in which case I love you and we should get married (No Homo) haha.​
Additions, Edits, Other stuff that doesn't fit anywhere else really haha
Okay so what about the other types of cool things you can do to make this maybe a little bit easier? Well even like you guys probably are i am also still learning how to properly use git, and linux etc. so here i will be adding any of the cool things i learn. This will be great as a reference for me to look back at resources and recollect any information that may filter out of my brain, but may also be useful for you to learn at the same rate as i do! So check it out ​
Okay so today (18.02.14) i found a cool little trick using .sh files to help with the whole setting up malarcky and can make it easier if you plan to build the same rom on a weekly/nightly basis.
Okay, so what you can do whilst in the terminal is to add a file on a text basis, you can do this by running
Code:
$ pico setup.sh
This will open up the text editor on a blank document in which you can edit yourself, this is what you need, to begin with you should probably aim to write something for on screen guide/a type of ui just to let you know whats happening, this will work like a build script does, infact the same method can be applied there. Okay so whatneeds to go into it? First you want the print, this is displayed using a command known as echo.
Code:
echo 'Whatever you want to write'
This will displayed when you execute the script. So what next? Well you can choose to have it run a ui print after each action or just once at the start and then leave it to default ui to guide you. So how do you set the actions you want to do? Simply just start writing the commands!
Code:
echo 'setting up'
mkdir -p kernel/<MANUFACTURER> && git clone <KERNEL_CLONE_LINK> <CODENAME> && cd ~/<ROMNAME>/vendor && git clone <VENDOR_CLONE_LINK>
<MANUFACTURER> && cd ~/<ROMNAME> && mkdir <MANUFACTURER> && cd <MANUFACTURER> && git clone <DEVICE_CLONE_LINK> <CODENAME> && cd
~/<ROMNAME>/vendor/cm && sh get-prebuilts && cd ~/<ROMNAME> && . build/envsetup.sh && breakfast <CODENAME> && brunch <CODENAME> -j7 && cd
~/<ROMNAME>/out/target/product/<CODENAME>/
This will set up the kernel, vendor, and device and start building the rom, you may want to remove/add steps but that is how you can do it if you want to build multiple times, this can take a while to ammend for each different rom you use but it works like a dependencies file. To add UI after each one just add it after each step (short version example to follow)
Code:
echo 'setting up'
Mkdir -p kernel/<MANUFACTURER>
echo 'Cloning Kernel now'
Save this file with ctrl +w and save as a .sh file. Once this is done and in your root, working directory you can simply do:
Code:
. setup.sh
Or whichever you set it as!
NOTE
This may not always work, but it is a good way to set up quickly and efficiently, if a step goes wrong it is best to continue manually rather then re-executing the file, for those with GUI, you can just double click the sh file, this does include the prebuilts from CM, you cann a step by using the && command or create multiple scripts to run one after the other to do a separate job. This does require default branches on github to be the ones you are going to be using. The one i use as an example for carbon is as follows
Code:
echo "Setting up Kernel, Vendor, and Device ready to build Carbon Rom"
mkdir -p kernel/lge && cd kernel/lge && git clone https://github.com/P880-dev/android_kernel_lge_x3.git x3 && cd ~/carbon/vendor && git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge && cd ~/carbon/device && mkdir lge && cd lge && git clone https://github.com/Fluoxetine/android_device_lge_p880.git p880 && cd ~/carbon && . build/envsetup.sh && lunch p880 && make carbon -j30 && cd out/target/product/p880/
Great job mate very useful thread
Sent from my LG-P880 using Tapatalk
Nice work mate! I'm a noob but very interested in these type of things and this looks very useful.I'll see if I can do a 'Lil something with this and let you know if it works out!kudos my man!
Sent from my HTC One using xda app-developers app
nice very good thread for our p880 maybe there will not be more q's about bugs and other stuffXD
i will try this challange later i am tired a bit of building roms by myself, because i have lot of work..
btw i didnt know there are some gui tools for building romsXD
If I may add a suggestion repo sync -f is not the best idea (at least for the first sync), as if a repo can't be downloaded, it just gets skipped, but the repo script still does on syncing, which means you may be missing some source code in case something goes wrong.
So repo sync should be better, at least for the initial sync. Also, the -j flag can speed up things extremely, on systems with a good internet connection, the default is -j4 (if you don't specify another value), but if you run this on a speedy connection, it will slow the DL extremely down.
I, for one, am running -j20 on my home connection (~1.2MB/s DL), but -j80 on a server, I have access to (dunno the exact max speed, but it's fast enough to sync CM in under 7 minutes ). -j4 would take an eternity, as it cannot use the entire bandwidth of the server
BTW, the codenames and manufacturers usually are all lowercase
laufersteppenwolf said:
If I may add a suggestion repo sync -f is not the best idea (at least for the first sync), as if a repo can't be downloaded, it just gets skipped, but the repo script still does on syncing, which means you may be missing some source code in case something goes wrong.
So repo sync should be better, at least for the initial sync. Also, the -j flag can speed up things extremely, on systems with a good internet connection, the default is -j4 (if you don't specify another value), but if you run this on a speedy connection, it will slow the DL extremely down.
I, for one, am running -j20 on my home connection (~1.2MB/s DL), but -j80 on a server, I have access to (dunno the exact max speed, but it's fast enough to sync CM in under 7 minutes ). -j4 would take an eternity, as it cannot use the entire bandwidth of the server
BTW, the codenames and manufacturers usually are all lowercase
Click to expand...
Click to collapse
Added your changes, and some suggested by @me4488 so thanks for that guys, in addition to this and to kinda bump the thread i did add another
Additions, Edits, Other stuff that doesn't fit anywhere else really haha
Click to expand...
Click to collapse
Section with a build script type creating thing in it for users to muck about with
Hope this is of a help to you all!
Damn this is a big thread
it look really great but... i would like to use the offical tree and blobs...... i got a lot of it done oke but i seems to get lost in finding the "offical" vendor in step setting up for your device.
could any body help me out? just trying to compile offical cyanogenmod just to try. and to understand how it all works.
ok i got something starting
but i get this message
You are attempting to build with an unsupported JDK. will find and try to install the right JDK
moneyvirus said:
[..]
but i get this message
You are attempting to build with an unsupported JDK. will find and try to install the right JDK
Click to expand...
Click to collapse
what's the output of?
Code:
java -version
laufersteppenwolf said:
what's the output of?
Code:
java -version
Click to expand...
Click to collapse
It seems he is using java1.7 .. He must change all things to work under 1.6 but i dont remember how XD it is explained somewhere at xda university
Sent from my LG-P880 using xda app-developers app
gerciolisz said:
It seems he is using java1.7 .. He must change all things to work under 1.6 but i dont remember how XD it is explained somewhere at xda university
Sent from my LG-P880 using xda app-developers app
Click to expand...
Click to collapse
well apperently i'm not using java 1.7.
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
this is what i got @laufersteppenwolf
moneyvirus said:
well apperently i'm not using java 1.7.
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
this is what i got @laufersteppenwolf
Click to expand...
Click to collapse
I mean there was a command which shows every detail about wchich things are using which java.. Sometimes you can have java 1.6 installed but some parts of system are using 1.7.. Ill try to find it
Edit. I remember it was in compiling cm11 thread somewhere on xda.
There was something about setting up java alternatives AS far AS i remember
Sent from my LG-P880 using xda app-developers app
Nice tutorial If i was a developer of roms o would definetely use your way, i like the old school linux throught terminal exploring
Sent from my LT22i using xda app-developers app
moneyvirus said:
well apperently i'm not using java 1.7.
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
this is what i got @laufersteppenwolf
Click to expand...
Click to collapse
Alright, then just ignore the error It's saying it'd be the wrong java version, because you're using openJDK, and not oracle, but openJDK is just as fine as oracle
gerciolisz said:
I mean there was a command which shows every detail about wchich things are using which java.. Sometimes you can have java 1.6 installed but some parts of system are using 1.7.. Ill try to find it
Edit. I remember it was in compiling cm11 thread somewhere on xda.
There was something about setting up java alternatives AS far AS i remember
Sent from my LG-P880 using xda app-developers app
Click to expand...
Click to collapse
Java 7 (1.7) is also compatible. It isn't officially supported, and you might run into problems compiling pure AOSP, but other custom ROMs should compile just fine
Thanks for the feedback i'm still having 1 question the Vendor, the unoffical tree is completly clear but i can't find it in the offical source so i mean something like
$ git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge but than on the offical cyanogenmod github.
moneyvirus said:
Thanks for the feedback i'm still having 1 question the Vendor, the unoffical tree is completly clear but i can't find it in the offical source so i mean something like
$ git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge but than on the offical cyanogenmod github.
Click to expand...
Click to collapse
here you go:
Code:
cd vendor
git clone [email protected]:TheMuppets/proprietary_vendor_lge.git -b cm-11.0 lge
croot
ok i found it..
source: http://forum.xda-developers.com/nexus-4/general/guide-cm11-how-to-build-cyanogenmod-11-t2515305
Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the right Java location and version:
Code:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
If they are pointing to the wrong versions you have to change that to OpenJDK6.
Select the default Java version for your system:
Code:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
That's it.
Click to expand...
Click to collapse
when i had problems with compiling and got some famous errors i changed to this OpenJDK6 with this method and it solved it so if is not solution for your problem maybe its helpful for others
when i was compiling some time ago i must read few compiling threads to make it work and understand it
ok probbably this is a really stupid from my side but this is what i did.
and probbably i'm too noob for this, but i tried this:
i downloaded by example rastakat.
downloaded all the steps... without any error.
But in the last step when i type lunch and i have to choose wich version i would like to compile i can't find P880......
i have the feeling i have to edit some stuff but to be honest i don't know that yet....
will try later on.
maybe you need custom local manifest to p880-dev sources or official p880 sources..
moneyvirus said:
ok probbably this is a really stupid from my side but this is what i did.
and probbably i'm too noob for this, but i tried this:
i downloaded by example rastakat.
downloaded all the steps... without any error.
But in the last step when i type lunch and i have to choose wich version i would like to compile i can't find P880......
i have the feeling i have to edit some stuff but to be honest i don't know that yet....
will try later on.
Click to expand...
Click to collapse
You've set yourself a pretty hard task, first of all, compiling a yet unsupported ROM, but mostly a (more-less) AOSP ROM...
this means you can't use lunch, but you need to do the following:
Download the p880-dev device tree, kernel and vendor blobs
Edit the "inherit" paths inside the .mk files of the device tree
Without (except for the above mentioned) changes, you can run "lunch cm_p880-eng"
Then you can make -j<your_value> bacon

Categories

Resources