[TUTORIAL] Complete Galaxy Nexus Kernel Development - Samsung Galaxy Nexus

I know a lot of this has been posted before in other locations, but recently I have found some of that data to be incomplete when I was building a custom kernel for my GNex, so just bear with me.
--The Build Environment--
Operating System: Xubuntu 12.04 x86 (I haven't tested it on the x64 version yet)
Dependencies: (using sudo-apt get install)
Code:
git git-core gnupg flex bison gperf build-essential zip hexdump gedit \
curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 gcc \
libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \
mingw32 tofrodos
Other Files Needed:
unpack-mkbootimg - Which I have forked from work4blue@github.
You can grab the modified version from: https://github.com/ClimberTy/unpack-mkbootimg.git
The mkbootimg.c has been modified to fix the default load addresses of the kernel with the GNex (See below for more details).
Android SDK - You just need the Android Debug Bridge (ADB) from the SDK.
Or you can grab a toolkit from here: http://forum.xda-developers.com/showthread.php?t=1848036 for a script that will get you the files you need (Internet connection required).
Needed:
Samsung Galaxy Nexus Prime (I9250)
The GNex Bootloader to be Unlocked (http://www.android.gs/how-to-unlock-galaxy-nexus-bootloader/)
Kernel files (See Kernel Source area for locations)
ADB and Fastboot
ARM Cross Compiler - grab from here. NOTE: You'll need the ARM EABI Release. You can also get the ARM Cross Compiler by following the "Downloading a prebuilt gcc" instructions from Google as well.
Place either of these ARM Compilers in the folder you are using to build your KERNELSOURCE.
Linux USB Driver Rules:
Open Terminal and type:
Code:
$ vim /etc/udev/rules.d/70-android.rules
You can use gEdit if you prefer.
Paste in (Ensuring that <username> is the name of your Linux profile):
Code:
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
# adb protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
# fastboot protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
# adb protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
# fastboot protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
Kernel Source:
It is important that you make separate folders to put everything in. Keeping the DEV area organized will help out in the long run.
Code:
$ mkdir -p ~/Documents/Kernel/Source
CyanogenMod 10.1 Kernel from GitHub
Google's Android Kernel (See Downloading Android Kernel section below for more details)
Downloading the Android Kernel:
To download the kernel directly from Google enter in these commands.
Code:
$ git clone https://android.googlesource.com/kernel/omap.git
$ cd omap/
$ git branch -a
What you'll see in response:
Code:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/android-omap-3.0
remotes/origin/android-omap-panda-3.0
remotes/origin/android-omap-steelhead-3.0-ics-aah
remotes/origin/android-omap-tuna-3.0
remotes/origin/android-omap-tuna-3.0-ics-mr1
remotes/origin/android-omap-tuna-3.0-jb-mr0
remotes/origin/android-omap-tuna-3.0-jb-mr1
remotes/origin/android-omap-tuna-3.0-jb-mr1.1
remotes/origin/android-omap-tuna-3.0-jb-pre1
remotes/origin/android-omap-tuna-3.0-mr0
remotes/origin/android-omap-tuna-3.0-mr0.1
remotes/origin/linux-omap-3.0
remotes/origin/master
remotes/origin/sph-l700-fh05
To grab the (at this time) latest Jellybean source:
Code:
$ git checkout remotes/origin/android-omap-tuna-3.0-jb-mr1.1
Otherwise just use:
Code:
$ git clone https://github.com/CyanogenMod/android_kernel_samsung_tuna.git
--Building the Kernel--
In the ~/Documents/Kernel/KERNELSOURCE (varies depending on which kernel you downloaded. For this build I used android_kernel_samsung_tuna-jb as my source directory. The ARM Cross Compiler that I downloaded from the CodeSourcery site is located inside this folder.
In the terminal type:
Code:
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=/home/user/Documents/Kernel/KERNELSOURCE/arm-2011.03/bin/arm-none-eabi-
$ make tuna_defconfig
$ make
NOTE: The [...]/arm-none-eabi- is how it is supposed to be.
Now go grab some lunch or drink a beer or two, it could take about 30-45 mins to compile. You'll know when it is finished when you see:
Code:
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gzip
AS arch/arm/boot/compressed/piggy.gzip.o
CC arch/arm/boot/compressed/misc.o
CC arch/arm/boot/compressed/decompress.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS arch/arm/boot/compressed/lib1funcs.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 4 modules
CC crypto/ansi_cprng.mod.o
LD [M] crypto/ansi_cprng.ko
CC drivers/rpmsg/rpmsg_client_sample.mod.o
LD [M] drivers/rpmsg/rpmsg_client_sample.ko
CC drivers/rpmsg/rpmsg_server_sample.mod.o
LD [M] drivers/rpmsg/rpmsg_server_sample.ko
CC drivers/scsi/scsi_wait_scan.mod.o
LD [M] drivers/scsi/scsi_wait_scan.ko
The zImage is what we need because it is the compressed Linux kernel. Note the path of where the zImage is located. We also need the *.ko files (Kernel Modules). Remember their paths because you'll need to create those same paths later when you rebuild the kernel. Probably best to move these files to a new folder, I have used /home/user/Documents/Kernel/CompiledKernel/.
--Backing Up the Original Kernel--
It is important that we save a backup of the original kernel just in case there are errors in the kernel you are creating and we need to revert. Each device has their images saved in somwhat similar spots but they can change depending on device or OS.
Before these images were located on /proc/mnt location but with this model/OS they are stored elsewhere. Your phone will most likely need to be rooted prior to this operation. So either push the SuperUser app to your phone or grab Koushik Dutta's version from ROM Manager in ClockworkMod (http://download.clockworkmod.com/test/superuser-2.zip).
How to grab the images:
Code:
$ adb shell
$ su
$ ls -l /dev/block/platform/omap/omap_hsmmc.0/by-name
Result:
Code:
lrwxrwxrwx root root 2013-02-20 06:38 boot -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 2013-02-20 06:38 cache -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 2013-02-20 06:38 dgs -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 2013-02-20 06:38 efs -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 2013-02-20 06:38 metadata -> /dev/block/mmcblk0p13
lrwxrwxrwx root root 2013-02-20 06:38 misc -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 2013-02-20 06:38 param -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 2013-02-20 06:38 radio -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 2013-02-20 06:38 recovery -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 2013-02-20 06:38 sbl -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 2013-02-20 06:38 system -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 2013-02-20 06:38 userdata -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 2013-02-20 06:38 xloader -> /dev/block/mmcblk0p1
We need to backup the boot and recovery images.
Copying the Android Images:
Code:
cat /dev/block/mmcblk0p7 > /sdcard/boot
cat /dev/block/mmcblk0p8 > /sdcard/recovery
Pulling the Images Off the Device:
Code:
$ dab pull /sdcard/IMAGE_NAME ~/Documents/Kernel/OriginalKernel/
NOTE: This assumes you have this folder already created.
--Unpacking the Kernel--
Splitting the Image:
Using the unpack-mkbootimg-master kit you can split the image by using the ./unpackbootimg binary. The command is:
Code:
$ ./unpackbootimg -i ~/Documents/Kernel/OriginalKernel/boot
The results should be similar to this:
Code:
BOARD_KERNEL_CMDLINE
BOARD_KERNEL_BASE 80000000
BOARD_OAGE_SIZE 2048
The output files in your unpack-mkbootimg-master folder should be similar to this:
Code:
drwxrwxr-x 4 user user 4.0K Mar 3 11:22 .
drwxr-xr-x 3 user user 4.0K Mar 3 11:15 ..
-rw-rw-r-- 1 user user 9 Mar 3 11:22 boot-base
-rw-rw-r-- 1 user user 1 Mar 3 11:22 boot-cmdline
-rw-rw-r-- 1 user user 2.9K Feb 28 18:00 bootimg.h
-rw-rw-r-- 1 user user 5 Mar 3 11:22 boot-pagesize
-rw-rw-r-- 1 user user 344K Mar 3 11:22 boot-ramdisk.gz
-rw-rw-r-- 1 user user 4.0M Mar 3 11:22 boot-zImage
drwxrwxr-x 2 user user 4.0K Mar 3 11:15 libmincrypt
-rw-rw-r-- 1 user user 7.3K Mar 3 11:15 libmincrypt.a
-rwxr-xr-x 1 user user 622 Feb 28 18:00 Makefile
drwxrwxr-x 2 user user 4.0K Feb 28 18:00 mincrypt
-rwxrwxr-x 1 user user 789K Mar 3 11:15 mkbootimg
-rw-rw-r-- 1 user user 7.4K Feb 28 18:00 mkbootimg.c
-rw-rw-r-- 1 user user 8.5K Mar 3 11:15 mkbootimg.o
-rw-rw-r-- 1 user user 1.1K Feb 28 18:00 README
-rwxrwxr-x 1 user user 789K Mar 3 11:15 unpackbootimg
-rw-rw-r-- 1 user user 3.9K Feb 28 18:00 unpackbootimg.c
-rw-rw-r-- 1 user user 6.6K Mar 3 11:15 unpackbootimg.o
NOTE: This is for the Samsung Galaxy Nexus (Maguro & Tuna, possibly Toro & Toroplus)
A simple hexdump (using "hex dump -n 40") of the boot image from the GNex phone should give us the results of:
Code:
0000000 41 4e 44 52 4f 49 44 21 68 54 3f 00 00 80 00 80
0000010 4d 5c 05 00 00 00 00 81 00 00 00 00 00 00 f0 80
0000020 00 01 00 80 00 08 00 00
0000028
Results may vary between Android versions. These numbers will help us in verifying that your kernel that you're creating is indeed correct.
What is needed to be taken away from this is the so called "Android Magic" which are the first four bytes of data in the hex dump.
Code:
Android Magic = 4e41 5244 494f 2144
The next two bytes are the kernel size, in this case (0x5468 0x003f).
The rest of the byes are as follows:
Code:
Kernel Base = 8000 8000
Ramdisk Address = 8100 0000
Secondary Address = 80f0 0000
Tags Address = 8000 0100
These values are what I had to change in the mkbootimg application in the unpack-mkbootimg-master. Otherwise the kernel images would be off and they would not load correctly on the device. Look at https://github.com/ClimberTy/unpack-mkbootimg/blob/master/mkbootimg.c for more details.
Splitting the Ramdisk
For organizations sake move the boot-* files to a new folder. From here we need to open the boot-ramdisk.gz.
Code:
$ mkdir UnpackedKernel
$ mv boot-* UnpackedKernel/
$ cd UnpackedKernel/
$ gunzip -c boot-ramdisk.gz | cpio -i
This splits open the boot-ramdisk.gz file so we can place our newly created kernel modules (anything listed as .KO) in their appropriate folders or make modifications to any of the other files in the UnpackedKernel/ folder.
Remember these, we'll need them later.
--Rebuilding the Kernel--
After making the modifications and placing the kernel modules in the UnpackedKernel/ folders . Again you may need to create the directories for these kernel module locations. See your compiled kernel printout for the correct paths. Now that everything is in place you need to rebuild the boot-ramdisk.gz:
Code:
$ pwd
[…]/UnpackedKernel/
$ find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
$ cd ..
Now copy in the /CompiledKernel/zImage into the /unpack-mkbootimg-master/ folder and run this command to build the kernel:
Code:
$ ./mkbootimg --kernel zImage --ramdisk newramdisk.cpio.gz --base 80000000 --pagesize 2048 -o newKernel.img
Now to verify that the compiled kernel is right on par with the original kernel you need to do a hexdump.
Code:
$ hex dump -n 40 newKernel.img
Should print out results similar to this:
Code:
0000000 4e41 5244 494f 2144 cee4 0044 8000 8000
0000010 3e08 004b 0000 8100 0000 0000 0000 80f0
0000020 0100 8000 0800 0000
0000028
And as you can see all the addresses line up as they should, the only thing that should have changed is the kernel size which is expected.
--Test Flashing to the Device--
Move your newKernel.img image file into its own folder (e.g. ~/Documents/Kernel/NewKernel/) then put your device into the recovery mode to test and see if it boots, if it doesn't then "wash, rinse, and repeat".
To put your device into recovery mode, first power it off then power it back on and immediately hold down the POWER, VOLUME UP and VOLUME DOWN buttons. Select RECOVERY from the menu and press POWER to enter.
Code:
$ fastboot flash boot ~/Documents/Kernel/NewKernel/newKernel.img
$ fastboot reboot
Wait a few seconds till it boots up. If you don't receive any device response after a minute or so then put your phone back into recovery and flash the original kernel. If it works then, congratulations! If not try, try rebuilding it again and verifying you have the correct addresses or all the kernel modules installed properly.

Could not be explained better .... thanks a lot ... have included the link to your guide into my thread. :good:

Amazing job dude! Thanks for the TUT. Maybe one time in my free life time... I will try something :good:

Seems very good (because Anarkia sad it :victory: ) ... but my english is bad ...
COULD YOU translate it in german language, please ?
JOOOOKE :laugh:
Thank you for you work :good: :highfive:

Thanks for this great tutorial... Just opening a thread with all that useful info and such excellently organized need a lot of time...
Sent from my Galaxy Nexus using Tapatalk 2

salahmed said:
Thanks for this great tutorial... Just opening a thread with all that useful info and such excellently organized need a lot of time...
Sent from my Galaxy Nexus using Tapatalk 2
Click to expand...
Click to collapse
Thanks I just got tired of trying to outsource my info through so many different sites, not to mention the conflicting or out of date information.

bvt-1 said:
JOOOOKE :laugh:
Click to expand...
Click to collapse
Good show ol' chap!

anarkia1976 said:
Could not be explained better .... thanks a lot ... have included the link to your guide into my thread. :good:
Click to expand...
Click to collapse
Thanks, I appreciate the work you guys are doing as well. Maybe one day I'll step up and do some ROM development and write a better tutorial about that as well. But for now I am happy just doing the kernel work.

Great guide , all the info I need in one thread , I got this one tagged
Sent from my Galaxy Nexus using Xparent Cyan Tapatalk 2

Climber Ty said:
Thanks, I appreciate the work you guys are doing as well. Maybe one day I'll step up and do some ROM development and write a better tutorial about that as well. But for now I am happy just doing the kernel work.
Click to expand...
Click to collapse
I think a tutorial for create a modded ROM step by step will be a great job for xda community. :thumbup:
Sent from my Galaxy Nexus using xda app-developers app

I always get the same error, no matter which toolchain I try
Any suggestions?
See screenshot..

t0wlie said:
I always get the same error, no matter which toolchain I try
Any suggestions?
See screenshot..
Click to expand...
Click to collapse
Your path is wrong.
Wrote "export" on terminal and verify.
Copy complete link from export and do:
ll <complite link>
If there is an error your path is wrong.

[email protected]:~/Dokumente/Kernel/maguro/omap$ make
make: /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Kommando nicht gefunden
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: »include/generated/mach-types.h« ist bereits aktualisiert.
CC kernel/bounds.s
/bin/sh: 1: /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: not found
make[1]: *** [kernel/bounds.s] Fehler 127
make: *** [prepare0] Fehler 2
[email protected]:~/Dokumente/Kernel/maguro/omap$ ll /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
-rwxr-xr-x 1 marc marc 323104 Dez 4 10:58 /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc*
[email protected]:~/Dokumente/Kernel/maguro/omap$

t0wlie said:
I always get the same error, no matter which toolchain I try
Any suggestions?
See screenshot..
Click to expand...
Click to collapse
t0wlie said:
[email protected]:~/Dokumente/Kernel/maguro/omap$ make
make: /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Kommando nicht gefunden
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: »include/generated/mach-types.h« ist bereits aktualisiert.
CC kernel/bounds.s
/bin/sh: 1: /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: not found
make[1]: *** [kernel/bounds.s] Fehler 127
make: *** [prepare0] Fehler 2
[email protected]:~/Dokumente/Kernel/maguro/omap$ ll /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
-rwxr-xr-x 1 marc marc 323104 Dez 4 10:58 /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc*
[email protected]:~/Dokumente/Kernel/maguro/omap$
Click to expand...
Click to collapse
Can you post export command please.
You can try to modify:
/arm-linux-androideabi-gcc
to
/arm-linux-androideabi-

I tried (on antoher user)
export PATH=/home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin:$PATH
export CROSS_COMPILE=/home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-
make: /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Kommando nicht gefunden
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: »include/generated/mach-types.h« ist bereits aktualisiert.
CC kernel/bounds.s
/bin/sh: 1: /home/marc/Dokumente/Kernel/maguro/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: not found
make[1]: *** [kernel/bounds.s] Fehler 127
make: *** [prepare0] Fehler 2

Try using the CodeSourcery ARM Compilers instead of the prebuilts (http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/). The version you want are the EABI release under the ARM Processors section. These compilers haven't failed me once since I've used them. Let me know if that works for you.

Thank you so much for this guide! I've been compiling my own ROM for a while now, and I feel like taking another step in development, by building my own kernel. I'm running into the following make error(s) though. I'm completely new to kernel development, so I figured I'd fire out my questions here, and hope that you guys can help me out. Below is my entire build environment (as far as I could get) - from the 'mkdir' commands to the *make* errors I'm experiencing... As you'll see, I haven't gotten very far, so I'm clearly doing something wrong at an elementary level. Any help would be appreciated. :good:
Code:
[email protected]:~$ mkdir Blowfish
[email protected]:~$ cd Blowfish
[email protected]:~/Blowfish$ mkdir kernel
[email protected]:~/Blowfish$ cd kernel
[email protected]:~/Blowfish/kernel$ mkdir source
[email protected]:~/Blowfish/kernel$ cd kerne
bash: cd: kerne: No such file or directory
[email protected]:~/Blowfish/kernel$ cd kernel
bash: cd: kernel: No such file or directory
[email protected]:~/Blowfish/kernel$ git clone https://android.googlesource.com/kernel/omap.git
Cloning into 'omap'...
remote: Sending approximately 439.05 MiB ...
remote: Counting objects: 64780, done
remote: Finding sources: 100% (18264/18264)
remote: Getting sizes: 100% (2126/2126)
remote: Compressing objects: 99% (26370/26371)
remote: Total 2138198 (delta 1785247), reused 2137592 (delta 1785041)
Receiving objects: 100% (2138198/2138198), 446.32 MiB | 340 KiB/s, done.
Resolving deltas: 100% (1786095/1786095), done.
[email protected]:~/Blowfish/kernel$ cd omap
[email protected]:~/Blowfish/kernel/omap$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/android-omap-3.0
remotes/origin/android-omap-panda-3.0
remotes/origin/android-omap-steelhead-3.0-ics-aah
remotes/origin/android-omap-tuna-3.0
remotes/origin/android-omap-tuna-3.0-ics-mr1
remotes/origin/android-omap-tuna-3.0-jb-mr0
remotes/origin/android-omap-tuna-3.0-jb-mr1
remotes/origin/android-omap-tuna-3.0-jb-mr1.1
remotes/origin/android-omap-tuna-3.0-jb-pre1
remotes/origin/android-omap-tuna-3.0-mr0
remotes/origin/android-omap-tuna-3.0-mr0.1
remotes/origin/glass-omap-xrr02
remotes/origin/glass-omap-xrr35
remotes/origin/glass-omap-xrr64b
remotes/origin/linux-omap-3.0
remotes/origin/master
remotes/origin/sph-l700-fh05
[email protected]:~/Blowfish/kernel/omap$ git checkout remotes/origin/android-omap-tuna-3.0-jb-pre1
Checking out files: 100% (37659/37659), done.
Note: checking out 'remotes/origin/android-omap-tuna-3.0-jb-pre1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at e8de0e2... video: sii9234: dynamically register and unregister input device
[email protected]:~/Blowfish/kernel/omap$ export ARCH=arm
[email protected]:~/Blowfish/kernel/omap$ export SUBARCH=arm
[email protected]:~/Blowfish/kernel/omap$ export CROSS_COMPILE='/home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi.bin'
[email protected]:~/Blowfish/kernel/omap$ make tuna_deconfig
HOSTCC scripts/basic/fixdep
make[1]: *** No rule to make target `tuna_deconfig'. Stop.
make: *** [tuna_deconfig] Error 2
[email protected]:~/Blowfish/kernel/omap$ make
make: /home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi.bingcc: Command not found
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/Blowfish/kernel/omap$

jjhiza said:
Code:
[email protected]:~/Blowfish/kernel/omap$ git checkout remotes/origin/android-omap-tuna-3.0-jb-pre1
Checking out files: 100% (37659/37659), done.
Note: checking out 'remotes/origin/android-omap-tuna-3.0-jb-pre1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at e8de0e2... video: sii9234: dynamically register and unregister input device
[email protected]:~/Blowfish/kernel/omap$ export ARCH=arm
[email protected]:~/Blowfish/kernel/omap$ export SUBARCH=arm
[email protected]:~/Blowfish/kernel/omap$ export CROSS_COMPILE='/home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi.bin'
[email protected]:~/Blowfish/kernel/omap$ make tuna_deconfig
HOSTCC scripts/basic/fixdep
make[1]: *** No rule to make target `tuna_deconfig'. Stop.
make: *** [tuna_deconfig] Error 2
[email protected]:~/Blowfish/kernel/omap$ make
make: /home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi.bingcc: Command not found
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/Blowfish/kernel/omap$
Click to expand...
Click to collapse
I have run into this issue before, and I believe what I did to solve this was delete all the files in the build directory and re-git them from a specific branch. For example building ICS I used:
Code:
$ git branch -a
$ git checkout remotes/origin/android-omap-tuna-3.0-ics-mr1
Try it and see if that works for your JB files. I think for you it's:
Code:
$ git checkout remotes/origin/android-omap-tuna-3.0-jb-mr1.1

jjhiza said:
Thank you so much for this guide! I've been compiling my own ROM for a while now, and I feel like taking another step in development, by building my own kernel. I'm running into the following make error(s) though. I'm completely new to kernel development, so I figured I'd fire out my questions here, and hope that you guys can help me out. Below is my entire build environment (as far as I could get) - from the 'mkdir' commands to the *make* errors I'm experiencing... As you'll see, I haven't gotten very far, so I'm clearly doing something wrong at an elementary level. Any help would be appreciated. :good:
Code:
[email protected]:~$ mkdir Blowfish
[email protected]:~$ cd Blowfish
[email protected]:~/Blowfish$ mkdir kernel
[email protected]:~/Blowfish$ cd kernel
[email protected]:~/Blowfish/kernel$ mkdir source
[email protected]:~/Blowfish/kernel$ cd kerne
bash: cd: kerne: No such file or directory
[email protected]:~/Blowfish/kernel$ cd kernel
bash: cd: kernel: No such file or directory
[email protected]:~/Blowfish/kernel$ git clone https://android.googlesource.com/kernel/omap.git
Cloning into 'omap'...
remote: Sending approximately 439.05 MiB ...
remote: Counting objects: 64780, done
remote: Finding sources: 100% (18264/18264)
remote: Getting sizes: 100% (2126/2126)
remote: Compressing objects: 99% (26370/26371)
remote: Total 2138198 (delta 1785247), reused 2137592 (delta 1785041)
Receiving objects: 100% (2138198/2138198), 446.32 MiB | 340 KiB/s, done.
Resolving deltas: 100% (1786095/1786095), done.
[email protected]:~/Blowfish/kernel$ cd omap
[email protected]:~/Blowfish/kernel/omap$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/android-omap-3.0
remotes/origin/android-omap-panda-3.0
remotes/origin/android-omap-steelhead-3.0-ics-aah
remotes/origin/android-omap-tuna-3.0
remotes/origin/android-omap-tuna-3.0-ics-mr1
remotes/origin/android-omap-tuna-3.0-jb-mr0
remotes/origin/android-omap-tuna-3.0-jb-mr1
remotes/origin/android-omap-tuna-3.0-jb-mr1.1
remotes/origin/android-omap-tuna-3.0-jb-pre1
remotes/origin/android-omap-tuna-3.0-mr0
remotes/origin/android-omap-tuna-3.0-mr0.1
remotes/origin/glass-omap-xrr02
remotes/origin/glass-omap-xrr35
remotes/origin/glass-omap-xrr64b
remotes/origin/linux-omap-3.0
remotes/origin/master
remotes/origin/sph-l700-fh05
[email protected]:~/Blowfish/kernel/omap$ git checkout remotes/origin/android-omap-tuna-3.0-jb-pre1
Checking out files: 100% (37659/37659), done.
Note: checking out 'remotes/origin/android-omap-tuna-3.0-jb-pre1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at e8de0e2... video: sii9234: dynamically register and unregister input device
[email protected]:~/Blowfish/kernel/omap$ export ARCH=arm
[email protected]:~/Blowfish/kernel/omap$ export SUBARCH=arm
[email protected]:~/Blowfish/kernel/omap$ export CROSS_COMPILE='/home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi.bin'
[email protected]:~/Blowfish/kernel/omap$ make tuna_deconfig
HOSTCC scripts/basic/fixdep
make[1]: *** No rule to make target `tuna_deconfig'. Stop.
make: *** [tuna_deconfig] Error 2
[email protected]:~/Blowfish/kernel/omap$ make
make: /home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi.bingcc: Command not found
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/Blowfish/kernel/omap$
Click to expand...
Click to collapse
If you haven't had luck figuring out the problem , you need to add a hyphen at the end of your toolchain , so it would be
" export CROSS_COMPILE=~/home/jjhiza/Blowfish/arm-2013.05-23-arm-none-eabi- "
that just tells it to use all the binary files that start with eabi-
Sent from my Galaxy Nexus using Tapatalk

Climber Ty said:
I know a lot of this has been posted before in other locations, but recently I have found some of that data to be incomplete when I was building a custom kernel for my GNex, so just bear with me.
Click to expand...
Click to collapse
Dude, this tutorial is f'king amazing.
For some odd reason, my kernel will boot and run just fine temporarily using the "fastboot boot" command, but I get write errors when trying to "fastboot flash" it, and flashing the new kernel fails. I've tried in xubuntu 12.04 x86, Windows 7 x64 using command line and Windows x64 using Wug's Nexus toolkit.
Any ideas?
I tried repacking the ROM that I'm using (Shiny 4.3 10/11/13 build) with my kernel and reflashing it, but no joy. I'm sure there's more to making kernel into a flashable .zip than I realize...

Related

Building Kernel Error | Please Help | Dev.ChaosFirZen

I Get This Problem Please Help Me...
[email protected]:~/kernel$ ARCH=arm CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi make
make: /opt/arm-2011.09/bin/arm-none-eabigcc: Command not found
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
/bin/sh: /opt/arm-2011.09/bin/arm-none-eabigcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
i think u missing some libraries. u on 64 bit ? maybe u need install 32 libraries
what kind of linux u have?
ChaosFirZen said:
[email protected]:~/kernel$ ARCH=arm CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi make
Click to expand...
Click to collapse
You forgot about export:
Code:
export ARCH=arm
export CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi
and double check if CROSS_COMPILE should be arm-none-eabi or arm-none-eabi- (with a minus at the end)
denisl78 said:
i think u missing some libraries. u on 64 bit ? maybe u need install 32 libraries
what kind of linux u have?
Click to expand...
Click to collapse
Im on 32bit ubuntu..
Sent from my LT18i using XDA App
This What Shows and it doesnt reponse at
export ARCH=arm
export CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi
Click to expand...
Click to collapse
[email protected]:~$ cd kernel
[email protected]:~/kernel$ export ARCH=arm
[email protected]:~/kernel$ export CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi
[email protected]:~/kernel$ setprop persist.world.domination 1
setprop: command not found
[email protected]:~/kernel$ ARCH=arm CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi- make
make: /opt/arm-2011.09/bin/arm-none-eabi-gcc: Command not found
scripts/kconfig/conf -s arch/arm/Kconfig
make: /opt/arm-2011.09/bin/arm-none-eabi-gcc: Command not found
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
/bin/sh: /opt/arm-2011.09/bin/arm-none-eabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
[email protected]:~/kernel$ export ARCH=arm CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi make
[email protected]:~/kernel$ export ARCH=arm CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi- make
[email protected]:~/kernel$ cd
[email protected]:~$ cd
[email protected]:~$ cd
[email protected]:~$ cd
[email protected]:~$ cd
[email protected]:~$ cd
[email protected]:~$ cd
[email protected]:~$ cd kernel
[email protected]:~/kernel$ export ARCH=arm
[email protected]:~/kernel$ export CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi make
[email protected]:~/kernel$ export CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi- make
[email protected]:~/kernel$ export arm-none-eabi=/opt/arm-2011.09/bin/arm-none-eabi- make
bash: export: `arm-none-eabi=/opt/arm-2011.09/bin/arm-none-eabi-': not a valid identifier
[email protected]:~/kernel$
what u get with :
Code:
file /opt/arm-2011.09/bin/arm-none-eabi-gcc
?
do u installed all build packages ?
i not fluent with deb distributions (more rpm), but maybe
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
may help
and
Code:
export ARCH=arm
export CROSS_COMPILE=/opt/arm-2011.09/bin/arm-none-eabi
export KERNEL_DIR=/full/path/to/kernel
make
ChaosFirZen said:
[email protected]:~/kernel$ setprop persist.world.domination 1
setprop: command not found
Click to expand...
Click to collapse
OMGLOL, it's my signature (setprop is android specific)
Anyway, if any packages would be missing make would whine about them first. Just to be sure check official docs
As for exports- I use envsetup.sh-s like this one:
Code:
export ARCH=arm
export CC=arm-spica-linux-uclibcgnueabi-gcc
export CXX=arm-spica-linux-uclibcgnueabi-gcc
export CROSS_COMPILE=arm-spica-linux-uclibcgnueabi-
export PATH=$PATH:${HOME}/x-tools/bin:${HOME}/x-tools/arm-spica-linux-uclibcgnueabi/bin
(this one is for crosstools-ng, you have to adjust names and paths for your environment)
usage:
Code:
. ./envsetup.sh
Please give Me The Full View Of The Script On Your terminal ..
ChaosFirZen said:
Please give Me The Full View Of The Script On Your terminal ..
Click to expand...
Click to collapse
What do you mean by 'full view'?
Command
Code:
. ./envsetup.sh
does not produse any visible output, script just sets variables
tapatalked from Desire
Error During Cross compile
Sir after giving the bellow cmd
make ARCH=arm CROSS_COMPILE=/home/digvijay/Desktop/5-4-12/toolchain/arm-2011.03/bin/arm-none-linux-gnueabi-
I am getting folloeing error
#
# configuration written to .config
#
include/config/auto.conf:15:warning: symbol value 'arch/x86/configs/x86_64_defconfig' invalid for ARCH_DEFCONFIG
include/config/auto.conf:106:warning: symbol value 'elf64-x86-64' invalid for OUTPUT_FORMAT
make: execvp: /home/digvijay/Desktop/5-4-12/toolchain/arm-2011.03/bin/arm-none-linux-gnueabi-gcc: Permission denied
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
Generating include/generated/mach-types.h
CC kernel/bounds.s
/bin/sh: /home/digvijay/Desktop/5-4-12/toolchain/arm-2011.03/bin/arm-none-linux-gnueabi-gcc: Permission denied
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
Please help me out.. pleas its urgent. ASAP
It seems that you don't have ARM config, make still tries to build x86.
Do exports and 'make menuconfig' first to check if config is correct
tapatalked from Xperia Arc S
Hey all, i get the same error
I close the terminal and re-open it and i get rid of this but now i've foud another error
>ARCH=arm CROSS_COMPILER=$CCOMPILER make
scripts/kconfig/conf -s arch/arm/Kconfig
arch/arm/mach-msm/Kconfig:1509:warning: multi-line strings not supported
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
Generating include/generated/mach-types.h
CC kernel/bounds.s
cc1: erreur: unrecognized command line option ‘-mlittle-endian’
cc1: erreur: unrecognized command line option ‘-mno-thumb-interwork’
kernel/bounds.c:1:0: erreur: unknown ABI (aapcs-linux) for -mabi= switch
kernel/bounds.c:1:0: erreur: bad value (armv5t) for -march= switch
make[1]: *** [kernel/bounds.s] Erreur 1
make: *** [prepare0] Erreur 2
cc1: erreur: unrecognized command line option ‘-mlittle-endian’
cc1: erreur: unrecognized command line option ‘-mno-thumb-interwork’
Can someone help me ?
arc_u said:
Hey all, i get the same error
I close the terminal and re-open it and i get rid of this but now i've foud another error
>ARCH=arm CROSS_COMPILER=$CCOMPILER make
Click to expand...
Click to collapse
IIRC it should be: make ARCH=arm [...] (make first, then arguments)
arc_u said:
scripts/kconfig/conf -s arch/arm/Kconfig
arch/arm/mach-msm/Kconfig:1509:warning: multi-line strings not supported
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
Generating include/generated/mach-types.h
CC kernel/bounds.s
cc1: erreur: unrecognized command line option ‘-mlittle-endian’
cc1: erreur: unrecognized command line option ‘-mno-thumb-interwork’
kernel/bounds.c:1:0: erreur: unknown ABI (aapcs-linux) for -mabi= switch
kernel/bounds.c:1:0: erreur: bad value (armv5t) for -march= switch
make[1]: *** [kernel/bounds.s] Erreur 1
make: *** [prepare0] Erreur 2
Click to expand...
Click to collapse
You have errors in kernel config
-kernel is NOT compiled for arm
-cpu is armv7, not armv5t
Do exports and
Code:
make menuconfig
before you try to compile
>make menuconfig
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Erreur 1
make: *** [menuconfig] Erreur 2
EDIT: installed the libncurses5-dev and it seems to work now, i've to configure now
But what config i've to do
ARCH=arm CROSS_COMPILE=/opt/arm-2010q1/bin/arm-none-eabi- make semc_anzu_defconfig
or
make menuconfig (and what i have to do exactly in menuconfig?)
arc_u said:
EDIT: installed the libncurses5-dev and it seems to work now, i've to configure now
But what config i've to do
ARCH=arm CROSS_COMPILE=/opt/arm-2010q1/bin/arm-none-eabi- make semc_anzu_defconfig
or
make menuconfig (and what i have to do exactly in menuconfig?)
Click to expand...
Click to collapse
1. Do required exports
2. make semc_anzu_defconfig (this will create kernel config required for make- copy of semc_anzu_defconfig)
3. If you want to make any changes (drivers/options/modules/whatever) in config- make menuconfig
4. make
A lot of thanks for your help
I do the following export
export ARCH=arm
export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
then
make semc_anzu_defconfig
make
make
CHK include/linux/version.h
make[1]: « include/asm-arm/mach-types.h » est à jour.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
GEN include/linux/bounds.h
CC arch/arm/kernel/asm-offsets.s
GEN include/asm/asm-offsets.h
CALL scripts/checksyscalls.sh
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
scripts/mod/modpost.c: In function ‘get_markers’:
scripts/mod/modpost.c:1562:12: attention : ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
scripts/mod/modpost.c: In function ‘add_marker’:
scripts/mod/modpost.c:1982:10: attention : ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/kallsyms
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:112:9: attention : ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
HOSTCC scripts/conmakehash
HOSTCC scripts/bin2c
CC init/main.o
In file included from include/linux/mempolicy.h:62:0,
from init/main.c:52:
include/linux/pagemap.h: In function ‘fault_in_pages_readable’:
include/linux/pagemap.h:415:16: erreur: variable ‘c’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make[1]: *** [init/main.o] Erreur 1
make: *** [init] Erreur 2
very disappointed
arc_u said:
very disappointed
Click to expand...
Click to collapse
This needs to be added in Makefile :
Code:
# This warning generated too much noise in a regular build.
KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
By default the toolchain stops compiling on all errors.

Compiling AOKP JellyBean from source

Hi,
I've been trying to build a rom from Lord ClockaN´s repo but I run into some issues when trying to embed the kernel.
I've done the following:
$ mkdir ~/src/android
$ cd ~/src/android
$ repo init -u git://github.com/IceColdJelly/platform_manifest.git -b jb
$ repo sync -j16
$ mkdir -p kernel/htc
$ cd kernel/htc
$ git clone git://github.com/TeamNDVRu/htc-kernel-endeavoru.git endeavoru
$ cd endeavoru
$ git checkout -b jellybean origin/jellybean
$ cd ~/src/android
$ cat device/htc/endeavoru/BoardConfig.mk | tail -3
# Kernel building
TARGET_KERNEL_SOURCE := kernel/htc/endeavoru
TARGET_KERNEL_CONFIG := arch/arm/configs/endeavoru_android_config
I copied the kernel config from my running IceColdJelly 0.3 to endeavoru_android_config
Within BoardConfig.mk, I changed endeavoru_android_defconfig to arch/arm/configs/endeavoru_android_config
$ . build/envsetup.sh
$ lunch aokp_endeavoru-userdebug
$ make bacon (or mka)
...
make -f /home/archv/src/android/kernel/htc/endeavoru/Makefile silentoldconfig
make -f /home/archv/src/android/kernel/htc/endeavoru/scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
ln -fsn /home/archv/src/android/kernel/htc/endeavoru source
/bin/sh /home/archv/src/android/kernel/htc/endeavoru/scripts/mkmakefile \
/home/archv/src/android/kernel/htc/endeavoru /home/archv/src/android/out/target/product/endeavoru/obj/KERNEL_OBJ 2 6
GEN /home/archv/src/android/out/target/product/endeavoru/obj/KERNEL_OBJ/Makefile
mkdir -p include/linux include/config
make -f /home/archv/src/android/kernel/htc/endeavoru/scripts/Makefile.build obj=scripts/kconfig silentoldconfig
mkdir -p include/generated
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[4]: *** [silentoldconfig] Error 1
make[3]: *** [silentoldconfig] Error 2
make[2]: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory `/home/archv/src/android/kernel/htc/endeavoru'
make: *** [TARGET_KERNEL_BINARIES] Error 2
I get this error whether I have the kernel already compiled or not.
What is the supposed way to correctly embed the kernel with the ROM image, keeping the source in sync with
the repo command, just like everything else?
do it the easy way and copy your endeavoru_android_config to <kernel_dir>/.config.
seadersn said:
do it the easy way and copy your endeavoru_android_config to <kernel_dir>/.config.
Click to expand...
Click to collapse
It doesn´t make any difference. I tried compiling the kernel before building the rom, hence the <kernel_dir>/.config
already exists but I get the same error.

[Guide] Build your own Kernel for Galaxy W

Hello guys!
Because the GT-i9001 (Galaxy S Plus) has a Kernel Building Tutorial, I decided to make one for the i8150 as these 2 devices are very similar.
This tutorial is based on this one by our Recognized Contributor, Xistance: /showthread.php?t=1966751. So all the credit goes to him!
First of all, you will need Ubuntu(it may work on other distros too, but Ubuntu is the most easy one to set up) these versions were tested:
14.04 - (this is were I build ROM's and Kernels)
13.10
12.10
12.04
10.04
Ok, so lets get started!
PART 1 - Installing Required Programs, Packages and Toolchains:
Android SDK
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I rename the SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file(Change path according to your SDK dir):
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Install required packages:
Open the Terminal and type:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Getting the Toolchain:
Open the terminal and type
Code:
mkdir android && cd android
mkdir kernel && cd kernel
Now clone this repo by DooMLoRD, these are precompiled toolchains, essential for compiling: (You can use any other linaro toolchains you want)
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
Make sure you have the toolchain folder in the Android folder as well as in the Kernel folder.
PART 2 - Getting the source, and making modifications:
Now we need to git clone the kernel source, this time I will use arco's github source:
Code:
cd android/kernel
git clone git://github.com/arco/samsung-kernel-msm7x30 -b ics-2.6
After -b you must specify the branch you want to clone, in this example, I used the ICS 2.6 branch.
After the repo is cloned you can modify/add features to kernel.
Examples in the second post.
PART 3 - Building the Kernel:
cd to your kernel directory:
Code:
cd android/kernel/samsung-kernel-msm7x30
Ok, now we need to set our target architecture and set the path to the toolchain we would like to use.
In this example, I will use the 4.6.2 toolchain downloaded above:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
Now we need to load our configuration file, also, setting the board we would like to use, in this case, it is Ancora Board:
Code:
make ancora_defconfig
Than, we need to load menuconfing in order to apply the changes we made to the kernel (Governors, I/O schedulers, OC and so on)
Code:
make menuconfig
*Activating CPU Governors can be made under "CPU Power Management" Tab
*Activating I/O Schedulers can be made under "Enable block layer" tab
*OC can be activated under "System Type" tab
Now, the building will start after this command:
Code:
make -jx
x(max number of jobs per core)= number of CPU cores + 1 (for a QuadCore CPU there will be make -j5)
The building should take 5 to 10 minutes depending on your CPU.
PART 4 - Exporting the zImage and the modules
If the kernel compiled successfully you should see something like: zImage is ready.
Now, we need to export the zImage and the compiled modules into a folder:
Code:
A. Open a terminal
B. Change to your root kernel directory
C. Type "mkdir ../_output"
D. Type "cp arch/arm/boot/zImage ../_output/zImage"
E. Type "find . -name "*.ko" -exec cp {} ../_output \;"
Credits for this goes to Recognized Developer Hacre
PART 5 - Making the boot.img
Ok, this part is optional and it depends on your knowledge level.
The most easiest way to make the boot.img is using dsixda's Android Kitchen.
I recommend using this version from GT-i9001 forum as it is the same as for i8150: /showthread.php?t=1399468.
For this example, we built a zImage based on arco's sources for 2.6 kernel so we will need his ROM base.
Download the kitchen, and put the ROM (flashable ZIP) into the "original-update" folder.
Then, open up the kitchen (menu.sh) and press 1 (Set up working folder from ROM).
Choose your ROM and then press enter. After this we would like to go to 0 - Advanced Options and then 12 - Tools For Boot.img.
Here we need to press w to extract the content of the boot.img from the working directory.
Than, replace the zImage from BOOT-EXTRACTED with your zImage.
Also, you can put the compiled modules (.ko) inside /lib/modules in the RAMDISK folder
Now go back to the terminal and press b to build back your boot.img (which will be located in working folder)
PART 6 - Flashing the boot.img and Making Flashable ZIP
The compiled boot.img can be flashed to the device using adb like this: (If you don't know what adb is or how to use it, please search on Google/XDA for tutorials)
Code:
adb push boot.img /sdcard/boot.img
adb shell
su
dd if=/sdcard/boot.img of=/dev/block/mmcblk0p8
reboot
Commands explained:
adb push = it pushes the compiled boot.img to the internal sd card of the phone.
dd if = READ FROM FILE
dd of = WRITE TO FILE
mmcblk0p8 = the partition where the Kernel Image goes.
After that, we need to manually push the modules into /system/lib/modules on our phone. This can be done through adb like this:
Code:
adb push dhd.ko system/lib/modules/dhd.ko
This example is for dhd.ko module, which is required for WiFi.
For flashable ZIP, take one from another kernel and replace the boot.img.
Credits:
Xistance
broodplank
Hacre
DooMLoRD
Madridii (for helping to test the kernel on Galaxy W)
hotheabilly (for helping to test the kernel on Galaxy W)
Adding Governors, I/O schedulers and more.
This one great tut by broodplank should explain everything about Governors and I/O Schedulers in very tiny details: http://xda-university.com/as-a-developer/adding-features-to-your-kernel
Don't forget to activate every feature you added, in makeconfig menu, before building the kernel
Reserved - Just in case
Woow
My nickname is mentioned in the firsh post..
Thank you for this guide
We need guide on windows os
Sent from my GT-I8150 using xda premium
Madridii said:
Woow
My nickname is mentioned in the firsh post..
Thank you for this guide
We need guide on windows os
Sent from my GT-I8150 using xda premium
Click to expand...
Click to collapse
Well, I don't own this device and you tested my compiled kernel and confirmed that it works, so you deserve credit...
I never actually builded anything on Windows OS, Cygwin is required for that, and that is a program I'm not yet familiarized with.
Sent from my GT-I9001 using xda app-developers app
Madridii said:
Woow
My nickname is mentioned in the firsh post..
Thank you for this guide
We need guide on windows os
Sent from my GT-I8150 using xda premium
Click to expand...
Click to collapse
The easiest way is to just dual boot Ubuntu or Mint. Well, if you can't really do that you can use a VM to build it as well.
Anyway, great job on the tutorial educk!
Xistance said:
The easiest way is to just dual boot Ubuntu or Mint. Well, if you can't really do that you can use a VM to build it as well.
Anyway, great job on the tutorial educk!
Click to expand...
Click to collapse
Thank you!
But if it wasn't for you, broodplank, diablo, skywalker01 and many other great devs on our forum who helped me, I would have never found out these awesome things.
Your tutorial was like a starting point for me, it opened my way into the Android World, it was my first step into "development".
I hope I can help other people with this guide, just like you helped me with yours!
Sent from my GT-I9001 using xda app-developers app
First time i tried to make my kernel, I had errors because i didn't have some packages. (Was using Ubuntu 12.10)
Add that you need 12.04 LTS to Successfully build it After installed the LTS version, you could update it to 12.10.....The packages will still be there
Thank you guys
I will try to learn about Ubuntu to have 10% of your experience..
Thank you again
Sent from my GT-I8150 using xda premium
i guess SDK is not needed if you are building kernel. i build it without having sdk on my ubuntu
and for the make -j options it's easier to use -j26. use -j1 to debug any compile error
very useful guide :good:
Sent from my GT-I8150
hadidjapri said:
i guess SDK is not needed if you are building kernel. i build it without having sdk on my ubuntu
and for the make -j options it's easier to use -j26. use -j1 to debug any compile error
very useful guide :good:
Sent from my GT-I8150
Click to expand...
Click to collapse
Yeah, you don't need the SDK. I included it in my guide because I find it very useful to have.
About the -j options, I sometimes use -j150 and sometimes -j8. Why? Because sometimes I feel like using my PC while building. Also, don't ask for my specs, for kernel building it doesn't matter.
Woah my name on the OP thanks educk!
Sent from my GT-P1000 using Tapatalk 2
hadidjapri said:
i guess SDK is not needed if you are building kernel. i build it without having sdk on my ubuntu
and for the make -j options it's easier to use -j26. use -j1 to debug any compile error
very useful guide :good:
Sent from my GT-I8150
Click to expand...
Click to collapse
Yes, you are right! SDK is not needed for the kernel building, I added it because it is required for ADB.
Update: I added a method of flashing the boot.img and my github commit where I added CPU Governors (SmartAss v2, Smoothass, InteractiveX and more) and I/O Schedulers (SIO and VR). More updates soon.
Regards,
Erik
Sent from my GT-I9001 using xda app-developers app
Hello all
I am trying to compile arco's sources but ı have problem.
when ı entry make -j2
make -j2
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
scripts/kconfig/conf --silentoldconfig Kconfig
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
CHK include/linux/version.h
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 25: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 26: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' güncel
CC scripts/mod/empty.o
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
CC kernel/bounds.s
make[2]: *** [scripts/mod/empty.o] error 127
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make[1]: make[1]: *** [kernel/bounds.s] error 127
*** [scripts/mod] error 2
make: *** [prepare0] error 2
make: *** Waiting for unfinished jobs ....
make: *** [scripts] error 2
[email protected]:~/android/kernel/samsung-kernel-msm7x30$
Thanks
Sorry for my bad english
Batur97 said:
Hello all
I am trying to compile arco's sources but ı have problem.
when ı entry make -j2
make -j2
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
scripts/kconfig/conf --silentoldconfig Kconfig
make: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: command not found
CHK include/linux/version.h
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 25: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
/home/batur/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: satır 26: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: No such file or directory
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' güncel
CC scripts/mod/empty.o
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
CC kernel/bounds.s
make[2]: *** [scripts/mod/empty.o] error 127
/bin/sh: 1: /home/batur/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make[1]: make[1]: *** [kernel/bounds.s] error 127
*** [scripts/mod] error 2
make: *** [prepare0] error 2
make: *** Waiting for unfinished jobs ....
make: *** [scripts] error 2
[email protected]:~/android/kernel/samsung-kernel-msm7x30$
Thanks
Sorry for my bad english
Click to expand...
Click to collapse
try:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
make ancora_defconfig
before make -j2...
also, make sure the path /android/kernel/toolchains/arm-eabi-linaro-4.6.2 exists and you have you'r toolchain in there...
This guide may be useful, but what about Fedora/RPM-based users?
Debian-based users can use the usual method (Educk has made a guide for install it, just check your repo if they have it) but for Fedora user? Maybe this method will work. I was a user of Fedora but since Debian wheezy (although it is RC1, unstable) I moved on.
Maybe this method for RPM-based (Fedora, Red Hat, CentOS, openSUSE)
Code:
$ su
# yum install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
# ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
This maybe useful, but if you RPM-based users didn't find those packages, then maybe Google is your best partner.
R: [Guide] Build your own Kernel for Galaxy W
How can I add UV in the kernel?
Sent from my GT-I8150 using xda app-developers app
lorenzo82 said:
How can I add UV in the kernel?
Sent from my GT-I8150 using xda app-developers app
Click to expand...
Click to collapse
You can modify it from the arch/arm/mach-msm/acpuclock-7x30.c file.
Is this core 'make -jx' x for telephone or pc because my pc is per of 2 core but my phone is 1 core
thanks for your helping
Batur97 said:
Is this core 'make -jx' x for telephone or pc because my pc is per of 2 core but my phone is 1 core
thanks for your helping
Click to expand...
Click to collapse
PC of course.

Onclite 5.18.14 Kernel

hello! I am writing through google translator. I built kernel 5.18.4, but I don't see image.gz-dtb in /arch/arm64/boot/.
Here is what I did:
Code:
wget "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.18.14.tar.xz"
tar -xvf "linux-5.18.14.tar.xz"
cd linux-5.18.14
make clean
make mrproper
make onclite-perf_defconfig CC=clang-11 ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=/mnt/sdc1/pub/dev/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- O=/mnt/sdc1/dev/onc5
make[1]: Entering directory '/mnt/sdc1/pub/dev/onc5'
GEN Makefile
#
# configuration written to .config
#
make[1]: Leaving directory '/mnt/sdc1/pub/dev/onc5'
make -j5 O=/mnt/sdc1/pub/dev/onc5 CC=clang-11 ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=/mnt/sdc1/pub/dev/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- O=/mnt/sdc1/dev/onc5
.....
the kernel built successfully and there were files
Image
Image.gz
but there was no image.gz-dtb file
best regards, Vadim

Custom LOS build fails due to missing product spec

Given various issues with the latest LOS 19.1 for pioneer I tried to build LOS 18.1 myself using the lineageos4microg/docker-lineage-cicd docker image. Unfortunately this fails:
>> [Mon Oct 31 23:18:54 UTC 2022] Starting build for pioneer, lineage-18.1 branch
build/envsetup.sh: line 136: build/soong/soong_ui.bash: Permission denied
build/envsetup.sh: line 669: vendor/lineage/build/tools/roomservice.py: Permission denied
build/envsetup.sh: line 136: build/soong/soong_ui.bash: Permission denied
build/envsetup.sh: line 71: build/soong/soong_ui.bash: Permission denied
** Don't have a product spec for: 'lineage_pioneer'
** Do you have the right repo manifest?
No such item in brunch menu. Try 'breakfast'
>> [Mon Oct 31 23:18:54 UTC 2022] Failed build for pioneer
>> [Mon Oct 31 23:18:54 UTC 2022] Finishing build for pioneer
>> [Mon Oct 31 23:18:54 UTC 2022] Cleaning source dir for device pioneer
build/envsetup.sh: line 1479: /srv/src/LINEAGE_18_1/build/soong/soong_ui.bash: Permission denied
[0;31m#### failed to build some targets ####[00m
Click to expand...
Click to collapse
I was unable to find something useful about this but even without the image I can confirm the issue:
$ brunch pioneer
bash: build/soong/soong_ui.bash: Keine Berechtigung
bash: vendor/lineage/build/tools/roomservice.py: Keine Berechtigung
bash: build/soong/soong_ui.bash: Keine Berechtigung
bash: build/soong/soong_ui.bash: Keine Berechtigung
** Don't have a product spec for: 'lineage_pioneer'
** Do you have the right repo manifest?
No such item in brunch menu. Try 'breakfast'
$ breakfast pioneer
bash: build/soong/soong_ui.bash: Keine Berechtigung
bash: vendor/lineage/build/tools/roomservice.py: Keine Berechtigung
bash: build/soong/soong_ui.bash: Keine Berechtigung
bash: build/soong/soong_ui.bash: Keine Berechtigung
** Don't have a product spec for: 'lineage_pioneer'
** Do you have the right repo manifest?
Click to expand...
Click to collapse
What am I missing? The official build guide does not mention any extra steps like custom/local manifests.
I got this resolved. The "permission denied" was the actual hint: I was running the build on a drive mounted with "noexec" (defaults), thus no binary could be executed, leading to the failing build. After remounting with "exec", the scripts/binaries could be executed and the build is running now.

Categories

Resources