[Q] Compile modules with preempt mod_unload ARMv7 - Android Q&A, Help & Troubleshooting

I've been trying to compile the nfs module for my generic AML 8726 tablet. My steps have been:
Located and downloaded the kernal source
Set up the Sourcery G++ Lite cross-compiler
Found the .config file for my tablet and did "make meson6smp_android_defconfig" to get the kernel config file
modified the .config file for CONFIG_CROSS_COMPILE, CONFIG_LOCAL_VERSION and set the nfs module to compile
Did "make clean"
Did "make modules"
This produced a nfs.ko module, but it would not load with insmod.
Checking dmesg revealed: "nfs: version magic '3.0.8-g3dd9997-dirty preempt mod_unload ARMv5 ' should be '3.0.8-g3dd9997-dirty SMP preempt mod_unload ARMv7 '"
So everything matched except the cpu architecture.
I then googled around, plus reread the cross-compiler user manual, and figured I needed to set the library to ARMv7-A. I eventually managed that using the linker options to specify the sysroot location.
The module still came out as ARMv5.
Next I tried making the .config file again while setting the library to ARMv7-A ... still ARMv5!!!
So I have to conclude that "preempt mod_unload ARMv5" is being set somewhere else.
I did see one suggestion to add "CONFIG_CPU_V7=y" to the .config file. I tried that, but the compiler just overwrote it during the make.
Can anyone tell me where the %^!&# this is set? Any suggestions would me most appreciated - even ones that don't work out

I managed to work this out myself eventually. Since I noticed a couple of other similar threads, I'll write a brief howto.
BE WARNED!!! The reason the version magic didn't match is because there was no config.gz on my tablet. I thought I managed to locate the correct .config file, but clearly it wasn't. If you need to fiddle with these settings, you're probably in the same situation.
While I was experimenting, my tablet froze a couple of times, but fortunately was fine when I rebooted, since the modules don't load when rebooted from an insmod.
So, if you're still game, here is what I did.
I assume you already have a kernel source and a cross compiler ready. If not, there's a good guide here.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Input "make name_of_your_defconfig" in the consonle. Again, you've probably already got this far if you're reading this.
Don't do the edits from Chui's guide to the .config file yet. The menuconfig will override them anyway.
Input "make menuconfig". The following screen appears. Choose "System type" and hit enter.
On the next screen, choose "ARM system type" (the details may differ depending on your architecture).
On the next screen, change the processor. This is where I had to guess a bit, but I also did some research and ARM Ltd. Versatile Express Family" seemed likely. Make your selection, hit enter, and you will return to the previous screen.
Back on the previous screen, select "Versatile Express platform type" and press enter.
In my case, there was only one choice, but it is important to make sure it was selected (use the space bar), otherwise the SMB menu from the next step won't appear.
Exit twice to get back to the main screen, then select "Kernel Features" and press enter.
On the next screen, select "Symmetric Multi-Processing" (using the space bar). If that option is not there, the cpu you selected does not support SMP; you need to select a different processor.
Exit twice, and a dialog box will appear, asking you it you want to save.
Now, you need to make the other changes to the .config file as described in Chui's guide.
Once you're satisfied with the .config file, input "make modules". You may need to answer a question or two during the process.
Open a second console tab, and cd into where your module is. As root, check the version magic string with "modinfo".
Well, that worked for me, and I now have nfs shares mounted on my tablet :victory: Just remember that if you try this, it is at your own risk!!!

Related

[Root] SimpleRoot 1.5 (Revised - Linux/Windows)

http://www.nickbetcher.com/~nbetcher/SimpleRoot-v1.5-Linux.tar.gzHere you can find the revised version of SimpleRoot. It has somewhat major changes that blend in the combination of Wes and Eugene's findings together and separate from one another. As Wes has silently left the community for the Vibrant (as I understand it - please clarify if you want Wes) I have been unable to contact him.
Consequently I am posting revised version of SimpleRoot for the people whom are new to the community or people who want a more streamlined process that uses Eugene's Clockwork update.zip and Wes' SimpleRoot package. Using Eugene's update.zip fixes problems with gaining root access once you have flashed your ROM (SuperUser APK was apparently missing in Wes').
It's been generally accepted that SimpleRoot is fairly unnecessary once you flash the ENG nbh. There was controversy over the ENG nbh, but Eugene has disproven those opinions. For those of you who still want to use SimpleRoot, here it is.
Download: For Linux v1.5 (4shared).
Download: For Windows v1.5 (4shared).
Changes (for v1.5), they are as follows:
Switched from Wes' update.zip to Eugene's update.zip to eliminate problems gaining root access (SuperUser APK was apparently missing in Wes') after the ROM was flashed.
Changes (for v1.4.1 - WINDOWS ONLY), they are as follows:
Apparently the usb_driver package I had from the Android SDK didn't have the HTC Espresso's hardware IDs present. Added those so it will allow you to use the packaged drivers for device installation.
Added @ECHO off into rootme2.bat.
These changes do not affect the Linux package since the Linux scripts work and Linux doesn't need a special driver.
Changes (for v1.4), they are as follows:
Changed a lot of the text formatting for the Windows scripts, including fixing line feeds, quotation marks, command echoing, and grammatical changes.
Added the most recent copy of the Android SDK's Windows USB driver since users who have never installed the driver need an easier way to get it. (Especially if they are on limited broadband)
Added the USB driver as a requirement in the Windows script since it is a fairly important requirement.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Added a .sh extention to the Linux script filenames.
Added a ./ in front of "adb" in the loop.sh script so it uses the adb in the local directory of the SimpleRoot extracted archive versus erroring out in a loop (in the likely event the user doesn't have adb installed system-wide). This preserves the consistency already in the other scripts.
Packaged the Linux files into a subdirectory in the tar.gz file versus extracting the files into the current directory (which is highly irritating
).
Bumped version number to 1.4.
Added myself into the credits.
Modified the Windows Readme file to reflect the directions provided from the script.
Thanks nbetcher!
As I understand it Wes is working for both devices now, not sure though.
Quick question this worked perfect the first time but when i tried to put a rom on my sd card from clockwork it wouldnt see it when i clicked install from sd so i rebooted and i saw superuser on stock and i couldnt get back into clockwork since then and now i cant re root again it keeps saying device not found any ideas

MID7012 - Kernel Building ERROR - PLS Help!

so far i have downloaded the tcc8902 kernel, it fails to build...
using ubuntu 11.10
am i missing something in my toolchain???
when i "make menuconfig" i get a few error....
and after that i just run "make" it fails.... see image...
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
i would like to finish this build so i can OC this device...
the kernel come pre-setup with the freqtables and voltages from the mid9200
any help would be nice!
would be very nice if it would just build!!!!!
have a look at the cyanogen wiki about setting up your cross compiler.
http://wiki.cyanogenmod.com/wiki/Building_Kernel_from_source
Sent from my Nexus One using XDA App
i will try this.... i understand now, cant build ARM source with out an arm processor, the ia32 doesnt read or write arm source.... wow....
will try later gotta goto school... preparing for a test.... i pray this works, i got a whole ton of people wanting this kernel and android build....
Hi you can still compile for arm on your pc. you just need a compiler that can output arm code.
first download the ARM EABI Toolchain for your computer
then set the environment variable for the arm build toolchain. such as
export CCOMPILER=[extraction directory]/bin/arm-eabi-
then build kernel with new toolchain
make ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
and if your .config is correct that should get you a working kernel.
ps. and by your first screenshot it looks like your .config is the default from /boot/config-3.0.0-14.
so back to the wiki with how to get the .config from your android device
adb pull /proc/config.gz /home/user_name/android/kernel/cm-kernel/config.gz
cat config.gz | gunzip > .config
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig
hope that helps and good luck!
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A
just my luck... i tryed to build the toolchain... and i picked a broken script... stupid download... md5 was correct, just a broken installer script... error code 1 and code 2.... garbage...
recomend any good arm cross-compiler toolchains?
The prebuilt binaries from here should be all you need.
https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription3053
then just make sure to export CCOMPILER=path/to/toolchain/bin/arm-none-eabi-
any progress been made on this? theres a lot of delveopment happening over at the KTZ Forums but not much about developing kernels. you should take a peak.
LemonHead2089 said:
any progress been made on this? theres a lot of delveopment happening over at the KTZ Forums but not much about developing kernels. you should take a peak.
Click to expand...
Click to collapse
I second that, I need a kernel that is OC-able since this rubbish wont run faster than 720mhz.
Has anyone been able to run ICS on this? Any other roms other than the KTZ ones? I really don't like them to be honest (I do appreciate their work) but I would prefer CM7 or something similar, maybe something very light would also be awesome.

[GUIDE] Export Your Kernel Adiutor Settings to init.d Script

Hi, there.
The reason I make this thread is just want to share some tips to export your Kernel Adiutor profile settings to make it as a script running via init.d on your device and also as a backup for reasons. Since I'm having some trouble with Kernel Adiutor such as fail to apply on boot on restart, reseting all of my tweaks for no reason after restart, switching from different ROMs, etc. that really grind my gears.
NOTE : I prefer doing this work on PC and using Notepad++ or other text editor since its more easier.
1. Make sure your device is already have working init.d
2. Open your Kernel Adiutor, make some tweaks and save it as a profile in Hamburger Menu - Profile
3. Go to /data/data/com.grarak.kerneladiutor/files/ and copy profiles.json to somewhere else
4. Open profiles.json in Text Editor and copy all of its contents to clipboard
5. Go to https://www.browserling.com/tools/json-to-text to convert .json to txt, just paste it on the text box provided and click convert!.
6. Copy the text inside the text box and create a new files, paste onto it.
7. From this point we will edit the lines and remove unused lines so pay attention to avoid deleting the useful one
8. As you can see there are lines begins with "command" and "path", delete all the lines that start with the "path".
9. After you done with that, next is ONLY delete the words "command" from all lines. you will see fewer lines of codes after all this step. Then don't forget to save it as file without extension ex. : 69mykernelsettings
10. If you want to make sure you did copy the correct code, just do quick cross-check from Kernel Adiutor - Profile and see Information and compare it to the profile you use with the file we just made.
11. Last step copy your file to /etc/init.d/ , dont forget to give it permissions rwxr-xr-x (0755) or it wont executed on boot.
Here are some screenshot example from my profile :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Maybe this method is so convensional and too much hassle but it works for me and if you have a better method feel free to share in this thread and give some feedback
Very helpful bro, thanks
Gonna do this
arundhiman said:
Very helpful bro, thanks
Gonna do this
Click to expand...
Click to collapse
but that didnt worked for me , i m using android q and there is just "init" folder not that init.d
Looking for a another simple method now
In android q and above service.d folder works as init.d, you could found that folder in adb magisk

Kernel directory structure at compile time

I'm having trouble compiling this kernel for the Realme 2 Pro:
https://github.com/realme-kernel-opensource/Realme2Pro-kernel-source
Firstly, there were misc build errors based around paths and syntax used for .C and .H driver source code files, which needed to be made "standalone compilable" ala OnePlus5:
https://github.com/adin-k/oneplus5-kernel/commit/ec4ec687ba23609b9c323145c7d509262b0f025f
For example, this source file header needed changing from:
#include "pmic-voter.h"
To this:
#include <linux/pmic-voter.h>
In other words, the pmic-voter.h file was not located in the same folder as the source file - but inside the "linux" sub-folder instead.
Once the paths were corrected it then builds successfully (albeit one final outstanding error relating to the fingerprint driver).
My first question then is how on earth might paths within the kernel tree become so messed up as to require such a drastic clean up operation!? Is it deliberate or are sub-folders being moved around or perhaps special environment variables being set at compile time?
I then went inside the make menuconfig to change some default kernel settings - specifically to enable Virtualization and KVM:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The kernel then failed to compile again! The first place it falls over is building the cpu_errata.c, which can be fixed by having more paths updated within that file, but then it soon falls over again elsewhere.
I tried another Snapdragon 660 device with a similar kernel (Nokia 7 Plus) and the KVM parts compile fine. I even tried compiling the exact same kernel used by the Realme 2 Pro:
https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.78.tar.gz
Of course it compiles fine! Here's the typical steps that were taken:
export CROSS_COMPILE=/home/gilius/Desktop/tool/bin/aarch64-linux-android-
export ARCH=arm64
make O=out clean && make O=out mrproper
make O=out defconfig
make O=out menuconfig (note: here is where we enable Virtualization and KVM)
make O=out -j10
The Realme, Nokia and original kernel sources all share the same tree/directory structure - at least in terms of KVM. I don't know how the KVM modules were originally added to the official Linux Kernel (from version 3.11 onwards) because there are no instructions, but I do know from comparison that the files and directory structures are identical:
/arch/arm64/kvm/hyp
/virt/kvm/arm
/include/kvm
etc.
I then discovered that the original KVM files (perhaps finalised way back in 2014) do not depend on any particular directory structure as per what was required to fix standard OnePlus5/Realme compiles. For example, the kvm_main.c includes the following:
#include <kvm/iodev.h>
#include <linux/kvm_host.h>
#include <asm/processor.h>
But these folders (kvm/linux/asm) are located elsewhere in the kernel tree; the folder containing kvm_main.c has no such sub-folders - yet the compile still works for the Nokia kernel! And to complicate matters further, there happens to be several duplicate directories named "linux" containing different files in need of inclusion by various C and H source code files. In other words: they require files from all different linux folders scattered in all different locations - but without knowing exactly where to find them.
Therefore, the issue with enabling KVM in the Realme 2 Pro must be something to do with environment variables set during at compile time? So I'm guessing a whole of list of them (or symbolic links or some such) are set within a file somewhere to be referenced at compile time? Since all 3 kernels contain identical directory structures, how else might the Realme 2 pro kernel in particular have got messed up so that even basic parts of the kernel, such as kvm, do not compile by default? And how might this be undone and fixed?
Any help would be much appreciated.
Hi gilius2k15,
You can try this kernel source, its by Los dev SamarV121:
https://github.com/SamarV-121/android_kernel_oppo_sdm660
If you manage to compile do let us know how to
please let us know if u managed to compile it

FIX: Un-allowed DMA capable bus/device(s) detected

Credit goes to this posting:
https://superuser.com/questions/1345848/un-allowed-dma-capable-bus-devices-detected
I've edited it to make the process easier. It helped me solve the issue. Of course, use at your own risk and wear a helmet if you're going to tinker in the registry.
White-list the device​
Open Regedit
Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DmaSecurity\AllowedBuses
Grant yourself access to modify the registry key
Right-click AllowedBuses and go to Permissions
Make yourself the owner
Press Advanced
Next to Owner, make note of what it says (mine said SYSTEM)
Next to Owner, press Change
Enter your username (eg your Microsoft account email address)
Press OK
Grant yourself access
Press Add
Enter your username (eg your Microsoft account email address)
Press OK
Select your user
Tick Full Control
Press OK
Under AllowedBuses, create a new String Value
Run the following PS script which generates a .reg file (with all found PCI devices) in tmp directory and then imports it silently
Code:
$tmpfile = "$($env:TEMP)\AllowBuses.reg"
'Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DmaSecurity\AllowedBuses]'`
| Out-File $tmpfile
(Get-PnPDevice -InstanceId PCI* `
| Format-Table -Property FriendlyName,InstanceId -HideTableHeaders -AutoSize `
| Out-String -Width 300).trim() `
-split "`r`n" `
-replace '&SUBSYS.*', '' `
-replace '\s+PCI\\', '"="PCI\\' `
| Foreach-Object{ "{0}{1}{2}" -f '"',$_,'"' } `
| Out-File $tmpfile -Append
regedit /s $tmpfile
Start removing added entries via regedit one by one while refreshing system info page and checking which entry makes it incompatible again
*Fun fact: Running the script again re-populates the list without duplicating/missing entries
You should find at least one entry that re-enables the System Information message. I had 2. (See photo below).
Keep ONLY the one(s) that trigger the incompatibility message
Make sure to remove the user account that took ownership of the registry folder. I did this by right clicking Allowed Busses-> advanced and deleting my account. No need to do anything else except confirm the original owner (System in my case) has been restored. Be warned that this may NOT be the correct way to restore ownership.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This, unfortunately, does not work for me. After running the PowerShell script, I get entries added to AllowedBuses, but I still get the "Un-allowed DMA capable bus/device(s) detected" error.
The problem seems to be that I have multiple instances of some unallowed devices. When I run the Get-PnPDevice manually, I see everything, but you can only add a single instance of any given friendly name to the AllowedBuses key in the registry. For example, I have 12 PCI-to-PCI Bridge entries that have 5 different device ID's between them.
I haven't figured out how to whitelist everything I need to whitelist yet, and it seems impossible since I have multiple device ID's with the same friendly name that need to be added.
shrike1978 said:
This, unfortunately, does not work for me. After running the PowerShell script, I get entries added to AllowedBuses, but I still get the "Un-allowed DMA capable bus/device(s) detected" error.
The problem seems to be that I have multiple instances of some unallowed devices. When I run the Get-PnPDevice manually, I see everything, but you can only add a single instance of any given friendly name to the AllowedBuses key in the registry. For example, I have 12 PCI-to-PCI Bridge entries that have 5 different device ID's between them.
I haven't figured out how to whitelist everything I need to whitelist yet, and it seems impossible since I have multiple device ID's with the same friendly name that need to be added.
Click to expand...
Click to collapse
Multiple instances of the same device can be fixed by appending 2, 3, 4 etcetera to the friendly names to make them unique.
I have five "PCI Express Root Port" devices with the same name but different device-id's, and this trick fixed the "Un-allowed DMA capable bus/device(s) detected" error for me.

Categories

Resources