3D Printable Mobile Microscope? Nexus 7 Discontinued – XDA TV

The Nexus 7 2013 has been discontinued on the Google Store! That and … more

Which Lockscreen Security Type Do You Use?

From pattern locks to the controversial face unlock, there are a number of different ways you … more

Xposed 3.0 Alpha 3 Released

A new alpha for the Xposed framework is out and brings several bug fixes. You’ll only need to flash … more

XDA Recap: This Week In Android (Apr 18 – 25)

Here in the digital XDA newsroom, we spend our days pouring over an average of … more
Thread Deleted Subscribe to Thread Email Thread

[HOW-TO] extract kernel from source, compile, and insert on GPE (510)

Prev Previous Post   Next Post Next
29th January 2014, 05:09 PM |#1  
sleekmason's Avatar
OP Senior Member
Flag Fayetteville
Thanks Meter: 356

How to extract the boot image from your tablet, set up adb, compile a new kernel with cool options, and put it back on your device!

UPDATED for Lolipop 12-4-14

This is a complete guide from start to finish, copy and paste style. If you own a gpe510, or any other AOSP device and a computer running Debian Linux, you can do all of this.

If all you want is the modified kernel, download from here:
Sleekai Kernel For The LG GPad 8.3 V510(GPE)

I am hoping people will add to this with new ideas and patches in order to make the GPE a better device. I see the potential for all sorts of neat stuff.

This guide assumes a basic knowledge of linux operating systems. I am using a Debian 64 bit (wheezy stable) to compile my kernel. I have used many, many hours of the day to figure this out properly, with specific thanks going to Pete of Pete's Blog for his image tools.

But first, lets keep this simple. As usual, you are on your own if you brick your device, though I don't see how you could if you are paying attention!

There are dependencies for building your own kernel, and you will definitely want to use a 64 bit system as a 32 bit will not work properly for kitkat.

Here are all of the packages you will need, and they will draw in further dependencies when you install, but these are it! So, here we go:
Open a terminal, su to root and:
dpkg --add-architecture i386
##This will allow for the use of some 32 bit librarys that we will need for both adb and the kernel compile. Then:
apt-get update ; apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 libc6-i686:i386 lzop liblzo2-dev libgpm2:i386 git-core git gnupg flex bison gperf libsdl1.2-dev libesd0-dev build-essential zip curl gedit libncurses5-dev zlib1g-dev fakeroot lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
Next, you will need to install adb and have your permissions set up.

In order to do this you will need to go into the developer options on your device to enable debugging on your tablet. Go to settings/about tablet/build number, and tap on build number several times to unlock the developer options.
You will need to create new udev rules for your device in/etc/udev/rules.d on your computer.
Use "lsusb" in your terminal to find the manufactures code of your device. it will show up as a nexus 4, or Google device.

You will need to create a file in your computer in /etc/udev/rules.d/99-android.rules.
You can use gedit if you like:
gedit /etc/udev/rules.d/99-android.rules
Put the following inside and save, changing the manufactures code as necessary to fit your device, and change “your-login” to your login name on your computer.
# Google Nexus devices
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", OWNER="your-login" # Google Nexus devices
18d1 is the manufacturers code.

You will then want to restart udev on your computer:
service udev restart
you will now have permissions to access your android device from user space.

Now to download adb and get started. You should probably not use adb from the Debian repositories, as it may be an older version. the V510 is using kitkat android and needs the latest build of adb to work properly. It is a good idea to get rid of any old adb files on your computer first. The code below will do just that.

apt-get purge android-tools-adb android-tools-fastboot
Now download the latest adb bundle from here:

Move it into a new directory,
*note -the version number may be different.
mkdir ~/adb
cd ~/adb
su to root and Move the bundle to /opt:
mv adt-bundle-linux-x86_64-20131030 /opt/android-sdk-linux-x86_64-20131030
Other google products reside in /opt, this should too. This takes a minute or so on slow machines.
Next we need to link adb to /usr/bin
ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/adb /usr/bin
ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/fastboot /usr/bin
We are ready to begin working on the device! first start the adb server and look for your device.
adb start-server
adb devices
You will then need to confirm the connection on your tablet screen to allow access from your computer.

Okay, wev'e got this first part set up. it's time to begin working on a kernel!

Lets get started.
I want to extract and build my zimage in $userspace, so open a terminal from /home and:
mkdir ~/android
Download the source package LG-V510(G-Pad 8.3 Google Play Edition)_Android_KK_V510_11c from here :

and open it to find three folders, including a kernel folder. Move the kernel folder to ~/android and then:
cd ~/android
Download the current eabi-4.6 Google tool chain to ~/android to cross compile your android kernel:

git clone
When it completes, enter ~/android/kernel and get ready to compile a new kernel from the source code.
cd ~/android/kernel
Do the following each time you compile another kernel. This insures the correct path.
export PATH=$PATH:~/android/arm-eabi-4.8/bin
arm-eabi-gcc --version
you should get:
arm-eabi-gcc (GCC) 4.6.x-google 20120106 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
Continue on! we are not done yet!
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
export KERNEL_DEFCONFIG=palman_defconfig
make clean
make palman_defconfig
Doing the above prepares your kernel build environment, while the following code opens a interface to configure the kernel. You can simplify this later however you wish.
But for now,
make menuconfig
At this point make whatever changes you wish to the config file. for a list of the changes I have made, and that are in the kernel available to download, look in the sleekai kernel thread. (At start of thread, or in my signature).
After saving your changes,
Or conversely
make -o2
which will optimize the make. I recommend using simply "make" first, as the other may not properly show errors should any occur.

and go make a pot of coffee, and probably drink the whole pot! This will take a while.

At the end you will see that the "zimage is ready"
If you have errors, then you probably have dependency problems. If not, Yay! You compiled your first kernel, but we are not done yet!

The zimage you just produced is stored in /kernel/arch/arm/boot/zImage
To put both the zimage and any modules into a separate folder inside of ~/android so as to make extracting them easier:
mkdir ~/android/kernel_output
cp ~/android/kernel/arch/arm/boot/zImage ~/android/kernel_output/zImage
find ~/android/kernel -name "*.ko" -exec cp {} ~/android/kernel_output/ \;
The above code will find all the modules for your kernel. We don't need them for this tutorial, but it still is mighty handy!

Extract your boot image ( for the ramdisk You may also download the from the sleekai kernel thread

Now make a backup to transfer to your computer.
Reboot to recovery on your tablet. I'm using TWRP. If you are using something else it should be just as easy.
adb reboot recovery
Only tick the boot
make a backup to your sd card. I changed the name to boot.bac to keep it simple
make sure the backup of boot is present using a file explorer. I am using ES File explorer.

On your computer, pull the file using adb
adb start-server
adb devices
adb pull /storage/sdcard1/TWRP/BACKUPS/LG0000606708987/boot.bac /home/sleek
sleek is my user name, replace with yours or use tilde.

What we are after is the "" file. We will only need this and the zImage to compile a new boot image and run it on your tablet.

The tools to extract the kernel and ramdisk from the you will need the following boot image tools installed on your computer.

So, again, lets keep this simple. All the tools are forked to my github for ease of use.
So lets install the tools! Ready?
As Root:
mkdir /usr/src/android
mkdir /usr/src/android/boot
cd /usr/src/android/
git clone
cd bootimg-tools/libmincrypt/
gcc -c *.c -I../include
ar rcs libmincrypt.a *.o
cd ../mkbootimg
gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
cp mkbootimg /usr/local/bin/
cd ../cpio
gcc mkbootfs.c  -o mkbootfs -I../include
cp mkbootfs /usr/local/bin/
cd /usr/src/android/bootimg-tools/mkbootimg/
gcc -o unmkbootimg unmkbootimg.c
cp unmkbootimg /usr/local/bin/
Now everything is in place to make a new boot image for your tablet!

Finishing this up is easy.

As root, we made a directory in /usr/src/android/boot for your file to be torn apart:
cd /usr/src/android/boot
Copy your new zImage and the file you extracted from your device.
Note* "/home/sleek" is the path on my computer, and should be changed to reflect yours!
cp /home/sleek/android/kernel_output/zImage /usr/src/android/boot
cp /home/sleek/ /usr/src/android/boot
Now unpack the file to get the ram disk
unmkbootimg -i
Now you may remove the current file, and the resultant kernel file as we will be making new ones, and rename the zImage file you moved here to "kernel".
rm kernel && mv zImage kernel
Now repack using the command given to you during the unpack:
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x80208000 --ramdisk_offset 0x82200000 --second_offset 0x81100000 --tags_offset 0x80200100 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=palman lpj=67677 vmalloc=300M' --kernel kernel --ramdisk ramdisk.cpio.gz -o
Note* For 500 users this may be different. Simply use the command from the prompt.

You should now have a brand new image in /usr/src/android/boot!!
To push back on your device to test
adb reboot bootloader
fastboot boot
USING the above will only put your kernel build into memory and should not hurt your device if something goes wrong. Use the command below to make it permanent.

If everything works well, you should see the change you made to the /general/perf-localversion/ in your settings under kernel. from there it's up to you to hack away! make new and unique kernels!

If you want your kernel to survive reboot do;
fastboot flash boot
fastboot reboot
You can expect a slow bootup on the first go around as your new kernel populates the widgets, etc..

NOTE*For the use of the latest eabi-4.7 google toolchain, you will need the libglibc libraries from the "testing" branch as gcc 4.7 is in testing. I advise completing the guide with eabi 4.6 first before trying 4.7.

The gamma correction though enabled in 4.6, isn't near as good as the native compile using 4.7. If you want the screen to look like it does in my kernels, you will need 4.7
For the eabi-4.7:
git clone
That's it! Good luck! Remember, If you post a kernel you have made, you will need to show your kernel source, etc . . . Git hub is a good choice to keep track of changes you make. Best regards, Sleekmason
Last edited by sleekmason; 4th December 2014 at 11:56 PM. Reason: fixin' it
The Following 12 Users Say Thank You to sleekmason For This Useful Post: [ View ]
Subscribe to Thread

boot image,, how-to, kernel, kernel gpad
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes