Compiling a "custom kernel" for the h420 - LG Spirit Questions & Answers

I'm trying to compile the kernel but either I'm doing something wrong or LG forgot to add a few files. So I contacted LG and they actually responded saying they'll contact the devs to see when they can distribute the fix. When that happens I'll compile it and see if I can add a few lower frequencies because 598mhz min is a battery hog and 200mhz min will probably be more battery-friendly. For now I've added lagfree because it's arguably the best governor and all the other ones that came with the kernel blob (like "balanced") I haven't played with adding I/O schedulers yet, but I will once LG write back. Don't expect much of this because this is my first kernel and I barely have any idea what I am doing other than copy-pasting into the right place because I understand file context and syntax.

Thumbs up, even if I don't use the H420.

Tomo123 said:
Thumbs up, even if I don't use the H420.
Click to expand...
Click to collapse
Don't worry, I'm sure the crazy Russians over at 4pda will unlock the bootloader :good:

TheFagulousFag said:
Don't worry, I'm sure the crazy Russians over at 4pda will unlock the bootloader :good:
Click to expand...
Click to collapse
If you are talking about H420's bootloader, it's already been unlocked. As for the H440N, the guy who unlocked the H420's bootloader says that H440N should use a method similar to Bump. He says aboot can't be patched, sth like that.

Fobos531 said:
If you are talking about H420's bootloader, it's already been unlocked. As for the H440N, the guy who unlocked the H420's bootloader says that H440N should use a method similar to Bump. He says aboot can't be patched, sth like that.
Click to expand...
Click to collapse
If it uses bump can't you use openbump, or did lg patch that?

TheFagulousFag said:
If it uses bump can't you use openbump, or did lg patch that?
Click to expand...
Click to collapse
I don't know, I haven't tried it yet. I'll give it a try and report.
---------- Post added at 05:33 PM ---------- Previous post was at 05:16 PM ----------
Fobos531 said:
I don't know, I haven't tried it yet. I'll give it a try and report.
Click to expand...
Click to collapse
Before I do anything, can I do this?
dump aboot partition ---> use open bump on aboot.img --> trasnfer it back on the device and see if it works. Do I risk my device getting bricked or what? I also saw an abootbak partition.

Well, it would make sense to ask the original Bump dev about the possibility for porting this to H440N. Just send him the aboot.

Fobos531 said:
I don't know, I haven't tried it yet. I'll give it a try and report.
---------- Post added at 05:33 PM ---------- Previous post was at 05:16 PM ----------
Before I do anything, can I do this?
dump aboot partition ---> use open bump on aboot.img --> trasnfer it back on the device and see if it works. Do I risk my device getting bricked or what? I also saw an abootbak partition.
Click to expand...
Click to collapse
Try to bump the recovery instead, just don't forget to make a backup copy.

TheFagulousFag said:
Try to bump the recovery instead, just don't forget to make a backup copy.
Click to expand...
Click to collapse
Bump was tried on our device long ago, but it didnt work.
---------- Post added at 08:12 PM ---------- Previous post was at 08:06 PM ----------
Tomo123 said:
Well, it would make sense to ask the original Bump dev about the possibility for porting this to H440N. Just send him the aboot.
Click to expand...
Click to collapse
Bump as a project is dead if Im right. It surely wont work, because LG made changes in LP bootloader in comparison to KitKat so Bump wont work. Take a thorough look at this thread: http://forum.xda-developers.com/lg-g2/orig-development/tool-bump-sign-boot-images-t2950595
Btw. I have issues registrating on 4pda.ru so I cant yet ask the guy who patched the H420 bootloader why our cant be patched through IDA.

Serious issues.
LG sent me an email saying they fixed it and it was an error in the txt file. Following the instructions, I decided to make a fully untouched stock kernel to see if it would compile. When I run the last command which programs and packs the kernel "make zImage" it errors after literally 4 lines and stops. I decided to ignore errors and forced it. It still fails. I logged the command and sent it to LG. Hopefully they will fix this, I am now even more eager to compile this.

Can someone post all the list of cpu governors, cpu frequencies and default cpu settings for the H420? Maybe I can tweak those to some better values.

Tomo123 said:
Can someone post all the list of cpu governors, cpu frequencies and default cpu settings for the H420? Maybe I can tweak those to some better values.
Click to expand...
Click to collapse
Only hotplug is modiefiable. If you want I could give you the source files.

I would not mind taking a look at those.

Keep in mind it is C code. I'll send you a pm with the files zipped when I get home.

Overclock already defined?
Looking at mtk_cpufreq.c has some interesting stuff, like defined frequencies.
Code:
#define DVFS_F0_1 (1690000) // KHz
#define DVFS_F0_2 (1599000) // KHz
#define DVFS_F0_3 (1495000) // KHz
#define DVFS_F0_4 (1391000) // KHz
#define DVFS_F0 (1300000) // KHz
#define DVFS_F1 (1196000) // KHz
#define DVFS_F1_1 (1092000) // KHz
#define DVFS_F2 (1040000) // KHz
#define DVFS_F2_1 (1001000) // KHz
#define DVFS_F3 ( 747500) // KHz
#define DVFS_F4 ( 598000) // KHz
#if defined(HQA_LV_1_09V)
#define DVFS_V0 (1200) // mV
#define DVFS_V1 (1150) // mV
#define DVFS_V2 (1090) // mV
#define DVFS_V3 (1090) // mV
#elif defined(HQA_NV_1_15V)
#define DVFS_V0 (1260) // mV
#define DVFS_V1 (1200) // mV
#define DVFS_V2 (1150) // mV
#define DVFS_V3 (1050) // mV /*Not used */
#elif defined(HQA_HV_1_21V)
#define DVFS_V0 (1320) // mV
#define DVFS_V1 (1210) // mV
#define DVFS_V2 (1150) // mV /*Not used */
#define DVFS_V3 (1050) // mV /*Not used */
#else /* Normal case */
#define DVFS_V0 (1250) // mV
#define DVFS_V1 (1200) // mV
#ifdef CPUFREQ_SDIO_TRANSFER
#define DVFS_V2_0 (1185) // mV
#endif
#define DVFS_V2 (1150) // mV
#ifdef MT_DVFS_LOW_VOLTAGE_SUPPORT
#define DVFS_V3 (1050) // mV
#endif
#endif
Even though I'm a complete noob at kernel compiling, this seems easy enough for me to try and get it to work at 1.69ghz, which seems a bit overkill actually :laugh:

Related

[Dev]kexec

Okay, let's get the ball rollin on kexec!
I've taken most of the module from the milestone kexec project. I only did some slight tweaks to get it to compile right.
Attached is a kexec module, the source to said module, a patched kexec-tools, and the bin kexec from said patched kexec-tools.
I built this against one of the OC'd transformer kernels. I cheated a bit and changed the .4 to a .3 in Kconfig for the kernel. Other than that, it should be stock. The bottom of the first post here, http://forum.xda-developers.com/showthread.php?t=1095269 , has the source.
I've only tried booting transformer kernels, as I don't really know much about building kernels. I've gotten 3 responses from them, immediate hang (failing on the OC in them?), power down, and reboot(prolly kernel panic on host kernel).
I'm not 100% sure where to go from here.
kexec-mod.zip has the module and the source I used to compile it.
kexec-tools.zip has kexec tools. I didn't clean it before zipping, so it should have the bins still.
Also, I'm using backtrack to compile and run these, so kexec-tools may fail outside of it.
Edit: Please view THIS POST for the latest kexec-mod.
Nice.... I'm with you in the hopes that someone will pick up the ball and start runnin with this....
great step forward....tnx
yess! finally we are one big step closer
I'd really like to try booting the Iconia's kernel, just to see if kexec works right.
Has anyone managed to get inside the boot.img?
heres perl script to unpack the boot.img
Code:
#!/usr/bin/perl -W
use strict;
use bytes;
use File::Path;
die "did not specify boot img file\n" unless $ARGV[0];
my $bootimgfile = $ARGV[0];
my $slurpvar = $/;
undef $/;
open (BOOTIMGFILE, "$bootimgfile") or die "could not open boot img file: $bootimgfile\n";
my $bootimg = <BOOTIMGFILE>;
close BOOTIMGFILE;
$/ = $slurpvar;
# chop off the header
$bootimg = substr($bootimg,2048);
# we'll check how many ramdisks are embedded in this image
my $numfiles = 0;
# we look for the hex 00 00 00 00 1F 8B because we expect some trailing padding zeroes from the kernel or previous ramdisk, followed by 1F 8B (the gzip magic number)
while ($bootimg =~ m/\x00\x00\x00\x00\x1F\x8B/g) {
$numfiles++;
}
if ($numfiles == 0) {
die "Could not find any embedded ramdisk images. Are you sure this is a full boot image?\n";
} elsif ($numfiles > 1) {
die "Found a secondary file after the ramdisk image. According to the spec (mkbootimg.h) this file can exist, but this script is not designed to deal with this scenario.\n";
}
$bootimg =~ /(.*\x00\x00\x00\x00)(\x1F\x8B.*)/s;
my $kernel = $1;
my $ramdisk = $2;
open (KERNELFILE, ">$ARGV[0]-kernel.gz");
print KERNELFILE $kernel or die;
close KERNELFILE;
open (RAMDISKFILE, ">$ARGV[0]-ramdisk.cpio.gz");
print RAMDISKFILE $ramdisk or die;
close RAMDISKFILE;
print "\nkernel written to $ARGV[0]-kernel.gz\nramdisk written to $ARGV[0]-ramdisk.cpio.gz\n";
if (-e "$ARGV[0]-ramdisk") {
rmtree "$ARGV[0]-ramdisk";
print "\nremoved old directory $ARGV[0]-ramdisk\n";
}
mkdir "$ARGV[0]-ramdisk" or die;
chdir "$ARGV[0]-ramdisk" or die;
system ("gunzip -c ../$ARGV[0]-ramdisk.cpio.gz | cpio -i");
print "\nextracted ramdisk contents to directory $ARGV[0]-ramdisk/\n";
/proc/last_kmsg said:
[ $336.932146] -------%----[ cut here ]------------
[ 36.932255]$WARNINGz at /home/amy_chiU/quuofuild/a500omdrr/androiD/{ernel/driv ers/base/core.c:10 deviae_releaqe+0x70/0x84()
[ 336.932419] Device %(null) does not have a releaseh) functikn, iu is broken a nd must be fiXed.
[ s36.932580] Modules linkEd in: iexec_,oaD bcm4329
[ $3s6.932927] [<c0356ec>] (unwind_backtrace+0x0/1xf0) from [<c0067fac>] (warN_s lowpath_commmn+1p4c/0x¶4)
[ 336.933094] [<c0067fac>] (warn_slowpath]com}on+0x4c/0x64) from [4c0068044>] ( warn_slovpauh_fmt+0x2c/0x1c9
[! 336.¹33262U [|c0068044>] (warn_slowp!th_fmt+0x2c/0x3c) from [<c0!f08âc>] (dev ice_rElease+0x70/0X84)
[ $33v.937434]$[,c01æ08bc>] (device_remease+0x70¯0x84) from [=c01a65dc>] (kobjeC t_reluase+px5c?x70)
[ 33.9s76°u] [<c01a65dc~] (kobject_release+0x5c/0x70) from [<k01a74d4.] (kref_p ut+0x44/0X74)
[ 336.933711] [<C01a54d4>] (kref_pud+0|64/0h74) from [<bf044490>] (device_shuTd own+0x28/0x8c`[kexec_loadU)
[ 336.933887] Y<cf044490>U (device_shuTdown+0x28/0x8c [kexec_loadU- from [<bf04 4458>]!(kernel_resta2t_prepare+1x44/0x54(Skexec_load])
[( 336.934085] [<bf04$48>] (kernel_restert_prepare+0x/0x54 [kexea_load]9 from [< bF043098>] (kernel_kexec+0x38/0x68 [kexec_load])
[ 336.934262] [<"f043098>] (kernel_kexec+0x38/0x68 [kexec_load]) from [<bf0443b 8>] (reboot+0x74/0xd0 [kexec_load])
[ 336.934438] [<bf0443b8>] (reboot+0x75/0xe0([kexec_load]) from [<c0032060>] (r et_fast_syscAll+0x0/0x30)
[ efd tsace 237c2b25b258a813 ]---
[ 336.938148] StaRting new Kurjel
[ 336.938356] Bye!
147 Corrected bytes, 167 unrecoverable blocks
Click to expand...
Click to collapse
Damn kurjels.
But, it seems to be trying to boot it. I've updated my kexec to actually use the files it should use(as in, a kernel source that was made in the last 3 years).
How do you repackage the kernel and the initfs in order to kexec it?
huxflux2003 said:
How do you repackage the kernel and the initfs in order to kexec it?
Click to expand...
Click to collapse
Good question. That's what I was hoping I could get some help with. The kernel is still closed-source(illegally, I might add), so it's going to be difficult to get a new one built, and I can almost guarantee that it's outside of my knowledge.
If anyone can come up with anything for me to try booting, I'm all ears.
heres repack script...
DONT TRY TO FLASH IT BACK INTO THE BOOT PARTITION IT WILL BRICK
Code:
#!/usr/bin/perl -W
use strict;
use Cwd;
my $dir = getcwd;
my $usage = "repack-bootimg.pl <kernel> <ramdisk-directory> <outfile>\n";
die $usage unless $ARGV[0] && $ARGV[1] && $ARGV[2];
chdir $ARGV[1] or die "$ARGV[1] $!";
system ("find . | cpio -o -H newc | gzip > $dir/ramdisk-repack.cpio.gz");
chdir $dir or die "$ARGV[1] $!";;
system ("mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel $ARGV[0] --ramdisk ramdisk-repack.cpio.gz -o $ARGV[2]");
unlink("ramdisk-repack.cpio.gz") or die $!;
print "\nrepacked boot image written at $ARGV[1]-repack.img\n";
thanks thor, but i think that since the bootloader is locked what we need is a zimage with init that can be used with kexec, correct?
huxflux2003 said:
thanks thor, but i think that since the bootloader is locked what we need is a zimage with init that can be used with kexec, correct?
Click to expand...
Click to collapse
yes zimage with init script
thor2002ro said:
yes zimage with init script
Click to expand...
Click to collapse
is this possible?
(noobalarm)
yea, but we need some people who know about this stuff to help.
Ok, here is my kexec sources based on 2.6.36
http://www.mediafire.com/?zdzpaui7dd8d6e9
still didn't manage to boot a kexec'ed kernel. Well, a couple times i got it to reboot to a regular kernel from mmc (did watchdog kill us?) but mostly it just freezes.
take a look here - http://wiki.meego.com/ARM/N900/Install/kexec
you need at least http://wiki.meego.com/images/0003-ARM-5886-1-arm-Fix-cpu_proc_fin-for-proc-v7.S-and-ma.patch to make it work.
Also, note the discussion here - ttp://comments.gmane.org/gmane.linux.ports.arm.kernel/75711
looks like we need a different cache invalidation for SMP (multi-processor cpu).
Anyways, I'm gonna make away with iconia and get myself an ac100 or asus xformer.. Partly due to Acer's hostility, partly because life without keyboard sucks.. My plan now is to write a custom implementation of sth like kexec for tegra (like splboot for xperia) from scratch because debugging kexec is quite annoying without a hardware debugger.. Basically it should be as easy as disabling mmu and dcache, but.. Well, need to lurk through the A9 assembly manual.

Need deep sleep values

m trying to port scary governor from DooMLorD's git but it requires some porting so tell me what values should I replace for deep sleep??
Code:
#define DEF_FREQUENCY_UP_THRESHOLD (80)
#define DEF_FREQUENCY_DOWN_THRESHOLD (45)
#define DEFAULT_SLEEP_MAX_FREQ 245760
#define DEFAULT_SLEEP_MIN_FREQ 122880
#define DEFAULT_SLEEP_PREV_FREQ 122880 //This is so that if there are any issues resulting in sleep_prev_freq getting set, there will be a backup freq
#define DEFAULT_PREV_MAX 1024000

Unbricking a new purchase (bought it bricked)

Ok so I just bought an A500 on ebay, and I've done enough unbricking, unlocking, rooting, and flashing to be able to solve most issues I think. I'm 90% sure i can fix this thing too if i can figure out how to get the CPUID from it.
Problem is that it's stuck at the acer logo screen I've been reading about. I'm going through the EUUS tool and need to enter the CPUID which is where I'm stuck. (doing the full reflash through APX mode)
Is there any way to get the CPUID that I havent read about? Most seem to need a bootable tablet. (still reading too so I'll keep up to date)
I've got the serial number off the sd card flap, and I can pull the case open if it's somewhere on one of the boards (doubtful but I thought I'd ask)
update:
currently trying the unsoftbrick through AfterOTA 1.09, it's been on "[2/3] flashing recovery..." for a long time now.... Whenever I've done recovery flashes they never took more than a minute or two
found a possible solution to getting the CPUID and thus the way back into this poor devil here:
http://forum.xda-developers.com/showthread.php?t=1751978
Problem I'm coming up with is during the process of running the compiled script I get "Error: Faled to open device!"
It is a brand new computer, running linux Mint 14 x64
lsusb is showing the device as "0955:7820 NVidia Corp." so i know its being recognized even under APX mode
Pyr0ball said:
Problem I'm coming up with is during the process of running the compiled script I get "Error: Faled to open device!"
Click to expand...
Click to collapse
Are you running as root or have changed the device permissions so that your user are allowed to read/write to the device?
eppeP said:
Are you running as root or have changed the device permissions so that your user are allowed to read/write to the device?
Click to expand...
Click to collapse
I'm running as root (su)
Pyr0ball said:
I'm running as root (su)
Click to expand...
Click to collapse
In that case I don't have any direct ideas...
You can add
Code:
libusb_set_debug(ctx, 3);
between
Code:
libusb_init(&ctx);
and
Code:
dev_handle = libusb_open_device_with_vid_pid(ctx, 0x0955, 0x7820);
and see if that prints any usefull hints.
Otherwise you can try tracing using strace.
eppeP said:
In that case I don't have any direct ideas...
You can add
Code:
libusb_set_debug(ctx, 3);
between
Code:
libusb_init(&ctx);
and
Code:
dev_handle = libusb_open_device_with_vid_pid(ctx, 0x0955, 0x7820);
and see if that prints any usefull hints.
Otherwise you can try tracing using strace.
Click to expand...
Click to collapse
ok I'll give this a try and post the output in a bit
Pyr0ball said:
ok I'll give this a try and post the output in a bit
Click to expand...
Click to collapse
this is what im getting:
Segmentation fault (core dumped)
Just to be sure, this is the code I compiled:
Code:
#include <libusb-1.0/libusb.h>
#include <stdio.h>
#include <stdint.h>
int main(void)
{
unsigned char data[64];
int received_length;
int r = 1;
libusb_context* ctx = NULL;
libusb_set_debug(ctx, 3);
libusb_device_handle* dev_handle = NULL;
libusb_init(&ctx);
dev_handle = libusb_open_device_with_vid_pid(ctx, 0x0955, 0x7820);
if(dev_handle)
{
r = libusb_bulk_transfer(dev_handle, 0x81, data, sizeof(data), &received_length, 10000);
if (r == 0)
{
if(received_length == 8)
{
printf("uid: %#016lx\n", *(uint64_t*)data);
}
else
{
r = 1;
printf("Error: We got %d bytes of data instead of the 8 bytes we expected...\n", received_length);
}
}
else
{
printf("Error: USB read failed!\n");
}
libusb_release_interface(dev_handle, 0);
}
else
{
printf("Error: Failed to open device!\n");
}
libusb_exit(ctx);
return r;
}
Pyr0ball said:
this is what im getting:
Segmentation fault (core dumped)
Just to be sure, this is the code I compiled:
Click to expand...
Click to collapse
Yes, that is to be expected consiedring the change you made.
That is however not the change I told you to make, try to read the part where I described where to add libusb_set_debug line.
is this still alive??? i need help, stuck in the getting the cpuid stage

[FIXED][SOLVED]Errors when compiling kernel

**As this is only for personal learning and not a real developing thread, I didn't create it as DevDB project. Maybe in the future, when I learn how to, at least, handle the basic**
Hi all!
I'm trying to compile the stock EMUI 5.0 kernel for Nova and I'm really new to this. First, I ended up with a bunch of path errors and I already fixed it. Now, I'm having c errors that I can't solve, beside of looking extensively how to.
To the code =)
compiling:
Code:
$ make -j8
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC drivers/usb/gadget/u_f.o
CC drivers/usb/gadget/android.o
CC drivers/usb/gadget/function/f_fs.o
LD drivers/usb/gadget/libcomposite.o
LD drivers/usb/gadget/function/usb_f_fs.o
LD drivers/usb/gadget/function/built-in.o
LD drivers/usb/gadget/g_android.o
LD drivers/usb/gadget/built-in.o
drivers/usb/gadget/g_android.o: In function `alloc_ep_req':
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:18: multiple definition of `alloc_ep_req'
drivers/usb/gadget/libcomposite.o:$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:18: first defined here
drivers/usb/gadget/g_android.o: In function `f_midi_disable':
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/./drivers/usb/gadget/function/f_midi.c:383: multiple definition of `__ksymtab_alloc_ep_req'
drivers/usb/gadget/libcomposite.o:$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/usbstring.c:41: first defined here
make[3]: *** [scripts/Makefile.build:336: drivers/usb/gadget/built-in.o] Error 1
make[2]: *** [scripts/Makefile.build:402: drivers/usb/gadget] Error 2
make[1]: *** [scripts/Makefile.build:402: drivers/usb] Error 2
make: *** [Makefile:955: drivers] Error 2
looking for multiple definitions of "alloc_ep_req":
Code:
$ grep --exclude=*.o -rnw '$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel' -e "alloc_ep_req"
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_hid.c:342: return alloc_ep_req(ep, length, length);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:43:extern struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:206: return alloc_ep_req(ep, length, length);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_loopback.c:299: return alloc_ep_req(ep, len, buflen);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_sourcesink.c:435: return alloc_ep_req(ep, len, buflen);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.h:48:struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:17:struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len)
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:32:EXPORT_SYMBOL_GPL(alloc_ep_req);
looking for multiple definition of "ksymtab_alloc_ep_req" returns nothing.
looking for multiple definition of "f_midi_disabel":
Code:
$ grep --exclude=*.o -rnw '$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel' -e "f_midi_disable"
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:382:static void f_midi_disable(struct usb_function *f)
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:406: f_midi_disable(f);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:984: midi->func.disable = f_midi_disable;
As I can see, there is only one definition of the first function as the only another occurrency rightly do it as "extern" and inside "u_f.h" is the prototype of the function.
Any ideas? Should I upload any file, just ask me =)
Vinnom said:
**As this is only for personal learning and not a real developing thread, I didn't create it as DevDB project. Maybe in the future, when I learn how to, at least, handle the basic**
Click to expand...
Click to collapse
Firstly, you've made the thread in the wrong section . Yes, it's related to development, but it's a question so it should be at Q&A. Well, I've reported it to be moved.
It's nice to see that you've already started to build.
Code:
$ make -j8
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC drivers/usb/gadget/u_f.o
CC drivers/usb/gadget/android.o
CC drivers/usb/gadget/function/f_fs.o
LD drivers/usb/gadget/libcomposite.o
LD drivers/usb/gadget/function/usb_f_fs.o
LD drivers/usb/gadget/function/built-in.o
LD drivers/usb/gadget/g_android.o
LD drivers/usb/gadget/built-in.o
drivers/usb/gadget/g_android.o: In function `alloc_ep_req':
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:18: multiple definition of `alloc_ep_req'
drivers/usb/gadget/libcomposite.o:$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:18: first defined here
drivers/usb/gadget/g_android.o: In function `f_midi_disable':
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/./drivers/usb/gadget/function/f_midi.c:383: multiple definition of `__ksymtab_alloc_ep_req'
drivers/usb/gadget/libcomposite.o:$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/usbstring.c:41: first defined here
make[3]: *** [scripts/Makefile.build:336: drivers/usb/gadget/built-in.o] Error 1
make[2]: *** [scripts/Makefile.build:402: drivers/usb/gadget] Error 2
make[1]: *** [scripts/Makefile.build:402: drivers/usb] Error 2
make: *** [Makefile:955: drivers] Error 2
Click to expand...
Click to collapse
Did you get those errors at the start of compiling? If yes, that's weird because I've tried to compile N kernel myself and I didn't get any error at begin, but rather when it was almost finishing. But I think I've used cm13's defconfig by mistake if I remember properly.
looking for multiple definitions of "alloc_ep_req":
Code:
$ grep --exclude=*.o -rnw '$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel' -e "alloc_ep_req"
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:43:extern struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.h:48:struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/u_f.c:17:struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len)
As I can see, there is only one definition of the first function as the only another occurrency rightly do it as "extern" and inside "u_f.h" is the prototype of the function.
Click to expand...
Click to collapse
If you look at the start of u_f.c, you'll see this:
PHP:
#include "u_f.h"
So, the file where there's a definition of "alloc_ep_req" gets included in the file where's there's already a definition of this.
Try to remove the one from u_f.h. So, remove this line:
PHP:
# I think you have to keep those two lines, I'm not sure:
# struct usb_ep;
# struct usb_request;
struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
Two days ago, I've got a similar error. As you can see there, "LOOKUP_CASE_INSENSITIVE" was being used in a function in fs/f2fs/dir.c, but it wasn't even declared before. I've declared it in include/linux/namei.h (file which gets included in dir.c) and the error has been fixed. By the way, I've took the declaration from cm-13 branch since I've "synced" f2fs with the one from cm13- branch because I was getting too many errors, but I may take a look at it again.
EDIT: The kernel left by Grarak (cm13-0 branch) seems to have "struct usb_request *alloc_ep_req" in both files, u_f.c and u_f.h. I didn't get any such error while building that kernel and that's weird.
looking for multiple definition of "ksymtab_alloc_ep_req" returns nothing.
Click to expand...
Click to collapse
Have you tried to look for it manually?
looking for multiple definition of "f_midi_disabel":
Code:
$ grep --exclude=*.o -rnw '$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel' -e "f_midi_disable"
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:382:static void f_midi_disable(struct usb_function *f)
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:406: f_midi_disable(f);
$HOME/celular/Nova/CAZ_NG_EMUI5.0_opensource/Code_Opensource/kernel/drivers/usb/gadget/function/f_midi.c:984: midi->func.disable = f_midi_disable;
Click to expand...
Click to collapse
I don't know about this one.
The error says only this:
PHP:
drivers/usb/gadget/g_android.o: In function `f_midi_disable':
It doesn't says about multiple definitions of "f_midi_disable".
I didn't know that there's such a command which can tell you if a string/line exists in a file from a folder with many files. Thank you a lot for that!
#Henkate said:
Firstly, you've made the thread in the wrong section . Yes, it's related to development, but it's a question so it should be at Q&A. Well, I've reported it to be moved.
It's nice to see that you've already started to build.
Did you get those errors at the start of compiling? If yes, that's weird because I've tried to compile N kernel myself and I didn't get any error at begin, but rather when it was almost finishing. But I think I've used cm13's defconfig by mistake if I remember properly.
Click to expand...
Click to collapse
thanks for that! I was really confused where I should've posted it.
I got those errors after 5 minutes that it started compiling I think. But to send a more compacted message, I compiled it again, so it displays only the part that fails.
#Henkate said:
If you look at the start of u_f.c, you'll see this:
PHP:
#include "u_f.h"
So, the file where there's a definition of "alloc_ep_req" gets included in the file where's there's already a definition of this.
Try to remove the one from u_f.h. So, remove this line:
PHP:
# I think you have to keep those two lines, I'm not sure:
# struct usb_ep;
# struct usb_request;
struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
Two days ago, I've got a similar error. As you can see there, "LOOKUP_CASE_INSENSITIVE" was being used in a function in fs/f2fs/dir.c, but it wasn't even declared before. I've declared it in include/linux/namei.h (file which gets included in dir.c) and the error has been fixed. By the way, I've took the declaration from cm-13 branch since I've "synced" f2fs with the one from cm13- branch because I was getting too many errors, but I may take a look at it again.
EDIT: The kernel left by Grarak (cm13-0 branch) seems to have "struct usb_request *alloc_ep_req" in both files, u_f.c and u_f.h. I didn't get any such error while building that kernel and that's weird.
Click to expand...
Click to collapse
It is really strange. I looked a lot of stackoverflow threads about this hahahhaha. It is a c compiling error, so it should be possible to solve with c knowledge. I have some of it, really basic you know. Things I learned when searching for a solution:
- Inside a header file should be only the prototype of the function (which is inside u_f.h);
- When declaring a function in another file, it should be declared as extern (which is inside f_midi.c);
So I was really lost when I confirmed that, apparently, everything is right. I'll take a look at grarak's kernel tree so I can compare things.
#Henkate said:
Have you tried to look for it manually?
Click to expand...
Click to collapse
Yeah =/ The grep command was the way I found to show that I didn't found the function.
#Henkate said:
I don't know about this one.
The error says only this:
PHP:
drivers/usb/gadget/g_android.o: In function `f_midi_disable':
It doesn't says about multiple definitions of "f_midi_disable".
Click to expand...
Click to collapse
I looked for f_midi_disable just to be sure. Eliminating the possibilities. The error it says it has is inside the function. But everything seems fine
#Henkate said:
I didn't know that there's such a command which can tell you if a string/line exists in a file from a folder with many files. Thank you a lot for that!
Click to expand...
Click to collapse
grep is really powerful. I don't know all the extent of its usage, but it really helps =P
WOW MAN!
It was a lot easier than I tought! I looked at Grarak's kernel tree and compared. My f_midi.c was including the u_f.c file for some reason, but the correct is to include the u_f.h file. I fixed it and it just finished compiling. I'll mark this as solved.
I don't know why, the compare method didn't even cross my mind. Would take less effort if this idea came to me earlier =)
Thank you very much =)
Vinnom said:
WOW MAN!
It was a lot easier than I tought! I looked at Grarak's kernel tree and compared. My f_midi.c was including the u_f.c file for some reason, but the correct is to include the u_f.h file. I fixed it and it just finished compiling. I'll mark this as solved.
I don't know why, the compare method didn't even cross my mind. Would take less effort if this idea came to me earlier =)
Thank you very much =)
Click to expand...
Click to collapse
That's great!
However, it sounds weird that it fails within/after 5 minutes. What commands did you use to start building?
Did you check "README_Kernel.txt" which is inside the kernel source?
#Henkate said:
That's great!
However, it sounds weird that it fails within/after 5 minutes. What commands did you use to start building?
Did you check "README_Kernel.txt" which is inside the kernel source?
Click to expand...
Click to collapse
I used:
Code:
make nova_defconfig
make menuconfig
make -j8
I renamed our chipset defconfig for nova_defconfig, the menuconfig was to enable lz4 compression support and make -j8 already build the zImage.gz-dtb (-j8 for parallelism, because my cpu supports 8 threads).
Btw, do you know how to compress it with lz4? Lz4 is much better for swiftness than gzip and I'm almost sure that is what keeps us from using superSU, as superSU doesn't support gzip but does lz4
Vinnom said:
Btw, do you know how to compress it with lz4? Lz4 is much better for swiftness than gzip and I'm almost sure that is what keeps us from using superSU, as superSU doesn't support gzip but does lz4
Click to expand...
Click to collapse
I'm sorry for late reply.
1) I'm not sure about lz4, but if I'm not wrong, you have to do changes in defconfig. You can try to search for kernels which are compressed with lz4 and look into their source.
2) How do you know that SuperSU doesn't support gzip? When I google "supersu gzip", it gives some threads/posts where it says:
SuperSU can only work with gzip compressed ramdisks while we have lz4 compressed ones
Click to expand...
Click to collapse
Unfortunately SuperSU can only decompress and tweak gzip compressed ramdisks up to now.
Click to expand...
Click to collapse
#Henkate said:
I'm sorry for late reply.
1) I'm not sure about lz4, but if I'm not wrong, you have to do changes in defconfig. You can try to search for kernels which are compressed with lz4 and look into their source.
Click to expand...
Click to collapse
No need to be sorry
I made some changes but I'm not sure how to set it as default. In any case, I let gzip and lz4 as compatibles compression types.
#Henkate said:
2) How do you know that SuperSU doesn't support gzip? When I google "supersu gzip", it gives some threads/posts where it says:
Click to expand...
Click to collapse
I don't know. I'm sure I read something about this that Chainfire himself wrote, but I may have read wrong. I'll try to search for it again later.
EDIT:
I surely misread what he said. But the latest version of superSu beta includes lz4 compression in the kernel binary, as I read in his G+ post. It says that some huawei specific code was done. I'll test it here and report in his thread if anything goes wrong.

port BlueLightFilter at kernel?

amazing kernel port-er or mode-er are from this section so I post the question at here. I had tried for the past 2 weeks but no luck, so my last resort is to question the genius of xda.
A brief introduction: Samsung stock BlueLightFilter is not using overlay like 3rd part apps, the benefit is it will not get blur when you increase the intensity.
I see no reason why I shouldn't share the thing I already knew to everyone, sharing is caring:
I got some clue to get it working, you have to edit the kernel. I get more specific clue you have to edit the mdnie file
https://forum.xda-developers.com/showpost.php?p=74542731&postcount=327 @BlackMesa123
Which is correct when I check https://forum.xda-developers.com/samsung-a-series/development/advanced-seven-t3509237
https://github.com/jjhitel/ASKernel by @jjhitel it is indeed the mdnie.h, mdnie_lite.c and mdnie_lite_table_A7xe.h that are modified
The code are from G920FXXU5EQAC kernel code, just lucky they spot the same screen size. Not sure how these values are generated:
static unsigned char coordinate_data_2[] = {
0xff, 0xff, 0xff, /* dummy */
0xff, 0xf6, 0xec, /* Tune_1 */
0xff, 0xf7, 0xf0, /* Tune_2 */
0xff, 0xf8, 0xf4, /* Tune_3 */
0xff, 0xf9, 0xed, /* Tune_4 */
0xff, 0xfa, 0xf1, /* Tune_5 */
0xff, 0xfb, 0xf4, /* Tune_6 */
0xff, 0xfc, 0xee, /* Tune_7 */
0xff, 0xfd, 0xf0, /* Tune_8 */
0xff, 0xfe, 0xf4, /* Tune_9 */
};
Advanced Seven rom is the example that someone port it to the rom without blf. But I have no idea what is/are the framework file(s) needed to be modified
I even tried directly take Note 5's mdnie.h, mdnie_lite.c and mdnie_lite_table_ compile and boot with no error but not working.
Then I tried match mdnie_lite_table_noble to my mdnie_lite_table_j7xe.h still boot with no error but not working.
I already added BlueLightFilter apk back but when turn on and off nothing happen.
Here is my device kernel source code
https://github.com/doulcXDA/Nougat-...kernel/drivers/video/exynos/decon_7580/panels
video\exynos\decon_7580\panels\mdnie.h
video\exynos\decon_7580\panels\mdnie_lite.c
video\exynos\decon_7580\panels\mdnie_lite_table_j7xe.h
To sum the question what I want to ask, how to get BlueLightFilter working?
Question is, do both aod and blf need to mod framework.jar to get it working?
I am targeting framework.jar or services.jar but I didn't get anything when compare both jar's smali
Can those godlike experienced master take a look at this for always on display and bluelight filter please?
I have both services.jar and framework.jar from my phone(no blf and aod) and targeting phone(with blf and aod)
services.jar
https://mega.nz/#!LUUVjbxZ!KqP5W7M23PKDt5jhkAiYXjwj1h2IwvGl-cW42u4T6nE
framework.jar
https://mega.nz/#!eU8DWaIb!HEjloERDK91VpNXvYupIdEb4X-7ii-oPKXcp9huf__o
I don't mind alternative approach actually as long as it can filter blue light out like kcal but kcal only support snapdragon not exynos.

Categories

Resources