Related
Building CM9 from Sources for O2X
This Guide is a Step by Step Guide to Build CM9 from official CM9 Sources.
It based on:
aMpeX`s [TUTORIAL] The Step-By-Step guide to build Cyanogenmod7 for the LG Optimus 2X
loganmc10`s [GUIDE] Building CM9 for G2X
I only change to P990, respectively CM9 and add the fix for working Baseband
You need:
- a installed Linux, (I use Ubuntu 11.10, 64 Bit)
- a fast PC or Notebook is recommended
- a fast internet-connections is recommended, (you have to download several GBs)
There are 10 Steps, (8 for building, and 2 optionals ):
1. Installing Build-Packages
2. Install and setup Android-SDK
3. Update path
4. Create directories
5. Install repository and download CM9 Sources
6. Fix for non working camera
6a. Fix the known issues
7. Compiling Unofficial CM9 Build
8. Fix unknown Baseband
9. Extended building
10. Optional changes
Some infos before start:
- read the whole Guide carefully, (possibly you have to read it a few times, untill you understand all steps)
- if you do it exactly as explained, there should be no problems, and the result is a working Unofficial CM9-Build
- don`t login to Linux as root
- if you get problems, feel free to PM me, if you can`t post in Dev-Forum
lets start,
1. Installing Build-Packages
install this for 32 bit and 64 bit:
Terminal:
type:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jdk pngcrush schedtool
NOTE:
this will install Open-JDK instead of Sun-JDK,
(Sun-JDK isn`t longer official available for Ubuntu)
this will result in an error message at the beginning of compiling,
just ignore it, compiling will working fine.
If you want to install Sun-JDK instead of Open-JDK,
the user tonyp has made a tutorial.
use this line instead of above one
Terminal:
type:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
than go to this tutorial
for me the tutorial above doesn`t work (Ubuntu 11.10 64 Bit)
this is working for me:
open terminal:
Code:
sudo add-apt-repository ppa:ferramroberto/java
Code:
sudo apt-get update
Code:
sudo apt-get install sun-java6-jdk sun-java6-plugin
Code:
sudo update-alternatives --config java
(note: you have to press the tab button to be able to press ok, after the last command )
install this for 64 bit also:
Terminal:
type:
Code:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.4-multilib g++-4.4-multilib
2. Install and setup Android-SDK
Download newest Android-SDK from here (Linux (i386) )
Extract the Zip-Package to a directory of your choice
Terminal:
navigate to the tools-folder of Android-SDK and type:
Code:
./android
this will launch the AVD-Manager
check repository, select newest repository, and click install packages
3. Update path
go to your Home-Directory, and press CTRL + H to show hidden files,
open .bashrc
and add this:
Code:
export PATH="/home/<yourusername>/<path to the android SDK >/platform-tools/:${PATH}"
export PATH="/home/<yourusername>/bin/:${PATH}"
now you have to log out and in again for the changes take effect.
now check if changes are working,
Terminal:
type:
Code:
adb devices
you should see something like this:
[email protected]:~$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
Click to expand...
Click to collapse
4. Create directories
Terminal:
type:
Code:
mkdir -p ~/bin
Code:
mkdir -p ~/android/system
5. Install repository and download CM9 Sources
Install repository
Terminal:
type:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Code:
cd ~/android/system/
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics
enter name, email adress, and choose if you want colors or not
Download CM9 Sources:
Terminal:
type:
Code:
cd ~/android/system/
Code:
repo sync
depending on your internet connection speed this can take several hours
press CTRL + H
go to :
/android/system/.repo/
create:
local_manifest.xml
paste into local_manifest.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/lge/p990" name="CyanogenMod/android_device_lge_p990" />
<project path="device/lge/star-common" name="CyanogenMod/android_device_lge_star-common" />
<project path="vendor/lge" name="Owain94/proprietary_vendor_lge.git" remote="github" />
</manifest>
Terminal:
type:
Code:
cd ~/android/system/
Code:
repo sync
6. Fix for non working camera
download this zip-package MediaFire SolidFiles.
(I don`t make this patch, and don`t know who had made it, if you made it PM me and I`ll give credit for your work)
Extract the Zip-Package to a directory of your choice.
Terminal:
type:
Code:
cd ~/android/system
Code:
patch -p1 <
NOTE: after "<" there has to be a "blank space" (press spacebar)
now drop the first ...diff file from extracted package into terminal, the path will be automatically added,
run the created command,
the same procedure for the other 4 files
6a. Fix the known issues
for broken building:
open:
device/lge/p990/BoardConfig.mk
delete line:
Code:
BOARD_TOUCH_RECOVERY := true
For mobile data fix:
place this file to android/system/system/core/init/ (overwrite excisting file),
7. Compiling Unofficial CM9 Build
Terminal:
type:
Code:
~/android/system/vendor/cm/get-prebuilts
Code:
cd ~/android/system/
Code:
. build/envsetup.sh
Code:
brunch p990
depending on your PC or Notebooks specs compiling will take from 30 minutes to several hours
you can find your Rom-Zip-Package at:
/android/system/out/target/product/p990/
Click to expand...
Click to collapse
8. Fix unknown Baseband
open your Rom-Zip-Package and extract /system/build.prop
(don`t close Archivmanager)
open build.prop:
delete line:
ro.modversion=9-...-UNOFFICIAL-p990
Click to expand...
Click to collapse
(thanks to owain94 for deleting line info)
find line:
ro.cm.version=9-...-UNOFFICIAL-p990
Click to expand...
Click to collapse
replace this line with:
ro.cm.version=9.0.0-RC1-p990-UNOFFICIAL
Click to expand...
Click to collapse
save build.prop
drop modded build.prop into Archivemanager (/system, overwrite existing file)
Now your Unofficial CM9 Build is ready to install
------------------------------------------------------------------------------------------------------------------------------------------------------------
9. Extended building:
I decided to make a optional 9. Step to have a better building experience
(all tipps by owain94, thanks)
This Step is a replacement for Step 7!
Terminal:
type:
Code:
cd ~/android/system && clear && cd vendor/cm && ./get-prebuilts && cd ../../ && clear && . build/envsetup.sh && brunch p990 2> warn.log
this command downloads the cm-prebuilds,
sets up the build environment,
start the building,
exports all warnings and errors to a text file
and cleans the Terminal.
open another Terminal
type:
Code:
cd ~/android/system && clear && tail -f warn.log
this command cleans the terminal,
shows the warnings and errors in this second Terminal,
and keep the focus on it,
first terminal only shows the building process,
so it`s much easier to catch problems while compiling.
If you have connected two screens to your PC or Notebook,
you can also place second Terminal on second screen.
you can find your Rom-Zip-Package also at:
/android/system/out/target/product/p990/
Click to expand...
Click to collapse
10. Optional changes:
Fix for working torch and torch power-widget:
"activate" torch and power-widget:
open:
/android/system/packages/apps/Torch/res/values/config.xml
add or change to:
Code:
<bool name="useCameraInterface">true</bool>
open:
/android/system/packages/apps/Settings/res/values
add or change to:
Code:
<bool name="has_led_flash">true</bool>
add Torch.apk to the package:
open:
/android/system/device/lge/star-common/star.mk
change:
Code:
## LGE stuffs
PRODUCT_PACKAGES += \
LGEServices \
bridgeutil \
libbridges \
libbridge \
libbridge_jni \
secureclockd \
libsecureclock \
screencap \
hwprops \
com.android.future.usb.accessory
to:
Code:
## LGE stuffs
PRODUCT_PACKAGES += \
LGEServices \
bridgeutil \
libbridges \
libbridge \
libbridge_jni \
secureclockd \
libsecureclock \
screencap \
hwprops \
com.android.future.usb.accessory \
Torch
Credits:
aMpeX, loganmc10, pastime1971, owain94, tonyp, temasek
The -j part isn't needed anymore the build script figure it out on their own
and for the vendor files you can ad this to the local manifest
<project name="koush/proprietary_vendor_lge.git" path="vendor/lge" remote="github" />
it is less work we don't want to do to much
also this is maybe a nice addition
Code:
clear && cd vendor/cm && ./get-prebuilts && cd ../../ && clear && . build/envsetup.sh && brunch p990 2> warn.log
i use this build line
clear - make my terminal nice and empty
cd vendor/cm && ./get-prebuilts && cd ../../ - get the cm prebuilts
clear - make the terminal clean again
. build/envsetup.sh - set up the build env
brunch p990 - lunch and bacon for the p990
2> warn.log - exports al the warnings and errors to a text file to keep the terminal clean
i have three screens attached to my pc
on one screen i run the above command (clear && cd vendor/cm && ./get-prebuilts && cd ../../ && clear && . build/envsetup.sh && brunch p990 2> warn.log)
on another screen i run this command (clear && tail -f warn.log) this will print (and keep track of) the warn.log file with all the errors and warnings
and on the other screen i do useless stuff hehe
anyway i really like to use 2 terminals it is just easier to catch problems
Nice tut mate!
Sent from my HTC One X using xda premium
reserved
great guide bro.
Edit:
If anyone wants to install the SUN JDK instead of Open JDK you can install it from the partner repository:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
Thanks, for your replies, I'll change my Guide at the evening.
Gesendet von meinem HTC One S mit Tapatalk 2
Great! Maybe I will stay building
Sent from LG 2X using Tapatalk 2 Elite
Thanks a lot !!
The Guide is updated, (big thanks to owain94).
I`ll add a new Step or Section (lets see, atm I don`t know) for extended Build-Line and possibly multiscreen using, I`ll test it while compiling for my One-S.
i am getting an error
make: *** No rule to make target `out/target/product/p990/obj/lib/libnvdispmgr_d.so', needed by `out/target/product/p990/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/LINKED/libsurfaceflinger.so'. Stop.
plz help me..
thanks for the tutorial.
podanimesh said:
i am getting an error
make: *** No rule to make target `out/target/product/p990/obj/lib/libnvdispmgr_d.so', needed by `out/target/product/p990/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/LINKED/libsurfaceflinger.so'. Stop.
plz help me..
Click to expand...
Click to collapse
did you sync the vendor files?
libnvdispmgr_d.so is a vendor file that cannot be build because we don't have the sources
you need to sync them from koush his github or extract the vendor files using the script in the device folder
good luck
owain94 said:
did you sync the vendor files?
libnvdispmgr_d.so is a vendor file that cannot be build because we don't have the sources
you need to sync them from koush his github or extract the vendor files using the script in the device folder
good luck
Click to expand...
Click to collapse
ok now compiled successfully..
ROM booted but no wi-fi and camera..
podanimesh said:
ok now compiled successfully..
ROM booted but no wi-fi and camera..
Click to expand...
Click to collapse
Wifi working fine for me, but I'll add a step for camera fix, thanks for reporting
Gesendet von meinem HTC VLE_U mit Tapatalk 2
If anyone wants to have SUN JDK instead of Open JDK it's still possible:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
I also put that in "my" post 3.
thanks for reporting, but as far as I know, sun has many security risks, isn`t it?
XXMrHyde said:
thanks for reporting, but as far as I know, sun has many security risks, isn`t it?
Click to expand...
Click to collapse
Hm I don't think so. As far as I know the reason why Open JDK is used in Ubuntu instead of Sun JDK is that Open JDK is fully open sourced while Sun JDK still uses some pre compiled closed source binaries. Some open source fanatics might call this a security risk as they can't check the source themselves, but apart from that their shouldn't be any risks.
Sent from my LG-P990 using xda app-developers app
this procedure did not make .zip file, but normal folder
tonyp said:
Hm I don't think so. As far as I know the reason why Open JDK is used in Ubuntu instead of Sun JDK is that Open JDK is fully open sourced while Sun JDK still uses some pre compiled closed source binaries. Some open source fanatics might call this a security risk as they can't check the source themselves, but apart from that their shouldn't be any risks.
Sent from my LG-P990 using xda app-developers app
Click to expand...
Click to collapse
Ok, nice to know, I`ll change the Guide, so users can decide, which JDK they want to install
tomsi91 said:
this procedure did not make .zip file, but normal folder
Click to expand...
Click to collapse
Then you make a mistake, if so, my Rom wouldn`t excist
Please upload camera fix tutorial....
Sorry, I was a little bit busy today, I`ll ad the camera fix to the guide now
added camera fix to the Guide
edit:
now it can be choosen if you want to install Sun- or Open-JDK
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.
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
Hi, my name's Stefano I'm from Italy, and sorry for my poor english. This is the guide to build your own the KitKat (or whatever branch you want) for your HammerHead. We'll start, obviously, setting up your client (PC), and here we'll use ubuntu x64. Is possible to use almost any linux distribution (also MacOSX) but I prefer to stay on what is much supported and known (for me!). This guide is taken from internet and reading forums/blogs. I didn't invent anything, you can found a lot of guides like this. Just this is updated with last changes. For the setup part I read and paste a lot from here (thanks to sylentprofet).
Regard the hardware side you'll need at least of:
a Dual Core processor
4 Gb of RAM
80 Gb of hard disk for each repository (Better if SSD but don't required)
The Graphics Card don't care, we don't use to compile
A good internet connection, you have to download up to 40 Gb of stuff
A lot of patience, if you aren't go to download a ready ROM, it's better!
Time, time, time, time and again time!
How to Configure Ubuntu for Properly Compiling Android ROMs
This guide applies to Ubuntu 13.04 Raring Ringtail 64 bit (but also down to 12.04 LTS which is the version that I prefer). Do not use the 32 Bit version. Also, PAY CLOSE ATTENTION when to use “sudo” and when to not. It can make things funky if you do something as root that you shouldn’t. During normal build you don't have absolutely need to use "sudo", just during the PC setup.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
First, let’s set up the correct JDK.
Many of you probably have some kind of wrong Java installed. Sad cupcake.Let’s get rid of that. Copy and paste this into a Terminal window:
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Back to the Terminal. Copypasta the following:
Code:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.04 (or less). No more unrecognized Java version errors! Yay! And it’s self updating, so you don’t have to redownload binaries everytime they release a new version.
Next, we actually need to install the package. More copypasta:
Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the onscreen instructions. You have to Accept the Licensing Agreement or whatever. Hopefully no human centipede clauses. Once that is completed successfully, you will have to restart any open browsers with Java content for it to display correctly.
To make sure the correct version of Java is activated, run the following at the Terminal prompt:
Code:
java -version
You should see something like the following:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu. Because (K)Ubuntu no longer carries ia32-libs-multiarch and ia32-libs (from Saucy onwards), it is necessary to install from precise repos:
Code:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse"
sudo apt-get update
sudo apt-get install ia32-libs-multiarch
once is installed, you can remove repository:
Code:
sudo add-apt-repository --remove "deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse"
sudo apt-get update
Before start, install:
Code:
sudo apt-get install dpkg-dev
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
And we wait. Don’t worry, this isn’t the crazy downloading part just yet.
When that is done, do this:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Now it's time to download and setup SDK Tools. First of all download Android SDK Tools for Linux x64. Extract the folder “sdk”, inside package, into your "Downloads" folder and rename it to "AndroidSDK" e.g..
Then come to your terminal and type:
Code:
cd ~/Downloads/AndroidSDK/tools
and after:
Code:
./android sdk
You can now see the GUI that propose all installable packages. Install Platform tools and Tools for most recent Android (4.4), with the most higher API (19+) version. Flag "accept" and install.
Once is complete, you have you need the binary for repo that will let you talk to git servers and download all that precious source code:
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Open "~/.bashrc" to add a line:
Code:
sudo nano ~/.bashrc
At the very bottom, add the following line:
Code:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Type to restart bash:
Code:
source ~/.bashrc
Now you have all need to work (or play) with your ubuntu and it's time to give the sources (repositories) from your preferred Team (who share the source code for their rom). The most known host service for sources and projects is GitHub. E.g. https://github.com/CyanogenMod/
The point of start of any repo is its "manifest" (default.xml) where the team list all it's projects (here an example), only the necessary to the building process.
Until last year was necessary to compile (before begin and looking to platform manifest) an own local manifest where we exclude from download all the devices/kernel/vendor parts unnecessary for our device. This saves up to some Gigabytes of download.
Fortunately now the repositories will download itself the necessary devices/kernel/vendor parts when we'll choose ("lunch") the device to build ("make"). With the exception of AOKP who wanna know, before initialize your local repo, for which device/s you'd like build.
Now I'll write a section for each Team/ROM you want to initialize, that's for me has sense. How take a sense to put each "platform/project" in a different folder (e.g. CarbonDev in a folder and Cyanogenmod in another, both sons of your Home folder).
In the waiting to read next part, better familiarize a little with terms like "breakfast, brunch, lunch, make" into Android contest.
Building Cyanogenmod
In the terminal, now we'll make a folder where to store the Android source code. Typically will make it in your home folder, within a folder called like your projected ROM, to identify from other stuff, open your terminal and type:
Code:
mkdir –p ~/Cyanogenmod
cd ~/Cyanogenmod
Now we are going to initialize your local repository, with the "branch" cm-11.0 (KitKat), in your terminal:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
And now, the most long part of the story: you’re going to get the source. We have to download around 10-15 Gbytes. First of begin the process, you must to know that you can accelerate the process related to your processor and, obviously, to your internet band. You can choose the number of simultaneous processes to start. They depends from the "#" in the "-j" parameter. E.g. the option -j6 is related to a “normal” processor. If you have a performant processor and/or internet connection, try to increment putting –j10 or more. On terminal:
Code:
repo sync -j6
From time to time, check the situation on output, maybe occurs a pair of hours or a whole night. But when all will be done, you’re ready to build Android!
Once you finish your repo sync, you’ll ready to build. In your terminal, into your working folder type (pay attention at the initial “dot”):
Code:
. build/envsetup.sh
The commands are loaded, now you can build (tune your -j# parameter as you want):
Code:
breakfast hammerhead && make -j6 bacon
At the end of all, your fresh ROM to flash will be in Cyanogenmod/out/target/product/hammerhead. Happy flash!
Thanks @Lloir for supervision.
Building AOKP
Reserved 2
Reserved 3
Reserved 4
Reserved 5
Reserved 6
Nice
Thank you man I'm gonna try it out
I am getting a tone of errors while compiling. Is this normal. I'm gonna assume as long as it doesn't stop everything should be OK.
Sent from my hammerhead
Cuzz1369 said:
I am getting a tone of errors while compiling. Is this normal. I'm gonna assume as long as it doesn't stop everything should be OK.
Sent from my hammerhead
Click to expand...
Click to collapse
When u have warnings, it's all right.
When u have errors the building stops itself...
I was about to do the same guide . I have made the part for paranoidandroid and aosp yesterday, but I am now late. Btw good guide. Better than mine.
Make this thread a sticky thread!
Sent from my Nexus 5 using xda app-developers app
@PippoX3 I really appreciate this guide and your help. My phone just booted into my self comiled cm11. This is always something I've wanted to do since I flashed my first ROM a couple years ago. @Lloir it was actually one of yours "evervolv" for HOV I would like to thank both of you for your help thus far and look forward to continue to ask silly questions. To some this sounds like nothing special. But using a rom you compiled yourself for the first time is quite a rush. Thanks again...
Cuzz1369 said:
@PippoX3 I really appreciate this guide and your help. My phone just booted into my self comiled cm11. This is always something I've wanted to do since I flashed my first ROM a couple years ago. (@Llor it was actually one of yours "evervolv" for HOV) I would like to thank both of you for your help thus far and look forward to continue to ask silly questions. To some this sounds like nothing special. But using a rom you compiled yourself for the first time is quite a rush. Thanks again...
Click to expand...
Click to collapse
You're welcome mate. I remember my first builded and flashed rom for HtcOneS and was a big goal for me. Then I understand you. A step away to grow again and learn more and more. Dig it! :laugh:
The only difference for aosp is just changing the link in repo init -u ? I wanna build a stock rom only with advanced brightness adjustment
Sent from my Nexus 5 using Tapatalk
andrei.voinea93 said:
The only difference for aosp is just changing the link in repo init -u ? I wanna build a stock rom only with advanced brightness adjustment
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Generally yes. Take a look to their readme into manifest platform, usually they explain there how to initialize your local repo. The rest is same for alls...
Thank you
Sent from my Nexus 5 using Tapatalk
I'm getting this error while trying to install packages after the Java step.(Ubuntu 13.10)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
Package ia32-libs 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
However, the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
I moved on to the next step and receive this:
[email protected]:~$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory
Edit: Found my answer here
http://forum.xda-developers.com/showthread.php?p=50353201
Cuzz1369 said:
I'm getting this error while trying to install packages after the Java step.(Ubuntu 13.10)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
Package ia32-libs 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
However, the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
I moved on to the next step and receive this:
[email protected]:~$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory
Edit: Found my answer here
http://forum.xda-developers.com/showthread.php?p=50353201
Click to expand...
Click to collapse
I got issues with 13.10 (was a beta, now I don't know...) try 13.04. My prefer is 12.04 or 12.10.
PippoX3 said:
I got issues with 13.10 (was a beta, now I don't know...) try 13.04. My prefer is 12.04 or 12.10.
Click to expand...
Click to collapse
I found the answer and posted above. Worked great now.
Sent from my hammerhead
So I successfully compile slimKat. It gave me 2 different zips in my out folder slim****ota***.zip which was 186mb and slim*****.zip which was only 156mb. What the difference between the two?
Sent from my Nexus 7 using Tapatalk
Development: Building CyanogenMod 13 for Zenfone 5/6
Prerequisites:
Ubuntu 16.04 (Installation Guide)
~80 GiB of Available Disk Space
Establishing a Build Environment
Open a Terminal Emulator (Ctrl+Alt+T)
Install the latest Ubuntu updates:
Code:
sudo apt-get update
sudo apt-get dist-upgrade
Add the OpenJDK 7 Repository:
Code:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
Install the Required packages by Android:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip maven yasm optipng openjdk-7-jdk
Install Repo:
Code:
sudo wget https://storage.googleapis.com/git-repo-downloads/repo -O/usr/bin/repo
sudo chmod +x /usr/bin/repo
Setup Git:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Recommended: Reboot.
Downloading the Source:
Create a Working Directory:
Code:
mkdir -p ~/CM13
cd ~/CM13
Initialize the Repository (choose a command below):
Stable (ZNH2K):
Code:
repo init -u git://github.com/zf5/android.git -b stable/cm-13.0-ZNH2K
Stable (ZNH5Y):
Code:
repo init -u git://github.com/zf5/android.git -b stable/cm-13.0-ZNH5Y
Nightly:
Code:
repo init -u git://github.com/zf5/android.git -b cm-13.0
Download the Code:
Code:
repo sync -c -j4
Optional: Setup ccache (ccache acts as a compiler cache that can be used to speed up rebuilds)
Code:
echo "export USE_CCACHE=1" >> ~/.bashrc
export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Applying the Patches:
Download the Patches
Extract the Patches at your working directory
Apply the patch files by changing the directory to where they are and using the following command:
Code:
patch -p1 < filename.patch
Example: Applying the Patch for Vibration:
Code:
cd frameworks/base
patch -p1 < vibration.patch
(Do the same for every patch file in their respective directories)
Building the System:
Prepare the build environment:
Code:
. build/envsetup.sh
lunch cm_T00F-user
Build the System:
Code:
make -j4
That's it. Your system.img is located at WORKING_DIRECTORY/out/target/product/T00F/system.img
Also check out: Development: Building a Marshmallow Kernel for Zenfone 5/6
XDA:DevDB Information
Development: Building CyanogenMod 13 for Zenfone 5/6, Tool/Utility for the Asus Zenfone 5
Contributors
dgadelha
Version Information
Status: Stable
Created 2016-04-21
Last Updated 2016-09-13
For T00G:
Device Tree: https://github.com/T00G-Marshmallow-DEV/android_device_asus_T00G
Vendor Tree: https://github.com/T00G-Marshmallow-DEV/android_vendor_asus_T00G
Information: Sensors and some bugs fixed.
Gooood! Thanks very much
For cm12.1 also same method? Because I got some error on building cm12.1
AhZhi said:
For cm12.1 also same method? Because I got some error on building cm12.1
Click to expand...
Click to collapse
Yes. But I think you'll need to apply the Vibration patch manually, as it will probably fail.
And, well, no need to apply all the patches, only vibration.
That's it.
dgadelha said:
Yes. But I think you'll need to apply the Vibration patch manually, as it will probably fail.
And, well, no need to apply all the patches, only vibration.
That's it.
Click to expand...
Click to collapse
Thank you now i go to try it
Error
dgadelha said:
Development: Building CyanogenMod 13 for Zenfone 5/6
Prerequisites:
Ubuntu 15.10 (Installation Guide)
~80 GiB of Available Disk Space
Establishing a Build Environment
Open a Terminal Emulator (Ctrl+Alt+T)
Install the latest Ubuntu updates:
Code:
sudo apt-get update
sudo apt-get dist-upgrade
Install the Required packages by Android:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip maven yasm optipng openjdk-7-jdk
Install Repo:
Code:
sudo wget https://storage.googleapis.com/git-repo-downloads/repo -O/usr/bin/repo
sudo chmod +x /usr/bin/repo
Setup Git:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Recommended: Reboot.
Downloading the Source:
Create a Working Directory:
Code:
mkdir -p ~/CM13
cd ~/CM13
Initialize the Repository:
Stable:
Code:
repo init -u git://github.com/zf5/android.git -b stable/cm-13.0-ZNH2K
Nightly:
Code:
repo init -u git://github.com/zf5/android.git -b cm-13.0
Download the Code:
Code:
repo sync -c -j4
Optional: Setup ccache (ccache acts as a compiler cache that can be used to speed up rebuilds)
Code:
echo "export USE_CCACHE=1" >> ~/.bashrc
export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Applying the Patches:
Download the Patches
Extract the Patches at your working directory
Apply the patch files by changing the directory to where they are and using the following command:
Code:
patch -p1 < filename.patch
Example: Applying the Patch for Vibration:
Code:
cd frameworks/base
patch -p1 < vibration.patch
(Do the same for every patch file in their respective directories)
Building the System:
Prepare the build environment:
Code:
. build/envsetup.sh
lunch cm_T00F-user
Build the System:
Code:
make -j4
That's it. Your system.img is located at WORKING_DIRECTORY/out/target/product/T00F/system.img
Also check out: Development: Building a Marshmallow Kernel for Zenfone 5/6
XDA:DevDB Information
Development: Building CyanogenMod 13 for Zenfone 5/6, Tool/Utility for the Asus Zenfone 5
Contributors
dgadelha, tank0412
Version Information
Status: Stable
Created 2016-04-21
Last Updated 2016-05-11
Click to expand...
Click to collapse
Fetching projects: 51% (222/435)
error: Exited sync due to fetch errors
Can you help me ?
HONGARC said:
Fetching projects: 51% (222/435)
error: Exited sync due to fetch errors
Can you help me ?
Click to expand...
Click to collapse
type again last comand
it will resume, try use google there are some comands what will help you
And how to creat .zip flash on twrp
adekcan said:
And how to creat .zip flash on twrp
Click to expand...
Click to collapse
you can use otapackage but you must this have in device tree or you can extrac system.img file after build
Hi @dgadelha..
I have successfully built the rom and kernel in my laptop using the steps you provided on first page..
After that I flashed it to my phone and it's been working so smooth and stable. It was a great experience for me getting the phone work using the firmware compiled by me ?. Many thanks for you..
Sent from my ASUS_T00F using XDA-Developers mobile app
sapiterbang said:
Hi @dgadelha..
I have successfully built the rom and kernel in my laptop using the steps you provided on first page..
After that I flashed it to my phone and it's been working so smooth and stable. It was a great experience for me getting the phone work using the firmware compiled by me ?. Many thanks for you..
Sent from my ASUS_T00F using XDA-Developers mobile app
Click to expand...
Click to collapse
Ohh that's good it means new dev come !! ??
sapiterbang said:
Hi @dgadelha..
I have successfully built the rom and kernel in my laptop using the steps you provided on first page..
After that I flashed it to my phone and it's been working so smooth and stable. It was a great experience for me getting the phone work using the firmware compiled by me . Many thanks for you..
Click to expand...
Click to collapse
Nice to hear that.
What is the procedure if I want to run this rom on stock kernel? (I am asking this because I have no camera found bug after unlocking bootloader.)
Beside that your guide is awesome.
[email protected][email protected]@ said:
What is the procedure if I want to run this rom on stock kernel? (I am asking this because I have no camera found bug after unlocking bootloader.)
Beside that your guide is awesome.
Click to expand...
Click to collapse
There is no procedure, you can't do that.
[email protected][email protected]@ said:
What is the procedure if I want to run this rom on stock kernel? (I am asking this because I have no camera found bug after unlocking bootloader.)
Beside that your guide is awesome.
Click to expand...
Click to collapse
You have to build a Lollipop 5.0 based ROM to run with stock kernel.
leonardohenrique10 said:
You have to build a Lollipop 5.0 based ROM to run with stock kernel.
Click to expand...
Click to collapse
I'm a bit disappointed,but anyway thanks a lot for information.
getting error in applying patches
I am getting erros while applying patch.....I reffered ur steps from guide by u that how to build cyanogenmod for zenfone 5....I have downloaded and synced sources and when i come to apply patch then i get error..
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/linker/linker.cpp b/linker/linker.cpp
|index bc40cf1..899eeca 100644
|--- a/linker/linker.cpp
|+++ b/linker/linker.cpp
--------------------------
File to patch: y
y: No such file or directory
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
please help me...
Desert fox2612 said:
I am getting erros while applying patch.....I reffered ur steps from guide by u that how to build cyanogenmod for zenfone 5....I have downloaded and synced sources and when i come to apply patch then i get error..
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/linker/linker.cpp b/linker/linker.cpp
|index bc40cf1..899eeca 100644
|--- a/linker/linker.cpp
|+++ b/linker/linker.cpp
--------------------------
File to patch: y
y: No such file or directory
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
please help me...
Click to expand...
Click to collapse
You need to copy the file bionic/linker.patch to the directory ~/CM13/bionic/
then you need to do
Code:
cd ~/CM13/bionic
patch -p1 < linker.patch
dgadelha said:
You need to copy the file bionic/linker.patch to the directory ~/CM13/bionic/
then you need to do
Code:
cd ~/CM13/bionic
patch -p1 < linker.patch
Click to expand...
Click to collapse
Thanks....that helped me.. Btw should I ignore warnings generated between building img file? & one prob is linker.patch is not worked....rest all patches worked....will it create problem?