[Question] post #4: Include Stk.apk in full_passion_eng make... - Android

question #1 regarding if "make -jx otapackage" update.zip flashes new recovery over custom recovery...
when building froyo from aosp for passion, i have been taking the out/target/product/passion boot.img and system.img and using dsixda kitchen to output a flashable update.zip... no issues. i just started also ending the compile with "make -jx otapackage". pulling apart the .zip i see there is a "recovery" file folder. does this flash a new recovery that would replace any custom recovery already on device???
thanks to anyone willing to throw me an answer.

lpasq said:
when building froyo from aosp for passion, i have been taking the out/target/product/passion boot.img and system.img and using dsixda kitchen to output a flashable update.zip... no issues. i just started also ending the compile with "make -jx otapackage". pulling apart the .zip i see there is a "recovery" file folder. does this flash a new recovery that would replace any custom recovery already one device???
thanks to anyone willing to throw me an answer.
Click to expand...
Click to collapse
It's my understanding that as long as there's nothing in the update-script that will flash the recovery image, then you are ok. I've encountered this once, and I just deleted the recovery folder and anything in the update-script. (And then zipped and resigned the ROM.) When I flashed the ROM, there was no recovery image flashed. Just double-check everything.

gnarlyc said:
It's my understanding that as long as there's nothing in the update-script that will flash the recovery image, then you are ok. I've encountered this once, and I just deleted the recovery folder and anything in the update-script. (And then zipped and resigned the ROM.) When I flashed the ROM, there was no recovery image flashed. Just double-check everything.
Click to expand...
Click to collapse
Understood and appreciated.
Sent from my Nexus One using XDA App

[Question] Including Stk.apk in full_passion_eng make...
When I lunch full_passion_eng, the Stk.apk is not included in my compiled build. How do I add it for inclusion in the build?
My build.sh is as follows:
PHP:
#!/bin/bash
#clean out prior compiled files
make installclean
make clean
#update AOSP froyo source files
repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
cd ~
repo sync
#setup compiling environment and build
cd ~
. build/envsetup.sh
lunch
#USB connect N1 and initiate ADB
cd ~
adb devices
#ADB pull needed device files
cd ~
cd device
cd htc
cd passion
./extract-files.sh
#build the Passion *.img's
cd ~
make -j3
#view compiled folder's new boot.img/system.img/userdata.img
cd ~
cd out
cd target
cd product
cd passion
echo 'see flashable files:'
ls *.img
#create update.zip
cd ~
make -j3 otapackage
This is the Android.mk in /packages/apps/Stk. Am I to modify this or am I really off?
PHP:
# Copyright 2007-2008 The Android Open Source Project
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := Stk
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
Thank you.

Related

[Q]How to Unpack/Split Samsung boot.img ?

Maybe a noob question, but how do you guys split and repack SGS3 boot.img ?
The usual perl scripts don't seem to work with any S3 boot.img I came across (neither for the Galaxy Tab 7.7 boot.img's btw).
I keep getting this error :
Android Magic not found in boot.img. Giving Up.
Click to expand...
Click to collapse
Thanks for answering.
To unpack, you can do this:
Code:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames
Of course, that assumes you have abootimg installed. The above will split the zImage and the ramdisk from the boot.img and then proceed to extract the files from the ramdisk. Some ramdisks are not Gzip compressed so in that case use cat instead of zcat. Also: run that as root to make sure you don't mangle the files' permissions. I haven't tried repacking, though. ("find . -print | cpio -o -H newc | gzip > ../initrd.img" followed by "cd .. ; abootimg -u boot.img -r initrd.img" worked for my U8800pro, but I've had no need to try it with GS3 images.) I'd start by looking at the tools that come with the official Samsung source distribution and guides that tell you how to build a Samsung kernel.
Thanks a lot for this thorough answer
Trying this right now.
Couldn't find a specific Samsung kernel-related tutorial, though good idea to go take a look at Samsung's official kernel documentation.
qwerty12 said:
To unpack, you can do this:
Code:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames
Of course, that assumes you have abootimg installed. The above will split the zImage and the ramdisk from the boot.img and then proceed to extract the files from the ramdisk. Some ramdisks are not Gzip compressed so in that case use cat instead of zcat. Also: run that as root to make sure you don't mangle the files' permissions. I haven't tried repacking, though. ("find . -print | cpio -o -H newc | gzip > ../initrd.img" followed by "cd .. ; abootimg -u boot.img -r initrd.img" worked for my U8800pro, but I've had no need to try it with GS3 images.) I'd start by looking at the tools that come with the official Samsung source distribution and guides that tell you how to build a Samsung kernel.
Click to expand...
Click to collapse
Great!! Thanks for your information.
Here is what I use. Inside there are three binaries and two perl scripts,, copy the binaries into /usr/bin/ or you can add them in their own place and add that to the path. Then use this to help you use the files
Thanks for that too, ima try those scripts
Getting this error :
~$ perl unpack-bootimg.pl boot.img
could not find any embeded ramdisk images. Are you sure this is a full boot image?
Click to expand...
Click to collapse
Apparently, from what I have been reading, Samsung uses a different type of kernels than other manufacturers.
Although there's a huge number of custom samsung kernels out there. There might be a way^^
Here is the kernel i'm trying to edit if anyone wanna give a try at unpacking it for me.
That is true up until the S3 boot.img/kernel They have always used a zImage. Now Google has forced them to move over to EXT4 system and change the kernel format.
That file is only 2.88 mb's that is way too small to be a full kernel. Even for stock with no tweaks. That's why you are having an error.
This is the original boot.img from the CM9 for Galaxy Tab 7.7 update.zip
However i get the same error when trying to unpack S3 stock boot.img or even CM10 boot.img, although when i try the same scripts on my Xperia Play's kernels they unpack properly.
Good thing if Google made Samsung do kernels like others
Hi,
Did you manage to unpack/repack the SGS3 boot image? I'm trying to modify init.rc in an international SGS3 (i9300).
I've managed to unpack the boot image (from /dev/block/mmcblk0p5) as per qwerty12's command but how do I repack it?
Thanks!

[DEV][RECOVERY] TeamWin Recovery Project for X8 [11-11-2012]

ATTENTION!
AT THIS MOMENT THIS IS ONLY A WORK IN PROGRESS PROJECT,
RECOMMENDED FOR DEVS AND TESTERS ONLY!
To the haters/spammers/etc:
The TeamWin Recovery Project is Open Source Project, available for
everyone and I talked with Dees_Troy, and he accept this project.
In the links you can found a modded kernel from alfsamsung, before you
start a permission war: I have permission from alfsamsung too, since 2012 march,
so do not start "do you have permission???" questions.
Some suggestion:
This is a development thread.
If you want to say: this project is wonderful or a big piece of sh*t, better if you leave it.
Earlier sgt. meow opened a discussion thread about TWRP, if you can't help in the development,
please go there if you want to write something.
I have really few time to work on this project.
If you want to help, write your ideas, and write what do you want to do.
For example:
If you want to work with themes, or any part of the code, please inform me.
XDA Developers site is a COMMUNITY
Better if we share the tasks, and work more developers on ONE project than everyone working alone.
I will try to manage this project, and if the project will be stable, I will send back the code/configuration/etc
changes to the original TeamWin team to help their work.​
What is it?
This is a modified TeamWin Recovery for the X8
For more information visit the official TeamWin Recovery Project page.
http://teamw.in/project/twrp2
Whats working:
Touch control
Install zip updates (some zip files need a newer update-binary)
Backup and Restore (except the android_secure folder)
Built in terminal and filemanager
Mounts
Wipes
USB Mount
Need to fix:
Some UI related changes (a few button/checkbox in wrong place)
Backup/restore of the android_secure folder
All non discovered bugs...
How to build from source:
With CM7:
First step: Prepare the build environment
Download the modded CM7_build from Dees_Troy:
https://github.com/Dees-Troy/TWRP2-CM7_build
and replace your own build/core/Makefile with the one from the downloaded file.
Second step: modify the prelinker map
Search the device specific BoardConfig.mk (or BoardConfigCommon.mk) and check where is your prelinker map. Defined with the TARGET_PRELINKER_MAP variable, for example in the MiniCM7 source the TARGET_PRELINKER_MAP point to /device/semc/msm7x27-common/prelink-linux-arm-x8.map
Merge these binaries:
#libraries for TWRP
libmmcutils.so 0x9C500000 # [<64K]
libbmlutils.so 0x9C400000 # [<64K]
libflashutils.so 0x9C300000 # [<64K]
libmincrypt.so 0x9C200000 # [<64K] #This need only is you use crypto​
WARNING!!! Check the last address in the original file, and recalculate the added binaries address!!!
With CM9/CM10/AOKP:
Waiting for other devs
TWRP related settings (merge into the BoardConfig.mk, and you can found these settings in the source too)
#TWRP
BOARD_HAS_NO_REAL_SDCARD := false
DEVICE_RESOLUTION := 320x480
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TARGET_RECOVERY_GUI := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565"
TARGET_USE_CUSTOM_LUN_FILE_PATH :=/sys/devices/platform/usb_mass_storage/lun0/file
TW_CUSTOM_POWER_BUTTON := 107
TW_EXTERNAL_STORAGE_PATH := "/sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard"
TW_FLASH_FROM_STORAGE := true
TW_HAS_DOWNLOAD_MODE := false
TW_HAS_NO_RECOVERY_PARTITION := true
TW_INCLUDE_CRYPTO := false
TW_INCLUDE_JB_CRYPTO := false
TW_NEVER_UNMOUNT_SYSTEM := false
TW_NO_BATT_PERCENT := false
TW_NO_REBOOT_BOOTLOADER := true
TW_NO_USB_STORAGE := false
TW_SDEXT_NO_EXT4 := false​
To build it, you need only:
Replace the files in bootable/recovery with the files from the source
Code:
. build/envsetup.sh
lunch
make recoveryimage
When the build finished, grab the needed files from:
out/target/product/shakira/recovery/root
While this project is only alpha stage, better if you use it in dual recovery mode (CWM+TWRP)
Here is a sample bootrec file (with this sample the normal methods (key press on kernel logo or use the Reboot to recovery option in the rom) start the CWM recovery, if you touch the screen on kernel logo, the TWRP start.
Code:
#!/sbin/sh
# With alfsamsung kernels and stock use these values:
cat /dev/input/event1 > /dev/keycheck&
cat /dev/input/event0 > /dev/tscheck&
[COLOR="Red"]# USE THESE VALUES ON ALL NAA BASED KERNELS :) [COLOR="Blue"]// thanks for feherneoh[/COLOR]
cat /dev/input/event2 > /dev/keycheck&
cat /dev/input/event1 > /dev/tscheck&[/COLOR]
sleep 2
kill -9 $!
if [ -s /dev/keycheck -o -e /cache/recovery/boot ]
then
rm /cache/recovery/boot
mount -o remount,rw rootfs /
umount -l /system
umount -l /data
umount -l /cache
umount -l /mnt/sdcard
rm -r /sdcard
rm -r /not/sdcard
mkdir /sdcard
mkdir /tmp
rm /etc
mkdir /etc
cp /recovery.fstab /etc/recovery.fstab
mount /dev/block/mmcblk0p1 /sdcard
/sbin/recovery &
/sbin/adbd recovery
fi
if [ -s /dev/tscheck ]
then
mount -o remount,rw rootfs /
umount -l /system
umount -l /data
umount -l /cache
umount -l /mnt/sdcard
chroot /recovery /init
fi
mkdir /system/lib/modules
ln -s /modules/sdio.ko /system/lib/modules/sdio.ko
ln -s /modules/tiwlan_drv.ko /system/lib/modules/tiwlan_drv.ko
ln -s /modules/tiap_drv.ko /system/lib/modules/tiap_drv.ko
chown u+s /sbin/charger
mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh,ro /dev/block/mtdblock0 /system
/sbin/charger
With this sample you must place the recovery files into /recovery folder of the ramdisk or if you have /recovery partition place it there (don't forget to mount the recovery partition)
If you use the ramdisk own init.rc file to start the recovery (instead of the method with change root to the recovery own folder) you need to modify the init.rc file, add the path of the recovery files to the LD_LIBRARY_PATH variable:
Code:
# setup the global environment
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /vendor/lib:/system/lib[COLOR="Red"]:/path_of_the_recovery (usually the /sbin folder)[/COLOR]
Links:
Source: https://github.com/pilu1978/TeamWin_Recovery_X8
Link for the prebuilt binaries (you can try it without compiling):
http://www.mediafire.com/?wxkmwnh1afc7aa1
If you not want to play with this project, just want to try it
here is a modded alfs8a kernel with CWM+TWRP:
http://www.mediafire.com/?7qy1fq3yv4gjra8​
Work in progress:
Fix for the old update-binary (if the zip package contains normal installer then use the built-in version from the ramdisk, if the update contains aroma installer use the one from the zip package)
Fix for the android_secure backup/restore
Fix the UI bugs (correct some button/checkbox position and remove some useless thing)
Aroma Filemanager instead of the built-in filemanager
Fix the errors with the busybox what compiled with twrp (to make standalone twrp, no need external busybox or cwm recovery to use it)
SOURCES AND BINARIES WILL BE UPDATED ONLY WHEN THESE FIXES FULLY WORKING!!!
The cooperative work failed, working alone.
Reserved for other developers who working on this project
Reserved for future usage
Hi, I'd like to know what has this Recovery more than the others ? I didn't find in the Thread the specs of it.
Thanks.
WHTA?'''
What version is this cwm....... Can i port this to the stock kernel??
With Jelly Bean repos, your config not working. The recovery compiling without error. But the made recovcery doesn't work. The Blue background and teamwin text flashing constantly... Now I try to find why...
Neur0Nerd said:
Hi, I'd like to know what has this Recovery more than the others ? I didn't find in the Thread the specs of it.
Thanks.
Click to expand...
Click to collapse
Go there: http://teamw.in/project/twrp2 (link added to the first post)
xperiafan13 said:
What version is this cwm....... Can i port this to the stock kernel??
Click to expand...
Click to collapse
This is NOT ClockWorkMod This is TeamWin Recovery V2.3.1.1 And as I wrote: this project is open source. If you want to port for stock kernel, you can do it. Only one request: please inform me about your work.
Daveee10 said:
With Jelly Bean repos, your config not working. The recovery compiling without error. But the made recovcery doesn't work. The Blue background and teamwin text flashing constantly... Now I try to find why...
Click to expand...
Click to collapse
No idea why. Try to use the precompiled binaries. If these binaries work with JB kernel, maybe I forgot something, or need to add something. The source based on the official JB branch of TeamWin Recovery.
no, the prebuilt recovery doen't work too.. But I don't see the init.rc change in your first post.
I think that:
Adding .:/sbin after export LD_LIBRARY_PATH before any other path...
Yes, I forgot it, later I will correct it. (now on mobile). But the prebuilt binaries contains this mod. And when you compile the recovery, the listed folder in the 1st post contains the correct init.rc. And how to use the recovery? Try to use it with chroot.
Sent from my E15i using xda app-developers app
pilu1978 said:
Yes, I forgot it, later I will correct it. (now on mobile). But the prebuilt binaries contains this mod. And when you compile the recovery, the listed folder in the 1st post contains the correct init.rc. And how to use the recovery? Try to use it with chroot.
Sent from my E15i using xda app-developers app
Click to expand...
Click to collapse
no, that not the correct for me... in my kernel init.rc very different from that.. Trying to change all needed file to twrp recovery file... So I want use twrp only one recovery in kernel now.. If working I will make the dual recovery method or modular recovery... But now I go to bed because tomorrow I will working. So the next compiling is tomorrow evening...
The compiled init.rc is correct for the recovery. I think better if you use it in dual recovery mode, and make standalone twrp recovery after a longer test period. And I think better if you re-init the phone with the recovery own init.rc file instead of replacing existing files in ramdisk. This method clean and work, and compatible with the kernel what have recovery partition.
Sent from my E15i using xda app-developers app
I'm going to compile now using the jb-wip branch. Will let you know how it goes.
Umm...pilu1978, your modified kernel's init (the one in the recovery folder) is smaller in size than that of mine. Also would the same bootrec work on ICS kernels? I'm pretty sure it will. However when I tried it didn't boot (missed out some bits of code, I guess). So I'm going to use your one now and test. Will report what happens.
Good work bro
downloaded and testing now
cheers
For those who want to test it on other kernels here is the .zip edition:
https://docs.google.com/folder/d/0B_4r4JB1Is2QX3VSSDBZZF81ckU/edit
Download then install from CWM & enjoy
Sent from my E15i using xda app-developers app
sgt. meow said:
Umm...pilu1978, your modified kernel's init (the one in the recovery folder) is smaller in size than that of mine. Also would the same bootrec work on ICS kernels? I'm pretty sure it will. However when I tried it didn't boot (missed out some bits of code, I guess). So I'm going to use your one now and test. Will report what happens.
Click to expand...
Click to collapse
Yes, it can work with all kernel. The init binary compiled from CM7 sources, this is the reason of the smaller size. The init in ICS/JB kernels a little bit bigger, these binaries contains additional user groups, etc, but for the recovery this is not important. The init.rc is much smaller because it NOT contains the basic file structure/settings what needed for the ROM. The recovery can work with a totally empty phone without any ROM, because this is INDEPENDENT from the installed (or not installed) android version (you also use CWM what compiled with CM7 source tree in your ICS/JB kernels without any problem). The bootrec is only a simple script, what contains some conditions (what happen IF key pressed and what happen IF you touch the screen). You can use any script when the phone booting (call with exec command in init.rc/init.delta.rc
It still didn't work. When I tap the screen, it boots into CWM touch. Now I'll try and use your binaries and see what happens.
@feherneoh
Good work bro. Works like a charm.
You use the bootrec from 1st post? Try to use the one from the sample kernel, later I will check the posted bootrec, maybe forgot something...
EDIT: looks like the posted bootrec and the other in the sample kernel is near 100% same. Two differences:
1. In the kernel the bootrec check the screen type and select the correct version of touch cwm (this is absolute not do anything with twrp)
2. In the kernel bootrec file a secondary condition exist to start twrp, it will start IF touch the screen OR a file exists in /cache/recovery (I add options for boot to twrp in my own rom, but it can't be a reason of cwm starting instead of twrp)
Sent from my E15i using xda app-developers app
Nope, using your binaries didn't work either.

[Q] 1000 failures while trying to compile CM!

I'm tired of asking the same question again and again but for the thousandth and the last time I'll try my best to explain y'all the jeopardy I'm in.
I'm trying to build cm-10.2 from source for Sony Xperia E (nanhu) and everything started off just fine until I had to generate the skeleton files. I decided to use the mkvendor.sh to generate em. I have no clue why, but Sony seems to be in love with .elf files. And the best part, mkvendor only works with a standard boot.img file. Since I found mkvendor.sh the only convincing option, I decided to not use the other 2 options given here.
I extracted the kernel.sin from the ftf package of the kernel I downloaded, used flashtool to in turn extract kernel.sin which produced kernel.elf. I tried two things:
1) Unpack kernel.elf (flashtool elf extractor) and then pack em into a boot.img file (Failed as I couldn't pack em because I didn;t know how to use mkbootimg)
2) Rename kernel.elf to boot.img. as suggested by a developer of CM11 for Xperia E (Worked and was also accepted by mkvendor.sh)
I used mkvendor and it said that i don't have unpackbootimg binaries. I tried to make them by using:
make -j4 out/host/linux-x86/bin/unpackbootimg
Sadly I didn't know how to proceed so I got the binary from here and copied it to /usr/bin/ and made executable using:
sudo chmod a+x /usr/bin/unpackbootimg
Rebooted and it worked but you will see below that it isn't fixed 100% but it just works. I moved on and decided to use the script again on the renamed kernel.elf file(i.e. boot.img)
This is the following error I encounter while using mkvendor:
[email protected]:~/tools/FlashTool$ cd ~/source/cm/branch/cm-10.2
[email protected]:~/source/cm/branch/cm-10.2$ ./build/tools/device/mkvendor.sh sony nanhu ~/Desktop/boot.img
Arguments: sony nanhu /home/carbogen-chemist/Desktop/boot.img
Output will be in /home/carbogen-chemist/source/cm/branch/cm-10.2/device/sony/nanhu
*** Error in `unpackbootimg': free(): invalid next size (fast): 0x09793170 ***
./build/tools/device/mkvendor.sh: line 84: 3943 Aborted (core dumped) unpackbootimg -i $BOOTIMAGEFILE > /dev/null
gzip: ../boot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
cp: cannot stat ‘/tmp/carbogen-chemist/bootimg/boot.img-zImage’: No such file or directory
Creating initial git repository.
~/source/cm/branch/cm-10.2/device/sony/nanhu ~/source/cm/branch/cm-10.2
Initialized empty Git repository in /home/carbogen-chemist/source/cm/branch/cm-10.2/device/sony/nanhu/.git/
[master (root-commit) d49b660] mkvendor.sh: Initial commit of nanhu
7 files changed, 95 insertions(+)
create mode 100644 AndroidBoard.mk
create mode 100644 AndroidProducts.mk
create mode 100644 BoardConfig.mk
create mode 100644 cm.mk
create mode 100644 device_nanhu.mk
create mode 100644 recovery.fstab
create mode 100644 system.prop
~/source/cm/branch/cm-10.2
Done!
Use the following command to set up your build environment:
lunch cm_nanhu-eng
And use the follwowing command to build a recovery:
. build/tools/device/makerecoveries.sh cm_nanhu-eng
Since the script seems to look up for boot.img-ramdisk.gz and boot.img-zImage, I decided to investigate a bit further. I renamed boot.img to kernel.elf and used flashtool elf extractor to unzip kernel.elf. I obtained four files as a result of the extraction:
1) kernel.elf.bootcmd
2) kernel.elf.cert
3) kernel.elf.Image
4) kernel.elf.ramdisk.gz
Since mkvendor needed boot.img-ramdisk.gz and boot.img-zImage, I renamed all the files:
1) kernel.elf.bootcmd >> kernel.img-bootcmd
2) kernel.elf.cert >> kernel.img-cert
3) kernel.elf.Image >> kernel.img-zImage
4) kernel.elf.ramdisk.gz >> kernel.img-ramdisk.gz
Now I repackaged them using mkelf.py script. Since I couldn't find any command specific to nanhu, I edited it to fit for the device:
python mkelf.py -o edited.elf [email protected] [email protected],ramdisk [email protected],cmdline
This command throws no error and produces edited.elf. All of the files are packed in except kernel.img-cert as I didn't know the arguments for it ([email protected]?x????????,cert). I rename the edited.elf to boot2.img.
But I get the same error as the one I get when I use the unedited kernel (boot.img)
What should I do to get out of this format abyss? Would I have better luck with mkbootimg? If so, could you point me out to a thread or tell me here itself how to use it?
Thank you all!
TheUltimateNoobist said:
I used mkvendor and it said that i don't have unpackbootimg binaries. I tried to make them by using:
make -j4 out/host/linux-x86/bin/unpackbootimg
Sadly I didn't know how to proceed so I got the binary from here and copied it to /usr/bin/ and made executable using:
sudo chmod a+x /usr/bin/unpackbootimg
Rebooted and it worked but you will see below that it isn't fixed 100% but it just works. I moved on and decided to use the script again on the renamed kernel.elf file(i.e. boot.img)
Click to expand...
Click to collapse
Fixed it myself. How did I miss that note at cyanogenmod porting?
Cd'ed to my working directory. Ran :
sudo make -j4 otatools
and grabbed unpackbootimg from WORKING_DIR/out/host/linux-x86/bin/unpackbootimg and pasted to /usr/bin
Made it executable by running:
sudo chmod a+x /usr/bin/unpackbootimg
Reboot!
It would also be very helpful if anyone could point out what the correct config for Xperia E is. (For EG >> blue_mint_defconfig is for Xperia T, semc_zeus_defconfig is for Xperia Play)
There is a file called README_Xperia, which contains the configuration names for the different phones in the kernel source can be used for. But my source doesn't contain it. So I would be very grateful if someone pointed it out!
Thank you!
TheUltimateNoobist said:
I'm tired of asking the same question again and again but for the thousandth and the last time I'll try my best to explain y'all the jeopardy I'm in.
I'm trying to build cm-10.2 from source for Sony Xperia E (nanhu) and everything started off just fine until I had to generate the skeleton files. I decided to use the mkvendor.sh to generate em. I have no clue why, but Sony seems to be in love with .elf files. And the best part, mkvendor only works with a standard boot.img file. Since I found mkvendor.sh the only convincing option, I decided to not use the other 2 options given here.
I extracted the kernel.sin from the ftf package of the kernel I downloaded, used flashtool to in turn extract kernel.sin which produced kernel.elf. I tried two things:
1) Unpack kernel.elf (flashtool elf extractor) and then pack em into a boot.img file (Failed as I couldn't pack em because I didn;t know how to use mkbootimg)
2) Rename kernel.elf to boot.img. as suggested by a developer of CM11 for Xperia E (Worked and was also accepted by mkvendor.sh)
I used mkvendor and it said that i don't have unpackbootimg binaries. I tried to make them by using:
make -j4 out/host/linux-x86/bin/unpackbootimg
Sadly I didn't know how to proceed so I got the binary from here and copied it to /usr/bin/ and made executable using:
sudo chmod a+x /usr/bin/unpackbootimg
Rebooted and it worked but you will see below that it isn't fixed 100% but it just works. I moved on and decided to use the script again on the renamed kernel.elf file(i.e. boot.img)
This is the following error I encounter while using mkvendor:
[email protected]:~/tools/FlashTool$ cd ~/source/cm/branch/cm-10.2
[email protected]:~/source/cm/branch/cm-10.2$ ./build/tools/device/mkvendor.sh sony nanhu ~/Desktop/boot.img
Arguments: sony nanhu /home/carbogen-chemist/Desktop/boot.img
Output will be in /home/carbogen-chemist/source/cm/branch/cm-10.2/device/sony/nanhu
*** Error in `unpackbootimg': free(): invalid next size (fast): 0x09793170 ***
./build/tools/device/mkvendor.sh: line 84: 3943 Aborted (core dumped) unpackbootimg -i $BOOTIMAGEFILE > /dev/null
gzip: ../boot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
cp: cannot stat ‘/tmp/carbogen-chemist/bootimg/boot.img-zImage’: No such file or directory
Creating initial git repository.
~/source/cm/branch/cm-10.2/device/sony/nanhu ~/source/cm/branch/cm-10.2
Initialized empty Git repository in /home/carbogen-chemist/source/cm/branch/cm-10.2/device/sony/nanhu/.git/
[master (root-commit) d49b660] mkvendor.sh: Initial commit of nanhu
7 files changed, 95 insertions(+)
create mode 100644 AndroidBoard.mk
create mode 100644 AndroidProducts.mk
create mode 100644 BoardConfig.mk
create mode 100644 cm.mk
create mode 100644 device_nanhu.mk
create mode 100644 recovery.fstab
create mode 100644 system.prop
~/source/cm/branch/cm-10.2
Done!
Use the following command to set up your build environment:
lunch cm_nanhu-eng
And use the follwowing command to build a recovery:
. build/tools/device/makerecoveries.sh cm_nanhu-eng
Since the script seems to look up for boot.img-ramdisk.gz and boot.img-zImage, I decided to investigate a bit further. I renamed boot.img to kernel.elf and used flashtool elf extractor to unzip kernel.elf. I obtained four files as a result of the extraction:
1) kernel.elf.bootcmd
2) kernel.elf.cert
3) kernel.elf.Image
4) kernel.elf.ramdisk.gz
Since mkvendor needed boot.img-ramdisk.gz and boot.img-zImage, I renamed all the files:
1) kernel.elf.bootcmd >> kernel.img-bootcmd
2) kernel.elf.cert >> kernel.img-cert
3) kernel.elf.Image >> kernel.img-zImage
4) kernel.elf.ramdisk.gz >> kernel.img-ramdisk.gz
Now I repackaged them using mkelf.py script. Since I couldn't find any command specific to nanhu, I edited it to fit for the device:
python mkelf.py -o edited.elf [email protected] [email protected],ramdisk [email protected],cmdline
This command throws no error and produces edited.elf. All of the files are packed in except kernel.img-cert as I didn't know the arguments for it ([email protected]?x????????,cert). I rename the edited.elf to boot2.img.
But I get the same error as the one I get when I use the unedited kernel (boot.img)
What should I do to get out of this format abyss? Would I have better luck with mkbootimg? If so, could you point me out to a thread or tell me here itself how to use it?
Thank you all!
Click to expand...
Click to collapse
Nevermind :/ Fixed it myself.
Repacked the edited files using mkbootimg.
mkbootimg --kernel kernel.img-zImage --ramdisk kernel.img-ramdisk.gz --cmdline kernel.img-bootcmd -o boot.img

[GUIDE] Build Cyanogenmod from Source

Hi,
I have decided to write this post after reading so many different guides on my journey to build my own version of Cyanogenmod and after countless tries and hours of research I succeeded. Here's how:
You will need:
A Ubuntu box
A basic knowledge of Linux
A fast internet connection or a lot of patience.
Once you have setup your Ubuntu box either in a Virtual Machine of as a stand alone PC you will need to open a terminal, this can be done by pressing 'CTRL + ALT + T' or opening the search menu and typing "Terminal".
You should see the following:
Code:
[email protected]:~$
We will need to install all the necessary files in order to build and download Cyanogenmod, we can do this by running the following command:
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev openjdk-7-jdk openjdk-7-jre
As many Linux users have more than one version of Java installed we will need to set the the version we just installed as our default version.
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
If by any chance you have a 64-bit version of Ubuntu installed we will require some extra files, if not please skip this command.
Code:
sudo apt-get install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
We will now for simplicity's sake need to create the following directories in your home folder. These directories will host our build.
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
Once you have setup everything correctly we will now to download the Cyanogenmod source code of which we are going to use the 'Repo' utility. This utility is an automated tool for GitHub cloning. We can download this and set the correct permissions by running the following commands.
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
To continue with download the source code we will now initialize the GitHub repository that holds Cyanogenmod. We are going to need to specify the repository with -u and the branch with -b. Here I am going to download the latest available version of Cyanagenmod 13.0.
Code:
cd ~/android/system/
~/bin/repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
And to finally start downloading the source:
Code:
~/bin/repo sync -c -f -j8
Where:
-c Download the current version instead of all history.
-F Forces the connection to continue even if a connection error occurs.
-j8 This specifies the number of parallel operations. Use -j8 for a quad core processor and a -j16 for an octa-core.
Once the download completes successfully we will need to download the device specific code, this includes specific applications and kernel configurations for your device. To start downloading the files type:
Code:
source build/envsetup.sh
breakfast angler
The download should now start, it should only take minutes however this depends on your internet connection.
Again once this completes, we need to grab proprietary specific files. We first need to navigate to ~/android/system/device/huawei/angler. You can do this by running the following command:
Code:
cd ~/android/system/device/huawei/angler
As the script we are going to use has some dependencies we will need to get them first.
Code:
git clone https://github.com/JesusFreke/smali
cd smali
./gradlew build
cd ..
Additionally we need to download a Google Stock Image, I'm using angler-mmb29m-factory-8c31db3f.tgz, once downloaded you will need to unzip it and cd to it within the terminal.
and then download:
Code:
wget http://people.canonical.com/~mfisch/tools/ext4_utils.tar.gz
tar xzsf ext4_utils.tar.gz
cd ext4_utils
mv simg2img ../angler-mmb29m/
cd ../angler-mmb29m/
We will now convert the system and vendor img's using simg2img to a readable format and mount them so we extract the propriety files using ./extract_files.sh
We can do all of this by using the following commands.
Code:
./simg2img system.img system.ext4
./simg2img vendor.img vendor.ext4
sudo mkdir -p /mnt/system
sudo mkdir -p /mnt/vendor
sudo mount -rw system.ext4 /mnt/system
sudo mount -rw vendor.ext4 /mnt/vendor
Finally we can extract the proprietary files for the system image by running the following commands.
Code:
cd ~/android/system/device/huawei/angler/
./extract_files /mnt/ smali/
Finally we can finish off by our by running the brunch command to build and generate the .zip file of our own Cyanogenmod.
Code:
brunch angler
Note: This will take 20 mins - 2 hours - 2 days depending on your hardware spec.
And well that's it, the location of your generated .zip file should be in blue at the end of your terminal.
Reserved
N/A
This is amazing. Many thanks.
Great I've been looking
Sent from my XT1526 using XDA Forums Pro.
If there are bugs how can we fix that .Such as camera ,ril.For nexus 6p it is fine but for other phones
AANISH said:
If there are bugs how can we fix that .Such as camera ,ril.For nexus 6p it is fine but for other phones
Click to expand...
Click to collapse
As I have only just started my journey on this long path I have done a bit of research for you. Google released there own device specific binaries for the Nexus devices of which usually include the following:
NFC, Bluetooth and Wi-Fi
Media, Audio, Thermal, Touch Screen, Sensors
GPS, Camera, Gestures, Graphics, DRM, Video
This to me suggests that the chipset suppliers supply them - Broadcom, Qualcomm... or even other companies like Motorola. So if you are looking for binaries for other devices I would start with there chipset.
If you would like to look at Google's binaries following the link below however before you go looking for the 6P binaries they haven't been uploaded yet + if you do find any further information please reply to this comment or PM me.
Just saying, the official guide on the wiki works just fine. Been building for all my CM12-capable devices since 2015. Good for people who don't go there, though.
Sent from Google Nexus 6P @ CM13
[WARNING: XDA One have not implemented "mark forum as read" - do not use]
AndyYan said:
Just saying, the official guide on the wiki works just fine. Been building for all my CM12-capable devices since 2015. Good for people who don't go there, though.
Sent from Google Nexus 6P @ CM13
[WARNING: XDA One have not implemented "mark forum as read" - do not use]
Click to expand...
Click to collapse
That is true but I had major difficulties with it, for example it asks you to initialise the cm 12.1 branch when it wasn't available and I had a major pain with extract_files as it wouldnt use adb but instead had to use stock firmware to grab the proprietary files.
connectionalive said:
That is true but I had major difficulties with it, for example it asks you to initialise the cm 12.1 branch when it wasn't available and I had a major pain with extract_files as it wouldnt use adb but instead had to use stock firmware to grab the proprietary files.
Click to expand...
Click to collapse
You still have to spot the tiny mistakes in the guide, of course. The guide hasn't been updated in a long time.
I didn't grab any proprietary files for any of my devices and the builds still run fine - the files should already be in the repo.
Sent from Google Nexus 6P @ CM13
[WARNING: XDA One have not implemented "mark forum as read" - do not use]
AndyYan said:
You still have to spot the tiny mistakes in the guide, of course. The guide hasn't been updated in a long time.
I didn't grab any proprietary files for any of my devices and the builds still run fine - the files should already be in the repo.
Sent from Google Nexus 6P @ CM13
[WARNING: XDA One have not implemented "mark forum as read" - do not use]
Click to expand...
Click to collapse
Ah I didn't know this, I have only just started learning and researching all of this so all helps, if you could point me in the right direction, it would be greatly appreciated.
connectionalive said:
Ah I didn't know this, I have only just started learning and researching all of this so all helps, if you could point me in the right direction, it would be greatly appreciated.
Click to expand...
Click to collapse
I'm also just at the beginning - building according to official guides without modifying the source. Just giving some tips so that you don't step on the same mines as I did
P.S. Transition from CM12.1 to CM13 was a real PITA...
Sent from Google Nexus 6P @ CM13
[WARNING: XDA One have not implemented "mark forum as read" - do not use]
Great guide, I have a build environment setup on Linux Mint, but I am curious to know if the simg2img stuff and extraction is necessary, I thought the initial build process took care of that??
adzcache said:
Great guide, I have a build environment setup on Linux Mint, but I am curious to know if the simg2img stuff and extraction is necessary, I thought the initial build process took care of that??
Click to expand...
Click to collapse
It's not, it's a lot easier to just use the Muppets and not worry about it.
akellar said:
It's not, it's a lot easier to just use the Muppets and not worry about it.
Click to expand...
Click to collapse
I suppose I should start learning how to building up a roomservice.xml for this 6P then. Thanks for the confirmation.
akellar said:
It's not, it's a lot easier to just use the Muppets and not worry about it.
Click to expand...
Click to collapse
I couldn't find it on their repository under Google or Huawei
connectionalive said:
I couldn't find it on their repository under Google or Huawei
Click to expand...
Click to collapse
Look under the right branch
Code:
./simg2img system.img system.ext4
./simg2img vendor.img vendor.ext4
sudo mkdir -p /mnt/system
sudo mkdir -p /mnt/vendor
sudo mount -rw system.ext4 /mnt/system
sudo mount -rw vendor.ext4 /mnt/vendor
Code:
cd ~/android/system/device/huawei/angler/
./extract_files /mnt/ smali/
You have to take ownership of the mounted images before you can extract the blobs. Otherwise you have to use sudo for extract. Then the folder is root and make is denied permission while compiling.
XxMORPHEOUSxX said:
Code:
./simg2img system.img system.ext4
./simg2img vendor.img vendor.ext4
sudo mkdir -p /mnt/system
sudo mkdir -p /mnt/vendor
sudo mount -rw system.ext4 /mnt/system
sudo mount -rw vendor.ext4 /mnt/vendor
Code:
cd ~/android/system/device/huawei/angler/
./extract_files /mnt/ smali/
You have to take ownership of the mounted images before you can extract the blobs. Otherwise you have to use sudo for extract. Then the folder is root and make is denied permission while compiling.
Click to expand...
Click to collapse
I had no issues when actioning any of these commands but in theory you are correct.
connectionalive said:
I had no issues when actioning any of these commands but in theory you are correct.
Click to expand...
Click to collapse
I ran into issues. That's why I mentioned it. Also the extract-files tool is formatted different in my tree. After mounting these were are my exact commands. Maybe it will help someone else.
Code:
sudo chown -hR <user> /mnt/system
sudo chown -hR <user> /mnt/vendor
cd ~/android/system/device/huawei/angler
./extract-files.sh /mnt/ smali/
Hola
I have gone through this guide (really well put together) but I am getting an error almost at the very end and I need some guidance please:
I invoke brunch angler command but it shows:
~/android/system/device/huawei/angler$ brunch angler
bash: build/tools/roomservice.py: No such file or directory
** Don't have a product spec for: 'cm_angler'
** Do you have the right repo manifest?
No such item in brunch menu. Try 'breakfast'
I tried the lunch and breakfast commands but it comes up with the same error.
I did run both:
source build/envsetup.sh
breakfast angler
from the right directory and no errors came up. Can anyone assist me? Thanks.

[GUIDE] How to compile a custom kernel for OnePlus 2

Hi all...
Happy Holidays
I have been looking around haven't found a tutorial on compiling kernel for oneplus2, so i decided on making one for those who are new to compiling kernel from source.
This tutorial will be divided into 3 parts...
>Preparing the build environment... (Ubuntu 16.04 LTS).
>Downloading source code, Toolchain and compiling.
>Testing
######################################################################
Preparing the build environment
Preparing the build environment is easy. If u haven't install Ubuntu yet, check out how to dual-boot alongside windows from here.
If u are looking for something easier like running it from a virtual machine check out this.
Right now i have Ubuntu 16.04 LTS installed which i will be using.
Once u have booted into Ubuntu, it's time to head to the terminal.
Lunch the terminal by right clicking on desktop an select "open terminal"
Once in terminal type in these commands individually (note: some commands will prompt u to type y and enter):
Code:
sudo apt-get install synaptic
Code:
sudo apt-get install libncurses5-dev
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 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Code:
sudo apt-get install -y ccache &&echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc &&source ~/.bashrc && echo $PATH
Code:
export USE_CCACHE=1
Installing repo...
Code:
mkdir ~/bin
Code:
export PATH=~/bin:$PATH
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Installing Java...
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt update; sudo apt install oracle-java8-installer
Code:
sudo apt install oracle-java8-set-default
Run this command to check if Java is installed correctly:
Code:
javac -version
If it says something like this (javac 1.8.0_111) then u are good to go.
That's it for preparing the build environment. Easy... right.:highfive:
######################################################################
Downloading source code, Toolchain and compiling
Now it's time to download the source, u will be creating a folder to download the source in so type to commands below,
Code:
mkdir oneplus2-kernel
Code:
cd oneplus2-kernel
(The folder can be found in the home directory)
If u are building for cm, download the kernel source using command below...
Code:
git clone https://github.com/CyanogenMod/android_kernel_oneplus_msm8994.git
If u are building for other rom use this one...
Code:
git clone https://github.com/OnePlusOSS/android_kernel_oneplus_msm8994.git
Once download is completed, u need to download the toolchain which is the tool used in compiling the kernel.
It can be downloaded from here.
When download completed, move the zip file to the oneplus2-kernel folder u made earlier and then right click and select extract here.
U can now delete the zip file when extracted. So now u would have 2 folders to in ur oneplus2-kernel folder. One is the kernel and the other is the toolchain.
Time to compile the kernel... But first u need to point the variable to toolchains path. To do this, u need to go to the kernel source, folder(which is called android_kernel_oneplus_msm8994 in the oneplus2-kernel folder) right click and open in terminal, then run the command
Code:
export CROSS_COMPILE=/home/[B]"UR_USERNAME"[/B]/oneplus2-kernel/aarch64-linux-android-4.9-uber-master/bin/aarch64-linux-android-
(NOTE:Replace "UR_USERNAME" with the name u used when installing ubuntu)
Now run the commands below in the same terminal:
Code:
export ARCH=arm64
Code:
export SUBARCH=arm64
Code:
export USE_CCACHE=1
U will need to locate the defconfig file. If u are compiling for cm, the file name will be "cm_oneplus2_defconfig", and for the other source, name will be "msm8994-OnePlus2_defconfig". It is located in /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/configs/...
(Note: The defconfig file may vary for different roms ur building for so pay attention to that.)
So if u are compiling for cm, run the command:
Code:
make cm_oneplus2_defconfig
to add it to the config file. Change name of defconfig file accordingly as said above.
Now it's time to give ur kernel a name so run the command:
Code:
make menuconfig
This will look like when u boot into the BIOS, so use the arrow keys to navigate. This menu allows the u to choose the features of the kernel (and other options) that will be compiled. To add the name, go to "General setup" then "(-perf) Local version - append to kernel release", then type in the name for ur custom kernel and save/exit.
Finally type this command to compile...
Code:
make -j2
(Replace -j2 with the number of cpu cores)
IF (make -j2) gives errors try:
Code:
make
This will take A WHILE, so let it do it's ting.
If it compiled without errors, u will find the kernel file named "Image.gz-dtb" located in /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/boot/...
:good:SUCCESS:good::victory:
If FAILED:crying: , u can post a screen-shot of ur error below and i will try an help u out.
######################################################################
Testing
Time to test ur newly built kernel, since everything went smoothly and u cant wait to boot it up.
Well download this flashable zip from here.
Open the zip file using Archive Manager without extracting.
Delete the file named "Image.gz-dtb" and replace with ur kernel located at /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/boot/Image.gz-dtb.
That's it...Just copy the zip to ur device and flash away...
As i said early... any problem u are having with compiling, just post a screen-shot of ur error below and i will try an help u.
:good:REMEMBER TO HIT THANKS/LIKE:good:
reserved
So I've decided to give this a try today. Run into a slight problem though.
1. When I execute make msm8994-OnePlus2_defconfig I receive an error 'make: Nothing to be done for msm8994-OnePlus2_defconfig'. This file did already exist under the folder structure.
2. When I execute make menuconfig I receive an error 'No rule to make target menuconfig. Stop'.
Any ideas to what I am doing wrong?
Thanks in advance.
Woodzrul said:
So I've decided to give this a try today. Run into a slight problem though.
1. When I execute make msm8994-OnePlus2_defconfig I receive an error 'make: Nothing to be done for msm8994-OnePlus2_defconfig'. This file did already exist under the folder structure.
2. When I execute make menuconfig I receive an error 'No rule to make target menuconfig. Stop'.
Any ideas to what I am doing wrong?
Thanks in advance.
Click to expand...
Click to collapse
It been a while but I'll try to help ima assume you building the latest lineage kernel right? If so use
make oneplus2_defconfig
Then
make -j4
The menu config is to name the kernel if you want to it appears after the Linux version default is often perf+, but not required
example: 3.10.93 perf+
Appreciate the prompt response. I shall give this ago. Have clicked the Thanks! button.
Brandon Indar said:
reserved
Click to expand...
Click to collapse
Sir I'm trying to compile from boeffla kernel sources But I'm just stuck here...i also tried "make cm_oneplus2_defconfig" but no use I followed all the below steps also installed java and I'm on Ubuntu 17.04 (dualboot)..
Any help would be appreciated
Prathamesh Kapure said:
Sir I'm trying to compile from boeffla kernel sources But I'm just stuck here...i also tried "make cm_oneplus2_defconfig" but no use I followed all the below steps also installed java and I'm on Ubuntu 17.04 (dualboot)..
Any help would be appreciated
Click to expand...
Click to collapse
Hi...
What error exactly u are getting when u running the command:
"make cm_oneplus2_defconfig"
Sent from my ONE A2005 using Tapatalk
Brandon Indar said:
Hi...
What error exactly u are getting when u running the command:
"make cm_oneplus2_defconfig"
Click to expand...
Click to collapse
The error wguch i get always is "make: *** No rule to make target 'cm_oneplus2_defconfig'. Stop"
Edit:the error can be seen in the attachment
---------- Post added at 04:17 AM ---------- Previous post was at 04:11 AM ----------
Prathamesh Kapure said:
The error wguch i get always is "make: *** No rule to make target 'cm_oneplus2_defconfig'. Stop"
Edit:the error can be seen in the attachment
Click to expand...
Click to collapse
Edit 2:At first one of my developer frnd said try "make boeffla_defconfig" it didn't work thwn he said try "make cm_oneplus2_defconfig" this also didn't work so i thought i might post it here and get some help..
Prathamesh Kapure said:
The error wguch i get always is "make: *** No rule to make target 'cm_oneplus2_defconfig'. Stop"
Edit:the error can be seen in the attachment
---------- Post added at 04:17 AM ---------- Previous post was at 04:11 AM ----------
Edit 2:At first one of my developer frnd said try "make boeffla_defconfig" it didn't work thwn he said try "make cm_oneplus2_defconfig" this also didn't work so i thought i might post it here and get some help..
Click to expand...
Click to collapse
Look at the arch/boot/arm64/configuration inside the kernel source and the files in there will give you an idea what you can build the usually one is oneplus2_defconfig sometimes developers will make another Defconfig and you'll find it there. typically for LineageOS oneplus2_defconfig is the one used.
After looking at boeffla source cm Defconfig is old and prob will break something, "make boeffla_defconfig" should work and make sure your inside the kernel source as you do the make Defconfig command
Dr_DjEnder said:
Look at the arch/boot/arm64/configuration inside the kernel source and the files in there will give you an idea what you can build the usually one is oneplus2_defconfig sometimes developers will make another Defconfig and you'll find it there. typically for LineageOS oneplus2_defconfig is the one used.
After looking at boeffla source cm Defconfig is old and prob will break something, "make boeffla_defconfig" should work and make sure your inside the kernel source as you do the make Defconfig command
Click to expand...
Click to collapse
Ok Thank you sir.. I'll try and report
Offtopic: Do u know any of our whatsapp and telegram group? If so can u plz add me
Dr_DjEnder said:
Look at the arch/boot/arm64/configuration inside the kernel source and the files in there will give you an idea what you can build the usually one is oneplus2_defconfig sometimes developers will make another Defconfig and you'll find it there. typically for LineageOS oneplus2_defconfig is the one used.
After looking at boeffla source cm Defconfig is old and prob will break something, "make boeffla_defconfig" should work and make sure your inside the kernel source as you do the make Defconfig command
Click to expand...
Click to collapse
Sir i tried but no use i get same error but i just noticed some bottom commands show a bit different error "make: Nothing to be done for 'oneplus_2' and also for 'make boeffla_defconfig'
Prathamesh Kapure said:
Sir i tried but no use i get same error but i just noticed some bottom commands show a bit different error "make: Nothing to be done for 'oneplus_2' and also for 'make boeffla_defconfig'
Click to expand...
Click to collapse
Have u set up the cross compiler and run the commands in the root of the kernel source folder before using make command. If so, run command: "make menuconfig".
If that fails that means the cross compiler isn't set up right.
Sent from my ONE A2005 using Tapatalk
Brandon Indar said:
Have u set up the cross compiler and run the commands in the root of the kernel source folder before using make command. If so, run command: "make menuconfig".
If that fails that means the cross compiler isn't set up right.
Click to expand...
Click to collapse
Yaa sir it already setup cross compiler... Then after i downloaded los sources and tried with them and the kernel got compiled successfully...
Thank You for the wonderful and simple guide :good:
first of all thanks for guide
i tried to give it a try(using lineage os 14.1) and went through exact steps and when i gave command make or make - j2 then i am getting this error
Code:
Makefile:805: *** multiple target patterns. Stop.
And This is In Makefile
Code:
# Include targets which we want to
# execute if the rest of the kernel build went well.
line 805 >> vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
ifdef CONFIG_SAMPLES
$(Q)$(MAKE) $(build)=samples
endif
ifdef CONFIG_BUILD_DOCSRC
$(Q)$(MAKE) $(build)=Documentation
endif
+$(call if_changed,link-vmlinux)
Hope you will help me
Vaas_FC said:
first of all thanks for guide
i tried to give it a try(using lineage os 14.1) and went through exact steps and when i gave command make or make - j2 then i am getting this error
Code:
Makefile:805: *** multiple target patterns. Stop.
And This is In Makefile
Code:
# Include targets which we want to
# execute if the rest of the kernel build went well.
line 805 >> vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
ifdef CONFIG_SAMPLES
$(Q)$(MAKE) $(build)=samples
endif
ifdef CONFIG_BUILD_DOCSRC
$(Q)$(MAKE) $(build)=Documentation
endif
+$(call if_changed,link-vmlinux)
Hope you will help me
Click to expand...
Click to collapse
What it shows before that error.
If u run; make menuconfig and u get same error, check back the command used to configure the toolchain and make sure the path to the folder is set right.
Sent from my ONE A2005 using Tapatalk
deleted
deleted
I flashed my kernel and it boots in fastboot mode ??
used "make -j2" but got error see in pic
Brandon Indar said:
Hi all...
Happy Holidays
I have been looking around haven't found a tutorial on compiling kernel for oneplus2, so i decided on making one for those who are new to compiling kernel from source.
This tutorial will be divided into 3 parts...
>Preparing the build environment... (Ubuntu 16.04 LTS).
>Downloading source code, Toolchain and compiling.
>Testing
######################################################################
Preparing the build environment
Preparing the build environment is easy. If u haven't install Ubuntu yet, check out how to dual-boot alongside windows from here.
If u are looking for something easier like running it from a virtual machine check out this.
Right now i have Ubuntu 16.04 LTS installed which i will be using.
Once u have booted into Ubuntu, it's time to head to the terminal.
Lunch the terminal by right clicking on desktop an select "open terminal"
Once in terminal type in these commands individually (note: some commands will prompt u to type y and enter):
Code:
sudo apt-get install synaptic
Code:
sudo apt-get install libncurses5-dev
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 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Code:
sudo apt-get install -y ccache &&echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc &&source ~/.bashrc && echo $PATH
Code:
export USE_CCACHE=1
Installing repo...
Code:
mkdir ~/bin
Code:
export PATH=~/bin:$PATH
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Installing Java...
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt update; sudo apt install oracle-java8-installer
Code:
sudo apt install oracle-java8-set-default
Run this command to check if Java is installed correctly:
Code:
javac -version
If it says something like this (javac 1.8.0_111) then u are good to go.
That's it for preparing the build environment. Easy... right.:highfive:
######################################################################
Downloading source code, Toolchain and compiling
Now it's time to download the source, u will be creating a folder to download the source in so type to commands below,
Code:
mkdir oneplus2-kernel
Code:
cd oneplus2-kernel
(The folder can be found in the home directory)
If u are building for cm, download the kernel source using command below...
Code:
git clone https://github.com/CyanogenMod/android_kernel_oneplus_msm8994.git
If u are building for other rom use this one...
Code:
git clone https://github.com/OnePlusOSS/android_kernel_oneplus_msm8994.git
Once download is completed, u need to download the toolchain which is the tool used in compiling the kernel.
It can be downloaded from here.
When download completed, move the zip file to the oneplus2-kernel folder u made earlier and then right click and select extract here.
U can now delete the zip file when extracted. So now u would have 2 folders to in ur oneplus2-kernel folder. One is the kernel and the other is the toolchain.
Time to compile the kernel... But first u need to point the variable to toolchains path. To do this, u need to go to the kernel source, folder(which is called android_kernel_oneplus_msm8994 in the oneplus2-kernel folder) right click and open in terminal, then run the command
Code:
export CROSS_COMPILE=/home/[B]"UR_USERNAME"[/B]/oneplus2-kernel/aarch64-linux-android-4.9-uber-master/bin/aarch64-linux-android-
(NOTE:Replace "UR_USERNAME" with the name u used when installing ubuntu)
Now run the commands below in the same terminal:
Code:
export ARCH=arm64
Code:
export SUBARCH=arm64
Code:
export USE_CCACHE=1
U will need to locate the defconfig file. If u are compiling for cm, the file name will be "cm_oneplus2_defconfig", and for the other source, name will be "msm8994-OnePlus2_defconfig". It is located in /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/configs/...
(Note: The defconfig file may vary for different roms ur building for so pay attention to that.)
So if u are compiling for cm, run the command:
Code:
make cm_oneplus2_defconfig
to add it to the config file. Change name of defconfig file accordingly as said above.
Now it's time to give ur kernel a name so run the command:
Code:
make menuconfig
This will look like when u boot into the BIOS, so use the arrow keys to navigate. This menu allows the u to choose the features of the kernel (and other options) that will be compiled. To add the name, go to "General setup" then "(-perf) Local version - append to kernel release", then type in the name for ur custom kernel and save/exit.
Finally type this command to compile...
Code:
make -j2
(Replace -j2 with the number of cpu cores)
IF (make -j2) gives errors try:
Code:
make
This will take A WHILE, so let it do it's ting.
If it compiled without errors, u will find the kernel file named "Image.gz-dtb" located in /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/boot/...
:good:SUCCESS:good::victory:
If FAILED:crying: , u can post a screen-shot of ur error below and i will try an help u out.
######################################################################
Testing
Time to test ur newly built kernel, since everything went smoothly and u cant wait to boot it up.
Well download this flashable zip from here.
Open the zip file using Archive Manager without extracting.
Delete the file named "Image.gz-dtb" and replace with ur kernel located at /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/boot/Image.gz-dtb.
That's it...Just copy the zip to ur device and flash away...
As i said early... any problem u are having with compiling, just post a screen-shot of ur error below and i will try an help u.
:good:REMEMBER TO HIT THANKS/LIKE:good:
Click to expand...
Click to collapse
I've created kernel/oneplus2 folder, git cloned in this folder and then extracted the aarch64 zip file and follow all instructions. Used "make -j2" but got error. Please see in pic. I'm trying "make", if it is going right, then ill hit thanks and reply. Thanks
also got error in "make"
Brandon Indar said:
Hi all...
Happy Holidays
I have been looking around haven't found a tutorial on compiling kernel for oneplus2, so i decided on making one for those who are new to compiling kernel from source.
This tutorial will be divided into 3 parts...
>Preparing the build environment... (Ubuntu 16.04 LTS).
>Downloading source code, Toolchain and compiling.
>Testing
######################################################################
Preparing the build environment
Preparing the build environment is easy. If u haven't install Ubuntu yet, check out how to dual-boot alongside windows from here.
If u are looking for something easier like running it from a virtual machine check out this.
Right now i have Ubuntu 16.04 LTS installed which i will be using.
Once u have booted into Ubuntu, it's time to head to the terminal.
Lunch the terminal by right clicking on desktop an select "open terminal"
Once in terminal type in these commands individually (note: some commands will prompt u to type y and enter):
Code:
sudo apt-get install synaptic
Code:
sudo apt-get install libncurses5-dev
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 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Code:
sudo apt-get install -y ccache &&echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc &&source ~/.bashrc && echo $PATH
Code:
export USE_CCACHE=1
Installing repo...
Code:
mkdir ~/bin
Code:
export PATH=~/bin:$PATH
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Installing Java...
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt update; sudo apt install oracle-java8-installer
Code:
sudo apt install oracle-java8-set-default
Run this command to check if Java is installed correctly:
Code:
javac -version
If it says something like this (javac 1.8.0_111) then u are good to go.
That's it for preparing the build environment. Easy... right.:highfive:
######################################################################
Downloading source code, Toolchain and compiling
Now it's time to download the source, u will be creating a folder to download the source in so type to commands below,
Code:
mkdir oneplus2-kernel
Code:
cd oneplus2-kernel
(The folder can be found in the home directory)
If u are building for cm, download the kernel source using command below...
Code:
git clone https://github.com/CyanogenMod/android_kernel_oneplus_msm8994.git
If u are building for other rom use this one...
Code:
git clone https://github.com/OnePlusOSS/android_kernel_oneplus_msm8994.git
Once download is completed, u need to download the toolchain which is the tool used in compiling the kernel.
It can be downloaded from here.
When download completed, move the zip file to the oneplus2-kernel folder u made earlier and then right click and select extract here.
U can now delete the zip file when extracted. So now u would have 2 folders to in ur oneplus2-kernel folder. One is the kernel and the other is the toolchain.
Time to compile the kernel... But first u need to point the variable to toolchains path. To do this, u need to go to the kernel source, folder(which is called android_kernel_oneplus_msm8994 in the oneplus2-kernel folder) right click and open in terminal, then run the command
Code:
export CROSS_COMPILE=/home/[B]"UR_USERNAME"[/B]/oneplus2-kernel/aarch64-linux-android-4.9-uber-master/bin/aarch64-linux-android-
(NOTE:Replace "UR_USERNAME" with the name u used when installing ubuntu)
Now run the commands below in the same terminal:
Code:
export ARCH=arm64
Code:
export SUBARCH=arm64
Code:
export USE_CCACHE=1
U will need to locate the defconfig file. If u are compiling for cm, the file name will be "cm_oneplus2_defconfig", and for the other source, name will be "msm8994-OnePlus2_defconfig". It is located in /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/configs/...
(Note: The defconfig file may vary for different roms ur building for so pay attention to that.)
So if u are compiling for cm, run the command:
Code:
make cm_oneplus2_defconfig
to add it to the config file. Change name of defconfig file accordingly as said above.
Now it's time to give ur kernel a name so run the command:
Code:
make menuconfig
This will look like when u boot into the BIOS, so use the arrow keys to navigate. This menu allows the u to choose the features of the kernel (and other options) that will be compiled. To add the name, go to "General setup" then "(-perf) Local version - append to kernel release", then type in the name for ur custom kernel and save/exit.
Finally type this command to compile...
Code:
make -j2
(Replace -j2 with the number of cpu cores)
IF (make -j2) gives errors try:
Code:
make
This will take A WHILE, so let it do it's ting.
If it compiled without errors, u will find the kernel file named "Image.gz-dtb" located in /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/boot/...
:good:SUCCESS:good::victory:
If FAILED:crying: , u can post a screen-shot of ur error below and i will try an help u out.
######################################################################
Testing
Time to test ur newly built kernel, since everything went smoothly and u cant wait to boot it up.
Well download this flashable zip from here.
Open the zip file using Archive Manager without extracting.
Delete the file named "Image.gz-dtb" and replace with ur kernel located at /home/"UR_USERNAME"/oneplus2-kernel/android_kernel_oneplus_msm8994/arch/arm64/boot/Image.gz-dtb.
That's it...Just copy the zip to ur device and flash away...
As i said early... any problem u are having with compiling, just post a screen-shot of ur error below and i will try an help u.
:good:REMEMBER TO HIT THANKS/LIKE:good:
Click to expand...
Click to collapse
I've told that I've got error in "make -j2" and so i tried the "make" and got error again. Please see in this pic.

Categories

Resources