Question Twrp for Tab A8 SM-X205 - Samsung Galaxy Tab A8 (2021)

Hello Guys,
I need Twrp for My Tab A8 SM-X205. I've already try to build but no success and is not list on twrp.me please i need HELP !
device tree for Tab A8 SM-X205 : https://github.com/U4I5/twrp_device_samsung_Tab_A8_4G who can build img file ?

rename ~/TWRP/twrpdtgen/output/samsung/gta8/omni_gta8.mk to twrp_gta8.mk
delete vendorsetup.sh
Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)
open twrp_gta8.mk and :
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)
open AndroidProducts.mk
change omni to twrp (4 spots)
4. Optional: add extra items to BoardConfig.mk
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
• Make a directory called ~/a12s-twrp
cd ~/twrp
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11
repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1
copy ~/TWRP/twrpdtgen/output/samsung to /twrp/device
Building
========
. build/envsetup.sh
lunch twrp_gta8-eng
mka recoveryimage –j1
Recovery.img at out/Samsung/gta8/...img

Dkpost3 said:
rename ~/TWRP/twrpdtgen/output/samsung/gta8/omni_gta8.mk to twrp_gta8.mk
delete vendorsetup.sh
Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)
open twrp_gta8.mk and :
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)
open AndroidProducts.mk
change omni to twrp (4 spots)
4. Optional: add extra items to BoardConfig.mk
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
• Make a directory called ~/a12s-twrp
cd ~/twrp
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11
repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1
copy ~/TWRP/twrpdtgen/output/samsung to /twrp/device
Building
========
. build/envsetup.sh
lunch twrp_gta8-eng
mka recoveryimage –j1
Recovery.img at out/Samsung/gta8/...img
Click to expand...
Click to collapse
Hey bro thank but I have to rename omni to twrp of these ligne : PRODUCT_NAME := omni_gta8 $(call inherit-product, vendor/omni/config/common.mk) ?

Dkpost3 said:
rename ~/TWRP/twrpdtgen/output/samsung/gta8/omni_gta8.mk to twrp_gta8.mk
delete vendorsetup.sh
Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)
open twrp_gta8.mk and :
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)
open AndroidProducts.mk
change omni to twrp (4 spots)
4. Optional: add extra items to BoardConfig.mk
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
• Make a directory called ~/a12s-twrp
cd ~/twrp
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11
repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1
copy ~/TWRP/twrpdtgen/output/samsung to /twrp/device
Building
========
. build/envsetup.sh
lunch twrp_gta8-eng
mka recoveryimage –j1
Recovery.img at out/Samsung/gta8/...img
Click to expand...
Click to collapse
Can you do it for me i got some error please : build/make/core/dex_preopt_libart.mk:18: error:

Ur!el said:
Can you do it for me i got some error please : build/make/core/dex_preopt_libart.mk:18: error:
Click to expand...
Click to collapse
Google

Ur!el said:
Hey bro thank but I have to rename omni to twrp of these ligne : PRODUCT_NAME := omni_gta8 $(call inherit-product, vendor/omni/config/common.mk) ?
Click to expand...
Click to collapse
omni_gta8 NO
twrp_gta8.mk - yes

Dkpost3 said:
rename ~/TWRP/twrpdtgen/output/samsung/gta8/omni_gta8.mk to twrp_gta8.mk
delete vendorsetup.sh
Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)
open twrp_gta8.mk and :
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)
open AndroidProducts.mk
change omni to twrp (4 spots)
4. Optional: add extra items to BoardConfig.mk
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
• Make a directory called ~/a12s-twrp
cd ~/twrp
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11
repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1
copy ~/TWRP/twrpdtgen/output/samsung to /twrp/device
Building
========
. build/envsetup.sh
lunch twrp_gta8-eng
mka recoveryimage –j1
Recovery.img at out/Samsung/gta8/...img
Click to expand...
Click to collapse
Why not to create twrp file instead of this for every normal user like me to flash it and use

Did this worked with anyone
Dkpost3 said:
rename ~/TWRP/twrpdtgen/output/samsung/gta8/omni_gta8.mk to twrp_gta8.mk
delete vendorsetup.sh
Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)
open twrp_gta8.mk and :
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)
open AndroidProducts.mk
change omni to twrp (4 spots)
4. Optional: add extra items to BoardConfig.mk
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
• Make a directory called ~/a12s-twrp
cd ~/twrp
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11
repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j1
copy ~/TWRP/twrpdtgen/output/samsung to /twrp/device
Building
========
. build/envsetup.sh
lunch twrp_gta8-eng
mka recoveryimage –j1
Recovery.img at out/Samsung/gta8/...img
Click to expand...
Click to collapse
??
And if worked ,why no one published ithe file ??

I have a bit of experience building TWRP for the Galaxy Tab A 8.0 (2019), Galaxy Tab A 10.1" (2019) and Galaxy Tab A7 (2020), so when I saw the $149 deal this week I thought I'd give the A8 a try. I unlocked the bootloader, updated to XAR-X200XXU1AVG1-20220804205906, and made my first build of TWRP 3.6.2_11.
My first attempt generated a boot loop, which isn't all that unusual. I pulled my camera out to capture the diagnostic log that was flashing on the screen, but the boot loop stopped after about a dozen iterations. I didn't worry at the time, since I assumed I could force a reboot using Power & Vol Down...but that's not working, no matter how long I hold the two buttons.
Unfortunately, without the ability to force restart, I can't get back to Download Mode to flash the stock recovery in Odin. I'm basically dead in the water until my battery is depleted, which could be weeks.
Any suggestions on how to force restart if Power & Vol Down isn't working? I've never had an issue doing this with Samsung tablets based on Qualcomm or Exynos chipsets, but this is my first experience with Unisoc.
UPDATE: A week was sufficient reset time and connecting USB with Vol Up & Down got me to Download Mode. I'm back in business. Moral of the story is to catch a boot loop quickly to return to Download Mode. Don't let it loop more than a few times.
(And the X200XXU1AVG1 kernel source is now posted.)

Okay, I have a TWRP 3.6.2_11 build booting and running on SM-X200 except for user data encryption, which I'll continue to work on tomorrow. If anyone has any insights into how to get TWRP to recognized metadata encryption on this device, please let me know.
Update: Now posted here: https://forum.xda-developers.com/t/...-for-2021-galaxy-tab-a8-10-5-sm-x200.4488691/

Can't use the TWRP user interface. no function available. what am I doing wrong. had to install stock recovery again

I have TWRP ready for SM-X205. However, this will not work because there is such a thing as Android Verified Boot. It can be disabled by patching vbmeta.img
Now I'm trying to do it, but so far without success. TWRP starts, but instead of the system. Android does not start, TWRP starts. If any of you are ready to help in resolving this issue, I would be very grateful.

unpack and add magiskboot in orangefox.zip

OK, I'll try this.

AndrewMarkov621 said:
OK, I'll try this.
Click to expand...
Click to collapse
send me a tree, I'll make twrp

TWRP is already there

Dkpost3 said:
unpack and add magiskboot in orangefox.zip
Click to expand...
Click to collapse
Does not work, Odin refuses to flash the device.

Actually, here is the result of the TWRP build. When booting into the system, it writes something like "Warranty bit: boot" "Warranty bit: recovery". And goes into the bootloop. At the moment I'm trying to assemble a patched vbmeta, however, so far without success, I can't even get the encryption keys, because a lot of time has passed since writing the guide on the Internet and Android protection has stepped far ahead. I hope that someday I will be able to at least get off the ground.
P.S. The version that one of the participants of the SM-X200 theme put together works on the SM-X205 in the same way as mine. Magisk is installed on the device, root is received.

I was able to install TWRP definitively. It works fine with Android. However, it cannot perform any functions, the internal storage does not see, it gives this:

If you remount the partitions to ext2 and then to ext4, then everything works. However, the Storage section is not mounted in any way, it was in vfat, and remained. The system does not load after these manipulations, only the installation of stock firmware helps. Something like that.

Related

[Dev][Panda] AOSP 2.3.7_r1 (GWK74) compilation guide for buzz

Direct link to the precompiled ROM: http://www.filefactory.com/file/cfe8147/GWK74-buzz-20111111.zip (please hit thanks if you find this ROM useful )
Setting up the development environment
Install the current stable Debian: squeeze (6.0) amd64 (not the i386 version, and not the testing/unstable version). Do not ask me for a working Ubuntu version -- I don't know. Use Debian instead
Code:
apt-get install python git bzip2 zip unzip lzma patch bison flex \
make gcc g++ gcc-multilib g++-multilib gperf libz-dev lib32z-dev curl \
libncurses5-dev lib32ncurses5-dev libx11-dev openjdk-6-jdk
Downloading the sources and other packages
AOSP 2.3.7r1 (GWK74) is the current version of the AOSP
arco's 2.6.35 kernel is the base for the kernel we will build
koush's vendor files contain the HTC proprietary blobs for buzz
CyanogenMod's device/htc/buzz
Code:
git clone https://github.com/arco/buzz-kernel-2.6.35.git
git clone https://github.com/koush/proprietary_vendor_htc
git clone https://github.com/CyanogenMod/android_device_htc_buzz.git -b gingerbread-release
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod +x ~/bin/repo
export PATH=~/bin:$PATH
Code:
mkdir 2.3.7_r1; cd 2.3.7_r1
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
repo sync
mkdir -p vendor/htc
cp -r ../proprietary_vendor_htc/buzz vendor/htc
cp -r ../android_device_htc_buzz device/htc/buzz
The "repo sync" may take a while, so please be patient
Compiling the kernel
Code:
cd ../buzz-kernel-2.6.35
make ARCH=arm buzz_defconfig
At this point you can edit .config and change CONFIG_MSM_CPU_FREQ_ONDEMAND_MAX to overclock the CPU, for example setting it to 700 MHz.
Code:
make ARCH=arm -j4 CROSS_COMPILE=../2.3.7_r1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
cp arch/arm/boot/zImage ../2.3.7_r1/device/htc/buzz/prebuilt/kernel
cp drivers/net/wireless/bcm4329/bcm4329.ko ../2.3.7_r1/device/htc/buzz/prebuilt/bcm4329.ko
Patching the sources
Several files must be patched. The following patches are from CyanogenMod 7:
armv6j.mk.patch: adds a new architecture (ARMv6J) which targets the MSM7225
browser.patch: provides a small fix to prevent the Browser from crashing
camera.patch: enables the use of Froyo (2.2) libcamera.so
dalvik-armv6j.patch: adds a new ARMv6J target for JIT compilation by the Dalvik runtime environment
gpsshim.patch: enables the use of Froyo (2.2) libgps.so
libagl.patch: enables the use of copybit to make software OpenGL support a bit faster (I think)
surfaceflinger.patch: another cool patch from CM7 when transparency is not supported
The following patches were made by myself:
config.xml.patch: several values which are present in CM7 but not AOSP must be disabled
LOCAL_MODULE_TAGS.patch: a bunch of Android.mk in hardware/msm7k lack this variable
ota-no-recovery.patch: prevent ota_from_target_files from flashing the recovery (we like our ClockworkMod better )
vendork-blobs.mk.patch: adds library libOmxCore.so which is needed by mediaserver
The following patches are from Google:
apns-conf.xml.patch: adds a bunch of APNs that are not present in the default AOSP file
For your convenience, I have included all the patches in a single file, which is attached to this post (patch-buzz.zip).
Code:
cd ../2.3.7_r1
wget -O patch-buzz.zip "http://forum.xda-developers.com/attachment.php?attachmentid=779411"
unzip patch-buzz.zip; ./patch-buzz/apply.sh
ln -s full.mk build/target/product/full_base.mk
rm -rf device/htc/buzz/overlay/packages
Setting up a custom vendor
At this point you may want to add a number of custom additions, for example:
a simple boot animation: http://forum.cyanogenmod.com/topic/19198-simple-generic-boot-animation/
Superuser root package: http://forum.xda-developers.com/showthread.php?t=682828
Torch from CyanogenMod: http://download.cyanogenmod.com/?type=stable&device=buzz
Talk and Android Market: http://wiki.cyanogenmod.com/wiki/Latest_Version
Google Maps for WildFire: http://forum.xda-developers.com/showpost.php?p=15218646&postcount=4
Code:
mkdir vendor/xdbg; cd vendor/xdbg
wget http://duck.at.shangtai.net/files/android/bootanimation.zip
wget -O su-2.3.6.1-ef-signed.zip http://dl.dropbox.com/u/6408470/su-releases/su-2.3.6.1-ef-signed.zip
wget http://download.cyanogenmod.com/get/update-cm-7.1.0-buzz-signed.zip
Also download gapps from http://goo-inside.me/gapps/gapps-gb-20110828-signed.zip , put it in 2.3.7_r1/vendor/xdbg and run:
Code:
unzip su-2.3.6.1-ef-signed.zip
wget -O system/app/Maps.apk http://forum.xda-developers.com/attachment.php?attachmentid=641716
unzip update-cm-7.1.0-buzz-signed.zip system/lib/libOmxCore.so
unzip update-cm-7.1.0-buzz-signed.zip system/app/Torch.apk
unzip -o gapps-gb-20110828-signed.zip
mv system/lib/libOmxCore.so ../htc/buzz/proprietary
I haven't tried it, but you can try to include the LatinIME.apk from CM7 in order to get the dictionaries (not included by default in AOSP).
Now we'll create the Makefile that specifies which files are to be copied in the ROM. Be careful when copy-pasting to not truncate the last line which is quite long:
Code:
echo "\$(call inherit-product, vendor/xdbg/xdbg.mk)" >>../../device/htc/buzz/buzz.mk
cat >xdbg.mk <<"EOF"
PRODUCT_COPY_FILES += \
vendor/xdbg/bootanimation.zip:system/media/bootanimation.zip \
vendor/xdbg/system/bin/su:system/xbin/su \
vendor/xdbg/system/lib/libvoicesearch.so:system/lib/libvoicesearch.so \
vendor/xdbg/system/app/Superuser.apk:system/app/Superuser.apk \
vendor/xdbg/system/app/Torch.apk:system/app/Torch.apk \
vendor/xdbg/system/app/Talk.apk:system/app/Talk.apk \
vendor/xdbg/system/app/Vending.apk:system/app/Vending.apk \
vendor/xdbg/system/app/GenieWidget.apk:system/app/GenieWidget.apk \
vendor/xdbg/system/app/Maps.apk:system/app/Maps.apk \
vendor/xdbg/system/app/NetworkLocation.apk:system/app/NetworkLocation.apk \
vendor/xdbg/system/app/GoogleServicesFramework.apk:system/app/GoogleServicesFramework.apk \
vendor/xdbg/system/app/GoogleContactsSyncAdapter.apk:system/app/GoogleContactsSyncAdapter.apk \
vendor/xdbg/system/app/GoogleCalendarSyncAdapter.apk:system/app/GoogleCalendarSyncAdapter.apk \
vendor/xdbg/system/framework/com.google.android.maps.jar:system/framework/com.google.android.maps.jar \
vendor/xdbg/system/etc/permissions/com.google.android.maps.xml:system/etc/permissions/com.google.android.maps.xml
EOF
Building the ROM
Code:
cd ../..
. build/envsetup.sh
lunch [I](choose htc_buzz-userdebug)[/I]
make -j5 otapackage WITH_DEXPREOPT=true[I]
(5 is for a quad-core with 4GB of RAM. you can decrease it if you have less RAM)[/I]
Remove WITH_DEXPREOPT=true above to generate a de-odexed ROM.
Advantage of a de-odexed ROM: you can easily replace APKs or JARs in /system.
Disadvantages: the first boot takes a while because all APKs must be odexed. Also the dalkvik cache takes a significant amount of space (up to 50 MB) in /data (CM7 uses /cache so this is not a problem).
Note that you will not need the Android SDK since adb and other tools will be present in the PATH after you run lunch and the out/host part is compiled.
The generated ROM is out/target/product/buzz/htc_buzz-ota-*.zip. Wiping the whole data partition in ClockworkMod is required if your previous ROM was built with different signing keys.
Finally, I'd like to thank everyone who made this possible: cyanogen, arco, koush, HDCRJacob, schiznik, _thalamus & AdamG, ben1066, nhnt11 and everyone else who contributed on porting the AOSP on the WildFire. You guys are awesome
reserved
also reserved for future use
wow
Thats a very comprehensive guide )
I think you may be overcomplicating things though - if you run "make -jX otapackage" instead of just make, the build process will create a flashable zip for you.
Further to this, you can create your own vendor_blah repo, which will allow you to remove things like the recovery from the otapackage, and set a custom modversion during the build
schiznik said:
Thats a very comprehensive guide )
I think you may be overcomplicating things though - if you run "make -jX otapackage" instead of just make, the build process will create a flashable zip for you.
Further to this, you can create your own vendor_blah repo, which will allow you to remove things like the recovery from the otapackage, and set a custom modversion during the build
Click to expand...
Click to collapse
Super cool! I'll add your suggestions in a later release I need to get back my WildFire to test it all, so far I have great hope to fix the graphics with the patches from arco68. BTW, in your testing, would you recomment the 2.6.32 (htc-kernel-buzz) or 2.6.35 from arco's GitHub? Both seem fairly similar to me although the 2.6.35 get updated more often.
schiznik said:
I think you may be overcomplicating things though - if you run "make -jX otapackage" instead of just make, the build process will create a flashable zip for you.
Click to expand...
Click to collapse
I prefer making bacon myself. Then it compiles, squishes and zips in one process.
arco68 said:
I prefer making bacon myself. Then it compiles, squishes and zips in one process.
Click to expand...
Click to collapse
Hey arco68 Any comment on the 2.6.32.41 vs 2.6.35.10 kernels? I'd say the 2.6.35 should be more fitted to GR* (like 2.6.32 was for FR*), but I'd really like to hear your opinion on this.
I prefer 2.6.35 for gingerbread, as it's easier to keep up to date and patch with stuff from CAF and Google's kernels.
arco68 said:
I prefer 2.6.35 for gingerbread, as it's easier to keep up to date and patch with stuff from CAF and Google's kernels.
Click to expand...
Click to collapse
Yea 2.6.35 is the gb kernel. I can't use make bacon as I don't use cm's vendor, make devnull does the same though
Many thanks for the input arco68
Sent from my HTC Desire using XDA App
Do you know what would be so nice? It would be really nice is someone could update this to the newest source so that it could actually be relivant
Minor thread hijack...
If you want to build Oxygen for buzz - you can do the below:
Code:
mkdir android ; cd android/
repo init -u [email protected]:schiznik/oxygen_manifest.git -b gingerbread
repo sync
. build/envsetup.sh
lunch 8
make oxygen
You can optionally use "repo -j20 sync" to sync 20 of the repo's at once, and make -jX oxygen, where X is the number of CPU cores that you are using to build.
Once completed, there is a update-oxygen-*.zip file in out/target/product/buzz/ that can be flashed.
Nice !Very interisting
Thanks a lot, schiznik. I'll update the main thread.
EDIT: main thread updated. the sources compile, although I haven't tested the resulting ROM yet.
schiznik said:
Minor thread hijack...
If you want to build Oxygen for buzz - you can do the below:
Code:
mkdir android ; cd android/
repo init -u [email protected]:schiznik/oxygen_manifest.git -b gingerbread
repo sync
. build/envsetup.sh
lunch 8
make oxygen
You can optionally use "repo -j20 sync" to sync 20 of the repo's at once, and make -jX oxygen, where X is the number of CPU cores that you are using to build.
Once completed, there is a update-oxygen-*.zip file in out/target/product/buzz/ that can be flashed.
Click to expand...
Click to collapse
For those who have tried this and get the reply "public key error". Try editing the repo init line to read "repo init -u https://github.com/schiznik/oxygen_manifest -b gingerbread" this works for me. I'm busy report syncing now, will inform you further, when it completes.
Sent from my HTC Wildfire using xda premium
Gandolff said:
For those who have tried this and get the reply "public key error". Try editing the repo init line to read "repo init -u https;//github.com/schiznik/oxygen_manifest -b gingerbread" this works for me. I'm busy report syncing now, will inform you further, when it completes.
Sent from my HTC Wildfire using xda premium
Click to expand...
Click to collapse
Update, repo sync complete, but to many errors to create software package. I'm looking onto it.
Sent from my HTC Wildfire using xda premium
xdbg said:
Link to prebuilt ROM: http://www.filefactory.com/file/cfe8147/n/GWK74-buzz-20111111.zip
Setting up the development environment
Install the current stable Debian: squeeze (6.0) amd64 (not the i386 version, and not the testing/unstable version). Do not ask me for a working Ubuntu version -- I don't know. Use Debian instead
Code:
apt-get install python git bzip2 zip unzip lzma patch bison flex \
make gcc g++ gcc-multilib g++-multilib gperf libz-dev lib32z-dev curl \
libncurses5-dev lib32ncurses5-dev libx11-dev openjdk-6-jdk
Downloading the sources and other packages
AOSP 2.3.7r1 (GWK74) is the current version of the AOSP
arco's 2.6.35 kernel is the base for the kernel we will build
koush's vendor files contain the HTC proprietary blobs for buzz
CyanogenMod's device/htc/buzz
Code:
git clone https://github.com/arco/buzz-kernel-2.6.35.git
git clone https://github.com/koush/proprietary_vendor_htc
git clone https://github.com/CyanogenMod/android_device_htc_buzz.git -b gingerbread-release
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod +x ~/bin/repo
export PATH=~/bin:$PATH
Code:
mkdir 2.3.7_r1; cd 2.3.7_r1
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
repo sync
mkdir -p vendor/htc
cp -r ../proprietary_vendor_htc/buzz vendor/htc
cp -r ../android_device_htc_buzz device/htc/buzz
The "repo sync" may take a while, so please be patient
Compiling the kernel
Code:
cd ../buzz-kernel-2.6.35
make ARCH=arm buzz_defconfig
At this point you can edit .config and change CONFIG_MSM_CPU_FREQ_ONDEMAND_MAX to overclock the CPU, for example setting it to 700 MHz.
Code:
make ARCH=arm -j4 CROSS_COMPILE=../2.3.7_r1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
cp arch/arm/boot/zImage ../2.3.7_r1/device/htc/buzz/prebuilt/kernel
cp drivers/net/wireless/bcm4329/bcm4329.ko ../2.3.7_r1/device/htc/buzz/prebuilt/bcm4329.ko
Patching the sources
Several files must be patched. The following patches are from CyanogenMod 7:
armv6j.mk.patch: adds a new architecture (ARMv6J) which targets the MSM7225
browser.patch: provides a small fix to prevent the Browser from crashing
camera.patch: enables the use of Froyo (2.2) libcamera.so
dalvik-armv6j.patch: adds a new ARMv6J target for JIT compilation by the Dalvik runtime environment
gpsshim.patch: enables the use of Froyo (2.2) libgps.so
libagl.patch: enables the use of copybit to make software OpenGL support a bit faster (I think)
surfaceflinger.patch: another cool patch from CM7 when transparency is not supported
The following patches were made by myself:
config.xml.patch: several values which are present in CM7 but not AOSP must be disabled
LOCAL_MODULE_TAGS.patch: a bunch of Android.mk in hardware/msm7k lack this variable
ota-no-recovery.patch: prevent ota_from_target_files from flashing the recovery (we like our ClockworkMod better )
vendork-blobs.mk.patch: adds library libOmxCore.so which is needed by mediaserver
The following patches are from Google:
apns-conf.xml.patch: adds a bunch of APNs that are not present in the default AOSP file
For your convenience, I have included all the patches in a single file, which is attached to this post (patch-buzz.zip).
Code:
cd ../2.3.7_r1
wget -O patch-buzz.zip "http://forum.xda-developers.com/attachment.php?attachmentid=779411"
unzip patch-buzz.zip; ./patch-buzz/apply.sh
ln -s full.mk build/target/product/full_base.mk
rm -rf device/htc/buzz/overlay/packages
Setting up a custom vendor
At this point you may want to add a number of custom additions, for example:
a simple boot animation: http://forum.cyanogenmod.com/topic/19198-simple-generic-boot-animation/
Superuser root package: http://forum.xda-developers.com/showthread.php?t=682828
Torch from CyanogenMod: http://download.cyanogenmod.com/?type=stable&device=buzz
Talk and Android Market: http://wiki.cyanogenmod.com/wiki/Latest_Version
Google Maps for WildFire: http://forum.xda-developers.com/showpost.php?p=15218646&postcount=4
Code:
mkdir vendor/xdbg; cd vendor/xdbg
wget http://duck.at.shangtai.net/files/android/bootanimation.zip
wget -O su-2.3.6.1-ef-signed.zip http://dl.dropbox.com/u/6408470/su-releases/su-2.3.6.1-ef-signed.zip
wget http://download.cyanogenmod.com/get/update-cm-7.1.0-buzz-signed.zip
Also download gapps from http://goo-inside.me/gapps/gapps-gb-20110828-signed.zip , put it in 2.3.7_r1/vendor/xdbg and run:
Code:
unzip su-2.3.6.1-ef-signed.zip
wget -O system/app/Maps.apk http://forum.xda-developers.com/attachment.php?attachmentid=641716
unzip update-cm-7.1.0-buzz-signed.zip system/lib/libOmxCore.so
unzip update-cm-7.1.0-buzz-signed.zip system/app/Torch.apk
unzip -o gapps-gb-20110828-signed.zip
mv system/lib/libOmxCore.so ../htc/buzz/proprietary
I haven't tried it, but you can try to include the LatinIME.apk from CM7 in order to get the dictionaries (not included by default in AOSP).
Now we'll create the Makefile that specifies which files are to be copied in the ROM. Be careful when copy-pasting to not truncate the last line which is quite long:
Code:
echo "\$(call inherit-product, vendor/xdbg/xdbg.mk)" >>../../device/htc/buzz/buzz.mk
cat >xdbg.mk <<"EOF"
PRODUCT_COPY_FILES += \
vendor/xdbg/bootanimation.zip:system/media/bootanimation.zip \
vendor/xdbg/system/bin/su:system/xbin/su \
vendor/xdbg/system/lib/libvoicesearch.so:system/lib/libvoicesearch.so \
vendor/xdbg/system/app/Superuser.apk:system/app/Superuser.apk \
vendor/xdbg/system/app/Torch.apk:system/app/Torch.apk \
vendor/xdbg/system/app/Talk.apk:system/app/Talk.apk \
vendor/xdbg/system/app/Vending.apk:system/app/Vending.apk \
vendor/xdbg/system/app/GenieWidget.apk:system/app/GenieWidget.apk \
vendor/xdbg/system/app/Maps.apk:system/app/Maps.apk \
vendor/xdbg/system/app/NetworkLocation.apk:system/app/NetworkLocation.apk \
vendor/xdbg/system/app/GoogleServicesFramework.apk:system/app/GoogleServicesFramework.apk \
vendor/xdbg/system/app/GoogleContactsSyncAdapter.apk:system/app/GoogleContactsSyncAdapter.apk \
vendor/xdbg/system/app/GoogleCalendarSyncAdapter.apk:system/app/GoogleCalendarSyncAdapter.apk \
vendor/xdbg/system/framework/com.google.android.maps.jar:system/framework/com.google.android.maps.jar \
vendor/xdbg/system/etc/permissions/com.google.android.maps.xml:system/etc/permissions/com.google.android.maps.xml
EOF
Building the ROM
Code:
cd ../..
. build/envsetup.sh
lunch [I](choose htc_buzz-userdebug)[/I]
make -j5 otapackage WITH_DEXPREOPT=true[I]
(5 is for a quad-core with 4GB of RAM. you can decrease it if you have less RAM)[/I]
Remove WITH_DEXPREOPT=true above to generate a de-odexed ROM.
Advantage of a de-odexed ROM: you can easily replace APKs or JARs in /system.
Disadvantages: the first boot takes a while because all APKs must be odexed. Also the dalkvik cache takes a significant amount of space (up to 50 MB) in /data (CM7 uses /cache so this is not a problem).
Note that you will not need the Android SDK since adb and other tools will be present in the PATH after you run lunch and the out/host part is compiled.
The generated ROM is out/target/product/buzz/htc_buzz-ota-*.zip. Wiping the whole data partition in ClockworkMod is required if your previous ROM was built with different signing keys.
Finally, I'd like to thank everyone who made this possible: cyanogen, arco, koush, HDCRJacob, schiznik, _thalamus & AdamG, ben1066, nhnt11 and everyone else who contributed on porting the AOSP on the WildFire. You guys are awesome
Click to expand...
Click to collapse
Plessis guys there is there problem with this download link. I'm not able to download the file.
Sent from my HTC Wildfire using xda premium
Gandolff said:
Plessis guys there is there problem with this download link. I'm not able to download the file.
Sent from my HTC Wildfire using xda premium
Click to expand...
Click to collapse
Did you *really* need to quote the entire post?
I'm assuming you meant the GWK74​-buzz​-20111111​.zip from filefactory - I cant seem to download it either.
No I was trying for just the 1st paragraph, but, sorry mistakes do happen.
Sent from my HTC Wildfire using xda premium

[GUIDE] Bulding CM9 from Sources for O2X (P990)

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

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

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

[Guide] A beginners guide to building and modifying a nexus 4 kernel from source

A beginners guide to building and modifying a nexus 4 lollipop* kernel from source.
*currently 5.0.1​Disclaimer
I am not a developer, nor am I an expert. All the information in here I have gleaned from other sources, credited where possible, so it may not be correct and almost certainly isn't the 'best' way to do things. But it works for me. I hope it works for you but there's no guarantee. Use at your own risk
Assumptions
You have access to a computer running Ubuntu - other distros will probably work but this is the one I'm using. You'll need a basic understanding of the Linux command line including, but not limited to, ls, cp, cd, mkdir, make, ~, sudo, nano and so on.
You'll need to know how to use adb & fastboot to copy stuff into and out of your Nexus 4
A basic undersanding of Git is REALLY helpful if you want to modify your kernel. You'll be able to get by using the comands listed but you really need to have a basic understanding of what Git does if you're going to proceed.
CONTENTS
Initialise your build environment
Downloading the sources
Toolchain
Building
Creating a boot.img
A bit more about Git
Modifying kernels (how I got DT2W working)
Making a flashable zip
Initialise your build envronment
The information for this stage came from: here
I installed Ubuntu 14.04.1 LTS from a scratch. I used VM ware on a Windows laptop but any Linux environment can probably be made to work. So, to start, do an update just to be sure, then install the packages you'll need.
Code:
# sudo apt-get update
# sudo apt-get install bison g++-multilib git gperf libxml2-utils
# sudo apt-get install libncurses5-dev:i386
# sudo apt-get install lib32ncurses5-dev
# sudo apt-get install build-essential kernel-package
Downloads
Most of the really helpful information I've used came from here
I've updated the information slightly and changed the device from Flo to Mako but Pete's page is well worth reading for more background information than I've included here.
To download the source into a 'kernel' folder
Code:
# mkdir ~/android
# cd ~/android/
# git clone https://android.googlesource.com/kernel/msm.git kernel
# cd kernel/
# git branch -a
will show you all the current branches of Mako kernels, choose the one you want and checkout that one.
Code:
# git checkout android-msm-mako-3.4-lollipop-release
Now you need to find out exactly which kernel to build. The 'official' method is here
but that involves a significant download for just a few bytes so I suggest you use the following trick. Go to the pre-built kernel you want to copy here
and you wll see the first line after the header is:-
"16e203d lowmemorykiller: enhance debug information"
You need to make a note of the first seven characters, in this case 16e203d.
Next you need to use Git to create a new branch for our specific kernel. I've called it 'android-lollipop-release'.
Code:
# git checkout -b android-lollipop-release 16e203d
This will extract the source for the kernel we're going to build.
Toolchain
I'm using the stock toolchain (thanks @zaclimon) but will add an alternative suggested by @aviz1911 as time allows.
I'm going to install the toolchain in /usr/local/share but there are other places you could sensibly put it.
Code:
# cd /usr/local/share
sudo git clone [url]https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7[/url]
Export the path to the toolchain and check it works. Note these exports only work for the current session, if you want to add permanently put it in your .bashrc or .profile
Code:
# export PATH=$PATH:/usr/local/share/arm-eabi-4.7/bin
# cd ~
Test it works with
Code:
# arm-eabi-gcc --version
Now you need to tell the system we want to cross compile.
Code:
# export ARCH=arm
# export SUBARCH=arm
# export CROSS_COMPILE=arm-eabi-
Building
Now you're ready to start.
Code:
#cd ~/android/kernel
# make mako_defconfig
You'll get some warnings like this which you can ignore
warning: (ARCH_MSM_KRAITMP && ARCH_MSM_CORTEX_A5) selects HAVE_HW_BRKPT_RESERVED_RW_ACCESS which has unmet direct dependencies (HAVE_HW_BREAKPOINT)
Code:
# make menuconfig
this is where you can make some changes if you like, we're going to change just the name. Choose General Setup ---> then select
(-perf) Local version - append to kernel release
and change perf to anything you like, I'll use dt2w
Save and exit
Code:
# make -j2
where 2 is twice the number of cores on your machine - there's just one processor on my VM but could be many more on yours. It takes more than half an hour on my machine. Then you should see
Code:
Kernel: arch/arm/boot/zImage is ready
Ta Daaaaa - you have built a kernel - now you need to pack it for testing on your phone.
Creating a boot.img
Again I'm going to use Pete's blog post as my guide but omit some details and just get the job done. I'm not going to explain all the steps, you'll have to investigate yourself if you want to understand more.
Code:
# cd ~/android
# git clone https://github.com/pbatard/bootimg-tools.git bootimg-tools
# cd bootimg-tools/libmincrypt/
# gcc -c *.c -I../include
# # cd ../mkbootimg
# gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
# sudo cp mkbootimg /usr/local/bin/
# gcc -o unmkbootimg unmkbootimg.c
# sudo cp unmkbootimg /usr/local/bin/
You need an original boot img to copy so you can insert your new kernel into it. Download the factory image.
Code:
# mkdir ~/android/boot
# cd ~/android/boot
# wget https://dl.google.com/dl/android/aosp/occam-lrx22c-factory-86c04af6.tgz
# tar -xvf occam-lrx22c-factory-86c04af6.tgz
# cd occam-lrx22c/
# unzip occam-lrx22c-factory-86c04af6.zip
# cp boot.img ../
# cd ~/android/boot
Now it's time to unpack the original boot image. unmkbooting will tell you all the parameters you need to repack the boot image with your new kernel inside.
Code:
# unmkbootimg -i boot.img
kernel written to 'kernel' (6009416 bytes)
ramdisk written to 'ramdisk.cpio.gz' (490557 bytes)
To rebuild this boot image, you can use the command:
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x80208000 --ramdisk_offset 0x81800000 --second_offset 0x81100000 --tags_offset 0x80200100 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=mako lpj=67677 user_debug=31' --kernel kernel --ramdisk ramdisk.cpio.gz -o boot.img
Code:
# cp ~/android/kernel/arch/arm/boot/zImage ~/android/boot/
Repack your new boot image with your new kernel using the information from unmkbootimg
Code:
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x80208000 --ramdisk_offset 0x81800000 --second_offset 0x81100000 --tags_offset 0x80200100 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=mako lpj=67677 user_debug=31' --kernel zImage --ramdisk ramdisk.cpio.gz -o new_boot.img
Nore that kernel has been changed to zImage and output file has been changed new_boot.img Now it's time to test your new_boot.img by rebooting your phone into bootloader and reboot with the new img.
DO NOT FLASH THE NEW IMAGE.
fastboot boot new_boot.img NOT fastboot flash boot new_boot.img
If all has gone well your phone will now boot with your new kernel. If something has gone wrong just reboot the phone and you'll be back to where you started. If it has all worked then you can flash the new boot image and use that.
A bit more about Git
If like me, you know nothing about Git, then this bit of the guide is for you. If you have basic understanding this will be too simple for you and you'll have to skip this bit and look elsewhere. If you have a basic understanding of any version control software you won't need this either as the necessary commands to complete the next step will be self explanatory.
Jump to the next stage here
Git is a version control system. To understand what it does at a most basic level follow these steps
Code:
# mkdir git_test
# cd git_test
# git init
Tell git who you are. You don't need the inverted commas, just an email address and a name. Keep this information for when/if you open a Github account.
Code:
# git config --global user.email "[email protected]"
# git config --global user.name "Your Name"
create a text file called 'text' with a single line of text that says "This is the first line"
add this file to your git
Code:
# git add text
commit the change with a message
Code:
git commit -m "first line"
create a new branch (checkout -b both creates and makes the new branch current)
Code:
git checkout -b newbranch
edit the 'text' file by adding another line "this is the second line"
add and commit the change to git
Code:
# git add text
# git commit -m "second line"
Then examine the text file, as you might expect it looks like this
Code:
# cat text
this the first line
this is the second line
but if we now go back to the master branch and checkout THE SAME file, we get a different result
Code:
# git checkout master
cat text
this the first line
The second line is not present because it was only added to the 'newbranch' branch. This, it appears to me is the essence of git, it changes files depending on which branch you're viewing them from.
Now we're going to look at how we can use git to extract files from someone else's repository in order to get the files we want for our needs.
There are loads of guides that help you to learn more, I found this video particularly helpful.
https://www.youtube.com/watch?v=1ffBJ4sVUb4
Still to come
Modifying kernels (how I got DT2W working)
Edit:- It's going to be a while before I complete this section as although I managed to build a working kernel I'm pretty sure I didn't do it the 'right' way so I'm reading the Git Pro book.
Will be back later. .. . .
Awesome guide dude. This will surely help a lot of people
Nice
Nice guide, wish you'd have written it a week earlier
Anyways, what i'd really like to know, is how to patch the Linux version properly, because my attempts lead to break the kernel in the process. Didn't get beyond 3.4.11 :/
Hope you can help me out there, buddy.
How to create a zip ?
I have been looking into this and created a kernel a few days ago. But i want to share it.
For that ill have to create a zip. I have searched for it. I think its done using anykernel template.
The issuse is can i use the certificates in the meta-inf folder and the update-binary that is 4 years old ?
Or should i just unzip a kernel , modify the script and place my boot.img. 
 @aviz1911
Unzipping and re zipping is pretty easy, I'd do that.
@Nicknoxx How's the reading up on git going? Any tips on enabling dt2w would be much appreciated. I've been trying but can't seem to get it to work
I'm really new at the Kernel stuff and just wanted to build stock with dt2w as my first project.
Thanks for the first part of the guide
Wow nice guide sir, i'll try it later
Great Guide!
Thanks Mate!!
what all lines or links should i have to modify if i am building kernel for my device oneplus one lollipop ?
 @Nicknoxx
Also @Nicknoxx one can use the -b argument with git while cloning so git just downloads a single branch of the kernel source, this'll save bandwidth and time to some extent
Like
git clone https://android.googlesource.com/kernel/msm.git -bx kernel
Replace x with desired branch name
Click to expand...
Click to collapse
̿ ̿̿’̿’\̵͇̿̿\з==(*͡° ͜ʖ ͡°)==ε/̵͇̿̿/’̿’̿ ̿ ̿̿*
---------- Post added at 08:26 PM ---------- Previous post was at 08:21 PM ----------
Droid.Riz said:
what all lines or links should i have to modify if i am building kernel for my device oneplus one lollipop ?
@Nicknoxx
Click to expand...
Click to collapse
Use the cm kernel source from github.com/CyanogenMod in git clone
Just type
git clone https://github.com/CyanogenMod/android_kernel_oneplus_msm8974 kernel
Click to expand...
Click to collapse
And for compiling
make bacon_defconfig
Click to expand...
Click to collapse
̿ ̿̿’̿’\̵͇̿̿\з==(*͡° ͜ʖ ͡°)==ε/̵͇̿̿/’̿’̿ ̿ ̿̿*
KNIGHT97 said:
Also @Nicknoxx one can use the -b argument with git while cloning so git just downloads a single branch of the kernel source, this'll save bandwidth and time to some extent
Like
̿ ̿̿’̿’\̵͇̿̿\з==(*͡° ͜ʖ ͡°)==ε/̵͇̿̿/’̿’̿ ̿ ̿̿*
---------- Post added at 08:26 PM ---------- Previous post was at 08:21 PM ----------
Use the cm kernel source from github.com/CyanogenMod in git clone
Just type
And for compiling
̿ ̿̿’̿’\̵͇̿̿\з==(*͡° ͜ʖ ͡°)==ε/̵͇̿̿/’̿’̿ ̿ ̿̿*
Click to expand...
Click to collapse
thanks a lot for quick reply i will start it today itself @ night.
after successfully compiling i will reply here
Nice guide. I ad it to my collection. I mis the part about building the modules. For wifi and so on. I think the command is "make modules"
Maby ad some info about updating a kernel. ICS to JB. KK to LP and sow on.
How about the command to clean after building?
[email protected] said:
Nice guide. I ad it to my collection. I mis the part about building the modules. For wifi and so on. I think the command is "make modules"
Maby ad some info about updating a kernel. ICS to JB. KK to LP and sow on.
How about the command to clean after building?
Click to expand...
Click to collapse
Executing the make -j# command automatically builds your modules along with the Zimage, you'll just need to read last few lines in terminal to know the modules and where they reside
̿ ̿̿’̿’\̵͇̿̿\з==(*͡° ͜ʖ ͡°)==ε/̵͇̿̿/’̿’̿ ̿ ̿̿*
Hi guys,
How i can implement this mod/patch in my kernel??
http://forum.xda-developers.com/android/software-hacking/kernel-tap2unlock-tap2wake-feature-t2965344

[GUIDE] Building An Android Kernel

There are a lot of people out there wondering how to build kernels. It sounds confusing and hard, but once you get the hang of it, it is actually quite easy. I got the jist of it in just a few practices. Now I give all of my information to you, in the simplest, most comprehensible and most noob friendly way I can. In this guide, I will be building the kernel for my phone, the Samsung Galaxy Victory 4G LTE. So make your adjustments where necessary.
What You Will Need:
A linux OS. I now use Ubuntu 14.04 Manjaro, and Manjaro or Arch are preferred. (Ubuntu is easiest)
Patience
(Optional) A boot.img for your device
Required files
Required Files:
Open terminal and paste the following (I assume you already have java and perl and all that jazz):
In Ubuntu/ Debian:
Code:
sudo apt-get install abootimg git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
For Arch/Manjaro, do
Code:
sudo pacman -S gcc git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc
for 32 and 64 bit systems. For only 64 bit, add the following:
Code:
sudo pacman -S gcc-multilib lib32-zlib lib32-ncurses lib32-readline
Also, abootimg can be installed using
Code:
yaourt -S abootimg-git
For other distros, you may have to modify the command to get the required files, such as using yum
Also, make sure you have setup git and it is ready to go.
Setting Up Folders:
You are going to need a folder to build you kernel in. For this tutorial, I will use my setup: /home/nick/android/kernel/SPH-L300/Kernel. Kernel is the source directory that is made from the source zip and SPH-L300 I will also use a lot, which contains Kernel.
Downloading The Source:
Download the zip from http://opensource.samsung.com/ or from InsanelyCool's stock kernel source. Then I put it in the SPH-L300 folder. Afterwards, unzip it. You should have 2 files, Kernel.tar.gz and Platform.tar.gz. We are going to focus on Kernel.tar.gz, so unzip it. This will make the Kernel folder.
Now, in your terminal, cd to somewhere to keep your toolchains. I keep mine in ~/android/kernel.
Now type
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
for the toolchains I used. They should be put in the folder toolchains.
Modifying The Kernel:
Now is the time to modify the kernel. You can apply patches and change governors and frequencies etc here.
Applying a Patch:
The kernel version is 3.0.31. You can upgrade it using patches. Patches can be found here. You have to apply one patch at a time, which is why scripts come in handy when patching multiple times. I am going to show you how to upgrade to 3.0.33, since you can do that without error.
First, download patch-3.0.31-32.bz2 (or .gz) and download patch-3.0.32-33.bz2 (or .gz).
Extract both and move the extracted files into the Kernel source folder.
Cd to this folder in your terminal and type
Code:
patch -p1 < patch-3.0.31-32
. If you get something about
Code:
...assume -R? [n]
just press enter then press y then enter again.
Do the same steps for applying the other patch, just mod the command to work.
Building The Kernel:
Setting Up Environment:
In the Kernel source directory, open the file Makefile and press ctrl-f. Then enter CROSS_COMPILE, and look for CROSS_COMPILE = /xxxxx, where xxxxx is a directory. Change that directory to the toolchain of your choice. **Not all toolchains work!** For me, it would look like: CROSS_COMPILE = /home/nick/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi- for Linaro 4.6.2. Save the file and exit.
Make sure your terminal is in the Kernel source directory.
Kernel Name:
If you want to change the kernel name, in terminal type
Code:
KBUILD_BUILD_VERSION="ROM NAME"
then
Code:
export KBUILD_BUILD_VERSION
.
Compiling It:
Next, type
Code:
export ARCH=arm
into terminal.
Almost there. The next step is to type
Code:
make gogh_defconfig
into terminal.
If you added options such as governors, do
Code:
make menuconfig
to activate them.
Otherwise, type
Code:
make -jx
where x is the number of processes per core. I use
-j2 for a dual core cpu. This takes about 20-30 mins for me. A quad-core Intel cpu takes 4 mins if you use -j5. For Intel, it is the # of cores + 1.
Actually Putting The Kernel Together:
Now that it has built, assuming you have had no errors and the terminal finishes with
Code:
Kernel: arch/arm/boot/zImage is ready
you are ready to assemble the kernel. Cd to outside your Kernel source to the folder that contains it. For me that would be SPH-L300. You are going to need a working boot.img for this phone to speed up this process by a lot. Whether its stock, mine, or Insanelycool's, just paste it into the folder.
In terminal, type
Code:
abootimg -x boot.img
Then
Code:
mkdir initrd && cd initrd && zcat ../initrd.img | cpio -i
And finally
Code:
find . | cpio -o -H newc | gzip > ../initrd.img
This splits the boot.img, and puts the ramdisk in the initrd folder.
Now, navigate to (kernel source)/arch/arm/boot and copy the zImage to where you were before (the SPH-L300 folder for me). When you paste, override the pre-existing zImage.
If you would like to change the splash screen before the bootanimation, swap out initlogo.rle in the initrd folder with the image of you choice. It must be a rle image and must be named initlogo to work. I won't tell you how to convert png's to rle's cuz I am sure you know how to Google.
Now, we actually but the boot.img together. In terminal, type
Code:
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
and make sure you are in the initrd folder. If you get the error updated is too big for Boot Image, use this command:
Code:
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -c "bootsize=xxxxxx" -r initrd.img
and replace the x's with the size the kernel wants to be. This will give you a new boot.img in the containing folder (SPH-L300 for me). Now just zip it up and tell the updater-script where to flash it and voila!, you just made you own kernel.
Feel free to ask any questions below.
I WOULD LIKE TO THANK ONE PERSON IN SPECIFIC, AND THAT IS INSANELYCOOL FOR TEACHING ME MOST OF THE STEPS HERE.
please help me a aint got a clue using ubuntu 15.10 withe kernel 4.3
Nick_73 said:
There are a lot of people out there wondering how to build kernels. It sounds confusing and hard, but once you get the hang of it, it is actually quite easy. I got the jist of it in just a few practices. Now I give all of my information to you, in the simplest, most comprehensible and most noob friendly way I can. In this guide, I will be building the kernel for my phone, the Samsung Galaxy Victory 4G LTE. So make your adjustments where necessary.
What You Will Need:
A linux OS. I now use Ubuntu 14.04 Manjaro, and Manjaro or Arch are preferred. (Ubuntu is easiest)
Patience
(Optional) A boot.img for your device
Required files
Required Files:
Open terminal and paste the following (I assume you already have java and perl and all that jazz):
In Ubuntu/ Debian:
Code:
sudo apt-get install abootimg git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
For Arch/Manjaro, do
Code:
sudo pacman -S gcc git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc
for 32 and 64 bit systems. For only 64 bit, add the following:
Code:
sudo pacman -S gcc-multilib lib32-zlib lib32-ncurses lib32-readline
Also, abootimg can be installed using
Code:
yaourt -S abootimg-git
For other distros, you may have to modify the command to get the required files, such as using yum
Also, make sure you have setup git and it is ready to go.
Setting Up Folders:
You are going to need a folder to build you kernel in. For this tutorial, I will use my setup: /home/nick/android/kernel/SPH-L300/Kernel. Kernel is the source directory that is made from the source zip and SPH-L300 I will also use a lot, which contains Kernel.
Downloading The Source:
Download the zip from http://opensource.samsung.com/ or from InsanelyCool's stock kernel source. Then I put it in the SPH-L300 folder. Afterwards, unzip it. You should have 2 files, Kernel.tar.gz and Platform.tar.gz. We are going to focus on Kernel.tar.gz, so unzip it. This will make the Kernel folder.
Now, in your terminal, cd to somewhere to keep your toolchains. I keep mine in ~/android/kernel.
Now type
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
for the toolchains I used. They should be put in the folder toolchains.
Modifying The Kernel:
Now is the time to modify the kernel. You can apply patches and change governors and frequencies etc here.
Applying a Patch:
The kernel version is 3.0.31. You can upgrade it using patches. Patches can be found here. You have to apply one patch at a time, which is why scripts come in handy when patching multiple times. I am going to show you how to upgrade to 3.0.33, since you can do that without error.
First, download patch-3.0.31-32.bz2 (or .gz) and download patch-3.0.32-33.bz2 (or .gz).
Extract both and move the extracted files into the Kernel source folder.
Cd to this folder in your terminal and type
Code:
patch -p1 < patch-3.0.31-32
. If you get something about
Code:
...assume -R? [n]
just press enter then press y then enter again.
Do the same steps for applying the other patch, just mod the command to work.
Building The Kernel:
Setting Up Environment:
In the Kernel source directory, open the file Makefile and press ctrl-f. Then enter CROSS_COMPILE, and look for CROSS_COMPILE = /xxxxx, where xxxxx is a directory. Change that directory to the toolchain of your choice. **Not all toolchains work!** For me, it would look like: CROSS_COMPILE = /home/nick/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi- for Linaro 4.6.2. Save the file and exit.
Make sure your terminal is in the Kernel source directory.
Kernel Name:
If you want to change the kernel name, in terminal type
Code:
KBUILD_BUILD_VERSION="ROM NAME"
then
Code:
export KBUILD_BUILD_VERSION
.
Compiling It:
Next, type
Code:
export ARCH=arm
into terminal.
Almost there. The next step is to type
Code:
make gogh_defconfig
into terminal.
If you added options such as governors, do
Code:
make menuconfig
to activate them.
Otherwise, type
Code:
make -jx
where x is the number of processes per core. I use
-j2 for a dual core cpu. This takes about 20-30 mins for me. A quad-core Intel cpu takes 4 mins if you use -j5. For Intel, it is the # of cores + 1.
Actually Putting The Kernel Together:
Now that it has built, assuming you have had no errors and the terminal finishes with
Code:
Kernel: arch/arm/boot/zImage is ready
you are ready to assemble the kernel. Cd to outside your Kernel source to the folder that contains it. For me that would be SPH-L300. You are going to need a working boot.img for this phone to speed up this process by a lot. Whether its stock, mine, or Insanelycool's, just paste it into the folder.
In terminal, type
Code:
abootimg -x boot.img
Then
Code:
mkdir initrd && cd initrd && zcat ../initrd.img | cpio -i
And finally
Code:
find . | cpio -o -H newc | gzip > ../initrd.img
This splits the boot.img, and puts the ramdisk in the initrd folder.
Now, navigate to (kernel source)/arch/arm/boot and copy the zImage to where you were before (the SPH-L300 folder for me). When you paste, override the pre-existing zImage.
If you would like to change the splash screen before the bootanimation, swap out initlogo.rle in the initrd folder with the image of you choice. It must be a rle image and must be named initlogo to work. I won't tell you how to convert png's to rle's cuz I am sure you know how to Google.
Now, we actually but the boot.img together. In terminal, type
Code:
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
and make sure you are in the initrd folder. If you get the error updated is too big for Boot Image, use this command:
Code:
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -c "bootsize=xxxxxx" -r initrd.img
and replace the x's with the size the kernel wants to be. This will give you a new boot.img in the containing folder (SPH-L300 for me). Now just zip it up and tell the updater-script where to flash it and voila!, you just made you own kernel.
Feel free to ask any questions below.
I WOULD LIKE TO THANK ONE PERSON IN SPECIFIC, AND THAT IS INSANELYCOOL FOR TEACHING ME MOST OF THE STEPS HERE.
Click to expand...
Click to collapse
Actually where is the zImage located in output/arch/arm/boot/ or in source/arch/arm/boot/ both the files are different for me
Sent from my SM-G530H using Tapatalk
pradeepreddychimmula said:
Actually where is the zImage located in output/arch/arm/boot/ or in source/arch/arm/boot/ both the files are different for me
Sent from my SM-G530H using Tapatalk
Click to expand...
Click to collapse
The one you made may be a diff size depending on the compression and mods you've done
Sent from my A0001 using Tapatalk
Nick_73 said:
The one you made may be a diff size depending on the compression and mods you've done
Sent from my A0001 using Tapatalk
Click to expand...
Click to collapse
I mean which is the compiled one
Sent from my SM-G530H using Tapatalk
pradeepreddychimmula said:
I mean which is the compiled one
Sent from my SM-G530H using Tapatalk
Click to expand...
Click to collapse
The one u compiled should be the output
Sent from my A0001 using Tapatalk
Nick_73 said:
There are a lot of people out there wondering how to build kernels. It sounds confusing and hard, but once you get the hang of it, it is actually quite easy. I got the jist of it in just a few practices. Now I give all of my information to you, in the simplest, most comprehensible and most noob friendly way I can. In this guide, I will be building the kernel for my phone, the Samsung Galaxy Victory 4G LTE. So make your adjustments where necessary.
What You Will Need:
A linux OS. I now use Ubuntu 14.04 Manjaro, and Manjaro or Arch are preferred. (Ubuntu is easiest)
Patience
(Optional) A boot.img for your device
Required files
Required Files:
Open terminal and paste the following (I assume you already have java and perl and all that jazz):
In Ubuntu/ Debian:
Code:
sudo apt-get install abootimg git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
For Arch/Manjaro, do
Code:
sudo pacman -S gcc git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc
for 32 and 64 bit systems. For only 64 bit, add the following:
Code:
sudo pacman -S gcc-multilib lib32-zlib lib32-ncurses lib32-readline
Also, abootimg can be installed using
Code:
yaourt -S abootimg-git
For other distros, you may have to modify the command to get the required files, such as using yum
Also, make sure you have setup git and it is ready to go.
Setting Up Folders:
You are going to need a folder to build you kernel in. For this tutorial, I will use my setup: /home/nick/android/kernel/SPH-L300/Kernel. Kernel is the source directory that is made from the source zip and SPH-L300 I will also use a lot, which contains Kernel.
Downloading The Source:
Download the zip from http://opensource.samsung.com/ or from InsanelyCool's stock kernel source. Then I put it in the SPH-L300 folder. Afterwards, unzip it. You should have 2 files, Kernel.tar.gz and Platform.tar.gz. We are going to focus on Kernel.tar.gz, so unzip it. This will make the Kernel folder.
Now, in your terminal, cd to somewhere to keep your toolchains. I keep mine in ~/android/kernel.
Now type
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
for the toolchains I used. They should be put in the folder toolchains.
Modifying The Kernel:
Now is the time to modify the kernel. You can apply patches and change governors and frequencies etc here.
Applying a Patch:
The kernel version is 3.0.31. You can upgrade it using patches. Patches can be found here. You have to apply one patch at a time, which is why scripts come in handy when patching multiple times. I am going to show you how to upgrade to 3.0.33, since you can do that without error.
First, download patch-3.0.31-32.bz2 (or .gz) and download patch-3.0.32-33.bz2 (or .gz).
Extract both and move the extracted files into the Kernel source folder.
Cd to this folder in your terminal and type
Code:
patch -p1 < patch-3.0.31-32
. If you get something about
Code:
...assume -R? [n]
just press enter then press y then enter again.
Do the same steps for applying the other patch, just mod the command to work.
Building The Kernel:
Setting Up Environment:
In the Kernel source directory, open the file Makefile and press ctrl-f. Then enter CROSS_COMPILE, and look for CROSS_COMPILE = /xxxxx, where xxxxx is a directory. Change that directory to the toolchain of your choice. **Not all toolchains work!** For me, it would look like: CROSS_COMPILE = /home/nick/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi- for Linaro 4.6.2. Save the file and exit.
Make sure your terminal is in the Kernel source directory.
Kernel Name:
If you want to change the kernel name, in terminal type
Code:
KBUILD_BUILD_VERSION="ROM NAME"
then
Code:
export KBUILD_BUILD_VERSION
.
Compiling It:
Next, type
Code:
export ARCH=arm
into terminal.
Almost there. The next step is to type
Code:
make gogh_defconfig
into terminal.
If you added options such as governors, do
Code:
make menuconfig
to activate them.
Otherwise, type
Code:
make -jx
where x is the number of processes per core. I use
-j2 for a dual core cpu. This takes about 20-30 mins for me. A quad-core Intel cpu takes 4 mins if you use -j5. For Intel, it is the # of cores + 1.
Actually Putting The Kernel Together:
Now that it has built, assuming you have had no errors and the terminal finishes with
Code:
Kernel: arch/arm/boot/zImage is ready
you are ready to assemble the kernel. Cd to outside your Kernel source to the folder that contains it. For me that would be SPH-L300. You are going to need a working boot.img for this phone to speed up this process by a lot. Whether its stock, mine, or Insanelycool's, just paste it into the folder.
In terminal, type
Code:
abootimg -x boot.img
Then
Code:
mkdir initrd && cd initrd && zcat ../initrd.img | cpio -i
And finally
Code:
find . | cpio -o -H newc | gzip > ../initrd.img
This splits the boot.img, and puts the ramdisk in the initrd folder.
Now, navigate to (kernel source)/arch/arm/boot and copy the zImage to where you were before (the SPH-L300 folder for me). When you paste, override the pre-existing zImage.
If you would like to change the splash screen before the bootanimation, swap out initlogo.rle in the initrd folder with the image of you choice. It must be a rle image and must be named initlogo to work. I won't tell you how to convert png's to rle's cuz I am sure you know how to Google.
Now, we actually but the boot.img together. In terminal, type
Code:
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
and make sure you are in the initrd folder. If you get the error updated is too big for Boot Image, use this command:
Code:
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -c "bootsize=xxxxxx" -r initrd.img
and replace the x's with the size the kernel wants to be. This will give you a new boot.img in the containing folder (SPH-L300 for me). Now just zip it up and tell the updater-script where to flash it and voila!, you just made you own kernel.
Feel free to ask any questions below.
I WOULD LIKE TO THANK ONE PERSON IN SPECIFIC, AND THAT IS INSANELYCOOL FOR TEACHING ME MOST OF THE STEPS HERE.
Click to expand...
Click to collapse
How to covert zImage- to boot.img
Sent from my SM-G530H using Tapatalk
pradeepreddychimmula said:
How to covert zImage- to boot.img
Sent from my SM-G530H using Tapatalk
Click to expand...
Click to collapse
It tells u in the instructions how to put the zImage into the boot.img
Sent from my 1+ One using Tapatalk
Fantastic guide. Much appreciated!!! Thank you.
Now if i need to compile a custom kernel, i know where to look at.
Nick_73 said:
(I assume you already have java and perl and all that jazz)
Click to expand...
Click to collapse
it's not noob friendly. how do i know about other stuff that required for compiling?
Thank's for this tutorial. I have a Unbuntu box with 4Gig RAM and I'm interested in trying this out. Would that be sufficient for compiling android or should I upgrade my machine first?
Hello,
I'm compiling this kernel https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/ido-l-oss
But the kernel stop booting as it doesn't found a sound card.
Running ls /dev/snd return only timer while it will have some pcm and other device in stock kernel.
Can somebody point me where to look at?
Thanks
Sent from my Redmi 3 using XDA Labs
can I have one?
can I have a copy of the Victory's rom o.o it sounds AWESOME
Soory but I am newbie building kernels for every device is same thanks in advance

Categories

Resources