[TUTORIAL][KERNEL][GPL] How-to: Compile a kernel for the B&N Nook Tablet - Barnes & Noble Nook Tablet

This tutorial will instruct you on how to compile a kernel for the Nook Tablet.
Sources:
-B&N stock source instructions
-Adrynalyne's excellent tutorial for the Mecha
-Compiling kernels for the Arch Linux project
First and foremost, you MUST use a GNU/Linux (hereafter 'Linux') distribution. I don't care if your Mac has a BSD kernel or if you have Cygwin installed, you cannot do this without a full Linux distribution.
To keep this simple, I'm going to assume that you're using the latest version of Ubuntu Linux, version 11.10. I personally haven't used Ubuntu in a long time and so I'll include instructions for Arch when they vary.
Step 0: Pre-project Setup
This link is essential to the entire process, you will need ADB before anything else: [SCRIPT] [Ubuntu] ADB, AAPT, APKTool, Android SDK/NDK, and udev rules auto-installer
Step 1: Setting up a build environment
First, you will need to install the required packages:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev g++-multilib lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev libgl1-mesa-dev git
Next, you will need a Cross-Compile Toolchain, and for our purposes we will be using the CodeSourcery release recommended by B&N (though newer versions may work):
CodeSourcery Arm Cross-Compiler
Use the IA32 GNU/Linux TAR release.
Step 2: Pulling the Kernel Source
Now, we get to pull the kernel down and prepare it for compiling.
First, create the android directory in your home folder:
Code:
mkdir ~/android
cd ~/android
Then, we pull down the kernel source:
Code:
git clone git://github.com/admiralspark/NT-sparkkernel.git
This may take awhile if you're not on a fast connection, so go make lunch
While it's pulling the repo, untar the CodeSourcery cross-compiling tools into the ~/android directory. This will create a folder inside called arm-2010q1.
Step 3: Build the Kernel
Finally, what you've been waiting for!
We have to export a few things first, to prepare the build environment. Open a terminal and type:
Code:
export BOARD_KERNEL_CMDLINE="androidboot.console=ttyO0 console=ttyO0,115200n8 [email protected] [email protected] [email protected] init=/init rootwait vram=32M,9CC00000 omapfb.vram=0:[email protected]"
export ARCH=arm
export CROSS_COMPILE=~/android/arm-2010q1/bin/arm-none-linux-gnueabi-
Then, we build it:
Code:
make android_4430BN_defconfig
make -jX
Where X is the total number of cpu's +1 (so, on my i7, I have 4 real + 4 virtual cores +1 = 9, so make -j9).
Optionally, running
Code:
make menuconfig
before make -jX will allow you to modify the kernel.
Now, watch the output at the end carefully an you'll see the necessary files that we need:
Code:
Building modules, stage 2.
MODPOST 1 modules
CC drivers/media/video/omapgfx/gfx_vout_mod.mod.o
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gzip
CC arch/arm/boot/compressed/misc.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
CC arch/arm/boot/compressed/decompress.o
AS arch/arm/boot/compressed/lib1funcs.o
LD [M] drivers/media/video/omapgfx/gfx_vout_mod.ko
AS arch/arm/boot/compressed/piggy.gzip.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Anything marked with an [M] will need to be remembered, as well as the location of the compiled kernel at /arch/arm/boot/zImage.
And there you go! You've successfully compiled a kernel for the Nook Tablet!
See the next post for instructions on how to actually install and USE the new kernel

This post reserved

Reserved as well

More resources
Cool thanks!
First and foremost, you MUST use a GNU/Linux (hereafter 'Linux') distribution. I don't care if your Mac has a BSD kernel or if you have Cygwin installed, you cannot do this without a full Linux distribution.
Click to expand...
Click to collapse
I think you can build a kernel w/a cross compiler in OS X... but I agree it's probably easier to just use linux... even if from a VM such as virtualbox.
Also, for anyone who wants more resources, kernel-building instructions for NT, NC, and other Android devices have been documented in lots and lots of places, but but more walkthroughs can't hurt. The more info the better!
Loglud's wiki page-- in fact his whole site-- is geared specifically for NT, fwiw, and includes instructions on how to create a boot.img and I think how to flash it as well. Keep in mind though that if you're creating a bootable image w/cyanoboot it's slightly more complicated. I'll let admiral spark give you the precise instructions )
If you do a 2nd part, admiral, you may want to direct people to use fastboot for easy emmc flashing...
Other threads on XDA for the casual reader: this thread, has turned to kernel building, and the 3.0 porting thread might be of interest to more experienced folk who want to help with that effort (and it's making great progress!)
Also, loglud's thread on this topic might have some good info in the comments, though I haven't looked.
Thanks again.

fattire, thanks! The pieces on building a boot.img with irboot included, with Cyanoboot, and then using Anykernel are coming, but I'm a bit caught up in stuff right now.

weekend project
Very straightforward tutorial. I am going to make this my weekend project. I am going to try and add the super charger mods and a couple of other goodies into my build as i go. TY!

Good idea, if you don't mind I might add the supercharger mod as well as beats audio,and set up Chainfire3D for a dedicated "gaming" ROM!
Sent from my CyanogenMod 7 Alpha Final Nook Tablet

admiralspark said:
fattire, thanks! The pieces on building a boot.img with irboot included, with Cyanoboot, and then using Anykernel are coming, but I'm a bit caught up in stuff right now.
Click to expand...
Click to collapse
Sure if you need an assist (esp. w/cyanoboot or 2nd bootloader issues), find me on IRC...
Oh, quick note to those using menuconfig... if you're turning something "on" or "off"-- type space to turn off the feature (you'll see the option have a [ ]), type "Y" (or space again works) to turn it on (you'll see a [*]), or type "M" to compile it as a loadable module (you'll see [M]). You can build modules directly into the kernel, but then it's gonna make the kernel bigger. The only module that's for-sho needed to be loadable is the wifi module... to search for a feature you want to build into the kernel or make a module, use the "/" command.

C64assembly said:
Very straightforward tutorial. I am going to make this my weekend project. I am going to try and add the super charger mods and a couple of other goodies into my build as i go. TY!
Click to expand...
Click to collapse
Good idea. The source up there is a stock kernel with the smartassv2 and interactivex governors added, thats all. Let me know how it comes out, I'd like to implement it permanently in the kernel.
SilentStormer said:
Good idea, if you don't mind I might add the supercharger mod as well as beats audio,and set up Chainfire3D for a dedicated "gaming" ROM!
Sent from my CyanogenMod 7 Alpha Final Nook Tablet
Click to expand...
Click to collapse
Open Source= do it!! Though, if you get the Beats Audio/Chainfire3d working, please PM me and I'll open a branch up to host it on my github, I'd love for that to get working.
Actually, both of you PM me, I'm going to be releasing this kernel with a few more mods hopefully this weekend.

Oh yeah! Maybe we should all start using cyanoboot as a standard for our roms! Just a suggestion but itd be nice!
Sent from my CyanogenMod 7 Alpha Final Nook Tablet

Related

[Guide] In-Depth Compiling using Ubuntu 12.10

DISCLAIMER: I am in no way responsible for you breaking your phone or your computer. You the reader/user/dev/compiler understand that you enter into this agreement freely with no expectations that everything will work 100% of the time.
This is in no way a means of stealing people away from Shrikes guide. If you do not have ubuntu installed as a complete os/ or do not intend to maked modifications to system files etc. Then please use the guide for compiling roms using a virtual box here (CM9 The complete noobs guide to building CM9 in a virtual machine)
Still with me. COOL. So you now have either a dual boot or a fully thrashed Linux machine. I will be using my Vaio VPCF114 box with Ubuntu 12.10 to make this guide. This is also compatible with 12.04 if you have not yet upgraded. I am not sure if the same goes for Redhat/Fedora or Backtrack 5. My work here is a compilation of years of doing research and compiling my own roms.
This guide is to help people that have little knowledge of linux get a base idea of where to start to make their own roms and kernels. Part 1 will be building your box and compiling a rom. Part 2 will be how to make and grab your Kernel.
First lets get Dropbox from here DROPBOX This is good for backing up your libs and sharing files with other Devs.
What you need:
1) A Windows computer, preferably with a CPU that supports 64-bit. Your pc/laptop does no need to have 64-bit windows on it, your CPU just needs to support the hardware. I think at this day and age, almost all devs have a 64-bit box. You will need this so you can make a dual boot box.
2) Plenty of memory. I recommend at least 4GB on the host computer. You can make it work on less, but more is better.
3) At least 60GB of free hard drive space during the install, but i'm sure you already know that and have gigs upon gigs of free space. If you do not know how much space you have, go to settings>details and it will tell you. Note: The source download is approximately 8.5GB in size. You will need over 30GB free to complete a single build, and up to 100GB (or more) for a full set of builds.
4) Lastly a good book, tab, second pc, whatever because this is not a quick process. And compiling roms literally takes hours.
5) Most importantly UBUNTU 12.10. If on the off hand you do not have it, you can pick it up at Ubuntu Central
OK YOU READY. LET'S GET CRACKING. First you need to set up Java on your box. Then grab a couple of programs you will need for editing files Go to your UBUNTU SOFTWARE CENTER. In the search bar in the top right type in Java. We will be installing Java 6 Runtimes.
{
"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"
}
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, go here JAVA
If the link does not work, you want accept the license agreement and download jdk-6u35-linux-x64.bin
Once it done:
chmod a+x ~/Downloads/jdk-6u35-linux-x64.bin
sudo mv ~/Downloads/jdk-6u35-linux-x64.bin /usr/lib
cd /usr/lib
sudo ./jdk-6u35-linux-x64.bin
Now lets finish the install and make it default: (Remember to enter in the lines one at a time)
sudo mv jdk1.6.0_35/ jvm/
sudo rm jdk-6u35-linux-x64.bin
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/jre/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_35/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_35/bin/javadoc 1
IF YOU HAVE MULTIPLE JAVA JDK'S INSTALLED FOR OTHER PROJECTS YOU WILL WANT TO MAKE 1.6 THE DEFAULT.
On each command you will have to select the version of java you want to use. This command is helpful if you also do other coding.
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Java 6: for Gingerbread and newer
Java 5: for Froyo and older
Note: The lunch command in the build step will ensure that the Sun JDK is used instead of any previously installed JDK.
Now what we need:
We need to open up a terminal window and download packages.
Remember you will need to input your password after each line.
sudo add-apt-repository ppa:git-core/ppa
and
sudo apt-get update
(this will download all of the Quantal updates for universe and multiverse.
Next we want to install some Libs and Binaries. (You can copy and paste this into your terminal)
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool gcc-multilib g++-multilib pngcrush
(don't worry. some of the libs my fail. This happens as google changes their sources)
Now we need to tell the computer how to "REPO", this is where you will tell it to handle the Andorid sources via the Git command.
cd ~
mkdir -p bin
export PATH=${PATH}:~/bin
Once done you can use "echo $PATH" to see all of your path directories.
sudo apt-get install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
(this will get you the repo script)
Now lets give it executable permissions by using chmod
chmod a+x ~/bin/repo
Now that we can repo
Lets setup the Android SDK. (Get a beer/coffee/soda, this will take a second)
Go to http://developer.android.com/sdk/index.html And install the ADT bundle for Linux.
Install the SDK and Eclipse IDE
Unpack the ZIP file (named adt-bundle-linux.zip) and save it to an appropriate location, such as a "Development" directory in your home directory.
Open the adt-bundle-linux/eclipse/ directory and launch eclipse.
That's it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go. To start developing, read Building Your First App on the developer site.
Caution: Do not move any of the files or directories from the adt-bundle-linux directory. If you move the eclipse or sdk directory, ADT will not be able to locate the SDK and you'll need to manually update the ADT preferences.
Now to just add the tools to our $Path.
gedit .bashrc
Scroll to very bottom, under last fi input
export PATH=${PATH}:~/adt-bundle-linux/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux/sdk/platform-tools
That was pretty painless.
Now lets start some cool stuff.
TestSigning
Click on your desktop menu bar and go into your home folder. Press Ctrl and h together on your keyboard to show hidden folders. Anything marked with a . in front of it is hidden, we are looking for a folder name .gnome2, go into it and look for nautilus-scripts. Once inside this folder, right click on a empty space and select create document and then empty file and name it sign. Open up that empty document and copy and paste this script from dumbfaq on xda
Code:
#!/bin/bash
# Update the Loc var to where YOU stored the testsign.jar file !
SUCCESS=
Loc=~/android/source/
for arg
do
TMP=$(ls $arg | sed 's/\(.*\)\..*/\1/')
EXT=${arg##*.}
java -classpath "$Loc"testsign.jar testsign "$arg" "$arg"-signed 2> /tmp/signTmp
SUCCESS=$?
if [ $SUCCESS -eq 1 ]
then
zenity --info --title "Sign APK" --text "signing FAILED! \n`cat /tmp/signTmp`"
exit 1
fi
mv $TMP.$EXT-signed $TMP-signed.$EXT
done
zenity --info --title "Sign APK" --text "signing completed!"
Save and exit out and right click on our new script and select properties. select the permissions tab and look for a check box that says allow executing as a program. click on it and now we have a pretty little script that we can just right click on a update.zip file and sign with our test keys for flashing. You will also need the testsign.jar from the bottom of this guide.
Now lets do a couple things so that we can get our Phones Vendor ID.
Type in your terminal
lsusb
While your phone isconnected to see our vendor id and you will something like this. Note that for the Rezound our vendor id is
Bus 002 Device 003: ID 0bb4:0ccd HTC (High Tech Computer Corp.)
In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.
Now that we have that, we can make our rules for for connecting to adb
sudo gedit /etc/udev/rules.d/51-android.rules
Paste
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
Save and exit
Reboot your computer so that all of the changes we have made can Take effect.
OK. All setup and ready to start making a Rom with your name on it.
IF you are already running AOSP on your phone, you can back up you system now Do this by:
cd ~/
mkdir stock
cd stock
adb pull /system/ ~/stock/
This will dump your entire system directory into the stock folder. This is good so you always have a working system. Now zip the folder and tuck it away for safe keeping.
Now the MEAT AND POTATOES. Grabbing the Source. "CYANOGENMOD"
cd ~/
mkdir -p android/source
touch ~/.netrc
cd ~/android/source
sudo apt-get install git
sudo sysctl -w net.ipv4.tcp_window_scaling=0 (remvoes the overstack flow problem that causes some repo jobs to hang)
repo init -u git://github.com/Chad0989/android.git -b ics
(Note: If you want to compile a jellybean rom, just replace the ics with jellybean!)
Once you do this, it's going to ask you for your email. This is how you will log back into the repo in the future. So answer the questions correctly.
Now we will sync the Repo and set it to run.
repo sync -j4
-j# (# means twice the amount of cores in your computer) means jobs. I have an i7 processor and a pretty decent internet connection, so i'm running max jobs at once for faster sync) Be patient. It's still going to take a while to clone the directory.
Once done with the Sync we want to setup our device.
This is where we get the pre-built part of our rom.
First we will
./vendor/cm/get-prebuilts
Probably all that will be left directly after the repo will be the Terminal service for android.
Now we are about ready to compile our Rom:
cd ~/android/source
repo sync (it should only take a moment this time)
. build/envsetup.sh
make clobber
Now you can compile your rom using the brunch command (This will take about 1 to 1 1/2 hours depending on your box)
brunch vigor
Now you can go to the output box and pick up your freshly made Rom.
Reserved for Kernel
Changed Repo from CyanogenMod to Chad0989 for easier Vigor integration.
21NOV12: Change Repo from Chad0989 to Dragonstalker github.
Change Repo from DragonStalker to Chad0989 github
Modified Testsign script to reflect changed ADT Tools location.
First, looks interesting i might look into this when i boot into Ubuntu next time.
jon7701 said:
First, looks interesting i might look into this when i boot into Ubuntu next time.
Click to expand...
Click to collapse
i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.
dragonstalker said:
i wanted to show people how i do my own personal roms and kernels. With this setup, you can make roms for multiple devices and also use Eclipse to make apps if thats your bag baby.
Click to expand...
Click to collapse
Nice, if i can figure out a little more about how to dev and stuff maybe ill make my own rom one day.
Wow. So going to do this right now. Thanks for your effort on this.
Sent from my ADR6425LVW using xda premium
I can't wait for the final act! I am going to try this so I can get my hands on some jelly beans.
Vedor ID
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.
Very nice guide. Extremely thorough which makes a great tutorial.
vonhinkle said:
Quick question. I notice that you mention that "in this case the Vedor ID is 18d1" but in your screenshot it say 0bb4. You have some clarification after that and I'm not sure I understand it 100%. My rezound show the 0bb4 for vedor ID as well. I guess what I'm asking is if you could clarify the statement about the Vendor ID? Thanks, sorry if this is a dumb question.
Click to expand...
Click to collapse
It shows it as 0bb4. But as for the drivers Ubuntu uses. The Vendor id for High Tech Computers is 18d1. I was using a stock rom to pull the vendor Id from and for some reason, HTC has never changed it on there.
GrayTheWolf said:
Very nice guide. Extremely thorough which makes a great tutorial.
Click to expand...
Click to collapse
I teach networking to and development to the Army. I took the same ideology into this guide. Not just tell you how to do it, but explain why it works. I will, as thing change try to keep this updated, and keep up with Shrike as he learns new things. Thank Shrike for making me realize that we didn't have a guide for people that do run Ubuntu, and need to know how to set up.
Ok the updated Guide is online. Please tell me if anything is not correct. I'm only Human. Working with Snuzzo for and Updated Kernel Optimization section and hopefully Chad with the Repo..
More to Follow .............................
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.
Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.
drkow19 said:
I'm compiling right now. The guide was good, but there were some extra steps I had to take to get this far. My Rezound is old, so my android.rules file needed the 0bb4 id (I got rid of the ATTR{idproduct} part). Also adb wasn't connecting when using filename 51-android.rules, so I used 70-android.rules and mode 0666 instead of 0600, then adb connected. I think the 70 was the fix, but mode 0666 I found from other, older guides on setting up adb, I don't know what change that makes but it's probably unnecessary. Finally, on compile I was getting errors like bison missing and other missing also. That big line with all the installs must have not worked for all the programs, so I just installed the missing ones individually per error message. There may have been other issues that I am forgetting but nothing too hard to figure out, of course I have worked a tiny bit with Ubuntu over the past 5 years.
Still compiling, so it seems to be working. I used Chad0989's repo, and jellybean! Thanks for the guide, if I have any problems I shall post them.
Click to expand...
Click to collapse
Thanks for the headsup. Android.source.com said to change it to that. SO I will change it back.
As for the progs that did not install. Android Source pulls progs, i've just been to lazy to go over the tag and remove the ones that have been obsoleted. I will take care of that this weekend.
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.
What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://forum.xda-developers.com/showthread.php?t=1965290 and it worked.
edit: google search seems to force close with the gapps I used.
drkow19 said:
Schweet! I compiled my own rom! Syncing took about 30 mins, compiling also 30 mins. I have a 4.4 ghz oc'd Core i5 with 8 gig 1866 ram. Now I need to learn some simple things, like how to rename the rom package, edit the installation text, add some tweaks, etc.
What gapps do you use for CM10? I downloaded this one http://wiki.cyanogenmod.org/wiki/Latest_Version/Google_Apps for CM10, but it doesn't list xdpi, and it failed flashing. So I used this one instead http://forum.xda-developers.com/showthread.php?t=1965290 and it worked.
edit: google search seems to force close with the gapps I used.
Click to expand...
Click to collapse
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
issues
dragonstalker said:
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
Click to expand...
Click to collapse
hey guys ive been compiling on 12.04 still new to this but ive set up a new enviorment useing this guide with 12.10 im getting this error though
Import includes file: /home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/import_includes
make: *** No rule to make target `/home/ken/CM10/out/target/product/i577/obj/lib/libaudioalsa.so', needed by `/home/ken/CM10/out/target/product/i577/obj/SHARED_LIBRARIES/audio.primary.msm8660_intermediates/LINKED/audio.primary.msm8660.so'. Stop.
make: *** Waiting for unfinished jobs....
target StaticLib: libc_nomalloc (/home/ken/CM10/out/target/product/i577/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a)
any help would be appreatiated thanks
dragonstalker said:
Note: There is a reason that me and Chad have asked not to compile CM10 roms. The code is not complete yet.
If you found gapps that work, then that's a major. Post to the thread where you found it and that it works. To rename a rom package, you can just right click>rename and name it what you want it. To rename it so it shows up inside the rom on the phone for details is different.
I would not advise it if you don't know what you are doing, but you have to edit the build.prop. As for tweaks. Depends on what tweaks you want to change. Android Developer site is where i get all my tweaks, and i get some from other devs. Glad you are joining the community.
Happy building and thanks for the contribution.
Click to expand...
Click to collapse
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:
drkow19 said:
Roger that. I will definitely try to do some build.prop tweaks, and then move on from there. Thanks again for the guide! Meanwhile I am emailing Ubuntu about their re-installer option to erase and reinstall Ubuntu, which wipes out all partitions, not just the current Ubuntu partition as I figured would happen. It wiped my main NTFS partition with all my stuff, without even a warning! Currently using Active Partition Recovery, but I fear since I compiled CM on that whole harddrive that most of the contents were probably overwritten. :crying:
Click to expand...
Click to collapse
Never heard of that happening before. Let me know what you find out.

[TUT] Introduction into Kernel development

INTRODUCTION INTO KERNEL DEVELOPMENT
PREPARATION
This guide is NOT a full development tutorial! For development of kernels you should be familiar with C. I cannot teach you full C - would be too much for me - but I can show you how to prepare a build environment especially for RAZR Kexec Kernel building! At the end you will find some first steps about how to develop a kernel.
As soon as you have a full dev setup you will be motivated to proceed with learning C - hopefully
For me it worked!
The reason is that I would like to see more people giving it a shot! Kexec is wondeful and it would be great if there are some more people working on kernels.
Please leave me some credits if this tutorial helped you wherever you provide your work! THX!
OVERVIEW
1. Install Linux
2. Setup build environment
3. Initialize Kernel Source
3.1 Branches
3.2 How to compile a kernel
4. Create your first development branch (Add a new Governor)
5. Git Commands
I will tell you the way I started once and guide you through the preparation.
It's important to know how to setup a build environment! The best way to learn about kernel development is to learn by practice!
How to setup a build environment
1. INSTALL LINUX
I suggest Linux Mint 15 Cinnamon (or Linux Mint 15 Mate is good for older for low-spec Systems) - it's free and very easy to install near Windows 7 (dual boot). After the installation you will have a very Windows-like desktop environment which is easy to handle also for beginners. Then you need to learn the Linux Shell!
*of course you can install any other Linux, like Ubuntu. Linux Mint is based on Ubuntu 13.04 and I use it as well.
If your CPU supports 64 bit you should install the 64 bit version! This is impossible also later when it comes to install libraires for development, etc. There are mostly two versions, whether for x32 or x64.
After the installation of Linux you need to imstall related software and depencies.
2. SETUP BUILD ENVIRONMENT
Now, Linux is installed, we begin to setup the build environment.
First install Git which is the main part for using services like Github, etc..
We will install also adb and fastboot!
NOTE
The main installation command for packages in Linux is:
apt-get install (mostly used with 'sudo' ("superuser doers" - admin), then it will be:
sudo apt-get install package-name
You can combine one command to imnstall multiple packages, like:
sudo apt-get install package-name package-name ...
It doesn't matter how much names you enter!
NOTE: Sometimes you will have to confirm the installation of a specific package, means it will ask you for proceed (e.g.: ...this will take xx mb of space (J/n) ?).
Press "j" and enter in this case.
Click to expand...
Click to collapse
Let's start!
Open a shell (terminal) and type:
Code:
sudo apt-get install git android-tools-adb android-tools-fastboot
(you will have to enter your password. Keep in mind that you won't see any input when typing passwords in Linux!)
Now you have installed adb, fastboot and Git!
After this you need to create a working space which means you have to download the full Android source to be able to build your kernel later.
Still in Terminal make sure you're in your user root directory (just type "cd" to get back into your root dir). Now you have to create a new directory for Android sources. Therefor we use the "mkdir" command (make directory). We need to create a folder structure, so we create another folder inside of your new folder:
Code:
mkdir android
cd android
mkdir system
NOTE
This will create: /home/android/system
There is a simpler way to create a folder structure by using on single command. Just add a "-p" to the mkdir command to create multiple directories:
Code:
mkdir -p ~/android/system
NOTE
The "-p" lets you also create directories while being somewhere else!
The "~" symbol is a placeholder for your home folder! It tells the terminal that you want to create the folders in your "home" dir. For better understanding I'll show you the command w/o the placeholder again:
mkdir -p /home/android/system
Click to expand...
Click to collapse
Now you have install the depencies (libraires, etc, needed for compiling Android). So you are still in your terminal and type:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jre openjdk-6-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc
NOTE
These depencies are for 32 bit & 64 bit systems!!
Click to expand...
Click to collapse
Now we need some additional libs because we are using a 64 bit system. Still in terminal install them by using the apt-get command. I will only show you the package names now, so you can practice and see if you have understood it. Install these:
Code:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib
NOTE
You can simply use copy&paste
Click to expand...
Click to collapse
Next step is the creation of the repo base directory. It is needed by the repo software which lets you control and use the git repositories on your local machine (your computer). Use the "mkdir" command to create the following directory:
Code:
mkdir -p ~/bin
Now you have to install the "repo command". It's a binary file, so you have to make it "executable" (runable) by using the "chmod" command. Chmod is similar to the "set_perm("...")" command used by updater-scripts (EDIFY script language). It just sets the permissions of a file, i.e. to allow the execution of this file or to make sure the file can be accessed by any people or other programs.
Enter the following to download the "repo" binary and make it executable (runnable):
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
NOTE
It would be too much to explaing stuff like "Curl", etc..
Click to expand...
Click to collapse
Now we have to make sure that we can call "repo" from anywhere. This means if you're in terminal in for example: $ /home/Downloads and you type "repo" it will tell you usually that "repo" is an unknown command. To avoid this we need to make it generic by adding "repo" to your static PATH (Path of execution). The command:
Code:
export PATH=${PATH}:~/bin
NOTE
if you set an "export" for anything (lkie repo) in your terminal, it will be gone as soon as you exit the terminal or also after a reboot. To keep it in your PATH forever you have to add the "export" to your bashrc file (this file stores your preferred Path commands, it's like a list where you can add whatever you need) to make this change to the path permanent for all future Terminal sessions:
Code:
gedit ~/.bashrc
This will launch a graphical text editor (if it doesn't work, try it with "sudo"). Just copy&paste the following line into it, save it and close:
Code:
export PATH=${PATH}:~/bin
Click to expand...
Click to collapse
Fine! So far we are prepared! Now we have to download the android source!
Still in terminal, type:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
NOTE
"repo init" initializes a repository oy your PC
the Git address is the link to the CM source code repo. YOu just told the computer that you just initialized a CM Git repo in the specifi folder /android/system
Click to expand...
Click to collapse
.
To start the download of all the source code to your computer:
Code:
repo sync
NOTE
This process can take a very long time - depends on your internet connection speed. The source is about 10 GB!!
"repo sync" will be your further command to keep the rpo up-to-date! Just enter it while being in the root dir of the android source (/android/system) at least once a day!
Click to expand...
Click to collapse
Now, when the download has been finished we have to download the prebuilt apps (like terminal emulator, etc):
Code:
cd ~/android/system/vendor/cm
then enter:
Code:
./get-prebuilts
Now there are the vendor files needed! There are two ways to do that: The "easy" way and - sometimes it doesn't work, then you have to use - the "harder" way.
The easy way:
Code:
source build/envsetup.sh
breakfast spyder
NOTE
this will usually download the vendor files (motorola speific device drivers). If you get an error message you have to use the second way (harder way).
Click to expand...
Click to collapse
Click to expand...
Click to collapse
The harder way:
cd to you vendor dir and clone the proprietary files manually:
Code:
cd ~/android/system/vendor
git clone https://github.com/Motorola-OMAP4-CM/proprietary_vendor_motorola.git -b cm-10.2
NOTE
"git clone" will be used always when you want to download a git repository to your computer, so you can work with it locally. e.g on Github.com there is always a clone URL given at the right side of the repo. Just type "git clone <link>" into the terminal to clone this repo.
Click to expand...
Click to collapse
Now open the file explorer (whether by using the mouse or in terminal: nautilus (maybe you you have to install this first) and head to /android/system/vendor.
You will find a folder called "proprietary_vendor_motorola".
Just rename it to "motorola".
NOTE
In the future, everytime you update your repo (repo sync) you will have to update the vendor repo too. Perform this by using "git remote update" command in terminal. Therefore you have to be in /android/system/vendor/motorola, and type:
Code:
git remote update
git pull
Click to expand...
Click to collapse
Congratulations! You have successfully setup your Android build environment!
Now we need the kernel source!
3. INITIALIZE KERNEL SOURCE
So you learned some basics about Git! Proof that you understand it and clone the kernel source repo to your PC! I'll give you the links but you have to clone it yourself! Use the clone URL you find at the following Github repo. Make sure you are NOT cloning into your Android source dir /android/system!)
The source for our 3.0.8 Kernel:
www.github.com/CyanogenMod/android_kernel_motorola_omap4-common
NOTE
Too hard? Let me help you (You can even copy&paste my stuff - but for real learning experience you should try to make it on your own)
Head into this dir:
Code:
cd ~/android
Clone the kernel source:
Code:
git clone https://github.com/CyanogenMod/android_kernel_motorola_omap4-common.git
The new folder will be: ~/android/android_kernel_motorola_omap4-common where your kernel source sits.
When done, you have successfully loaded the kernel source! Fine!
3.1 ---> BRANCHES
Now I am going explain you something about "branches" and how to use them!
A "branch" is a part of almost all git repos. It is very important and also very useful to work with branches!
A typical repository looks like that:
[CODE GIT REPO
|
master branch
/ \
/ \
branch: Test branch: Stable
\ /
\ /
\ /
MERGE changes[/CODE]
The repo contains mostly multiple branches. There is always the "master branch" (can have another name of course, branches can be named like you want) and some lower branches.
The "Master branch" is the main branch!
All other branches are custom and mainly used to test new code or sth else.
Let's say we have a kernel repo! This repo contains the JBX-Kernel. The master branch contains the current STABLE Version of the kernel. Now we want to implement a new feature. But when we use the master branch for development (which is sometimes an experiment) we could potentially break the kernel or its source and make it becoming unusable. Therefore we can use a different branch.
NOTE: A branch is always a copy of this branch where you are while creating a new branch! This means when I am currently in the JBX-Kernel master branch, and I create a new branch from there, then I will get a new branch which includes a full copy of my JBX-Kerne master branch. -- But I can work with it without being scared about breaking my repo!
Then many devs are using a "Merge branch". There we could in example copy all changes (which have been tested successfully before) together into a new branch. This process is called "merging".
Let's say we have finished our new feature inside of a test branch. Now the feature is ready to be built in into the Stable Kernel. Then we merge the test branch into the master branch. Thsi results in an updated master branch which now includes our new feature!
Another possibility to use branches can be found if you want to split our repo into different systems, such like the CM kernel source contains branches for CM10.1 and CM10.2. So there is a branch calld "cm-10.1" and another branch called "cm-10.2".
When you look at the part where we initalized the CM repo, you might notice that the repo URL includes this:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
The line marked with red in the URL points to a specific branch, the cm-10.2 branch.
Now we are still in the kernel source dir!
Because you want to build a 4.3 Kernel we need to be in the right branch for this! There are already branches exisiting in the kernel source (like explained above), it's splitted into different versions (4.2.2 and 4.3).
Still in terminal be sure you're inside your kernel source root dir (~/android/android_kernel_motorola_omap4-common), type:
Code:
git checkout cm-10.2
NOTE
"git checkout" is the command to switch to another branch. But it's also used to create or delete branches. More about that later...
Click to expand...
Click to collapse
The output in the terminal will tell you sth like: "Switched to branch cm-10.2"
(if it's the first time you enter a branch it will download the files first and tell you: "Switched to a new branch cm-10.2". Don't be confused by this. If you try to enter a non-existing branch it will give you an error).
Now you are in the kernel repo, in the 4.3 branch!
Before we start to play with the source code I will show you how to build a kernel! As long as the kernel source is untouched you can be sure that it will work! Also this will make sure you have done everything right so far - as soon as the kernel boots you've built!
3.2 HOW TO COMPILE A KERNEL
To get a first impression about how to build the kernel, please have a deeper look at my personal JBX build script:
https://github.com/RAZR-K-Devs/android_kernel_motorola_omap4-common/blob/JBX_4.3/build.sh
The script is very simple and contains only a few commands which can be used in the terminal as well. For your the script is only interesting until the poiont where it says: "make -j4 TARGET_KERNEL_SOURCE=/home/dtrail/android/android_kernel_motorola_omap4-common/ TARGET_KERNEL_CONFIG=mapphone_OCE_defconfig $OUT/boot.img"
Since the latest Android version and the modified kexec stuff it's not enough anymore to build the kernel only. The PVR source has been moved into the Android source and it must be built together with the kernel in order to get a working (booting) kernel! That's why I don't show you the common way.
In fact you can now build your kernel by taking my build script commands, and enter them - one by one - in your terminal. BUT you have to modify the paths because script was made for use on my computer (so, you probably are not called "dtrail!" ). You have to start in your kernel source dir (this is the location where my build script is being executed). To make it easier for you, I have pasted the script here and changed it so it will work for you. I have removed all comments and echo (output) commands so there are only the related build commands left. I just added comments just for you:
Code:
# THESE LINES (those beginning with #) ARE COMMENTS!!!
# Be in your kernel source: /android/android_kernel_motorola_omap4-common
# this command cleans all leftover files from prior compile (needed)
make mrproper
# We build the kernel and its modules
# enter the Android source dir
cd /android/system
# This command makes sure to use the additional build cache. It will make all fufutre build processes MUCH faster! (YOu have to install ccache first by using apt-get)
export USE_CCACHE=1
# Clean also the Android source dir
make mrproper
make ARCH=arm distclean
# Tell the compiler that we want to build now
source build/envsetup.sh
# Tell the compiler which device we want to build for
lunch cm_spyder-userdebug
# built kernel & modules (This command includes the full path to the kernel course and the used kernel config)
make -j4 TARGET_KERNEL_SOURCE=/home/YOUR_USERNAME_HERE/android/android_kernel_motorola_omap4-common/ TARGET_KERNEL_CONFIG=mapphone_mmi_defconfig $OUT/boot.img
After you entered this your computer will start building. The first compiling process will take longer! But future bui9lds will be built much faster thanks to the use of CCACHE!
CONGRATULATIONS!! You built your first kernel!!
Now we have to create a flashable zip file and flash the kernel to see if it works. >The advanced Linux users from you should have another look into my build script I linked above, there you can see how it automaticall pushes (copy) the fiules into a prepared folder which includes everything needed for a flashable zip and compresses it to a ready zip file!
Other less experienced users can just download my latest JBX-Kernel, unpack it, delete "logo.bin" and do this:
go to (by using mouse or terminal):
Code:
/android/system/out/target/product/spyder
There you will find a file called "kernel" - this is your fresh compiled kernel! Copy it to the unpacked JBX-Kernel folder, into:
Code:
.../JBX-Kernel_whatever.../system/etc/kexec
(and overwrite the previous kernel in there)
Now go to:
Code:
/android/system/out/target/product/spyder/system/lib/modules
There are all the modules you've just built. Copy them to:
Code:
.../JBX-Kernel_whatever.../system/lib/modules
Now compress the folders to a new zip file, copy it to your phone and flash it in recovery!
4. CREATE YOUR FIRST DEVELOPMENT BRANCH (add a new Governor)
to create a new branch locally, be in terminal inside the root of your kernel source, and type:
Code:
git checkout -b BRANCH_NAME
Replace BRANCH_NAME with whatever you want!
Now you created and switched to your new branch! Here you can start plaing with the files!
To develop Linux kernel (Android IS Linux!) you will have to learn C! The kernel is developed in pure C which is the best programming language for drivers (machine controlling).
if you're German I can suggest your the "open Book - C von A bis Z" (Galileo Computing, gratis).
Otherwiase just google for free C books or tutorials.
Take your time, this is not easy in the fist place - but as soon as you are more experienced you will find it more easy!
The best way to learn it is to read and browse others Kernel repos! You are always free to watch my JBX-Kernel Repo! Read the commit messages to see what this commit is for and look at the code-side changes! If you read carefully, and learn C at the same time, you will understand the commits, step by step.
Let me give you some more hints:
Set you some smaller goals and start to reach them one by one! Don't set yourself too high goals, otherwise you will make yourself too much pressure!
Small steps are the way to your success!
Some of you might only want to make some minor changes, such like adding new governors, etc. Therefor you can i.e. use google to find related commits. So open Google and type:
Code:
github kernel omap add governor
We hope that google will show us some repos where the dev(s) wrote commit messages like "Added XXX governor", etc, etc..
In this example Google will put out this:
https://www.google.com/search?q=github+kernel+omap+add+governor
If you click the link you will find the very first result, which leads us to:
https://github.com/broodplank/glass-omap-xrr02
There click on Commits and you will see a commit "Add SmartassV2 governor". Now open this commit, you will find this:
https://github.com/broodplank/glass-omap-xrr02/commit/f959e0e8c16412319e991b26aaa50d8fe3555a4e
There you can see now the FULL commit with all its details! It shows you exactly how to add a governor! The green parts are ALWAYS insertions on Github, while red parts are deletions! SO you can see exactly:
1. WHICH files have been changed
2. WHAT has been changed in these files
3. WHERE in the files were the changes made
4. HOW were these changes performed
Now, if you study this commit for a while, you might know what has to be done in order to add a new governor!
NOTE: The very long files which are COMPLETELY green are NEW FILES!
Let's say you want to take this SMartassV2 governor into your kernel:
You can do it with different ways.
1. Cherry-Pick
For this weay you have to add the "glass-omap-xrr02" repo as remote to your repo. So you get the clone URL and use the git remote command (in your kernel root dir with terminal):
Code:
git remote remove upstream
git remote add upstream https://github.com/broodplank/glass-omap-xrr02.git
Now we must fetch the repos content:
Code:
git fetch upstream
Wait until the fetching process is finished.
Now we need the SHA1 sum of the commits. You go to your browser and look at the commit. The SHA1 is a very large number you can find at the upper right.
In this case this is the SHA1 for the commit "add SmartassV2 governor":
Code:
f959e0e8c16412319e991b26aaa50d8fe3555a4e
So, we need to cherry-pick this commit by typing in the terminal:
Code:
git cherry-pick f959e0e8c16412319e991b26aaa50d8fe3555a4e
Now there are three possibilites! If you see a message about "...conflicts" then it didn't work correctly because your local kernel source files might be a little bit different than those from the remote repo. In this case you open these files with a text editor (gedit) and find the lines with the errors, they are looking like this:
Code:
<<<<< HEAD
..some code...
>>>>>> Add SmartassV2 governor
Compare the files to those in the remote commit in your browser qand correct the issues or just this:
Code:
git cherry-pick --abort
This reverts your cherry-pick and your files are clean and like they were before the cherry-pick!
YOu can add the governor manually by simply looking the remote commit in the browser and copy the green stuff into your local files. Make sure you insert the codes in the right places!!! When you copy it from the green parts you will have to remove EVERY SINGLE "+" at the beginninf of each line!
There is another view in github for files, called "RAW". This will shows the pure file - but also without green/red marks! But in case you add the SMartassV2 governor, you can just search for the keyword "smartass" in the raw view of the file and then copy all lines which are including "msartass" into your local files
The governor itself is a complete new file, so you canswitch to the raw view, right click --> select all --> copy. Then create as new file in the right location (/kernel_source_dir/drivers/cpufreq/cpufreq.c) with the same name like in the commit (cpufreq_smartassv2.c) and paste the whole code into it, save and close.
Don't forget the rest of the code in the other files!!
At last you have to insert the new governor into your kernel configuration! The kernel config is mostly a "defconfig" file!
ALl the related defconfigs we need are located in:
Code:
.../arch(arm/configs
The default defconfig for our RAZR is the:
Code:
mapphone_mmi_defconfig
The defconfig file inlcudedes everything which is built into the kernel later. If you search for keyword "GOV" you will see the other governos, like Hotplug, etc.. YOu can see how they are used in the defconfig file, so add your new governor the same way. This should be:
Code:
CONFIG_CPU_FREQ_GOV_SMARTASS2=y
# CPU_FREQ_DEFAULT_GOV_SMARTASS2 is not set
*The second line is for setting it as default governor.
Thats was it! Now make sure everything was done the right way, save and close all files. In terminal type:
Code:
git status
This shows you info about the current status. In this case it will show you the changed files and the new file(s) in red color.
Now you have to stage your commit:
Code:
git add .
Adds all new/changed/untracked files to the commit, then:
Code:
git commit -m "Added Smartassv2 governor"
Done! Your new commit is staged to the index and can be uploaded! (Uploading is not part of this at the moment! If you want to learn more about git, use Google)
Now repeat the compile process like you did already! See if your new governor is included and working.
For further learning it's a good way to proceed with learning C and read, compare and understand commits from other devs/repos.
Ok, guys! I hope you enjoy the guide and it's helpful for you! I will extend/fix/correct this time by time... for now I'm done!
5. GIT COMMANDS
Here are some basics about using git by Terminal:
git branch -D BRANCH_NAME - Delete a branch
git branch -b BRANCH_NAME - create a new branch (but don't switch to it)
git checkout -b BRANCH_NAME - create & switch to a new branch
git checkout BRANCH_NAME - switch to a exisitng branch
git push origin BRANCH_NAME - upload your changes to your repo on Github (You have to be in that branch you are also uploading to!)
git remote update - checks for the latest changes in the original repo (that one where you took the source)
git pull - after you used "git remote update" use "git pull" to download the changes to your computer
git diff BRANCH_NAME - shows differences between the current branch and any branch
git add . - Adds all your changed files to the index (this is important to upload your changes)
git commit -m "this is my commit message" - USe this after "git add ." to append a message to your changes, so other devs can
see why you did it, etc..
git log - Shows the commit history (the history of changes in this repo) inlcuding the related SHA1 for each commit
git revert SHA1 - this reverts (undo) one spedific commit. The SHA1 sum can be found near the commit messages (whether you
can look the with your browser or by us ing "git log")
git remote remove upstream - Removes the current upstream repository
git remote add upstream <git URL> - Adds a new upstream, useful if you want to take over changes from another repos/devs
git fetch upstream - get the new remote repo's content
git cherry-pick SHA1 - this picks one single commit from your current upstream repo - or from another branch
git cherry-pick --abort - This aborts your curerent cherry-pick, useful if you run into conflicts
Click to expand...
Click to collapse
If you find any mistakes or somethings missing in your mind, PM me or post it here.
Please leave me some credits if this tutorial helped you wherever you provide your work! THX!
CREDITS
*Cyanogenmod - took some single infos from their website
How to build Cyanogenmod for Droid Razr (website):
http://wiki.cyanogenmod.org/w/Build_for_spyder
*Hashcode - for being always helpful and supportive and of course for his great work with dhacker
*Linux, Google, XDA-DEVELOPERS
-- reserved --
Another reserver
MINE
Great write-up @dtrail1,
And I completely agree. I'm always hoping for more devs to jump into kernel development to learn and have fun with their devices.
Deffinitely interested in this. Il be hitting this guide up soon as I pick a better internet provider for Repoing.
Saving your book
Sent from my XT910 using xda app-developers app
Thanks for the write up .
Sent from my XT912 using XDA Premium 4 mobile app
Thanks. Perfect for youngsters like me
Sent from my XT910 using Tapatalk 2
Corrected a typo where a .git extension was missing (and users might not be able to clone the repo without it)
umts_spyder
Thank you dtrail1 for the great guide.
as XT910 owner, i guess that everywhere I see spyder in the code, I should replace it with umts_spyder ?
tester5224 said:
Thank you dtrail1 for the great guide.
as XT910 owner, i guess that everywhere I see spyder in the code, I should replace it with umts_spyder ?
Click to expand...
Click to collapse
No, just use the SPYDER source - otherwise your kernel won't support LTE for the CDMA users. The LTE modules are only built with the SPYDER source, that's why we use it.
But you can repeat these steps with UMTS_SPYDER, it will only download the UMTS depencies then, so you are able to build CM10.2 for the XT910. For the kernel only use SPYDER source.
dtrail1 said:
No, just use the SPYDER source - otherwise your kernel won't support LTE for the CDMA users. The LTE modules are only built with the SPYDER source, that's why we use it.
But you can repeat these steps with UMTS_SPYDER, it will only download the UMTS depencies then, so you are able to build CM10.2 for the XT910. For the kernel only use SPYDER source.
Click to expand...
Click to collapse
So if I understood correctly, the GSM\UMTS and LTE\CDMA are using the same kernel in CM ?
thanks for the reply
tester5224 said:
So if I understood correctly, the GSM\UMTS and LTE\CDMA are using the same kernel in CM ?
thanks for the reply
Click to expand...
Click to collapse
If I understood it correctly in the normal cm there are two different kernels. One for gsm without LTE modules and one cdma with LTE modules. So in case want to build for both you need the cdma version as it has the LTE modules and so cdma users have LTE and as usually gsm users will have there normal network.
Sent from my XT910 using XDA Premium 4 mobile app
Para94 said:
If I understood it correctly in the normal cm there are two different kernels. One for gsm without LTE modules and one cdma with LTE modules. So in case want to build for both you need the cdma version as it has the LTE modules and so cdma users have LTE and as usually gsm users will have there normal network.
Sent from my XT910 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
No, the kernel has no differences! It's about the modules. The kernel is always the same but the mlodules are not. If you build the kernel with UMTS_SPYDER depencies you will get umts baseband modules only. But if you build it with the SPYDER source you will get a working modules for umts and cdma.
:good: got it, thanks
tester5224 said:
:good: got it, thanks
Click to expand...
Click to collapse
It's special for our device. Usually it's enough to build the kernel only w/o using the full 15GB rom sources. But since 4.2.2 some parts of the kernel source were moved into the android rom source (e.g. the PVR (SGX) Sources), so we have to use the full rom source to build a working kernel - otherwise your kernel will cause a black screen on boot.
@dtrail1 Question regarding the script you use to build the kernel.
Your script shows: make mrproper
When I run this command I receive an error message: make: *** No rule to make target 'mrproper'. Stop.
Do you have any advice on where I set the target?
Edit: After continuing with the remainder of the script the last error I receive is: make: *** Waiting for unfinished jobs....
This command is needed to clean out the source directories. The error message is normal, just don't care about.
The second error you wrote about sounds like you tried to build without defconfig.
Make sure you have all related "export" commands AFTER the mrproper/distclean commands.
If you did so, then the error is caused by something else. Please post me the full last few lines of your terminal output, then I can tell you more.
Gesendet von meinem XT910 mit Tapatalk 4
awesome guide brother. thank you. i ll give it a try today

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

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
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
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
Canadoc said:
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
Click to expand...
Click to collapse
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.
sleekmason said:
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.
...
Click to expand...
Click to collapse
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.
@ 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.
sleekmason said:
@ 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.
Click to expand...
Click to collapse
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.
AndroidUser00110001 said:
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.
Click to expand...
Click to collapse
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.
AndroidUser00110001 said:
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.
Click to expand...
Click to collapse
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?
ayziaa said:
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?
Click to expand...
Click to collapse
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.
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...
sleekmason said:
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.
Click to expand...
Click to collapse
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,
darkassain said:
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...
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,
Click to expand...
Click to collapse
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!
sleekmason said:
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!
Click to expand...
Click to collapse
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
darkassain said:
i was thinking of writing a tutorial about this as well for the v500 but this better than i would have done Well done...
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,
Click to expand...
Click to collapse
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
poondog said:
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
Click to expand...
Click to collapse
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
darkassain said:
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
Click to expand...
Click to collapse
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.
Installed kenel and booted. Now to install trickster mod and fix the dang gamma.
gunnyman said:
Installed kenel and booted. Now to install trickster mod and fix the dang gamma.
Click to expand...
Click to collapse
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?
sleekmason said:
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?
Click to expand...
Click to collapse
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!!!!!
gunnyman said:
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!!!!!
Click to expand...
Click to collapse
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.

[DIS][DEV]Android Kernel and Rom Modding for GT-P52xx

For the last 2 weeks, a few of us has been working on a project of modding p52XX kernel here,
http://forum.xda-developers.com/showthread.php?p=59379382#post59379382
However, as we are getting off topic and involving more other project including modding custom rom with kernel, unbricking etc, so suggested by our senior member @r2d23cpo , I've created a new thread that only discussing about the project that we are going on.
useful resources:
SGT3 10.1 Rom Developing by learning developers
http://forum.xda-developers.com/showthread.php?t=2643970
Unbricking:
http://forum.xda-developers.com/gal...p52xx-soft-t3051604/post59361000#post59361000
Android Image Kitchen:
http://forum.xda-developers.com/showthread.php?t=2073775
How to build x86 Kernels:
http://drebsdorf.net/content/samsung_gt3/KernelHowTo.html
NOTE: IF YOU ARE NOT A DEVELOPER THEN DO NOT INVOLVE HERE AND POST USELESS COMMENT. YOU MAY ASK QUESTION HERE BUT ONLY ABOUT THIS TOPIC, DO NOT TALK CRAP!
So if you want to start that thread please do so
Click to expand...
Click to collapse
@r2d23cpo @Daniel-TAz00 , @Max4000 here we go, lets continue our discussion here...
I know I Mention CM10.1. Please be aware there in no Official Working Cianogenmod for our device, the most we have is Angel_666 work. I had taken a lot of work to get where hi is at.
For know I suggest you not to get involved in CM10.1. I have bad Internet, It took me 1 moth just to downlond ripos and patches just to see it compile boot and recovery images. It does not produce a working system.img.
Now what I try to say before is that a 4.2.2 CM10.1 boot & recovery images had make my life more easier. At least that is my impression. Just give me some time I will post the images I use. Then you can place your Kernel on it.
Click to expand...
Click to collapse
@r2d23cpo yeap, i can see that there is very limited resources for CM 1x going on. so i think i will try to do R&D on it, hopefully i can get to finish it before may (my university intake). I think before i can get a working CM, I will try to use stock boot.img and hopefully it works. I downloaded all version of source code that i can get on opensourcesamsung and hopefully i can get something working out if it.
some time ago I wrote a thread called, SGT3 10.1 Rom Developing by learning developers => http://forum.xda-developers.com/show....php?t=2643970. This is a suggestion, just to keep on good xda standing. Wait for you answer
Click to expand...
Click to collapse
Your thread contain a tones of useful information hopefully it can benefits those who need it. I have seen people complaining ( Including my self) that p52xx series have limited developers, so i thought of being one my self, start up some active project and keep this device running.
Nice!
Ok guys @r2d23cpo @Daniel-TAz00 , @Max4000 lets have fun here.
First I know I mention twice 4.2.2 - CM10.1 and there is a reason, No Selinux Files in boot nor recovery images! That makes me happy.
But lets be clear, Cianogenmod for Tab3 10.1 is like a Dog witching to received a fillet.! The only prove of concepts has been made by Angel_666 in his thread [Development][Source]CyanogenMod 11 for SGT-3 10.1 by Angel_666 => http://forum.xda-developers.com/showthread.php?t=2633554. Thanks Angel and all that help him for those long days of work.
Now there are many thread in AOSP or Cianogenmod for TAB3 10.1. with time all got forgotten. So, Do not waist your time for now on that road to hell.
I my self burn out 1 moth some time ago on 4.2.2 CM10.1 , and I only got to compile a none working firmware. But It produce boot.img and recovery.img. Now This files are in fact worthless by them self. boot.img will not boot to a system and the recovery has issues with lag response. So Why then did I mention it. Because there is NO SELinux on them. That makes those files the perfect TEST Sandbox to try new things. So without more explanation I am attaching the files I build. I am attaching them here in update.zip form for easily installation. Be aware they are build for GT_P5210. But guess what, if you used them for testing, it do not matters because they in fact incomplete.
Code:
CM10.1_boot.zip 12.6 MB
h__ps://mega.co.nz/#!HkJVCDxK!wzKnciQx50QkIbe65-3l-DtfCy0lavoKRw4tUY2wGDA
CM10.1_boot.zip 12.6 MB
h__ps://mega.co.nz/#!HkJVCDxK!wzKnciQx50QkIbe65-3l-DtfCy0lavoKRw4tUY2wGDA
So forget to dedicate time in CM R&D. It is useless for now. Well that is not true. It may be possible to take Angels CM11 tree and modified it to meet CM10.1. Who knows it may work!. But believe me it takes a lot of time to paste all patches and correct all compilation error just to get a final CM compilation for x86!!! I had warned you.
Now I do not know if you have realized, I know all this not because I am Senior. I am not, I am just a newbee like you. But I was playing with kernel/initramfs in
[DEVELOPMENT]TAB310.1-Run a Linux distro natively ==> http://forum.xda-developers.com/galaxy-tab-3/general/development-tab310-1-run-linux-distro-t3008521
But I got sick and now I will continue my work. It is just clearly related to what you are trying to do.
Now I do not know if you have realized, I know all this not because I am Senior. I am not, I am just a newbee like you. But I was playing with kernel/initramfs in
Click to expand...
Click to collapse
@r2d23cpo actually everyone make their own ways to become a good developer or a senior. I my self did the same thing, asked a lot of questions, brick my device unlimited times. And now I can pick up easily.
So forget to dedicate time in CM R&D. It is useless for now. Well that is not true. It may be possible to take Angels CM11 tree and modified it to meet CM10.1. Who knows it may work!. But believe me it takes a lot of time to paste all patches and correct all compilation error just to get a final CM compilation for x86!!! I had warned you.
Click to expand...
Click to collapse
Actually you are right, after i summit this thread, i have googled for resources a while now and i gave up on it because there is too much problems going on. So now i just wanna try to mod my boot.img that i got from sammobile.com and try to flash it to enable wifi dongle support.
@Daniel-TAz00 , Can you try to compile a kernel that based on stock rom? I noticed there is a lot people who prefer stock rom on this device.
can anyone help me out here?
http://forum.xda-developers.com/galaxy-tab-3/help/adb-detect-tab-3-fastboot-dosent-weird-t3052404
I have tried every possible solution i can think of and google of.
Jacker31 said:
@Daniel-TAz00 , Can you try to compile a kernel that based on stock rom? I noticed there is a lot people who prefer stock rom on this device.
Click to expand...
Click to collapse
The boot.img I made should work for stock roms aswell.
Anyway, back last year when I built my kernel, I took a bunch of notes with the idea of writing a detailed android kernel tutorial. It's not at all done, but contain a bunch of specific GT-P52xx info.
Here are my notes on compiling the GT-P5210 kernel: http://drebsdorf.net/content/samsung_gt3/KernelHowTo.html
*Crossposting*
Getting the proper monitor mode broadcom drivers should be possible, which broadcom chip do we have tho?
https://code.google.com/p/bcmon/source/browse/trunk/#trunk/bcm4329/driver/src/bcm4329
Anyone know which is the latest kernel source file? (i could surely compile for the P5200 aswell)
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=GT-P5210
I suspect its: GT-P5210_EUR_KK_Opensource.zip (I will get the sources for the other versions of the tablet aswell)
Daniel-TAz00 said:
The boot.img I made should work for stock roms aswell.
Anyway, back last year when I built my kernel, I took a bunch of notes with the idea of writing a detailed android kernel tutorial. It's not at all done, but contain a bunch of specific GT-P52xx info.
Here are my notes on compiling the GT-P5210 kernel: http://drebsdorf.net/content/samsung_gt3/KernelHowTo.html
Click to expand...
Click to collapse
I didnt really take down notes, but I actually have like 10+ tabs open with information that i need for doing things.
*Crossposting*
Getting the proper monitor mode broadcom drivers should be possible, which broadcom chip do we have tho?
https://code.google.com/p/bcmon/sour...Fsrc/bcm4329
Anyone know which is the latest kernel source file? (i could surely compile for the P5200 aswell)
http://opensource.samsung.com/recept...Value=GT-P5210
I suspect its: GT-P5210_EUR_KK_Opensource.zip (I will get the sources for the other versions of the tablet aswell)
Click to expand...
Click to collapse
I used the SEA KK version instead of EUR since I got my device from singapore. I got stuck in broadcom.* error while compiling the kernel, and its alright after i disabled it in menuconfig.
Getting the proper monitor mode broadcom drivers should be possible, which broadcom chip do we have tho?
https://code.google.com/p/bcmon/sour...Fsrc/bcm4329
Click to expand...
Click to collapse
Code:
[email protected]:~# cd Kernel
[email protected]:~/Kernel# make ARCH=i386 android_santos10_open_r00_user_defconfig
arch/x86/Kconfig:496:warning: defaults for choice values not supported
drivers/staging/mrfl/Kconfig:25:warning: choice value used outside its choice group
drivers/staging/mrfl/Kconfig:31:warning: choice value used outside its choice group
arch/x86/configs/android_santos10_open_r00_user_defconfig:3123:warning: override: reassigning to symbol SYNC
arch/x86/configs/android_santos10_open_r00_user_defconfig:3615:warning: override: reassigning to symbol SECURITY_SELINUX
arch/x86/configs/android_santos10_open_r00_user_defconfig:3616:warning: override: DEFAULT_SECURITY_SELINUX changes choice state
arch/x86/configs/android_santos10_open_r00_user_defconfig:3618:warning: override: reassigning to symbol NETWORK_SECMARK
#
# configuration written to .config
#
[email protected]:~/Kernel# make menuconfig
scripts/kconfig/mconf Kconfig
arch/x86/Kconfig:496:warning: defaults for choice values not supported
drivers/staging/mrfl/Kconfig:25:warning: choice value used outside its choice group
drivers/staging/mrfl/Kconfig:31:warning: choice value used outside its choice group
#
# configuration written to .config
#
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
[email protected]:~/Kernel# make arch=i386 -j2
scripts/kconfig/conf --silentoldconfig Kconfig
arch/x86/Kconfig:496:warning: defaults for choice values not supported
drivers/staging/mrfl/Kconfig:25:warning: choice value used outside its choice group
drivers/staging/mrfl/Kconfig:31:warning: choice value used outside its choice group
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `relocs'.
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds
VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds
VDSOSYM arch/x86/vdso/vdso32-syms.lds
LD arch/x86/vdso/built-in.o
LD arch/x86/built-in.o
CC net/mac80211/main.o
CC drivers/net/wireless/at76c50x-usb.o
CC net/mac80211/status.o
CC drivers/net/wireless/ath/main.o
CC drivers/net/wireless/ath/regd.o
CC net/mac80211/sta_info.o
CC drivers/net/wireless/ath/hw.o
CC drivers/net/wireless/ath/key.o
CC net/mac80211/wep.o
LD drivers/net/wireless/ath/ath.o
LD drivers/net/wireless/ath/built-in.o
CC drivers/net/wireless/b43/main.o
CC net/mac80211/wpa.o
CC net/mac80211/scan.o
CC net/mac80211/offchannel.o
CC drivers/net/wireless/b43/bus.o
CC drivers/net/wireless/b43/tables.o
CC net/mac80211/ht.o
CC drivers/net/wireless/b43/phy_common.o
CC net/mac80211/agg-tx.o
CC drivers/net/wireless/b43/phy_g.o
CC net/mac80211/agg-rx.o
CC net/mac80211/ibss.o
CC drivers/net/wireless/b43/phy_a.o
CC drivers/net/wireless/b43/phy_lp.o
CC net/mac80211/work.o
CC net/mac80211/iface.o
CC drivers/net/wireless/b43/tables_lpphy.o
CC drivers/net/wireless/b43/sysfs.o
CC net/mac80211/rate.o
CC drivers/net/wireless/b43/xmit.o
CC net/mac80211/tkip.o
CC drivers/net/wireless/b43/lo.o
CC net/mac80211/aes_ccm.o
CC drivers/net/wireless/b43/wa.o
CC net/mac80211/aes_cmac.o
CC net/mac80211/cfg.o
CC drivers/net/wireless/b43/dma.o
CC drivers/net/wireless/b43/pio.o
CC net/mac80211/rx.o
CC drivers/net/wireless/b43/rfkill.o
LD drivers/net/wireless/b43/b43.o
LD drivers/net/wireless/b43/built-in.o
CC drivers/net/wireless/b43legacy/main.o
CC net/mac80211/spectmgmt.o
CC net/mac80211/tx.o
CC drivers/net/wireless/b43legacy/ilt.o
CC drivers/net/wireless/b43legacy/phy.o
CC net/mac80211/key.o
CC net/mac80211/util.o
CC drivers/net/wireless/b43legacy/radio.o
CC net/mac80211/wme.o
CC net/mac80211/event.o
CC drivers/net/wireless/b43legacy/sysfs.o
CC net/mac80211/chan.o
CC drivers/net/wireless/b43legacy/xmit.o
CC net/mac80211/driver-trace.o
CC drivers/net/wireless/b43legacy/rfkill.o
CC drivers/net/wireless/b43legacy/debugfs.o
CC drivers/net/wireless/b43legacy/dma.o
CC drivers/net/wireless/b43legacy/pio.o
LD drivers/net/wireless/b43legacy/b43legacy.o
LD drivers/net/wireless/b43legacy/built-in.o
CC drivers/net/wireless/bcmdhd/bcmsdh.o
<command-line>:0:0: error: "CUSTOM_MAX_TXGLOM_SIZE" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: error: "DYNAMIC_F2_BLKSIZE_FOR_NONLEGACY" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: error: "CUSTOM_GLOM_SETTING" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: error: "CUSTOM_GLOM_SETTING" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
<command-line>:0:0: error: "CUSTOM_GLOM_SETTING" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
CC net/mac80211/mlme.o
In file included from drivers/net/wireless/bcmdhd/bcmsdh.c:43:0:
drivers/net/wireless/bcmdhd/include/bcmsdbus.h:66:2: error: #warning "SDPCM_DEFGLOM_SIZE cannot be higher than SDPCM_MAXGLOM_SIZE!!" [-Werror=cpp]
cc1: all warnings being treated as errors
make[4]: *** [drivers/net/wireless/bcmdhd/bcmsdh.o] Error 1
make[3]: *** [drivers/net/wireless/bcmdhd] Error 2
make[2]: *** [drivers/net/wireless] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
CC net/mac80211/pm.o
CC net/mac80211/rc80211_minstrel.o
CC net/mac80211/rc80211_minstrel_ht.o
LD net/mac80211/mac80211.o
LD net/mac80211/built-in.o
LD net/built-in.o
[email protected]:~/Kernel#
Jacker31 said:
Code:
[email protected]:~# cd Kernel
[email protected]:~/Kernel# make ARCH=i386 android_santos10_open_r00_user_defconfig
Click to expand...
Click to collapse
Ello, what are you up to? You compiled .... something
You might want to remove -Werror flags from the makefile, otherwise default option is to exit on compile warnings
Daniel-TAz00 said:
Ello, what are you up to? You compiled .... something
You might want to remove -Werror flags from the makefile, otherwise default option is to exit on compile warnings
Click to expand...
Click to collapse
oh ~ for that make ARCH=i386 android_santos10_open_r00_user_defconfig i thought was a process of generating config. because i saw somewhere that i have to run it first, but i lost the link though.
Never mind, I was in confused and i figured it out...
Code:
#Create Boot.img
Now I copied the boot.img to /home/android/WRKDIR_BOOT/ from the P5210UEUAMI8.zip rom we found on XDA (by Mod57)
cd /home/android/WRKDIR_BOOT/
unmkbootimg -i boot.img
This will extract the boot.img into its parts.
It also will spit out the command you need to rebuild the image, save that for later.
Copy /home/android/WRKDIR_KRLSRC/arch/x86/bzImage to /home/android/WRKDIR_BOOT/bzImage
Change the parameters of the rebuild command you saved and change
--kernel bzImage
--ramdisk ramdisk.cpio.gz
-o boot-MI8.img
ex. (PLESE DO NOT USE, this is an example cmd, your offsets may vary, unless you need bricks for a house , I cant recommend it.)
To rebuild this boot image, you can use the command:
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x10008000 --ramdisk_offset 0x11000000 --second_offset 0x10f00000 --tags_offset 0x10000100 --cmdline 'init=/init pci=noearly console=ttyS0 console=logk0 earlyprintk=nologger loglevel=4 hsu_dma=7 kmemleak=off androidboot.bootmedia=sdcard androidboot.hardware=santos10wifi androidboot.spid=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx androidboot.serialno=01234567890123456789012345678901 ip=50.0.0.2:50.0.0.1::255.255.255.0::usb0:on vmalloc=172M' --kernel bzImage --ramdisk ramdisk.cpio.gz -o boot-MI8.img
@Daniel-TAz00 one question, can i just use other tool to pack like this one in the attachment? I like to use it as it has a gui.
the attachment (there is a 8mb limit so i uploaded to mega instead.) : https://mega.co.nz/#!6hkSTYJY!gUa0VeQ-6nDh2TMw4Ul23nPt6RLP8r0Wg3UFDJUr7vQ
Jacker31 said:
@Daniel-TAz00 one question, can i just use other tool to pack like this one in the attachment? I like to use it as it has a gui.
the attachment (there is a 8mb limit so i uploaded to mega instead.) : https://mega.co.nz/#!6hkSTYJY!gUa0VeQ-6nDh2TMw4Ul23nPt6RLP8r0Wg3UFDJUr7vQ
Click to expand...
Click to collapse
Looks like it might be able to. I don't for sure though
I had little time, and the little time I had I used answering post.
One thing regards building kernel I will start posting only here for now on.
I did answer to Daniel-TAz00 on what I think is wifi driver ,type bcmdhd or dhd.ko. see here http://forum.xda-developers.com/showpost.php?p=59404794&postcount=37
I saw the issue with fastboot and answered by @moonbutt74. Yes no fastboot for MOSTSamsung devices.
I like moonbutt74
Code:
#!/bin/bash
/<$NDK-TOP>/build/tools/./make-standalone-toolchain.sh --ndk-dir=/<$NDK-TOP> --system=linux-x86 --toolchain=[COLOR="Red"]x86-4.8[/COLOR] --platform=android-17 --install-dir=/opt//toolchains/NDK-x86-4.8-JB
but never tested. I just point to where I have my NDK toolchain. But that previous option should be better. Now I have always tell moonbutt74 that I disagree in using gcc4.8. If you Open README_Kernel.txt you will see that their instructions point to gcc4.6
Code:
ex) CROSS_COMPILE ?= {your google aosp}/prebuilts/gcc/linux-x86/x86/[COLOR="Red"]i686-linux-android-4.6[/COLOR]/bin/i686-linux-android-
In fact I already said that to Jacker31 in http://forum.xda-developers.com/showpost.php?p=59310924&postcount=2 where I explained you should in fact install ggc 4.6 in your Linux distribution so that the "MAKE" get maximun compatibility witch will end up in minimun errors!!!!!
In ubuntu this is done
Code:
sudo apt-get install gcc-4.6 g++-4.6 gcc-4.6-multilib g++-4.6-multilib
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
Yes you Linux distribution will end up with a native 4.6 gcc witch is no the same as the NDK tool-chain you are suggested to use. I also suggested you install a Linix distribution with 32bit even if you have a 64bit!!! This is my personal opinion.
For example I can compile Kernel-GT-P5210_EUR_KK_Opensource without a single error just by adding
Edit Makefile
Code:
CROSS_COMPILE ?= /media/<user>/Ldata/bin/androidndk/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-
"/media/<user>/Ldata" this is just my DiskDrive
and execute
Code:
make ARCH=i386 android_santos10_open_r00_user_defconfig
make ARCH=i386 -j6
"-j6" is use to accelerate the process. Yes my devices is a Intel Core i7 witch in fact has 4 Physical Core but has 4 Virtual Cores thats a Total of 8 Cores, So by using "-j6" I dedicate 6 of my total 8 cores to the compilation. Taking about a 1/4 of the required time!.
This bring me to recall, are we going to use 4.2.2 instead of 4.4.2?
Here are my notes on compiling the GT-P5210 kernel: http://drebsdorf.net/content/samsung...rnelHowTo.html
Click to expand...
Click to collapse
Nice notes thanks Daniel-TAz00
@Daniel-TAz00 one question, can i just use other tool to pack like this one in the attachment? I like to use it as it has a gui.
the attachment (there is a 8mb limit so i uploaded to mega instead.) : https://mega.co.nz/#!6hkSTYJY!gUa0Ve...r0Wg3UFDJUr7vQ
Click to expand...
Click to collapse
moonbutt74 has show me AIK to pack and unpack images.
http://forum.xda-developers.com/showthread.php?t=2073775
This Android Image kitchen has support for Win7, Android and Linux. I normally do not use anything else.
Please be ware that while working in Win7 you can lose the Permission and ownership!! Making the pack image to failed!!! when in fact if you had packed it in Android or Linux it will be ok. The same goes if you are working in Linux but the files are store in Fat32 or NTFS. So be aware of that.
I like moonbutt74
Code:
#!/bin/bash
/<$NDK-TOP>/build/tools/./make-standalone-toolchain.sh --ndk-dir=/<$NDK-TOP> --system=linux-x86 --toolchain=x86-4.8 --platform=android-17 --install-dir=/opt//toolchains/NDK-x86-4.8-JB
but never tested. I just point to where I have my NDK toolchain. But that previous option should be better. Now I have always tell moonbutt74 that I disagree in using gcc4.8. If you Open README_Kernel.txt you will see that their instructions point to gcc4.6
Code:
ex) CROSS_COMPILE ?= {your google aosp}/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6/bin/i686-linux-android-
In fact I already said that to Jacker31 in http://forum.xda-developers.com/show...24&postcount=2 where I explained you should in fact install ggc 4.6 in your Linux distribution so that the "MAKE" get maximun compatibility witch will end up in minimun errors!!!!!
Click to expand...
Click to collapse
Remember my thread with that some error occur during compiling kernel? the one you answered? that occur and prevent me from compiling even i flagged it to ignore warnings but it end up error. That's happen because i used the wrong gcc build. I have to use the exact build returned in readme_kernel to build it successfully.
One thing regards building kernel I will start posting only here for now on.
I did answer to Daniel-TAz00 on what I think is wifi driver ,type bcmdhd or dhd.ko. see here http://forum.xda-developers.com/show...4&postcount=37
Click to expand...
Click to collapse
Hm...In my opinion, we should just forget about broadcom drivers as the wifi adapters is not as powerful as TL-w772n or that ALFA adapters. In fact most people who wish to use aircrack have either tplink or ALFA, unless they have something else.
Quote:
@Daniel-TAz00 one question, can i just use other tool to pack like this one in the attachment? I like to use it as it has a gui.
the attachment (there is a 8mb limit so i uploaded to mega instead.) : https://mega.co.nz/#!6hkSTYJY!gUa0Ve...r0Wg3UFDJUr7vQ
moonbutt74 has show me AIK to pack and unpack images.
http://forum.xda-developers.com/show....php?t=2073775
This Android Image kitchen has support for Win7, Android and Linux. I normally do not use anything else.
Please be ware that while working in Win7 you can lose the Permission and ownership!! Making the pack image to failed!!! when in fact if you had packed it in Android or Linux it will be ok. The same goes if you are working in Linux but the files are store in Fat32 or NTFS. So be aware of that.
Click to expand...
Click to collapse
Thanks for that, I have totally forgotten about AIK .
"-j6" is use to accelerate the process. Yes my devices is a Intel Core i7 witch in fact has 4 Physical Core but has 4 Virtual Cores thats a Total of 8 Cores, So by using "-j6" I dedicate 6 of my total 8 cores to the compilation. Taking about a 1/4 of the required time!.
Click to expand...
Click to collapse
I am going to get a new i7 MSI laptop soon cant wait for it XD I cant really stand with my current 6yo hp laptop as it will overheat while using MSVs2012 or eclipse . Arrrh sometimes even in vmware. I only have 2 cores on my processors so i cannot actually put up 8 XD.
Hm...In my opinion, we should just forget about broadcom drivers as the wifi adapters is not as powerful with TL-w772n or that ALFA adapters. In fact most people who wish to use aircrack have either tplink or ALFA, unless they have something else.
Click to expand...
Click to collapse
Is this your anwer or somebody else?
Listen I has used this to ,monitor wifi channel used. Some time ago I found hacking to complicated and time consuming. Maybe wrong with todays version.
So to monitor wifi usage I do not need Alpha or any other router.
If you plan to buy a new laptop make yourself sure that the graphic adapter is linux compatible!11 For example,Tab3 is PowerVR witch is not Linux Friendly!1
r2d23cpo said:
Is this your anwer or somebody else?
Listen I has used this to ,monitor wifi channel used. Some time ago I found hacking to complicated and time consuming. Maybe wrong with todays version.
So to monitor wifi usage I do not need Alpha or any other router.
If you plan to buy a new laptop make yourself sure that the graphic adapter is linux compatible!11 For example,Tab3 is PowerVR witch is not Linux Friendly!1
Click to expand...
Click to collapse
thats my answer, just noticed i made typo mistake haha, agree, I like ATI graphic on my HP as it works with Kali and Ubuntu. But i am not sure that MSI i gotta buy (with nvidia) compatible with linux or not as i never heard from anyone before.
correction.
"Hm...In my opinion, we should just forget about broadcom drivers as the wifi adapters is not as powerful as TL-w772n or that ALFA adapters. In fact most people who wish to use aircrack have either tplink or ALFA, unless they have something else."
Hacking maybe time consuming and tired, but with correct usage, it can create fireworks. But people seems to take their knowledge of hacking and use it wrongly.
Unless Daniel-TAz00 objects, I will postpone TAB3 wifi's own driver mod for promiscuous. Please remember I have my own Kernel mod project [DEVELOPMENT]TAB310.1-Run a Linux distro natively ==> http://forum.xda-developers.com/gal...ent-tab310-1-run-linux-distro-t3008521/page11 Now If you go there you see is almost a monologue, me , my ideas and some more of my work. From time to time I get a visit witch offer me great Ideas. But at this point is just Kernel development. That is why I am spending time here with you guys. I see interest in learning and developing. More of us more may gets done. My philosophy learn and spread the knowledge to others. And never forget I am just a newbee just like most of us.
So back to Android Kernel Modding for GT-P52xx.
To share with us you only need to setup your Linux building environment and download Samsung Open Source. I suggest we stick with JB 4.2.2, So for testing it will help if you backup your tablet using TWTP to a external SDCARD. I suggest install the original stock JB 4.2.2. And you can download "GT-P5210_SEA_JB_Opensource.zip" witch I think was the original. So you do that until you see that you can Compile your own Kernel. Then you are ready for some modifications. And join the group. If you need help just ask?
Androids Kernel is just an incomplete Linux kernel. So they share many thing. That means we should be able to go into Kernel. org or similar sites and read their info and try to apply it to us.
Linux Kernel Documentation Index ==> h__ps://www.kernel.org/doc/index-old.html
Menuconfig docs for Linux v3.0-rc7 ==> h__ps://www.kernel.org/doc/menuconfig/
arch/x86/Kconfig v3.0-rc7 ==> h__ps://www.kernel.org/doc/menuconfig/x86.html
Do not waist your MAIN time reading it. Just know you can get there to get info.
Now the main problem when we mod the kernel is that we get Samsung Screen and nothing more. So we need a way to debug the kernel and get info. So you can google debugging Kernel and find many resources.
Now Here is the tricky part. When you boot there is "kernel space" then "user space". You need to remember because kernel security will not allow you to get into kernel space from user space. A nice place to start is
Kernel Debugging Tips ==> h__p://elinux.org/Kernel_Debugging_Tips
And here is what I want to do next. Google eclipse debugging linux kernel. For example
h__p://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html
h__p://www.yonch.com/tech/84-debugging-the-linux-kernel-with-qemu-and-eclipse
Now clearly this methods are for Linux Distro like Ubuntu. But I think we can run Our Android and run Ubuntu or kali under chroot like you been doing. Install Eclipse on the tab. Then execute all this on my desktop using VNC ty to the linux on the TAB. And finally I hope to debug the kernel without installing it.
I hope this works.
To share with us you only need to setup your Linux building environment and download Samsung Open Source. I suggest we stick with JB 4.2.2, So for testing it will help if you backup your tablet using TWTP to a external SDCARD. I suggest install the original stock JB 4.2.2. And you can download "GT-P5210_SEA_JB_Opensource.zip" witch I think was the original. So you do that until you see that you can Compile your own Kernel. Then you are ready for some modifications. And join the group. If you need help just ask?
Click to expand...
Click to collapse
i think the original are something like this "GT-P5220_JB_Opensource.zip"
Unless Daniel-TAz00 objects, I will postpone TAB3 wifi's own driver mod for promiscuous. Please remember I have my own Kernel mod project [DEVELOPMENT]TAB310.1-Run a Linux distro natively ==> http://forum.xda-developers.com/gala...3008521/page11 Now If you go there you see is almost a monologue, me , my ideas and some more of my work. From time to time I get a visit witch offer me great Ideas. But at this point is just Kernel development. That is why I am spending time here with you guys. I see interest in learning and developing. More of us more may gets done. My philosophy learn and spread the knowledge to others. And never forget I am just a newbee just like most of us.
So back to Android Kernel Modding for GT-P52xx.
To share with us you only need to setup your Linux building environment and download Samsung Open Source. I suggest we stick with JB 4.2.2, So for testing it will help if you backup your tablet using TWTP to a external SDCARD. I suggest install the original stock JB 4.2.2. And you can download "GT-P5210_SEA_JB_Opensource.zip" witch I think was the original. So you do that until you see that you can Compile your own Kernel. Then you are ready for some modifications. And join the group. If you need help just ask?
Androids Kernel is just an incomplete Linux kernel. So they share many thing. That means we should be able to go into Kernel. org or similar sites and read their info and try to apply it to us.
Linux Kernel Documentation Index ==> h__ps://www.kernel.org/doc/index-old.html
Menuconfig docs for Linux v3.0-rc7 ==> h__ps://www.kernel.org/doc/menuconfig/
arch/x86/Kconfig v3.0-rc7 ==> h__ps://www.kernel.org/doc/menuconfig/x86.html
Do not waist your MAIN time reading it. Just know you can get there to get info.
Now the main problem when we mod the kernel is that we get Samsung Screen and nothing more. So we need a way to debug the kernel and get info. So you can google debugging Kernel and find many resources.
Now Here is the tricky part. When you boot there is "kernel space" then "user space". You need to remember because kernel security will not allow you to get into kernel space from user space. A nice place to start is
Kernel Debugging Tips ==> h__p://elinux.org/Kernel_Debugging_Tips
And here is what I want to do next. Google eclipse debugging linux kernel. For example
h__p://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html
h__p://www.yonch.com/tech/84-debugging-the-linux-kernel-with-qemu-and-eclipse
Now clearly this methods are for Linux Distro like Ubuntu. But I think we can run Our Android and run Ubuntu or kali under chroot like you been doing. Install Eclipse on the tab. Then execute all this on my desktop using VNC ty to the linux on the TAB. And finally I hope to debug the kernel without installing it.
Click to expand...
Click to collapse
i will take my time and do a little research as i still got 1 and a half month of holiday before i get into my university.
Jacker31
I know working with the Kernel is fun!
But in reality what is what you want to add to it? What is your objective?
r2d23cpo said:
Jacker31
I know working with the Kernel is fun!
But in reality what is what you want to add to it? What is your objective?
Click to expand...
Click to collapse
em there is a few objective of my point:
1) to spend my time on something useful,
2)for fun
3) tinkering around on my tab3 with kali linux and add in some usb driver.
4) discovering more ideas and maybe i can get started with another project.

[HELP] Compiling Android from source (sm-g360f)

Hi there,
I have Samsung Galaxy Core Prime LTE and I could not find any custom ROMs so I decided that I will try to compile it myself. I downloaded the LineageOS source code from git (cm 14.1), the device trees and kernel from here: github/MSM8916-Samsung, and the samsung vendor files from the extraxt-files.sh script. The qcom-common files from here: github/CyanogenMod/android_device_samsung_qcom-common. Then I set up the environment (source build/envsetup.sh), ran breakfast and everything went fine. And then came brunch... It's running for about 40-50 minutes, and then stopes because "ninja: build stopped: subcommand failed". Here's the output from my terminal: https:/ /drive.google.com/fi le/d/0Bzbi _UspTWqac3ZkV2RhRjJGeW8/view?usp=drivesdk (remove spaces - sorry for that, but I cannot add links yet)
If the ninja log is needed I will post it.
Can someone help me to understand the code and find out why it is failing?
(I am new to developing stuff, but I have already compiled programs back in the days, and I am familiar with Linux, which is my daily driver)
what version of linux are you using at the moment?
Ubuntu 17.04, but I have also tried it on 16.10 last week, and openjdk-8
wasowski02 said:
Ubuntu 17.04, but I have also tried it on 16.10 last week, and openjdk-8
Click to expand...
Click to collapse
I can't speak for others but I have not had success building anything android on 15.10,16.04,16.10... I always end up on a wild goose chase with all the compiling errors. I have consistently compiled without errors using 14.04 with oracle java 8 as that is what many of the manufacturers are using to make their own builds. If or oracle spits errors with 14.04 i try to use the rule of thumb and thats openjdk-6 and jre for LP, openjdk-7 and jre for MM and openjdk-8 for nougat builds but im only working on MM builds at the moment so your results may vary. Hope this helps a bit, just remember you can use sudo update-alternatives --display java to switch versions on the fly if needed and make sure you incorporate Google prebuilts as well. good luck ?
Sent from my LGLS676 using Tapatalk
Sands207 said:
I can't speak for others but I have not had success building anything android on 15.10,16.04,16.10... I always end up on a wild goose chase with all the compiling errors. I have consistently compiled without errors using 14.04 with oracle java 8 as that is what many of the manufacturers are using to make their own builds. If or oracle spits errors with 14.04 i try to use the rule of thumb and thats openjdk-6 and jre for LP, openjdk-7 and jre for MM and openjdk-8 for nougat builds but im only working on MM builds at the moment so your results may vary. Hope this helps a bit, just remember you can use sudo update-alternatives --display java to switch versions on the fly if needed and make sure you incorporate Google prebuilts as well. good luck ?
Click to expand...
Click to collapse
Then I will try 14.04 and see what happens. Thanks for help
@Sands207 Is there by any chance a site where you can learn to do this? Tutorial for noobs of sort.
Sent from my SM-N920P using Tapatalk
ninja_unmatched said:
@Sands207 Is there by any chance a site where you can learn to do this? Tutorial for noobs of sort.
Click to expand...
Click to collapse
Yes, luckily for us xda members we have our own Android college built right into xda https://forum.xda-developers.com/general/xda-university its a great starting point and rom compiling guide is also there. Its all aimed to help new folks find their way ? jump right in ?
If you need TWRP for it I have it. It was built by blaz3r64, but since AA51 is down I can upload it for you. I can confirm that it works on both the ST Galaxy Core Prime and the Boost Prevail LTE.
Sent from my XT1609 using Tapatalk
RealWelder said:
If you need TWRP for it I have it. It was built by blaz3r64, but since AA51 is down I can upload it for you. I can confirm that it works on both the ST Galaxy Core Prime and the Boost Prevail LTE.
Click to expand...
Click to collapse
So I have already downloaded the official TWRP, but thanks for your interest.
I have tried to compile using ubuntu 14.04 (with openjdk-8) as @Sands207, but I get this error:
Code:
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/bison/bison -d --defines=/home/karol/android/system/out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_y.h -o /home/karol/android/system/out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_y.cpp system/tools/aidl/aidl_language_y.yy"
/bin/bash: prebuilts/misc/linux-x86/bison/bison: No such file or directory
wasowski02 said:
So I have already downloaded the official TWRP, but thanks for your interest.
I have tried to compile using ubuntu 14.04 (with openjdk-8) as @Sands207, but I get this error:
Code:
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/bison/bison -d --defines=/home/karol/android/system/out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_y.h -o /home/karol/android/system/out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_y.cpp system/tools/aidl/aidl_language_y.yy"
/bin/bash: prebuilts/misc/linux-x86/bison/bison: No such file or directory
Click to expand...
Click to collapse
I recommend trying this keychain as it has full support for what you are attempting https://forum.xda-developers.com/showthread.php?t=3606941 I have tried it myself but Id recommend cleaning your build folder before incorporating them, maybe even a reboot as well. i had forgotten about this but it has far more tools than the normal keychain.
Sent from my LGLS676 using Tapatalk
---------- Post added at 04:29 PM ---------- Previous post was at 04:22 PM ----------
remember to select the right architecture ??
Sent from my LGLS676 using Tapatalk
Sands207 said:
I recommend trying this keychain as it has full support for what you are attempting https://forum.xda-developers.com/showthread.php?t=3606941 I have tried it myself but Id recommend cleaning your build folder before incorporating them, maybe even a reboot as well. i had forgotten about this but it has far more tools than the normal keychain.
Sent from my LGLS676 using Tapatalk
---------- Post added at 04:29 PM ---------- Previous post was at 04:22 PM ----------
remember to select the right architecture ?
Click to expand...
Click to collapse
So I downloaded the new toolchain/keychain/cross compiler (just to make sure - this is the same, yes?), but I cannot find how to choose it to compile android. The official post says:
Code:
# for arm64
export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-gnu-
but as I'm not compiling the kernel I assume it is not what I need (I think) and
Code:
echo $CROSS_COMPILE
does not return anything by default. If I should have used the export function then which file should I choose, because there are many (-strip, -strings, -size, -run, etc.).
There is a directory called toolchain (it contains only binutils) in the folder containing the source code. Should I add a folder called gcc and put the files there? Or maybe I have to run brunch with some options or change an entry in a configuration/make file?
I use the aarch64 version, but not the newest (20170515 not 20170520).
wasowski02 said:
So I downloaded the new toolchain/keychain/cross compiler (just to make sure - this is the same, yes?), but I cannot find how to choose it to compile android. The official post says:
but as I'm not compiling the kernel I assume it is not what I need (I think) and
does not return anything by default. If I should have used the export function then which file should I choose, because there are many (-strip, -strings, -size, -run, etc.).
There is a directory called toolchain (it contains only binutils) in the folder containing the source code. Should I add a folder called gcc and put the files there? Or maybe I have to run brunch with some options or change an entry in a configuration/make file?
I use the aarch64 version, but not the newest (20170515 not 20170520).
Click to expand...
Click to collapse
I do think as you said you will need to run brunch but resetting up your build & source environment to use the new keychain as you attempted to switch from one keychain to the other as well may help if this doesn't work as well take a look at your build configuration. rc file and make sure you don't have double entries or the new keychain missing i usually import the prebuilts i need as I am using arm architecture at the moment but i either download the individual keychain i need and place it in my source folder when i setup my build environment to be added to the build along with my sources before i run lunch because my source folder is untouched by me besides that at that point. I'll be home in an hour or so I'm going to see if i can track down some info to help you get untangled but i do recommend downloading the folder and making a gcc folder with the toolchain folder for arm64 as you said and and adding it to your build ensuring it is clean besides what you need and adding it then attempt to compile again.
I'm​ not sure if I should use aarch64. I have an armv7-a-neon (so 64-bit) and the internet says that aarch64 and arm64 is pretty much the same, but maybe I am wrong and I should use arm instead. But I think that does not matter until I put the new toolchain both to the aarch64 and arm directory (I guess the compilation process will choose the right one automatically). So I've put the compilers into prebuilts/gcc/linux-x86/... folders, but should I delete the old compilers? And then run the environment setup again (all this stuff starts to make sense to me ?)
Sent from my SM-G360F using Tapatalk
wasowski02 said:
I'm​ not sure if I should use aarch64. I have an armv7-a-neon (so 64-bit) and the internet says that aarch64 and arm64 is pretty much the same, but maybe I am wrong and I should use arm instead. But I think that does not matter until I put the new toolchain both to the aarch64 and arm directory (I guess the compilation process will choose the right one automatically). So I've put the compilers into prebuilts/gcc/linux-x86/... folders, but should I delete the old compilers? And then run the environment setup again (all this stuff starts to make sense to me )
Sent from my SM-G360F using Tapatalk
Click to expand...
Click to collapse
Yes you should delete the old ones and set up your enviroment again and it should include them. Also yes the compile proccess should pick the correct one in your case as long as you include them and you have, you are heading in the right direction for sure. :good:
Sands207 said:
Yes you should delete the old ones and set up your enviroment again and it should include them. Also yes the compile proccess should pick the correct one in your case as long as you include them and you have, you are heading in the right direction for sure. :good:
Click to expand...
Click to collapse
So I deleted the old ones and I get this error:
Code:
ninja: error: 'prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-strip', needed by '/home/karol/android/system/out/target/product/coreprimeltexx/obj/lib/libdl.so', missing and no known rule to make it
I guess it's because somewhere in a configuration file there is an entry for the old compiler. I have deleted the out directory and played with the envsetup.sh file (about line 210 there is something about compilers),
Code:
# defined in core/config.mk
targetgccversion=
targetgccversion2=
export TARGET_GCC_VERSION=$targetgccversion
# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
export ANDROID_TOOLCHAIN=
export ANDROID_TOOLCHAIN_2ND_ARCH=
local ARCH=$(get_build_var TARGET_ARCH)
case $ARCH in
x86) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
;;
x86_64) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
;;
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
;;
arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin;
toolchaindir2=arm/arm-linux-androideabi-$targetgccversion2/bin
;;
mips|mips64) toolchaindir=mips/mips64el-linux-android-$targetgccversion/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
but this did not work either. The ninja files don't contain any gcc configuration. So where can I find the right configuration file? (I can't find the suggested configuration.rc file)
wasowski02 said:
So I deleted the old ones and I get this error:
I guess it's because somewhere in a configuration file there is an entry for the old compiler. I have deleted the out directory and played with the envsetup.sh file (about line 210 there is something about compilers),
but this did not work either. The ninja files don't contain any gcc configuration. So where can I find the right configuration file?
Click to expand...
Click to collapse
I usually compile using clang or maven as I only build AOSP atm https://ninja-build.org/manual.html this page includes directions that should assist you. Do you have maven or clang installed on your linux box?
Sands207 said:
I usually compile using clang or maven as I only build AOSP atm https://ninja-build.org/manual.html this page includes directions that should assist you. Do you have maven or clang installed on your linux box?
Click to expand...
Click to collapse
So it seems that nor klang nor maven is installed on my machine (but as my computer claims ninja is not installed either I guess that they may be installed somewhere in the build directories). Should I try them instead of ninja?
wasowski02 said:
So it seems that nor klang nor maven is installed on my machine (but as my computer claims ninja is not installed either I guess that they may be installed somewhere in the build directories). Should I try them instead of ninja?
Click to expand...
Click to collapse
yes absolutely
Sands207 said:
yes absolutely
Click to expand...
Click to collapse
So what I understand is:
(1) Install maven or clang (let's say clang because I found it in the official ubuntu repository)
(2) Configure brunch to use clang instead of ninja
So I checked the internet if there are any options I can use with brunch to run clang, but I didn't find any. Also looked through the envsetup.sh file, but there is nothing there, or I missed it.
wasowski02 said:
So what I understand is:
(1) Install maven or clang (let's say clang because I found it in the official ubuntu repository)
(2) Configure brunch to use clang instead of ninja
So I checked the internet if there are any options I can use with brunch to run clang, but I didn't find any. Also looked through the envsetup.sh file, but there is nothing there, or I missed it.
Click to expand...
Click to collapse
tonight i will try doing some digging to see if i can help you. im away from my computer right now but ill do what i can. i would try would maven. clang assists with aosp primarily but maven should work for you as far as using a custom command to run maven, log out or reboot after you install it and run brunch as you normally would also please read this https://clang.llvm.org/comparison.html

Categories

Resources