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

Search This thread

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com

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:
Code:
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:
Code:
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.
then:
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:
Code:
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.
Code:
# 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:
Code:
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.

Code:
apt-get purge android-tools-adb android-tools-fastboot

Now download the latest adb bundle from here:

http://developer.android.com/sdk/index.html

Move it into a new directory,
*note -the version number may be different.
Code:
mkdir ~/adb
Code:
cd ~/adb
Code:
unzip adt-bundle-linux-x86_64-20131030.zip
su to root and Move the bundle to /opt:
Code:
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
Code:
ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/adb /usr/bin
Code:
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.
Code:
adb start-server
Code:
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:
Code:
mkdir ~/android
Download the source package LG-V510(G-Pad 8.3 Google Play Edition)_Android_KK_V510_11c from here :

https://www.lg.com/global/support/opensource/opensourceList?types=ALL&search=lgv510

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

Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8

When it completes, enter ~/android/kernel and get ready to compile a new kernel from the source code.
Code:
cd ~/android/kernel
Do the following each time you compile another kernel. This insures the correct path.
Code:
export PATH=$PATH:~/android/arm-eabi-4.8/bin
Code:
arm-eabi-gcc --version
you should get:
Code:
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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Continue on! we are not done yet!
Code:
export ARCH=arm
Code:
export SUBARCH=arm
Code:
export CROSS_COMPILE=arm-eabi-
Code:
export KERNEL_DEFCONFIG=palman_defconfig
Code:
make clean
Code:
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,
Code:
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,
Code:
make
Or conversely
Code:
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:
Code:
mkdir ~/android/kernel_output
Code:
cp ~/android/kernel/arch/arm/boot/zImage ~/android/kernel_output/zImage
Code:
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 (boot.emmc.win) for the ramdisk You may also download the stock.zip 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.
Code:
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
reboot
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
Code:
adb start-server
Code:
adb devices
Code:
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 "boot.emmc.win" 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 boot.emmc.win 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:
Code:
mkdir /usr/src/android
Code:
mkdir /usr/src/android/boot
Code:
cd /usr/src/android/
Code:
git clone https://github.com/sleekmason/bootimg-tools.git
Code:
cd bootimg-tools/libmincrypt/
Code:
gcc -c *.c -I../include
Code:
ar rcs libmincrypt.a *.o
Code:
cd ../mkbootimg
Code:
gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
Code:
cp mkbootimg /usr/local/bin/
Code:
cd ../cpio
Code:
gcc mkbootfs.c  -o mkbootfs -I../include
Code:
cp mkbootfs /usr/local/bin/
Code:
cd /usr/src/android/bootimg-tools/mkbootimg/
Code:
wget https://raw.github.com/sleekmason/bootimg-tools/master/mkbootimg/unmkbootimg.c
Code:
gcc -o unmkbootimg unmkbootimg.c
Code:
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 boot.emmc.win file to be torn apart:
Code:
cd /usr/src/android/boot
Copy your new zImage and the boot.emmc.win file you extracted from your device.
Note* "/home/sleek" is the path on my computer, and should be changed to reflect yours!
Code:
cp /home/sleek/android/kernel_output/zImage /usr/src/android/boot
Code:
cp /home/sleek/boot.emmc.win /usr/src/android/boot
Now unpack the boot.emmc.win file to get the ram disk
Code:
unmkbootimg -i boot.emmc.win
Now you may remove the current boot.emmc.win file, and the resultant kernel file as we will be making new ones, and rename the zImage file you moved here to "kernel".
Code:
rm boot.emmc.win kernel && mv zImage kernel
Now repack using the command given to you during the unpack:
Code:
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 boot.emmc.win

Note* For 500 users this may be different. Simply use the command from the prompt.

You should now have a brand new boot.emmc.win image in /usr/src/android/boot!!
To push back on your device to test
Code:
adb reboot bootloader
Code:
fastboot boot boot.emmc.win

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;
Code:
fastboot flash boot boot.emmc.win
then:
Code:
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:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7

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:

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
If you are a v500 user and want to build your own kernel!


First, read the above post as you will be following the steps listed there.


There are just a couple of changes that you will need to do, and maybe a riddle to figure out as well. Read on.

You will need to download the v500 source from here: https://www.lg.com/global/support/opensource/opensourceList?superOsCategoryId=CAT00000001&osCategoryId=

Look for the LGV500 kernel source.

Where it says "palman" for the defconfig items, you will want to replace that with the defconfig for the 500, so replace palman with awifi-perf,
like this:

Code:
export KERNEL_DEFCONFIG=awifi-perf_defconfig
Code:
make awifi-perf_defconfig

Important

Follow the guide and build with the Google Toolchain eabi4.6 first
LG compiled for the 500 and 510 using the eabi4.6. It works, and will give you a feel for the process, and allow you to use your kernel.

Note*
I use the google toolchain eabi-4.7 for the sleekai kernels as it changes the gamma to reasonable defaults on the 510 without further tweaking. After compiling a kernel or two to get a feel for it, you should try using the 4.7 toolchain. To do so, you will probably need the libglibc libraries from the "testing" branch. Look it up.

caveat: I recieved a compile error for the v500 when I used the eabi-4.7 . . . . . yeah. You'll have to work that out.

There is a modified anykernel script for emmc devices out there (Search Google or here in xda). You will have to use the anykernel script after making your boot.emmc.win image as fastboot won't work on the 500. There may be another way .... But I don't know what it is.

Edit* There are now two different kernels for the LG GPad 8.3 V500(awifi) located in the development section of the forum.

Best of luck! -sleekmason
 
Last edited:

Canadoc

Senior Member
Nov 29, 2010
1,822
117
Can this be used to create a kernel for the non Google Play Edition Gpad to be able to allow us to install the Google Play edition ROM on it

Sent from my SM-N900W8 using Tapatalk
 

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
Can this be used to create a kernel for the non Google Play Edition Gpad to be able to allow us to install the Google Play edition ROM on it

Sent from my SM-N900W8 using Tapatalk

I would think so. I edited the above to show how to put the image back on your device. You should be able to use any source you wish to compile with. My thoughts are that you might wish to examine the differences in the ram disk if any.
 

AndroidUser00110001

Senior Member
Aug 16, 2011
3,430
5,739
NYC
Howdy, I would like to share how to download the kernel source for the gpe, compile a new custom kernel, and insert into your LG gpad GPE 510.

...

Thanks for the guide. Making GPE kernel was my next step in trying to get the GPE ROM to work on v510.

I just made guide for getting your Android build environment going if you want to use it on your blog or where ever.

http://forum.xda-developers.com/showthread.php?t=2629008

The problem with v500 is that it does not have fastboot so we can not flash kernel like how you can on v510.
 
  • Like
Reactions: sleekmason

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
@ AndroidUser00110001 Hi! I know that somebody tweaked the Any kernel to work on emmc devices... Maybe it could be adapted? Actually getting the menuconfig and make should be the same process as well as repacking the image. I take it just getting it back on the 500 device is the problem?

I will add your link to this post for setting up a build environment if that is okay.
 

AndroidUser00110001

Senior Member
Aug 16, 2011
3,430
5,739
NYC
@ AndroidUser00110001 Hi! I know that somebody tweaked the Any kernel to work on emmc devices... Maybe it could be adapted? Actually getting the menuconfig and make should be the same process as well as repacking the image. I take it just getting it back on the 500 device is the problem?

I will add your link to this post for setting up a build environment if that is okay.

Is that the koush any kernel? I was going to mess with that too. I just need a small break now. Took a few days to get new system exactly how I want it.

Go ahead and use guide...mo problem at all.
 

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
Is that the koush any kernel? I was going to mess with that too. I just need a small break now. Took a few days to get new system exactly how I want it.

Go ahead and use guide...mo problem at all.

Yes, from here: http://forum.xda-developers.com/showthread.php?t=847265

I noted that boot was on block nncblk0p21 on our device, and not 22? better double check that. I tried it Anykernel as well to no avail when getting this set up. Fastboot is Awesome!

It's taxing to get it set up right. Seems like things change very often for the dependencies based on other package changes. I ussually go with testing but redid two partitions with stable. The 32 bit is just going to sit there, which seems kinda silly due to the need for extra packages in 64 to compile for 32 but whatever. Yeah.
 

ayziaa

Senior Member
Dec 14, 2010
123
23
Lyon
Thanks for the guide. Making GPE kernel was my next step in trying to get the GPE ROM to work on v510.

I just made guide for getting your Android build environment going if you want to use it on your blog or where ever.

http://forum.xda-developers.com/showthread.php?t=2629008

The problem with v500 is that it does not have fastboot so we can not flash kernel like how you can on v510.

I don't understand, what are the differences bettween the v500 and v510? they both have the same hardware, but not the same boot partition or something like that?
 

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
I don't understand, what are the differences bettween the v500 and v510? they both have the same hardware, but not the same boot partition or something like that?

The boot on the 500 cannot be fully unlocked.

This is not the appropriate place to ask that kind of question should be asked in general or in troubleshooting. Also, there are already many threads about this same question please use the search utility to find them. Thank you.
 

darkassain

Senior Member
Oct 30, 2008
195
139
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...:D

Yes, from here: http://forum.xda-developers.com/showthread.php?t=847265

I noted that boot was on block nncblk0p21 on our device, and not 22? better double check that. I tried it Anykernel as well to no avail when getting this set up. Fastboot is Awesome!

It's taxing to get it set up right. Seems like things change very often for the dependencies based on other package changes. I ussually go with testing but redid two partitions with stable. The 32 bit is just going to sit there, which seems kinda silly due to the need for extra packages in 64 to compile for 32 but whatever. Yeah.

Another tool that i ported to the lg g pad a bit back along with loki-doki...;)
Quick hint, dont bother with direct mmc naming as qcom (i dont know if the other chip makers do the same thing, as i have only had qcom devices) has given us a simple naming scheme...:)


should only be used by people who know how to use this,
 

Attachments

  • AnyKernel_test.zip
    433 KB · Views: 48
Last edited:
  • Like
Reactions: sleekmason

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...:D



Another tool that i ported to the lg g pad a bit back along with loki-doki...;)
Quick hint, dont bother with direct mmc naming as qcom (i dont know if the other chip makers do the same thing, as i have only had qcom devices) has given us a simple naming scheme...:)


should only be used by people who know how to use this,

Thank you! Have you successfully used your script to push a kernel onto the 500 Or 510?

I would think this could be very handy for sharing a custom kernel for the 510, but would like to see somebody report a positive test result. Very cool!
 

darkassain

Senior Member
Oct 30, 2008
195
139
Thank you! Have you successfully used your script to push a kernel onto the 500 Or 510?

I would think this could be very handy for sharing a custom kernel for the 510, but would like to see somebody report a positive test result. Very cool!

yes back before when there wasnt a overclocked kernel i basically used this to push it when i would compile just the kernel (didnt maintain so i now use dyn's)...
yes this is only for the v500 as this has the extra loki step, but it shouldnt be hard to modify so it does not do that extra step
 

poondog

Inactive Recognized Contributor
Dec 11, 2011
14,998
12,950
Melbourne
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...:D



Another tool that i ported to the lg g pad a bit back along with loki-doki...;)
Quick hint, dont bother with direct mmc naming as qcom (i dont know if the other chip makers do the same thing, as i have only had qcom devices) has given us a simple naming scheme...:)


should only be used by people who know how to use this,

Hi, can you just use a generic anykernel updater script too?
For example to flash a packed boot.img

Code:
run_program("/tmp/busybox", "dd", "if=/dev/block/platform/msm_sdcc.1/by-name/boot", "of=/tmp/boot.img");
run_program("/tmp/unpackbootimg", "-i", "/tmp/boot.img", "-o", "/tmp/");
run_program("/tmp/repack-ramdisk.sh");
run_program("/tmp/mkbootimg.sh");
run_program("/tmp/busybox", "dd", "if=/tmp/newboot.img", "of=/dev/block/platform/msm_sdcc.1/by-name/boot");

mako and flo can do like this.. I think HTC One as well, since they are all similar qcom chipsets maybe this device can too
 

darkassain

Senior Member
Oct 30, 2008
195
139
Hi, can you just use a generic anykernel updater script too?
For example to flash a packed boot.img

Code:
run_program("/tmp/busybox", "dd", "if=/dev/block/platform/msm_sdcc.1/by-name/boot", "of=/tmp/boot.img");
run_program("/tmp/unpackbootimg", "-i", "/tmp/boot.img", "-o", "/tmp/");
run_program("/tmp/repack-ramdisk.sh");
run_program("/tmp/mkbootimg.sh");
run_program("/tmp/busybox", "dd", "if=/tmp/newboot.img", "of=/dev/block/platform/msm_sdcc.1/by-name/boot");

mako and flo can do like this.. I think HTC One as well, since they are all similar qcom chipsets maybe this device can too

thanks for reminding me the any kernel uploaded by me won't work as it doesn't parse Loki images xorrectly, I'll upload the correct one once I have access to my pc
 

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
thanks for reminding me the any kernel uploaded by me won't work as it doesn't parse Loki images xorrectly, I'll upload the correct one once I have access to my pc

could you please re-post to a different thread rather than hijacking this thread, as your script does not work with the 510 currently and I do not want to go to get confused with my kernel how to. what started out to maybe become relevant apparently will not and so shouldn't be confused with what I'm doing here. I will be happy to try working with your script if you would open up an appropriate thread. Thank you.
 

gunnyman

Senior Member
Apr 12, 2010
7,998
2,668
Greenville SC
Excellent!! Pleased to know that you are able to use it. Have you changed your gamma settings?

I did on mine and am pleased with the result. I'm using 248, 252, 255 using trickster mod What are you going with?

havent messed around too much.
I had a thought about this and I think it would be awesome if we could incorporate faux123's bits for gamma and color control. His fauxcontrol offers much more granular control than trickster.
I'm thankful to have what we have, and THANK YOU for sharing it, but like any good geek I WANTS MOAR!!!!! :p
 

sleekmason

Senior Member
Dec 22, 2013
705
371
Fayetteville
sleekmason.wordpress.com
havent messed around too much.
I had a thought about this and I think it would be awesome if we could incorporate faux123's bits for gamma and color control. His fauxcontrol offers much more granular control than trickster.
I'm thankful to have what we have, and THANK YOU for sharing it, but like any good geek I WANTS MOAR!!!!! :p

me too! I'll look into it. There are other apps besides trickster to give you more control. I think at the kernel level everything we need is unlocked. And yeah, he knows his business like nobody else eh? I'm just persistent.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12

    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:
    Code:
    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:
    Code:
    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.
    then:
    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:
    Code:
    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.
    Code:
    # 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:
    Code:
    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.

    Code:
    apt-get purge android-tools-adb android-tools-fastboot

    Now download the latest adb bundle from here:

    http://developer.android.com/sdk/index.html

    Move it into a new directory,
    *note -the version number may be different.
    Code:
    mkdir ~/adb
    Code:
    cd ~/adb
    Code:
    unzip adt-bundle-linux-x86_64-20131030.zip
    su to root and Move the bundle to /opt:
    Code:
    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
    Code:
    ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/adb /usr/bin
    Code:
    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.
    Code:
    adb start-server
    Code:
    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:
    Code:
    mkdir ~/android
    Download the source package LG-V510(G-Pad 8.3 Google Play Edition)_Android_KK_V510_11c from here :

    https://www.lg.com/global/support/opensource/opensourceList?types=ALL&search=lgv510

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

    Code:
    git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8

    When it completes, enter ~/android/kernel and get ready to compile a new kernel from the source code.
    Code:
    cd ~/android/kernel
    Do the following each time you compile another kernel. This insures the correct path.
    Code:
    export PATH=$PATH:~/android/arm-eabi-4.8/bin
    Code:
    arm-eabi-gcc --version
    you should get:
    Code:
    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
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Continue on! we are not done yet!
    Code:
    export ARCH=arm
    Code:
    export SUBARCH=arm
    Code:
    export CROSS_COMPILE=arm-eabi-
    Code:
    export KERNEL_DEFCONFIG=palman_defconfig
    Code:
    make clean
    Code:
    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,
    Code:
    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,
    Code:
    make
    Or conversely
    Code:
    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:
    Code:
    mkdir ~/android/kernel_output
    Code:
    cp ~/android/kernel/arch/arm/boot/zImage ~/android/kernel_output/zImage
    Code:
    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 (boot.emmc.win) for the ramdisk You may also download the stock.zip 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.
    Code:
    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
    reboot
    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
    Code:
    adb start-server
    Code:
    adb devices
    Code:
    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 "boot.emmc.win" 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 boot.emmc.win 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:
    Code:
    mkdir /usr/src/android
    Code:
    mkdir /usr/src/android/boot
    Code:
    cd /usr/src/android/
    Code:
    git clone https://github.com/sleekmason/bootimg-tools.git
    Code:
    cd bootimg-tools/libmincrypt/
    Code:
    gcc -c *.c -I../include
    Code:
    ar rcs libmincrypt.a *.o
    Code:
    cd ../mkbootimg
    Code:
    gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
    Code:
    cp mkbootimg /usr/local/bin/
    Code:
    cd ../cpio
    Code:
    gcc mkbootfs.c  -o mkbootfs -I../include
    Code:
    cp mkbootfs /usr/local/bin/
    Code:
    cd /usr/src/android/bootimg-tools/mkbootimg/
    Code:
    wget https://raw.github.com/sleekmason/bootimg-tools/master/mkbootimg/unmkbootimg.c
    Code:
    gcc -o unmkbootimg unmkbootimg.c
    Code:
    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 boot.emmc.win file to be torn apart:
    Code:
    cd /usr/src/android/boot
    Copy your new zImage and the boot.emmc.win file you extracted from your device.
    Note* "/home/sleek" is the path on my computer, and should be changed to reflect yours!
    Code:
    cp /home/sleek/android/kernel_output/zImage /usr/src/android/boot
    Code:
    cp /home/sleek/boot.emmc.win /usr/src/android/boot
    Now unpack the boot.emmc.win file to get the ram disk
    Code:
    unmkbootimg -i boot.emmc.win
    Now you may remove the current boot.emmc.win file, and the resultant kernel file as we will be making new ones, and rename the zImage file you moved here to "kernel".
    Code:
    rm boot.emmc.win kernel && mv zImage kernel
    Now repack using the command given to you during the unpack:
    Code:
    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 boot.emmc.win

    Note* For 500 users this may be different. Simply use the command from the prompt.

    You should now have a brand new boot.emmc.win image in /usr/src/android/boot!!
    To push back on your device to test
    Code:
    adb reboot bootloader
    Code:
    fastboot boot boot.emmc.win

    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;
    Code:
    fastboot flash boot boot.emmc.win
    then:
    Code:
    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:
    Code:
    git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7

    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
    6
    If you are a v500 user and want to build your own kernel!


    First, read the above post as you will be following the steps listed there.


    There are just a couple of changes that you will need to do, and maybe a riddle to figure out as well. Read on.

    You will need to download the v500 source from here: https://www.lg.com/global/support/opensource/opensourceList?superOsCategoryId=CAT00000001&osCategoryId=

    Look for the LGV500 kernel source.

    Where it says "palman" for the defconfig items, you will want to replace that with the defconfig for the 500, so replace palman with awifi-perf,
    like this:

    Code:
    export KERNEL_DEFCONFIG=awifi-perf_defconfig
    Code:
    make awifi-perf_defconfig

    Important

    Follow the guide and build with the Google Toolchain eabi4.6 first
    LG compiled for the 500 and 510 using the eabi4.6. It works, and will give you a feel for the process, and allow you to use your kernel.

    Note*
    I use the google toolchain eabi-4.7 for the sleekai kernels as it changes the gamma to reasonable defaults on the 510 without further tweaking. After compiling a kernel or two to get a feel for it, you should try using the 4.7 toolchain. To do so, you will probably need the libglibc libraries from the "testing" branch. Look it up.

    caveat: I recieved a compile error for the v500 when I used the eabi-4.7 . . . . . yeah. You'll have to work that out.

    There is a modified anykernel script for emmc devices out there (Search Google or here in xda). You will have to use the anykernel script after making your boot.emmc.win image as fastboot won't work on the 500. There may be another way .... But I don't know what it is.

    Edit* There are now two different kernels for the LG GPad 8.3 V500(awifi) located in the development section of the forum.

    Best of luck! -sleekmason
    4
    Thank you for this guide. I am working to take the plunge in building my own v500 kernel and already have a Debian box in the house. This will definitely help me get started. For the Dev setup and compilation.

    Sent from my LG-V500 using XDA Premium 4 mobile app

    Some notes for the v500 make:
    You will want to download the v500 source from here: https://www.lg.com/global/support/opensource/opensourceList?superOsCategoryId=CAT00000001&osCategoryId=
    You will want the LGV500 kernel source.

    Where it says "palman" for the defconfig items, you will want to replace that with the defconfig for the 500, so replace palman with awifi-perf,
    like this:
    export KERNEL_DEFCONFIG=awifi-perf_defconfig
    make awifi-perf_defconfig

    Now, I have the 4.7 eabi listed for download as it changes the gamma to reasonable defaults on the 510. You will probabably need the libglibc libraries from the "testing" branch to use 4.7
    I'm going to update this in a minute to show 4.7 as an option, and 4.6 as the default.

    I WOULD TRY WITH 4.6 FIRST ( It's easy to change out the 4.6 eabi folder for the 4.7 when you want)

    caveat: I recieved a compile error for the v500 when I used the eabi-4.7 . . . . . yeah. You'll have to work that out.

    There is a modified anykernel script for emmc devices (Search Google or here in xda). It didn't work for the 510 and will need a minor tweak to work with the 500. You will have to use (I think) the anykernel script after making your boot.emmc.win image as fastboot won't work on the 500. There may be another way ....

    Don't be discouraged by reading all of this. It really is easy once you are set up!
    3
    So can you confirm that the guide as posted worked for you? Yes? Good!

    Be aware that in order for the gamma to be changed, you may well need the original source from Lg. Also, look in my kernel thread to find all of the settings that I changed, as you may find some useful for you! The config for my latest kernel is also available on github.

    Again, if the guide worked for you as posted, please state such as you are the FIRST to try it!! (Or at least post you did!)

    I can confirm that I can get all the way to a zImage file with the LG stock kernel source and your guide and the changes to the process you document in the second post. I haven't gone any further using your guide yet than the step which pulls the boot.bac file down to my machine. I still do need to review what you changed in your GPE kernel and do some further reading on the anykernel script/process...

    Correct me if I am wrong but I think to go further with the stock kernel and test what I've built I'd have to flash my tablet back to stock and then reroot it to then test booting the LG Kernel I have built. My thought was since I'm running Mahdi to use your guide with the Mahdi source and see if that boots... however the gamma fixes are tempting me... (although as you have mentioned that would require me to figure out the 4.7 puzzle) I may flash back to stock and try that... I can always recover to Mahdi from a nandroid... *grins*

    Time for some sleep though I am running short these past few days... due to this lack of sleep my above post may seem a bit discombobulated...
    3
    Thank you for this guide. I am working to take the plunge in building my own v500 kernel and already have a Debian box in the house. This will definitely help me get started. For the Dev setup and compilation.

    Sent from my LG-V500 using XDA Premium 4 mobile app
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone