[Guide] How to compile stock LG2X kernel from scratch - LG Optimus 2x

For some weeks I've been trying to set up an environment in which I'm able to compile the stock kernel for my LG2X on my own. Following various tips and hints were unsuccessful and several restarts were required until a kernel which was compiled on my own box was running on my phone. Since I had to patch together all the information because there was no complete guide available/findable, I'd like to list here all the steps from the beginning which I had to perform to boot my own compiled kernel. Maybe this is also useful for others. Note: again, this approach is for compiling STOCK kernel sources which are based on the public sources from LG. (The build process for CM is different and cannot be applied to stock kernels)
I began with a freshly installed Ubuntu 11.10 32bit (http://www.ubuntu.com/download/ubuntu/download) running in a VMware virtual machine. In it I entered a shell and switched to root to be able to perform the required actions:
Code:
sudo su -
The next step was to add the package-sources for the cross-compiler toolchain (see next step) and to bring the system up to the latest state.
Code:
add-apt-repository ppa:linaro-maintainers/toolchain
apt-get update
apt-get upgrade
This takes some time but after it's finished I installed the cross-compiler toolchain to be able to compile applications for the LGs ARM platform
Code:
apt-get install gcc-linaro
apt-get install gcc-linaro-arm-linux-gnueabi
After this I've been ready to begin with the source-works. I closed the root-shell and opened up a new one (required to make sure that all paths are correctly set and recognized again). Test it by executing
Code:
arm-linux-gnueabi-gcc --version
When this executed without error I started with downloading the sources for version 20q from http://www.lg.com/global/support/opensource/opensource-detail.jsp?detailCustomerModelCode=LGP990 into a new directory.
When the file 'LGP990_Android_Gingerbread_V20Q.zip' had finished downloading I unzipped the complete package by
Code:
unzip LGP990_Android_Gingerbread_V20Q.zip
resulting in three files. A README, one .tar.gz with the ROM sources and finally one .tar.gz with the kernel sources. To unpack the kernel sources I issued
Code:
tar xvzf P990_Stardop_IFX_GingerBread_V20Q_KERNEL.tar.gz
and the complete LG 20q kernel sources were finally located in a new 'kernel' subdirectory.
The kernel sources themselves are not yet ready to be compiled. This is because LG most probably has a different/special build environment and our standard environment produces errors and unbootable kernels. Some patching is required to succeed to a running kernel.
Firstly the compilation options for the wireless module have to be tweaked as the default settings break compilation at some unused variables in the source. This is set to be just treated as warnings for the wireless-module by applying following patch:
Code:
diff -u -r original/kernel/drivers/net/wireless/bcm4329/Makefile kernel/drivers/net/wireless/bcm4329/Makefile
--- original/kernel/drivers/net/wireless/bcm4329/Makefile 2012-01-31 04:36:22.000000000 -0800
+++ kernel/drivers/net/wireless/bcm4329/Makefile 2012-02-14 11:41:59.972467559 -0800
@@ -53,7 +53,7 @@
-DBCMLXSDMMC \
-DBCMPLATFORM_BUS \
-DSDIO_ISR_THREAD \
- -Wall -Wstrict-prototypes -Werror \
+ -Wall -Wstrict-prototypes -Werror -Wno-unused-but-set-variable -Wno-array-bounds \
-I$(SRCROOT) \
-I$(SRCROOT)/include \
-I$(SRCROOT)/shared \
Also the main Makefile requires tuning to contain the proper compilation options to produce code which correctly runs on the phone (thanks to spica1234 for providing me with the correct options).
Code:
diff -u -r original/kernel/Makefile kernel/Makefile
--- original/kernel/Makefile 2012-01-31 04:36:21.000000000 -0800
+++ kernel/Makefile 2012-02-28 13:21:20.038003539 -0800
@@ -323,12 +323,12 @@
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void $(CF)
-MODFLAGS = -DMODULE
-CFLAGS_MODULE = $(MODFLAGS)
+MODFLAGS = -DMODULE -mfloat-abi=softfp -mfpu=vfpv3-d16 -mtune=cortex-a9 -march=armv7-a -fno-common -fsingle-precision-constant -fno-gcse -funsafe-math-optimizations -ffinite-math-only -fgcse-las -fgcse-sm -fivopts -fbtr-bb-exclusive -fvect-cost-model -fmodulo-sched -fmodulo-sched-allow-regmoves
+CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)
LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
-CFLAGS_KERNEL =
-AFLAGS_KERNEL =
+CFLAGS_KERNEL = -mfloat-abi=softfp -mfpu=vfpv3-d16 -mtune=cortex-a9 -march=armv7-a -fno-common -fsingle-precision-constant -fno-gcse -funsafe-math-optimizations -ffinite-math-only -fgcse-las -fgcse-sm -fivopts -fbtr-bb-exclusive -fvect-cost-model -fmodulo-sched -fmodulo-sched-allow-regmoves
+AFLAGS_KERNEL = -mfloat-abi=softfp -mfpu=vfpv3-d16 -mtune=cortex-a9 -march=armv7-a -fno-common -fsingle-precision-constant -fno-gcse -funsafe-math-optimizations -ffinite-math-only -fgcse-las -fgcse-sm -fivopts -fbtr-bb-exclusive -fvect-cost-model -fmodulo-sched -fmodulo-sched-allow-regmoves
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
# 20100705, [email protected],[LGE_START]
@@ -544,7 +544,8 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -Ofast
+KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
endif
We're not finished yet. We've to create the correct kernel configuration and (again) apply some patches. I'm not so sure about these changes but the kernel refused to boot on my phone without them. It is again provided by spica1234 and contains a number of changes. I did not research which of these changes allowed to boot since most of them are generally useful and I didn't do the work trying them out one-by-one.
Code:
make ARCH=arm star_ifx_defconfig
Code:
--- .config.orig 2012-02-28 13:22:09.322001449 -0800
+++ .config.spica_working 2012-03-02 08:41:21.757696988 -0800
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.9-HP_2X_Xtreme_RC12-RevOTF
-# Tue Feb 28 13:22:09 2012
+# Tue Feb 28 13:24:15 2012
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -56,16 +56,16 @@
CONFIG_LOG_BUF_SHIFT=18
CONFIG_GROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
-# CONFIG_RT_GROUP_SCHED is not set
+CONFIG_RT_GROUP_SCHED=y
# CONFIG_USER_SCHED is not set
CONFIG_CGROUP_SCHED=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
# CONFIG_CGROUP_NS is not set
-CONFIG_CGROUP_FREEZER=y
-CONFIG_CGROUP_DEVICE=y
+# CONFIG_CGROUP_FREEZER is not set
+# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CPUSETS is not set
-CONFIG_CGROUP_CPUACCT=y
+# CONFIG_CGROUP_CPUACCT is not set
# CONFIG_RESOURCE_COUNTERS is not set
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
@@ -121,7 +121,8 @@
# GCOV-based kernel profiling
#
# CONFIG_GCOV_KERNEL is not set
-# CONFIG_SLOW_WORK is not set
+CONFIG_SLOW_WORK=y
+# CONFIG_SLOW_WORK_DEBUG is not set
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
@@ -146,10 +147,10 @@
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
-# CONFIG_DEFAULT_DEADLINE is not set
-CONFIG_DEFAULT_CFQ=y
+CONFIG_DEFAULT_DEADLINE=y
+# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="cfq"
+CONFIG_DEFAULT_IOSCHED="deadline"
CONFIG_FREEZER=y
#
@@ -1676,16 +1677,25 @@
# File systems
#
CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT2_FS_XATTR=y
+# CONFIG_EXT2_FS_POSIX_ACL is not set
+# CONFIG_EXT2_FS_SECURITY is not set
+CONFIG_EXT2_FS_XIP=y
CONFIG_EXT3_FS=y
CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
CONFIG_EXT3_FS_XATTR=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
# CONFIG_EXT3_FS_SECURITY is not set
-# CONFIG_EXT4_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
+CONFIG_FS_XIP=y
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
@@ -1769,7 +1779,22 @@
# CONFIG_ROMFS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
-# CONFIG_NETWORK_FILESYSTEMS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+# CONFIG_NFS_FS is not set
+# CONFIG_NFSD is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT is not set
+CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
#
# Partition Types
After these patches, were finally ready to compile the kernel
Code:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- STAR_TMUS_REV=TMUS_10 TARGET_STAR_HWREV=TMUS_E TARGET_MODEM=ifx
Now go grab some coffee. This takes a while. When it's finished, the compressed kernel-image is found in
arch/arm/boot/zImage
For the experienced kernel-hackers this might be enough. It wasn't for me and I wanted to have it easily installable like other kernels from the forum. So I downloaded a kernel zip package, eg. the one from spica1234 at http://forum.xda-developers.com/showpost.php?p=18253696&postcount=1
Any version will do as long as the kernel is contained in a .zip archive and installable via CWM. In my case I downloaded the kernel zip in a new directory 'build' and unpacked it.
Code:
unzip HP_2x_RC12-RevOTF-PRO.zip
This creates the subdirectories 'data', 'kernel', 'META-INF' and 'system'. Here we now have to replace the kernel and the kernel-modules with our self-compiled versions.
Code:
cd ~build/kernel
rm zImage
cp ~kernel/arch/arm/bootzImage ./zImage
cd ../system/lib/modules
rm *.ko
find ~kernel/ -name "*.ko" -exec cp '{}' . \;
cd ../../..
One last step, creating the zip which carries the new kernel:
Code:
zip -r -FS new_kernel.zip data/ kernel/ META-INF/ system/
This new_kernel.zip can now be flashed with CWM and should boot without problems.
For easier usage, I've attached the three patched files in the build_set.zip attachment so you don't have to patch the stock files by hand. Just extract it in the kernel directory and overwrite the existing files.
I hope I did not make any error in the compilation of this information and that it can be helpful for the interested reader.
Thanks goes especially to spica1234 and the material which he provided me to come through to a successful boot.

Very good explanation. I wish such useful info available b4 an year for me while i published 1st kernel at samdroid for my older device
Sent from my LG-P990 using Tapatalk

Bloody hell! I never realised it took so much to simply compile!!!! (I build JEE systems at work, but we scripted most of it, stuff that used to take a day and half now takes a few minutes).

Excellent guide Kosi! I'm a linux and kernel n00b and I understand your instructions pretty well.

Ubuntu 11 is not the best choice though I currently use it myself. v11 can cause problems, especially when not compiling kernels but compiling Android ROMs.
Ubuntu 10 is the better choice.
Also there is a VMware Android Developer Environment available for download, providing nearly all the necessary tools for compilation preinstalled and set-up.
http://forum.xda-developers.com/showthread.php?t=1386918
You can compile your kernel directly in the virtual machine p.ex. on your Windows 7 PC. That's the way I do it for my kernel. VMware Player is available for free, so you can just run the image.
Also install VMware tools, so you can set up a directory for exchanging files between your Windows Host and the virtual Machine Ubuntu. In this directory I usually paste the compiled kernel for further use under Win7 (making the CWM update ZIPs).
Just note that you should have a dual/quadcore CPU strong enough to host the linux and compile the kernel in an acceptable time (usually it takes me 1-2 minutes for complete kernel compilation under virtual machine ubuntu using -j24 option on make).

Can u guys add a bit in this tutorial, example, at which file / folder need to edit for OCUV, add swap function, enable ext4, etc.. seriously like this thread..
Sent from my LG-P990 using XDA

ghadap said:
Can u guys add a bit in this tutorial, example, at which file / folder need to edit for OCUV, add swap function, enable ext4, etc.. seriously like this thread..
Click to expand...
Click to collapse
As the topic of this thread is just how to get the stock kernel compiling I won't step into modifying it. Please open a separate thread for that.
Small hints though, OCUV requires deeper code changes, swap and ext4 can just be enabled in the kernel config.

Hey,
I follow the guide, but ubuntu (11.04 64 bit) doesn't find the pack
Code:
apt-get install gcc-linaro
so I can't install the pack
Code:
apt-get install gcc-linaro-arm-linux-gnueabi
Edit: With Ubuntu 11.10, it works.

Has anyone compiled and booted a kernel successfully with this guide? Can't get mine to boot, so before I look any further I'd thought I'd check if anyone else has gotten a workable kernel out of it.

TrymHansen said:
Has anyone compiled and booted a kernel successfully with this guide? Can't get mine to boot, so before I look any further I'd thought I'd check if anyone else has gotten a workable kernel out of it.
Click to expand...
Click to collapse
Which version it shows "arm-linux-gnueabi-gcc --version"
If its 4.6.2?
Sent from my LG-P990 using Tapatalk

Stefan Gündhör said:
Ubuntu 11 is not the best choice though I currently use it myself. v11 can cause problems, especially when not compiling kernels but compiling Android ROMs.
Ubuntu 10 is the better choice.
Also there is a VMware Android Developer Environment available for download, providing nearly all the necessary tools for compilation preinstalled and set-up.
http://forum.xda-developers.com/showthread.php?t=1386918
You can compile your kernel directly in the virtual machine p.ex. on your Windows 7 PC. That's the way I do it for my kernel. VMware Player is available for free, so you can just run the image.
Also install VMware tools, so you can set up a directory for exchanging files between your Windows Host and the virtual Machine Ubuntu. In this directory I usually paste the compiled kernel for further use under Win7 (making the CWM update ZIPs).
Just note that you should have a dual/quadcore CPU strong enough to host the linux and compile the kernel in an acceptable time (usually it takes me 1-2 minutes for complete kernel compilation under virtual machine ubuntu using -j24 option on make).
Click to expand...
Click to collapse
Ubuntu 11.xx is still a good choise if you want to build ROMs it is very easy to set it up (it is just one step more then on 10.xx)
i also use ubuntu 11.10 and it is working fine for me with building android ROMs
and of course it can take 1-2 minutes but it also can take up to an hour for a kernel to compile
it all depends on how good your computer is
on my home computer i build a kernel in a matter of seconds (clobber builds)
but when i am at my girlfriend my build (also clobber) on her craptop will take up to 20 minutes
nice guide kosi2801!

spica1234 said:
Which version it shows "arm-linux-gnueabi-gcc --version"
If its 4.6.2?
Click to expand...
Click to collapse
Yap. This
Code:
arm-linux-gnueabi-gcc (Ubuntu/Linaro 4.6.2-14ubuntu2~ppa1) 4.6.2
to be specific.

Trymhanson, Try to downgrade with 4.5.3. 4.6.2 is causing this unable to boot issue which was not happening earlier with 4.6.1
try this
apt-get install gcc-4.5-arm-linux-gnueabi
apt-get install g++-4.5-arm-linux-gnueabi
rm /usr/bin/arm-linux-gnueabi-gcc
ln -s /usr/bin/arm-linux-gnueabi-gcc-4.5 /usr/bin/arm-linux-gnueabi-gcc

Thanks, that did it. I also had to change the -Ofast flag back to -O2 as -Ofast wasn't recognized by the 4.5.3 version. So now I'm thinking maybe the -Ofast flag was to blame, so I'll try a fresh 4.6.2 install with -O2. Thanks again.

TrymHansen said:
Thanks, that did it. I also had to change the -Ofast flag back to -O2 as -Ofast wasn't recognized by the 4.5.3 version. So now I'm thinking maybe the -Ofast flag was to blame, so I'll try a fresh 4.6.2 install with -O2. Thanks again.
Click to expand...
Click to collapse
no may be ofast is not to blame but 4.6.2. Ofast was introduced with 4.6.0 and doesnt work with < 4..6. 4.6.2 doesnt even work with o2. And IMHO kernel compiled with 4.5.3 ismore stable
Sent from my LG-P990 using Tapatalk

http://db.tt/jN4fU9Vz
Thisis my recent sr3r2 patch created against original v20Q sourceswith Full OTF V2.0. Anybody interested can use it. It will transform to fully noo oc version of SR3r2
It wont work with CM but only stock v20q
Sent from my LG-P990 using Tapatalk

For anyone interested, currently I'm building with
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 4.6.1-7ubuntu2) 4.6.1
For my usage patterns the kernel works pretty well, but YMMV.
Thanks spica for the updated patch!

kosi2801 said:
For anyone interested, currently I'm building with
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 4.6.1-7ubuntu2) 4.6.1
For my usage patterns the kernel works pretty well, but YMMV.
Thanks spica for the updated patch!
Click to expand...
Click to collapse
Use my recent cflags its most stable and used in sr3r2
As you are using gnueabihf relace mfloat-abi=softfp with mfloat-abi=hard
Sent from my LG-P990 using xda premium

spica1234 said:
Use my recent cflags its most stable and used in sr3r2
As you are using gnueabihf relace mfloat-abi=softfp with mfloat-abi=hard
Click to expand...
Click to collapse
Thanks for the tip. I already thought about that some time ago but forgot again. Gained some additional performance points

Can someone upload a compiled stock v20q kernel flashable zip? Thanks!

Related

[KERNEL] marmite v10.6 final

Download latest marmite: this post
Download marmite for old versions e.g. Jellybean: version matrix
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Marmite once made me more sick than I'd ever been before or since.
But I still love it. #truefact
This kernel is based on the stock jb kernel. I have kept, added or tweaked the features I approve of:
- CFQ I/O scheduler (best performing)
- Ondemand, tweaked values
- BLN (no blinking), BLD and Fast-Charge
- more free RAM
- Bluetooth fixed and PM_FAST (keeps fast wifi even with screen off)
- Voodoo sound and colours with my settings for a stable whitepoint at all brightnesses.
- Zcache: compressed cache stored in ram, improves performance by retrieving cached pages from ram rather than flash
- MTP (explanation below the links)
- custom OC available
Voltage and OC quoted from a chip designer with 14 years industry experience: here.
What is ORD?: here.
Facebook by leap_ahead: here
What you need to know about Custom OverClocking [OC]: here.
Interesting discussion of gamma and RGB setting (voodoo): here.
My kernel doesn't wipe your cache or dalvic, so you can flash and reboot in less than a minute. Read this.
What is MTP?
Firstly, huge props to krfoy for making this work with the any-kernel script. Great work!
Microsoft's Media Transfer Protocol. It allows for dramatically faster transfers too the phone, so it is really good when you are copying over films or mp3 folders. What's really good is that you can continue to use your apps while these transfers happen. Faster? More functional? You bet! The limitations are that it is relatively unsupported on non-Windows platforms. However, you can investigate these possibilities: Ubuntu: here. --- --- Mac: here.
How to Select MTP/PTP
Go to Settings>Storage>(Hit capacitive menu button)>USB Computer Connection to select.
If your ROM doesn't have the switch there then check this tip from pigsan! or use the command line.
* * *
Big thanks: ...to the community! So many people supported my research that it's impossible to thank them all individually. Particular thanks to tchaari and Harbb. Credit goes to: _thalamus for getting me started with git, correcting my misconceptions about merging; KalimochoAz for CM; ezekeel for the incredible variety of mods; mathkid95 for ondemand tweaks; steve.garon for help with scripting; morfic for his advice and permission to use his colour settings; and supercurio for voodoo. Big thanks to krarvind for MTP, legend! Congrats to krfoy for enabling MTP via the any-kernel script. Nice work! Thanks to caliban2 for his consistent and unbiased feedback. Thanks to brainmaster, when I originally joined the forums for being so helpful. Hopefully I treat newcomers just as kindly.
Old versions: http://goo.gl/B0p8Z
TOOLCHAIN: Linaro a8 optimised by @Christopher83 here
SOURCE: http://github.com/bedalus/marmite
Download ICS version: v1.5b (For ICS 4.0.4)
NOTE: Opening AnTuTu breaks Deep Idle! If you have to use this app, disable DI until you can reboot.
Flashable Patch for BiggerMem: http://d-h.st/NSx
This kernel is based on the work of the cyanogenmod team:
Cyanogenmod base features:
- Merged to 3.0.39 from mainline.
- Voodoo sound v10
- "Biggermem" 404MB (morfic's idea if I remember right)
- BLN
- SLUB memory allocator*
- Deep Idle:- Kalim included code that limits the maximum frequency to 800MHz when DI is active. Great innovation Kalim! I have modified this code to fix the screen off frequency to 400MHz for efficiency.
Click to expand...
Click to collapse
I have enabled the things I like:
- CFQ scheduler. It's a tiny notch down from deadline in performance, but very consistent. Kalim disabled it in the nightlies where I got my base configuration, so I've brought it back.
- Deadline I/O scheduler adjusted for flash for lowest I/O latencies (thanks thalamus)
- BLX
- BLD
- Voodoo colour
- Gamma settings by morfic, thank him for giving permission
>>> Try these settings in Voodoo: raise all gamma to 20, then set RGB to 189-185-214
- SmartassV2 governor*
- Deep Idle locks to 400MHz regardless of your governor settings. This is an adaptation of kalim's code. Why? Because I proved that 400MHz is the most power saving state for Deep Idle. Excerpt from research: here.
- Removed pointless governors
- Removed noop scheduler
- Removed OC and custom voltage
- PM_FAST (fast wifi with screen off: power saving for downloading files, but slightly higher power use when idle compared to PM_MAX)
- 1.2 GHz step
- v0.6 onward have MTP working for ROMs that support it. Krarvind is the one who made this work (donate to him here), with the help of another dev, so kudos to them.
Version History
v1.5b: http://d-h.st/BhK
-Morfic's colours fixed!
-Merged to 3.0.39
-DI fixed at 400 MHz, the most power saving state, using thalamus' code, which is stable!
-ICS ONLY!!
v1.4d http://d-h.st/66r (ICS ONLY)
-stable
-probably last version I'll do for ICS
-DI fixed at 800MHz
-reorganised fixed DI code a little
-If you have no video on MIUI, check out this tip!
v1.4b http://d-h.st/l7X
-Made some code reorganisation based on thalamus suggestion
-Created a patch!
v1.4 http://d-h.st/MoU
-Made DI fix at 800 MHz using the performance governor which saves CPU cycles
v1.4_test http://d-h.st/UOt
-Possibly unstable, please try to collect last_kmsg
-Includes new 'performance DI': When Deep Idle state is called the governor switches to performance to save CPU cycles
-DI fixed at 800MHz for stability
-thalamus' DI spinlock patch
-Mathematically sensible smartassV2 tunable settings to save CPU cycles (working well)
v1.3c: http://d-h.st/HJY
-Stable
-Minor bugfix release (bugs in freq stepping that were my own faulty code merges)
-_thalmus' DI patch
-If you have no issues with 1.3b skip this, and wait for v1.4
v1.3b http://d-h.st/n55
-Frequency stepping bugfix
-Stable (I really mean it this time ) ...so I deleted the other download links, apart from the early _thalamus based one.
-Shrank the download to a normal size: I'd forgotten to remove the redundant zImage from the any-kernel script. (I don't use that since I flash a boot image).
v1.3
-thalamus' mutex to spinlock patch has been integrated. I've tested this, as I'm sure thalamus has, and DI of course still works fine, but because this is the first time anyone has touched the DI code in a few months, I think it's safer to call this a TEST release.
-I fixed the minimum fq getting stuck 200MHz issue, which was an issue actually caused by myself: when I was altering the available OC I failed to adjust all the levels correctly.
-Having trouble with 200MHz? >Read this<
All previous releases have been pulled. Use the current stable please! Remember: enjoy marmite!
Big thanks: ...to the community! So many people supported my research that it's impossible to thank them all individually. And big thanks to the developers who have selflessly helped a total noob get his kernel off the ground. Credit goes to: KalimochoAz for representing cyanogenmod in this forum and his tweaks; _thalamus for his patience and getting me started with git and modules, correcting my misconceptions about merging; ezekeel for the mods; mathkid95 for ondemand tweaks; steve.garon for help with scripting; morfic for his advice and permission to use his colour settings; and supercurio for voodoo. Big thanks to krarvind for MTP, legend!
SOURCE: http://github.com/bedalus
Note: If you want to repost this guide, feel free to download it here (text file, includes all XDA formatting.) Please give credit.
Why would you want to build a kernel yourself?
Click to expand...
Click to collapse
Have you read this: http://forum.xda-developers.com/showpost.php?p=21006133&postcount=1144
In that spirit, I'm going to attempt to write a plain-English tutorial on what to do to build this kernel. In fact, change one or two URLs, and you could build practically any kernel!
Note: I'm assuming you're on a PC here. I'm also assuming this isn't your first trip to linux-land, and you've at least used the terminal a few times before now. I'm also going to assume that even if you are a noob, you're not mentally sub-normal.
Note2: If this is your first time building a kernel, you may want to print this out, and go slowly, and if you get stuck, post about it in the thread! It will help me improve the guide.
What makes this different to other tutorials?
Click to expand...
Click to collapse
I'm a noob at building, but a professional at teaching. It's literally my job! In my noobishness, I made good records of pretty much every step, and I've got lots of time for explaining what each step actually does.
THE STEPS
Got a computer?
Click to expand...
Click to collapse
You'll need one to compile stuff. "For Gingerbread (2.3.x) and newer versions, including the master branch, a 64-bit environment is required." (source)
OK. You're probably thinking of compiling a kernel for ICS or higher right? Is your computer only 32 bit? Pull the processor off the motherboard and count the pins. Just kidding. It won't matter if it is AMD or Intel, but it needs to be a 64 bit processor. I can compile a kernel with just 2GB of RAM and my processor is approaching its 9 year. Even with this lousy set-up, compiling a whole kernel from scratch takes only five minutes.
Install Ubuntu 10.04 64-bit. (Click on this link to download the install CD.)
If you've got a spare hard drive, use the whole thing. If you're good at partitioning, you might consider putting the linux swap partition on a separate disk. You'll want it to be at least 8GB. Putting it on a separate disk will speed things up.
If you don't have a spare disk, you're going to have to resize a partition of an existing OS, to make some new space for Ubuntu. Lets say a minimum of 12GB for the OS plus 8GB for the swap. The more space you can give to the OS, the easier your life will be if you're serious about building stuff.
At the end of the installation it will ask to install a boot-loader. This should be on sda (not sda1!) but you may need to adjust your BIOS to point at the right hard-drive if you later find it doesn't boot into Ubuntu when you restart. Don't worry about Windows, Ubuntu provides a boot menu, so you have the option of booting to Windows instead.
Once Ubuntu is installed, reboot then open a terminal and sort out your credentials:
Code:
sudo passwd root
Type in the password you set during the install, then decide on a password for the root user, and enter it once, then again for confirmation. It can be the same as your user password if you like.
Do some updates (this could take a while):
Code:
sudo apt-get update && sudo apt-get dist-upgrade
When it's finally finished, you'll have to reboot, then repeat until there's no updates left.
You're ready to set up a build environment!
Click to expand...
Click to collapse
First, you need a whole bunch of packages. You could copy and paste this into your terminal:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" && sudo apt-get update && sudo apt-get install sun-java6-jdk
That's java sorted.
Next up is the dependencies for compiling stuff:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32ncurses5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libsdl-dev libesd0-dev libwxgtk2.6-dev libncurses5-dev lib32z1-dev gcc-multilib git-core && sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
Make sure ADB is initialised:
Code:
gedit /etc/udev/rules.d/51-android.rules
and copy the below into a blank text file, then edit both instances of <username> to your Ubuntu username (lower-case!) and no chevrons: ="<bedalus>" is wrong. You want ="bedalus"
Code:
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
Now save the file!
Get hold of a Cross-Compiler
Click to expand...
Click to collapse
Follow this link to Mentor Graphics Sourcery CodeBench LITE and do a free signup to get the download link. You can get hold of other ones, like Linaro or Google's own, but I'm using this as an example, because it's the one I use, and Ezekeel published some R&D here that showed there was no measurable benefit to one toolchain over another.
When you've downloaded it, you need to copy it to /opt:
Code:
cd /home/<username>/Downloads
cp arm-some-date-some-version-some-arch.tar.bz2 /opt
Note- Obviously that's not the actual name of the file! But you can see what it's really called when you download it.
Now go to /opt and unpack it:
Code:
cd /opt
tar xjf arm-some-date-some-version-some-arch.tar.bz2
So I've got all the tools. Now what?
Click to expand...
Click to collapse
So now you need to get some source code. You can use 'git clone' if you don't plan on publishing your kernel. But if you've made some modifications and want to share your end result, you need to obey the GPL terms for the linux kernel, which is Open Source, meaning that you are required to make your source available publicly.
Go to github: https://github.com/
...and sign up. It's just a free registration provided you are non-commercial. Github has some useful getting started tutorials, which I suggest you follow:
https://help.github.com/articles/set-up-git
(just follow that first page for now. I will walk you through git in a bit...)
Next, fork a repo:
Go to whichever kernel you like: https://github.com/bedalus/bedalusKERNEL
I'm using mine as an example. Look for the big 'Fork' button.
You've now got your own copy on github, and you can do whatever you like with it, without affecting the original.
However, it's no use if it exists only in the cloud. You need to get a local copy. You'll also want something called a 'remote tracking branch', which will enable you to keep up-to-date with the changes going on in the original repository that you have forked-off from.
Critical Step:
Click to expand...
Click to collapse
Shout 'fork-off!' at the top of your voice.
Uh... okay. Now, to get a local copy, and set up your remote-tracking branches, execute:
Code:
cd /home/<username>/
mkdir mykernel
...you can name your new directory whatever you want. It doesn't have to be 'mykernel', then:
Code:
git clone https://github.com/<your github username>/bedalusKERNEL.git
In the above, put your git username, and substitute bedalusKERNEL.git for whatever your fork is called. You can actually copy and paste the URL from the top of your new github repo's page if you want.
It's going to download about 800MB if I remember correctly. This will take a while, so go have some marmite on toast.
When that's done, you're ready for the remote-tracking branch:
Code:
cd bedalusKERNEL (or whatever your fork is called)
git remote add upstream https://github.com/bedalus/bedalusKERNEL.git
git fetch upstream
The 'git remote add upstream' creates a new branch called upstream, and any changes that the original developer uploads to github can be fetched to your machine with the 'git fetch upstream' command. Notice how this time, the download time is much shorter? That's because of 'delta downloads' which only downloads the differences between what you have, and what they have. (There's some technical detail here.)
Git Tip No. 1: What branches do I have?
Click to expand...
Click to collapse
You can now enter:
Code:
git branch
...to see all your branches. At this point there should be 'origin' and 'upstream'.
Git Tip No. 2: How do I change branches?
Click to expand...
Click to collapse
Changing branches (you might as well do this now just to have a little go):
Code:
git checkout upstream
That will move you onto the upstream branch, as long as you haven't made any 'uncommited' changes in origin. (More on that later.) Change back to origin with:
Code:
git checkout origin
Git Tip No. 3: How do I rename a branch?
Click to expand...
Click to collapse
You might want to rename your branches to help personalise them, just to make remembering which is which a little bit easier. To change origin to 'my_version' do this:
Code:
git branch -m origin my_version
You can change upstream to 'their_version' or something else if you want to. It won't stop anything from working.
More Git Tips later. Let's sort out a build script. If you tinker with any code, you'll inevitably break stuff, and need to fix it, and then need to try building again... So, having a build script is going to save you a lot of time, because there are several steps that can be automated.
Here's how the start of my script looks:
Code:
#!/bin/sh
cd /home/dave/mykernel
git branch
read -p "Correct branch? [Y/N]: " -n 1
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo -e "\n"
exit 1
fi
This is just a little precaution that I put in to give myself the chance to abort the build before it starts if I'm on the wrong branch. If I don't hit y then the script aborts, and I can checkout the right branch, then restart the script.
Code:
echo -e "\nSTARTING...\n"
The \n prints a new line, then on that new line the message 'STARTING...' and then begins another new line. If you put \n\n you can print a blank line. The echo command is a good way of putting notices in a script so you know what stage it is at.
Code:
export PATH=$PATH:/opt/toolchain/bin/
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-none-eabi-
If you put these lines in your script, it sets 'environment variables' that tells the make program where to find the compiler, and what processor it's compiling for (ARM).
If you now save your script in the /mykernel directory you created earlier, git can keep track of it as well as the files integral to the kernel. Save it as whatever you like, e.g. "myscript.sh"
...It's important to have the .sh extension so the system knows it is a script.
To make your script executable, run:
Code:
chmod a+x myscript.sh
Before you execute the script, you need a .config file in the mykernel directory. If you've cloned my repo, you can get a working one by executing:
Code:
cp arch/arm/configs/crespo_release_defconfig ./.config
...this command will only work properly if you are in the mykernel directory when you execute it.
You can mess with this config file if you like! But it's very easy to break the kernel. However, you can always just copy the crespo_release_defconfig again.
Now, to execute the build script run:
Code:
./myscript
If you execute your script, your compiler will now build the kernel. It will take time, but even on my ten-years-old PC it takes less than ten minutes from scratch.
The compiler will spit out a lot of messages. Most of the time it's telling you that it has compiled an object (i.e. a .o file, which will all be linked up later to form the kernel) and sometimes you'll see warnings, which is the compiler telling you it thinks something might be wrong. Don't worry, most of the time the compiler is just being over-cautious.
If the compiler hits a real problem with the code, it will print an error, and tell you what file, and what line, and how far along that line it managed to get to before it didn't know what to do. I'll get back to this later. For now, let's assume everything compiled.
You'll see a message about the zImage being created. That's the kernel. You can't use it as it is, you need to put it into a boot.img so you can flash it.
I find it useful to add this command in my build-script:
Code:
ls -l /home/dave/mykernel/arch/arm/boot/zImage
ls -l means list with long format. It'll print out the entire contents of a directory with size, time, permissions, etc. if you execute it in a directory, or point it to a directory. However, in the command above, I've pointed it specifically at the zImage file, so it only prints out the details for that. This is so I can check the time. If the time is from yesterday, I can see quickly that there has been an error in the build, and the zImage is still the same one I built yesterday, or an hour ago... etc. depending on the time-stamp printed out.
If you get a 'No such file' error, it's because there is no old zImage, because you haven't ever successfully built one yet.
If you sat and watched the entire thing build, then the timestamp should show the current time, minus a few seconds.
How do I make this zImage into a CWM flashable .zip file?
Click to expand...
Click to collapse
Yay! You've built a kernel. Now you need to make everybody else flash it to their phones too
To do this you need to put it into a boot.img, and then into a .zip file.
Making the boot.img
Click to expand...
Click to collapse
Download this: http://d-h.st/wVZ (make-boot necessary files)
It's a small download. It's some very simple tools that can split an existing boot image into a ramdisk and zImage, and can also stitch them back up.
Move mkboot.zip into your mykernel folder, right click on it, and select 'Extract Here'. You can now delete mkboot.zip. There is a tool called unbootimg, that can take apart existing boot.img files, I've made things simple by including my own ramdisk, which is compatible with AOSP and CM ROMs. That file is called cyan2disk_new.cpio.gz
We now need to add some new stuff to the script to stitch our zImage and ramdisk together.
If you've not already added the ls -l command I mentioned above, also add this now. Then:
Code:
cp /home/dave/mykernel/arch/arm/boot/zImage /home/dave/mykernel/mkboot/
cd /home/dave/mykernel/mkboot
./mkbootimg --kernel zImage --ramdisk cyan2disk_new.cpio.gz --cmdline 'no_console_suspend=1 console=bull's --base 0x30000000 --pagesize 4096 -o boot.img
Remember, your username is not dave! Unless it is. Make the appropriate changes to the path.
How do I make the CWM flashable .zip file?
Click to expand...
Click to collapse
We're nearly there! This bit is relatively painless. At this point you could save and run the script to check that mkboot is working. If it has worked you can use the same ls -l trick from before, but this time target the boot.img file you just created. If the time-stamp is fresh, it means your boot.img is correct.
TIP: If you haven't switched branches, or run 'make clean', all your .o files are unchanged. The make program keeps track of changes, and only recompiles .o files when the corresponding .c file has been altered. If nothing has changed, your build script will execute very quickly!
To make a flashable .zip file, the easiest thing to do is modify an existing .zip file. You can download my kernel for simplicity, since it already has the necessary script for flashing the entire boot partition. (Most kernels here use koush's any-kernel script, which updates only the zImage and keeps the boot partition's existing ramdisk, so if you try to use another kernel .zip as a template, make sure you correct their updater-script. Using my ramdisk and kernel script will also ensure you keep MTP!)
Once you've downloaded my kernel you should extract it in your home folder, then rename the directory to something like 'myzip'
Now add these lines to your build-script:
Code:
cp /home/dave/mykernel/mkboot/boot.img /home/dave/myzip/boot.img
cp /home/dave/mykernel/drivers/scsi/scsi_wait_scan.ko /home/dave/myzip/system/modules/
"What's that second line? With the .ko file?" I hear you say. Depending on what modules you build, you'll need to copy all of them to the folder specified above. Fortunately, when the kernel finishes building, it tells you what modules have also been built. If you don't want modules in your kernel, you can remove the second line above. However, you must edit your .config file: Open it in gedit, use CTRL+F to open the find dialogue, then type "=m" Now, change every one you find into a "=y" ...so now instead of building modules, the kernel will now incorporate all that code into the zImage instead.
Finally, add this line to your build-script:
Code:
7z a -r -tzip /home/dave/mykernel.zip /home/dave/myzip/*
Run the script again. if everything has gone smoothly, then you now have a flashable .zip in your home directory!
Congratulations!
* * * * * * * * *
More git tips!
Click to expand...
Click to collapse
I've compiled a list of commands you may find handy when getting to know git.
Add a remote branch and track it
git remote add ezekeel git://github.com/Ezekeel/GLaDOS-nexus-s-ics.git
git fetch ezekeel
git checkout --track -b bln ezekeel/bln
Merge in the changes
git merge bln
Resolve conflicts
git mergetool
List local branches
git branch
List remote branches
git branch -r
Switch branch
git checkout branch_name
Rename a branch
git branch -m old_branch_name new_branch_name
View log with short sha1 hash
git log -10 --pretty=format:"%h - %ar: %s"
Restore to a particular point
(IMPORTANT! Don't do this if you've already pushed your commits to github!)
git reset --hard <sha1 hash>
Restore to your last commit
git reset --hard HEAD
Restore to one commit before your last commit:
git reset --hard HEAD^
Restore to two commits before your last commit:
git reset --hard HEAD^^ (etc.)
As long as you haven't pushed to github,
squash all your recent commits into one:
git rebase -i <sha1> ...then change push to squash (or fixup) for all except the first one
git rebase -i --abort (to abort!)
Add .file (i.e. hidden file)
git add .file (simple!)
Add all new and modified files
git add .
Deleting files
(i.e. after doing rm <files>)
git add -u (git will note which files have been deleted)
Bring files from a directory in another branch
git checkout cyanogenmod drivers/cpufreq/
Tells you what changes you've made so far
git status
Commit your changes
git commit (type in your notes about what you did, then CTRL+X then Y to save)
Sync your commits to your github repo
git push <repo_name> <branch_name>
Delete a remote branch
(WARNING: This will delete the entire branch from github
Note: You cannot do this to the default github branch, but you can change the default branch in the admin tab on the website)
git push <repo_name> :<branch to be deleted>
General tips! File management, searching... etc.
Click to expand...
Click to collapse
Find a file (useful for troubleshooting in some situations)
find /home/dave/ -name 'buildlean.sh'
(searches the home folder and subdirectories for 'buildlean.sh')
Find within any *.c file, the text "s5pv210_driver" (good for finding bits of code)
find ./ -type f -name *.c | xargs grep s5pv210_driver
Find within any file, the text "s5pv210_driver" (good for finding bits of code)
find ./ -type f | xargs grep s5pv210_driver
bedalus said:
Thalamus recently changed the way he compiles his kernel. This was his previous stable release, based on Samsung source code.
The cyann.mobi adds bln, touchwake. Features that thalamus has said are unnecessary.
Click to expand...
Click to collapse
bedalus Hello, I can add this kernel to the list I made on the kernel and rom?
Yes, but be sure to give credit to the right people.
I've decided to attempt to build my own version of thalamus' kernel with some mods.
If I'm not too retarded, hopefully i can achieve this in the next few days.
As a result of learning to manage git and c, I'll have less time for forum posts.
bedalus said:
Yes, but be sure to give credit to the right people.
I've decided to attempt to build my own version of thalamus' kernel with some mods.
If I'm not too retarded, hopefully i can achieve this in the next few days.
As a result of learning to manage git and c, I'll have less time for forum posts.
Click to expand...
Click to collapse
Looking forward to this
Sent from my Nexus S 4G using xda premium
bedalus said:
Yes, but be sure to give credit to the right people.
I've decided to attempt to build my own version of thalamus' kernel with some mods.
If I'm not too retarded, hopefully i can achieve this in the next few days.
As a result of learning to manage git and c, I'll have less time for forum posts.
Click to expand...
Click to collapse
This is good news, Dave. I've been hearing a lot of good things about the new stable release of thalamus in the thread for his kernel that I've been moderating. However, a lot of people including me will be missing BLD and BLN so it's nice to see how it would perform with these mods. With those two plus Voodoo sound that's already cooked in the last release, this may be a kernel to be reckoned with. Cheers!
Sent from my Nexus S
bedalus said:
Thalamus recently changed the way he compiles his kernel. This was his previous stable release, based on Samsung source code.
The cyann.mobi adds bln, touchwake. Features that thalamus has said are unnecessary.
Click to expand...
Click to collapse
waiting for bedalus thalamus base plus addons
an interesting benchmark would be bedalus vs thalamus
Off-Topic: I've been discussing with thalamus about the need for a dalvik wipe before flashing a kernel, and he had some pretty convincing arguments against it. You can read his statement here.
Just wanted to get your opinion on this, if you have time. Thanks, Dave.
Sent from my Nexus S
jjhrrsn said:
Looking forward to this
Sent from my Nexus S 4G using xda premium
Click to expand...
Click to collapse
+1. Me too! Would be nice to have voodoo color included.
ironia. said:
waiting for bedalus thalamus base plus addons
an interesting benchmark would be bedalus vs thalamus
Click to expand...
Click to collapse
Thalamus wins,
REMATCH!
Thalamus wins again.
Good news, BLN added. I now know what I'm doing with the code merges, so more features to come soon.
Later on I may start trying to make some original mods, but for now we'll focus on existing ones.
Thanks to thalamus for his help with some extremely noobish questions,
...thalamus' latest but with added BLN and marmite.
To Do
Get organised
Push back to github so changes can be observed
Get some sleep
bedalus said:
Thalamus wins,
REMATCH!
Thalamus wins again.
Good news, BLN added. I now know what I'm doing with the code merges, so more features to come soon.
Later on I may start trying to make some original mods, but for now we'll focus on existing ones.
Thanks to thalamus for his help with some extremely noobish questions,
Here: http://d-h.st/Df6
...thalamus' latest but with added BLN and marmite.
To Do
Get organised
Push back to github so changes can be observed
Get some sleep
Click to expand...
Click to collapse
Lol at marmite.
Sent from my Nexus S®
apatal said:
Off-Topic: I've been discussing with thalamus about the need for a dalvik wipe before flashing a kernel, and he had some pretty convincing arguments against it. You can read his statement here.
Just wanted to get your opinion on this, if you have time. Thanks, Dave.
Sent from my Nexus S
Click to expand...
Click to collapse
Yeah, i agree with thalamus. I only wipe when switching ROMs.
I modified the script so it doesn't bother wiping cache or dalvic-cache
This makes flashing much more painless.
If anyone has trouble, reboot into recovery and wipe cache.
apatal provides some handy scripts for wiping: http://forum.xda-developers.com/showthread.php?p=19746141
To be completely honest, I wouldn't have been so helpful had I known you intended to release this, specially without saying anything to me about it.
I fully accept that the GPL doesn't require permission but to ask is both the polite and respectful thing to do.
The majority of others have always when they have wanted to release my work with superficial alterations...all it takes is 'I plan on doing this, what do you think?'
I have never had any objection, but to be asked first is just common courtesy, specially when you are asking me for help! You had plenty of chance to mention it whilst I was assisting you with your queries via email.
But hey...
_thalamus said:
To be completely honest, I wouldn't have been so helpful had I known you intended to release this, specially without saying anything to me about it.
I fully accept that the GPL doesn't require permission but to ask is both the polite and respectful thing to do.
The majority of others have always when they have wanted to release my work with superficial alterations...all it takes is 'I plan on doing this, what do you think?'
I have never had any objection, but to be asked first is just common courtesy, specially when you are asking me for help! You had plenty of chance to mention it whilst I was assisting you with your queries via email.
But hey...
Click to expand...
Click to collapse
From what i see here... Give him the big daddy credits as you used his sources...
_thalamus said:
To be completely honest, I wouldn't have been so helpful had I known you intended to release this, specially without saying anything to me about it.
I fully accept that the GPL doesn't require permission but to ask is both the polite and respectful thing to do.
The majority of others have always when they have wanted to release my work with superficial alterations...all it takes is 'I plan on doing this, what do you think?'
I have never had any objection, but to be asked first is just common courtesy, specially when you are asking me for help! You had plenty of chance to mention it whilst I was assisting you with your queries via email.
But hey...
Click to expand...
Click to collapse
Sorry, links pulled.
bedalus said:
Sorry, links pulled.
Click to expand...
Click to collapse
Too bad i was diggin the marmite just now lol
Sent from my Nexus S®
I feel quite bad now. I don't know what possessed me to release without getting the okay first. Eager to show off i think.
I'll get this thread locked as a lesson to myself!
bedalus said:
I feel quite bad now. I don't know what possessed me to release without getting the okay first. Eager to show off i think.
Click to expand...
Click to collapse
We're not perfect we have our own mistakes in life
Sent from my Nexus S®
Actually thalamus is fine for me to release this! Yay. Thanks thalamus.
Links will reappear when the OP is properly organised and credited.

[DEV][KERNEL SOURCE]Patched 3.0.21 - Bootmode Aware

Hi Folks
I thought I throw this one up for good measure.
Archos Kernel 3.0.21
I've made a couple of changes which are outline in the README2 file in the repo, but a quick summary.
Patched arch/arm/mach-omap4/omap4-reboot-reason.c to enable bootmode system property setting from the kernel command line which is required by CWM-SDE
I also back-ported the arch/arm/mm/proc-v7.S from the android-omap-3.4 kernel which means the kernel can be built using the standard android aosp toolchains Although It's probably still better to use Linaro Optimized!!
github.com/trevd/android_kernel_ti_archos.git
README2
Code:
android linux kernel 3.0.21 based on original archos sources found at
http://gitorious.org/archos/archos-gpl-gen9-kernel-ics branch: linux-ics-3.0.21
Android boot mode awareness:
----------------------------
changes made to arch/arm/mach-omap2/omap4-reboot-reason.c to enable correct setting
of android system property ro.bootmode.
designed to be used in conjunction with roms created using device files locating in
https://github.com/trevd/android_device_ti_archos.git
Proc-v7.S changes
-----------------
I've backported arch/arm/mm/Proc-v7.S from the android-omap-3 kernel 3.4 branch, this
was done to allow the kernel to be built using the standard android toolchain.
Building
--------
Clone the android aosp toolchain
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Using the Bourne Again Shell ( bash ) export an alias to make cross compiling easy
alias make-arm='<toolchain path>/arm-eabi-4.6/bin/:$PATH ARCH=arm SUBARCH=arm CROSS_COMPILE=arm-eabi- LOCALVERSION_AUTO=n make'
make-arm distclean && make-arm mrproper
make-arm ti_archos_defconfig
make-arm -j$(grep -c processor /proc/cpuinfo)
Out of tree drivers
-------------------
PowerVR Kernel Modules are not included in this release, they are available from omapzoom android aosp
repo located at git://git.omapzoom.org/device/ti/proprietary-open.git. this repo also contains the matching
userland binary blobs, versions of which exist for Gingerbread, ICS and JellyBean. See device tree documentation
for further details ( https://github.com/trevd/android_device_ti_archos.git )
Hi Trevd !
Thank you very much for your great work ! :good:
....how much I wish I could be useful ( I am currently with hands tied :laugh: - I have not my tablet ....but I'll be back as soon as I will receive my tablet from reparation centre ! )
Good luck & keep up your awesome work ! :good::good::good:
Wifi Drivers info and resources.
Hi Folks.
Along with building the PowerVR Drivers out of tree, It should be also possible to use the latest drivers for the wireless chip
This Page [ linuxwireless.org ] provides some nice documentation with the links to the repo's contain the lastest code along with what looks like some useful android related utilities

Cifs

Cifs manager, any got out could build a working cifs.ko file?
Sent from my LG-D955 using XDA Premium 4 mobile app
tutreak said:
Cifs manager, any got out could build a working cifs.ko file?
Sent from my LG-D955 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Sorry for knocking a 9 month old Thread , but I am trying to make Cifs Manager work for my Gflex.
i'm running Android 4.4.2 , Kernel 3.4.0 Build KOT49I.D95520a .
I've Downloaded the Kernel Source tar.gz from LG : LGD955_Gflex_Kikat_V20a_Kernel.tar.gz
And I just cannot seem to produce a cifs.ko module that is succesfully loaded with insmod on the device.
I keep getting this in dmesg: no symbol version for module_layout
I was trying to use this thread for instructions: http://forum.xda-developers.com/showthread.php?t=2531407&page=3
and this http://forum.xda-developers.com/showthread.php?t=2531407&page=3
@TheWizardOfROMs Maybe if you have some time you can give some useful advice
@ forrestgump2000 How did you do it for LG G2 ? It should be almost the same for the Gflex, could you perhaps lend a hand? Please?
I am trying to build it on Mac OSX , installed with macports gcc4.9 , using CROSS_COMPILE=/Downloads/android-ndk-r10c/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi- , ARCH=arm,SUBARCH=arm
make EXTRA_CFLAGS=-fno-pic M=fs/cifs Tells me about some versioning , then I run make modules before to create that file and then it doesn't complain.
Running out of ideas..... (will try a Ubuntu VM soon if nothing works...)
Thank you!
2nd really need this for off device storage
Work documentation
I've sent an e-mail to LG , let's see what happens....
"
Dear LG OpenSource Team,
I am currently trying very hard to compile a new module for my current kernel:LGD955_Gflex_Kikat_V20a_Kernel.zip
My work environment is the following:
Vmware Ubuntu 14.01 LTS , gcc 4.8
I have unpacked your kernel source and tried the following:
cp arch/arm/configs/z-open-com-perf_defconfig .
make z-open-com-perf_defconfig prepare headers_install scripts ARCH=arm CROSS_COMPILE=arm-linux-androideabi- O=build KERNELRELEASE=3.4.0-perf-g551cabf
make menuconfig ARCH=arm CROSS_COMPILE=arm-linux-androideabi- O=build KERNELRELEASE=3.4.0-perf-g551cabf
Chosen Network File System Support -> CIFS (M) and saved.
make modules ARCH=arm CROSS_COMPILE=arm-linux-androideabi- O=build KERNELRELEASE=3.4.0-perf-g551cabf
adb push fs/cifs/cifs.ko /data/local/modules/
chmod 644 /data/local/modules/cifs.ko
insmod /data/local/modules/cifs.ko gives this Failure Message : … failed (Exec format error)
dmesg has this message inside: no symbol version for module_layout
A little info after building the module:
[email protected]:~/Downloads/kernel$ modinfo build/fs/cifs/cifs.ko
filename: /home/adi/Downloads/kernel/build/fs/cifs/cifs.ko
version: 1.78
description: VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
license: GPL
author: Steve French <sfr[email protected]>
srcversion: 3F86E0A9406EADE34D14793
depends:
intree: Y
vermagic: 3.4.0-perf-g551cabf SMP preempt mod_unload modversions ARMv7
parm: CIFSMaxBufSize:Network buffer size (not including header). Default: 16384 Range: 8192 to 130048 (int)
parm: cifs_min_rcv:Network buffers in pool. Default: 4 Range: 1 to 64 (int)
parm: cifs_min_small:Small network buffers in pool. Default: 30 Range: 2 to 256 (int)
parm: cifs_max_pending:Simultaneous requests to server. Default: 32767 Range: 2 to 32767. (int)
parm: enable_oplocks:Enable or disable oplocks (bool). Default:y/Y/1 (bool)
[email protected]:/ # uname -r
3.4.0-perf-g551cabf
[email protected]:/ # uname -a
Linux localhost 3.4.0-perf-g551cabf #1 SMP PREEMPT Tue Apr 29 00:20:47 KST 2014 armv7l GNU/Linux
I am running out of ideas , could you please help ? What am I doing wrong? I love this Phone and want to learn more about it’s inner workings but when compiling a module fails , it leaves me a little hopeless…
Thank you in advance,
With kind regards,
Adrian
"
Fingers crossed

[KERNEL][exp: (3.1.10) #5] Firtecy Kernel - a modified Kowalski Kernel

This is an EXPERIMENTAL Kernel that continues the work of @pengus77, but with some additions i make. That means a huge thank to pengus77! Please check his thread http://forum.xda-developers.com/showthread.php?t=2097788
This kernel is completely based on his latest release.
This kernel only supports newbl and will only work on roms with 3.1 support (these are atm only 4.4 (aka KitKat) Roms and tonyps TheRom that is compatible with the 3.1 kernel
Features:
Features from the kowalski kernel:
3.1.10 Kernel Version
bcmdhd wifi driver
Dynamic FSync
Overclock to 1.5 GHz (Not all phones work well with 1.5 Ghz!)
Undervolting
MultiCore Sched PM
Auto Hotplug
Fast charge
Wifi PM
and many more ...
Features added by me:
PKSM as enhanced KSM module
Built in ZRAM Modul (that makes it possible to use the android default zram solution)
Possibility to use deferred_timer for (P)KSM
0, 16 or 32 MB Ramhack
Support for extra free kbytes tunable (more a ROM dev feature)
Custom vibration force/strength through sysfs
120MHz and 168 MHz frequencies for more battery savings during wakelock
Known bugs:
Camera Bug
Gyro does not work properly
If you want to report a new kernel bug, you must describe your problem in detail, post your kmsg and last_kmsg (if available) (you can found them under /proc/kmsg and /proc/last_kmsg) otherwise the rule is: no log = no issue
Downloads:
This is more a personal kernel build. I have built these kernels for weeks for myself and used them in private. Now i just want to share them with you guys!
You can download the kernels here: https://s.basketbuild.com/devs/firtecy/p990/kernel/3.1/ They are labeled like this: firtecy_kernel_X-N.zip where X is either exp for an experimental kernel release and stable for a stable kernel and where N is the build number (this number is always incremental!)
Sourcecode:
You can find the sourcecode at github: https://github.com/Firtecy/kowalski/ the branch is exp. The config file is: "kowalski_defconfig"
The intention of this thread is to continue the 3.1 kernel development pengus started. Development related questions or discussions are appreciated
Have fun!
And to quote pengus77:
On a side note... i'm not really responsible if you decide to test it and your phone melts... right?
Thanks to:
@hjunii for bringing up 3.1 Kernel
@pengus77 for the kowalski kernel
XDA:DevDB Information
Firtecy Kernel - a modified Kowalski Kernel, Kernel for the LG Optimus 2x
Contributors
Firtecy, pengus77, hjunii, djnoxd
Kernel Special Features:
Version Information
Status: Beta
Current Beta Version: 3.1#5
Beta Release Date: 2014-08-25
Created 2014-10-31
Last Updated 2014-10-31
Changelog:
firtecy_kernel_exp-5 - 25.8.2014
Added intellactive governor (thanks to @faux123) and powersave
Some bug fixes
Added sync framework and exfat support (but not active for the moment)
Added a "kowalski touch driver" and dt2w files (since they are not stable enough for now, they are disabled)
The reason why I disabled those things is that I didn't had the time to test them. If you want to test them you have to build your own version. Especially for other developers that can be interesting.
Click to expand...
Click to collapse
firtecy_kernel_exp-4 - 25.6.2014
minor updates/fixes from other kernels
Added the min screen on freq back
Added a sysfs attribute to change the min screen on freq
when disabling pksm, it will be disabled completely
Screen on min freq
If your screen is on, this frequency is the lowest that will be used. If your screen goes off for whatever reason the cpu will go to the normal min frequency.
Note: It seems like 120MHz and 168MHz are stable even for screen on, but since there was the question if i can add it, here you go:
How to change the value:
Code:
echo [value] > /sys/module/cpu_tegra/parameters/cpu_screen_on_min_cap
You have to use a value that is in the frequency table, but you have to echo the frequency in KHz, so 120MHz -> 120000KHz:
Code:
echo 120000 > /sys/module/cpu_tegra/parameters/cpu_screen_on_min_cap
This option does not stick after a reboot
According to @BS86 this release should be more stable than exp3 and thanks for testing!
Click to expand...
Click to collapse
firtecy_kernel_exp-3 - 13.6.2014
tons of updates to zram/zcache (picked from faux123 tegra kernels)
crypto: added optimized AES and SHA1 routines
added permission checker for binder IPC
tegra video driver updates
Fixed the voltage table -> all values below 770 MHz are not supported by the regulator chip (thanks to all who helped researching! )
Click to expand...
Click to collapse
firtecy_kernel_exp-2 - 8.6.2014
Added the possibility to change the vibration force (or vibration strength)
Added 120MHz and 168MHz as cpu frequencies
Enabled 600 mV as lowest undervolting value (undervolting is very dangerous if you go too low! Better stay at defaults)
Fixed a nvidia or lg cpu derp.
For security reasons it is not possible that the cpu will go underneath 216MHz when screen is on!
Option to use: No ramhack, 16Mb Ramhack or 32 Mb Ramhack!
Vibration force:
to change the vibration force echo a number between 0 and 127 to /sys/module/tspdrv/parameters/vibration_force. Where 127 is the highest and the default. 20 seems to be the last noticeable value.
Code:
echo [force] > /sys/module/tspdrv/parameters/vibration_force
This option does not stick after a reboot. Rom support will be available (hopefully) soon. I'm preparing a patch for tonyps Rom, so that it is possible to change it in the Rom settings.
120 and 168Mhz:
These values are useful for the case where the phone helds a wake lock. This means because of the wake lock it won't enter deepsleep. The phone would run at 216MHz even if it isn't needed. Running at 168Mhz or even 120MHz should result in a better battery life.
If you experience any problems, try to raise the voltage at this frequencies to a higher value and test again. If it is still unstable report it (with a description of the problem) and change the minimum frequency to 216Mhz.
Click to expand...
Click to collapse
firtecy_kernel_exp-1 - 1.6.2014
Initial release
Base source: kowalski kernel
Added built in ZRam (no need to use zram.ko for longer)
Added PKSM as replacement for ksm (http://code.google.com/p/pksm/)
Enabled deferred timers for pksm and ksm
Notice: Since there is no ksm available, but pksm you will not find the options for ksm in any app. All configurations are no longer under: /sys/kernel/mm/ksm/ , but under: /sys/kernel/mm/pksm/
To deativate pksm run this command as root:
Code:
echo 0 > /sys/kernel/mm/pksm/run
This option does not stick after a reboot
Click to expand...
Click to collapse
How to build your own kernel:
You need a Linux PC with either 32 or 64Bit. I'm using Linux Mint Debian Edition 64Bit. And you will need the following packages:
build-essential kernel-package libncurses5-dev bzip2
For example to install them run:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
Hint: If you run into troubles with installing packages, check this post
1. Create a new directory for your kernel building (for example: ~/kernel_p990)
Code:
mkdir ~/kernel_p990
2. cd to your kernel dir
Code:
cd ~/kernel_p990
3. Run this command to download the source code for compiling:
Code:
git clone https://github.com/Firtecy/kowalski
4. Now we need to download the toolchain for compiling: Download it from here: http://www.linaro.org/downloads/ under the Bare-Metal section. It is labeled GCC ARM Embedded. Version: 4.7-2013.q3 ; Release: 13.11
5. Now extract the toolchain to a new dir, for example: ~/kernel_p990/toolchain
6. Now we have to define some values for the build enviroment:
Set the CROSS_COMPILE var to your path where you have downloaded your toolchain. For example:
Code:
export CROSS_COMPILE=~/kernel_p990/toolchain/gcc-arm-none-eabi-4_7-2013q3/bin/arm-none-eabi-
Notice at the end you find this prefix: arm-none-eabi- this is not a dir, but the prefix for all files inside the bin directory(for example: arm-none-eabi-gcc)
7. Set the architecture (processor architecture) for which the kernel should be build. So in our case arm:
Code:
export ARCH=arm
and
Code:
export SUBARCH=arm
8. The next step defines the configurations for the kernel (in this case the configuration is named kowalski_defconig)
Code:
make kowalski_defconfig
Notice: this takes the configuration from the file located under arch/arm/configs and will write it to .config
9. Now we can finally build the kernel :victory: Run:
Code:
make
You will find the kernel under: arch/arm/boot/zImage. You just have to copy the zImage and replace the one found in the flashable zip (e.g. my downloads) under kernel/zImage with your own.
Troubleshooting:
Before you can build or run any from step 8 or 9 you have to make sure that all three vars are set correctly (so ARCH, CROSS_COMPILE and SUBARCH). You can check it by running:
Code:
echo $ARCH
for ARCH (for CROSS_COMPILE and SUBARCH it is the seem, but you have to change the name)
If they are not set correctly repeat step 6 and 7.
If you get a compile error first try to run:
Code:
make clean
and try to build the kernel again.
How to diff 2 files or directories in linux
If you are running linux and have two files on your computer and you want to find the differences you can run the diff command in the terminal.
Let's say you have a file "hjunii/traps.c" and "kowalski/traps.c", this is how you compare them:
Code:
diff -u hjunii/traps.c kowalski/traps.c
The command will compare both and will print an output to the terminal that will be similar to this:
Code:
@@ -27,6 +27,7 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <linux/atomic.h>
#include <asm/cacheflush.h>
@@ -483,25 +484,38 @@
static inline void
do_cache_op(unsigned long start, unsigned long end, int flags)
{
- struct mm_struct *mm = current->active_mm;
- struct vm_area_struct *vma;
-
if (end < start || flags)
return;
+ return flush_cache_user_range(start, end);
+}
+
+static inline int
+do_cache_op_iov(const struct iovec __user *uiov, unsigned long cnt, int flags)
+{
+ int i, ret = 0;
+ unsigned long len = cnt * sizeof(struct iovec);
+ struct iovec *iov = kmalloc(len, GFP_KERNEL);
- down_read(&mm->mmap_sem);
- vma = find_vma(mm, start);
- if (vma && vma->vm_start < end) {
- if (start < vma->vm_start)
- start = vma->vm_start;
- if (end > vma->vm_end)
- end = vma->vm_end;
+ if (iov == NULL) {
+ ret = -ENOMEM;
+ goto out;
+ }
- up_read(&mm->mmap_sem);
- flush_cache_user_range(start, end);
- return;
+ if (copy_from_user(iov, uiov, len)) {
+ ret = -EFAULT;
+ goto out_free;
}
- up_read(&mm->mmap_sem);
+
+ for (i = 0; i < cnt; ++i) {
+ unsigned long start = (unsigned long __force)iov[i].iov_base;
+ unsigned long end = start + iov[i].iov_len;
+ do_cache_op(start, end, flags);
+ }
+
+out_free:
+ kfree(iov);
+out:
+ return ret;
}
/*
@@ -550,6 +564,10 @@
do_cache_op(regs->ARM_r0, regs->ARM_r1, regs->ARM_r2);
return 0;
+ case NR(cacheflush_iov):
+ do_cache_op_iov((const struct iovec __user *)regs->ARM_r0,
+ regs->ARM_r1, regs->ARM_r2);
+
case NR(usr26):
if (!(elf_hwcap & HWCAP_26BIT))
break;
Each line starting with a "+" are lines that were added, for example:
Code:
+#include <linux/slab.h>
On the other side lines starting with a "-" are lines that were deleted, for example:
Code:
- struct mm_struct *mm = current->active_mm;
A line like the following should just show you were you find the changes:
Code:
@@ -550,6 +564,10 @@
with the following syntax:
Code:
@@ -[line number in 1. file],[number of lines that were printed from 1.file] + [line number in 2. file], [number of lines that were printed from 2.file] @@
But the basic syntax is the following:
Code:
diff -u [base file] [file containing the changes you want to display]
You can also compare whole directories!
ProTip: Install the program "colordiff". It will color the console output, that means the output is more readable!
Syntax:
Code:
diff -u [base file] [file containing the changes you want to display] | colordiff
Example:
Code:
[COLOR="Plum"]@@ -1,8 +1,8 @@[/COLOR]
[COLOR="Red"]-VERSION = 2
-PATCHLEVEL = 6
-SUBLEVEL = 39
-EXTRAVERSION = .4
-NAME = Flesh-Eating Bats with Fangs[/COLOR]
[COLOR="RoyalBlue"]+VERSION = 3
+PATCHLEVEL = 1
+SUBLEVEL = 10
+EXTRAVERSION =
+NAME = "Divemaster Edition"[/COLOR]
Nice New kernel!
will try that one as soon as possible.
thanks for the work.we dont let the 2x die!
Will this work on Mokee rom?
If you don't understand the subconscious you will always bump into it calling it fate...
themistoklisv said:
Will this work on Mokee rom?
If you don't understand the subconscious you will always bump into it calling it fate...
Click to expand...
Click to collapse
Which kernel is included by default in the Rom or can you paste a link?
Gesendet von meinem LG-P990 mit Tapatalk
[email protected]#126
If you don't understand the subconscious you will always bump into it calling it fate...
themistoklisv said:
[email protected]#126
If you don't understand the subconscious you will always bump into it calling it fate...
Click to expand...
Click to collapse
Then I am sorry, but it is not compatible.
The 3.1 kernel differs too much to be compatible with ROMs that are build for an 2.6 kernel
Gesendet von meinem LG-P990 mit Tapatalk
Oh my God, amazing! Finally some serious development! Great work Firtecy. Time to bust CM11 back on my device and try this ramhacked wonder
Oh...i see...this why no ksm settings
Btw...i would suggest a higher ramhack like 32mb like m1 ramhack...but this kernel works great so far...just classic low ram problem exist (well...obviously) need to set an aggresive value (i'm using swap without zram)
Do i need to post a logcat?
Sent from my LG-P990
Will this work with cm 10.1?
Wysłane z mojego LG-P990 przy użyciu Tapatalka
No, it has a different wifi driver, sorry for my english
Sent from my ME173X using XDA Free mobile app
Okey
Wysłane z mojego LG-P990 przy użyciu Tapatalka
The first change:
Okay since there was the wish that there should be a 32 MB ramhack version and the poll showed the same i built one. You can find it at my basketbuild https://s.basketbuild.com/devs/firtecy/p990/kernel/3.1/.
So the 32 MB Ramhack version is labeled: firtecy_kernel_exp-1_32MB-RH.zip and the previous one is labeled: firtecy_kernel_exp-1_16MB-RH.zip
I have flashed it and in the settings app, I had 372MB available (Settings > About)
The second change:
Since i have been asked to explain how to build my kernel from source code i wrote a small how to in the third post of the thread. Check it and maybe try to build it for your own.
If you wish i can also write how to change the kernel by your own. (So add new stuff or something similiar)
Great job firtecy...downloading asap
--------------------++-
Very fluid ui with 32rh and with performance control app i can set lmk on boot (dunno..the one come with rom 0527 always reset after reboot)
So far...no bugs for me (except known bugs)
Btw i'm using swap only..no zram but zram works too (i turned it off)
Sent from my LG-P990
Would like to know if random reboot and phone always waking is a kernel related or rom?
Sent from my LG-P990 using Tapatalk 2
mkchan said:
Would like to know if random reboot and phone always waking is a kernel related or rom?
Sent from my LG-P990 using Tapatalk 2
Click to expand...
Click to collapse
I haven't got random reboots or always waking phone in fact on 3.1 kernel there's a bug for waking phone (need press power button twice or thrice)
Maybe your memory full ocupied and still lot queued job to do...that's sometimes happen to me...that's why i need to set lmk a bit aggresive...
Well as dev always said...log or it's not happen
Sent from my LG-P990
Firtecy said:
How to build your own kernel:
You need a Linux PC with either 32 or 64Bit. I'm using Linux Mint Debian Edition 64Bit. And you will need the following packages:
build-essential kernel-package libncurses5-dev bzip2
For example to install them run:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
Click to expand...
Click to collapse
I have even had to install libc6-dev-i386 in my 64bit vbox image, then the make seems to have started working :good:
If you wish i can also write how to change the kernel by your own. (So add new stuff or something similiar)
Click to expand...
Click to collapse
+1 (if you don't mind and have time for it )
Thanks!
Thx for your dev. but can you build this kernel for su660?
나의 LG-P990 의 Tapatalk에서 보냄

[KERNEL] [UNIFIED] Anykernel

ANYKERNEL
espressowifi / espresso3g
Please respect the following 2 points
No feature requests!
Overclocked Kernel can be found here
NOTE:
This product is provided "as is" without any warranty. Use on your own risk.
I am not responsible for burned CPU or GPU.
Any kind of OC is really dangerous on Galaxy Tab2. While OMAP 4460 has a built-in temperature sensor, OMAP 4430 doesn't have one. Nothing stops it from overheating...
If you don't read and respect the OP, you accept to make a donation of 50$ to a charity of your choice!
​ [#WARRANTY]
It is difficult to update all Roms frequently, and it does not always makes sense to compile, download and flash a whole rom, if only some kernel changes are applied.
This kernel will include changes before i add them official to our kernel source (most of the time security bugfixes)!
Android 5.1 and Android 6.0
This Kernel works on all Android 5.1 and Android 6.0 Roms for espressowifi and espresso3g.
Android 4.4
On Android 4.4 we need a different kernel, 4.4 Kernel includes "KitKat" tag on zip name.
What else to say
Kernel compiled using GCC 4.8
Anykernel based on Anykernel2 by @osm0sis ( https://github.com/osm0sis/AnyKernel2 ) - it will dump your boot.img and replace the zImage and add proper kernel modules.
Roms with default libion
LineageOS (unofficial)
espresso3g
lineage-11-20180131-2053-UNOFFICIAL-espresso3g.zip and newer
lineage-13.0_espresso3g-6.0.1-20180130-2211.zip and newer
lineage-14.1_espresso3g-7.1.2-20180131-1859.zip and newer
espressowifi
lineage-11-20180131-2033-UNOFFICIAL-espressowifi.zip and newer
lineage-13.0_espressowifi-6.0.1-20180130-2146.zip and newer
lineage-14.1_espressowifi-7.1.2-20180131-1818.zip and newer
OmniRom (unofficial)
espresso3g
omni_espresso3g-4.4.4-20180127-2337.zip and newer
omni_espresso3g-6.0.1-20180128-0312.zip and newer
omni_espresso3g-7.1.2-20180128-1319.zip and newer
espressowifi
omni_espressowifi-4.4.4-20180127-2310.zip and newer
omni_espressowifi-6.0.1-20180128-0251.zip and newer
omni_espressowifi-7.1.2-20180128-1254.zip and newer
SlimRoms (unofficial)
espresso3g
Slim-espresso3g-4.4.4.build.9.15-UNOFFICIAL-20180128-0125.zip and newer
Slim_espresso3g-6.0.1-20180128-2332.zip and newer
Slim_espresso3g-7.1.2-20180131-1617.zip and newer
espressowifi
Slim-espressowifi-4.4.4.build.9.15-UNOFFICIAL-20180128-0028.zip and newer
Slim_espressowifi-6.0.1-20180128-2308.zip and newer
Slim_espressowifi-7.1.2-20180131-1555.zip and newer
Unlegacy-Android:
All official Unlegacy-Android builds starting on 15th feburary use the default libion
Roms with new DDK
Slim6 , Slim7, OmniROM4, OmniROM 6, OmniROM 7 and LineageOS 11, LineageOS 13 and LineageOS 14.1 compiled after 01.03.2019
[#DONATETOME]
XDA:DevDB Information
(unified) Anykernel, Kernel for the Samsung Galaxy Tab 2
Contributors
Android-Andi, Ziyan
Source Code: https://github.com/Unlegacy-Android/android_kernel_ti_omap4/commits/3.0/common
Kernel Special Features: Testing before applying on our source official, CVE fixes
Version Information
Status: Testing
Created 2016-10-21
Last Updated 2020-05-02
Reserved
As requested, here's my setup to compile espresso kernel.
01.05.2020
Follow https://github.com/andi34/android_build-bot/blob/manifest/README.md and https://github.com/andi34/android_build-bot/blob/kernelcompile/README.md
What do you need
Kernel Source (you can get our latest kernel source on SlimRoms, OmniRoms or CyanogenMods github, "espresso10 kernel")
GCC ( https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8 )
pvr source, added to omap4-common device repo and hardware_ti_omap4 repo (can be found on SlimRoms, OmniRoms or CyanogenMods github)
you can use my scripts put below (update some paths, marked red )
AnyKernel2 Source from osm0sis (see 1. post, update for your tab2 needed)
build-gcc4.8.env:
Code:
[COLOR="Red"]export CROSS_COMPILE='/android/kernelcompile/arm-eabi-4.8/bin/arm-eabi-'[/COLOR]
export LDFLAGS=''
export CFLAGS=''
export SUBARCH=arm
export ARCH=arm
[COLOR="Red"]export STRIP=/android/kernelcompile/arm-eabi-4.8/bin/arm-eabi-strip[/COLOR]
alias 'stm'='$STRIP --strip-unneeded *.ko'
compile-espresso.sh
Code:
#!/bin/bash
readonly red=$(tput setaf 1) # red
readonly grn=$(tput setaf 2) # green
readonly ylw=$(tput setaf 3) # yellow
readonly blu=$(tput setaf 4) # blue
readonly cya=$(tput setaf 6) # cyan
readonly txtbld=$(tput bold) # Bold
readonly bldred=$txtbld$red # red
readonly bldgrn=$txtbld$grn # green
readonly bldylw=$txtbld$ylw # yellow
readonly bldblu=$txtbld$blu # blue
readonly bldcya=$txtbld$cya # cyan
readonly txtrst=$(tput sgr0) # Reset
err() {
echo "$txtrst${red}$*$txtrst" >&2
}
warn() {
echo "$txtrst${ylw}$*$txtrst" >&2
}
info() {
echo "$txtrst${grn}$*$txtrst"
}
setbuildjobs() {
# Set build jobs
JOBS=$(expr 0 + $(grep -c ^processor /proc/cpuinfo))
info "Set build jobs to $JOBS"
}
info "Kernel source path: $KERNELSOURCE"
info "PVR Source path: $PVRSAUCE"
info "Working directory: $WORKINGDIR"
info "resulting zImage and modules stored at: $WORKINGOUTDIR"
setbuildjobs
info "Moving to kernel source"
cd $KERNELSOURCE
info "Import toolchain environment setup"
info "Toolchain: $TOOLCHAIN"
source $SAUCE/build-$TOOLCHAIN.env
info "Create a buid directory, known as KERNEL_OUT directory"
# then always use "O=$SAUCE/espresso" in kernel compilation
info "create working directory"
mkdir -p $WORKINGDIR
warn "Make sure the kernel source clean on first compilation"
make O=$WORKINGDIR mrproper
warn "Rebuild the kernel after a change, maybe we want to reset the compilation counter"
echo 0 > $WORKINGDIR/.version
if [ "$VARIANTDEFCONFIG" = "*p*" ]; then
info "Import kernel config file: $DEFCONFIGNAME"
info "Import variant config file: $VARIANTDEFCONFIGNAME"
make O=$WORKINGDIR VARIANT_DEFCONFIG=$VARIANTDEFCONFIG $DEFCONFIGNAME
info "Change kernel configuration if needed using:"
info " make O=$WORKINGDIR menuconfig "
VARIANTDEFCONFIG=
else
info "Import kernel config file: $DEFCONFIGNAME"
make O=$WORKINGDIR $DEFCONFIGNAME
info "Change kernel configuration if needed using:"
info " make O=$WORKINGDIR menuconfig "
fi
info "lets build the kernel"
make -j$JOBS O=$WORKINGDIR
if [ -f $WORKINGDIR/arch/arm/boot/zImage ]; then
info "Copying the resulting zImage and modules to: $WORKINGOUTDIR"
info "Creating directory..."
mkdir -p $WORKINGOUTDIR
mkdir -p $WORKINGOUTDIR/modules/system/lib/modules
cp $WORKINGDIR/arch/arm/boot/zImage $WORKINGOUTDIR/
find $WORKINGDIR/ -type f -name *.ko -exec cp {} $WORKINGOUTDIR/modules/system/lib/modules/ \;
info "Files moved!"
info "Pointing KERNELDIR to KERNEL_OUT directory"
export KERNELDIR=$WORKINGDIR
warn "Make sure the PVR source clean."
warn "Running 'make clean'..."
make clean -C $PVRSAUCE/build/linux2/omap4430_android
info "Building the PVR module..."
# we now use the default libion, our kernel was updated
make -j8 -C $PVRSAUCE/build/linux2/omap4430_android TARGET_PRODUCT="blaze_tablet" BOARD_USE_TI_LIBION=false BUILD=release TARGET_SGX=540 PLATFORM_VERSION=4.1
info "Copying the resulting PVR module to: $WORKINGOUTDIR"
cp -fr $PVRSAUCE/binary2_omap4430_android_release/target/pvrsrvkm.ko $WORKINGOUTDIR/modules/system/lib/modules/pvrsrvkm_sgx540_120.ko
mv $PVRSAUCE/binary2_omap4430_android_release/target/pvrsrvkm.ko $WORKINGOUTDIR/modules/system/lib/modules/
warn "Don't leave any module objects in PVR source!"
warn "Running 'make clean'..."
make clean -C $PVRSAUCE/build/linux2/omap4430_android
info "Properly stripping the kernel modules for smaller size (implified as stm command inside build.env)..."
cd $WORKINGOUTDIR/modules/system/lib/modules
stm
info "####################"
info "# Done! #"
info "####################"
else
warn "####################"
warn "# FAILED! #"
warn "####################"
fi
cd $SAUCE
espresso-m.sh
Code:
#!/bin/bash
[COLOR="Red"]SAUCE=~/android2/kernelcompile
PVRSAUCE=~/android2/official/omap4/stable/pvr-source/eurasiacon
KERNELSOURCE=~/android2/official/kernel/android_kernel_ti_omap4[/COLOR]
TOOLCHAIN="gcc4.8"
DEFCONFIGNAME=espresso_defconfig
WORKINGDIR=$SAUCE/out/$DEFCONFIGNAME
WORKINGOUTDIR=$SAUCE/$DEFCONFIGNAME-bin
. `dirname $0`/compile-espresso.sh
espresso-k.sh
Code:
#!/bin/bash
[COLOR="Red"]SAUCE=~/android2/kernelcompile
PVRSAUCE=~/android2/official/omap4/stable/pvr-source/eurasiacon
KERNELSOURCE=~/android2/official/kernel/android_kernel_ti_omap4[/COLOR]
TOOLCHAIN="gcc4.8"
DEFCONFIGNAME=espresso_kitkat_defconfig
WORKINGDIR=$SAUCE/espresso-kitkat
WORKINGOUTDIR=$WORKINGDIR-bin
. `dirname $0`/compile-espresso.sh
Reserved
DEVICE SPECIFIC ANYKERNEL
Edit 02.05.2020
Latest device specific AnyKernel-Zip can be found here:
https://forum.xda-developers.com/showpost.php?p=79259009&postcount=204
Please note: our kernel detects your Tab2 variant at boot and chooses the right driver and config for your device! In some cases (e.g. if the mainboard or the screen got replaced) your device variant isn't detected right and it will use wrong driver!
I am not sure how many user are affected, but in such case we can skip the intelligent board detection and hardcode the variant.
Attached device specific kernel should work on all unified espresso/espressowifi & espresso3g roms from Android 5 up to Android 7, for Android 4 Roms please use the "kitkat" version.
Feel free to buy me a coconut water if it helped you to keep your Tab still, after many years, almost up to date.
UPDATE AnyKernel-2016-10-21
- Update the ext-csd.rev check for eMMC5.1 (fixes emmc detection for some tab2)
- CVE-2016-5195
- CVE-2016-6828
- CVE-2016-7042
thanks andi.
working nice on my own builded aosp-6.0 10/16
Some more CVE fixes applied on top of previous kernel:
CVE-2014-8173
CVE-2014-7970
CVE-2014-5206
CVE-2016-0819
CVE-2015-8830
CVE-2014-9715
I added a CVE overview on 2nd post.
Edit:
Added a KitKat version
Hi Android-Andi.
Has this kernel the OPTION (or plan to enable) to overclock ?
Thanks.
galoneta said:
Hi Android-Andi.
Has this kernel the OPTION (or plan to enable) to overclock ?
Thanks.
Click to expand...
Click to collapse
No as mentioned in first post! Move out of this thread if you are not able to read first post.
~ All my work, news etc. on http://andi34.github.io ~
Guys, if you don't read the OP the thread will be closed and you can take care about a security patched kernel yourself.
Source is available on github, add everything you miss by your own and stop spamming this thread!
Edit: everyone not accepting the forum rules will be reported!
Edit2: Thanks @ Moderator for the post remove / thread clean
~ All my work, news etc. on http://andi34.github.io ~
SORRY!
I know its off topic but you should read this
http://www.xda-developers.com/9-yea...-dirty-cow-can-root-every-version-of-android/
Emo Darkemotion said:
SORRY!
I know its off topic but you should read this
http://www.xda-developers.com/9-yea...-dirty-cow-can-root-every-version-of-android/
Click to expand...
Click to collapse
OP states that its already patched
Android-Andi said:
"CVE-2016-5195" https://github.com/Unlegacy-Android/...b19311a9089b77
Click to expand...
Click to collapse
Emo Darkemotion said:
SORRY!
I know its off topic but you should read this
http://www.xda-developers.com/9-yea...-dirty-cow-can-root-every-version-of-android/
Click to expand...
Click to collapse
It is quite funny making noise about a bug which existed 9 years now.
1. It is fixed on my kernel as mentioned on 2nd post (wonder why i spend time doing it)
2. I don't see an issue on custom roms (can be fixed within 2 minutes), i would worry about android by your Manufacturer (on all devices).
On android we change the wheel: no central updates like on linux or windows - it is up to your manufacturer to update your device and there's a lot of security issues fixed by google on android every month (and sure, some kernel side too). How many stock updates you get? 1, maybe 2 within 1 year and support drops after that.
To be true: i am not sure if my next device is an android device:
On my g4 i am on stock rom and LG cares 0 about it (Security patch level 2016-07-01... I waited 6 or 7 month to get that update and it was already 1 month behind).
If manufacturer don't care about theire flagships, what else can we do? Flashing custom roms? Right works, but on my daylie driver i don't like to be a flashahollic... I am more thinking about using a different OS.
You should think about my words and don't care about a already fixed security issue
~ All my work, news etc. on http://andi34.github.io ~
Hi Andy,
First of all, many thanks for all your work! I´m using your ROMs and kernels since Slimkat and all are great!
I also do my best colaborating with the translating team of CyanogenMod and SlimRoms (Brazilian Portuguese).
But now I would like to compile a kernel bymyself, to patch the CVEs, changes I like, etc.
If you have time, can you post here the steps you do to compile the Anykernel?
Don´t need to waste time explaining the things, just post the step-by-step commands (git clone, makes, ADBs, etc) and I will do my research, ok?
Thanks in advance and greetings from Brazil!
AranhaEscarlate said:
Hi Andy,
First of all, many thanks for all your work! I´m using your ROMs and kernels since Slimkat and all are great!
I also do my best colaborating with the translating team of CyanogenMod and SlimRoms (Brazilian Portuguese).
But now I would like to compile a kernel bymyself, to patch the CVEs, changes I like, etc.
If you have time, can you post here the steps you do to compile the Anykernel?
Don´t need to waste time explaining the things, just post the step-by-step commands (git clone, makes, ADBs, etc) and I will do my research, ok?
Thanks in advance and greetings from Brazil!
Click to expand...
Click to collapse
Sure, i have nothing to hide i can upload my script next days. Busy on other stuff atm maybe send a small reminder if the script isn't added on 3rd post of this thread end of next week.
~ All my work, news etc. on http://andi34.github.io ~
Android-Andi said:
Sure, i have nothing to hide i can upload my script next days. Busy on other stuff atm maybe send a small reminder if the script isn't added on 3rd post of this thread end of next week.
~ All my work, news etc. on http://andi34.github.io ~
Click to expand...
Click to collapse
Oh and @Android-Andi just a small request , change the color of the text for ""CVE-XXXXXYYYY" DOES NOT AFFECT" because This colour is hard to read on the screen .
AranhaEscarlate said:
(...)
If you have time, can you post here the steps you do to compile the Anykernel?
Don´t need to waste time explaining the things, just post the step-by-step commands (git clone, makes, ADBs, etc) and I will do my research, ok?
(...)
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=69241933&postcount=3
Must be enough, everything else you need to read / find out yourself
iamashwin said:
Oh and @Android-Andi just a small request , change the color of the text for ""CVE-XXXXXYYYY" DOES NOT AFFECT" because This colour is hard to read on the screen .
Click to expand...
Click to collapse
Done, should be better now.
Android-Andi said:
http://forum.xda-developers.com/showpost.php?p=69241933&postcount=3
Must be enough, everything else you need to read / find out yourself
Click to expand...
Click to collapse
Thank you very much, Andy!!!
It´s more than enough!
Everything else, I will read documentation at the Internet, but this is a great starting point for me.
What kind ANY KERNEL is important when you can not clocked CPU and graphics
Kutuzov666 said:
What kind ANY KERNEL is important when you can not clocked CPU and graphics
Click to expand...
Click to collapse
Dont use it if you dont want it!
It is for the kind of people who want a secure kernel ... more secure than the one given by samsung (I dont remember the last time they sent us a patched kernel update ...or did they !)
Nearly all the device I own are waaaay too insecure (be it my router (its also a linux system) , phone Landline TV ...) except for my 4 year old tab all thanks to Andi ! Respect it
Besides OP is doing all this as a hobby and not for your or my benefit.
Stop spaming this thread ! Please READ
Please respect the following 2 points
No feature requests!
Overclocking will never be added here!
If you don't read and respect the OP, you accept to make a donation of 50$ to a charity of your choice!
Click to expand...
Click to collapse
PSS If you are satisfied with the answer please delete the message and so will I .Lets keep this thread clean.

Categories

Resources