Kernel Compile for the LG GPad 510 (gpe)

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

This guide has been copied from my XDA developers forum site. For more info go there.
http://forum.xda-developers.com/showthread.php?t=2628951

This is a complete guide from start to finish, copy and paste style. If you own a gpe510 and a computer running Debian wheezy (stable), you can do all of this.

If all you want is the modified kernel, download from my XDA thread here:

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

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 guides and other sites to figure this out properly, with specific thanks going to Pete of [URL=”http://pete.akeo.ie/2013/10/compiling-and-running-your-own-android.html”%5Dhttp://pete.akeo.ie/2013/10/compiling-and-running-your-own-android.html%5B/URL%5D for his image tools.

But first, lets keep this simple eh? 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 all of this, 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 this is it! So, here we go:
Open a terminal, su to root and:
[CODE]dpkg –add-architecture i386[/CODE]
##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[/CODE]
You will need to install adb and have your permissions set up:

In order to do this you will need to go into developer options on your device to enable debugging on your tablet. Go to settings/about tablet/build number, and tap on build 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.

Create a blank 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[/CODE]
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[/CODE]
18d1 is the manufacturers code.

You will then want to restart udev on your computer:
[CODE]service udev restart[/CODE]
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 repositories, as it may be an older version. the gpe is using kitkat android and needs the latest build. It is a good idea to get rid of any old adb files on your computer.

[CODE]apt-get purge android-tools-adb android-tools-fastboot[/CODE]
##You shouldn’t use adb from the repositories. The above code removes any old builds##
Download the latest adb bundle from here:
http://developer.android.com/sdk/index.html
Move it into a new directory,
[CODE]mkdir ~/adb[/CODE]
[CODE]cd ~/adb[/CODE]
[CODE]unzip adt-bundle-linux-x86_64-20131030.zip[/CODE]
su to root and Move the bundle to /opt:
[CODE]mv adt-bundle-linux-x86_64-20131030 /opt/android-sdk-linux-x86_64-20131030[/CODE]
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]
[CODE]ln -s /opt/android-sdk-linux-x86_64-20131030/sdk/platform-tools/fastboot /usr/bin[/CODE]
We are ready to begin working on the device! first start the adb server and look for your device.
[CODE]adb start-server[/CODE]
[CODE]adb devices[/CODE]
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[/CODE]
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/op…&search=lgv510
and open it to find three folders, including a kernel folder. Move the kernel folder to ~/android.
[CODE]cd ~/android[/CODE]
Download the current eabi-4.6 Google tool chain to ~/android to cross compile your android kernel:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6

When it completes, enter ~/android/kernel and get ready to compile a new kernel from the source code.
[CODE]cd ~/android/kernel[/CODE]
Do the following each time you compile another kernel. This insures the correct path.
[CODE]export PATH=$PATH:~/android/arm-eabi-4.6/bin[/CODE]
[CODE]arm-eabi-gcc –version[/CODE] 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.[/CODE]
[CODE]export ARCH=arm[/CODE]
[CODE]export SUBARCH=arm[/CODE]
[CODE]export CROSS_COMPILE=arm-eabi-[/CODE]
[CODE]export KERNEL_DEFCONFIG=palman_defconfig[/CODE]
And here we go!
[CODE]make clean [/CODE]
[CODE]make palman_defconfig[/CODE] ## I get two warnings which have no impact on the kernel compile##
[CODE]make menuconfig[/CODE]
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.
After saving your changes,
[CODE]make[/CODE]
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!

The zimage is stored in /kernel/arch/arm/boot/zImage
To put both the zimage and any modules into a separate folder inside of ~/android:
[CODE]mkdir ~/android/kernel_output[/CODE]
[CODE]cp ~/android/kernel/arch/arm/boot/zImage ~/android/kernel_output/zImage[/CODE]
###This puts the image into ~/android/kernel_output
[CODE]find ~/android/kernel -name “*.ko” -exec cp {} ~/android/kernel_output \;[/CODE]
###This will find all modules for your kernel. We don’t need this 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

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[/CODE]
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]
[CODE]adb devices[/CODE]
[CODE]adb pull /storage/sdcard1/TWRP/BACKUPS/LG0000606708987/boot.bac /home/sleek[/CODE] 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.

Pete’s tools from above are available on Git. Youwill only need to have your “boot.emmc.win” and your zimage ready for his tools. You WILL NOT NEED to download the sources from his site as we have already done this.

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]
[CODE]mkdir /usr/src/android/boot[/CODE]
[CODE]cd /usr/src/android/[/CODE]
[CODE]git clone https://github.com/sleekmason/bootimg-tools.git%5B/CODE%5D
[CODE]cd bootimg-tools/libmincrypt/[/CODE]
[CODE]gcc -c *.c -I../include[/CODE]
[CODE]ar rcs libmincrypt.a *.o[/CODE]
[CODE]cd ../mkbootimg[/CODE]
gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
[CODE]cp mkbootimg /usr/local/bin/[/CODE]
[CODE]cd ../cpio[/CODE]
[CODE]gcc mkbootfs.c -o mkbootfs -I../include[/CODE]
[CODE]cp mkbootfs /usr/local/bin/[/CODE]
[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]
[CODE]cp unmkbootimg /usr/local/bin/[/CODE]

yeah., Everything is in place to make a kernel!

To help you after you have the tools in place, 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[/CODE]
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]
[CODE]cp /home/sleek/boot.emmc.win /usr/src/android/boot[/CODE]
Now unpack the boot.emmc.win file to get the ram disk
[CODE]unmkbootimg -i boot.emmc.win[/CODE]
Now you may now 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[/CODE]
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
[/CODE]

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]
[CODE]fastboot boot boot.emmc.win[/CODE]

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 for us to use!

If you want your kernel to survive reboot do;
[CODE]fastboot flash boot boot.emmc.win[/CODE]
then:
[CODE]fastboot reboot[/CODE]

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 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

Antutu Benchmark

Antutu Benchmark

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s