[Guide] Build ASOP from source with Ubuntu 14.04 64bit - Nexus 7 General

First let me give you some background information before we start. I know there are guides out there but I found them all to be incomplete either missing a step here or there that is why I am posting this guide. After a lot of trial and error I tried to make the process as simple as it can be. This guide is for Ubuntu 14.04 64bit Desktop or Server version. This guide might work on other distros but I cannot guarantee it. This guide is designed to build the AOSP rom from Google source jellybean to lollipop. I highly recommend doing this on a remote server, like a vps or dedicated box. This guide is for root users if your not root then you may need to use "sudo" on many of the commands.
## Disclaimer I am not responsible for anything that happens to your device this is a guide only. I am not a master developer or linux guru if you have questions I will try to answer them best I can. ##
Most important command if your on a remote machine this will keep the process going if you get disconnected.
screen
## Establishing a Build Environment ##
# Java Install
apt-get update
apt-get upgrade (upgrades all the packages installed on system that have updates)
apt-get install openjdk-7-jdk (Lollipop)
apt-get install openjdk-6-jdk (KitKat or older)
# Optionally, update the default Java version by running:
update-alternatives --config java
update-alternatives --config javac
# Check if JAVA is Installed
java -version
# You should see something like this depending on the version you installed.
java version "1.7.0_91"
OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
# Installing required packages
apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip python-networkx libswitch-perl schedtool
## Downloading the Source ##
# To install Repo:
Make sure you have a bin/ directory in your home directory and that it is included in your path:
mkdir ~/bin
PATH=~/bin:$PATH
# Download the Repo tool and ensure that it is executable:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
# Initializing a Repo client
# After installing Repo, set up your client to access the Android source repository:
# Create an empty directory to hold your working files. Give it any name you like:
mkdir WORK
cd WORK
git config --global user.email "useyourrealemail"
git config --global user.name "usearealname"
repo init -u https://android.googlesource.com/platform/manifest
To check out a branch other than "master", specify it with -b. For a list of branches, see Source Code Tags and Builds.
repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.1_r1 ( To build only Lollipop. I suggest this option for most)
## Downloading the Android Source Tree ##
# To pull down the Android source tree to your working directory from the repositories as specified in the default manifest, run
repo sync -j4
# The Android source files will be located in your working directory under their project names. This takes anywhere from 15 minutes to a few hours depending on your internet connection. (Thats why I recommend building on a remote machine)
## Binaries ##
# Extracting the proprietary binaries
# Each set of binaries comes as a self-extracting script in a compressed archive. After uncompressing each archive, run the included self-extracting script from the root of the source tree, confirm that you agree to the terms of the enclosed license agreement, and the binaries and their matching makefiles will get installed in the vendor/ hierarchy of the source tree.
https://developers.google.com/android/nexus/drivers
# Nexus 7 (Wi-Fi) binaries for Android 4.1.2
Code:
wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-jzo54k-26240daf.tgz && wget -c wget -c https://dl.google.com/dl/android/aosp/elan-grouper-jzo54k-c889b8f4.tgz && wget -c wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-jzo54k-aae1cd0c.tgz && wget -c wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-jzo54k-56de148f.tgz && wget -c wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-jzo54k-4bfb1fb6.tgz && wget -c wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-jzo54k-aca0e725.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.2/4.2.1
Code:
wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-jop40c-1bf6a3d7.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-jop40c-3c485b17.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-jop40c-9f366366.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-jop40c-1a641dd0.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-jop40c-e072af0d.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-jop40c-ef747ec3.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.2.2
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-jdq39-b6907aa5.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-jdq39-4a9b93a2.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-jdq39-82c8d127.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-jdq39-28df082f.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-jdq39-738059f9.tgz && wget -c ]https://dl.google.com/dl/android/aosp/nxp-grouper-jdq39-28a5fe9a.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-jdq39-73fc49a2.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.3
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-jwr66y-d9ad928d.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-jwr66y-af694cc9.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-jwr66y-2ece01e1.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-jwr66y-f21f0c49.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-jwr66y-b3b0003e.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-jwr66y-f5d295e4.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-jwr66y-a0b9cafc.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.4
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-krt16s-286ffbbf.tgz&& wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-krt16s-2461febe.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-krt16s-4b37aa74.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-krt16s-d5bdd039.tgz&& wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-krt16s-2e8efaff.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-krt16s-fe4b53e1.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-krt16s-68751697.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.4.2
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-kot49h-2567c00c.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-kot49h-45c0c43a.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-kot49h-d3cda89d.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-kot49h-2f4def27.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-kot49h-73d2765c.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-kot49h-6d4f389b.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-kot49h-51d2ed4b.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.4.3
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-ktu84l-8dde86d9.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-ktu84l-079650ef.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-ktu84l-caa1c219.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-ktu84l-fae837a0.tgz&& wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-ktu84l-22d95d44.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-ktu84l-ece658d1.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-ktu84l-f3760dae.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 4.4.4
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-ktu84p-b12ce5f7.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-ktu84p-646d5a68.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-ktu84p-742223b3.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-ktu84p-724c855a.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-ktu84p-e6d581dc.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-ktu84p-27abae08.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-ktu84p-57b01f77.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 5.0
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-lrx21p-896ccd01.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-lrx21p-1220d525.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-lrx21p-a53f697e.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-lrx21p-4a1a3ab1.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-lrx21p-c4905f19.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-lrx21p-d0465c3c.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-lrx21p-78877346.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 5.0.2
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-lrx22g-aec33ad2.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-lrx22g-c7f54ba9.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-lrx22g-580da07a.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-lrx22g-fd3690aa.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-lrx22g-1d3281e3.tgz && wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-lrx22g-93aec176.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-lrx22g-179aea10.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 5.1.0
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-1743759-83e8c08c.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-1743759-48f4fdc9.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-1743759-9f5eb659.tgz && wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-1743759-744cc938.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-1743759-a1088a38.tgz&& wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-1743759-1d7e8bba.tgz && wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-1743759-d6f899eb.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Nexus 7 (Wi-Fi) binaries for Android 5.1.1
Code:
wget -c https://dl.google.com/dl/android/aosp/asus-grouper-lmy47v-f395a331.tgz && wget -c https://dl.google.com/dl/android/aosp/broadcom-grouper-lmy47v-5671ab27.tgz && wget -c https://dl.google.com/dl/android/aosp/elan-grouper-lmy47v-6a10e8f3.tgz&& wget -c https://dl.google.com/dl/android/aosp/invensense-grouper-lmy47v-ccd43018.tgz && wget -c https://dl.google.com/dl/android/aosp/nvidia-grouper-lmy47v-c9005750.tgz&& wget -c https://dl.google.com/dl/android/aosp/nxp-grouper-lmy47v-18820f9b.tgz&& wget -c https://dl.google.com/dl/android/aosp/widevine-grouper-lmy47v-e570494f.tgz
for f in *.tgz; do tar xzf $f; done
for extractor_script in *.sh; do bash $extractor_script; done
Please ACCEPT each one by typing I ACCEPT
# Now that is done you should of seen several files being extracted in certain directories.
source build/envsetup.sh
lunch (Pick the grouper-userdebug}
#To make a Fastboot flash image
make -j4
# If you get the following error on make
************************************************************
You are attempting to build with an unsupported JDK.
You use OpenJDK but only Sun/Oracle JDK is supported.
Please follow the machine setup instructions at
************************************************************
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer (Lollipop)
apt-get install oracle-java6-installer (KitKat or older)
update-alternatives --config java
The rerun command (make -j4)
#Flashable Zip
make -j4 otapackage
# If you get the following error on make
************************************************************
You are attempting to build with an unsupported JDK.
You use OpenJDK but only Sun/Oracle JDK is supported.
Please follow the machine setup instructions at
************************************************************
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer (Lollipop)
apt-get install oracle-java6-installer (KitKat or older)
update-alternatives --config java
The rerun command (make -j4 otapackage)
CREDITS and THANKS to:
AOSP/Google and Google Search

reserved for future use

another one

can i build cyanogenmod 13 using this method? im a total noob but i want to make a rom D;
---------- Post added at 12:20 PM ---------- Previous post was at 12:12 PM ----------
also, when you say that this guide is for rooted user, do you mean that the phone has to be rooted? (again im a noob xD)

supertiger1234 said:
can i build cyanogenmod 13 using this method? im a total noob but i want to make a rom D;
---------- Post added at 12:20 PM ---------- Previous post was at 12:12 PM ----------
also, when you say that this guide is for rooted user, do you mean that the phone has to be rooted? (again im a noob xD)
Click to expand...
Click to collapse
I would not recommend this guide for anything above lollipop.

ezbncs said:
I would not recommend this guide for anything above lollipop.
Click to expand...
Click to collapse
ah okay. is there any other guide to port cm 13? i cant find it anywhare.

supertiger1234 said:
ah okay. is there any other guide to port cm 13? i cant find it anywhare.
Click to expand...
Click to collapse
Im not sure you will have to search the forums or google.

AOSP built just fine for me with OpenJDK... and Google's documentation page seems to say OpenJDK is the right JDK for building under Ubuntu. So the build script seems to be incorrect. I got past the error you reported by tweaking the check.
In build/core/main.mk line 195 (the line which ends with "grep -i openjdk),)") I changed "ifneq" to "ifeq" and then it built fine for me. Probably not the right change, but it let me proceed. I was building aosp6 on Ubuntu 15.10 with java-8-openjdk-64.

aaopt said:
AOSP built just fine for me with OpenJDK... and Google's documentation page seems to say OpenJDK is the right JDK for building under Ubuntu. So the build script seems to be incorrect. I got past the error you reported by tweaking the check.
In build/core/main.mk line 195 (the line which ends with "grep -i openjdk),)") I changed "ifneq" to "ifeq" and then it built fine for me. Probably not the right change, but it let me proceed. I was building aosp6 on Ubuntu 15.10 with java-8-openjdk-64.
Click to expand...
Click to collapse
I mainly got the error when building diffrent versions of 4.1.2 to 4.4.4. I never got the error when doing lollipop so I included the oracle fix just to be safe incase others incounter the same problem. Thank you for the possible fix I will be testing it out soon.

Related

[Q] How to make a ROM?

Hello everyone.
Now I know this question has been posted before but I didn't get enough help from that so...
Let me explain what I've done...
I appreciate all of the work that the Devs have done, however, I would
love to help them.
I decided to try and build my own ROM. Unfortunately, I'm getting stuck and
am not sure how to proceed.
That is why I am here. I was hoping the wise devs here on XDA could help me
along this path I'm taking.
Here's my goal.
Build a 2.1 rom from source. No modifications at first.
Run this on an Emulator to see how it runs.
Then run it on my phone.
Here are the steps I've taken:
- Installed Ubuntu
- Installed jdk1.5
#sudo gedit /etc/apt/sources.list
-Add these lines
deb http://archive.ubuntu.com/ubuntu/ jaunty multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
-Save and exit
#sudo apt-get update
#sudo apt-get install sun-java5-jdk
#sudo update-java-alternatives -s java-1.5.0-sun
-Install the dev tools
# sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind
# cd ~
# mkdir bin
# curl xxxx://android.git.kernel.org/repo >~/bin/repo
# chmod a+x ~/bin/repo
-Get the android source
# cd ~
# mkdir mydroid
# cd mydroid
# repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.1_r2
# repo sync
-Download the samsung files from opensource.samsung.com
-Search for SGH-I897 and download the tar
# cd ~/Downloads
# mkdir samsung_files
# mv SGH-I897_OpenSource.tar.gz samsung_files/
# cd samsung_files
# tar xzvf SGH-I897_OpenSource.tar.gz
# tar xvf Platform.tar
-Merge the files together
# cd ~/Downloads/samsung_files/Captivate_eclair
# rsync -a --stats --progress dalvik/ ~/mydroid/dalvik/
# rsync -a --stats --progress external/ ~/mydroid/external/
# rsync -a --stats --progress prebuilt/ ~/mydroid/prebuilt/
# rsync -a --stats --progress vendor/ ~/mydroid/vendor/
-Modify the BoardConfig.mk
# sudo gedit ~/mydroid/build/target/board/generic/BoardConfig.mk
-Add these lines
BOARD_HAVE_BLUETOOTH := true
BT_USE_BTL_IF := true
BT_ALT_STACK := true
BRCM_BTL_INCLUDE_A2DP := true
BRCM_BT_USE_BTL_IF := true
-Compile the ROM
# cd ~/mydroid
# make update-api
# make
Now I browsed through the out directory after the Make was complete
and found some .img files:
ramdisk.img
system.img
userdata.img
userdata-qemu.img
I don't have anything for a Kernel and am confused as to how to
take these files and make a .zip that I can flash through CWM
Any direction from here would be greatly appreciated.
i.e.
How to make this run on an emulator.
How to turn this in to a .zip to flash through CWM
Also some tips on modifying the ROM would be nice
i always assumed it was some sort of magic or wizardry.....but all that **** you just said sounds pretty important, too.

[Q] How to compile cyanogenmod w/o google apps

This is the command I am running:
cd ~/android-cm && repo sync && make clean && cp ./vendor/cyanogen/products/cyanogen_passion.mk ./buildspec.mk && . build/envsetup.sh && lunch cyanogen_passion-eng && make -j`grep 'processor' /proc/cpuinfo | wc -l` CYANOGEN_WITH_GOOGLE=false bacon && ./vendor/cyanogen/tools/squisher
taken from http://forum.xda-developers.com/showthread.php?t=775505 but it still adds the gapps to system which I don't want, what am I doing wrong?
Thanks!
Why don't you just delete the apps you don't want?
be easier if it compiled without them and I will learn something
just drop the google tag altogether... run this once:
cd ~/android-cm && make clean && make clobber
then this build string is for when you build:
cd ~/android-cm && repo sync -j 10 && . build/envsetup.sh && lunch cyanogen_passion-eng && croot && mka bacon
thanks i'll try this when I get home.
is there somewhere i can learn exactly what those commands do (clobber and croot and mka bacon) ? or can you explain

[Q] Compiling a simple kernel module for N1

I followed the instructions listed here to compile the kernel from the source and was successful. Next, I saw some instructions here on how to compile our own loadable kernel modules:
Code:
First we must retrieve and copy the kernel config from our device.
$ cd /path/to/android-sdk/tools
$ ./adk pull /proc/config.gz
$ gunzip ./config.gz
$ cp config /path/to/kernel/.config
Next we have to prepare our kernel source for our module.
$ cd /path/to/kernel
$ make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi- modules_prepare
PREPARING YOUR MODULE FOR COMPILATION
We need to create a Makefile to cross-compile our kernel module. The contents of your Makefile should be similar to the following:
obj-m := modulename.o
KDIR := /path/to/kernel
PWD := $(shell pwd)
CCPATH := /path/to/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-eabi- -C $(KDIR) M=$(PWD) modules
COMPILING AND INSTALLING YOUR MODULE
$ cd /path/to/module/src
$ make
$ cd /path/to/android-sdk/tools/
$ ./adb push /path/to/module/src/modulename.ko /sdcard/modulename.ko
RUNNING YOUR MODULE
$ cd /path/to/android-sdk/
$ ./adb shell
$ su
# insmod /sdcard/modulename.ko
When I try executing:
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi- modules_prepare
I get an error:
Code:
make: *** No rule to make target `modules_prepare`. Stop.
Can someone please tell me if I am missing something here?
EliteLegend said:
I followed the instructions listed here to compile the kernel from the source and was successful. Next, I saw some instructions here on how to compile our own loadable kernel modules:
Code:
First we must retrieve and copy the kernel config from our device.
$ cd /path/to/android-sdk/tools
$ ./adk pull /proc/config.gz
$ gunzip ./config.gz
$ cp config /path/to/kernel/.config
Next we have to prepare our kernel source for our module.
$ cd /path/to/kernel
$ make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi- modules_prepare
PREPARING YOUR MODULE FOR COMPILATION
We need to create a Makefile to cross-compile our kernel module. The contents of your Makefile should be similar to the following:
obj-m := modulename.o
KDIR := /path/to/kernel
PWD := $(shell pwd)
CCPATH := /path/to/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-eabi- -C $(KDIR) M=$(PWD) modules
COMPILING AND INSTALLING YOUR MODULE
$ cd /path/to/module/src
$ make
$ cd /path/to/android-sdk/tools/
$ ./adb push /path/to/module/src/modulename.ko /sdcard/modulename.ko
RUNNING YOUR MODULE
$ cd /path/to/android-sdk/
$ ./adb shell
$ su
# insmod /sdcard/modulename.ko
When I try executing:
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi- modules_prepare
I get an error:
Code:
make: *** No rule to make target `modules_prepare`. Stop.
Can someone please tell me if I am missing something here?
Click to expand...
Click to collapse
The topic is old but the reply may be useful for other people:
this is the tipical issue when is missing the .config file which is a defconfig to be taken from /kernelfolder/arch/arm/configs

[GUIDE] Android One (Sprout) Making Kernel's or ROM's in Simple Way [NOOB FRIENDLY]

Post is Influenced from @Anik_khan Kernel Post to make Procedure More Simple for Us All.
So Don't BE Shocked to see Things
Prerequisites:
Ubuntu 14.04 Trusty Tahr 64 Bit. (Can be on VirtualBox or Full Install Your Wish.)
RAM Minimum:2GB Recommended:4GB
Around 100GB Space for ROM’s. (Kernels can use upto 1GB.)
Unlimited (Fast) LAN Connection.
More RAM, or faster CPU, or SSD will speed up the process.
A Brain (Most Important of All :v)
At the starting of the post I have linked a script by @akhilnarang which if run will automatically install all these programs for lazy people.
If you not interested to do all procedure from below just use the script. Simply it will automatically configure the build environment.
NOTE-------- some of these packages may already be on your machine. Obviously, if you complete a step and you have one of these installed, the machine simply will not do anything. So...it will not hurt anything. Some of the packages are different from Ubuntu 12.04 and 13.04 (use these packages for Ubuntu 14.04 as many of the old ones have obsoleted - these are new replacements).
So if you set up your pc with Ubuntu we are good to go.
All code will be in code boxes like this:
Code:
$
means you have to run that command in the terminal (don't type the $).
All commands with sudo, gksudo, or gksu means it requires root permission.
It will ask for password.
Once you type, then in that terminal session it will not ask you for a few minutes again.
Any time you make changes to .bashrc or .profile file, make sure to run
Code:
$ source ~/.bashrc
$ source ~/.profile
Or exit and open new terminal else the changes will not take place
Setting Up Build Environment
Method 1:
So if you not interested in doing below all steps then simply use this script by my friend @akhilnarang
Open terminal and type:
Code:
$ sudo apt-get install git-core
then do
Code:
$ git clone https://github.com/akhilnarang/scripts.git
$ cd scripts
$ . build-environment-setup.sh
This script will install all required packages
Method 2:
1)Installing Java JDK
Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one:
Download & install java
Code:
$ sudo apt-get update && sudo apt-get install openjdk-7-jdk openjdk-7-jre
CHECK if java properly installed or not
Code:
$ java -version
If you get output like
Code:
Code:
java version "1.7.0_79" or anything higher(in my case)
on the first line then all is good
Now JDK is configured!
Note: Only for Ubuntu 14.04 or higher
2)Installing Required Packages
Open Terminal
Now execute this command:
Note: This will take some time, has to download about 500MB or so of packages
Code:
$ sudo apt-get update && sudo apt-get install git-core python gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-7-jdk pngcrush schedtool \
libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib liblz4-* android-tools-adb android-tools-fastboot ccache
3)Installing Android SDK
Download the SDK from here!
Accept Terms & download 64 bit.
Extract in your home directory & rename extracted folder "android-sdk".
Now, execute these commands in terminal:
Code:
$ cd ~/android-sdk/tools/
$ ./android sdk
At this point the SDK should come up and you will need to download at least all the tools and all the extras files (at least to 4.0, so select them and install them.When it finishes downloading & installing everything you have to run this command in ANOTHER TERMINAL:
Code:
$ sudo apt-get install gksudo
$ gksu gedit .bashrc
And you need to add at the end of it your SDK paths these three lines (copy and paste them):
Code:
export PATH=~/android-sdk/tools:$PATH
export PATH=~/android-sdk/platform-tools:$PATH
export PATH=~/bin:$PATH
Save and close the file, then close terminal, or
Code:
source ~/.bashrc
Find your .profile file and add this at the bottom of the file
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/plartform-tools:$PATH"
SDK is configured.
4)Configuring USB Access
Now we need to set permissions so that our USB ports can detect our android devices
Type in the following commands, it will download a file with the permissions, give it permission to execute, and restart the service.
Code:
$ sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules
$ sudo chmod 644 /etc/udev/rules.d/51-android.rules
$ sudo chown root. /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb
ADB & Fastboot are configured
5)Installing Repo Package
Open terminal and type:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
6)Configure Git
Open terminal and type:
Code:
$ git config --global user.email ""
$ git config --global user.name ""
Git is configured.
7)Configure ccache
Open terminal and type:
Code:
$ gksu gedit ~/.bashrc
Enter these lines
Code:
export USE_CCACHE=1
export CCACHE_DIR=~/.ccache
Save & close
Open terminal & execute:
Code:
$ source .bashrc
$ ccache -M 50G
I usually use 50 gigs. You can use more if you have more space, or build for many devices
Congrats
YOUR BUILD ENVIROMENT IS NOW SETUP .
Making Kernel
Good work !!! Waiting for completion
Sent from my Moto G using Tapatalk
Thread closed per OPs request

[KERNEL] {WIP} Port Lollipop 5.1 Source -> AOSP Marshmallow 6.0 [Device_a32e]

Currently Building Bootable Android 5.1 Kernel From HTC DEV Source.
(THIS IS THE STOCK 5.0.1 / RUU Version = 1.23.1550.3 CL637541 RELEASE-KEYS)
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.7 (GCC) ) #2 SMP PREEMPT Sat Oct 31 02:35:36 CST 2015
This has been compiled and will boot on the device.
NOTE: WI-FI IS NOW WORKING
NOTE: DT Blobs broken:Fixed by using Blobs pulled from the device.}
WORK IN PROGRESS !!
Currently HTC has not released the Kernel Source for Marshmallow 6.0.1.
Solution: Port the 5.0.1 HTC Source by merging with AOSP device/lge/bullhead-kernel
Current Status:
WORKING KERNEL NO CHANGES FROM STOCK
Will Build for other Devices upon request.
Anyone who wishes to contribute to this project would be appreciated.
I'm in the process of setting up the GIT and the project on XDA.
DOWNLOADS
FOR METRO - PCS VERSION OF DESIRE 626S
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Sat Oct 1 11:53:51 EDT 2016
https://drive.google.com/open?id=0B8jitdIyh2NtdW1uNWdvaWdTdG8
The modules are in the link below.
https://drive.google.com/open?id=0B8jitdIyh2NtODl4ellvd0Y5MW8
XDA:DevDB Information
HTC MSM8909 Qualcom Kernel Port, Kernel for the HTC Desire 626
Contributors
BigCountry907, hp79
Kernel Special Features: Pssible: Change Keys used for flashing firmware: Add Fastboot Commands To Custom Bootloader: Either will allow us to S-OFF
Version Information
Status: Testing
Current Stable Version: Linux version 3.10.4
Stable Release Date: 2015-10-31
Created 2016-09-28
Last Updated 2016-10-01
Setting Up To Test 3.10.49-perf-g26c2269 Kernel Build
First I would like to mention that a full LINUX Development Environment is required to perform most of these tasks. If you don't have the development environment set up then please do the necessary research.
To test YOUR development environment and the HTC-DEV Kernel Source it is necessary to perform the following steps.
1 ) If you are currently running Marshmallow 6.0.1 you will need to downgrade the device to Lollipop 5.0.1 using the RUU. Please note that the Lollipop RUU is no longer available on the HTC-DEV site. Don't worry we will be going back to Marshmallow but need to test in lollipop first.
Please see the following thread for instructions on downgrading the HTC Desire 626s.
http://forum.xda-developers.com/desire-626/development/metropcs-htc-626s-to-lollipop-t3460391
:good:
2) Download the Kernel Source Code from the HTC-DEV Site.
http://www.htcdev.com/devcenter/downloads
If you use the filter for device and select desire 626s you will see only the 626s kernel sources.
The device I have = HTC Desire 626s (a32eul) " Carrier Metro-PCS"
The Kernel Source I am using.
Device= Desire626s Carrier=HTC Region= Gen Unlock Type=CRC
Kernel Version=3.10.49 Android Version=v5.1 Size=548 MB Description=1.06.617.6
Backup the device boot.img & Unpack / Split the kernel + ramdisk + dt.img.
Now we are all on the same page. " Same Setup Fresh Install "
Lets get down to business.
I'm going to go through the steps that I use. If you plan to work along with this project I recommend that you keep the same directory structure that I have. This way all the commands I give you will work. You may wish to change the directory structure but if you do.... remember you will need to adjust the commands accordingly.
So from a brand new fresh install.
#1 install twrp recovery
#2 install supersu
#3 Open supersu on phone
#4 Make sure usb debugging is turned on ect. ect. ect.
#5 Lets get the boot.img from the device.
Connect the device to the computer
From this point forward all commands are executed in the Linux terminal shell.
Code:
adb shell
Code:
su
Copy boot partition to the external sd card.
Code:
dd if=/dev/block/bootdevice/by-name/boot of=sdcard2/Boot.img
Pull the boot.img to the computer.
If still in adb shell exit out.
Code:
exit
exit
adb pull /sdcard2/Boot.img
#6 Setup some directories and move the boot.img into our project.
Code:
mkdir ~/a32e-kernel-build/
mkdir ~/a32e-kernel-build/Device-Files/
mkdir ~/a32e-kernel-build/Device-Files/Boot
mkdir ~/a32e-kernel-build/Tools
mkdir ~/a32e-kernel-build/Tools/AIK-Linux/
mv Boot.img ~/a32e-kernel-build/Device-Files/Boot
cd ~/a32e-kernel-build/Tools/AIK-Linux/
cp ~/a32e-kernel-build/Device-Files/Boot/Boot.img ~/a32e-kernel-build/Tools/AIK-Linux/
#7 We need AIK-Linux boot tools. Download them from the link below.
http://forum.xda-developers.com/showthread.php?t=2073775
Please do use these bootimg tools. You might have others but AIK-Linux unpacks and repacks the image files as "ROOT".
Using other tools or not unpacking / repacking as ROOT will cause a bootloop specifically in Marshmallow even if the boot.img is good.
Code:
mv ~/Downloads/AIK-Linux-v2.4-ALL.tar.gz ~/a32e-kernel-build/Tools/AIK-Linux
tar -xvzf ~/a32e-kernel-build/Tools/AIK-Linux/AIK-Linux-v2.4-ALL.tar.gz
rm -f ~/a32e-kernel-build/Tools/AIK-Linux/AIK-Linux-v2.4-ALL.tar.gz
mv -v ~/a32e-kernel-build/Tools/AIK-Linux/AIK-Linux/* ~/a32e-kernel-build/Tools/AIK-Linux/
rm -d ~/a32e-kernel-build/Tools/AIK-Linux/AIK-Linux
Ok I know ????????
You want to know what we need the boot image for anyway !!
The a32e_defconfig file that comes with the HTC-DEV source code is not the exact configuration that HTC used when they built the kernel.
We want to start out with the same configuration RIGHT!!
Yes we do...... and after we have a verified working Kernel.......then we can start making changes.
In a nutshell /proc/config.gz will not work to pull the existing configuration. HTC did not enable that option. Lucky for us there is another way to generate the configuration file & that's reason #1 that we need the boot.img. There is another reason but we will get to that later. ( Other than having a Backup of the boot.img LOL. )
#8 Unpack the boot.img
Code:
sudo ./unpackimg.sh Boot.img
Make sure you use "sudo" it is nessessary.
The output should be
~/a32e-kernel-build/Tools/AIK-Linux$ sudo ./unpackimg.sh Boot.img
Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers
Supplied image: MM-Boot.img
Removing old work folders and files...
Setting up work folders...
Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlyprintk vmalloc=400m androidboot.selinux=enforcing androidboot.hardware=htc_a32e androidusb.pid=0x0668
BOARD_KERNEL_BASE 80000000
BOARD_NAME boot:0
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02000000
BOARD_TAGS_OFFSET 01e00000
BOARD_DT_SIZE 731136
Unpacking ramdisk to "ramdisk/"...
Compression used: gzip
6560 blocks
Done!
#9 Move our unpacked boot.img to our project folder.
Code:
sudo mv ramdisk ~/a32e-kernel-build/Device-Files/Boot/
sudo mv split_img ~/a32e-kernel-build/Device-Files/Boot/
sudo cp ~/a32e-kernel-build/Device-Files/Boot/split_img/Boot.img-dtb ~/a32e-kernel-build/Device-Files/Boot/Boot.img-dtb
sudo cp ~/a32e-kernel-build/Device-Files/Boot/split_img/Boot.img-zImage ~/a32e-kernel-build/Device-Files/Boot/Boot.img-zImage
sudo cp ~/a32e-kernel-build/Device-Files/Boot/Boot.img-zImage ~/a32e-kernel-build/Device-Files/Boot/kernel
Getting Running Kernel Configuration
#1 Lets get the current running Kernel Version
Code:
cd ~/a32e-kernel-build/Device-Files/Boot/
Code:
dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
My output is as follows.
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.7 (GCC) ) #2 SMP PREEMPT Sat Oct 31 02:35:36 CST 2015
7202481+0 records in
7202481+0 records out
7202481 bytes (7.2 MB, 6.9 MiB) copied, 5.4281 s, 1.3 MB/s
Hopefully you see or know why this is important to us.
In order for our new kernel to load and not reject existing modules the version of the new kernel must match.
Linux version 3.10.49-perf-g26c2269
And also the 26c2269 is the number we need,
to match the exact commit of the source code that this specific kernel was built upon.
In theory when we checkout a branch and that would be used as part of the tag.
Right now the most important thing to us is the "-perf"
And the ".-g26c2269"
We will need those soon.
Now lets get that .config / a32e_defconfig file.
Wayy back in step number 2 of the 1st post you were supposed to get the HTC-DEV Kernel source.
If you didn't it's time we need it now.
http://www.htcdev.com/devcenter/downloads
When you get to the HTC-DEV download page just filter by device and select desire 626s.
#1 Set Up Basic HTC-DEV Source Directory Structure
Code:
cd
mkdir ~/android
mkdir ~/android/device
mkdir ~/android/device/a32e
mkdir ~/android/device/a32e/platform
#2 Setup the Kernel Source
Code:
mv ~/Downloads/a32eul-3.10.49-perf-ga4d7327.zip ~/android/device/a32e/a32eul-3.10.49-perf-ga4d7327.zip
unzip ~/android/device/a32e/a32eul-3.10.49-perf-ga4d7327.zip -d ~/android/device/a32e/
rm -f ~/android/device/a32e/a32eul-3.10.49-perf-ga4d7327.zip
cd ~/android/device/a32e/
tar -xvzf ~/android/device/a32e/248_kernel_a32eul-3.10.49-perf-ga4d7327.tar.gz
rm ~/android/device/a32e/248_kernel_a32eul-3.10.49-perf-ga4d7327.tar.gz
mv -v ~/android/device/a32e/248_kernel_a32eul-3.10.49-perf-ga4d7327/* ~/android/device/a32e/
rm -rf ~/android/device/a32e/248_kernel_a32eul-3.10.49-perf-ga4d7327
mv ~/android/device/a32e/platform.tar.gz ~/android/device/a32e/platform/
#3 Pull the config from the kernel
Code:
cd ~/android/device/a32e/scripts/
./extract-ikconfig ~/a32e-kernel-build/Device-Files/Boot/Boot.img-zImage > Big-Country_defconfig
mv -f Big-Country_defconfig ~/android/device/a32e/arch/arm/configs
mkdir ~/a32e-kernel-build/Device-Files/Configs/ORIGINAL/
cp -f ~/android/device/a32e/arch/arm/configs/Big-Country_defconfig ~/a32e-kernel-build/Device-Files/Configs/ORIGINAL/
Open up the Big-Country_defconfig
It is in the folder ~/android/device/a32e/arch/arm/configs
Open it with G-Edit or whatever text editor you use.
Search for CONFIG_LOCALVERSION=
and change it to CONFIG_LOCALVERSION="-g26c2269"
Open up the main makefile. in the folder ~/android/device/a32e/Makefile
VERSION = 3
PATCHLEVEL = 10
SUBLEVEL = 49
EXTRAVERSION =
NAME = TOSSUG Baby Fish
At the top of the file change EXTRAVERSION =
EXTRAVERSION = -perf
Now lets backup the edited Big-Country_defconfig.
Code:
cp -f ~/android/device/a32e/arch/arm/configs/Big-Country_defconfig ~/a32e-kernel-build/Device-Files/
Now were cooking.
Preparing and Building the Kernel
#1 Get the GCC Toolchain
First if you have a dev environment set up you should have a repo set up.
If not go to aosp site to see how yo set up a repo.
https://source.android.com/source/downloading.html
Then get the toolchain
Code:
cd
mkdir ~/android/Toolchains
mkdir ~/android/Toolchains/prebuilts
cd ~/android/Toolchains/prebuilts
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
Were gonna use the 4.8 toolchain.
[email protected]:~/android/Toolchains/prebuilts$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
Cloning into 'arm-eabi-4.8'...
remote: Sending approximately 28.69 MiB ...
remote: Counting objects: 158, done
remote: Finding sources: 100% (158/158)
remote: Total 354 (delta 71), reused 354 (delta 71)
Receiving objects: 100% (354/354), 28.74 MiB | 2.09 MiB/s, done.
Resolving deltas: 100% (71/71), done.
Checking connectivity... done.
#2 Initialize the Kernel Build
Go to the home path of the kernel
Code:
cd
cd ~/android/device/a32e/
Export the required variables.
Code:
export TOP=~/android/Toolchains/
export PATH=$TOP/prebuilts/arm-eabi-4.8/bin:$PATH
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=~/android/Toolchains/prebuilts/arm-eabi-4.8/bin/arm-eabi-
Clean out any old left over stuff from previous builds.
Code:
make clean
make mrproper
Dont worry about this warning it's not a problem.
/home/bigcountry/android/device/a32e/arch/arm/boot/dts/Makefile:228: warning: overriding recipe for target `dtbs'
/home/bigcountry/android/device/a32e/arch/arm/boot/dts/Makefile:228: warning: ignoring old recipe for target `dtbs'
Initialize the configuration for our device.
Code:
make Big-Country_defconfig
This warning is also ok.
In file included from scripts/kconfig/zconf.tab.c:2503:0:
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:567:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
jump->offset = r->len - 1;
^
scripts/kconfig/menu.c:528:19: note: ‘jump’ was declared here
struct jump_key *jump;
^
If your curious and want to see how many settings there are.
Just don't change anything for the first run.
Code:
make menuconfig
Were ready to compile
set -j to the number of cores your computer has.
Code:
make prepare
make all -j8
In about 5 min or less you will have a compiled kernel.
after you see the zimage output message
The last 2 lines output from the build.
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Code:
make modules -j8
Then you should see:
[email protected]:~/android/device/a32e$ make modules -j8
CHK include/generated/uapi/linux/version.h
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
Building modules, stage 2.
MODPOST 24 modules
During the build:
You will see 1 warning message for an uninitialized jump.
And 4 warning messages about relying on default adress.
Thats the broken dtb issue.
No worry for now. We will repack the boot.img with the new kernel zImage and use the original dt.img.
Good enough for this test.
Also as i mentioned we have to build the wifi module out of the tree.
We will get to that. So in this state the kernel will boot and the device functions with exception to wifi.
Remember this run is just to test the baseline system and source code.
Packing The Kernel Into Boot.img
First lets backup our kernel config files.
Code:
mkdir ~/a32e-kernel-build/Device-Files/Configs
cp -f ~/android/device/a32e/.config ~/a32e-kernel-build/Device-Files/Configs
cp -f ~/android/device/a32e/.config.old ~/a32e-kernel-build/Device-Files/Configs
cp -f ~/android/device/a32e/arch/arm/configs/Big-Country_defconfig ~/a32e-kernel-build/Device-Files/Configs
Now lets copy all the modules and kernel z-image we built.
Code:
mkdir ~/a32e-kernel-build/Device-Files/zimage
mkdir ~/a32e-kernel-build/Device-Files/modules
cp -f ~/android/device/a32e/arch/arm/boot/zImage ~/a32e-kernel-build/Device-Files/zimage/kernel
cp -f ~/android/device/a32e/arch/arm/boot/zImage-dtb ~/a32e-kernel-build/Device-Files/
shopt -s globstar
cp **/*.ko ~/a32e-kernel-build/Device-Files/modules/
Compare the new kernel version to the original version.
Code:
cd ~/a32e-kernel-build/Device-Files/zimage
dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
Code:
cd ~/a32e-kernel-build/Device-Files/Boot/
dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
Output Comparison On My System
[email protected]:~/a32e-kernel-build/Device-Files$ cd ~/a32e-kernel-build/Device-Files/zimage
[email protected]:~/a32e-kernel-build/Device-Files/zimage$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Sat Oct 1 11:53:51 EDT 2016
7162737+0 records in
7162737+0 records out
7162737 bytes (7.2 MB, 6.8 MiB) copied, 5.16669 s, 1.4 MB/s
[email protected]:~/a32e-kernel-build/Device-Files/zimage$ cd ~/a32e-kernel-build/Device-Files/Boot/
[email protected]:~/a32e-kernel-build/Device-Files/Boot$ dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.7 (GCC) ) #2 SMP PREEMPT Sat Oct 31 02:40:46 CST 2015
7202505+0 records in
7202505+0 records out
7202505 bytes (7.2 MB, 6.9 MiB) copied, 4.70855 s, 1.5 MB/s
[email protected]:~/a32e-kernel-build/Device-Files/Boot$
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Sat Oct 1 11:53:51 EDT 2016
Linux version 3.10.49-perf-g26c2269 ([email protected]) (gcc version 4.7 (GCC) ) #2 SMP PREEMPT Sat Oct 31 02:40:46 CST 2015
Linux version 3.10.49-perf-g26c2269 MATCHES.
Repack the Boot Image.
For now we are just using the original ramdisk and original dt.img.
Later on we will make some changes and then repack.
Were just making sure things boot first.
We have to do this as root.
Code:
sudo
Copy all files needed to AIK Linux for Repacking.
Code:
sudo cp -r ~/a32e-kernel-build/Device-Files/Boot/ramdisk ~/a32e-kernel-build/Tools/AIK-Linux/ramdisk
sudo cp -r ~/a32e-kernel-build/Device-Files/Boot/split_img ~/a32e-kernel-build/Tools/AIK-Linux/split_img
sudo cp -f ~/android/device/a32e/arch/arm/boot/zImage ~/a32e-kernel-build/Tools/AIK-Linux/split_img/Boot.img-zImage
Repack the Boot.img.
Code:
cd ~/a32e-kernel-build/Tools/AIK-Linux
sudo ./repackimg.sh
Yaaayyyy Now we have a boot.img we can flash. (For Testing / Developing Only)
Copy the boot image to our project.
Code:
mkdir ~/a32e-kernel-build/Device-Files/New-Boot
sudo cp -f ~/a32e-kernel-build/Tools/AIK-Linux/image-new.img ~/a32e-kernel-build/Device-Files/New-Boot/image-new.img
Flashing the New Boot Image
Flash and test Boot the new Kernel
#1 Boot the phone into download mode
Connect the device to the computer
Boot into download mode using the power and volume down key after turning off the device.
Or boot to download mode using adb.
Code:
adb reboot download
#2 Flash the boot image
Code:
cd ~/a32e-kernel-build/Device-Files/New-Boot/
fastboot flash boot image-new.img
Output is
[email protected]:~/a32e-kernel-build/Device-Files/New-Boot$ fastboot flash boot image-new.img
target reported max download size of 725000000 bytes
sending 'boot' (10476 KB)...
OKAY [ 1.877s]
writing 'boot'...
(bootloader) HOSD CL#637541
(bootloader) [email protected]
(bootloader) [email protected]%
(bootloader) Update partition OK
(bootloader) [email protected]
OKAY [ 2.759s]
finished. total time: 4.636s
Reboot the phone and test it out
I am happy to say that WIFI is working WE are Building the Prima Module
.
Building Proprietary Modules / Not Included in the Source
Adding the New Modules
All 24 of the modules currently being compiled are Tested and Work.
Please carefully install the modules as I demonstrate here.
Do not execute commands against the /system/lib/modules/ using wildcards.
#1 Get rid of any old modules created by previous compiles.
Code:
rm -f ~/a32e-kernel-build/Device-Files/modules/*.ko
#2 Copy our new modules from the source compile
Code:
cp ~/android/device/a32e/crypto/ansi_cprng.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/evbug.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/spi/spidev.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/fs/ecryptfs/ecryptfs.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/gud/mcDrvModule.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/gud/mcKernelApi.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/arch/arm/mach-msm/dma_test.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_axis.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/usb/host/ice40-hcd.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_event.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_input.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_matrix.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_output.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_oobtest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_pagetest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_readtest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_speedtest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_stresstest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_nandbiterrs.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_nandecctest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_subpagetest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_torturetest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/media/radio/radio-iris-transport.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/platform/msm/msm_bus/msm-buspm-dev.ko ~/a32e-kernel-build/Device-Files/modules/
#3 Create a modules directory on the external sd card
Code:
adb shell "su -c 'mkdir /sdcard2/modules/'"
#4 Erase old modules from sd card if there are any
Code:
adb shell "su -c 'rm -f /sdcard2/modules/*.ko'"
#5 Copy the new modules to the sd card
Code:
adb push ~/a32e-kernel-build/Device-Files/modules/ansi_cprng.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/dma_test.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/ecryptfs.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/evbug.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_axis.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_event.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_input.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_matrix.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_output.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/ice40-hcd.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mcDrvModule.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mcKernelApi.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/msm-buspm-dev.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_nandbiterrs.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_nandecctest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_oobtest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_pagetest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_readtest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_speedtest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_stresstest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_subpagetest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_torturetest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/radio-iris-transport.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/spidev.ko /sdcard2/modules/
#6 Connect the phone and start shell
Code:
adb shell
su
#7 Delete the existing modules from the device
Code:
mount -o rw,remount,rw /system
Code:
rm -rf /system/lib/modules/ansi_cprng.ko
rm -rf /system/lib/modules/dma_test.ko
rm -rf /system/lib/modules/ecryptfs.ko
rm -rf /system/lib/modules/evbug.ko
rm -rf /system/lib/modules/gpio_axis.ko
rm -rf /system/lib/modules/gpio_event.ko
rm -rf /system/lib/modules/gpio_input.ko
rm -rf /system/lib/modules/gpio_matrix.ko
rm -rf /system/lib/modules/gpio_output.ko
rm -rf /system/lib/modules/ice40-hcd.ko
rm -rf /system/lib/modules/mcDrvModule.ko
rm -rf /system/lib/modules/mcKernelApi.ko
rm -rf /system/lib/modules/msm-buspm-dev.ko
rm -rf /system/lib/modules/mtd_nandbiterrs.ko
rm -rf /system/lib/modules/mtd_nandecctest.ko
rm -rf /system/lib/modules/mtd_oobtest.ko
rm -rf /system/lib/modules/mtd_pagetest.ko
rm -rf /system/lib/modules/mtd_readtest.ko
rm -rf /system/lib/modules/mtd_speedtest.ko
rm -rf /system/lib/modules/mtd_stresstest.ko
rm -rf /system/lib/modules/mtd_subpagetest.ko
rm -rf /system/lib/modules/mtd_torturetest.ko
rm -rf /system/lib/modules/radio-iris-transport.ko
rm -rf /system/lib/modules/spidev.ko
#7 Copy the new modules to the device
Code:
cp -rf /sdcard2/modules/ansi_cprng.ko /system/lib/modules
cp -rf /sdcard2/modules/dma_test.ko /system/lib/modules
cp -rf /sdcard2/modules/ecryptfs.ko /system/lib/modules
cp -rf /sdcard2/modules/evbug.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_axis.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_event.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_input.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_matrix.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_output.ko /system/lib/modules
cp -rf /sdcard2/modules/ice40-hcd.ko /system/lib/modules
cp -rf /sdcard2/modules/mcDrvModule.ko /system/lib/modules
cp -rf /sdcard2/modules/mcKernelApi.ko /system/lib/modules
cp -rf /sdcard2/modules/msm-buspm-dev.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_nandbiterrs.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_nandecctest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_oobtest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_pagetest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_readtest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_speedtest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_stresstest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_subpagetest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_torturetest.ko /system/lib/modules
cp -rf /sdcard2/modules/radio-iris-transport.ko /system/lib/modules
cp -rf /sdcard2/modules/spidev.ko /system/lib/modules
#8 Set the correct permissions
Code:
chmod 0644 /system/lib/modules/ansi_cprng.ko
chmod 0644 /system/lib/modules/dma_test.ko
chmod 0644 /system/lib/modules/ecryptfs.ko
chmod 0644 /system/lib/modules/evbug.ko
chmod 0644 /system/lib/modules/gpio_axis.ko
chmod 0644 /system/lib/modules/gpio_event.ko
chmod 0644 /system/lib/modules/gpio_input.ko
chmod 0644 /system/lib/modules/gpio_matrix.ko
chmod 0644 /system/lib/modules/gpio_output.ko
chmod 0644 /system/lib/modules/ice40-hcd.ko
chmod 0644 /system/lib/modules/mcDrvModule.ko
chmod 0644 /system/lib/modules/mcKernelApi.ko
chmod 0644 /system/lib/modules/msm-buspm-dev.ko
chmod 0644 /system/lib/modules/mtd_nandbiterrs.ko
chmod 0644 /system/lib/modules/mtd_nandecctest.ko
chmod 0644 /system/lib/modules/mtd_oobtest.ko
chmod 0644 /system/lib/modules/mtd_pagetest.ko
chmod 0644 /system/lib/modules/mtd_readtest.ko
chmod 0644 /system/lib/modules/mtd_speedtest.ko
chmod 0644 /system/lib/modules/mtd_stresstest.ko
chmod 0644 /system/lib/modules/mtd_subpagetest.ko
chmod 0644 /system/lib/modules/mtd_torturetest.ko
chmod 0644 /system/lib/modules/radio-iris-transport.ko
chmod 0644 /system/lib/modules/spidev.ko
Reboot the device and you will be running the newly compiled modules.
Proprietary Modules
Building Proprietary Modules / Not Included in the Source
Lets take a look at the modules that did not build.
-rw-r--r-- root root 137370 2015-10-30 14:45 core_ctl.ko
lrw-r--r-- root root 2015-10-30 14:43 crypto_test_mod.ko -> crypto_test_mod.ko.3.10
-rw-r--r-- root root 287076 2015-10-30 14:43 crypto_test_mod.ko.3.10
lrw-r--r-- root root 2015-10-30 14:43 moc_crypto.ko -> moc_crypto.ko.3.10
-rw-r--r-- root root 510307 2015-10-30 14:43 moc_crypto.ko.3.10
-rw-r--r-- root root 40 2015-10-30 14:43 moc_crypto.ko.sig.3.10
lrw-r--r-- root root 2015-10-30 14:43 moc_crypto_api_tmpl.ko -> moc_crypto_api_tmpl.ko.3.10
-rw-r--r-- root root 176510 2015-10-30 14:43 moc_crypto_api_tmpl.ko.3.10
lrw-r--r-- root root 2015-10-30 14:43 moc_platform_mod.ko -> moc_platform_mod.ko.3.10
-rw-r--r-- root root 8541 2015-10-30 14:42 moc_platform_mod.ko.3.10
-rw-r--r-- root root 258697 2015-10-30 14:41 texfat.ko
lrw-r--r-- root root 2015-10-30 14:34 wlan.ko -> /system/lib/modules/pronto/pronto_wlan.ko
These are the modules we need to fix / get source for.
#1 core_ctl.ko
#2 crypto_test_mod.ko.3.10
#3 moc_crypto.ko.3.10
#4 moc_crypto.ko.sig.3.10
#5 moc_crypto_api_tmpl.ko.3.10
#6 moc_platform_mod.ko.3.10
#7 texfat.ko
#8 /system/lib/modules/pronto/pronto_wlan.ko
These modules require the following symlinks.
#1 crypto_test_mod.ko -> crypto_test_mod.ko.3.10
#2 moc_crypto.ko -> moc_crypto.ko.3.10
#3 moc_crypto_api_tmpl.ko -> moc_crypto_api_tmpl.ko.3.10
#4 moc_platform_mod.ko -> moc_platform_mod.ko.3.10
#5 wlan.ko -> /system/lib/modules/pronto/pronto_wlan.ko
Who is Who and What is What
This is the prima/pronto wireless net driver.
/system/lib/modules/pronto/pronto_wlan.ko
We will need to get source code for this module to build it.
The Mocana Cryptographic Loadable Kernel Module
crypto_test_mod.ko.3.10
moc_crypto.ko.3.10
moc_crypto.ko.sig.3.10
moc_crypto_api_tmpl.ko.3.10
moc_platform_mod.ko.3.10
http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1903.pdf
We will need to get source code from somewhere.
This I believe is a Qualcomm Module for the MSM8909 Board
core_ctl.ko
We will need to figure this one out.
This Is for large sd card support
texfat.ko
We will need to figure this one out.
So far with our extraversion and localversion settings during compile the original modules still work.
Long term we really want to be able to build theese
Building the Prima WIFI Module.
SEE INSTRUCTIONS ON THE NEXT PAGE
Building the msm_core_ctl module .
Export sched_setscheduler_nocheck() so that external kernel modules can use it.
A) Open ~/android/device/a32e/kernel/sched/core.c in a text editor
Search for do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
It is about line number 4239
add
Code:
EXPORT_SYMBOL(sched_setscheduler_nocheck);
The file should look like this
Code:
return __sched_setscheduler(p, &attr, false);
}
[COLOR="Green"][SIZE="4"]EXPORT_SYMBOL(sched_setscheduler_nocheck);[/SIZE][/COLOR]
static int
do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
Save and close the file.
ADD THE MODULE TO BUILD FILES
B) Open ~/android/device/a32e/drivers/soc/qcom/Kconfig in a text editor
config MSM_CORE_CTL_HELPER
It is about line number 558
add
Code:
config MSM_CORE_CTL
tristate "Core control module"
help
Add support for the Qualcomm core control module
The file should look like this
Code:
config MSM_PACMAN
bool "Enable the Peripheral Access Control Manager (PACMan)"
help
Add support for the Peripheral Access Control Manager (PACMan)
This driver allows reconfiguration of the Bus Access Manager
Low Speed Peripheral (BLSP) ownership.
[COLOR="Green"][SIZE="4"]config MSM_CORE_CTL
tristate "Core control module"
help
Add support for the Qualcomm core control module[/SIZE][/COLOR]
config MSM_CORE_CTL_HELPER
tristate "Core control helper functions for dynamically hotplug CPUs"
help
Provide helper functions for core control driver. Core control
driver dynamicatlly hotplugs CPUs from kernel based on current
system load and state. It also supports limiting min and
max online CPUs from userspace.
Save and close the file.
C) Open ~/android/device/a32e/drivers/soc/qcom/Makefile in a text editor
Search for obj-$(CONFIG_MSM_CORE_CTL_HELPER) += core_ctl_helper.o
It is about line number 62
add
Code:
obj-$(CONFIG_MSM_CORE_CTL) += msm_core_ctl.o
msm_core_ctl-objs := core_ctl_$(ARCH).o
The file should look like this
Code:
obj-$(CONFIG_MSM_PERFORMANCE) += msm_performance.o
[COLOR="Green"]obj-$(CONFIG_MSM_CORE_CTL) += msm_core_ctl.o
msm_core_ctl-objs := core_ctl_$(ARCH).o[/COLOR]
obj-$(CONFIG_MSM_CORE_CTL_HELPER) += core_ctl_helper.o
Save and close the file.
D) Open ~/android/device/a32e/arch/arm/configs/Prima_Big-Country_defconfig in a text editor
Search for CONFIG_MSM_CORE_CTL_HELPER
It is about line number 3471
add
Code:
CONFIG_MSM_CORE_CTL=m
CONFIG_MSM_CORE_CTL_HELPER=y
The file should look like this
Code:
# CONFIG_MSM_SHARED_HEAP_ACCESS is not set
# CONFIG_MSM_SYSTEM_HEALTH_MONITOR is not set
# CONFIG_QCOM_EARLY_RANDOM is not set
# CONFIG_MSM_PACMAN is not set
[COLOR="DarkGreen"]CONFIG_MSM_CORE_CTL=m
CONFIG_MSM_CORE_CTL_HELPER=y[/COLOR]
# CONFIG_MSM_PERFORMANCE is not set
CONFIG_HTC_DEBUG_RIL_PCN0002_DUMP_STACK=y
CONFIG_HTC_DEBUG_RIL_PCN0005_HTC_DUMP_SMSM_LOG=y
CONFIG_HTC_DEBUG_RIL_PCN0006_HTC_DUMP_BAM_DMUX_LOG=y
CONFIG_MEM_SHARE_QMI_SERVICE=y
Save and close the file.
E) DOWNLOAD THE SOURCE FILE.
https://drive.google.com/open?id=0B8jitdIyh2NtNjU3NFBIcU1NY0k
Copy the source to the TREE.
Code:
cp -rf ~/Downloads/core_ctl_arm.o_shipped /android/device/a32e/drivers/soc/qcom/core_ctl_arm.o_shipped
Now Go to the Build Prima Module Section on the next page and follow all instructions.
DE-Compile The Factory DT.img To DTB & DTS
How to Compile The Prima / (" PRONTO ") Wlan Module -->>> IN KERNEL TREE
# 1 ) Get the required Source Code ( DOWNLOAD HERE ) or attached to the DEVDB.
https://drive.google.com/open?id=0B8jitdIyh2NtMzB2a2pNeU1iWDg
#2 ) Add it to our Project & Kernel Source Tree
Code:
mkdir ~/a32e-kernel-build/Qualcom-Vendor-Opensource/
mv ~/Downloads/qualcom-vendor-opensource.zip ~/a32e-kernel-build/Qualcom-Vendor-Opensource/
unzip ~/a32e-kernel-build/Qualcom-Vendor-Opensource/qualcom-vendor-opensource.zip -d ~/a32e-kernel-build/Qualcom-Vendor-Opensource/
rm -rf ~/a32e-kernel-build/Qualcom-Vendor-Opensource/qualcom-vendor-opensource.zip
cp -rf ~/a32e-kernel-build/Qualcom-Vendor-Opensource/vendor/qcom/opensource/wlan/prima ~/android/device/a32e/drivers/staging/prima
#2 ) Configure The Module to build in the Kernel Source Tree
A) Open in a text Editor ~/android/device/a32e/drivers/staging/prima/Kconfig
Add to the bottom of the file:
Code:
[COLOR="SeaGreen"][SIZE="4"]config WLAN_OFFLOAD_PACKETS
bool "Enable offload packets feature"
default n[/SIZE][/COLOR]
[COLOR="SeaGreen"][SIZE="4"]config QCOM_TDLS
bool "Enable TDLS (Tunnel Direct Link Setup) feature"
default n[/SIZE][/COLOR]
Or download my Kconfig file
https://drive.google.com/open?id=0B8jitdIyh2Ntc0p6UFNlTGxJNkU
Copy the file to the tree. ( ONLY IF YOU DOWNLOADED IT )
Code:
mv ~/Downloads/Kconfig ~/android/device/a32e/drivers/staging/prima/Kconfig
B) Open in a text Editor ~/android/device/a32e/drivers/staging/Kconfig
Add to the bottom of the file:
Code:
[COLOR="SeaGreen"][SIZE="4"]source "drivers/staging/prima/Kconfig"[/SIZE][/COLOR]
C ) Open in a text Editor ~/android/device/a32e/drivers/staging/Makefile
Add to the bottom of the file:
Code:
[COLOR="SeaGreen"][SIZE="4"]
obj-$(CONFIG_PRIMA_WLAN) += prima/
obj-$(CONFIG_PRONTO_WLAN) += prima/
[/SIZE][/COLOR]
#4 ) Edit the Big-Country_defconfig File
I have made several Changes - USE THIS DOWNLOAD for now.
https://drive.google.com/open?id=0B8jitdIyh2NtZ3VtTTV6Z3dhb0E
Copy the new config to the tree
Code:
cp ~/Downloads/Prima_Big-Country_defconfig ~/android/device/a32e/arch/arm/configs/Prima_Big-Country_defconfig
#4 ) Compile the Kernel and it will build the wlan.ko
Code:
[SIZE="4"][COLOR="DarkGreen"]cd
cd ~/android/device/a32e/
export TOP=~/android/Toolchains/
export PATH=$TOP/prebuilts/arm-eabi-4.8/bin:$PATH
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=~/android/Toolchains/prebuilts/arm-eabi-4.8/bin/arm-eabi-
make clean
make mrproper
make Prima_Big-Country_defconfig
make prepare
make all -j8
make modules[/COLOR][/SIZE]
You Should see this output.
[email protected]:~/android/device/a32e$ make modules
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
Building modules, stage 2.
MODPOST 26 modules
Now we have 26 modules instead of 24.
A new wlan.ko which will get renamed to pronto_wlan.ko.
We also have the WCNSS file for the wlan.
Code:
[SIZE="4"][COLOR="Blue"]
~/android/device/a32e/drivers/staging/prima/wlan.ko
~/android/device/a32e/drivers/staging/prima/firmware_bin/WCNSS_cfg.dat
~/bigcountry/android/device/a32e/drivers/staging/prima/firmware_bin/WCNSS_qcom_cfg.ini
~/bigcountry/android/device/a32e/drivers/staging/prima/firmware_bin/WCNSS_qcom_wlan_nv.bin
~/android/device/a32e/drivers/bluetooth/bluetooth-power.ko
[/COLOR][/SIZE]
Now we are ready to load the new Kernel and Modules
load the new Kernel
Code:
sudo cp -r ~/a32e-kernel-build/Device-Files/Boot/ramdisk ~/a32e-kernel-build/Tools/AIK-Linux/ramdisk
Code:
sudo cp -r ~/a32e-kernel-build/Device-Files/Boot/split_img ~/a32e-kernel-build/Tools/AIK-Linux/split_img
Code:
sudo cp -f ~/android/device/a32e/arch/arm/boot/zImage ~/a32e-kernel-build/Tools/AIK-Linux/split_img/Boot.img-zImage
Code:
cd ~/a32e-kernel-build/Tools/AIK-Linux
sudo ./repackimg.sh
sudo cp -f ~/a32e-kernel-build/Tools/AIK-Linux/image-new.img ~/a32e-kernel-build/Device-Files/New-Boot/image-new.img
adb reboot download
sleep 10s
cd ~/a32e-kernel-build/Device-Files/New-Boot/
fastboot flash boot image-new.img
echo ""
echo ""
echo "Finished Flashing Kernel"
read -p "Press [Enter] to Reboot..."
fastboot reboot
Clean out our project directory.
Code:
rm -f ~/a32e-kernel-build/Device-Files/modules/*.ko
Copy compiled modules to our project directory.
Code:
cp ~/android/device/a32e/drivers/staging/prima/wlan.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/staging/prima/firmware_bin/WCNSS_cfg.dat ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/staging/prima/firmware_bin/WCNSS_qcom_cfg.ini ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/staging/prima/firmware_bin/WCNSS_qcom_wlan_nv.bin ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/bluetooth/bluetooth-power.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/crypto/ansi_cprng.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/evbug.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/spi/spidev.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/fs/ecryptfs/ecryptfs.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/gud/mcDrvModule.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/gud/mcKernelApi.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/arch/arm/mach-msm/dma_test.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_axis.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/usb/host/ice40-hcd.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_event.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_input.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_matrix.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/input/misc/gpio_output.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_oobtest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_pagetest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_readtest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_speedtest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_stresstest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_nandbiterrs.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_nandecctest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_subpagetest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/mtd/tests/mtd_torturetest.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/media/radio/radio-iris-transport.ko ~/a32e-kernel-build/Device-Files/modules/
cp ~/android/device/a32e/drivers/platform/msm/msm_bus/msm-buspm-dev.ko ~/a32e-kernel-build/Device-Files/modules/
Clean the sdcard temporary directory.
Code:
adb shell "su -c 'rm -f /sdcard2/modules/*.ko'"
Copy the new modules to the sd card temp directory.
Code:
adb push ~/a32e-kernel-build/Device-Files/modules/wlan.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/WCNSS_cfg.dat /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/WCNSS_qcom_cfg.ini /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/WCNSS_qcom_wlan_nv.bin /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/bluetooth-power.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/ansi_cprng.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/dma_test.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/ecryptfs.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/evbug.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_axis.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_event.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_input.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_matrix.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/gpio_output.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/ice40-hcd.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mcDrvModule.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mcKernelApi.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/msm-buspm-dev.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_nandbiterrs.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_nandecctest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_oobtest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_pagetest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_readtest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_speedtest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_stresstest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_subpagetest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/mtd_torturetest.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/radio-iris-transport.ko /sdcard2/modules/
adb push ~/a32e-kernel-build/Device-Files/modules/spidev.ko /sdcard2/modules/
NOW connect the device and start a shell
Code:
adb shell
su
Re-Mount System as Read Write.
Code:
mount -o rw,remount,rw /system
Remove the existing modules from the device .
Code:
rm -rf /system/lib/modules/wlan.ko
rm -rf /system/lib/modules/pronto/pronto_wlan.ko
rm -rf /system/etc/firmware/wlan/prima/WCNSS_cfg.dat
rm -rf /system/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini
rm -rf /system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
rm -rf /system/lib/modules/bluetooth-power.ko
rm -rf /system/lib/modules/ansi_cprng.ko
rm -rf /system/lib/modules/dma_test.ko
rm -rf /system/lib/modules/ecryptfs.ko
rm -rf /system/lib/modules/evbug.ko
rm -rf /system/lib/modules/gpio_axis.ko
rm -rf /system/lib/modules/gpio_event.ko
rm -rf /system/lib/modules/gpio_input.ko
rm -rf /system/lib/modules/gpio_matrix.ko
rm -rf /system/lib/modules/gpio_output.ko
rm -rf /system/lib/modules/ice40-hcd.ko
rm -rf /system/lib/modules/mcDrvModule.ko
rm -rf /system/lib/modules/mcKernelApi.ko
rm -rf /system/lib/modules/msm-buspm-dev.ko
rm -rf /system/lib/modules/mtd_nandbiterrs.ko
rm -rf /system/lib/modules/mtd_nandecctest.ko
rm -rf /system/lib/modules/mtd_oobtest.ko
rm -rf /system/lib/modules/mtd_pagetest.ko
rm -rf /system/lib/modules/mtd_readtest.ko
rm -rf /system/lib/modules/mtd_speedtest.ko
rm -rf /system/lib/modules/mtd_stresstest.ko
rm -rf /system/lib/modules/mtd_subpagetest.ko
rm -rf /system/lib/modules/mtd_torturetest.ko
rm -rf /system/lib/modules/radio-iris-transport.ko
rm -rf /system/lib/modules/spidev.ko
Copy the New Compiled Modules to the device .
Code:
cp -rf /sdcard2/modules/wlan.ko /system/lib/modules/pronto/pronto_wlan.ko
cp -rf /sdcard2/modules/WCNSS_cfg.dat /system/etc/firmware/wlan/prima/
cp -rf /sdcard2/modules/WCNSS_qcom_cfg.ini /system/etc/firmware/wlan/prima/
cp -rf /sdcard2/modules/WCNSS_qcom_wlan_nv.bin /system/etc/firmware/wlan/prima/
cp -rf /sdcard2/modules/bluetooth-power.ko /system/lib/modules/
cp -rf /sdcard2/modules/ansi_cprng.ko /system/lib/modules
cp -rf /sdcard2/modules/dma_test.ko /system/lib/modules
cp -rf /sdcard2/modules/ecryptfs.ko /system/lib/modules
cp -rf /sdcard2/modules/evbug.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_axis.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_event.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_input.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_matrix.ko /system/lib/modules
cp -rf /sdcard2/modules/gpio_output.ko /system/lib/modules
cp -rf /sdcard2/modules/ice40-hcd.ko /system/lib/modules
cp -rf /sdcard2/modules/mcDrvModule.ko /system/lib/modules
cp -rf /sdcard2/modules/mcKernelApi.ko /system/lib/modules
cp -rf /sdcard2/modules/msm-buspm-dev.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_nandbiterrs.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_nandecctest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_oobtest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_pagetest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_readtest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_speedtest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_stresstest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_subpagetest.ko /system/lib/modules
cp -rf /sdcard2/modules/mtd_torturetest.ko /system/lib/modules
cp -rf /sdcard2/modules/radio-iris-transport.ko /system/lib/modules
cp -rf /sdcard2/modules/spidev.ko /system/lib/modules
Create the pronto_wlan.ko / wlan.ko symlink .
Code:
ln -s /system/lib/modules/pronto/pronto_wlan.ko /system/lib/modules/wlan.ko
set the permissions for all the new modules.
Code:
chmod 0644 /system/lib/modules/wlan.ko
chmod 0644 /system/lib/modules/pronto/pronto_wlan.ko
chmod 0644 /system/etc/firmware/wlan/prima/WCNSS_cfg.dat
chmod 0644 /system/etc/firmware/wlan/prima/WCNSS_qcom_cfg.ini
chmod 0644 /system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
chmod 0644 /system/lib/modules/bluetooth-power.ko
chmod 0644 /system/lib/modules/ansi_cprng.ko
chmod 0644 /system/lib/modules/dma_test.ko
chmod 0644 /system/lib/modules/ecryptfs.ko
chmod 0644 /system/lib/modules/evbug.ko
chmod 0644 /system/lib/modules/gpio_axis.ko
chmod 0644 /system/lib/modules/gpio_event.ko
chmod 0644 /system/lib/modules/gpio_input.ko
chmod 0644 /system/lib/modules/gpio_matrix.ko
chmod 0644 /system/lib/modules/gpio_output.ko
chmod 0644 /system/lib/modules/ice40-hcd.ko
chmod 0644 /system/lib/modules/mcDrvModule.ko
chmod 0644 /system/lib/modules/mcKernelApi.ko
chmod 0644 /system/lib/modules/msm-buspm-dev.ko
chmod 0644 /system/lib/modules/mtd_nandbiterrs.ko
chmod 0644 /system/lib/modules/mtd_nandecctest.ko
chmod 0644 /system/lib/modules/mtd_oobtest.ko
chmod 0644 /system/lib/modules/mtd_pagetest.ko
chmod 0644 /system/lib/modules/mtd_readtest.ko
chmod 0644 /system/lib/modules/mtd_speedtest.ko
chmod 0644 /system/lib/modules/mtd_stresstest.ko
chmod 0644 /system/lib/modules/mtd_subpagetest.ko
chmod 0644 /system/lib/modules/mtd_torturetest.ko
chmod 0644 /system/lib/modules/radio-iris-transport.ko
chmod 0644 /system/lib/modules/spidev.ko
RE-Boot and run your new kernel and modules with a smile.
Customizing the Kernel
Changing and Customizing The Kernel
SUCCESS !! ( Build the Prima / Pronto Wlan Module)
Fix ADD the DTB Blob to the Source
reserved space
I'm so glad somone is doing this I've been wanting a new kernel for a while and I think this might help make a path to new roms
This looks great. Can't wait to see where this goes. What can I do to help?
@zixxorb
You can run through with all of this and get the kernel running on your device.
Right now im working on getting the missing modules to build.
So you can work on that to.
The modules that are generated during the compile function properly.
Ok, so I'm more of a noob to doing anything with kernels, idk what I need to do exactly. Plus I'm already on 6.0 (this is my main phone)
The Most Valuable Document Ever
This is exactly what we need to answer some questions.
Authored by Qualcomm and one of the hardest things to find.
Make sure to copy this wile you can.
It's practically Top Secret.
https://github.com/dante198406/Qual...0-NR964-4_C_MSM8909_LA_SW_User_Manual_SPD.pdf
Get it wile you can !!
Just a general update.
I have updated the modules install section.
It now includes the instructions for installing the new modules.
The modules have been tested and seem to operate without issues.
Will this work for the sprint variant?
I'm a noob so pls permit me if this question sounds foolish. All through the tutorial, it seems this kernel is for the Metro PCs. Will it work for the sprint variant of 626s?
This tutorial is based off of the Metro-Pcs version.
The HTC-DEV site has separate source code for each device carrier.
You would follow everything exactly except.
1 ) From the HTC-DEV site download the source code for your specific carrier.
For sprint download sprint.
For t-mobile download t-mobile.
Set the device filter on the website to be desire626s
and you will get this.
2 ) in the section #2 Setup the Kernel Source
There are commands for unzipping the source file.
You will need to change the filename in the command to match the filename you downloaded.
After the first untar / unpack you will need to get the kernel filename.
Change that filename in the commands as well.
3) When you edit the version info.
Open up the Big-Country_defconfig
It is in the folder ~/android/device/a32e/arch/arm/configs
Open it with G-Edit or whatever text editor you use.
Search for CONFIG_LOCALVERSION=
and change it to CONFIG_LOCALVERSION="-g26c2269"
CHANGE
CONFIG_LOCALVERSION="-g26c2269"
CONFIG_LOCALVERSION="-your device version"
You can get the version as i showed you in previous post.
4) The rest is all the same.
AS far as the kernel and modules that have been uploaded here, they are for the Metro Pcs Version. ( And Lollipop NOT Marshmallow)
I will build the others later when i finish more of this project.
ALSO YOU CAN USE THIS TUTORIAL TO BUILD THE KERNEL FOR ANY DEVICE.
Things will change here and there but generally speaking all of the steps you need to follow are the same.

Categories

Resources