[Q] Implement intell_plug - Galaxy Note II, Galaxy S III Developer Discussion

I'm attempting to implement faux123's intelli_plug into my kernel. It was added in this commit and enabled in "make menuconfig". However, it throws me errors during compilation:
Code:
arch/arm/hotplug/intelli_plug.c:166: error: undefined reference to 'avg_nr_running'
arch/arm/hotplug/intelli_plug.c:227: error: undefined reference to 'avg_cpu_nr_running'
make: *** [.tmp_vmlinux1] Error 1
I have reached out prior to this post, but that has gotten me nowhere.
Thanks in advance.

I have the same problem. Did you fix it?

take a look at the commit here:
https://github.com/faux123/android_kernel_oppo_n1/commit/64f86a98a0b70c42dc9d0a875164543b890012f4
i found the solution here and compile worked well
http://forum.xda-developers.com/showthread.php?p=55894825#post55894825
br,
nosedive

That's how you implement Intelliplug 4.0 properly.
https://github.com/olokos/OK-Kernel-Z1-LP/commit/bdda0d6b2edf66734f9a7b2b72797896028fbf16
Please do mention me when you use my commit as it took me a few hours to track down every single intelliplug change (it's spread between three different devices) and then merge it into a single working commit.

Op if it works please release it.

Hello I have the sam eproblem with implementaion of Intelli_plug to Samsung Exynos platform:
the same errors with avg_nr_running - Ive added codes to the core.c but in shed.h I have not the same codes as You have means no for ex. :
Code:
static inline void inc_nr_running(struct rq *rq) - I HAVE NO this function..
{
#ifdef CONFIG_INTELLI_PLUG
struct nr_stats_s *nr_stats = &per_cpu(runqueue_stats, rq->cpu);
#endif
sched_update_nr_prod(cpu_of(rq), rq->nr_running, true);
#ifdef CONFIG_INTELLI_PLUG
write_seqcount_begin(&nr_stats->ave_seqcnt);
nr_stats->ave_nr_running = do_avg_nr_running(rq);
nr_stats->nr_last_stamp = rq->clock_task;
#endif
rq->nr_running++;
#ifdef CONFIG_INTELLI_PLUG
write_seqcount_end(&nr_stats->ave_seqcnt);
#endif
and alwyas I have compilling error .
I put my shed.h file
View attachment sched.h
Thx for any help

Related

Getting BFS Scheduler working?

Im so sorry if this is in the wrong place but im a developer working on my first kernel and my question is only going to get some help by the most elite ROM dev's out there.
Ok so i got the BFS patch for the kernel im currently working on which is 2.6.32.9. Of course the patch is meant for a mainline kernel and not an Android kernel so i went through the patch file and applied the patch by hand, it was a pretty smooth process the diffs in the bfs patch were all the same code just wouldn't apply because all the line numbers were off. My first attempt bombed so i must have made some mistakes it was my first time patching by hand! Anyways took another crack and recompiled the kernel after every file patched so i could basically debug compiling problems well it all went smooth.
Heres the problem though, kernel compiles fine with out bfs checked, with it checked it compile a hell of alot of the kernel, but it eventually fails and it make no seance after my investigation of things. Here is my error
Code:
drivers/built-in.o: In function `mmc_wait_for_req':
lowmemorykiller.c:(.text+0xd2b3c): undefined reference to `wait_for_completion_io'
make: *** [.tmp_vmlinux1] Error 1
I found the decleration for wait_for_completion_io in kernel/sched.c the only thing i changed in sched.c was to at line 1 and it was basically to include sched_bfs.c, if the scheduler was seleted in the config, heres the patch stuff for sched, all i did was add the three lines to check if bfs was set in the config and then added the #endif at the bottom
Code:
*/
Index: linux-2.6.32-ck2/kernel/sched.c
===================================================================
--- linux-2.6.32-ck2.orig/kernel/sched.c 2009-12-03 21:02:30.565685697 +1100
+++ linux-2.6.32-ck2/kernel/sched.c 2009-12-29 10:15:00.820070753 +1100
@@ -1,3 +1,6 @@
+#ifdef CONFIG_SCHED_BFS
+#include "sched_bfs.c"
+#else
/*
* kernel/sched.c
*
@@ -10909,3 +10912,4 @@ void synchronize_sched_expedited(void)
EXPORT_SYMBOL_GPL(synchronize_sched_expedited);
#endif /* #else #ifndef CONFIG_SMP */
+#endif /* CONFIG_SCHED_BFS */
\ No newline at end of file
.
At the end of sched.c it starts exporting the functions and wait!!!! the first function it exports looks like this!
Code:
/**
* wait_for_completion: - waits for completion of a task
* @x: holds the state of this particular completion
*
* This waits to be signaled for completion of a specific task. It is NOT
* interruptible and there is no timeout.
*
* See also similar routines (i.e. wait_for_completion_timeout()) with timeout
* and interrupt capability. Also see complete().
*/
void __sched wait_for_completion(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(wait_for_completion);
So maybe sched isnt exporting any functions anymore after the inclusion of sched_bfs.c into it? i dont know all i know it i didnt touch lowmemmory.c and im sooo close to getting BFS but this is boggling me!! Maybe there is a conflict in kernel options im not aware of? I turned off all c groups and the default scheduler.
I wont paste my .config here nothing annoys me more than that, heres a link to a gist of it on github (just like pastbin for thos not in the know lol) bfs enabled .config and here is my sched.c and my lowmemmorykiller.c! Any help would be awesome there are so many people patching bfs into there androif kernel so im hoping this is a common type of problem
EDIT if i remove the mmc drivers it finishes the compile, but i kind of need these have to sleep now ill experiment more, if neone has any ideas about what the heck is goin on id love to know
did you ever fix this? i ran into the same error. a quick google search got me this and it seems to be working. ill post later if it actually works.
edit: succesfully built tdm's gingerkernel with -ck patchset with this. working on bobzhome's kernel now
Sorry this is way late man!! I have been doing alot of hardware hacking as of late, my android stuff especially kernel modding has been pushed to the the side.
Anyways how did BFS turn out any speed improvements? Maybe ill see if I can patch it into cm9 if theres and good reason for that
I am getting this same error after adding bfs to my kernel.. the link you gave is 404. Any one who worked with bfs that can provide some insight, that would be greatly appreciated. Thanks
arch/arm/mach-msm/built-in.o:shooter-panel.c:function msm_dmov_exec_cmd: error: undefined reference to 'wait_for_completion_io'
drivers/built-in.o:clkdev.c:function mmc_wait_for_req: error: undefined reference to 'wait_for_completion_io'
drivers/built-in.o:clkdev.c:function mmc_wait_for_cmd: error: undefined reference to 'wait_for_completion_io'
drivers/built-in.o:clkdev.c:function mmc_erase: error: undefined reference to 'wait_for_completion_io'
make: *** [.tmp_vmlinux1] Error 1
You can get BFS working adding these lines in <kernel-path>/kernel/sched_bfs.c
Code:
/**
* wait_for_completion_io: - waits for completion of a task
* @x: holds the state of this particular completion
*
* This waits for completion of a specific task to be signaled. Treats any
* sleeping as waiting for IO for the purposes of process accounting.
*/
void __sched wait_for_completion_io(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE);
}
EXPORT_SYMBOL(wait_for_completion_io);
After this line:
Code:
EXPORT_SYMBOL(wait_for_completion);

[Q] Jelly Bean wifi patch help

As many know, Jelly Bean wifi does not support enterprise wifi.
A fix was posted on the google forum that will hopefully work with the TF300t http://code.google.com/p/android/issues/detail?id=34212#c165
external/wpa_supplicant_8:
diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index aaa920b..be94e8a 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -929,6 +929,11 @@ struct tls_connection * tls_connection_init(void *ssl_ctx)
#ifdef SSL_OP_NO_COMPRESSION
options |= SSL_OP_NO_COMPRESSION;
#endif /* SSL_OP_NO_COMPRESSION */
+#ifdef ANDROID
+ options |= SSL_OP_NO_TLSv1_1;
+ options |= SSL_OP_NO_TLSv1_2;
+ options |= SSL_OP_NO_TICKET;
+#endif /* ANDROID */
SSL_set_options(conn->ssl, options);
conn->ssl_in = BIO_new(BIO_s_mem());
(note similar patch in wpa_supplicant_6 if your build configuration uses that)
those shouldn't disable WiFi, just limit what TLS versions are used by wpa_supplicant to talk to the server. it should still use TLSv1.0 and SSLv3.0.
My understanding is that you have to apply the patch to the source code and recompile the file. I have no clue how to do this despite a few searches with explanations beyond my abilities. Could someone give me a newb guide on how to do this or uploaded a patched file to fix this common issue?
Many, many thanks!
Is it possible to apply the patch and recompile it in Windows 7? From my searches it seems that you need linux (Ubuntu?) or Mac. If so, can you point me in the right direction?
Thanks!

[Q] Extracting kernel image from a rom image

I am trying to build some kernel modules for a Tronsmart MK808ii but Tronsmart have not provided the config (No proc/config.gz) after some messing about I have managed to get some kernel modules to load (I have the Init and Exit pointers in the right place). My first aim is to allow the device to read usb cdroms and iso files for which I need to load isofs.ko cdrom.ko and sr_mod.ko
Actually things go pretty well except there appears to be a misalignment between struct gendisk in the module and kernel. when the genhd driver dereferences gendisk->part0 i get an oops. Looking at the code the only definable length object before part0 seems to be disk_name
In order to be more precise about what's happening and to determine the relative alignment of structures between my kernel and the supplied one I need to be able to disassemble the original kernel which I've extracted from the eeprom - ony problem is that neither file nor objdump know what to do with this image, so I'm presupposing it has some sort of header on it so the bootloader can find the image. The Image starts with KRNL$
Does anyone have an idea of how vmlinux image can be extracted from this rom image?
int major; /* major number of driver */
int first_minor;
int minors; /* maximum number of minors, =1 for
* disks that can't be partitioned. */
char disk_name[DISK_NAME_LEN]; /* name of major driver */
char *(*devnode)(struct gendisk *gd, mode_t *mode);
unsigned int events; /* supported events */
unsigned int async_events; /* async events, subset of all */
/* Array of pointers to partitions indexed by partno.
* Protected with matching bdev lock but stat and other
* non-critical accesses use RCU. Always access through
* helpers.
*/
struct disk_part_tbl __rcu *part_tbl;
struct hd_struct part0;

Fixing boot on custom kernels support that targets CyanogenMod

I get a lot of question that my custom kernel breaks support their own AOSP-based ROMs.
So I'm here to how to fix that from your side.
The culprit is CyanogenMod's /init.environ.rc.
CM has been messing around that in recent months.
Changing BOOTCLASSPATH does not break cross-compatibility between different AOSP forks, as long as they don't remove stuffs and just adds stuff.
The problem is SYSTEMSERVERCLASSPATH. If any new stuffs are added, Android RunTime will just abort itself and refuse to boot.
And recently, CyanogenMod added Cyanogen Platform API.
That additionally adds /system/framework/org.cyanogenmod.platform.jar to the /init.environ.rc's SYSTEMSERVERCLASSPATH.
That breaks other AOSP-forks that doesn't use Cyanogen Platform API.
So those ROM developers have 3 options.
They can..
1. Just go and use Cyanogen Platform API. Undoubtedly, this would be super hard if your ROM is not already based on CyanogenMod.
2. Ask custom kernel developers to release a separate version just for your ROM. Very unlikely.
3. Solution below.
Most elegant solution I ended up so far is patch your Android RunTime(android_art) to just bypass extra SYSTEMSERVERCLASSPATH.
Just go to art/runtime/native/dalvik_system_DexFile.cc.
Around line 380..
Code:
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 3298b46..50aa44c 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -382,14 +382,6 @@ static jbyte IsDexOptNeededInternal(JNIEnv* env, const char* filename,
// Logging of reason for returning kDexoptNeeded or kPatchoatNeeded.
const bool kReasonLogging = true;
- if ((filename == nullptr) || !OS::FileExists(filename)) {
- LOG(ERROR) << "DexFile_isDexOptNeeded file '" << filename << "' does not exist";
- ScopedLocalRef<jclass> fnfe(env, env->FindClass("java/io/FileNotFoundException"));
- const char* message = (filename == nullptr) ? "<empty file name>" : filename;
- env->ThrowNew(fnfe.get(), message);
- return kUpToDate;
- }
-
// Always treat elements of the bootclasspath as up-to-date. The
// fact that code is running at all means that this should be true.
Runtime* runtime = Runtime::Current();
Remove those 7 lines and your ROM will be now compatible with custom kernels targeting CyanogenMod.
(Git style patch is added for 'git am' command. I'd appreciate it if you maintain Git repository, apply that Git patch for authorship.)
The only problem so far would be that this will break compatibility with Xposed, which replaces Android RunTime thus reverting this modification.

How To Guide [SOURCE] ASUS_I005_1-kernel (MacOS / Linux)

WARNING:
This is NOT a custom kernel!​
GPL requires that source is released for Android kernels.
It does not, however, require that the source is tracked.
ROG Phone 5 - Support
www.asus.com
Each release is downloaded, extracted, and added to git in a single repo in order to create a kernel changelog. Some commits may be added to improve building the kernel as a standalone binary. The core functionality and features will remain unchanged.
GitHub - Skywalker-I005/ASUS_I005_1-kernel
Contribute to Skywalker-I005/ASUS_I005_1-kernel development by creating an account on GitHub.
github.com
The IKCONFIG is then pulled from a running device to get the compiler hash
GitHub - Skywalker-I005/llvm-project_asus
Contribute to Skywalker-I005/llvm-project_asus development by creating an account on GitHub.
github.com
The source provided by ASUS is meant to be built as a complete firmware.
Some commits have been added to fix broken links and restore missing code.
The source, as it is provided, does not build without missing components.
There are changes required to use newer versions of LLVM that were already included in the CAF source, but not in the one from Asus.
ANDROID: vmlinux.lds.h: merge compound literal sections · Skywalker-I005/[email protected]
After LLVM rG9e33c096476a ("[ELF] Keep orphan section names (.rodata.foo .text.foo) unchanged if !hasSectionsCommand"), LLD splits compound literals to separate sections with -fdata-secti...
github.com
Code:
commit 210ecf9a8921bccf197372da9a91efb8aa38202f
Author: Sami Tolvanen <[email protected]>
Date: Wed Nov 25 08:44:09 2020 -0800
ANDROID: vmlinux.lds.h: merge compound literal sections
After LLVM rG9e33c096476a ("[ELF] Keep orphan section names
(.rodata.foo .text.foo) unchanged if !hasSectionsCommand"), LLD splits
compound literals to separate sections with -fdata-sections, which
it always enables with LTO. Merge these sections to allow LLVM to be
upgraded.
Bug: 174047799
Change-Id: I858c5fcc48283d5528c1d3e2b2d7a3c72f9e03d6
Link: https://github.com/ClangBuiltLinux/linux/issues/958
Suggested-by: Danny Lin <[email protected]0n.dev>
Suggested-by: Fangrui Song <[email protected]>
Signed-off-by: Sami Tolvanen <[email protected]>
(cherry picked from commit 559c23e691b8d0b25b055ecdf4c07f19c8407794)
(cherry picked from commit 6f7ffcefc7b0ad82dbe0975057ea82b045abe160)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index ef257c136f11..b5c86d85f7b3 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -72,10 +72,10 @@
#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
#define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
#define TEXT_CFI_MAIN .text.[0-9a-zA-Z_]*.cfi
-#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..LPBX*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral*
#define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
-#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]*
-#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
+#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
+#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
#define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
#else
#define TEXT_MAIN .text
The techpack is only a stub and folder layout, but is also missing parts.
For anyone unfamiliar with Asus source, it may not be immediately obvious that there are four additional components that are required.
platform/vendor/qcom/opensource/datarmnet - Unnamed repository; edit this file 'description' to name the repository.
source.codeaurora.org
platform/vendor/qcom/opensource/datarmnet-ext - Unnamed repository; edit this file 'description' to name the repository.
source.codeaurora.org
platform/vendor/opensource/dataipa - Unnamed repository; edit this file 'description' to name the repository.
source.codeaurora.org
platform/vendor/opensource/sched - Unnamed repository; edit this file 'description' to name the repository.
source.codeaurora.org
Techpack for ZS673KS
Being new to Asus devices that use the techpack, I was curious if anyone knows where to find current techpack source with the relevant changes for this device. I have found versions that support other current Asus devices, but they do not include...
forum.xda-developers.com
The modules do collide, but can be built in hybrid fashion to overcome the issues.
Code:
CONFIG_TOUCHSCREEN_ROG=y
CONFIG_TOUCHSCREEN2_ROG=m
Code:
CONFIG_INPUT_SX932X=y
CONFIG_INPUT_SX932X_2ND=m
The easiest method for building the kernel is to make all modules inline (replace m with y).
Modules will still be unable to load on their own, since the signatures and versions may be off. That is why the verification needs to be disabled.
kernel/module.c: safely bypass sig, vermagic, modversion · Skywalker-I005/[email protected]
Contrary to common modifications that disable all checks entirely, we should still verify the integrity of modules that have not been signed by the manufacturer and may be versioned differently. We...
github.com
Code:
commit e009a01e9cf2f0c64a87b84b6986fff01e278b3f
Author: Abandoned Cart <***************@gmail.com>
Date: Thu Sep 16 12:16:03 2021 -0400
kernel/module.c: safely bypass sig, vermagic, modversion
diff --git a/kernel/module.c b/kernel/module.c
index ab50f522b662..b9bbde4ad512 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2925,6 +2925,11 @@ static int module_sig_check(struct load_info *info, int flags)
const char *reason;
const void *mod = info->hdr;
+#ifdef CONFIG_MODULE_FORCE_PASS
+ info->sig_ok = true;
+ return 0;
+#endif
+
/*
* Require flags == 0, as a module with version information
* removed is no longer the module that was signed
@@ -3274,10 +3279,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
err = try_to_force_load(mod, "bad vermagic");
if (err)
return err;
+#ifndef CONFIG_MODULE_FORCE_PASS
} else if (!same_magic(modmagic, vermagic, info->index.vers)) {
pr_err("%s: version magic '%s' should be '%s'\n",
info->name, modmagic, vermagic);
return -ENOEXEC;
+#endif
}
if (!get_modinfo(info, "intree")) {
@@ -3988,11 +3995,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
goto free_copy;
}
err = rewrite_section_headers(info, flags);
if (err)
goto free_copy;
@@ -4199,9 +4201,11 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
pr_debug("finit_module: fd=%d, uargs=%p, flags=%i\n", fd, uargs, flags);
+#ifndef CONFIG_MODULE_FORCE_PASS
if (flags & ~(MODULE_INIT_IGNORE_MODVERSIONS
|MODULE_INIT_IGNORE_VERMAGIC))
return -EINVAL;
+#endif
err = kernel_read_file_from_fd(fd, &hdr, &size, INT_MAX,
READING_MODULE);
Restoring Stock / Rooted Boot Image
Boot / DTBO Images [Root / Stock] - 5 / Pro / Ultimate (NOT S)
These images are NOT built from source. These are the stock images from the firmware provided by Asus that are extracted with payload dumper and uploaded without modification. 18.0840.2202.231 18.0840.2201.226 18.0840.2112.211...
forum.xda-developers.com
Compiling on MacOS (Mojave or lower)
Skywalker-ZS673KS/build at master · Skywalker-I005/Skywalker-ZS673KS
Contribute to Skywalker-I005/Skywalker-ZS673KS development by creating an account on GitHub.
github.com
Custom Kernel Development on MacOS
[Kernel] (Anakin) Skywalker ZS673KS - Stable Gaming [3/31/2022]
This kernel is (just barely a little) experimental. Use at your own risk. Feel free to skip past the first 5 pages when reading over this thread. This kernel assumes a few things about you, the user: 1. You have a ROG Phone 5 2. You have read...
forum.xda-developers.com
Thanks!
This process was probably much easier for the last generation. I have never seen a manufacturer hand over a device without any resources for development.
This time around, it seems they haven't even kept the source updated (or at least updated the page to reflect that it hasn't changed). Hopefully that will change once the device releases in the US.
Post moved to https://forum.xda-developers.com/t/kernel-starkissed-zs673ks.4283585/
Updated to V18.0840.2104.50
Adding the compiler (based on the extracted ikconfig) that Asus used to build the kernel. This will be updated alongside the kernel.
Updated to V18.0840.2104.56
Edit: Apologies to anyone tracking for the delayed notification.
Updated to V18.0840.2106.86
Also adding the newest Magisk patched boot / vendor_ boot combo here, since this is updated for every firmware release.
Updated to V18.0840.2107.151
Rooted images also updated
Moved the stocked and rooted images to AndroidFileHost and their own thread to keep previous versions and make them easier to locate.
No changes for V18.0840.2107.157
Currently a CN exclusive firmware
Adding all of important details from the posts for getting the custom kernel to boot as a tutorial alongside the kernel source. See the second and third posts.
Updated to V18.0840.2109.176
Currently a CN exclusive again
The main repo is freshly rebuilt as a completely stock log, including empty commits. Each commit has been tagged with Asus support as the author. This should allow it to be used for updating custom kernels and tracking version changes completely separate from any custom code.
Hi bro can you check this one?
https://dlcdnets.asus.com/pub/ASUS/ZenFone/ZS673KS/ASUS_I005_1-18.0840.2107.157-kernel-src.tar.gz
Is it installable? How?
Just wanted to fix my wifi bro. The wifi stopped after the update that's why I'm frustrated
TOYOBHUMAX said:
Hi bro can you check this one?
https://dlcdnets.asus.com/pub/ASUS/ZenFone/ZS673KS/ASUS_I005_1-18.0840.2107.157-kernel-src.tar.gz
Is it installable? How?
Click to expand...
Click to collapse
That's source. It can't be installed. You build a kernel with it.
TOYOBHUMAX said:
Just wanted to fix my wifi bro. The wifi stopped after the update that's why I'm frustrated
Click to expand...
Click to collapse
Might want to try a factory reset. If that doesn't work, it may be a hardware issue.

Categories

Resources