Paranoid Networking? - Android Q&A, Help & Troubleshooting

I have been having issues with the Paranoid Networking feature added to the Linux Kernel preventing some of my programs from creating sockets.
Appearently the process must be of a certain group id, either one of the AID_INET or AID_BT groups in the 3000's range I believe. I was cgreping through the source code and it seems a few calls to "in_egroup_p(gid_t)" are made to test if the process's group is 'correct' when ANDROID_PARANOID_NETWORKING is defined. If I understood the "in_egroup_p()" function, it should return 1 (retval) if there is a match. so what I did was this in the c file for inet in the kernel. I hope the kernel gets compiled, I just did a "make clean" and "brunch d2spr" it is cm-10.1
Code:
#ifdef ANDROID_PARANOID_NETWORKING // this was there
if ( in_egroup_p(0) == 1) {
return 1;
} // I added this
return in_egroup_p(AID_INET) || capable(I_FORGOT_HERE); //this was there
And I am hoping that when I execute the program as root, it will have permission to create a socket. Also note, that the programs I am having problems for are glibc based that I copied and mounted from a .img file. Programs such as postresql, gdm3, and others. It is a debian distro that I mount with an init service when a property is set to 1.
If this does not work, I will need to run without the Paranoid Networking patch to the kernel. What config file do I need to edit so that ANDROID_PARANOID_NETWORKING does not get defined or built into the kernel?
edit: I feel like this, " IM ROOT B****, STAY OUTTA MY WAY! " And then that scene from Jurrasic Park comes to mind
http://www.youtube.com/watch?v=RfiQYRn7fBg

Still no go
Code:
[email protected]:/etc/init.d# ./postgresql start
[....] Starting PostgreSQL 9.1 database server: main[....] The PostgreSQL server failed to start. Please check the log output: 2014-01-06 16:48:59 UTC LOG: could not create IPv6 socket: Permission denied 2014-01-06 16:48:59 UTC LOG: could not create IPv4 socket: Permission denied 2014-01-06 16:48:59[FAILWARNING: could not create listen socket for "localhost" 2014-01-06 16:48:59 UTC FATAL: could not create any TCP/IP sockets ... failed!
failed!
*BEEP* *BEEP* *BEEEEEEEEEEP*
Hmmm... Maybe the kernel didn't compile? I dunno . ...
Where is the config file for the kernel that comes with CM-10.1 so I can turn off this paranoid networking?
My philosophy is that they shouldn't be there to start a socket in the first place, but if I want to, I should be able to. This is where I need something akin to sudo, but as root this is pissing me off, let me create a socket por favor!
I tried a lot of things but this just isn't working right. Some one please, help.
I've about had it up to my neck with Android. ****ing bull ****, I didn't know I was buying a bad ass phone with Chains and Iron Bars for an OS. FREEEEEEEDOOOOOOMMMMMNNNNNNNNN

After breaking my build, I deleted my kernel directory tree and re-sync'ed. I then did "source build/envsetup.sh" and "breakfast d2spr" and then I when to "kernel/samsung/d2/" and did "make menuconfig" then I unselected in networking options "Only specific groups can create sockets" or some such option. and then "brunch d2spr". We shall see if that works.
Update:
Did not work. Said unfinished jobs yada yada
So what I am trying now.
I cleaned everything, bummer!
I copied my kernel dir to another location
I pulled my kernel config with adb
I used that with 'make menuconfig' and edited out the 'only allow certain groups' bit
I saved that
copied it to my source in kernel/samsung/d2/
I edited AndroidKernel.mk to use that config file instead ( the assignment occurs at the top of the file)
croot
brunch d2spr
waiting till tomorrow more than likely....
Update: ( 3 hours later )
Its taking long enough
seems to be working
maybe I can make a config in my source tree and then make mroper and clean, aswell as in the KERNEL_OBJ dir in out/*, then brunch. to avoid needing two kernel source trees and some confusion in case I modify any of the source and not just the config.
AndroidKernel.mk specifies which config file to use instead of the other pre-configured files, just start by pulling a config off your phone with the same rom and device your building for.
Code:
adb pull /proc/config.gz
That will pull the conpressed file off your phone to the current working directory, then gunzip it. Then launch
Code:
make menuconfig
from your kernels root dir, for me that is "/home/$USER/android/system/kernel/samsung/d2/"
And then once the menu is up, use the arrows to scroll down to the bottom and use enter or return to select the option to use a different configuration file, it should change menus to one with ".config" erase that and change it to point to your config file, I just copied mine to the same directory mentioned above with the name "config" the same without the "." (dot/period) in front.
After that, from the same dir ( as well as in the KERNEL_OBJ/ dir somewhere within the out/ dir)
Code:
make mrproper && make clean
to clean the previous kernel make.
After all of that, you can 'croot' and 'brunch $YOUR_MODEL', but not before making sure you change which config file to use in your kernel's root dir in it's AndroidKernel.mk file. Its at the top, I used an absolute path for my installation, just in case.

Related

[MOD] Change WiFi hostname - for custom ROMs (Sept 23)

This is useful for identifying phones on the local networks by looking at DHCP lease tables in the routers. It doesn't make your phone appear on Windows networks, since the phone needs to broadcast NetBIOS name for that. If you want your phone to show up on Windows networks (and share files) - you need Samba server, and JimmyChingala is working on one.
ROM developers can insert the option to customize hostname using the way described below in their Spare Parts options. Feel free to do so.
[SOLUTION]
The following shell command does the job of changing WiFi hostname:
echo YOURHOSTNAME > /proc/sys/kernel/hostname
Click to expand...
Click to collapse
For the change to stay, it should be executed on each boot. And here the things start being more problematic.
For custom ROMs:
Most, if not all, custom ROMs include some user init shell script that will be executed on boot, making the solution easy.
Enter the following line in the Terminal / ADB shell:
echo "echo YOURHOSTNAME > /proc/sys/kernel/hostname" >> the_path_and_name_of_userinit_script.sh
chmod 777 the_path_and_name_of_userinit_script.sh
Click to expand...
Click to collapse
Several examples of custom ROMs and their userinit scripts:
Suggested - will work for most ROMs (creates another file in directory of autoexecuted scripts): /etc/init.d/88hostnameinit
Additional possibility for Enomther's ROM: /data/local/userinit.sh
Additional possibility for CyanogenMOD: /sd-ext/userinit.sh
For stock ROMs:
There is no autorun script for stock ROMs, so they have to be added through modifying boot.img. It's a complicated procedure, and even though guides exist for it - I suggest not to mess with it only because of the hostname. The easiest solution would be to create a script file with the line above using Gscript or other scripting solutions, and execute it after each reboot. If anyone really wishes to modify boot.img - I assume that he/she knows enough about Linux/Android since it can be relatively easily done only on Linux, can find the necessary guides with some googling (like I did), and in this case the modification is easiest to do directly in init.rc - changing "hostname localhost" to "hostname name_of_your_choice".
[ORIGINAL POST]
Hi people,
I'm not much of a dev, but I can find my way around with a bit of Google search And sorry about the links that don't link, new user's permissions don't allow me to...
Anyway, after messing with my router today I've noticed that Nexus transmits "localhost" as its host name to DHCP server, causing my DD-WRT to show it as "*". I went to Google and to my surprise, discovered that there isn't such an option in any Nexus ROM yet.
Found this: LINK_www_laslow_net_?p=501
To change your hostname on Cyanogen 5.x, add the following line to the bottom of /system/etc/init.d/01sysctl -- and make sure you make a backup of 01sysctl before editing it!
echo NEWHOSTNAME > /proc/sys/kernel/hostname
Click to expand...
Click to collapse
I tested it, and it didn't work. After booting, the file still read "localhost" in it, and the hostname on DHCP server reflected it.
But, I didn't get frustrated, connected with ADB, manually executed the command:
echo MyHostName > /proc/sys/kernel/hostname
checked that the file was overwritten, disabled WiFi, deleted DHCP lease, enabled WiFi back - and voila, I have a new hostname!
Then I went to search for hostname setting, which got me to /init.rc:
on boot
# basic network init
ifup lo
hostname localhost
domainname localdomain
Click to expand...
Click to collapse
Well, I guess that's the place. A tiny problem, though - it's in the boot image, which can't be easily modified. Thanks to the latest thread on update.zip creation I can probably do it myself, but I wanted to share the findings and ask for the correct way to implement.
There's a "dirty but functional" way of "disable WiFi - override /proc/sys/kernel/hostname - enable WiFi", and it's probably not a problem to stick it somewhere in the boot sequence, or even write an app that writes those changes to one of the boot scripts and allows configuration of host and domain names. But it's not the best way - DHCP might already give out a lease, and the new host name might not register.
And there's a correct (?) way of doing it, introducing it into init.rc. Since it's "on boot", I suppose that it runs after mounting the partitions - which means that the partitions are already accessible.
In this case, the best way would be executing a small shell script that would check for existence of, say, "/system/etc/settinghostdomainnames.rc" and create a default one if it's not there, then use "import /system/etc/settinghostdomainnames.rc" and set a manual trigger, like the guy is trying to do here:
LINK_groups.google.co.jp_group_android-developers_browse_thread_thread_e2f432707b735ff0
"trigger someeventtobringupnetworkinterface"
That would allow to use a custom setting for host and domain names that can be changed by SW, and adding that as another option into ROM Settings app or external app.
But the guy in question didn't succeed. What did he miss? Would it be better to do something like "on fakesystemproperty=something" and instead of manual trigger, doing "setprop fakesystemproperty something"?
I can probably test it and find out myself, but it would take loads of time compared to one of the kernel devs, and I don't even have the environment set up for modifying boot images. I was kinda hoping that one of the kernel devs would test it. I can write and post the modifications to init.rc and the custom script, they're very simple.
So, who can help me with answering the questions in the thread, and/or testing the modification?
Thanks! It's back.
Oh well, I'll keep preparing Ubuntu VM anyway
OK, first test fired - updated /init.rc in my own boot.img, checked the values. It's working, hostname is indeed modified.
Now I'll try to rewrite /init.rc in such way as to load the hostname setting from elsewhere, while not screwing the security. Will post results soon.
Setting it to the same value as the BT value would be ideal. I'm not sure how you could do that though, because the init scripts run before the frameworks load
Looking forward for a fix to this problem.
Update, but only partially on topic:
God, I hate SH scripting. Couldn't even google a normal tutorial that would explain where I went wrong. A script of 10 lines, and I can't make it work.
Let's see, I need something like this:
#!/system/bin/sh
echo "on service-exited-network_prepare" > /system/etc/net_init.rc
echo " ifup lo" >> /system/etc/net_init.rc
if [ -e "/system/etc/net_init.domain" ];
then
echo "hostname `cat /system/etc/net_init.host`" >> /system/etc/net_init.rc
else
echo "hostname localhost" >> /system/etc/net_init.rc
fi
if [ -e "/system/etc/net_init.domain" ];
then
echo "domainname `cat /system/etc/net_init.domain`" >> /system/etc/net_init.rc
else
echo "domainname localdomain" >> /system/etc/net_init.rc
fi
echo >> /system/etc/net_init.rc
Of course, this thing fails miserably with -
Syntax error: end of file unexpected (expecting "then")
What the hell am I doing wrong? Never used SH before, mostly tcsh and perl.
Thanks.
Oh well, I guess I got the problem.. Unix vs Windows file format. Sorry for bothering.
its always bothered me that you cant change the device name for wifi networks, and ive always looked for a way to change it.
kudos to you for the ambition and diligence to do it!
dont give up, if you can get it smoothed out enough im sure cyanogen will implement it in his next mod. ive always wished there was an option in wifi settings to change device name. itd be very useful for lan ip configuring and when your connected to a random hotspot lol
Ok, after fighting for a day, I still didn't manage to import another .RC file and run on service exit (I don't even see the trace of the process I'm trying to start - the first thing it does is attempting to write log, and there is no log, no matter where I put the start command), but at least for a "quick-and-dirty way" there's a very simple solution, given SD-EXT partition (I believe everyone creates it):
open terminal application, type the following command:
echo "echo YOURHOSTNAME > /proc/sys/kernel/hostname" > /sd-ext/userinit.sh
That would override the hostname of the system before boot completion.
After some reading, I believe there's nothing bad in setting the hostname twice - once default localhost in init.rc, and then overriding it using /proc/sys directory, Linux is designed to cope with that and hopefully so does Android.
So, as to pershoot's request, it's possible to write a small application to read Bluetooth device name value and write it as WiFi hostname, and include it in boot process right before 20userinit.
Now this is a task I'm not suitable for, I have no knowledge of frameworks whatsoever. Anybody up to the task?
Jack_R1 said:
After some reading, I believe there's nothing bad in setting the hostname twice - once default localhost in init.rc, and then overriding it using /proc/sys directory, Linux is designed to cope with that and hopefully so does Android.
So, as to pershoot's request, it's possible to write a small application to read Bluetooth device name value and write it as WiFi hostname, and include it in boot process right before 20userinit.
Now this is a task I'm not suitable for, I have no knowledge of frameworks whatsoever. Anybody up to the task?
Click to expand...
Click to collapse
I requested it and I'm not pershoot
Oops Sorry, my bad. Fever and lots of time in front of the computer don't do me good...
Kudos to you Jack_R1. Watching this.
Let me know if you need any help with shell scripting.
Gonna watch this and try it out later, the solution so far.
is this a stable fix?
is this confirmed to work?
Sorted out, updated with the most current info and several examples of custom ROMs.
Jack_R1 said:
Sorted out, updated with the most current info and several examples of custom ROMs.
Click to expand...
Click to collapse
I am running CM6 with a2sd and somehow the /sd-ext/userinit.rc is not executed. Even if I change permissions of the file to 777, it's not executed.
I also haven't found in init.d the script which executes userinit.rc, might be because I am running custom kernel? (wildmonks).
The only way for me to do it was to put the script in /etc/init.d/88userinit file and change it's permissions to 777
It's /scripts/userinit.sh, not userinit.rc
The execution of /sd-ext/userinit.rc used to be in /init.rc, in boot.img.
But the preferred way for most of the ROMs is to use /etc/init.d/ scripts anyway, since a lot of ROMs use them.
Changed the 1st post to reflect it.

[Q] Cyanogen: Set net.hostname at boot

Android 2.2 sets the default hostname to android_dfhjkahdjksf or something equally useless.
To override this in Cyanogen 6.1 you need to set the net.hostname property with setprop Eg:
# setprop net.hostname mickey
My problem is when I try to set this up at boot, something always overwrites my change with the default. I have tried putting it in my init.rc, /etc/init.d and /data/local/userinit.sh and it is always reset to default by the time the phone has booted.
Does anyone have any more ideas about how to permanently set the hostname? It would be a good option to have in cyanogenmod.
UP. I'm very interesting too.
The root filesystem is stored in the boot.img and is expanded to a ramdisk every time you reboot. For changes to be permenant, you need to extract the boot.img file, extract the kernel and ramdisk sections, modify the ramdisk image with your changes, then recombine the kernel and ramdisk to a new boot.img and reflash it. You'll probably need to do this on a linux machine that understands unix permissions and ramdisk/cpio filesystems as well as having a good knowledge of linux and unix commands. See this thread:
http://forum.xda-developers.com/showthread.php?t=551711
note: your kernel may use a different "--base 0x19200000" option when building the kernel boot image.
Is there not a way to add a correlating line to the build.prop file?
EDIT: This doesn't work - whatever is setting the net.hostname writes out after build.prop is read.
I'm looking...
I did a search in the /system/etc directory for any file doing setprop (I'm using a miui rom) and found the following script. I did the setprop for net.hostname in there and it too is being overwritten.
search command:
grep -H -r setprop /system/etc
/system/etc/init.goldfish.sh
I'm running out of ideas other than using autostart to set it after reboot.
EDIT2: doh. I think I already knew this but it dawned on me that the default net.hostname comes from concatenating the "android_id" (found in the secure database table) to the end of "android_".
So seems more likely to reset it after reboot using a script (gscript to launch it manually or use autostart to launch it automatically at the end of reboot cycle).
Property net.hostname originate from services.jar (ConnectivityServices.java):
Code:
// setup our unique device name
String id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (id != null && id.length() > 0) {
String name = new String("android_").concat(id);
SystemProperties.set("net.hostname", name);
}
Maybe CM guys would change this to add another "if /proc/sys/kernel/hostname is different than localhost, use it for net.hostname too" condition.
I'm not using CM so it is up to you guys to make a feature request.
Another approach would be to set service in init.rc that would start your net.hostname changing script on some property being set just after net.hostname is set. You could use also:
Code:
on property:net.hostname=android_blahblah
...but that wouldn't be so handy since you will have to change that line in init.rc every time you make a factory reset.
Really interesting, thx !
BlaY0 said:
Property net.hostname originate from services.jar (ConnectivityServices.java):
Code:
// setup our unique device name
String id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (id != null && id.length() > 0) {
String name = new String("android_").concat(id);
SystemProperties.set("net.hostname", name);
}
Maybe CM guys would change this to add another "if /proc/sys/kernel/hostname is different than localhost, use it for net.hostname too" condition.
I'm not using CM so it is up to you guys to make a feature request.
Another approach would be to set service in init.rc that would start your net.hostname changing script on some property being set just after net.hostname is set. You could use also:
Code:
on property:net.hostname=android_blahblah
...but that wouldn't be so handy since you will have to change that line in init.rc every time you make a factory reset.
Click to expand...
Click to collapse
Thanks a lot. I've been looking for this for the past hour or so. Traditional linux methods to set the hostname don't work... I think I'll add an option in cyanogenmod settings for this and submit it to Gerrit. Look for it to show up within the next day or two.
That's great m8! Cheers
Sent from my HTC Legend
underscores in hostnames are bad
The main thing I want to do is get rid of that underscore. Several of the places I hook up with with WiFi attempt to enter the hostname supplied during the DHCP conversation into a DNS. But underscore is illegal for this purpose.
Numbat.
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A

[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

[DEV only] Random Development thoughts

I have started this thread as a place to discuss random development thought that probably don't need their own threads, and as a place to discuss issues so other threads don't go too far off topic.
Table of Contents:
DBV for c6843: Posts 1 - 6
GPL: Post 7
F2FS: Post 8
wlan: post 9, 11 -
Optimisation Bookmark: post 10
Original Post 1:
First thought
@dbolivar Have you tried building you (DooMKernel) with CONFIG_DVB_CORE = y/m to see if you can get the TV function to work?
blueether said:
I have started this thread as a place to discuss random development thought that probably don't need their own threads, and as a place to discuss issues so other threads don't go too far off topic.
First thought
@dbolivar Have you tried building you (DooMKernel) with CONFIG_DVB_CORE = y/m to see if you can get the TV function to work?
Click to expand...
Click to collapse
Hi, good start. In fact I have, the differences in the kernel options between C6833 and C6843 (Brazilian model with digital TV) are:
Code:
47c47
< CONFIG_MACH_SONY_TOGARI_BRAZIL=y
---
> CONFIG_MACH_SONY_TOGARI_ROW=y
275d274
< CONFIG_ISDBT_TUNER_SMTEJ11X=y
325a325,327
> CONFIG_TOUCHSCREEN_CLEARPAD=y
> CONFIG_TOUCHSCREEN_CLEARPAD_I2C=y
> CONFIG_TOUCHSCREEN_CLEARPAD_RMI_DEV=y
Yes, I don't know why the Clearpad touchscreen is enabled for the C6833, but not for the C6843; I think it's just garbage (perhaps they made the togari defconfig based off honami, and corrected that when making the togari_brazil defconfig). It doesn't make any difference for me, disabling them keep the touchscreen (MAX1187) functions normal.
Well, back to the point: even when applying these differences to the ZU DooMKernel, the digital TV doesn't work. The app stays a long time in a black screen, and finally closes (FC). I investigated the kmsg and logcat, but nothing useful.
CONFIG_DVB_CORE is "m" by default. I tried insmod'ing every module in /system/lib/modules, but same result. I temporarily gave up, because I don't watch the crap they broadcast on the open TV here. But yeah, it would be good to have everything working...
dbolivar said:
Hi, good start. In fact I have, the differences in the kernel options between C6833 and C6843 (Brazilian model with digital TV) are:
Code:
47c47
< CONFIG_MACH_SONY_TOGARI_BRAZIL=y
---
> CONFIG_MACH_SONY_TOGARI_ROW=y
275d274
< CONFIG_ISDBT_TUNER_SMTEJ11X=y
325a325,327
> CONFIG_TOUCHSCREEN_CLEARPAD=y
> CONFIG_TOUCHSCREEN_CLEARPAD_I2C=y
> CONFIG_TOUCHSCREEN_CLEARPAD_RMI_DEV=y
Yes, I don't know why the Clearpad touchscreen is enabled for the C6833, but not for the C6843; I think it's just garbage (perhaps they made the togari defconfig based off honami, and corrected that when making the togari_brazil defconfig). It doesn't make any difference for me, disabling them keep the touchscreen (MAX1187) functions normal.
Well, back to the point: even when applying these differences to the ZU DooMKernel, the digital TV doesn't work. The app stays a long time in a black screen, and finally closes (FC). I investigated the kmsg and logcat, but nothing useful.
CONFIG_DVB_CORE is "m" by default. I tried insmod'ing every module in /system/lib/modules, but same result. I temporarily gave up, because I don't watch the crap they broadcast on the open TV here. But yeah, it would be good to have everything working...
Click to expand...
Click to collapse
I hadn't got around to diff'ing them I just noticed the DVB line and had a quick look at the brazil defconfig.
I guess there is a binary blob that is needed?
For some reason I have to include the clearpad stuff at the moment in the pimped kernel, I should dig to find out why so the kernel is a tad smaller.
blueether said:
I hadn't got around to diff'ing them I just noticed the DVB line and had a quick look at the brazil defconfig.
I guess there is a binary blob that is needed?
For some reason I have to include the clearpad stuff at the moment in the pimped kernel, I should dig to find out why so the kernel is a tad smaller.
Click to expand...
Click to collapse
Hmm very good insight about the binary blob... It's very possible. I have FTFs for the C6833 and C6843, I'll extract them and compare the file list.
I made it work!! Well, involves some manual steps, but it's a very good progress. I started by comparing the file listing in /system from stock C6833 and C6843 firmwares, and although there is no kernel blob, there ARE some files related to DTV, mostly dynamic libs (.so), some configuration, but most importantly, these two:
Code:
/system/bin/dtvsdserver
/system/bin/dtvserver
So, I insmod'ed every module related to DTV/DVB, and then started these guys... And the TV works! BUT, as soon as I quit the Mobile TV app, the process "dtvserver" is killed with a hangup signal, and opening the app again does not restart it, so I have to manually bring the dtvserver up first (otherwise the same previous issue happens, black screen and finally Mobile TV FC's).
I notice some DTV/DVB modules couldn't be insmod'ed:
Code:
insmod: init_module 'dib3000mc.ko' failed (No such file or directory)
insmod: init_module 'dib7000m.ko' failed (No such file or directory)
insmod: init_module 'dib7000p.ko' failed (No such file or directory)
insmod: init_module 'dib8000.ko' failed (No such file or directory)
insmod: init_module 'dib9000.ko' failed (No such file or directory)
insmod: init_module 'mpq-dmx-hw-plugin.ko' failed (No such file or directory)
insmod: init_module 'tuner-simple.ko' failed (No such file or directory)
But the modules are there, and they are the new ones... I don't get it why they can't be insmod'ed, perhaps something is missing from the kernel config? It could be one of the reasons.
Another thing I've been wondering, is why the DVB modules necessary for the Mobile TV are not loaded automatically, like the wlan module is, for instance. Perhaps a difference in the ramdisk? Something to investigate next.
dbolivar said:
I made it work!! Well, involves some manual steps...
Another thing I've been wondering, is why the DVB modules necessary for the Mobile TV are not loaded automatically, like the wlan module is, for instance. Perhaps a difference in the ramdisk? Something to investigate next.
Click to expand...
Click to collapse
Congrats on getting that far with the DTV, will make for a more complete device for the c6843 users that want to use custom ROMs
Any differences in udev or init.rc or whatever android uses?
Development using the GPL and GPL'd code
The GPL is a very powerful tool, as are the other OSS licences. One has to know how they are used and can/can't be enforced before publishing any code under these licences or modifying code that that been published under a OSS licence. Using a OSS licence brings with it risks and rewords, often these are one and the same.
When we do anything with Android [Linux] kernels we fall under the bounds of the GPL v2 that it is published under. Any modification to the kernel has to be published under the same licence, and we have to publish the newly modified source in a sate that can recreate the binary that you publish to the public/xda.
I'll leave you with this quote from http://programmers.stackexchange.com
...are you prepared to live by it, and let other people use what you've written, rather than just liking it because of what you can get out of it?
Click to expand...
Click to collapse
F2FS mount and sysfs options
Now that we have an F2FS-enabled firmware by default, I've been reading about the mount options and sysfs entries available. As many of us know, there are lots of tweaks out there for EXT4, but what about F2FS? Well, here is the official documentation from the Linux kernel:
https://www.kernel.org/doc/Documentation/filesystems/f2fs.txt
As for the mount options, I think only discard could be interesting (but it's questionable, some people say it's better to schedule a regular fstrim call instead). There are also some sysfs tunables which I think can have a noticeable impact in battery life, and performance. Testing them would require a lot of trial and error. I'm pasting them below for those who don't want to go through the full document:
Code:
================================================================================
SYSFS ENTRIES
================================================================================
Information about mounted f2f2 file systems can be found in
/sys/fs/f2fs. Each mounted filesystem will have a directory in
/sys/fs/f2fs based on its device name (i.e., /sys/fs/f2fs/sda).
The files in each per-device directory are shown in table below.
Files in /sys/fs/f2fs/<devname>
(see also Documentation/ABI/testing/sysfs-fs-f2fs)
..............................................................................
File Content
gc_max_sleep_time This tuning parameter controls the maximum sleep
time for the garbage collection thread. Time is
in milliseconds.
gc_min_sleep_time This tuning parameter controls the minimum sleep
time for the garbage collection thread. Time is
in milliseconds.
gc_no_gc_sleep_time This tuning parameter controls the default sleep
time for the garbage collection thread. Time is
in milliseconds.
gc_idle This parameter controls the selection of victim
policy for garbage collection. Setting gc_idle = 0
(default) will disable this option. Setting
gc_idle = 1 will select the Cost Benefit approach
& setting gc_idle = 2 will select the greedy aproach.
reclaim_segments This parameter controls the number of prefree
segments to be reclaimed. If the number of prefree
segments is larger than the number of segments
in the proportion to the percentage over total
volume size, f2fs tries to conduct checkpoint to
reclaim the prefree segments to free segments.
By default, 5% over total # of segments.
max_small_discards This parameter controls the number of discard
commands that consist small blocks less than 2MB.
The candidates to be discarded are cached until
checkpoint is triggered, and issued during the
checkpoint. By default, it is disabled with 0.
ipu_policy This parameter controls the policy of in-place
updates in f2fs. There are five policies:
0: F2FS_IPU_FORCE, 1: F2FS_IPU_SSR,
2: F2FS_IPU_UTIL, 3: F2FS_IPU_SSR_UTIL,
4: F2FS_IPU_DISABLE.
min_ipu_util This parameter controls the threshold to trigger
in-place-updates. The number indicates percentage
of the filesystem utilization, and used by
F2FS_IPU_UTIL and F2FS_IPU_SSR_UTIL policies.
max_victim_search This parameter controls the number of trials to
find a victim segment when conducting SSR and
cleaning operations. The default value is 4096
which covers 8GB block address range.
dir_level This parameter controls the directory level to
support large directory. If a directory has a
number of files, it can reduce the file lookup
latency by increasing this dir_level value.
Otherwise, it needs to decrease this value to
reduce the space overhead. The default value is 0.
ram_thresh This parameter controls the memory footprint used
by free nids and cached nat entries. By default,
10 is set, which indicates 10 MB / 1 GB RAM.
@blueether & @dbolivar :
our primary concern should be to get custom wlan (prima/pronto) drivers working on custom compiled kernel for stock ROMs.. once we have that there are a LOT of features which we can add!
so far I havent had much luck but you can find all my tests here
https://github.com/DooMLoRD/android_kernel_sony_msm8974/commits/testing_stock_4.3_wlan
https://github.com/DooMLoRD/android_kernel_sony_msm8974/commits/testing_stock_4.3_wlan_clean
https://github.com/DooMLoRD/android_kernel_sony_msm8974/commits/testing_z1_gpe_port_wlan
A bookmark
Worth the read @dbolivar
http://forum.xda-developers.com/showthread.php?t=2754997
DooMLoRD said:
@blueether & @dbolivar :
our primary concern should be to get custom wlan (prima/pronto) drivers working on custom compiled kernel for stock ROMs.. once we have that there are a LOT of features which we can add!
so far I havent had much luck but you can find all my tests here
https://github.com/DooMLoRD/android_kernel_sony_msm8974/commits/testing_stock_4.3_wlan
https://github.com/DooMLoRD/android_kernel_sony_msm8974/commits/testing_stock_4.3_wlan_clean
https://github.com/DooMLoRD/android_kernel_sony_msm8974/commits/testing_z1_gpe_port_wlan
Click to expand...
Click to collapse
I'm giving it a try - downloaded the latest sources from CodeAurora and applied to your kernel (adjusting Kconfigs, Makefiles and defconfig). The compilation stops here:
Code:
drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c: In function ‘wlan_hdd_send_avoid_freq_event’:
drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c:574:18: warning: assignment makes pointer from integer without a cast
error, forbidden warning: wlan_hdd_cfg80211.c:574
make[3]: *** [drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.o] Error 1
OK, so I edited wlan_hdd_cfg80211.c and changed line 574 to add an explicit cast:
Code:
vendor_event = (struct sk_buff *)cfg80211_vendor_event_alloc(pHddCtx->wiphy,
Then it passes by this point, but stops in following lines with similar errors (not even pasting here). What I noticed from these errors it that CodeAurora's sources seem to be incompatible with Sony's kernel, because for instance, the function cfg80211_vendor_event_alloc is not defined anywhere (ran a grep over all *.c and *.h files in the kernel).
Comparing with a CM11 kernel, this function is also not defined anywhere, but the prima sources are very different, they don't call it. So I thought: let's use CM11's prima sources.
Bingo!
Compiled fine, booted, and with the correspoding firmware in /system/etc/firmware/wlan/prima, WLAN came up normally after boot. :victory:
Now you mentioned something about CM11's prima sources, from what I understood they are not ideal. Is that true? Because there are CM11-based custom kernels which implement intelliplug (dependent on custom WLAN drivers), for instance.
Hope it works for you. In this case, I'll put together a more organized how-to of what I did.
dbolivar said:
I'm giving it a try - downloaded the latest sources from CodeAurora and applied to your kernel (adjusting Kconfigs, Makefiles and defconfig). The compilation stops here:
Code:
drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c: In function ‘wlan_hdd_send_avoid_freq_event’:
drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c:574:18: warning: assignment makes pointer from integer without a cast
error, forbidden warning: wlan_hdd_cfg80211.c:574
make[3]: *** [drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.o] Error 1
OK, so I edited wlan_hdd_cfg80211.c and changed line 574 to add an explicit cast:
Code:
vendor_event = (struct sk_buff *)cfg80211_vendor_event_alloc(pHddCtx->wiphy,
Then it passes by this point, but stops in following lines with similar errors (not even pasting here). What I noticed from these errors it that CodeAurora's sources seem to be incompatible with Sony's kernel, because for instance, the function cfg80211_vendor_event_alloc is not defined anywhere (ran a grep over all *.c and *.h files in the kernel).
Comparing with a CM11 kernel, this function is also not defined anywhere, but the prima sources are very different, they don't call it. So I thought: let's use CM11's prima sources.
Bingo!
Compiled fine, booted, and with the correspoding firmware in /system/etc/firmware/wlan/prima, WLAN came up normally after boot. :victory:
Now you mentioned something about CM11's prima sources, from what I understood they are not ideal. Is that true? Because there are CM11-based custom kernels which implement intelliplug (dependent on custom WLAN drivers), for instance.
Hope it works for you. In this case, I'll put together a more organized how-to of what I did.
Click to expand...
Click to collapse
great!
can you just fork my repo and shift to the branch which worked for you, then send pull request? i will investigate on the Z1...
and yes please do send the steps!
well if we get custom compiled WLAN modules properly working on custom compiled kernel for stock ROM then i can have features like intelli-plug, F2FS, AsyncFS and lots more on stock ROMs!
DooMLoRD said:
great!
can you just fork my repo and shift to the branch which worked for you, then send pull request? i will investigate on the Z1...
and yes please do send the steps!
well if we get custom compiled WLAN modules properly working on custom compiled kernel for stock ROM then i can have features like intelli-plug, F2FS, AsyncFS and lots more on stock ROMs!
Click to expand...
Click to collapse
Well I'm still learning my way around git & GitHub, so I think it will be faster if you just reproduce the steps below:
1) Copy Prima WLAN sources from CM11-based kernel:
I copied from SlimRom's kernel source. Put the sources under drivers/staging/prima.
2) Modify related Kconfig and Makefile:
drivers/staging/Kconfig
Code:
131,132d130
< source "drivers/staging/prima/Kconfig"
<
drivers/staging/Makefile
Code:
58,59d57
< obj-$(CONFIG_PRIMA_WLAN) += prima/
< obj-$(CONFIG_PRONTO_WLAN) += prima/
3) Modify defconfig:
I'm pasting every option related to WLAN. The Prima options should appear after a "make menuconfig".
Code:
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211=y
CONFIG_NL80211_TESTMODE=y
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_REG_DEBUG is not set
CONFIG_CFG80211_DEFAULT_PS=y
# CONFIG_CFG80211_DEBUGFS is not set
CONFIG_CFG80211_INTERNAL_REGDB=y
# CONFIG_CFG80211_WEXT is not set
# CONFIG_WIRELESS_EXT_SYSFS is not set
# CONFIG_LIB80211 is not set
# CONFIG_CFG80211_ALLOW_RECONNECT is not set
# CONFIG_MAC80211 is not set
# CONFIG_WIMAX is not set
CONFIG_RFKILL=y
CONFIG_RFKILL_PM=y
CONFIG_RFKILL_LEDS=y
# CONFIG_RFKILL_INPUT is not set
# CONFIG_RFKILL_REGULATOR is not set
# CONFIG_RFKILL_GPIO is not set
...
# CONFIG_WIFI_CONTROL_FUNC is not set
...
CONFIG_WLAN=y
# CONFIG_USB_ZD1201 is not set
# CONFIG_USB_NET_RNDIS_WLAN is not set
# CONFIG_LIBRA_SDIOIF is not set
# CONFIG_ATH6K_LEGACY_EXT is not set
CONFIG_WCNSS_CORE=y
CONFIG_WCNSS_CORE_PRONTO=y
CONFIG_WCNSS_MEM_PRE_ALLOC=y
CONFIG_WCNSS_REGISTER_DUMP_ON_BITE=y
# CONFIG_ATH_COMMON is not set
# CONFIG_BCMDHD is not set
# CONFIG_BRCMFMAC is not set
# CONFIG_HOSTAP is not set
# CONFIG_IWM is not set
# CONFIG_LIBERTAS is not set
# CONFIG_MWIFIEX is not set
...
#
# Qualcomm Atheros Prima WLAN module
#
CONFIG_PRIMA_WLAN=m
CONFIG_PRONTO_WLAN=y
# CONFIG_PRIMA_WLAN_BTAMP is not set
CONFIG_PRIMA_WLAN_LFR=y
CONFIG_PRIMA_WLAN_OKC=y
CONFIG_PRIMA_WLAN_11AC_HIGH_TP=y
CONFIG_WLAN_FEATURE_11W=y
CONFIG_QCOM_VOWIFI_11R=y
CONFIG_CONFIG_ENABLE_LINUX_REG=y
4) Include Prima WLAN firmware in kernel ZIP file:
Copy from a CM11-based firmware (I used PAC-Rom). Remember to set permissions as 644.
/system/etc/firmware/wlan/prima
Code:
WCNSS_cfg.dat
WCNSS_qcom_cfg.ini
WCNSS_qcom_wlan_nv.bin
5) Include wlan.ko in kernel ZIP file:
Actually I include every compiled kernel module, because we are using a different toolchain and they may benefit from it too. Remember that /system/lib/module/wlan.ko is a symlink, but in my test the target got updated accordingly.
dbolivar said:
Well I'm still learning my way around git & GitHub, so I think it will be faster if you just reproduce the steps below:
1) Copy Prima WLAN sources from CM11-based kernel:
I copied from SlimRom's kernel source. Put the sources under drivers/staging/prima.
2) Modify related Kconfig and Makefile:
drivers/staging/Kconfig
Code:
131,132d130
< source "drivers/staging/prima/Kconfig"
<
drivers/staging/Makefile
Code:
58,59d57
< obj-$(CONFIG_PRIMA_WLAN) += prima/
< obj-$(CONFIG_PRONTO_WLAN) += prima/
3) Modify defconfig:
I'm pasting every option related to WLAN. The Prima options should appear after a "make menuconfig".
Code:
CONFIG_WIRELESS=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211=y
CONFIG_NL80211_TESTMODE=y
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_REG_DEBUG is not set
CONFIG_CFG80211_DEFAULT_PS=y
# CONFIG_CFG80211_DEBUGFS is not set
CONFIG_CFG80211_INTERNAL_REGDB=y
# CONFIG_CFG80211_WEXT is not set
# CONFIG_WIRELESS_EXT_SYSFS is not set
# CONFIG_LIB80211 is not set
# CONFIG_CFG80211_ALLOW_RECONNECT is not set
# CONFIG_MAC80211 is not set
# CONFIG_WIMAX is not set
CONFIG_RFKILL=y
CONFIG_RFKILL_PM=y
CONFIG_RFKILL_LEDS=y
# CONFIG_RFKILL_INPUT is not set
# CONFIG_RFKILL_REGULATOR is not set
# CONFIG_RFKILL_GPIO is not set
...
# CONFIG_WIFI_CONTROL_FUNC is not set
...
CONFIG_WLAN=y
# CONFIG_USB_ZD1201 is not set
# CONFIG_USB_NET_RNDIS_WLAN is not set
# CONFIG_LIBRA_SDIOIF is not set
# CONFIG_ATH6K_LEGACY_EXT is not set
CONFIG_WCNSS_CORE=y
CONFIG_WCNSS_CORE_PRONTO=y
CONFIG_WCNSS_MEM_PRE_ALLOC=y
CONFIG_WCNSS_REGISTER_DUMP_ON_BITE=y
# CONFIG_ATH_COMMON is not set
# CONFIG_BCMDHD is not set
# CONFIG_BRCMFMAC is not set
# CONFIG_HOSTAP is not set
# CONFIG_IWM is not set
# CONFIG_LIBERTAS is not set
# CONFIG_MWIFIEX is not set
...
#
# Qualcomm Atheros Prima WLAN module
#
CONFIG_PRIMA_WLAN=m
CONFIG_PRONTO_WLAN=y
# CONFIG_PRIMA_WLAN_BTAMP is not set
CONFIG_PRIMA_WLAN_LFR=y
CONFIG_PRIMA_WLAN_OKC=y
CONFIG_PRIMA_WLAN_11AC_HIGH_TP=y
CONFIG_WLAN_FEATURE_11W=y
CONFIG_QCOM_VOWIFI_11R=y
CONFIG_CONFIG_ENABLE_LINUX_REG=y
4) Include Prima WLAN firmware in kernel ZIP file:
Copy from a CM11-based firmware (I used PAC-Rom). Remember to set permissions as 644.
/system/etc/firmware/wlan/prima
Code:
WCNSS_cfg.dat
WCNSS_qcom_cfg.ini
WCNSS_qcom_wlan_nv.bin
5) Include wlan.ko in kernel ZIP file:
Actually I include every compiled kernel module, because we are using a different toolchain and they may benefit from it too. Remember that /system/lib/module/wlan.ko is a symlink, but in my test the target got updated accordingly.
Click to expand...
Click to collapse
which branch did u test this with?
also can you please upload the correct firmware (/system/etc/firmware/wlan/prima) which worked for you?
DooMLoRD said:
which branch did u test this with?
also can you please upload the correct firmware (/system/etc/firmware/wlan/prima) which worked for you?
Click to expand...
Click to collapse
The branch from your kernel was master_kk-4.4.2. The Prima WLAN sources were, as I mentioned, from SlimRom's kernel, branch kk4.4.
I'm attaching the firmware to this post.
blueether said:
A bookmark
Worth the read @dbolivar
http://forum.xda-developers.com/showthread.php?t=2754997
Click to expand...
Click to collapse
Wow this is very nice! Follows the same line of research I've been doing, but this is more "elegant" and in-depth, especially because of all the benchmarks and other comparisons he has done. I'll try this approach myself on my custom builds.
One thing I noticed is that we may still have to use the "hammer" approach with the find & replace of the "-O" flags in *.mk and Makefiles I've been doing, because some of them have these flags hardcoded (i.e. they don't take the value from core/combo/TARGET_linux-arm.mk or other base files). I'll tip JustArchi in his thread about it.
Hi guys, I posted this in the general android section and have had no answer, maybe some one here might know?
I'm trying to build AOSP using CM 11's device tree for togari/togari_gpe and have hit a brick wall after solving the first few make errors.
I have to errors, that I suspect are the same problem:
The first is if I just build with make I get this error:
Code:
Import includes file: out/target/product/togari/obj/SHARED_LIBRARIES/copybit.msm8974_intermediates/import_includes
Import includes file: out/target/product/togari/obj/SHARED_LIBRARIES/libmemalloc_intermediates/import_includes
target thumb C++: libqdutils <= hardware/qcom/display/msm8974/libqdutils/profiler.cpp
target thumb C++: libqdutils <= hardware/qcom/display/msm8974/libqdutils/mdp_version.cpp
target thumb C++: libqdutils <= hardware/qcom/display/msm8974/libqdutils/idle_invalidator.cpp
target thumb C++: libqdutils <= hardware/qcom/display/msm8974/libqdutils/comptype.cpp
hardware/qcom/display/msm8974/libqdutils/mdp_version.cpp:33:27: fatal error: linux/msm_mdp.h: No such file or directory
#include <linux/msm_mdp.h>
^
Import includes file: out/target/product/togari/obj/SHARED_LIBRARIES/gps.msm8974_intermediates/import_includes
compilation terminated.
make: *** [out/target/product/togari/obj/SHARED_LIBRARIES/libqdutils_intermediates/mdp_version.o] Error 1
make: *** Waiting for unfinished jobs....
and if I do make bootimage I get this:
Code:
make: *** No rule to make target `out/target/product/togari/kernel', needed by `out/target/product/togari/boot.img'. Stop.
I suspect that both stem from aosp not finding the kernel source?
kernel source is at ~/dev/aosp/kernel/sony/msm8974/ and I'm building in ~/dev/aosp
I'm also trying to build vanir aosp using the same device tree and kernel and make bootimage completes fine.
Any help would be great
Yo, @DooMLoRD, @blueether @dbolivar
You guys have probably registred that Geohot (iPhone, PS3 jailbreaker) has successfully rooted the Galaxy S5 (and can now claim the $18,000 bounty), but i just read that this one-click root tool should work on any device running a pre-June 3rd kernel, i.e Android 4.4.2. The question is, does it work on the Ultra? I'm aware that it's easy to root an UItra AS LONG as the bootloader is unlocked, but this thing circumvents that part, and roots it. I think.
Are there anyone here still left on 4.4.2 that can try?
More here: Click
LordManhattan said:
Yo, @DooMLoRD, @blueether @dbolivar
You guys have probably registred that Geohot (iPhone, PS3 jailbreaker) has successfully rooted the Galaxy S5 (and can now claim the $18,000 bounty), but i just read that this one-click root tool should work on any device running a pre-June 3rd kernel, i.e Android 4.4.2. The question is, does it work on the Ultra? I'm aware that it's easy to root an UItra AS LONG as the bootloader is unlocked, but this thing circumvents that part, and roots it. I think.
Are there anyone here still left on 4.4.2 that can try?
More here: Click
Click to expand...
Click to collapse
Can't say... Will have to test
Sent from my C6902 using XDA Free mobile app
DooMLoRD said:
Can't say... Will have to test
Sent from my C6902 using XDA Free mobile app
Click to expand...
Click to collapse
I made a thread here. It should work.
http://forum.xda-developers.com/showthread.php?t=2783982

[REFERENCE] My experience building the Tucana kernel & Rom

Little info on what this all is.
If you are expecting a working kernel or rom after reading this all. That is not what this thread is.
What this all is intended for is material to help with getting you to the next step, if you are at a road block.
What will you gain from all this?
A fair bit of knowledge on working with msm-4.14 kernel and maybe others.
Make sure to have your search bar ready with a piece of the issue (key word of the error will do) and go through the hidden tabs until you pick up your error, with the browser search function (ctrl+f on most browsers)
Spoiler: OLD info
Method I used for building the kernel
1. Dowload AOSP common-kernel-4.14 through git
OR
ANDROID 10 Specific
refs/heads/q-common-android-4.14 - kernel/manifest - Git at Google
2. Download Xiaomi TUCANA-Q-SOURCE for android 10 source code from MiCode git.
ALL VARIANTS
GitHub - MiCode/Xiaomi_Kernel_OpenSource: Xiaomi Mobile Phone Kernel OpenSource
Xiaomi Mobile Phone Kernel OpenSource. Contribute to MiCode/Xiaomi_Kernel_OpenSource development by creating an account on GitHub.
github.com
**OR**
TUCANA Android 10
GitHub - MiCode/Xiaomi_Kernel_OpenSource at tucana-q-oss
Xiaomi Mobile Phone Kernel OpenSource. Contribute to MiCode/Xiaomi_Kernel_OpenSource development by creating an account on GitHub.
github.com
3. extract if you did not use git to download sources.
You will need AOSP 10 R29 downloaded. R29 Matches Stock MIUI 12.0.4
4. mkdir kernelbuild (can be what ever) then extract both AOSP KERNEL (git) ,build, common, kernel, prebuilts, master-prebuilts folders to the kernelbuild folder.
5. just use TUCANA source and don't merge with AOSP common source. Don't delete common either
4. copy AOSP kernel folder (contains 4.14) to TUCANA source and merge (Still not sure if you need to do this)
5. make sure you have AOSP-10 from git already. If not, repo it.
6. Go to AOSP-10 REPO>prebuilts>gcc>linux-x86>aarch64 location and get (aarch64-linux-android-4.9) folder and copy it to root Tucana source files folder make a directory call toolchain TUCANA source. in prebuilts>gcc>linux-x86>aarch64 folder replace and merge all
7. Not sure if this is outdated but got the export info from MSM section at https://github.com/MiCode/Xiaomi_Kernel_OpenSource/wiki/How-to-compile-kernel-standalone
e.g.
export CROSS_COMPILE=/<toolchain-location/prebuilts>GCC>/bin/aarch64-linux-android-
mkdir out
cd out
Taken from mi code section for MSM 4.14
export ARCH=arm64
export SUBARCH=arm64
export DTC_EXT=dtc
Set CONFIG_BUILD_ARM64_DT_OVERLAY=y
(does not work from what i can tell. Have to enable using menuconfig)
if not inside the "out" folder use O=out on next command, will also have to type cd ../ to go back in source if using this command.
(-jN (N is for a number))
make -jN tucana_user_defconfig
make menuconfig (configure config to your liking)
use save button (highlight save and press enter, can use arrow key right and left as well)
make -jN
Or it could be
make -jN ARCH=arm64
After doing all this, for me the build fails. Its driving me insane!
I think I also was using the wrong AOSP kernel, was using common-4.14 and now using this one
refs/heads/q-common-android-4.14 - kernel/manifest - Git at Google
guessing the Q is for Android 10
MY DEMON!!!!!
1615228944041.png
i think it is not working because i am using Android 10 R41 and should be using Android 10 R29. Testing it now.
Alright, went from ubuntu version 20 to 18 (Bionic is more reliable and easier to set up).
Had 20, due to bionic auto updated (my own fault).
Version 20 does work with some modding and adding bionic to the repo's of ubuntu.
I tried using AOSP toolchain and also Qualcomm's (QQ-LLV) LLV toolchain 8.0 for clang.
The part from MiCode wiki on github is saying to use CLANG_Triple with aarch64-linux-gnu which I can not find this file anywhere.
Not in QQ-LLV, AOSP-10-R29 aarch64 that is located in prebuilts > gcc
so the main problem I am getting is the cpu timer failing, during the build process. I try to modify the config by typing "make menuconfig" and then change the cpu govern type from performance to ondemand and saving it as .config (not sure if it is supposed to be the same name as the tucana-user-defconfig, let me know if this is the problem)
the AOSP android version I am using is R29. The AOSP kernel I am using is common-4.14
none of these files have aarch64-linux-gnu.
I am starting to slowly give up on this whole thing. spent 7 days just to get a cpu timer problem during build.
Oh and the source i am using is from Micode github under tucana for android 10 (Q)
Just sprung up an idea. I think i am supposed to first use Qualcomms LLVM toolchain 8.0 with the Mi source code package to make up the files needed in order to use anything from AOSP. please let me know if this is correct.
No matter what guide i find for it, it shows CLANG_TRIPLE=aarch64-linux-gnu- and every time. it just can not find it. no idea how to get this.
it work in clang triple for -gnu
AOSP-Q-Kernel-4.14.117
refs/heads/q-common-android-4.14 - kernel/manifest - Git at Google
Spoiler: Kbuild config
ARCH=arm64
SUBARCH=arm64
BRANCH=android-4.14
CLANG_TRIPLE=aarch64-linux-gnu-
CROSS_COMPILE=aarch64-linux-android-
DEFCONFIG=tucana_user_defconfig
KERNEL_DIR=xsource
DTC_EXT=dtc
DTS_EXT=dts
CC=clang
LZ4_RAMDISK=1
POST_DEFCONFIG_CMDS=""
EXTRA_CMDS=''
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r353983c/bin
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
REAL_CC=prebuilts/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang
BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
FILES="
O=/out
arch/arm64/boot/Image.gz
vmlinux
System.map
"
STOP_SHIP_TRACEPRINTK=1
OMFG!!!!!!! VICTORY!!!!!!!!
I think.
1615380568663.png
MAYBE!!!!!
1615380671546.png
Spoiler: New info
Alright Managed to fix most of the problems in the OLD area, mostly due to path issues, always check your paths (PATH).
Spoiler: build.config
ARCH=arm64
SUBARCH=arm64
BRANCH=K4.14Q
CLANG_TRIPLE=aarch64-linux-gnu-
CROSS_COMPILE=~/android/xkernel/tsource/toolchains/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
CROSS_COMPILE_ARM32=~/android/xkernel/tsource/toolchains/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-
KBUILD_DEFCONFIG=~/android/xkernel/tsource/arch/arm64/configs/tucana_user_defconfig
DEFCONFIG=tucana_user_defconfig
POST_DEFCONFIG_CMDS="check_defconfig"
DTC_EXT=dtc
DTC_PREBUILTS_BIN=/scripts/dtc
KBUILD_OUTPUT=out
HOSTCC=gcc
CC=clang
AS=clang
AR=ar
CLANG_PREBUILT_BIN=/toolchains/clang/host/linux-x86/clang-r353983c/bin
BUILDTOOLS_PREBUILT_BIN=/toolchains/build-tools/linux-x86/bin
FILES="
arch/arm64/boot/Image.gz
vmlinux
System.map
"
Don't know if most of what is in there is needed or if everything I need is there but that is what i have so far.
One thing that i know always does not work is the check_defconfig. fails to match every time.
Tried using ld.ldd and it just keeps saying the vmlinux file size is too large. I have not given up and can say i have learned a lot.
Will update more as I go.
Spoiler: Links
Toolchain and kbuild config help
Hello I have been trying to extract the kernel from Tucana android 10 source. I would like to know if anyone has a working config to be able to build up the kernel. I have a config but it does not extract everything, well I don't think it does...
forum.xda-developers.com
[SOLVED] dts not found
Hello. Been working on how to get a device kernel from source for the Mi note 10 pro (Mi CC9 Pro). I have gotten up to the point where it builds but fails due to dts folder is not found. I need an example of what goes in DTC_EXT= All I see on...
forum.xda-developers.com
Spoiler: UPDATE 2022 WORKING BUILD WITH ISSUES
Alright I decided to give it another shot in 2022 because of getting replies.
1. Get your source from device brand. (https://github.com/MiCode/Xiaomi_Kernel_OpenSource)
2. Use Mi code wiki to learn how to build (https://github.com/MiCode/Xiaomi_Kernel_OpenSource/wiki)
3. Go right hand side for standalone kernel. Because the how to section just waste hours on end with nothing built and Soong and clang errors.
4. Follow msm-4.14 for a guide. (https://github.com/MiCode/Xiaomi_Kernel_OpenSource/wiki/How-to-compile-kernel-standalone)
5. Make sure to have dtc binary file from aosp source (https://android.googlesource.com/platform/prebuilts/misc/) choose your android version. Check device for android version. Can use CPU ID in playstore under System, section API LEVEL.
6. Get llvm Snapdragon from Qualcomm. (https://developer.qualcomm.com/software/snapdragon-llvm-compiler-android) I used both but you should be able to use 8.0. both have off same results during the build process.
7. Get Aosp gcc
(https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/)
8. Put LLVM Snapdragon toolchain and AOSP gcc into a folder in root of kernel folder called toolchain.
9. Run the script mi provided. Change the 6.0 on the last 2 make commands to 8.0 unless you are already using 6.0, then you can leave it at 6.0.
10. Build.
11. Get a boot.img extractor from github or on these forums. I can't recommend one yet, due to not having full success. Can search boot.img extractor or boot.img unpacked as seperate search terms.
**Recommendation**
Boot and Recovery
GitHub - xiaolu/mkbootimg_tools: Unpack and repack boot.img,support dtb(dt.img).
Unpack and repack boot.img,support dtb(dt.img). Contribute to xiaolu/mkbootimg_tools development by creating an account on GitHub.
github.com
OR
Android Kitchen
GitHub - osm0sis/Android-Image-Kitchen: Automated scripts to unpack/repack Android kernel/recovery images + ramdisks
Automated scripts to unpack/repack Android kernel/recovery images + ramdisks - GitHub - osm0sis/Android-Image-Kitchen: Automated scripts to unpack/repack Android kernel/recovery images + ramdisks
github.com
OR
Android Kitchen
GitHub - cfig/Android_boot_image_editor: Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 13
Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 13 - GitHub - cfig/Android_boot_image_editor: Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supp...
github.com
12. Extract boot.img from stock rom.
13. Put image.gz.dtb in unpacked boot image. Delete original file and rename new one as the same name.
14. Repack boot.img and either upload using fastboot or use twrp to install the boot.img
The problem I have at the moment is I am unable to use touch input at all. It boots loads system but can't touch anything. No input at all. Hardware buttons work though.
Might be solution on 3rd post to no touch input. https://forum.xda-developers.com/t/reference-how-to-compile-an-android-kernel.3627297/page-43
VMLINUX FIX: HERE
Hi @Squida, I've also been on this road, I just hit a milestone when I actually have something booting (but not much working), see the thread I started if it works for you too
b100dian said:
Hi @Squida, I've also been on this road, I just hit a milestone when I actually have something booting (but not much working), see the thread I started if it works for you too
Click to expand...
Click to collapse
Spoiler: Reply
Hey mate, thanks for the reply. Could you put a link to your thread so I can check it out.
Found it: https://forum.xda-developers.com/t/building-lineageos-17-1-from-source.4245417/
I also have posted on Qualcomm forums.
LINK: https://developer.qualcomm.com/forum/qdn-forums/software/snapdragon-llvm-compiler-android/68403
I found out qcomm has its own builder for msm devices. It's known as QAEP. I have been trying to build the sm6150 with Tucana defconfig. The thread above is the issue I have in trying to build it. No idea how to get "SDClang" so as soon as I work that out. It should build with QAEP instead of using AOSP.
There's a commit where I add SDCLANG support (but I don't think that's needed, is backed out atm) https://github.com/alibei/android_d...mmit/efbb3c66aa0d385e58052675402489c13392576e )There's a similar commit in the kernel.
You need to register to Qualcomm to download it, and unzip it in kernel/toolchains, just as https://github.com/MiCode/Xiaomi_Kernel_OpenSource/wiki/How-to-compile-kernel-standalone says under "You must get llvm clang from qcom". You just have to get the 8.x version.
Some snippets for the commands I've tried https://gist.github.com/b100dian/40c8dbe746ff181aff71ee10a75a5f3c
Spoiler: Reply
Yeah I am not trying to use Lineage sources. so far steps I have taken are as follows.
1. Mi source code download of Tucana android 10, data source, wifi source, audio source.
2. Extracted Mi tucana source in a directory (also tried the git way to update CAF tags).
3. using AOSP as the source for build. I tried using Clang with cross compile with gcc (GNU)
4. with using all AOSP toolchains so clang and gcc from AOSP and then using LLVM clang as reall cc, due to it does not contain clang itself.
all that for kernel and it builds but I feel its missing drivers. due to the warnings that Qcom gives. also got wifi modules installed but not audio. Audio source is a little different then the wifi source.
For the proprietary binaries. I used lineage Extract script with the lineage 17.1 tucana proprietary-files.txt list.
extraction worked on miui_TUCANAGlobal_V12.0.4.0.QFDMIXM_be49be8fa0_10.0.zip.
but of course the device tree is missing, found the platform sm6150 device tree on QAEP. so now trying to use QAEP to build not only the kernel but the rom as well using QAEP instead of AOSP. think we need to use QAEP, then using the files built. can then move over to aosp for upgrading, etc.
Could you explain this error considering you managed to get SDClang working. it may solve my problem. error provided below.
Spoiler: sdclang error
I have a SDCLANG_PATH set in BoardConfig.mk in the commit I pointed to earlier.
Basically is from a toolchains folder creaded with `tar -xvzf snapdragon-llvm-8.0.6-linux64.tar.gz` in the kernel/xiaomi/tucana folder
b100dian said:
I have a SDCLANG_PATH set in BoardConfig.mk in the commit I pointed to earlier.
Basically is from a toolchains folder creaded with `tar -xvzf snapdragon-llvm-8.0.6-linux64.tar.gz` in the kernel/xiaomi/tucana folder
Click to expand...
Click to collapse
what i have setup in boardconfig is as follows.
ifneq ($(HOST_OS),linux)
SDCLANG := true
SDCLANG_PATH := toolchain/ndk/android-ndk-r22/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin
SDCLANG_LTO_DEFS := device/qcom/common/sdllvm-lto-defs.mk
endif
this has been added just above wifi. still fails with same error.
Spoiler: Boardconfig.mk
Image:
I think I just solved it, so i noticed you talk about Boardconfig.mk and when i checked out your git code, it had in the same config the target. well QAEP is a little different it not only has a Boardconfig file but also a AndroidBoard config file. so i think i am supposed to be adding it in there instead of Boardconfig. testing it now.
Spoiler: AndroidBoard.mk
Something else i also noticed that is not working.
Spoiler: .ko files missing
And can confirm above configuration changes are not working, not sure where it is located to tell it the path.
I cannot speak for QAEP (I barely began reading about lineage but in my case I don't have out/target/product/sm6150 at all, only out/target/product/tucana, which seems to be the name of the kernel (or device or vendor). Do you also have other repos pulled in that contain kernel named sm6150? Like https://github.com/LineageOS/android_kernel_xiaomi_sm6150 Maybe you should not have both
b100dian said:
I cannot speak for QAEP (I barely began reading about lineage but in my case I don't have out/target/product/sm6150 at all, only out/target/product/tucana, which seems to be the name of the kernel (or device or vendor). Do you also have other repos pulled in that contain kernel named sm6150? Like https://github.com/LineageOS/android_kernel_xiaomi_sm6150 Maybe you should not have both
Click to expand...
Click to collapse
Spoiler: b100dian reply
So where yours is out/target/product/tucana, the one for QAEP is SM6150 which is in the same location. so I think maybe on the right track here. also thanks for the help for llvm dragon, had to set bin path, for it to work. but i have not gone a built the rom yet, doing the kernel build first now.
Instead of relying on QAEP builder. I went and got kernel/build from code-aurora for android 10 r40 and ended up getting misc linux folder in kernel also gcc and build tools from the device tag release repo on codeaurora.
Usually i was using AOSP but now switched over to all QAEP tools and sources.
I am testing the Micode Audio and wifi source. got wifi working during kernel build by adding this below.
EXT_MODULES="
mods/wlan/qcacld-3.0
"
IN_KERNEL_MODULES=1
I believe that installs the wifi drivers for the device as a module. but building with clang, gcc and gnu as clang tripple this is all related to only kernel building.
Spoiler: Update
Done an overhaul on everything for the kernel. decided to switch from QAEP to AOSP.
Reason for the switch, I noticed with AOSP I am able to not only download the kernel/msm4.14 common folder but it also downloads build, prebuilts, prebuilts-master folders with everything included.
Differences aside from what I mentioned above.
AOSP common-4.14 comes with up to date builder, gcc, clang, etc. But when I download the release tag for example, LA.UM.9.1.r1-06700-SMxxx0.0 at codeaurora on the otherhand, it only downloads the common folder and no extra folders for it.
So then in turn. you have to go on codeaurora and download by using git clone, the build folder for what ever android version it is. for example, I had android version 29 (r29) though it does not exist in the branch list on codeaurora so i went with 28.
I should also note that making the change from QAEP to AOSP I started again with the kernel source.
With making the change, I have noticed improvements right away, but also I noticed that having CC=clang, the build would not work untill I also put in HOSTCC=gcc. guessing its to do with the AOSP version being a little different. still using QualComms LLVM clang compiler for everything clang related.
Spoiler: Problems I have so far.
***Error-1***
Have it building but get this spam, been trying to solve it.
***Error-2***
This error pops up when using LD=ld.lld
this is what is set in the build.config
***CONFIG-1***
LD=ld.lld
LD_LIBRARY_PATH=toolchain/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/lib/clang/8.0.6/lib/linux/aarch64:$LD_LIBRARY_PATH
export O=out/android-4.14 LD_LIBRARY_PATH
**RESULTS**
***CONFIG-2***
LD=ld.lld
HOSTLDFLAGS="-fuse-ld=lld" (added it so i can modify)
LD_LIBRARY_PATH=toolchain/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/lib/clang/8.0.6/lib:$LD_LIBRARY_PATH
export O=out/android-4.14 LD_LIBRARY_PATH
**RESULTS**
Same as above.
Spoiler: Config commands
This right here may have just solved all my problems. can confirm in all my config tries. Never once thought to put aarch64-linux-android before all variable values.
SOURCE: https://developer.android.com/ndk/guides/standalone_toolchain
# Tell configure what tools to use.
target_host=aarch64-linux-android
export AR=$target_host-ar
export AS=$target_host-clang
export CC=$target_host-clang
export CXX=$target_host-clang++
export LD=$target_host-ld
export STRIP=$target_host-strip
Also discovered that LD=ld.lld is for clang compiler. could be why the above Problem is happening.
This is using the toolschains without NDK, may have to put qualcomm and gcc in NDK and path them.
So after trying to downgrade to android 10 from 11, had no luck in doing so.
So now sticking with android 11 and I can safely say that I have reached a mile stone.
I ended up downloading android 11 R30 and using all the tool chains from AOSP while still using Qualcomm's LLVM compiler 8.0.6 as REAL_CC. But the clang pre-built path is clang from AOSP. Just trying to work out how to include the Xiaomi audio source. Unable to work out where to put it. Still testing, have not given up.
Hi @Squida, where is `mods/wlan/qcacld-3.0` from, the qcom talos referenced above in BoardConfig.mk?
Do you have an exact link to the repo?
In the meantime I can confirm I am missing something form the kernel. If I build everything myself and replace _just_ the kernel (with my dtb appended etc) it has sound/wireless, so knowing what wifi / audio module to link in seems the way to go.
b100dian said:
Hi @Squida, where is `mods/wlan/qcacld-3.0` from, the qcom talos referenced above in BoardConfig.mk?
Do you have an exact link to the repo?
In the meantime I can confirm I am missing something form the kernel. If I build everything myself and replace _just_ the kernel (with my dtb appended etc) it has sound/wireless, so knowing what wifi / audio module to link in seems the way to go.
Click to expand...
Click to collapse
Spoiler: Reply
No problem at all, anything to get this build done lol.
All links are for Android 11
If you want Android 10, replace pheonix-r-oss with tucana-q-oss
**Example for Android 10**
GitHub - MiCode/Xiaomi_Kernel_OpenSource at tucana-q-oss
Xiaomi Mobile Phone Kernel OpenSource. Contribute to MiCode/Xiaomi_Kernel_OpenSource development by creating an account on GitHub.
github.com
******ANDROID 11******
***SOURCE***
GitHub - MiCode/Xiaomi_Kernel_OpenSource at phoenix-r-oss
Xiaomi Mobile Phone Kernel OpenSource. Contribute to MiCode/Xiaomi_Kernel_OpenSource development by creating an account on GitHub.
github.com
***DATA***
GitHub - MiCode/vendor_qcom_opensource_data-kernel at phoenix-r-oss
xiaomi opensource for data-kernel. Contribute to MiCode/vendor_qcom_opensource_data-kernel development by creating an account on GitHub.
github.com
***AUDIO***
GitHub - MiCode/vendor_qcom_opensource_audio-kernel at phoenix-r-oss
Contribute to MiCode/vendor_qcom_opensource_audio-kernel development by creating an account on GitHub.
github.com
***WIFI (mods/wlan/qcacld-3.0)***
MiCode/vendor_qcom_opensource_wlan
Contribute to MiCode/vendor_qcom_opensource_wlan development by creating an account on GitHub.
github.com
Thanks, I think I get now what you're saying with 'talos', I poked at those repos now.
It seems to me the modules are built out of tree, as they don't appear in the extracted kernel config. (See https://github.com/b100dian/Xiaomi_Kernel_OpenSource/commit/0f4b062ef806aaad6ad02e2efd87809e8b7250c6).
Also, having dlkm from https://source.codeaurora.org/quic/la/device/qcom/common/tree/?h=LA.UM.8.9.r1-03800-sm6150.0 does not seem to help automate the build, I get all sorts of errors when AndroidKernelModule.mk is included and it includes back the AndroidKernel.mk..
Getting these into drivers/staging seems easier at first but..for now, I've only managed to build wlan.ko but that still errors out with `wlan: disagrees about version of symbol module_layout` :-S
b100dian said:
Spoiler: Reply
Thanks, I think I get now what you're saying with 'talos', I poked at those repos now.
It seems to me the modules are built out of tree, as they don't appear in the extracted kernel config. (See https://github.com/b100dian/Xiaomi_Kernel_OpenSource/commit/0f4b062ef806aaad6ad02e2efd87809e8b7250c6).
Also, having dlkm from https://source.codeaurora.org/quic/la/device/qcom/common/tree/?h=LA.UM.8.9.r1-03800-sm6150.0 does not seem to help automate the build, I get all sorts of errors when AndroidKernelModule.mk is included and it includes back the AndroidKernel.mk..
Getting these into drivers/staging seems easier at first but..for now, I've only managed to build wlan.ko but that still errors out with `wlan: disagrees about version of symbol module_layout` :-S
Click to expand...
Click to collapse
Spoiler: Reply
It seems you are having a similar issue.
When doing everything I have done so far, The biggest wall for me is getting <LD=LD.lld> to work properly, I either get clang error with a file having a linking problem with using clang from QQ llvm compiler. And when I switch over to using AOSP's 4.14 stable kernel prebuilts-master clang. It works but then another error to do with CPU timer pops up. Which was originally because of using gcc instead of clang in the CC=clang environment variable, or removing it out of the build.config file.
i myself did a major overhaul of Ubuntu and have upgraded to LTS 20.04 from 18 bionic.
Noticed some things right away.
When you install gcc-multilib and g++-multilib. You get version 9 instead of you being on Ubuntu bionic and getting version 7. Also faster in general with general use of the operating system using Oracle vmbox. On windows 10.
Apart from linking errors, kernel is buding but only with not having LD=LD.lld in the build.config file.
Spoiler: wifi-info
And for the wifi qcom. Mods folder I added manually. Inside the devices source folder. Then copied WLAN sources inside and renamed the folder to just WLAN.
Spoiler: where I am at now
I have got both android 11 and android 10 kernel and ROMs. Also went and downloaded the kernel for coral. That's how I found out about the wifi and how I got a lot of the settings for the build.config.
I am gonna have a break on this whole thing, gotten to a point where with android 11 Xiaomi Phoenix. I get one error with a file in kbuild, using the same config settings for android 10. I get none. Apart from the qcom space which is either DTC not working or failing at some point. Not sure if we need to use LD=LD.lld I have been reading it is not needed due to the builder choosing the correct one for you.
Overall though it builds. Just the spam for qcom warnings I just can not get rid of and it's to do with the sensors.
If anyone has information on what causes the qcom spam. Please let me know, thank you.
Plus this all started with vmlinux not working right. Something to do with channel scratch. Can not fix it.
Spoiler: My Thoughts
I have just found this exploring info on the rom.
Build AOSP with LineageOS device tree
My device (Xiaomi Redmi Note 5, whyred) have official LineageOS support and therefore there is device tree and kernel. I want to build AOSP without any modifications or tweaks. How can I use (or po...
stackoverflow.com
Key part taken from above link.
**Its hard to build pure AOSP than other ROMs. While building a custom ROM a lot of components wont work**
I think for our devices we have no choice but to use QAEP instead of AOSP, it explains why it fails to build properly. we first need a full working rom and then I think we can move over to AOSP and modify lets say, coral device and match it for our device. Though I think it is just easier using QAEP and why QAEP exists in the first place.
When I used QAEP, I got the SDCLANG problem, the build process according to the Micode git wiki, section "How to use" explains on how to configure and by the looks of the guide. It seems simple as cooking a boiled egg with only a couple of modifications to a device tree and adding your kernel to the kernel folder. It is supposed to build. I myself get SDClang path problems when using QAEP though.
I will go back to QAEP but i will be using all android 11 sources. due to unable to downgrade my phone from android 11 to 10. Having issues at the moment with TWRP installing. Shows my folder structure folder and file names. all random characters.
I will update as i get further in building the kernel and rom
Spoiler: Thoughts2
So I am now merging the built kernel into the kernel directory of AOSP 10. Made a folder called common and moved the built kernel into it. Also made a folder called prebuilts and put in all the .gz into it under a folder called 4.14. discovered that the AOSP 10 picked up the common folder with the built kernel but is having errors with Android.bp, will update as I find out more. Right now, just tinkering.
This is the issue when you have the build tools outside the source folder.
Could be a path I have not set properly. once I removed the command from POST_DEFCONFIG_CMDS="" it is now building.
Couple of things to note.
REAL_CC= I believe has now changed to HOSTCC=. Command is not found in any files in the build directory of the AOSP 4.14 STABLE Kernel.
QualComms LLVM 8.0.6 Compiler does not contain clang files. you still need to either download it, or just use the one in AOSP 4.14 Stable kernel, plus the clang version in AOSP stable kernel is a later version and also contains clang version for android 10+ instead of android 9.
New error I get after changes mentioned above are made.
Not sure where to put -fPIC to make the command function.
Fixed it, was a pathing issue with folders.
But now I am stuck now on finding out the directory for LD_LIBRARY_PATH=
Code:
DTC arch/arm64/boot/dts/qcom/apq8016-sbc.dtb
dtc: error while loading shared libraries: /home/avm/dev/source/kernel/prebuilts-master/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/lib/libc++.so: file too short
make[4]: *** [scripts/Makefile.lib:325: arch/arm64/boot/dts/qcom/apq8016-sbc.dtb] Error 127
make[3]: *** [/home/avm/dev/source/kernel/mi10/scripts/Makefile.build:676: arch/arm64/boot/dts/qcom] Error 2
make[2]: *** [arch/arm64/Makefile:187: dtbs] Error 2
make[2]: *** Waiting for unfinished jobs....
CC lib/rhashtable.o
Spoiler: Extra Discovered Info
${ROOT_DIR} is used. With it and you don't need to export it. Builder already knows what it is. so you use it like this for example
************************************
CC=${ROOT_DIR}/path-to-QQ_LLVM_COMPILER clang binary file, located in bin folder.
Also do this for ld.lld
LD=${ROOT_DIR}/path-to-ld.lld
************************************
Found another odd thing that happens
Having CC=PATH-TO-QQ-llvm-compiler/clang with CC_PREBUILT_BIN as aosp's location and HOSTCC=clang
It builds.
But with LD=
It fails.
I try using QQ-LLVM-Compiler as CC_Prebuilt_bin=
Fails.
So far I have managed to get to this point.
And can safely say that using QualComs LLVM 8.0.6 compiler does not work with android 10 so stick with AOSP's prebuilt clang either in Kernel stable git or AOSP android-Number-Revision
Again, REAL_CC does not work, nor show up in the enviroment as a used command.
These below all do.
<CC=>, <HOSTCC=>, <HOSTLDFLAGS=-fuse-ld=lld>, <NM=llvm-nm>, <OBJCOPY=llvm-objcopy>, <HOSTLD=>, <LD=>,
HOSTCC= will use what is put in CLANG_PREBUILT_BIN=
CC= you are able to add QQ-LLVM-COMPILER's clang and it will run.
Proof of QQ-LLVM-COMPILER failing, when using it for <CLANG_PREBUILT_BIN=>
Instead of using AOSP's clang.
So far that is all I have seen pop up.
All these changes were done with the Kernel AOSP-COMMON-4.14-STABLE build, kernel, prebuilts, prebuilts-master folders and then with the devices source in a folder with a build.config file in the same location as the AOSP-kernel build folders. this all seems to work, Only thing I lose out on, is using POST_DEFCONFIG_CMDS="" to use make menuconfig.
Reason that make does not work is because according to AOSP coral's kernel you have another build.config file which is with the build folder, prebuilts, master-prebuilts folders which connects to the main build.config.common and clang config that has the extra commands. So in turn I do not think we use LD=ld.lld
We let the builder choose it for us.
95% sure that the DTC is what is causing qcom to have that warning spam.
Device tree compiler (DTC) linking seems to be the full cause of all the issues.
Okay to prevent fixdep.c:105:10: error all you need to do is have HOSTCC=gcc and it works. so then in turn. You can now use QQ LLVM Clang compiler in CLANG_PREBUILT_BIN= instead of AOSP.
Spoiler: Helpful Links
GitHub - nathanchance/android-kernel-clang: Information on compiling Android kernels with Clang
Information on compiling Android kernels with Clang - GitHub - nathanchance/android-kernel-clang: Information on compiling Android kernels with Clang
github.com
Spoiler: Still going
Still going at it, manage to find out a couple of things.
If your build is failing due to files missing, check your build directory and make sure the files in the path folder and in Linux-x86>bin folders are indeed "symlinked" something I was unaware of with Linux due to me being a windows user. none of the icons can have an X on it. it means its broken. this solved a ton of my issues during Rom building.
the build folder itself is a symlink folder. (Not all files)
Just locate and put files in correct places. so instead of having a folder called toolchains, like we are told on the Micode wiki, etc. If you use the AOSP-kernel build, prebuilts, prebuilts-master. which contains all kernel and build tools. and are already linked. so then you just add QQ-LLVM-Compiler to either prebuilts or pre-builts master and link it in the config.
If you do all this correctly and having all files in the proper location, you should not have any more build errors in regards to missing files.
Summed up
Build directory contains symlinks to binary files which are located in prebuilts and prebuilts-master. you need all 3 folders in the device source root directory.
Inside the build directory you will find a file called build.config, its not a config. its a symlink for one. Rename it to the build.config.Aarch64 for example, or what ever your config is called located in your root devices source directory. this solved a **** load of my problems.
The problem I have now is actually got to do with Repo, AOSP, QAEP. found out using the manual install method of repo makes it so you can download off google when you have the pgp key installed. but having it installed this way, stuffs up gpg for QAEP. I am looking for a way to merge all PGP keys in one location.
and to get QAEP downloading without showing this error.
All you have to do is remove the manual repo you installed and then also deleting the .repoconfig folder and .gnupg folder.
Then install repo with <sudo snap install git-repo>
it will work, you will get a public key under john doe and it will use CAF as well. problem is. You lose out on public key to AOSP and also the repo that is inside the AOSP folder needs to be replaced. trying it just causes errors though.
What happens when you do above by removing the manual repo and adding the snap git-repo
So why does it matter that I need both public keys to work?
Because I am using AOSP and also QAEP for testing.
I'll be sticking with the snap instal git-repo for now. i'll have to work out how to add the key from AOSP.
**Error when going back to AOSP**
**what happens when you delete the repo folder inside .repo of AOSP**
Only way I got it to work is by removing the snap install version of repo and install the manual way.
But then I lose out on CAF.
Think i may have worked out what is happening with the keys. 2 folders are being made. .repoconfig and .gnupg.
.gnupg only gets created when using AOSP pgp key.
and there is a gnupg folder in .repoconfig, might be a command to merge the files.
this command below makes it so you can change the name.
--config-name
put it at the end of the repo init command.
from what I understand for the tucana_user_defconfig.
#CONFIG_BUILD_ARM64_DT_OVERLAY does not need to be set. for mi 9, yes. not for mi note 10. Just pulled the defconfig from my device using the command below.
**EXTRACT DEFCONFIG FROM DEVICE**
MSM devices
CMD> adb pull /proc/config.gz
files appears as config.gz in same directory
I should also note that I ran 2 builds one with DT_OVERLAY=Y and then one =N
the outcome was with the change of CONFIG_BUILD_ARM64_DT_OVERLAY=n
That is not how it is setup, the proper way to disable it is as follows.
#CONFIG_BUILD_ARM64_DT_OVERLAY is not set
I got a bigger file size for Image.gz-dtb. instead of under 20MB
Have it on so you can extract DTBO and dtb files. having it off stops it from extracting.
THIS error or what ever the hell it is, is driving me insane.
My understanding is that DTBO (overlay), when enabled, ends up in dtbo.img, and when disabled, probably ends up in dtb which is appened to the kernel Image.gz.
The gsi_write_channel_scratch error is... maybe this helps? https://github.com/ClangBuiltLinux/linux/issues/931#issuecomment-599681910
Spoiler: reply
Btw, thank you @Squida for pointing me out the correct repos for wifi and audio, I managed to compile both into my build and the audio one inline (the wifi needs to be insmod'ed).
b100dian said:
My understanding is that DTBO (overlay), when enabled, ends up in dtbo.img, and when disabled, probably ends up in dtb which is appened to the kernel Image.gz.
The gsi_write_channel_scratch error is... maybe this helps? https://github.com/ClangBuiltLinux/linux/issues/931#issuecomment-599681910
Spoiler: reply
Btw, thank you @Squida for pointing me out the correct repos for wifi and audio, I managed to compile both into my build and the audio one inline (the wifi needs to be insmod'ed).
Click to expand...
Click to collapse
Spoiler: Reply
You sir, are a Legend!
Okay So if I am reading that right.
If you mean DT_OVERLAY=y in defconfig, makes it so I can get the dtbo.img file. I tried adding the dtbo.img to the list of files for extraction and with it on, no dtbo image is made nor found, with it off. still the same thing but unable to extract any dtb or dtbo images from the boot directory. have to have it on.
dtbo.img just does not want to extract for me.
Again, using the clang config and not the mi 9 config used on Micode wiki.
the Micode Wiki settings do not work correctly. you lose out on about a GB of stuff and I know its a DTC issue I have been having due to the Qcom spam.
I have reduced the space though so now you can actually scroll through the whole build process, including the spam.
I will definitely be looking into that solution for channel scratch.
Also if you could please show me the config for the SDClang settings you put it to get it to detect. I tried looking over your git page and failed to understand why you have it in boardconfig.mk and if lineage has other files for the device.
Reason being is because on QAEP it talks about SDclang-3.8 and i have no idea where it is.. Supposed to be in QQ-LLVM-compiler and you copy it to the prebuilts folders, it just does not exist to do that.
the major problem I have is building the device tree when building the kernel. from my understanding, Xiaomi have set it up so DTC creates a Device tree for you. well that is the part that is failing and the whole reason why I can not make a rom.
My guess because you are using lineage sources, everything I am talking about. they already did for you. I am trying to do it all manually. learning purposes.
Okay so it turns out, we need LD=ld.lld
Though we must modify files, this is ridiculous just to get your own rom for xiaomi devices.
This thread below may have the solution for me and an easier one then having to modify files manually. Might have to update the Devices Kernel to the stable aosp 4.14 kernel. this is my theory anyway.
[REFERENCE] How to get an Android kernel up to date with linux-stable
Introduction Hello everyone! This will be a thread to assist people with getting their device's Android kernel up to date with the latest linux-stable tag from kernel.org. This process will henceforth be referred to as "upstreaming". This thread...
forum.xda-developers.com
Squida said:
Spoiler: Reply
You sir, are a Legend!
Okay So if I am reading that right.
If you mean DT_OVERLAY=y in defconfig, makes it so I can get the dtbo.img file. I tried adding the dtbo.img to the list of files for extraction and with it on, no dtbo image is made nor found, with it off. still the same thing but unable to extract any dtb or dtbo images from the boot directory. have to have it on.
dtbo.img just does not want to extract for me.
Again, using the clang config and not the mi 9 config used on Micode wiki.
the Micode Wiki settings do not work correctly. you lose out on about a GB of stuff and I know its a DTC issue I have been having due to the Qcom spam.
I have reduced the space though so now you can actually scroll through the whole build process, including the spam.
I will definitely be looking into that solution for channel scratch.
Also if you could please show me the config for the SDClang settings you put it to get it to detect. I tried looking over your git page and failed to understand why you have it in boardconfig.mk and if lineage has other files for the device.
Reason being is because on QAEP it talks about SDclang-3.8 and i have no idea where it is.. Supposed to be in QQ-LLVM-compiler and you copy it to the prebuilts folders, it just does not exist to do that.
the major problem I have is building the device tree when building the kernel. from my understanding, Xiaomi have set it up so DTC creates a Device tree for you. well that is the part that is failing and the whole reason why I can not make a rom.
My guess because you are using lineage sources, everything I am talking about. they already did for you. I am trying to do it all manually. learning purposes.
Click to expand...
Click to collapse
Spoiler: Reply
My guess because you are using lineage sources, everything I am talking about. they already did for you. I am trying to do it all manually. learning purposes.
Click to expand...
Click to collapse
Of course, this is the reason. I don't know exactly how the lineage build scripts generate dtbo.img. There's make bootimage, make vendorimage and maybe make dtboimage too. Probably this command helps you generate it, but I don't think I had success with that: https://forum.xda-developers.com/t/...nel-dtbo-for-redmi-k20.3973787/#post-80354635
The image size differs and the one created by lineage build scripts is the same size as the original one.
I also have console spam when the device tree is generated, I just didnt sweat on it as being an error.
BoardConfig is probably central to the lineage build, but I assume the variables set here are available to kernel's make commands.
For a lineage-less built I used the first two commands here: https://gist.github.com/b100dian/40c8dbe746ff181aff71ee10a75a5f3c (the rest of the things are my attempts to construct back the boot.img with the kernel).
To actually boot the kernel you can gzip it, and append the dtb file to it (
like
Code:
cat Image.gz dtb > Image.gz-dtb
).
, and _then_ reconstruct a deconstructed original boot.img with that (w/o the --dtb parameter if I remember correctly). But I think kernel output already has -dtb concatenated in out/arch/arm64/boot
b100dian said:
Spoiler: Reply
Of course, this is the reason. I don't know exactly how the lineage build scripts generate dtbo.img. There's make bootimage, make vendorimage and maybe make dtboimage too. Probably this command helps you generate it, but I don't think I had success with that: https://forum.xda-developers.com/t/...nel-dtbo-for-redmi-k20.3973787/#post-80354635
The image size differs and the one created by lineage build scripts is the same size as the original one.
I also have console spam when the device tree is generated, I just didnt sweat on it as being an error.
BoardConfig is probably central to the lineage build, but I assume the variables set here are available to kernel's make commands.
For a lineage-less built I used the first two commands here: https://gist.github.com/b100dian/40c8dbe746ff181aff71ee10a75a5f3c (the rest of the things are my attempts to construct back the boot.img with the kernel).
To actually boot the kernel you can gzip it, and append the dtb file to it (
like
Code:
cat Image.gz dtb > Image.gz-dtb
).
, and _then_ reconstruct a deconstructed original boot.img with that (w/o the --dtb parameter if I remember correctly). But I think kernel output already has -dtb concatenated in out/arch/arm64/boot
Click to expand...
Click to collapse
Thanks for the quick reply.
Spoiler: Might be the solution to DTC
Code:
DTC_EXT=~/android/lineage/prebuilts/tools-lineage/linux-x86/dtc/dtc ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=${PWD}/toolchain/bin/aarch64-linux-android- make O=../tucana-out REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu - vendor/tucana_user_defconfig
DTC_EXT=~/android/lineage/prebuilts/tools-lineage/linux-x86/dtc/dtc ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=${PWD}/toolchain/bin/aarch64-linux-android- make -j8 O=../tucana-out/ REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- 2>&1 | tee ../kernel.log
Above solution might be the key thing to solving my issues with DTC. i can safely say I never once put the ARCH= and SUBARCH= in DTC_EXT= this may have solved it.
As for the rom building itself, I may have to use AOSP over QAEP, due to the whole SDCLANG issue
Link:
https://developer.qualcomm.com/forum/qdn-forums/software/snapdragon-llvm-compiler-android/68403#comment-18264
Those issues are all related to QAEP, I have less problems with AOSP.
Just don't have a device tree for it. that is why I need DTC working perfectly.
For what it is worth, tried looking for a default device tree that was not based off lineage-os. No luck thus far.
But isn't the device tree what's in arch/arm64/boot/dts/qcom/ in the kernel sources?
There's even a Makefile there where you can see CONFIG_BUILD_ARM64_DT_OVERLAY in use
b100dian said:
But isn't the device tree what's in arch/arm64/boot/dts/qcom/ in the kernel sources?
There's even a Makefile there where you can see CONFIG_BUILD_ARM64_DT_OVERLAY in use
Click to expand...
Click to collapse
Spoiler: Reply
Lmao holy ****, I think I know where I stuffed up. I was navigating extract only at boot. Did not go further then boot directory lol. I'll test now with navigating to qcom. Thanks for the tip.
***UPDATE***
Managed to work out why all these problems are occurring.
Okay so from what I understand, there is 2 building methods.
1. Using terminal and using export commands.
2. build.config file
To test the theory to make sure that indeed there is a double up on builds, I decided to put the whole Micode Mi 9 export guide into the build.config that I have (made a backup of it) after executing it did indeed show errors.
so then I investigate how it is failing and it came to my attention that the export method for the make defconfig and then build is seperate for build.config.
for the kbuild, we issue the environment variables for example, these below.
When I say its Kbuild variables, it could be clang or gcc. Not 100% sure though.
Spoiler: Kbuild Environment Variables
# PRE_DEFCONFIG_CMDS
# Command evaluated before `make defconfig`
#
# POST_DEFCONFIG_CMDS
# Command evaluated after `make defconfig` and before `make`.
#
# POST_KERNEL_BUILD_CMDS
# Command evaluated after `make`.
#
# EXTRA_CMDS
# Command evaluated after building and installing kernel and modules.
#
# DIST_CMDS
# Command evaluated after copying files to DIST_DIR
#
# VENDOR_RAMDISK_CMDS
# When building vendor boot image, VENDOR_RAMDISK_CMDS enables the build
# config file to specify command(s) for further altering the prebuilt vendor
# ramdisk binary. For example, the build config file could add firmware files
# on the vendor ramdisk (lib/firmware) for testing purposes.
Spoiler: extra-info
and instead of having "make" command by itself I put it for example in PRE_DEFCONFIG_CMDS="make <code>*
and it will add in REAL_CC, etc to the defconfig and upon making the build it should inturn do the rest.
Does anyone know the environment variable for kernel build so i can then put in the make command for the build and include REAL_CC=, etc. I managed to get the first make command for the defconfig working.
PRE_DEFCONFIG_CMDS="make O=out/android-4.14 REAL_CC=${PWD}/prebuilts-master/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- tucana_user_defconfig"
I just now have to get the below command working. not sure what environment variable to put it under.
make -j$(nproc) O=out/android-4.14 REAL_CC=${PWD}/prebuilts-master/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- 2>&1 | tee kernel.log
Found it!
By searching in build directory then build.sh file.
and *_setup_env.sh* has settings as well that will help.
***********************************
export MAKE_ARGS=$*
Could be useful
CC_LD_ARG
***********************************
echo "========================================================"
echo " Building kernel"
set -x
(cd ${OUT_DIR} && make O=${OUT_DIR} ${CC_LD_ARG} ${MAKE_ARGS})
set +x
***Linux update script***
GitHub - android-linux-stable/script: A script to help with merging linux-stable into your own repository
A script to help with merging linux-stable into your own repository - GitHub - android-linux-stable/script: A script to help with merging linux-stable into your own repository
github.com
Better to use CAF for MSM devices.
[REFERENCE] Merge latest CAF Tag in Kernel
Introduction: Hello folks! In this thread I will be guiding you about how you can merge latest CAF tags in your CAF based kernel. Many people who just started compiling the kernels still don't know how to merge a CAF tag because there isn't any...
forum.xda-developers.com
Upon further research on the topic of MAKE_ARGS=$*
from what I now understand and please keep in mind, I am in no way a programmer or good with Linux overall.
I think the $* symbol is a value itself, so from my understanding. If i use lets say $S=Something I have just made an variable that will be used in MAKE_ARGS=$*
If my theory for this is correct, this is how I add in the make variables for the last build command to start the build.
Should be able to do this.
make -j$(nproc) O=out/android-4.14 REAL_CC=${PWD}/prebuilts-master/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- 2>&1 | tee kernel.log
Oh and the config is make commands, found that out as well. you have MAKE and SOONG commands and configs. I so prefer Make variables over Soong. looks easier to read for me.
Found a build config on mi code, sources, issues section
SOURCE
Spoiler: build.config-mi11
#!/bin/bash
export OUT=${PWD}/out
export ARCH=arm64
export SUBARCH=arm64
export TARGET_BUILD_VARIANT=userdebug
#export DTC_EXT=dtc
export CROSS_COMPILE=${PWD}/toolchains/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export KERNEL_DEFCONFIG=venus-qgki_defconfig
#set CONFIG_BUILD_ARM64_DT_OVERLAY=y
#set BUILD_CONFIG=build.config.gki.aarch64
O=$OUT REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- ${PWD}/scripts/gki/generate_defconfig.sh $KERNEL_DEFCONFIG
make O=$OUT REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- vendor/$KERNEL_DEFCONFIG
make -j$(nproc) O=$OUT REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- 2>&1 | tee kernel.log
The build config above is indeed for Mi11, we do not need gsi settings or the 3rd command starting with O=$OUT for Mi note 10 pro
By implementing the changes above, outcome below.
Just now have to resolve kernel issues and this should build with no more issues. it has been a massive adventure.
the errors above are due to remnants of old files from merges that were not undone properly. deleted the devices source and recreated it again. problems are now gone will update on outcome.
I still can not seem to get it completely built. Max Image.gz-dtb file size is 28.5MB so far. and the highest I have gotten. still get VMLINUX issues which tells me just maybe Xiaomi themselves have not updated the build scripts to suite the latest CAF changes.
All speculation at the moment.
Had a look at this area
GitHub - MiCode/kernel_build
Contribute to MiCode/kernel_build development by creating an account on GitHub.
github.com
Turns out, build config for CC9 Pro. does not exist hence why all the problems Using AOSP's.
I believe it needs to be full modified in order to work with Tucana, due to Xiaomi not releasing a build script for it. so another solution would be to modify or try and use another device on the list in the link to be able to build it. not even export using the Mi 9 works so I have to dig deeper on getting a config and build script for it.
Spoiler: Current build.config
ARCH=arm64
SUBARCH=arm64
BRANCH=android-4.14
CLANG_TRIPLE=aarch64-linux-gnu-
CROSS_COMPILE=aarch64-linux-android-
TARGET_BUILD_VARIANT=userdebug
DEFCONFIG=tucana_user_defconfig
SKIP_DEFCONFIG=1
PRE_DEFCONFIG_CMDS="make O=out/android-4.14 REAL_CC=${ROOT_DIR}/prebuilts-master/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- ${DEFCONFIG} && make O=out/android-4.14 menuconfig"
POST_DEFCONFIG_CMDS=""
KERNEL_DIR=.
EXTRA_CMDS=""
HOSTCC=gcc
CC=clang
DTC_EXT=${ROOT_DIR}/prebuilts-master/misc/linux-x86/dtc/dtc
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
CLANG_PREBUILT_BIN=prebuilts-master/ndk/toolchains/llvm-Snapdragon_LLVM_for_Android_8.0/prebuilt/linux-x86_64/bin
LZ4_PREBUILTS_BIN=prebuilts-master/misc/linux-x86/lz4
DTC_PREBUILTS_BIN=prebuilts-master/misc/linux-x86/dtc
LIBUFDT_PREBUILTS_BIN=prebuilts-master/misc/linux-x86/libufdt
BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
OUT_DIR=out/android-4.14
FILES="
arch/arm64/boot/Image
arch/arm64/boot/Image.gz
arch/arm64/boot/Image.gz-dtb
arch/arm64/boot/dts/qcom/tucana-sdmmagpie-overlay.dtbo
arch/arm64/boot/dts/qcom/sdmmagpie.dtb
vmlinux
System.map
.config
"
EXT_MODULES="
private/msm-tucana-modules/wlan/qcacld-3.0
"
IN_KERNEL_MODULES=1
STOP_SHIP_TRACEPRINTK=1
The config does not build vmlinux, DTC properly, dtbo.img. Still working on it.
I also did try first doing the standalone export way. Just constantly getting ld error --fix-something and to fix it, by using CC=clang and HOSTCC=gcc
but then you resort to having to use the build.config file. for some reason the standalone export method just does not work with cc and hostcc
and that is using the QQ LLVM/clang 8.0 toolchain with AOSP's GCC while having 2 directories. toolchain(GCC) and toolchains(QQ-LLVM/Clang) with QQ-llvm/clang's build directory inside the devices source root directory as well, according to MiCode Wiki under MSM-4.14.
Tried attaching the last make command to the DTC_EXT= and it fails, still unable to find the build kernel argument to change the command manually. Only have POST_KERNEL_BUILD
No luck at all with the export combo.
As for the build.config.
I get a build using AOSP'S GCC and QQ-LLVM/CLANG 8.0
But it is not complete.
I also use the build, prebuilts, prebuilts-master from AOSP's 4.14 Common kernel repo.
the reason for this, is because Xiaomi have not released kernel build files for the device. from what I have found.

Categories

Resources