[Solved] module logger.ko too big - Galaxy Note II, Galaxy S III Developer Discussion

Hi
I compiled my own kernel for I9300 (update 10).
I disabled the logger Android:
in arch/arm/configs/m0_00_defconfig
Code:
- CONFIG_ANDROID_LOGGER=y
+ CONFIG_ANDROID_LOGGER=m
in /drivers/staging/android/Kconfig
Code:
- default n
+ default m
I get a module logger.ko that works perfectly ( with insmod /lib/modules/logger.ko )
The problem is, that module logger.ko have 3,76 MB (3 944 448 bytes)!!!
How can i compile this module with "normal size", 12 KB, more or less
Thank in advance for any help

Rajada said:
Hi
I compiled my own kernel for I9300 (update 10).
I disabled the logger Android:
in arch/arm/configs/m0_00_defconfig
Code:
- CONFIG_ANDROID_LOGGER=y
+ CONFIG_ANDROID_LOGGER=m
in /drivers/staging/android/Kconfig
Code:
- default n
+ default m
I get a module logger.ko that works perfectly ( with insmod /lib/modules/logger.ko )
The problem is, that module logger.ko have 3,76 MB (3 944 448 bytes)!!!
How can i compile this module with "normal size", 12 KB, more or less
Thank in advance for any help
Click to expand...
Click to collapse
You can strip your modules with this command:
Code:
find . -type f -name '*.ko' | xargs -n 1 /path_to_your_toolchain/bin/arm-eabi-strip --strip-unneeded

wanam said:
You can strip your modules with this command:
Code:
find . -type f -name '*.ko' | xargs -n 1 /path_to_your_toolchain/bin/arm-eabi-strip --strip-unneeded
Click to expand...
Click to collapse
fast and deadly
Tested and working. Problem solved
Lots of thanks, grand master of flash

Related

How to fix Microphone low sensetivity (Superpad as example)

Hi,
I've searched a lot and nothing found as solution for my Superpad device so below something like solution.
In example below I'm using Superpad Chinese pad, sure some of this action could be applied to any other android devices.
If you experienced with silent mic problem in android system, you can perform fix in few ways (sure only for rooted device):
1. Way to fix through alsa. Launch terminal and type:
Code:
$ su
- find your input device, for that execute next command
Code:
# alsa_amixer cget numid=3
try numid value from 1 till you will see your input device or message that device doesn't exist
for example my respond:
Code:
numid=3,iface=MIXER,name='Input Volume'
; type=INTEGER,access=rw------,values=2,min=0,max=512,step=0
; values=488,488
- if values is less than max (in example 488<512) then you can continue, type next in console
Code:
# alsa_amixer cset numid=3 512,512
Code:
numid=3,iface=MIXER,name='Input Volume'
; type=INTEGER,access=rw------,values=2,min=0,max=512,step=0
; values=512,512
Settings will be applied till next reboot, after reboot you will execute it by hands again (I found no way to start it automatically at system boot).
So before reboot you can perform:
Code:
# alsa_ctl store
After reboot you can restore:
Code:
# alsa_ctl restore
2. Another way through audio device registers. This way is different for each audio device and should performed accordingly to chip documentation. For example for chip WM8987 (which is used in Superpad).
Microphone boost configuration are stored in the 5,4 bits of 0x20 register (left channel, 0x21 right channel in my device unusable). Configuration of input lines stored in 7,6 bits the same register.
Code:
$ su
- to see current settings perform next
Code:
# cat /proc/driver/audregs
in response you will see current settings;
- from chip datasheet:
Code:
5:4 bit | boost | hex
00 | off | c0
01 | 13dB | d
10 | 20dB | e0
11 | 29dB | f0
- write this registers into devices, for example for 29dB (mix will be little bit noisy so you can try 20dB) boost:
Code:
# echo 0x20 0xf0 > /proc/driver/audregs
- for autostart create XXmicfix (where XX - any unique number) file inside /etc/init.d with next text inside:
Code:
#!/system/bin/sh
echo 0x20 0xf0 > /proc/driver/audregs
Hope this will be helpful,
That's all.

Getting Working Wifi for Kernel builds

I have been buliding some kernels recently, but have been unable to get the wifi working.
I have tried it having the modules included in initramfs/lib/modules when ramdisk is created and i do mkbootimg, and have also tried just putting all the modules in the flash zip in /system/lib/modules, and excluded it from build process. Both result in no Wifi [Edit, putting the newly built correct modules in my working folders /lib/modules fixed wifi, must not have done it correctly before)
basic overview of what I've done (after zImage compile)
I use "./unpack-bootimg.pl boot.img" to pull the "ramdisk-contents" from the stock kernel, I renamed that folder "initramfs" and threw it in a folder along with my mkbootimg binary, and my zImage I just compiled.
I put the newly created modules from zImage build in my initramfs/libs/modules with
find -name '*.ko' -exec cp -av {} [path to desired folder] \;
I navigate to the initramfs folder and
find .|cpio -o -H newc > ../ramdisk
cd ..
gzip ramdisk
./mkbootimg --kernel ./zImage --ramdisk ./ramdisk.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o boot.img
the resultant boot.img boots fine and shows all other changes, just cant seem to get the wifi working. Anyone have idea for getting wifi working on our Note 2 kernel builds?
Edit: I re-tried and this time it worked. Not sure what was different. Copied the newly created modules into my ramdisk folder (for me was /initramfs/lib/modules) and created my ramdisk.gz etc. made the boot.img and it's all good. The difference must've been having the correct modules in place prior to creating the ramdisk.cpio(then .cpio.gz).
Mods please move if you feel this is in wrong section now etc. Found the answer, thank you
It's only in the wrong section if you don't share what you did wrong, and how you fixed it.
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.
Using the sbin's insmod gives me this:
Code:
[[email protected] android]$adb shell
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/dhd.ko
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|[email protected]:/ # busybox insmod /system/lib/modules/dhd.ko
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|[email protected]:/ #
I've turned off module versioning, and am not sure why there's a symbol error.
Droidzone said:
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.
Using the sbin's insmod gives me this:
Code:
[[email protected] android]$adb shell
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/dhd.ko
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|[email protected]:/ # busybox insmod /system/lib/modules/dhd.ko
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|[email protected]:/ #
I've turned off module versioning, and am not sure why there's a symbol error.
Click to expand...
Click to collapse
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
I fixed that issue..
The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.
However the inability to load the module persists.
My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".
This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.
dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '
EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.
Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory
Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.
I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.
EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:
Code:
[[email protected] kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42: addis r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43: lwz r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39: seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40: or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149: "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104: "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565: if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
/* ignore __this_module, it will be resolved shortly */
if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
return 1;
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
return 1;
Edit3: Solved.
AndreiLux said:
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
Click to expand...
Click to collapse
I'd like to thank you for this information - this cut my dhd.ko from 4.6 MB to around 550 kB - and my resulting kernel as a result. Fully expect this will now get my kernel working as it should.
Droidzone said:
I fixed that issue..
The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.
However the inability to load the module persists.
My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".
This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.
dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '
EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.
Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory
Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.
I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.
EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:
Code:
[[email protected] kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42: addis r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43: lwz r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39: seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40: or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149: "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104: "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565: if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
/* ignore __this_module, it will be resolved shortly */
if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
return 1;
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
return 1;
Edit3: Solved.
Click to expand...
Click to collapse
How to Solved? Too detailed can you tell us a little bit?
wctliu said:
How to Solved? Too detailed can you tell us a little bit?
Click to expand...
Click to collapse
Used another toolchain.
Droidzone said:
Used another toolchain.
Click to expand...
Click to collapse
another toolchain????
Which version?
I uesd these:
/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-
Which will cause the problem to occur?
wctliu said:
another toolchain????
Which version?
I uesd these:
/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-
Which will cause the problem to occur?
Click to expand...
Click to collapse
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi
Sent from my SPH-L900 using xda premium
sleshepic said:
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi
Sent from my SPH-L900 using xda premium
Click to expand...
Click to collapse
YES i do it .
you can see this:
http://forum.xda-developers.com/showthread.php?t=2193358
and now, it's no wifi no exfat.
AndreiLux said:
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
Click to expand...
Click to collapse
That is correct, the OS does pass parameters to the module when loading.
An example (from CM) can be seen at: https://github.com/CyanogenMod/andr...common/blob/cm-10.1/BoardCommonConfig.mk#L122
I cannot get Wifi to work either. I have the same exact problem as Droidzone with the "_GLOBAL_OFFSET_TABLE_" error.
I have checked that:
"LDFLAGS_MODULE = --strip-debug" is set in Makefile.
I'm using the 4.7 toolchain, but just tried the 4.6 to no avail.
Any help would be much appreciated.
Update: I was able to get it working by using CFLAGS_MODULE=-fno-pic as suggested in this guide.
Solved
I was running in the same issues. I solved my problem adding these to my kernel makefile:
LDFLAGS_MODULE = --strip-debug
CFLAGS_MODULE = -fno-pic
forfivo said:
I was running in the same issues. I solved my problem adding these to my kernel makefile:
LDFLAGS_MODULE = --strip-debug
CFLAGS_MODULE = -fno-pic
Click to expand...
Click to collapse
There must be something else goin on in my setup as this does not work for me to getting working WiFi. What is your build process?
Edit: or if you wouldn't mind shoot in me your kernel I'd be interested if it something small I'm missing like updater script etc
Edit2: I feel sometimes in android doing the same thing twice results in separate results. Crazy thx
Hey sorry to bump this. Not sure if anyone still remembers I have the same problem with my GT-B5330.
Even though I set in my kernel/Makefile :
CFLAGS_MODULE = -fno-pic
LDFLAGS_MODULE = --strip-debug
After building the kernel from source I get the dhd.ko file, copy it to ramdisk/lib/modules and then repack it with the zimage generated by the build.
Then i dd the newly created boot.img to the kernel partition.
lsmod doesnt show dhd.ko
and the file exists in system/lib/modules/dhd.ko
Toolchain arm-eabi-4.6
DroidFreak32 said:
Hey sorry to bump this. Not sure if anyone still remembers I have the same problem with my GT-B5330.
Even though I set in my kernel/Makefile :
CFLAGS_MODULE = -fno-pic
LDFLAGS_MODULE = --strip-debug
After building the kernel from source I get the dhd.ko file, copy it to ramdisk/lib/modules and then repack it with the zimage generated by the build.
Then i dd the newly created boot.img to the kernel partition.
lsmod doesnt show dhd.ko
and the file exists in system/lib/modules/dhd.ko
Toolchain arm-eabi-4.6
Click to expand...
Click to collapse
Are you able to test manually starting using insmod? If so, what is the result?
garwynn said:
Are you able to test manually starting using insmod? If so, what is the result?
Click to expand...
Click to collapse
I cannot insmod the module I get : /system/lib/module/dhd.ko invalid argument
DroidFreak32 said:
I cannot insmod the module I get : /system/lib/module/dhd.ko invalid argument
Click to expand...
Click to collapse
Can't get to my Linux env at the moment, but will follow up on this. Might even see if someone is willing to test for me.
garwynn said:
Can't get to my Linux env at the moment, but will follow up on this. Might even see if someone is willing to test for me.
Click to expand...
Click to collapse
Thanks man
Also I forgot to mention I use arm eabi 4.4.3 if that matters.

[TOOLS] MTKIMG : Unpack / Repack boot.img, recovery.img and logo.bin for MTK device

Hello,
For a personal project a write a simple tools to unpack/repack boot.img, recovery.img and logo.bin of Mediatek cpu based devices named MTKIMG. MTK add specific header on each blocs in image so common tools could not unpack/repack properly. Also every tools i found do not correspond to my need.
Here is the the MTKIMG characteristics :
Write in C, open-source.
Portable : Linux, Cygwin, Windows (MAC is currently under port).
Only one executable for unpack/repack.
Support unpack/repack boot.img and recovery.img.
Support unpack/repack logo.bin
Keep the original image size at repack time.
Handle kernel and ramdisk with or without MTK header.
Automatic ramdisk decompression.
Option to keep or remove MTK headers.
Check for valid "ARM Linux zImage" kernel.
Check for valid "GZIP" ramdisk.
Check for overflow if kernel or ramdisk is too big at repack time.
Option to set compression rate for ramdisk.
Easy to use, all parameters are defaulted.
Easy to build on every platform.
Got simple test-suite.
Documentation available.
Version :
Status : Bêta
Version : 0.44
Update : 2015/07/20
Source code :
https://github.com/rom1nux/mtkimg
Releases (Linux, Cygwin, Windows) :
https://github.com/rom1nux/mtkimg/tree/master/releases
OSX version are currently under port (Please, thanks sambwel)
Hope this help (Sorry for my bad english)
Hi
Did you used anything from @carliv or @bgcngm projects ( source / binarys ) ?
Or is this a full new project?
Since you didn't added any source link,,, (github / bitbucket ?)
cheers
Hello superdragonpt,
Did you used anything from @carliv or @bgcngm projects ( source / binarys ) ?
Click to expand...
Click to collapse
MTKIMG is write in C from scratch. I do not use anything other than "find", "gzip" and "cpio" utilities.
I know bgcngm's pearl scripts (mtk-tools) but it does not fit my needs.
I dont know carliv's bash scripts , i dont know if it support MTK header bloc.
Or is this a full new project?
Click to expand...
Click to collapse
Yes it's a full new project, It's write MTKIMG for my need first, but i told myself that it could help other.
Since you didn't added any source link,,, (github / bitbucket ?)
Click to expand...
Click to collapse
If MTKIMG got interests i probably create git repo.
Thanks for your remarks
rom1nux said:
Hello superdragonpt,
MTKIMG is write in C from scratch. I do not use anything other than "find", "gzip" and "cpio" utilities.
I know bgcngm's pearl scripts (mtk-tools) but it does not fit my needs.
I dont know carliv's bash scripts , i dont know if it support MTK header bloc.
Yes it's a full new project, It's write MTKIMG for my need first, but i told myself that it could help other.
If MTKIMG got interests i probably create git repo.
Thanks for your remarks
Click to expand...
Click to collapse
Thanks for answering
I have some MTK devices here, i'll test this tool Compatibility across the Mtk SoC's i own.
Keep it up
Cheers
I have some MTK devices here, i'll test this tool Compatibility across the Mtk SoC's i own.
Click to expand...
Click to collapse
Good news !
For information i put source code under GPL3 license and i create a dedicated GiHub repository as you suggest : https://github.com/rom1nux/mtkimg
Feel free to come to help
Good Work Mate ....looking forward to it
edit : any 32 bit system tool ??
Hello [email protected],
Thank for your interest.
edit : any 32 bit system tool ??
Click to expand...
Click to collapse
I got only 64bits OS but i can install Cygwin32 and VirtualBox 32 bits OS if needed but it's very easy to build.
Hello,
I test MTKIMG and it work well, but now i search information about MTK logo partition format, i see the MTK header on it but dont know how to parse images.
More preciselly i want to know information about header of the logo partition (like size of image, etc...) the header after the MTK header.
Did you have this kind of information ?
Thank in advance
Hello,
I find some information about logo.bin image :
- The first 512 bytes are the MTK header Magic (0x88168858) + Size + "LOGO"
- After, i found logo partition header is formated like :
Code:
Offset (B) | Size (B) | Description
--------------------------------------------------------
0 | 4 | Logos count
4 | 4 | Size of bloc (=MTK header image size)
8 | 4 | Logo_0 offset
12 | 4 | Logo_1 offset
8+(n*4) | 4 | Logo_n offset
... | ... | ?
--------------------------------------------------------
Logo_0 offset | Logo_1-Logo_0 offset | Logo_0 gzip content
Logo_1 offset | Logo_2-Logo_3 offset | Logo_1 gzip content
... | ... | Logo_n gzip content
--------------------------------------------------------
I dont know how to find the size of each logo, did you have this information ?
This looks great. I would love to be able to run this on my Mac. I don't think it should be hard to get it working but I'm not familiar with C so I don't know what to change to make it build. Let me know what I can do to help!
Hello sambwel,
I would love to be able to run this on my Mac. I don't think it should be hard to get it working but I'm not familiar with C so I don't know what to change to make it build. Let me know what I can do to help!
Click to expand...
Click to collapse
Happy to read this
You only need "gcc" and "make" for instance (i found this on the web) :
Installing recent XCode versions confusingly enough does not automatically install the command line tools. To install the command line tools when they're not automatically installed;
Start XCode.
Go to XCode/Preferences.
Click the "Downloads" tab.
Click "Components".
Click "Install" on the command line tools line.
That will install the command line tools and make them accessible from a regular command line.
Click to expand...
Click to collapse
Be sure gcc and make are in your PATH environment variable, and after, open a terminal on your MAC in the source folder and hit command :
Code:
make
If you get "Unsupported platform" message it's a good news, i'm going to do minor correction to the source code for this error after lunch. (Put your building log here if you want)
Thanks for your help
No worries mate, familiar with linux and building things from source, just not familiar with C code Here's the output when I try make:
Code:
sambwel:mtkimg sambwel$ make
MTKIMG LINUX MAKE by rom1nux
Create directory build ...
Building C file build/info.o ...
gcc -c -Wall src/info.c -o build/info.o
In file included from src/info.h:34,
from src/info.c:24:
src/main.h:51:3: warning: #warning "Unsupported platform !"
Building C file build/main.o ...
gcc -c -Wall src/main.c -o build/main.o
In file included from src/main.c:24:
src/main.h:51:3: warning: #warning "Unsupported platform !"
src/main.c: In function ‘main’:
src/main.c:54: error: ‘APP_PLATFORM’ undeclared (first use in this function)
src/main.c:54: error: (Each undeclared identifier is reported only once
src/main.c:54: error: for each function it appears in.)
make: *** [build/main.o] Error 1
Hello sambwel
sambwel said:
No worries mate, familiar with linux and building things from source
Click to expand...
Click to collapse
Cool, good new, I know nothing about MAC
sambwel said:
..., just not familiar with C code Here's the output when I try make:
Click to expand...
Click to collapse
OK, i'm going to add MAC platform specifics to main.h this afternoon (I have not been able to do yesterday, sorry).
I tell you when i the modification is done.
Thanks a lot for your help
superdragonpt said:
Thanks for answering
I have some MTK devices here, i'll test this tool Compatibility across the Mtk SoC's i own.
Keep it up
Cheers
Click to expand...
Click to collapse
I made a similar simple script in dash format that should work on device:
Code:
#!/sbin/sh
bootonetofive() {
busybox dd if=${1}.img of=1 bs=512 count=4 conv=notrunc
busybox dd if=${1}.img of=${1}-header bs=512 skip=4 conv=notrunc
busybox dd if=${1}-header of=2 bs=512 count=1 conv=notrunc
busybox dd if=${1}-header of=${1}-header-k_header bs=512 skip=1 conv=notrunc
initrd=`hexdump -C ${1}-header-k_header | grep -m1 "ROOTFS" | cut -d " " -f 1`
if [ -z ${initrd} ]; then
initrd=`hexdump -C ${1}-header-k_header | grep -m1 "RECOVERY" | cut -d " " -f 1`
FLSH=recovery
fi
initrdbin=`printf "%d\n" 0x${initrd}`
intrdsec=`expr ${initrdbin} / 512`
busybox dd if=${1}-header-k_header of=3 bs=512 count="${intrdsec}" conv=notrunc
busybox dd if=${1}-header-k_header of=${1}-header-k_header-kernel bs=512 skip="${intrdsec}" conv=notrunc
busybox dd if=${1}-header-k_header-kernel of=4 bs=512 count=1 conv=notrunc
busybox dd if=${1}-header-k_header-kernel of=5 bs=512 skip=1 conv=notrunc
}
AddPadd() {
if [ ${krnsz} != ${nwkrnsz} ]; then
krnsz=`du -B 1 3 | cut -f 1`
nwkrnsz=`du -B 1 3-new | cut -f 1`
if [ ${krnsz} -gt ${nwkrnsz} ]; then
pddng=`expr ${krnsz} - ${nwkrnsz}`
busybox dd if=/dev/zero of=padd bs=1 count=${pddng} conv=notrunc
cat padd >> 3-new
else
nwsz=`expr ${nwkrnsz} / 512 + 1`
busybox dd if=/dev/zero of=3 bs=512 count="${nwsz}" conv=notrunc
fi
AddPadd
else
echo "kernels are already the same size"
exit 0
fi
if [ ${pddng:-0} != "0" ]; then
if [ ${nwsz:-0} != "0" ]; then
echo "new kernel is larger"
else
echo "kernels are now the same size"
fi
exit 0
fi
}
addserialno() {
printf "androidboot.serialno=" > serno
dd if=/dev/block/mmcblk0p1 of=barcode bs=16 count=1
cat serno barcode > serialno
dd if=1 of=1_1 bs=16 count=7
dd if=1 of=1_2 bs=16 skip=7
dd if=1_2 of=1_3 bs=1 skip=37
cat 1_1 serialno 1_3 > 1_new
}
unpackramd() {
mkdir work 2> /dev/null
cd work
busybox gzip -dc ../5 2> /dev/null | cpio -i 2> /dev/null
cd ${crdr}
}
repackramd() {
cd work
find . | cpio -o -H newc 2> /dev/null | gzip -9 > ../5-new 2> /dev/null
rm -rf *
cd ${crdr}
}
bootfivetoone() {
cat 1 2 3 4 5 > new-${1:-boot}.img
}
crdr=`pwd`
bootonetofive ${1:-boot}
rm ${1:-boot}-*
if [ -f 3-new ]; then
AddPadd
cp 3-new 3
fi
if [ ${2:-NA} = "split" ]; then
unpackramd
echo "modify what you need to in ${crdr}/work then"
echo "press enter y to continue or any key to exit"
read cntn
if [ ${cntn:-n} = "y" ]; then
repackramd
cp 5-new 5
else
exit 0
fi
fi
if [ ${2-NA} = "serial" ]; then
addserialno
cp 1_new 1
fi
bootfivetoone ${1:-boot}
echo "All Done new .img created... ${crdr}/new-${1:-boot}.img"
# 1 header
# 2 k_header
# 3 kernel
# 4 r-header
# 5 ramdisk
FLSHPRT=`ls -la /dev/block/platform/mtk-msdc.0/by-name | grep ${FLSH:-boot} | awk -F " " '{print $NF}'`
if [ ${2:-no} = "flash" ]; then
dd if=${crdr}/new-${1:-boot}.img of=/dev/block/${FLSHPRT}
fi
Attached as a txt.
It just needs busybox installed. Only used it with the new MT6732/52 SoCs. I could use someone testing it with others to see if it's universal. (Only setup for gzipped ramdisks, should be able to add in the others.)
To run it is for example.
sh ./splitboot.sh boot split to split boot.img (and open ramdisk)
sh ./splitboot.sh boot flash to flash boot.img
sh ./splitboot.sh boot serial to take the barcode value from proinfo partition and uses it as serial number (only seems to work with AOSP)
It works with *.img and automatically identifies if it's a boot or recovery img.
HypoTurtle said:
I made a similar simple script in dash format that should work on device:
Code:
#!/sbin/sh
bootonetofive() {
busybox dd if=${1}.img of=1 bs=512 count=4 conv=notrunc
busybox dd if=${1}.img of=${1}-header bs=512 skip=4 conv=notrunc
busybox dd if=${1}-header of=2 bs=512 count=1 conv=notrunc
busybox dd if=${1}-header of=${1}-header-k_header bs=512 skip=1 conv=notrunc
initrd=`hexdump -C ${1}-header-k_header | grep -m1 "ROOTFS" | cut -d " " -f 1`
if [ -z ${initrd} ]; then
initrd=`hexdump -C ${1}-header-k_header | grep -m1 "RECOVERY" | cut -d " " -f 1`
FLSH=recovery
fi
initrdbin=`printf "%d\n" 0x${initrd}`
intrdsec=`expr ${initrdbin} / 512`
busybox dd if=${1}-header-k_header of=3 bs=512 count="${intrdsec}" conv=notrunc
busybox dd if=${1}-header-k_header of=${1}-header-k_header-kernel bs=512 skip="${intrdsec}" conv=notrunc
busybox dd if=${1}-header-k_header-kernel of=4 bs=512 count=1 conv=notrunc
busybox dd if=${1}-header-k_header-kernel of=5 bs=512 skip=1 conv=notrunc
}
AddPadd() {
if [ ${krnsz} != ${nwkrnsz} ]; then
krnsz=`du -B 1 3 | cut -f 1`
nwkrnsz=`du -B 1 3-new | cut -f 1`
if [ ${krnsz} -gt ${nwkrnsz} ]; then
pddng=`expr ${krnsz} - ${nwkrnsz}`
busybox dd if=/dev/zero of=padd bs=1 count=${pddng} conv=notrunc
cat padd >> 3-new
else
nwsz=`expr ${nwkrnsz} / 512 + 1`
busybox dd if=/dev/zero of=3 bs=512 count="${nwsz}" conv=notrunc
fi
AddPadd
else
echo "kernels are already the same size"
exit 0
fi
if [ ${pddng:-0} != "0" ]; then
if [ ${nwsz:-0} != "0" ]; then
echo "new kernel is larger"
else
echo "kernels are now the same size"
fi
exit 0
fi
}
addserialno() {
printf "androidboot.serialno=" > serno
dd if=/dev/block/mmcblk0p1 of=barcode bs=16 count=1
cat serno barcode > serialno
dd if=1 of=1_1 bs=16 count=7
dd if=1 of=1_2 bs=16 skip=7
dd if=1_2 of=1_3 bs=1 skip=37
cat 1_1 serialno 1_3 > 1_new
}
unpackramd() {
mkdir work 2> /dev/null
cd work
busybox gzip -dc ../5 2> /dev/null | cpio -i 2> /dev/null
cd ${crdr}
}
repackramd() {
cd work
find . | cpio -o -H newc 2> /dev/null | gzip -9 > ../5-new 2> /dev/null
rm -rf *
cd ${crdr}
}
bootfivetoone() {
cat 1 2 3 4 5 > new-${1:-boot}.img
}
crdr=`pwd`
bootonetofive ${1:-boot}
rm ${1:-boot}-*
if [ -f 3-new ]; then
AddPadd
cp 3-new 3
fi
if [ ${2:-NA} = "split" ]; then
unpackramd
echo "modify what you need to in ${crdr}/work then"
echo "press enter y to continue or any key to exit"
read cntn
if [ ${cntn:-n} = "y" ]; then
repackramd
cp 5-new 5
else
exit 0
fi
fi
if [ ${2-NA} = "serial" ]; then
addserialno
cp 1_new 1
fi
bootfivetoone ${1:-boot}
echo "All Done new .img created... ${crdr}/new-${1:-boot}.img"
# 1 header
# 2 k_header
# 3 kernel
# 4 r-header
# 5 ramdisk
FLSHPRT=`ls -la /dev/block/platform/mtk-msdc.0/by-name | grep ${FLSH:-boot} | awk -F " " '{print $NF}'`
if [ ${2:-no} = "flash" ]; then
dd if=${crdr}/new-${1:-boot}.img of=/dev/block/${FLSHPRT}
fi
Attached as a txt.
It just needs busybox installed. Only used it with the new MT6732/52 SoCs. I could use someone testing it with others to see if it's universal.
To run it is for example.
sh ./splitboot.sh boot split to split boot.img (and open ramdisk)
sh ./splitboot.sh boot flash to flash boot.img
sh ./splitboot.sh boot serial to take the barcode value from proinfo partition and uses it as serial number (only seems to work with AOSP)
It works with *.img and automatically identifies if it's a boot or recovery img.
Click to expand...
Click to collapse
Good
But for those SoC, we use the inbuilt tool.
(not for general public)
So yours and this one, is always good alternative
cheers
Hello
So yours and this one, is always good alternative
Click to expand...
Click to collapse
Yes good alternative, i take look when i can, but HypoTurtle you should probably create a dedicated thread for your tools.
sambwel,
Normally we just have to adjust "main.h" and "Makefile" for porting to OSX platform.
(I put notes in the files headers)
main.h
I add 'define' test to detect OSX platform (APP_PLATFORM/APP_OSX). I don't know if this work. I leave the APP_ARCH (32/64bits) test as-it but i don't know if this work on OSX (it's not very important for now, we can correct after)
Makefile
I add "Darwin" detection mechanism for OSX.
I start to add options to unpack/repack logo.bin, this use "zlib" and "libpng1.6", you can disable this to don't be bother with externals dependencies. In Makefile, put LOGO_SUPPORT=0 in the LINUX/CYGWIN/OSX section (Line ~92) for first build.
Big Thanks for your help
Okay, good news! mtkimg builds and runs now! I did have to put LOGO_SUPPORT=0 in the Makefile otherwise I get the error "error: png.h: No such file or directory".
So I did a quick test to see if it works. info and unpack seem to work correctly (tested on ~7mb stock boot.img). However when I repack the same image the result is a ~4.3gb boot.img!! Not sure what happened... headers are intact on the new image. No more time to test right now but I will check back here soon.
Hip Ha ! Good news !
For the size, look at the "image.cfg" if the size is right
You can use '-v' and '-d' options to see what append and look at the "layout" part display on the screen.
(Suspect image.cfg not being read correctly, i'm goind to look about "End of line" on MAC.
Many thanks for your try
Hello,
I push the MTKIMG Bêta 0.38 with compiled version for (Linux64,Cygwin64 and Windows64) that support logo unpacking. (logo repack in progres...)
Have fun.....

LEAGOO Shark 1 - Development & Support

In order to keep this thread clean, please use this one to discuss about Development, Support or Software Updates.​
ROMs:
Custom ROMs (based on Android 5.1)
AOSP-like 5.1 ROM - by GearLabs: https://mega.nz/#!lBtSBaDC!Jh1PXA_jEn8ynrISB8GeupVn-lJbHTlHtozhggb3UOg
Features:
- Clean Nexus-Like UI (get rid of the LEAGOO OS)
- Updated Google Apps (and most of them replace crappy Mediatek ones)
- Optimized for Maximum Performance
- with Root, Busybox & init.d support
What you'll lose compared to LEAGOO OS? (missing features)
- Miravision Menu
If you notice something else that is missing, just let me know.
Flashable Touchscreen Delay Fix: http://forum.xda-developers.com/attachment.php?attachmentid=3823450&d=1469457127​
Stock (Android 6.0)
160729: https://yadi.sk/d/tPz_sgnRtyqdA (Thanks @seraser for the report)
Stock (Android 5.1)
160712: https://mega.nz/#!UBFTzILY!Ympxl5aTRg1x5cAeEha12XgLHxXZ_kYPKDuYvlZUpIo
Previous Releases:
160620: https://yadi.sk/d/fp5sDnfJsvHve | Mirror
160530 (official): http://leagooftp.com.my/Shark 1/t87...10_LEAGOO_Shark_1_OS1.2_160530_release.tar.gz | Mirror
Flash Tools:
SP Flash Tool v5.1628 for Windows & Linux: https://mega.nz/#F!dYUm0TbB!SWeMLb5Wu1NbRzTPQ8-s_A
Flash Tool with Drivers provided by LEAGOO (Windows Only): http://leagooftp.com.my/Flashtool Elite Series, Shark 1/Flashtool Elite series, Shark 1.rar | Mirror
Choose the one that works better for you.
Recovery:
TWRP 3.0.2-1 - by GearLabs: https://mega.nz/#!9UsUXDJZ!b3-LhR8FfXpo9mPoN-vXxreVkMtJU0c1Y0_AGsPilvg
Previous Releases:
TWRP 3.0.0 - by @megthebest (buggy and outdated): https://mega.nz/#!0A8AlK7Y!yVXgeQksrVTe83IGQZdEY2FPC1dHmyvtcdpRmDtOPgE
Root:
SuperSU (flashable using TWRP): http://forum.xda-developers.com/apps/supersu
Extras (Root-Only):
Xposed Framework: http://forum.xda-developers.com/showthread.php?t=3034811
Useful Third-Party Apps:
Battery Life
Amplify: https://play.google.com/store/apps/details?id=com.ryansteckler.nlpunbounce&hl=en
Greenify: https://play.google.com/store/apps/details?id=com.oasisfeng.greenify&hl=en
Alberto96 said:
....... As soon as I have more time, I'll work on a CM ROM for this device.
Click to expand...
Click to collapse
Allready working on CM ROM?
I allways thought, CM is not possible for Mediatek Devices, because of Mediatek not opening Sources for its SoCs?
And also Leagoo doesnt seem to be very helpfull with CustomROMs.....
Robot12 said:
Allready working on CM ROM?
I allways thought, CM is not possible for Mediatek Devices, because of Mediatek not opening Sources for its SoCs?
And also Leagoo doesnt seem to be very helpfull with CustomROMs.....
Click to expand...
Click to collapse
Not yet, without kernel sources it will be hard.
Alberto96 said:
Not yet, without kernel sources it will be hard.
Click to expand...
Click to collapse
If I'm not wrong, you can use @bluefame CM12.1 sources for Elephone P8000, same SoC. Just need to change to our device parameters.
Btw, I dunno if the fact that Shark has 32bit Rom affects anything.
Sent from my s3 using Tapatalk
TWRP 3.0 for 160620 firmware
Hello guys,
I have flashed the full 160620 firmware as the OTA didn't work in my phone, even after exchanging TWRP with the stock recovery.
The Leagoo OTAs doesn't come as zip files so they can't be installed from TWRP either.
Now on 160620 fw I can't install TWRP 3.0.0 by @megthebest. It looks ok in SP_Flash_Tool but when I try to boot from TWRP I just get the dead Android robot on the screen and a message saying something like "No data available" or something like that.
Can it be that the partition map has changed and that the scatter file needs to be edited, or do I have something wrong in my phone?
Has anyone tried to do what I did? Flashed a full 160620 fw and tried to install TWRP 3.0.0 by @megthebest? If so, did you succeed?
---------- Post added at 08:42 AM ---------- Previous post was at 08:17 AM ----------
genesisalgor said:
If I'm not wrong, you can use @bluefame CM12.1 sources for Elephone P8000, same SoC. Just need to change to our device parameters.
Btw, I dunno if the fact that Shark has 32bit Rom affects anything.
Sent from my s3 using Tapatalk
Click to expand...
Click to collapse
The question I'd like to have an answer to is why they choose to go for a 32-bit Android 5.1, when it wouldn't have meant more work for them to go for the 64-bit version instead. There are many MT6753 devices at half the price of the Shark 1 on 64-bit Android. Could it be that there are some hardware in the Shark 1 that limits them to use 32-bit Android? The SoC is 64-bit for sure but how about bus controllers and other chips around the SoC?
If there are some 32-bit hardware in Shark 1 then the CM12.1 for Elephone P8000 won't be very useful as a starting point for a CM for Shark 1.
(Admin: this is partly a device question and maybe it should be in the other Shark 1 thread, but I answer with further questions to the quoted post about CM ROM)
The question I'd like to have an answer to is why they choose to go for a 32-bit Android 5.1, when it wouldn't have meant more work for them to go for the 64-bit version instead. There are many MT6753 devices at half the price of the Shark 1 on 64-bit Android. Could it be that there are some hardware in the Shark 1 that limits them to use 32-bit Android? The SoC is 64-bit for sure but how about bus controllers and other chips around the SoC?
If there are some 32-bit hardware in Shark 1 then the CM12.1 for Elephone P8000 won't be very useful as a starting point for a CM for Shark 1.
(Admin: this is partly a device question and maybe it should be in the other Shark 1 thread, but I answer with further questions to the quoted post about CM ROM)
Click to expand...
Click to collapse
No differences, the same MT6753 on both devices, or any other with the MT6753. What happens is, to compile/develop in 64bit its about twice of the work, storage, everything on theses socs demands more power than old MTKs.
Leagoo did this to avoid the work, and save money with the development. The SoC is able to run at 64Bit, but they put a 32bit software just to save with development, so theorically we don't have 64bit files on our Rom (I have a Jiayu S3 MT6752 it haves in example /system/libs and libs64. Leagoo and some other brands usually do this. But the processor/hardware is exact the same as P8000.
Sent from my s3 using Tapatalk
genesisalgor said:
No differences, the same MT6753 on both devices, or any other with the MT6753. What happens is, to compile/develop in 64bit its about twice of the work, storage, everything on theses socs demands more power than old MTKs.
Leagoo did this to avoid the work, and save money with the development. The SoC is able to run at 64Bit, but they put a 32bit software just to save with development, so theorically we don't have 64bit files on our Rom (I have a Jiayu S3 MT6752 it haves in example /system/libs and libs64. Leagoo and some other brands usually do this. But the processor/hardware is exact the same as P8000.
Sent from my s3 using Tapatalk
Click to expand...
Click to collapse
Unfortunately if they choose to use a 32-bit OS, then it isn't possible to run a 64-bit version due to bootloader incompatibilities.
Anyway, the new devices from LEAGOO will have a 64-bit OS. (just check my LEAGOO Z5L review, that ultra-low cost device has a 64-bit OS haha)
MacArthur67 said:
Hello guys,
I have flashed the full 160620 firmware as the OTA didn't work in my phone, even after exchanging TWRP with the stock recovery.
The Leagoo OTAs doesn't come as zip files so they can't be installed from TWRP either.
Now on 160620 fw I can't install TWRP 3.0.0 by @megthebest. It looks ok in SP_Flash_Tool but when I try to boot from TWRP I just get the dead Android robot on the screen and a message saying something like "No data available" or something like that.
Can it be that the partition map has changed and that the scatter file needs to be edited, or do I have something wrong in my phone?
Has anyone tried to do what I did? Flashed a full 160620 fw and tried to install TWRP 3.0.0 by @megthebest? If so, did you succeed?
Click to expand...
Click to collapse
I flashed the 160620 with SP-flashtool, but unticked "recovery" before flashing.
So after flashing, I still had TWRP.
Then reboot to TWRP, flashed super-su, everything ok.
So, i didnt do EXACTLY what you did, because I didnt had to install TWRP new after flashing 160620, but TWRP is working on my Phone with 160620.
When you flash, does it flash the stock-recovery? Maybe your recovery-partition got messed up, when you used Flashify to get Stock-recovery for the OTA-update?
Dont know, i am not that much of an expert........:silly:
Robot12 said:
I flashed the 160620 with SP-flashtool, but unticked "recovery" before flashing.
So after flashing, I still had TWRP.
Then reboot to TWRP, flashed super-su, everything ok.
So, i didnt do EXACTLY what you did, because I didnt had to install TWRP new after flashing 160620, but TWRP is working on my Phone with 160620.
When you flash, does it flash the stock-recovery? Maybe your recovery-partition got messed up, when you used Flashify to get Stock-recovery for the OTA-update?
Dont know, i am not that much of an expert........:silly:
Click to expand...
Click to collapse
Yes, Flashify messed up my phone badly. But since then I formated the internal storage except the bootloader so then with a clean install of 160620, invluding stock recovery it should be ok. Maybe I flash 160509 again because I know I can install TWRP in that fw. Then do like you, flash 160620 without stock recovery.
Has anybody use sp flash latest 11th july 2016 rom in needrom.com ?
some tips...
Well after 2 months with this phone, I think it's time to share some tips and improvements I found usefull.
** Please notify me if it's the wrong thread for posting these kind of stuff, but I thought it doesn't belong to the other leagoo shark thread... **
I personnally think it's a very good phone, good hardware, and you got a lot for the price. But like with other phones, some improvements doesn't hurt
(1)--> At first, you need to install TWRP recovery and you have to root the phone. You need it to tweak this beast.
Everything you need is in first post.
Important: For superSu, you have to untick "mount namespace separation", because most of the init.d tweaks won't work with this option activated. And you have to tick "activate su during boot" for the same reason
(2)--> Second step, install busybox (let's say with the stericson installer, install it directly -no need to wait for the "smart install" process-, and remove the installer apk after, because we doesn't need it anymore)
(3)--> Third step, let's add init.d support:
like I explained in the other leagoo shark thread, just search for the file install-recovery.sh In the directory /etc/ and modify it like that:
Code:
#!/system/bin/sh
/system/xbin/daemonsu --auto-daemon &
#init.d support
run-parts /system/etc/init.d/
All you have to do now, is to create a folder "init.d" (without the quotes) in /etc/ folder with 0777 permissions.
(4)--> Now that we have init.d support, here are some scripts I collected & adapted for our phone:
00opti:
This one increase sdcard0/sdcard1 -if any installed- read_ahead value for faster i/o, removes some debug flags, tunes oom, disable ipv6 and tunes ipv4 parameters
Code:
#!/system/bin/sh
echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 512 > /sys/block/mmcblk1/queue/read_ahead_kb
setprop profiler.debugmonitor false
setprop profiler.launch false
setprop profiler.hung.dumpdobugreport false
setprop debugtool.anrhistory 0
setprop profiler.force_disable_ulog 1
setprop profiler.force_disable_err_rpt 1
setprop logcat.live disable
setprop dalvik.vm.debug.alloc 0
setprop dalvik.vm.checkjni false
echo 0 > /sys/module/alarm_dev/parameters/debug_mask
echo 0 > /sys/module/alarmtimer/parameters/debug_mask
echo 0 > /sys/module/binder/parameters/debug_mask
echo 0 > /sys/module/kernel/parameters/initcall_debug
echo 0 > /sys/module/xt_qtaguid/parameters/debug_mask
echo 0 > /sys/module/sbsuspend/parameters/sbsuspend_debug_mask
echo 0 > /sys/module/earlysuspend/parameters/debug_mask
echo 0 > /sys/module/lowmemorykiller/parameters/debug_level
sysctl -w vm.block_dump=0
sysctl -e -w vm.oom_dump_tasks=1
sysctl -e -w vm.oom_kill_allocating_task=1
echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo "1" > /proc/sys/net/ipv6/conf/default/disable_ipv6
/system/bin/ip6tables -P INPUT DROP
/system/bin/ip6tables -P OUTPUT DROP
/system/bin/ip6tables -P FORWARD DROP
echo "0" > /proc/sys/net/ipv4/tcp_timestamps
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse
echo "1" > /proc/sys/net/ipv4/tcp_sack
echo "1" > /proc/sys/net/ipv4/tcp_dsack
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout
01rmt:
This one does classics 'perfect" remounts, tunes some fs parameters,ipv4 tweaks and fstrim function
Code:
#!/system/bin/sh
mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh,errors=continue,nomblk_io_submit,ro /system
mount -o remount,commit=19,nomblk_io_submit,errors=continue,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh,rw /data
mount -o remount,commit=19,nomblk_io_submit,errors=continue,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh,rw /cache
echo 0 > /sys/kernel/debug/tracing/tracing_on
sysctl -e -w fs.lease-break-time=10
sysctl -e -w fs.inotify.max_queued_events=32000
sysctl -e -w fs.inotify.max_user_instances=256
sysctl -e -w fs.inotify.max_user_watches=10240
sysctl -e -w fs.file-max=165164
sysctl -w vm.laptop_mode=0
sysctl -w net.ipv4.icmp_echo_ignore_all=1
sysctl -w net.ipv4.route.flush=1
busybox fstrim -v /cache
busybox fstrim -v /system
busybox fstrim -v /data
02touch:
touch tuning **thanks seraser
Code:
#!/system/bin/sh
echo 20 > /sys/module/tpd_setting/parameters/tpd_em_auto_time_interval
echo 25 > /sys/module/tpd_setting/parameters/tpd_em_pressure_threshold
echo 4 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time
echo 5 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time0
echo 9 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time1
03others:
disabling Zram, some other tweaks, temporary folders cleaning, scrolling and touch tuning
Code:
#!/system/bin/sh
swapoff /dev/block/zram0
setprop persist.sys.scrollingcache 3
setprop ro.min.fling_velocity 8000
setprop ro.max.fling_velocity 12000
echo "1" > /sys/module/tpd_setting/parameters/tpd_mode
echo "63" > /sys/module/hid_magicmouse/parameters/scroll_speed
setprop ENFORCE_PROCESS_LIMIT false
setprop MAX_SERVICE_INACTIVITY false
setprop MIN_HIDDEN_APPS false
setprop MAX_HIDDEN_APPS false
setprop CONTENT_APP_IDLE_OFFSET false
setprop EMPTY_APP_IDLE_OFFSET false
setprop MAX_ACTIVITIES false
setprop ACTIVITY_INACTIVE_RESET_TIME false
setprop MAX_RECENT_TASKS false
setprop MIN_RECENT_TASKS false
setprop APP_SWITCH_DELAY_TIME false
setprop MAX_PROCESSES false
setprop PROC_START_TIMEOUT false
setprop CPU_MIN_CHECK_DURATION false
setprop GC_TIMEOUT false
setprop SERVICE_TIMEOUT false
setprop MIN_CRASH_INTERVAL false
setprop touch.pressure.scale 0.001
busybox rm -f /data/*.log
busybox rm -f /data/tombstones/*
busybox rm -f /data/system/dropbox/*
busybox rm -f /storage/sdcard0/LOST.DIR/*
busybox rm -f /storage/sdcard1/LOST.DIR/*
busybox rm -f /data/system/usagestats/*
busybox rm -r /data/system/appusagestats/*
busybox rm -f /data/anr/*
busybox rm -f /cache/*.apk
busybox rm -f /cache/*.tmp
busybox rm -f /data/backup/pending/*
busybox rm -f /data/local/tmp/*
busybox rm -r /data/tmp/*
setprop media.stagefright.enable-player true
setprop media.stagefright.enable-meta true
setprop media.stagefright.enable-scan true
setprop media.stagefright.enable-http true
setprop media.stagefright.enable-aac true
setprop media.stagefright.enable-qcp true
04gsf:
disabling some google services functions, use it at your own risks ^^^ Can't remember where I find these tweaks, so all credits goes to the author(s)
For this script to work, you need sqlite3 binary, you can use the one I attached (put it in system/xbin/ with according 0777 permissions)
Code:
#!/system/bin/sh
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'perform_market_checkin' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'market_force_checkin' and value = -1"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'checkin_interval'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_gcore' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_idle' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_launch_service' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:SYSTEM_RECOVERY_KMSG' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:event_log' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:SYSTEM_RECOVERY_LOG' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'ads:jams:is_enabled' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'analytics.service_enabled' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = '127.0.0.1' where name = 'url:feedback_url'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'market_force_checkin' and value = 1"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'secure:bandwidth_checkin_stat_interval'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'secure:send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update saved_secure set value = '0' where name = 'send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update saved_global set value = '0' where name = 'send_action_app_error'"
05renice:
renice processes, especially fingerprint scanner service. Please note this two lines:
- busybox renice -19 `pidof com.teslacoilsw.launcher` <--- because I use Nova launcher instead of the stock launcher, wich I personally recommend.
- busybox renice -19 `pidof com.mrbimc.udn.lite:udn_service` <----- I'm using Ultimate Dynamic Navbar instead of the stock one, I will explain this later.
If you doesn't use this two apps, you can remove these lines. (well, if you don't, it will not hurt either)
Code:
#!/system/bin/sh
sleep 80
pid=$(busybox pgrep zygote 2>/dev/null)
busybox renice -1 $pid
busybox ionice -c 1 -n 0 -p $pid
for pid in `dumpsys activity services | busybox grep -i app=ProcessRecord | busybox awk '{ print $2 }' | busybox grep -v '/100[0-9]}' | busybox cut -d: -f1`; do
busybox renice 7 $pid
busybox ionice -c 2 -n 7 -p $pid
done;
busybox renice -20 `pidof com.android.phone`
busybox renice -19 `pidof egistec.fingerauth.host.service`
busybox renice -19 `pidof egistec.fingerauth.host.service:remote`
busybox renice -19 `pidof com.teslacoilsw.launcher`
busybox renice -19 `pidof com.mrbimc.udn.lite:udn_service`
busybox renice -19 `pidof com.android.mms`
busybox renice -15 `pidof com.android.systemui`
busybox renice -3 `pidof android.process.acore`
busybox renice -3 `pidof android.process.media`
(5)--> Now let's tweak the build.prop file a bit...
I added this lines to the build.prop file:
Code:
#seb tweaks
ro.media.enc.jpeg.quality=100
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
logcat.live=disable
wifi.supplicant_scan_interval=240
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
ro.config.nocheckin=1
persist.sys.scrollingcache=3
net.rmnet0.dns1=8.8.8.8
net.rmnet0.dns2=8.8.4.4
net.dns1=8.8.8.8
net.dns2=8.8.4.4
net.ppp0.dns1=8.8.8.8
net.ppp0.dns2=8.8.4.4
net.wlan0.dns1=8.8.8.8
net.wlan0.dns2=8.8.4.4
net.eth0.dns1=8.8.8.8
net.eth0.dns2=8.8.4.4
net.gprs.dns1=8.8.8.8
net.gprs.dns2=8.8.4.4
#seb experimental
mot.proximity.delay=25
windowsmgr.max_events_per_sec=90
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
debugtool.anrhistory=0
profiler.debugmonitor=false
profiler.launch=false
profiler.hung.dumpdobugreport=false
ro.config.hw_quickpoweron=true
net.tcp.mss.wlan=491520
net.tcp.mss.rmnet=491520
persist.service.zram=0
ro.zram.default=0
persist.sys.use_dithering=0
pm.sleep_mode=1
power.saving.mode=1
(6)-->Xposed
Let's install xposed, you need this for Amplify and Greenify, wich I strongly recommend against the stock power saver (I removed it).
You can also install the module "Deny location Consent", very usefull as I doesn't want other localisation than the gps one (very good with this phone by the way) and I'm tired of clicking "disagree" to the google popup when I activate location.
(7)-->Launcher
I doesn't like the stock launcher. At all. I prefer to use Nova Launcher and remove "Launcher3". Your choice
With my firmware version (20160530), there is no tts settings in "settings" :-/ ... But with Nova, and the widget "activity", you can access tts settings (.Settings$TextToSpeechActivity ;see image attachement). I found other interresting activities in parameters too like :
.RadioInfo
.Settings$NotificationsStationActivity
.Settings$GestureSettingsHct ("Somatosensoriel intelligente" ?....)
.Settings$CaptioningSettingsActivity
.Settings$HeadsetSettingActivity
.MonitoringCertInfoActivity
(8)-->Debloating
Use a file explorer (with root access granted) to remove some system apps and titanium backup (or another tool with similar functionnality) to freeze some others.
I removed:
-All the themes (related to launcher 3, wich I doesn't use) : cn.sh.hct.themeOtdColors, cn.sh.hct.themeOtdNusiness, cn.sh.hct.themeOtdEasyFlat, cn.sh.hct.themeOtd, cn.sh.hct.themeOtdluxurious. I keep the main app "Themes" because It allows us to easily change the lockscreen wallpaper. (via the app or via the galery app)
-UpgradeSys, Tags, Power On/Off scheduler, Power Saver, Pico sv (I installed google tts), MTKLogger, MTKNlpServices, MTK android suite daemon, ConfigUpdater, FWupgrade, FWUpgradeProvider, RockClient, Music (I prefer another player), MusicFx.
I froze:
-BSPTelephonyDevTool, com.mediatek.batteryWarning, FastCamera (doesn't know what it is for ?), MTK Thermal manager
(9)-->The navbar
Well, I think there are two problems with the leagoo navbar.
At First, I doesn't like the resolution changing when you activate/desactivate the navbar wich occurs with certain apps. It can even crash some very specific apps (like Igo primo).
And the second thing very annoying is that you have to hide it manually. Too bad there isn't a "auto hide feature".
I solved these two issues with "Ultimate Dynamic Navbar", http://forum.xda-developers.com/showthread.php?t=2270198
Now the navbar is superposed with anything on the screen, without changing the resolution of the running app. And you can specify a timeout for it to automatically hide.
Very customizable, very good and far better than the leagoo or the android stock navbar. You can use the integrated xposed module to hide the leagoo navbar; or modifying these two lines in build.prop (thanks to genesisalgor) :
ro.hct_navigationbar=0
qemu.hw.mainkeys=1
...... more to come if you are interrested
(like customizing the clock view with the flip cover -by modifyng framework-res.apk-,services disabling, optimizing system apks, bootanimation, .... and other tweaks).
Great stuff for helping other.
BTW related to navbar, the navbar in Shark isn't the stock Android Navbar, is another implementation. There is a line on build.prop called hct navbar or something, set it to 0 then the leagoo navbar goes away.
Then
qemu.hw.mainkeys=0
And you get stock Android navbar, which is a bit smaller, so I use Xstana to get a better one.
Sent from my s3 using Tapatalk
genesisalgor said:
BTW related to navbar, the navbar in Shark isn't the stock Android Navbar, is another implementation. There is a line on build.prop called hct navbar or something, set it to 0 then the leagoo navbar goes away.
Then
qemu.hw.mainkeys=0
And you get stock Android navbar, which is a bit smaller, so I use Xstana to get a better one.
Click to expand...
Click to collapse
Thanks a lot ! I still prefer to use Ultimate Dynamic Navbar as I found it more convenient and customizable than the "real" android stock navbar, but now I doesn't need to use the Xposed module, I only have to modify the build.prop like this:
ro.hct_navigationbar=0
qemu.hw.mainkeys=1
Hi.
@seb3773
From here...
http://forum.xda-developers.com/showthread.php?p=67860377
Can you check values of touch after init.d boot?
Thanks.
Enviado desde mi Shark 1 mediante Tapatalk
seraser said:
Hi.
@seb3773
From here...
http://forum.xda-developers.com/showthread.php?p=67860377
Can you check values of touch after init.d boot?
Thanks.
Enviado desde mi Shark 1 mediante Tapatalk
Click to expand...
Click to collapse
Yes, I checked the values (both with terminal and engineer mode) after boot and it's working, I mean the values are those mentionned in the script.
for testing purposes, can you install terminal emulator app, then open a windows, type "su" to get root and then type "run-parts", just to check there isn't something wrong with the busybox install ?
You should then see something like that:
Code:
[email protected]_35gu_l:/ # run-parts
BusyBox v1.24.1-Stericson (2015-11-06 19:11:24 EST) multi-call binary.
Usage: run-parts [-a ARG]... [-u UMASK] [--reverse] [--test] [--exit-on-error] [--list] DIRECTORY
Run a bunch of scripts in DIRECTORY
-a ARG Pass ARG as argument to scripts
-u UMASK Set UMASK before running scripts
--reverse Reverse execution order
--test Dry run
--exit-on-error Exit if a script exits with non-zero
--list Print names of matching files even if they are not executable
If it's ok, then try the command "run-parts --list /etc/init.d/ : you should get the listing of the scripts in init.d folder
seb3773 said:
Yes, I checked the values (both with terminal and engineer mode) after boot and it's working, I mean the values are those mentionned in the script.
for testing purposes, can you install terminal emulator app, then open a windows, type "su" to get root and then type "run-parts", just to check there isn't something wrong with the busybox install ?
You should then see something like that:
Code:
[email protected]_35gu_l:/ # run-parts
BusyBox v1.24.1-Stericson (2015-11-06 19:11:24 EST) multi-call binary.
Usage: run-parts [-a ARG]... [-u UMASK] [--reverse] [--test] [--exit-on-error] [--list] DIRECTORY
Run a bunch of scripts in DIRECTORY
-a ARG Pass ARG as argument to scripts
-u UMASK Set UMASK before running scripts
--reverse Reverse execution order
--test Dry run
--exit-on-error Exit if a script exits with non-zero
--list Print names of matching files even if they are not executable
If it's ok, then try the command "run-parts --list /etc/init.d/ : you should get the listing of the scripts in init.d folder
Click to expand...
Click to collapse
Run parts works fine, showme 02touch, I don't understand.
You feel the touch sensitive only with init.d and without settings fresh boot activation?
Thanks.
Enviado desde mi Shark 1 mediante Tapatalk
Guys instead of doing so many tweaks, all can be implemented into the ramdisk. Coming soon
Alberto96 said:
Guys instead of doing so many tweaks, all can be implemented into the ramdisk. Coming soon
Click to expand...
Click to collapse
Right. I was thinking of doing it as it is not a problem to decompile/compile mtk img files, but having these tweaks in scripts files/build.prop allow me to test, modify, remove some of them or add others tweaks without the hassle of playing with the ramdisk.
But you're definitively right, maybe we can make a list of the "good" working tweaks for the shark, and when we are sure it's ok and working properly, then integrate all of them in ramdisk.
---------- Post added at 01:28 PM ---------- Previous post was at 01:25 PM ----------
seraser, to be honnest, I already feel the touch enough sensitive for me without the tweaks, so I'm maybe not the good person to do this kind of test
Maybe others can try and tell us if there's a difference or not...
Shark 1 20160711 ROM: https://mega.nz/#!tV0DXRDI!7qEXPptHmC9eA9WORwzomdl3vy2nUrZzlTkJkewkcMo
- Rooted using SuperSU
- Busybox Support
- De-Bloated (just a bit)
- Improved Performance
Flashable using TWRP Recovery.
Touchscreen Sensitivity tweak hasn't been added because it seems that this last update doesn't have that issue.
I'm now working on an AOSP variant in order to get rid of the LEAGOO OS UI. UPDATE: Done, coming soon.
Alberto96 said:
Shark 1 20160711 ROM: https://mega.nz/#!tV0DXRDI!7qEXPptHmC9eA9WORwzomdl3vy2nUrZzlTkJkewkcMo
- Rooted using SuperSU
- Busybox Support
- De-Bloated (just a bit)
- Improved Performance
Flashable using TWRP Recovery.
Touchscreen Sensitivity tweak hasn't been added because it seems that this last update doesn't have that issue.
I'm now working on an AOSP variant in order to get rid of the LEAGOO OS UI.
Click to expand...
Click to collapse
Great work man!
And yeeeess, please AOSP it, I l don't like this UI [emoji14]
Sent from my s3 using Tapatalk

[Wanted] Kernel Open Source Code

Android has Modified Linux kernel under GNU GPL v2 which means manufacturer must share their kernels for devices when asked.
But... It is Huawei...
When other companies released their kernel sources, Huawei posted only text files.
Huawei Open Source MiniSite
MHA Open Source Text File
LON Open Source Text File
Text file:
Huawei Device Co., Ltd ("Huawei")is pleased to provide you the corresponding open source code of the device. If you want the code, please contact us with an email titled "Open Source Codes Issue" to [email_removed_against_spam_it_is_in_text_file_by_link]. Please note we may charge you the cost of physically performing source distribution like sending you a CD of the Open Source Codes, if you reqest. And the code download link will be ready soon.
I tried two times, sent emails, but nobody answered to me. It looks like Xiaomi did. They delayed posting code for 6 months and more. And there is nothing to do...
I am ready to sign a petition !
Sent from my MHA-AL00 using Tapatalk
Could you PM me the email?
Nvm, found it.
ante0 said:
Could you PM me the email?
Click to expand...
Click to collapse
It is in text file by link above
Anyway, i PM to you)
5[Strogino] said:
It is in text file by link above
Anyway, i PM to you)
Click to expand...
Click to collapse
Emailed them too now.
I guess, if they don't provide a source, we could ask GNU GPL for help
emailed to them, Hope I can get reply
I just sent them an email.
If you take time to actually read. They are "working on it"
LastStandingDroid said:
If you take time to actually read. They are "working on it"
Click to expand...
Click to collapse
So probably anytime from now to years in the future...
The Rollout of Nougat should be done end of First quarter, so i think it comes between april and may.
I have seen the new P10 and I loved it but came here to check how is Huawei behaving in terms of Kernel sources so devs can work on roms/mods. This post means that they wont give much facilities for this ?
Javi22 said:
I have seen the new P10 and I loved it but came here to check how is Huawei behaving in terms of Kernel sources so devs can work on roms/mods. This post means that they wont give much facilities for this ?
Click to expand...
Click to collapse
Chinese OEM's don't care for GPL.. If you are looking for a device with good development look elsewhere
liam_davenport said:
Chinese OEM's don't care for GPL.. If you are looking for a device with good development look elsewhere
Click to expand...
Click to collapse
Understand..sorry for little OT but although they dont release kernel, are there good mods possibilities using Xposed or this is like Xiaomi where xposed is very problematic with miui?
If not I would imagine that having a Huawei for 2 years or more is boring as you can't personalise too much
How do we help Huawei to release the 4.1.18 kernel source code ?
Code:
HWMHA:/data/data # uname -a
Linux localhost 4.1.18-g0ad0fb3 #1 SMP PREEMPT Tue Apr 11 12:25:26 CST 2017 aarch64
There is a kernel 3.10.90 source available for Honor-8 (FRD), which has similar device driver setup, but a different CPU (hi3650 vs. hi3660).
I could compile this kernel for FRD (with minor code editing), but the compilation for the hi3660 target failed because of some missing bit number
#define's and macros (for ppll2 and ppll3). If needed, these could be derived with relative ease by disassembling the respective functions in the current kernel:
Code:
HWMHA:/data/data # echo 1 > /proc/sys/kernel/kptr_restrict
HWMHA:/data/data # cat /proc/kallsyms | grep ppll
ffffffc000805e30 t xgene_pcppllclk_init
ffffffc000806668 t hi3xxx_multicore_ppll_disable
ffffffc0008067c0 t hi3xxx_multicore_ppll_enable
ffffffc0017a25b4 t hi3xxx_ppll_setup
ffffffc0017d4fb8 t __of_table_xgene_pcppll_clock
ffffffc0017d52d8 t __of_table_hi3xxx_ppll
ffffffc0018eaa70 d hi3xxx_ppll_ops
Another source of the hi3660 kernel code is hikey960 repository at https://github.com/96boards-hikey/linux , but it is missing many device
drivers necessary for the phone.
Both kernels also lack the Device Tree Spec (DTS) for Mate 9, although this one is readily available from the current kernel
Code:
HWMHA:/data/data # cat /sys/firmware/fdt > /storage/sdcard1/FDT
HWMHA:/data/data # exit
HWMHA:/ $ exit
# adb pull /storage/sdcard1/FDT
# dtc -o MHA.dts -O dts -I dtb FDT
Here is the beginning of the 500K MHA.dts file, providing all "MHA_TUGL_VN2" board configuration data:
Code:
/dts-v1/;
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "hi3660";
compatible = "hisilicon,hi3660";
interrupt-parent = <0x1>;
hisi,boardid = <0x5 0x5 0x0 0x9>;
hisi,boardname = "MHA_TUGL_VN2";
hisi,modem_id = <0x3a001400>;
hisi,sub_platform_info3 = "Kirin960";
hisi,provider3 = "BALONG";
hisi,sub_platform_info2 = "Kirin960";
hisi,provider2 = "BALONG";
hisi,sub_platform_info1 = "Kirin960";
hisi,provider1 = "BALONG";
hisi,sub_platform_info0 = "Kirin960";
hisi,provider0 = "HUAWEI_K3";
hisi,platform_num = <0x4>;
hisi,gpu_arch = "mimir";
hisi,camera_arch = "platform_v110";
hisi,camera_arch_v120 = "platform_v120";
...
There is another good thing about the current 4.1.18 kernel: it includes the kexec syscall
Code:
HWMHA:/data/data # echo 1 > /proc/sys/kernel/kptr_restrict
HWMHA:/data/data # cat /proc/kallsyms | grep kexec
ffffffc0000c430c W compat_sys_kexec_load
ffffffc0000c430c W sys_kexec_file_load
ffffffc0000c430c W sys_kexec_load
ffffffc001766794 t setup_crash_kexec_post_notifiers
ffffffc0017d2092 t __setup_str_setup_crash_kexec_post_notifiers
ffffffc0017d6fa8 t __setup_setup_crash_kexec_post_notifiers
ffffffc001a75758 b crash_kexec_post_notifiers
so it should be possible to test a self-compiled kernel zImage without any flashing
https://wiki.archlinux.org/index.php/kexec
and using a bare ramdisk image (unspoiled by weird android stuff)
https://github.com/96boards-hikey/l-loader/blob/master/rootfs.tar.gz
Would it be possible to build a kernel module (like loop.ko) from the hikey960 repository?
Could such a kernel module be loaded into the kernel of the Mate 9?
st_voss said:
Would it be possible to build a kernel module (like loop.ko) from the hikey960 repository?
Click to expand...
Click to collapse
It is a pretty hardware-independent and generic module with stable ABI,
you can try a precompiled .ko from any aarch64 kernel for the same kernel version
(i don't know how strict do they check the version numbers).
Could such a kernel module be loaded into the kernel of the Mate 9?
Click to expand...
Click to collapse
We should check if there are any SELinux restrictions for loading modules, and how to work around them.
All the module infrastructure is compiled into the kernel
Code:
ffffffc000576198 T module_add_driver
ffffffc000576260 T module_remove_driver
...
Huawei currently does not use dynamic modules (probably to avoid the support nightmares)
Code:
HWMHA:/data/data # lsmod
Module Size Used by
HWMHA:/data/data # modprobe -av
modprobe: can't change directory to '/system/lib/modules': No such file or directory
I have compiled loop.ko in the hikey960 tree (modules are disabled there by default), but cannot insert it
Code:
HWMHA:/data/data # insmod /system/lib/modules/4.1.18-g0ad0fb3/loop.ko
insmod: failed to load /system/lib/modules/4.1.18-g0ad0fb3/loop.ko: Exec format error
HWMHA:/data/data # strace insmod /system/lib/modules/4.1.18-g0ad0fb3/loop.ko
...
getuid() = 0
geteuid() = 0
umask(0) = 0
umask(0) = 0
openat(AT_FDCWD, "/system/lib/modules/4.1.18-g0ad0fb3/loop.ko", O_RDONLY|O_CLOEXEC) = 3
finit_module(3, "", 0) = -1 ENOEXEC (Exec format error)
write(2, "insmod: ", 8insmod: ) = 8
write(2, "failed to load /system/lib/modul"..., 58failed to load /system/lib/modules/4.1.18-g0ad0fb3/loop.ko) = 58
write(2, ": Exec format error", 19: Exec format error) = 19
write(2, "\n", 1) = 1
...
HWMHA:/data/data # cat /proc/sys/kernel/modules_disabled
0
It was my error, because the loop driver is already in the kernel
Code:
HWMHA:/data/data # cat /proc/kallsyms | grep loop_ | grep trans
ffffffc0005804c0 T loop_register_transfer
ffffffc000580784 T loop_unregister_transfer
ffffffc00058362c t cryptoloop_transfer
ffffffc00170c620 R __ksymtab_loop_register_transfer
ffffffc00170c630 R __ksymtab_loop_unregister_transfer
ffffffc001739b20 r __kstrtab_loop_unregister_transfer
ffffffc001739b39 r __kstrtab_loop_register_transfer
PS. The problem is more complex, i can't also load other modules.
Code:
ffffffc000127b3c T sys_finit_module
...
It was my error, because the loop driver is already in the kernel
Code:
HWMHA:/data/data # cat /proc/kallsyms | grep loop_ | grep trans
ffffffc0005804c0 T loop_register_transfer
ffffffc000580784 T loop_unregister_transfer
ffffffc00058362c t cryptoloop_transfer
ffffffc00170c620 R __ksymtab_loop_register_transfer
ffffffc00170c630 R __ksymtab_loop_unregister_transfer
ffffffc001739b20 r __kstrtab_loop_unregister_transfer
ffffffc001739b39 r __kstrtab_loop_register_transfer
PS. The problem is more complex, i can't also load other modules.
Code:
ffffffc000127b3c T sys_finit_module
Click to expand...
Click to collapse
You are right. Loop support is already in the kernel.
And we can even use it if selinux is set permissive!
Code:
HWMHA:/data/data # losetup /dev/block/loop0
/dev/block/loop0: [1031e]:6429 (/data/magisk.img)
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
mount: '/dev/block/loop0'->'/magisk': Invalid argument
HWMHA:/data/data # setenforce 0
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
HWMHA:/data/data # mount | grep loop
/dev/block/loop0 on /magisk type ext4 (rw,seclabel,relatime,data=ordered)
st_voss said:
You are right. Loop support is already in the kernel.
And we can even use it if selinux is set permissive!
Code:
HWMHA:/data/data # losetup /dev/block/loop0
/dev/block/loop0: [1031e]:6429 (/data/magisk.img)
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
mount: '/dev/block/loop0'->'/magisk': Invalid argument
HWMHA:/data/data # setenforce 0
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
HWMHA:/data/data # mount | grep loop
/dev/block/loop0 on /magisk type ext4 (rw,seclabel,relatime,data=ordered)
Click to expand...
Click to collapse
What good exactly will it do us then? I'm lost in all that tech talk. Halp!

Categories

Resources