Cannot compile kernel - Redmi Note 8 Questions & Answers

I am planning to compile my own kernel for my device, I have seen relative guides and such but I am unable to compile even the stock one by xiaomi.
1)Has anyone got any success compiling such kernel.
2)Can you describe step by step your set-up the install.
What I have tried by now
1) Download and unpack Kernel source by xiaomi
2) Getting the 4.9 toolchain
3) Now my commands
export CROSS_COMPILE= (toolchain path (this is correct as no error has popped up))
export ARCH=arm64
export SUBARCH=arm64
Make clean
Make mrproper
Make ranchu64_defconfig (probably wrong)
Make -j4
About the error: Since trying for over two weeks of no success I abandoned it, but I do remember that make was saying error 2 if that somehow helps.
-Thank you for your time my fellow developers!

MimoPakou said:
I am planning to compile my own kernel for my device, I have seen relative guides and such but I am unable to compile even the stock one by xiaomi.
1)Has anyone got any success compiling such kernel.
2)Can you describe step by step your set-up the install.
What I have tried by now
1) Download and unpack Kernel source by xiaomi
2) Getting the 4.9 toolchain
3) Now my commands
export CROSS_COMPILE= (toolchain path (this is correct as no error has popped up))
export ARCH=arm64
export SUBARCH=arm64
Make clean
Make mrproper
Make ranchu64_defconfig(it's probably wrong)
Make -j4
About the error: Since trying for over two weeks of no success I abandoned it, but I do remember that make was saying error 2 if that somehow helps.
-Thank you for your time my fellow developers!
Click to expand...
Click to collapse
UPDATE: After some time, I figured out 2 things
1)The defconfig I was using is wrong, but I
have searched the folders and no other file
works (So how do I find my defconfig?)
2)Turns out that for my particular device the
exported files need to be outside of the
kernel, as doing that continued the
compiling process only to be stopped by a
file that wasn't found:
(built-in.o located in /arch/arm64/kernel/ )
(and this makes me suspicious about my defconfig)

Related

How to make and flash a kernel from Official Htc Froyo Kernel sources?

Hi,
I have a branded Desire which have been first unbranded (goldcard), OTA updated to latest Htc froyo update, and then Unrevoked 3.21+S-off 1.5 by alpharev.
Now, i want to make my own kernel from htc sources.
I know linux (using Gentoo for years), but process to flash a new kernel on an android device is not clear for me.
Is this link ok for Desire?
http://htcevohacks.com/htc-evo-hacks/how-to-build-your-own-htc-evo-4g-android-kernel/
Regards.
Sent from my HTC Desire using XDA App
I followed Cyanogen wiki for building the HTC Kernel as I found the toolchain from Codesourcery threw errors when trying to compile.
Obviously with the CyanogenMod guide, I don't clone the kernel from their git, instead I untar the HTC source.
I would be interested in hearing your findings, if you do try and compile with that toolchain.
As for flashing the Kernel, I just use koush's AnyKernel - drop the zImage into the kernel folder and then compress and sign, to make a flashable zip.
Mekrel said:
I followed Cyanogen wiki for building the HTC Kernel as I found the toolchain from Codesourcery threw errors when trying to compile.
Obviously with the CyanogenMod guide, I don't clone the kernel from their git, instead I untar the HTC source.
I would be interested in hearing your findings, if you do try and compile with that toolchain.
As for flashing the Kernel, I just use koush's AnyKernel - drop the zImage into the kernel folder and then compress and sign, to make a flashable zip.
Click to expand...
Click to collapse
Yeah, basically this. It's pretty straightforward, it can just be a bit finicky sometimes.
Hi,
Thanks for answers.
Mekrel:
For the Sourcery compiler, I have same results as yours: errors and does not compile.
I believe HTC are working with the "google" toolchain, so their sources are not veryfied to work with another compiler.
Using the Cyanogen compile way ( with "google" toolchain), it does compile fine.
I'm happy to see this option in the kernel (Change Cpu Policy While Screen is ON/OFF), but I wonder why it is not activated by default... :
http://img833.imageshack.us/img833/3668/desiredefault.jpg
With changes made:
http://img145.imageshack.us/img145/3707/desiremodified.jpg
It would certainly be better than using SetCpu for me ( I'm using it just to force cpu at 245MHz when screen is off), and not need to hack HTC performance lock feature since I don't want to underclock or overclock my Cpu.
Now I just have to test it...but I do have few questions before doing that:
I can use koush's AnyKernel tool to flash my new zImage, but in case all goes wrong? How to revert back?
-->Can I save my actual boot.img in sdcard, and in case flash process goes wrong revert back to my actual boot.img?
Please help if possible with detailed process (or a web link but I have not being able to find a detailed process for Desire).
Regards.
Edit: Seems for me that Kouch's tool will not reuse my ramdisk, but another one?
-->I just want being able to modify my kernel, so I prefer to reuse ramdisk which is actually in my boot.img if possible.
-->I have tried this way: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images, but script provided on this link gave me error because my boot.img has a "Second Stage".
Judge584 said:
Hi,
Thanks for answers.
Mekrel:
For the Sourcery compiler, I have same results as yours: errors and does not compile.
I believe HTC are working with the "google" toolchain, so their sources are not veryfied to work with another compiler.
Using the Cyanogen compile way ( with "google" toolchain), it does compile fine.
I'm happy to see this option in the kernel (Change Cpu Policy While Screen is ON/OFF), but I wonder why it is not activated by default... :
http://img833.imageshack.us/img833/3668/desiredefault.jpg
With changes made:
http://img145.imageshack.us/img145/3707/desiremodified.jpg
It would certainly be better than using SetCpu for me ( I'm using it just to force cpu at 245MHz when screen is off), and not need to hack HTC performance lock feature since I don't want to underclock or overclock my Cpu.
Now I just have to test it...but I do have few questions before doing that:
I can use koush's AnyKernel tool to flash my new zImage, but in case all goes wrong? How to revert back?
-->Can I save my actual boot.img in sdcard, and in case flash process goes wrong revert back to my actual boot.img?
Please help if possible with detailed process (or a web link but I have not being able to find a detailed process for Desire).
Regards.
Edit: Seems for me that Kouch's tool will not reuse my ramdisk, but another one?
-->I just want being able to modify my kernel, so I prefer to reuse ramdisk which is actually in my boot.img if possible.
-->I have tried this way: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images, but script provided on this link gave me error because my boot.img has a "Second Stage".
Click to expand...
Click to collapse
You can backup via:
Code:
cat /dev/mtd/mtd2 > /sdcard/mtd2.img
Then you can use fastboot to flash boot:
Code:
fastboot flash boot mtd2.img
The guide you linked to doesn't recommend trying to split the boot.img from your phone (in this example, mtd2.img) due to possible corruption issues, which is why I went for Koush' AnyKernel.
So what you're saying is you can't get the ramdisk from your boot.img via:
Code:
% mkdir ramdisk
cd ramdisk
gzip -dc ../boot.img-ramdisk.gz | cpio -i
as this is the part that throws the error?
no, errors came from the perl scripts posted on the link http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
So to resume:
Code:
cat /dev/mtd/mtd2 > /sdcard/mtd2.img
will backup my boot.img but it may be corrupted
Code:
fastboot flash boot mtd2.img
will restore it but if it's corrupted then it's useless.
Why can it be corrupted?
Why not possible to flash this way, without the hassle of dealing with boot.img?:
Code:
fastboot flash zimage zImage
Edit:
OK, I have done some search: please confirm this procedure to be safe to flash a modified kernel:
1°)Make an Nandroid Backup
2°)Since my Desire is rooted and S-OFFed it does not need any-more signed files, so for me I just have to put my new wifi kernel module (bcm4329.ko) to /system/lib/modules/bcm4329.ko (via adb push)
3°And then flash the new kernel zImage in fastboot using this command:
Code:
fastboot flash zimage zImage
4°)Once done: I will have to power off my Desire.
5°)Then, Power it on again in bootloader mode, wait for 3 seconds and then go to fastboot: the zImage should now start flashing automaticaly.
6°)Once done: reboot to test my new kernel.
7°)In case something goes wrong, all I will have to do is to restore boot via my Nandroid backup and all will be fine.
If someone can confirm this procedure to be right and safe, thank you.
Best Regards.
Ok, my new kernel is ready.
Does someone can confirm that step 1 to 7 in previous post are corrects?
Sent from my HTC Desire using XDA App
The 7 steps you posted look about right - I'm not entirely sure about #3, I don't have much experience in fastboot flashing. You might be better off using AnyKernel and flashing that in recovery.
It works good!
Thanks a lot.
Sent from my HTC Desire using XDA App

[GUIDE]How to compile custom linux kernel for rooted HTC Wildfire S

====================================================================
How to compile Linux kernel for rooted ARM HTC Android 2.2+
====================================================================
(The process should be similar for other devices (if you can get your hands on their source). These instructions were used to compile successfully in Ubuntu 12.04.1 LTS for a rooted HTC Wildfire S, Android version 2.3.5)
0. Most Ubuntu installations should be ready to go, however just to be on the safe side you can use the command 'sudo apt-get install build-essential kernel-package libncurses5-dev bzip2' to install any missing packages.
1. First download the kernel source from HTC: ' http://htcdev.com/devcenter/downloads '.
Make sure to check Settings->About phone->Software information->more for the correct version.
2. Then download the android NDK: ' http://developer.android.com/tools/sdk/ndk/index.html '
(should be revision 5c but any NDK with the arm-eabi (NOT the arm-android-eabi) cross compiler should work (in fact any crosscompiler you can find for arm-eabi should work, as there are some custom/non-android ones around))
!!THIS IS IMPORTANT!!: DO NOT USE THE ARM-ANDROID-EABI CROSSCOMPILER!!! If you do, the kernel will (probably) compile but its modules will (probably) not load.
3. Untar the files somewhere, then export these variables: 'CROSS_COMPILE=/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-'
'ARCH=arm'
(You should change '/home/paris/ndk-r5c/' to the path of your own ndk. It is also possible to give this as a variable to the kernel Makefile, either by editing it and adding these decelerations to its first lines or by giving them as arguments when calling from the command line. Finally, you can add the bin folder to your path and export 'CROSS_COMPILE=arm-eabi-')
4. Pull the config file for your devices kernel from your device, using the adb (android debug bridge) command 'adb pull /proc/config.gz'. Open the archive and rename the config file inside to '.config' and copy it to the folder the kernel makefile is.
(Alternatively you can use one of the defconfig files with the comand 'make <device name>_defconfig'. See folder '<kernel source>/arch/<your architecture, usually 'arm'>/configs' for a list of defconfigs)
5. Use the command 'make menuconfig' to alter the configuration file. The menu should be pretty self explanatory and selecting Help will... help you understand more about the options. If you don't know what something is, you should probably leave it be. When done exit and save.
(Remember, when selecting modules [M] means the module will be compiled separately while [*] means the module will be compiled in the kernel. To load separate modules module support for the kernel must be enabled in the kernel options.)
6. Now everything should be ready. Use the command 'make -j<number of threads, used to compile faster on multicore machines>'
7. If everything went well, your kernel should be in the folder '<kernel source>/arch/<your arch>/boot' with the name 'zImage'.
8. Now !!BACKUP YOUR DEVICE!! (seriously, if you screw up and can't restore your device because you haven't backed it up, I'm not responsible). I use clockworkmod's backup option but any FULL backup will do. If your phone is rooted, you should already know how to do this.
9. Most backups contain an Image file named 'boot.img'. If your backup doesn't have this (it probably either compresses the backup somehow or it's a crappy backup) then search for alternate methods of obtaining the .boot.img'. Copy this image to your PC.
10. Download the python script 'split_boot_img.py' from Vicente Hernando: ' http://linuxclues.blogspot.gr/2012/11/split-bootimg-python-android.html ' or ' https://github.com/vhernando/split_boot_img '
Put it in the same folder as 'boot.img'.If you don't have python use apt-get install python to install it. Use the command 'python split_boot_img.py -i boot.img -o <output folder name, I used 'old'> -v'. You should get an output similar to this:
'Creating directory: old
boot_magic correct: ANDROID!
kernel size: 2484384
kernel address: 314605568
Base: 314572800 (hex): 0x12c00000 <--
ramdisk size: 449189
ramdisk address: 331350016
second size: 0
second address: 330301440
tags address: 314573056
page size: 2048 <--
product name:
cmdline: no_console_suspend=1 console=null
File old/zImage written (length=2484384).
File old/ramdisk.gz written (length=449189).'
Copy these lines and save them in a text file. Pay attention to the lines with the arrow.
11. Copy the ramdisk.gz from the old folder to a new folder. Copy the zImage you compiled to the new directory.
12. Download 'android_bootimg_tools.tar.gz' from: ' http://code.google.com/p/android-se...il?name=android_bootimg_tools.tar.gz&can=2&q= '
Untar/unzip the archive and copy the file named 'mkbootimg' to the folder where the zImage you compiled and ramdisk.gz you extracted from the old boot image are.
13. Use the command 'mkbootimg --kernel zImage --ramdisk ramdisk.gz --base 12c00000 --pagesize 2048 -o boot.img' Remember to change the 'base' and 'pagesize' arguments to the numbers you got on step [10]. (Remember the arrows?) You should now have your 'boot.img' file.
14. Now restart the device in bootloader mode and select fastboot. Connect your device to your computer via USB. You should see 'FASTBOOT USB' somewhere on screen now.
(Most devices boot in bootloader mode if you hold down the power button and volume down button when in hard off. You navigate the menus using the volume buttons and power button. Of course if you have rooted your phone you should already know how to do that. If not, Google and xda is your friend.)
15. Flash the new image using the ADB tool fastboot, by using the command: 'fastboot flash boot boot.img'
16. Select reboot. Your phone may take a while to restart but THAT'S OK! It's probably just rebuilding the dalvik cache. Just let it finish. If there's an error it will show up now. Just restore your backup and it'll be as good as new (or as good as it was when you backed it up). Remember that some things might not be working well yet since you haven't installed the appropriate modules. (You can verify that you are indeed running the new kernel by checking Settings->About phone->Software information->more where your computer name, time of compilation and EXTRAVERSION will be displayed)
17. Now simply mount your '/system' partition as read/write (google for instructions if you don't know how, it usually helps to run 'adb shell' to open a shell if you don't have a file manager that can remount the system partition as rw) and copy/replace the modules you will use to the appropriate folder, usually '/system/lib/modules/'. To find the modules you can simply use the command 'find -iname "*.ko"', either on your android device (if you have busybox installed) or your PC's kernel source directory. (There might be other commands necessary to activate new, user created modules. I'll update this post when I find out.)
That's all folks. If I have made any mistake or if I am unclear somewhere please tell me. Also tell me if I've made anything stupid or unnecessary.
Since most tutorials I found were outdated I decided I should make one and post it here for all to see.
I can't stress this enough: I compiled my kernel and wrote this tutorial by using info and tutorials by other people. I'll try to help in the best of my ability with any questions, but I'll probably be unable to answer them all.
====================================================================
Some tips
====================================================================
You can alter the 'EXTRAVERSION=' line in the Makefile to give your kernel a custom name/version. However, remember that most modules only load to kernels with the same name/version.
You can use the command 'make clean' to delete the compiled files, modules and kernel. Useful if you change something and want to be sure the new compilation is different.
You can use the command 'make mrproper' to delete the configuration files, making your source code truly clean.
You can use the command 'make -j<number of threads> modules' to only compile the .ko modules and not the kernel itself.
You can change the governor, cpu frequency, power options and more with the menuconfig, but be careful when you do so; it might fry your phone.
====================================================================
Thanks to
====================================================================
xda-developers, CyanogenWiki, Vicente Hernando and others for the info and files I used
(this is especially useful: http://forum.xda-developers.com/showpost.php?p=28646648&postcount=1 )
ohheyitslou for his tutorial: http://ohheyitslou.blogspot.gr/2011/09/ohheyitslou-custom-android-kernel-guide.html
ClockworkMod Recovery for its phone-saving usefulness
HTC for the free kernel and unlockable bootloader
google for Android and its search engine
Wow, amazing guide! I can't wait to try it out tomorrow. I can't believe no one has commented on this yet. I may send you a pm tomorrow, as I have been learning how to compile with the DNA. I was getting myself confused, so I'm gonna try your guide to see how it goes. I seemed to be having trouble with the tool chain and cross compile commands. How does CROSS_COMPILE =arm-eabi- even work? That command never seems to do anything for me.
stevedub40 said:
Wow, amazing guide! I can't wait to try it out tomorrow. I can't believe no one has commented on this yet. I may send you a pm tomorrow, as I have been learning how to compile with the DNA. I was getting myself confused, so I'm gonna try your guide to see how it goes. I seemed to be having trouble with the tool chain and cross compile commands. How does CROSS_COMPILE =arm-eabi- even work? That command never seems to do anything for me.
Click to expand...
Click to collapse
About whether or not arm-eabi has been replaced by arm-linux-eabi, I sincerely don't know. I have tried using some of the newer NDK versions to compile but none of them seemed to work. I was finally able to compile using NDK version 5c using the binaries in the arm-eabi folder. However if you do find a newer toolchain that works, please let me know and I'll update my post. There are also some custom arm cross compiler tool chains floating around the xda forums and other websites. You can try using one of these, but I can't guarantee that they will work. If they do however, again, please tell me so that I can add them to the post for other users.
Now, concerning the CROSS_COMPILE.
Skip this paragraph if you know what cross compiling is. Cross compiling means using one computer with a certain architecture, in our case x86 since most (if not all) PCs today use x86 CPUs, to compile code that is meant to run in another architecture, in our case the Wildfire S android phone, which uses an armv6l CPU. If you were compiling for an android phone that had an x86 CPU, as some newer models have, you would simply leave that variable (CROSS_COMPILE) unset and let your built in compiler binaries handle it. However, now we need a program that will run on your architecture and compile code for a different architecture. The programs in folder '/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/' do just that.
CROSS_COMPILE is an environment variable. The Makefile "reads" this variable from the terminal's environment. (You can use the 'env' command to see your terminal's environment. You can check for whether or not the CROSS_COMPILE variable has been exported with the command 'env | grep CROSS_COMPILE=' or 'echo $CROSS_COMPILE') It then adds this variable "in front of" every compile command it runs. So if the compiler were to run 'g++ -o executable1 file1.cpp file2.cpp' (which would be equivalent to '/usr/bin/g++ -o executable1 file1.cpp file2.cpp', since /usr/bin/ is part of your path), it will now run '($CROSS_COMPILE)g++ -o executable1 file1.cpp file2.cpp' which, if CROSS_COMPILE=/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-', translates to '/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-g++ -o executable1 file1.cpp file2.cpp'.
If however you have added '/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/' to your path, then you can simply use the command 'export CROSS_COMPILE=arm-eabi-' instead of writing the full path. This will translate the above command to 'arm-eabi-g++ -o executable1 file1.cpp file2.cpp' and since the folder where arm-eabi-g++ is in your path the binaries in it will be used. (A way to test whether or not the toolchain has been correctly added to your path is using the command 'which arm-eabi-g++' which should output '/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-g++' while 'which g++' should output '/usr/bin/g++')
Remember to change '/home/paris/whatever' to the location these files are stored in your system.
If you have any more questions or if you find something that may be helpful for other users, please don't be afraid to post.
Awesome man, thank you so much. I sort of had a feeling that is how the cross compile variable worked, but wasn't quite sure. I've been having some weird luck with using different toolchains. One day I had no problem compiling the HTC source kernel with the suggested toolchain (which came in the readme) and then the next day I couldn't get it to work. I've also tried the official ndk8 from the Android site, but I get a lot of errors. I also tried working with someone else's source code from github, but I could not compile using any of the toolchains I found. His makefile uses some linaro toolchain, which I could not find the one he used. I'm guessing you need to use a similar toolchain to which the source was compiled with. I also forgot to mention that I actually have the Droid DNA, but I figured HTC phones would be somewhat similar. I've tried asking some of the devs on that site for guidance, but I have not got any replies.
Thank you again for your help. If you don't mind, I may have some additional questions in the future, so I may send you a message or two
What an excellent guide thank you very much for this excellent help! Do you know where we can get the older revisions of the nkd? I am on 8 and it makes me
Sent from my Nexus 7 using xda premium
heavy_metal_man said:
What an excellent guide thank you very much for this excellent help! Do you know where we can get the older revisions of the nkd? I am on 8 and it makes me
Click to expand...
Click to collapse
Real easy, just use this url and change 'x' to the revision/version you want: dl.google.com/android/ndk/android-ndk-'x'-linux-x86.tar.bz2
For example for version r5c it's: dl.google.com/android/ndk/android-ndk-r5c-linux-x86.tar.bz2
Good thing the people at Google left the old download links working. Remember to look around the ndk site a bit too. It's got some interesting info.
If you really have nothing better to do you can also try these links:
android.googlesource.com/platform/prebuilts/ndk/+/tools_r21
android.googlesource.com/platform/ndk/+refs
Also a warning about something I noticed: I have used this method on a couple of friends computers to help them compile their own kernels. However on a single computer it would not compile whatever I tried. Finally made a second, clean ubuntu install alongside the first one and it compiled with no problems. I haven't yet found out what the problem was, but if you cannot compile in your computer, try a friend's computer or a new installation before giving up.
Hey I'm having some issues :-\ no matter what I do I cannot seem to point the make file to the arm eabi. Could you explain in greater detail please? The main problem I get is make arm-eabi-gcc : command not found.
I'm on Ubuntu 12.10 x86
Htc source code for htc bee (froyo device should that make a difference)
Ndk r5c
Target device htc wildfire (bee)
Help please
Tapped out from my sexy nexus 7
heavy_metal_man said:
Hey I'm having some issues :-\ no matter what I do I cannot seem to point the make file to the arm eabi. Could you explain in greater detail please? The main problem I get is make arm-eabi-gcc : command not found.
I'm on Ubuntu 12.10 x86
Htc source code for htc bee (froyo device should that make a difference)
Ndk r5c
Target device htc wildfire (bee)
Help please
Tapped out from my sexy nexus 7
Click to expand...
Click to collapse
You've clearly misunderstood something. You do not make arm-eabi-gcc. There's no need to make it. You just have to tell the makefile where it is so it can use it. Go read the first post and follow the instructions there. If you still have problems, write again, preferably detailing what you did and giving some console output.
Just in case the guide is not clear these are the things you must do to cross compile:
3. Untar the files somewhere, then export these variables: 'CROSS_COMPILE=/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-'
'ARCH=arm'
(You should change '/home/paris/ndk-r5c/' to the path of your own ndk.
Click to expand...
Click to collapse
You export variables via the export command, so you should write 'export CROSS_COMPILE=<ndk location>/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-' (again, change <ndk location> to your ndk location)
And here are the commands you must run for the makefile:
5. Use the command 'make menuconfig' to alter the configuration file. The menu should be pretty self explanatory and selecting Help will... help you understand more about the options. If you don't know what something is, you should probably leave it be. When done exit and save.
(Remember, when selecting modules [M] means the module will be compiled separately while[*] means the module will be compiled in the kernel. To load separate modules module support for the kernel must be enabled in the kernel options.)
6. Now everything should be ready. Use the command 'make -j<number of threads, used to compile faster on multicore machines>'
Click to expand...
Click to collapse
If you want to learn more about how the makefile operates see post number 3, where I explain it a bit. If you still have questions, please, don't be afraid to post.
No no, the command I am issuing is make clean && make mrproper and the output is what's above about not being able to find arm eabi gcc.
I will review what I'm doing and report back
Tapped out from my sexy nexus 7
output when doing make clean and make mrproper
Code:
[email protected]######:~/Desktop/bee/bee$ make clean
make: arm-eabi-gcc: Command not found
make[2]: arm-eabi-gcc: Command not found
CLEAN .tmp_versions
CLEAN include/asm-arm/mach-types.h
[email protected]#########:~/Desktop/bee/bee$ make mrproper
make: arm-eabi-gcc: Command not found
make[2]: arm-eabi-gcc: Command not found
CLEAN scripts/basic
CLEAN scripts/kconfig
CLEAN scripts
CLEAN include/config
CLEAN .config include/asm include/linux/autoconf.h include/linux/version.h include/linux/utsrelease.h
[email protected]######:~/Desktop/bee/bee$
when commanding echo $CROSS_COMPILE
Code:
[email protected]#########:~/Desktop/bee/bee$ echo $CROSS_COMPILE
/home/sam/Desktop/bee/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
[email protected]########:~/Desktop/bee/bee$
When running the command make -j3
Code:
[email protected]#######:~/Desktop/bee/bee$ make menuconfig
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
scripts/kconfig/lxdialog/textbox.c: In function ‘print_line’:
scripts/kconfig/lxdialog/textbox.c:323:9: warning: variable ‘x’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/lxdialog/textbox.c:323:6: warning: variable ‘y’ set but not used [-Wunused-but-set-variable]
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTCC scripts/kconfig/mconf.o
HOSTLD scripts/kconfig/mconf
scripts/kconfig/mconf arch/arm/Kconfig
#
# configuration written to .config
#
*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.
entering the command make -j3
Code:
[email protected]########:~/Desktop/bee/bee$ make -j3
make: arm-eabi-gcc: Command not found
scripts/kconfig/conf -s arch/arm/Kconfig
make: arm-eabi-gcc: Command not found
CHK include/linux/version.h
SYMLINK include/asm -> include/asm-arm
Generating include/asm-arm/mach-types.h
CHK include/linux/utsrelease.h
UPD include/linux/utsrelease.h
HOSTCC scripts/kallsyms
CC scripts/mod/empty.o
/bin/sh: 1: arm-eabi-gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
CC kernel/bounds.s
/bin/sh: 1: arm-eabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** Waiting for unfinished jobs....
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:112:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
make: *** [scripts] Error 2
[email protected]#######:~/Desktop/bee/bee
$
i am using basically the default .config but with the htc performance lock removed.
i am a bit out of my depth here :/
heavy_metal_man said:
output when doing make clean and make mrproper
when commanding echo $CROSS_COMPILE
Code:
[email protected]#########:~/Desktop/bee/bee$ echo $CROSS_COMPILE
/home/sam/Desktop/bee/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
[email protected]########:~/Desktop/bee/bee$
Click to expand...
Click to collapse
With a quick look I took I think this is your problem. Try changing the cross compile variable to include that bit in the end and tell me if it works.
3. Untar the files somewhere, then export these variables: 'CROSS_COMPILE=/home/paris/ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-'
'ARCH=arm'
Click to expand...
Click to collapse
I'll look at this again later but I have some work to do right now.
Parisbre56 said:
With a quick look I took I think this is your problem. Try changing the cross compile variable to include that bit in the end and tell me if it works.
I'll look at this again later but I have some work to do right now.
Click to expand...
Click to collapse
same here
[email protected]:~# export CROSS_COMPILE=/root/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/
[email protected]:~# ls $CROSS_COMPILE
arm-eabi-addr2line arm-eabi-g++ arm-eabi-gprof arm-eabi-readelf
arm-eabi-ar arm-eabi-gcc arm-eabi-ld arm-eabi-run
arm-eabi-as arm-eabi-gcc-4.4.0 arm-eabi-nm arm-eabi-size
arm-eabi-c++ arm-eabi-gcov arm-eabi-objcopy arm-eabi-strings
arm-eabi-c++filt arm-eabi-gdb arm-eabi-objdump arm-eabi-strip
arm-eabi-cpp arm-eabi-gdbtui arm-eabi-ranlib
[email protected]:~# which arm-eabi-gcc
[email protected]t:~#
---------- Post added at 02:27 AM ---------- Previous post was at 01:57 AM ----------
solved
export CROSS_COMPILE=/PathToFolder/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-
but now:
[email protected]:/media/DATA/nifl/HTC_Wildfire_S/source_code/marvel-s-gb-mr-2.6.35-696f19b# make
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CC arch/arm/kernel/asm-offsets.s
In file included from include/linux/dma-mapping.h:93,
from arch/arm/kernel/asm-offsets.c:15:
/media/DATA/nifl/HTC_Wildfire_S/source_code/marvel-s-gb-mr-2.6.35-696f19b/arch/arm/include/asm/dma-mapping.h: In function 'dma_cache_post_ops':
/media/DATA/nifl/HTC_Wildfire_S/source_code/marvel-s-gb-mr-2.6.35-696f19b/arch/arm/include/asm/dma-mapping.h:442: error: implicit declaration of function 'arch_has_speculative_dfetch'
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
Niflheim123 said:
-problem-
Click to expand...
Click to collapse
Hmmm... That's strange. It looks like there's a missing function declaration somewhere in that file, but that should be impossible. Could you PM me your .config file? It should be in the root of the kernel folder , i.e. here '/media/DATA/nifl/HTC_Wildfire_S/source_code/marvel-s-gb-mr-2.6.35-696f19b/.config '
I want to try compiling it for myself and seeing if I can figure out where the problem is.
Parisbre56 said:
Hmmm... That's strange. It looks like there's a missing function declaration somewhere in that file, but that should be impossible. Could you PM me your .config file? It should be in the root of the kernel folder , i.e. here '/media/DATA/nifl/HTC_Wildfire_S/source_code/marvel-s-gb-mr-2.6.35-696f19b/.config '
I want to try compiling it for myself and seeing if I can figure out where the problem is.
Click to expand...
Click to collapse
hey, thanks for the answer. I managed to compile it. I did a little screw up with .config file but now it works

custom kernel failed

I try to build kernel on my device E6883, and i was failed.
I followed the sony developer world guide:<<How to build and flash a Linux kernel from Sony copyleft archives>> All steps was OK. I got the boot.img and I flash onto my E6883, but it can’t boot, black screen.
my rom version is: 32.0.A.6.209
Can anyone help me?
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
2017-02-17
Hi @zacharias.maladroit,I update my e6883’s rom to 32.2.A.5.11 ,and flash the kernel that you released “Z5Prem-DSDS_SK_Perm_v5.11_III.2_6_ctl_X_sats_dual.zip”, it can work good.
So I decided to use your kernel . git clone from your github, I successfully compiled and got Image.gz-dtb. But when i flash to the device, it can’t boot.
I tried use my mkqcdbootimg to make the boot.img and I tried to use the lazyflasher, neither of the two way work.
My build command is:
```
export USE_CCACHE=1
export CACHE_DIR=~/.ccache
export ARCH=arm64
export PATH=/home/ubuntu/aarch64-linux-android-4.9/bin/:$PATH
export CROSS_COMPILE=aarch64-linux-android-
export KBUILD_DIFFCONFIG=satsuki_dsds_diffconfig
#export KBUILD_DIFFCONFIG=sumire_diffconfig I tried this config too.
make msm8994-perf_defconfig
make -j8
```
Can you give me some help?
seems like you have used wrong kernel or something went wrong.
your device is bricked or atleast stuck in bootloop withing kernel!
PRESS and HOLD volumeup and power button for 15 seconds,
you will feel 1........2..........3 vibrations! ........ just after 2nd vibration! RELEASE both BUTTON IMMEDIATELY!
the device will shutdown
now connect it as FLASHMODE and re flash the ORIGINAL STOCK in order to fix the device!
Code:
export ARCH=arm64
export PATH=~/android/z5_build-environment/mdalexca-aarch64-linux-android-4.9-kernel-linaro-09c6758022e7/bin/:$PATH
export CROSS_COMPILE=aarch64-linux-android-
export KBUILD_DIFFCONFIG=sumire_diffconfig
make msm8994-perf_defconfig
make -j8
https://github.com/zachariasmaladro....5.11_corona_III.2_ctl_X/build_it4_sumire#L31

building for un-existed device

hi, i followed this guide
https://forum.xda-developers.com/showthread.php?t=1863547
Is that guide still working ?
followed step by step but the kernel and the device/lge dont get automatically downloaded when i repo sync. Only vendor.
Also when i do breakfast it doesn't work , breakfast still see the path of my other repo and asks to find the device in a file not included in that guide.
Lastly of course brunch won't work without those files.....
The device i try build for is h815.
Thank you in advanced.
EDIT:
Could also copy paste the whole thing from the other repo i have here and only use the paranoid packages. That way i will still build paranoid , but ofc thats not the way i want to do it.
kessaras said:
hi, i followed this guide
https://forum.xda-developers.com/showthread.php?t=1863547
Is that guide still working ?
followed step by step but the kernel and the device/lge dont get automatically downloaded when i repo sync. Only vendor.
Also when i do breakfast it doesn't work , breakfast still see the path of my other repo and asks to find the device in a file not included in that guide.
Lastly of course brunch won't work without those files.....
The device i try build for is h815.
Thank you in advanced.
EDIT:
Could also copy paste the whole thing from the other repo i have here and only use the paranoid packages. That way i will still build paranoid , but ofc thats not the way i want to do it.
Click to expand...
Click to collapse
One way around this problem is to have your device tree on github and add it to the dependencies file either in the device repo, or add a (device_code_name).mk file to the vendor/pa/products/. Look at an existing device folder there for an example.

Unable to build kernel from source, what i'm missing?

Hello to all!
I'm an heavy oneplus user, currently with Nord, but i'm try to use my old but Gold Oneplus 3 to run Klipper+Moonraker+Fluidd.
Klipper side everything is perfect, still remains one big issue: there is no kernel compiled for OP3 which has USB_SERIAL_CH341 driver enabled.
I'm trying to build but without success. Here is what i've done under Linux Mint latest version.
First of all i've installed a lot of packages, i cant remember all because i used various guides since initially i was not able neither of finish compilation.
Then i've downloaded:
kernel source: https://github.com/lin16-microg/android_kernel_oneplus_msm8996/tree/lin-16.0-mse2
from this ROM thread, which is the rom im still using: https://forum.xda-developers.com/t/...ened-lineageos-16-0-for-oneplus-3-3t.4034869/
initially i've tried to use EVAgcc toolchain, but it was impossible to finish to build. Then i switched to AOSP toolchains:
32bit: https://android.googlesource.com/pl...inux-androideabi-4.9/+/refs/heads/pie-release
64bit: https://android.googlesource.com/pl...64-linux-android-4.9/+/refs/heads/pie-release
With Them i was able to compile from source, but before doing i modified the file called "lineageos_oneplus3_defconfig" by adding "USB_SERIAL_CH341=y" just under the "USB_SERIAL=y" in order to have the serial driver compiled and loader (if i have understood right?).
to build i've used from inside kernel source cloned directory:
>make clean
>make mrproper
>ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=googletoolpath/bin/aarch64-stuffs- CROSS_COMPILE_ARM32=googletoolpath/bin/arm-stuffs- make O=out lineageos_oneplus3_defconfig
>ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=googletoolpath/bin/aarch64-stuffs- CROSS_COMPILE_ARM32=googletoolpath/bin/arm-stuffs- make O=out Image -j2
in this way i've obtained an Image (not a zimage since with zimage returned error).
Then i unpacked the stock boot.img with Android Image Kitchen, substituted boot.img-kernel file (which is an archive..?) with the compiled image renamed.
Finally i repacked everything.
Tried to flash the repacked boot img but no boot, the phone returns to fastboot screen.
I've noticed that my newboot.img is around 25mb insted of around 12mb like the stock one present in the Rom.zip
Probably the error resides in how i've managed to unpack and repack the kernel image..
Do someone see some heavy error which can cause the problem? What can i try?
From a side, as automation engineer, i want to learn and try to do it by myself, but on the other side, if someone is able to compile it for me with serial CH341 driver enabled a beer is assured.
Thanks all to have read up to now and for any advice
not sure that's important but you forgot to gzip kernel before repacking. I recommend to compile with configuration of running kernel from device /proc/config.gz first.
alecxs said:
not sure that's important but you forgot to gzip kernel before repacking. I recommend to compile with configuration of running kernel from device /proc/config.gz first.
Click to expand...
Click to collapse
I've to try because it is not gzipped by default, the problem is that I don't found all in one scripts or config file as the one mentioned by you. I would never thought that rebuild a kernel were so tricky.

Categories

Resources