[KERNEL] FiiO X5iii custom kernel (RK3188) | 2016MHz | ZRAM | ZCACHE | AROMA

jkbuha

Member
May 31, 2009
46
20
0
Dear xda community

Following on from the work done to date in the active community in the head-fi.org forum, I have decided to post this work on xda to share the work done so far and, well, also elicit help from the best technical community I've spoken to in the past. This thread will solely focus on the RK3188-based FiiO X5iii player, and will thus contain any and all software modifications to the FiiO X5iii. The custom kernel contains the largest amount of new code, extra features and performance improvements for the X5, and really pushes the limits of the hardware to its fullest potential. The benchmarks alone are outstanding - using Geekbench and Antutu the performance is more than 400% that of the current vanilla firmware, and it will similarly feel more intuitive and responsive, as can be attested by the numerous users to date.

As of Version 3.x, audio tuning is also taken one step further. A new custom AK4490 driver has been implemented, and a significant portion of the redundant and/or unnecessary code has been removed from the sound drivers. Therefore, if not better, the sound should at least feel ‘cleaner’ when compared with previous or vanilla versions. We still have a long way to go to enhance the audio on these DACs, but this driver is a start.

Installation instructions are outlined further below; ie flash via TWRP, but first-time users can also find a more detailed set of instructions in the zip file.

There are three versions - the 2GHz version for faster CPUs, the 1.7GHz for most players, and the 1.4GHz version for anyone experiencing random lockups or reboots.

Unique Features
- Custom AK4490 DAC driver (faster, better oversampling)
- Support for DSD256
- Increased clock speed from 1416MHz to 2016MHz
- Increased GPU speed from 133MHz to 600MHz
- Increased DDR speed from 200MHz to 800MHz
- Better voltage regulation using all possible pwm and clocks on the board
- Increased available RAM by 20%
- LZ4 compression for better, faster swap and virtual memory usage
- ZRAM usage for additional system memory
- Fsync_disable for much faster system processing
- UKSM for faster Kernel operations
- Adaptive-LMK for better memory management
- Undervolting for lower heat dissipation and battery consumption
- New Faster CPU Governors: interactiveX, PegasusQ,
- New Faster I/O Schedulers: zen, bfq, sio, vr, maple
- New Faster Westwood TCP/IP congestion handler for faster wifi and internet access
- CPUBoost algorithm for faster on-demand processing
- CPU SMP feature for powering down unused cores on screen off
- RQ Affinity for faster I/O scheduling
- Linaro gcc toolkit for faster, leaner code
- RK3188 neon vfp3 code optimisation for faster fixed-point and floating DSP operation
- Full init.d support for script runtime loading
- Frandom genrator (23x faster than standard random function)

Download here: https://kernelmods.com

Thanks and Rants

Massive thanks to prispewnic from 4PDA for his incredible scripting experience, product features, suggestions and testing, and the great community of beta testers on Head-Fi and 4PDA.

Thanks also to Fiio for releasing the GPL source code. If it weren’t for you we wouldn’t have this modded kernel.

Changelog

Version 3.32
Fix: Minor AROMA Bugfixes
Enhanced: Updated hosts file - 137409 exceptions for no spamware, faster browsing
AROMA: expanded list for players automatic download

Version 3.31
Fix: Reverted Page writeback tweaks (caused random reboots)
Fix: Minor AROMA fixes

Version 3.3
New: Enabled ARM ARCH_POWER feature
New: Disabled Gentle_Fair_Sleepers (much faster)
New: Enabled cache wakeup preemption
New: Forced memory overcommit for better performance
New: Ignore all ICMP echo requests
New: Enable TCP low latency
New: Removed noatime and nodiratime to improve ext4 and sys filesystem performance (much faster)
New: Added asynchronous filesystem calls (much faster)
New: Enable TCP reuse read mostly algorithm
New: Enable TCP sysctl recycle algorithm
New: Disable TCP slow start after idle
Enhanced: Optimised SLUB memory allocator
Enhanced: Reduced Mini Memory Map to from 32k to 0
Enhanced: Reduced Max Block Dev size from 128 to 32
Enhanced: Increased Max Queue length from 128 to 1024
Enhanced: Tuned kernel fair scheduler workload parameters
Enhanced: Increased memory threshold compaction from 500 to 800
Enhanced: Reduced dirty write back interval
Enhanced: Increased sysctl read interval for reduced latency
Enhanced: Optimise TCP sack/fack/dsack read requests
Enhanced: Optimise TCP memory pressure
Enhanced: Optimise TCP proto packet length algorithm

Version 3.2
New : Added RCU Synchronization Mechanism (much faster)
New : Optimised RCU Settings
New : Added s2idle S0 state (better battery lifetime)
Enhanced: Voltage optimisation for 2016MHz kernel
Enhanced: Updated hosts file - 135385 exceptions for no spamware, faster browsing
Fix: Minor Bugfixes
AROMA: Added "Restore" section
AROMA: Added "Support the Project" section
AROMA: Reworked logic and scripts

Version 3.11

Miscellaneous bugfixes

Version 3.1

Single installer for all kernel versions
New optimised voltages for 1416, 1704 and 2016 kernels (more stable and better performance)
Customisable removal of unwanted system applications
Customisable removal of system equalizer
Customising different audio_flinger libraries (different sound profiles to suit taste)
Enable/Disable Boot-up animation
Enable/Disable custom application on bootup

Version 3.02

New: 1704MHz release for players that can work at higher frequencies than 1416MHz (install this version if you previously had reboots at 2016MHz)
Enhanced: Increased stability without performance decrease
Enhanced: CPU down-volting for performance kernel version (2016MHz)
Fix: Removed additional CPU frequencies for 1416MHz kernel version (increased stability)

Version 3.01

New: 1752MHz intermediary version
Enhanced: More step frequencies from 504 to 2016MHz
Enhanced: Better handling of frequencies at high CPU loads
Enhanced: Powersave governor enabled by default

Version 3.0

New: Upstreamed relevant portions of kernel source code to Linux 3.10.49
New: AdFree hosts file - 67825 exceptions for no spamware, faster browsing
New: Support for DSD256
New: CPU Boost algorithm to increase frequency on screen touch
New: RQ Affinity for faster I/O scheduling
New: CPU SMP feature for faster processing
New: PegasusQ CPU governor
New: Improved interactiveX governor with increased performance and more power saving on idle (2 core shutdown)
New: Custom AK4490 driver with up to 768kHz oversampling
New: Custom plugin module for AK4490 to add more audio filters in future
New: CPU Maximum overclocking to 2016MHz! (Super significant performance improvement)
New: Current CPU frequency 1896MHz (Significant performance improvement and good stability)
New: GPU overclocking to 500MHz (More fluid screen responsiveness)
New: DDR overclocking to 720MHz (Ultra-fast memory and software processing)
New: Reduced Graphics requirements from 225MB down to 80MB (20% more available RAM)
New: Adaptive Low Memory Killer (A-LMK) algorithm
New: A-LMK optimised scripting (thanks again to prispewnic)
New: Compaction algorithm for low memory killer
New: FiiO RK3188/RK3188T efuse algorithm handling
New: VM Pressure algorithm implementation
Enhanced: zram and zcache now compressed with LZ4
Enhanced: better voltage regulation code
Enhanced: support for apll, cpll and gpll clocks on RK30 board
Enhanced: better GPIO code specific to FiiO player
Enhanced: removed unnecessary encryption
Enhanced: lowered minimum screen brightness for better battery lifetime

Version 2.8
Performance Build

New: Disabled CRC checking in all kernel code (significant performance improvement)
New: Optimised compilation parameters (-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer)
New: Fine-tuned kernel optimisation for RK3188 (-mtune=cortex-a9)
New: Optimised ARM RWSEM algorithm

Version 2.7

New: Redesigned Busybox installer
New: Redesigned Permissive SE Linux installer
New: Kernel version now displayed in settings
Fix: Corrections to anyone who was not seeing the msg "Kernel optimisation Ready" prompt

Version 2.6

New: UKSM instead of KSM (much faster)
New: ZRAM (more RAM)
New: fsync_disable (much, much faster)
New: ROW I/O scheduler for SD cards (much faster)
New: LZ4 Compression instead of LZO (faster, more compression)
New: zsmalloc implementation instead of xsmalloc
New: zcache enabling (faster)
New: ARM RSEM implementation (faster)
New: frandom generator instead of random (much, much faster)
New: MSG pop-up notification daemon
Fix: Lowered voltage for some FiiO players with lower-grade VCOs
Fix: Corrected git file dependencies
Fix: Disabled system animation by default

Version 2.5

New: Increased max clock speed to 1752MHz (faster)
New: BFQ I/O scheduler (faster)
New: Westwood TCP/IP congestion protocol (much faster)
New: InteractiveX governor (much, much, much faster)
Fix: Stability checks to voltage
Fix: iX handling changes

Version 2.4

New: Maple I/O Scheduler (faster)
New: init.d full support (much, much faster)
New: init.d scripts (thanks prispewnic @ 4PDA)

Version 2.3

New: Zen I/O scheduler (much faster)

Version 2.2

Fix: Changes to scheduler priorities during screen off (faster)

Version 2.1

New: Additional GPU and DDR overclocking (much, much faster)

Version 1.4

New: Update to Linaro gcc 4.9.4 (significantly much faster)

Version 1.3

New: SIO I/O scheduler (faster)
New: VR I/O scheduler (faster)
New: CPU clock to 1704MHz (much, much faster)

Version 1.2

New: Additional voltage optimisation and DDR overclocking

Version 1.1

New: GPIO optimisation and documentation
New: CPU clock to 1518MHz (faster)

Version 1.0

Initial system release and branch-off from FiiO GPL code

Installation instructions

1) Windows and/or first-time users

If you already have TWRP or a previous version of my kernel, go to step 2.

a) If you don't yet have TWRP and/or any previous version of my kernel yet, download the Windows-based loader here and unzip to a folder

https://www.androidfilehost.com/?fid=1395089523397899882
(note: you need to have the FiiO USB Windows drivers correctly installed)

b) Run the AndroidTool.exe program and connect the FiiO via USB.

c) Put the player in bootloader mode (just as if you were going to upgrade the player the traditional FiiO way with the Windows based loader), by pressing power+pause+back.

d) If all goes well you should see the green light with 'Found One Loader Device'. Make sure 'boot' and 'recovery_twrp' are selected and press Run. Once done, click the 'Advanced Function' tab and click Reset Device. You should have the new kernel and TWRP installed!

2) TWRP users

a) Download the latest version of the kernel (with new optimisation scripts) above and push to sdcard
b) Reboot to TWRP recovery
c) Install -> FiiO-X5iii-jkbuha-V3.1-TWRP.zip
d) Wipe kernel and dalvik cache

e) Reboot

f) IMPORTANT: leave running for new scripts to do their magic (you will be prompted to reboot)

g) Reboot

h) Enjoy :)

Any queries, comments etc - please shout :)
 
Last edited:

fl1p17

New member
Jul 5, 2019
1
1
0
Thanks a lot for your work, jkbuha. Some friends also have the Fiio X5 iii and they all use your Kernel now. The Player is much smoother and faster.
I use the 1704 MHz version. For me its the best compromise of speed and battery lifetime.
With the 2016 MHz version my player gets very hot. Does your player also generate so much heat with this version?
 
  • Like
Reactions: jkbuha

jkbuha

Member
May 31, 2009
46
20
0
Thanks a lot for your work, jkbuha. Some friends also have the Fiio X5 iii and they all use your Kernel now. The Player is much smoother and faster.
I use the 1704 MHz version. For me its the best compromise of speed and battery lifetime.
With the 2016 MHz version my player gets very hot. Does your player also generate so much heat with this version?
Thanks for the feedback. The 2016 version uses slightly higher voltages than the default FiiO kernel at 1416MHz, but it's never generated any noticeable heat; at least in my case. Just to be safe, if you continue to experience heating, I'd use the 1704Mhz; other than benchmark scores the daily usage experience is the same as 2016MHz.
 

Tomekub

New member
Aug 12, 2019
1
1
0
Dear jkbuha,

Although using XDA forum a long time, just signed up because I really needed to say thanks. While I was satsified with sound quality on my X5, the performance of the device and general bugs left A LOT to desire.
Just flashed your kernel onto a stock 1.2.5 rom and the performance so far is outstanding. The X5 never worked THAT snappy. This is extraordinary work, sir, hats off. FIIO should buy this from you and put in their next release. Seriously.
I'll be spending the next days testing the battery performance with the hopes of getting better idle battery life, which bother the bejesus out of me.
Anyway, thanks again, your work is very appreciated!
 
  • Like
Reactions: jkbuha

Speniopantollor

New member
Nov 24, 2019
2
0
0
Hello, i have a problem when installing kernel: "set_perm: some changes failed". In log file:
Installing Init.d Scripts
package_extract_file: can't open /system/etc/init.d/10Sqlite for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/20Zipalign for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/30FSTweak for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/40EXT4Tweak for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/50ReniceTimer for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/55GoogleDrainFix for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/60Main for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/98SuperSUDaemon for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/99AutoReboot for write: No such file or directory
package_extract_file: can't open /system/bin/renice.sh for write: No such file or directory
set_perm: chown of /system/etc/init.d/10Sqlite to 0 0 failed: No such file or directory
set_perm: chmod of /system/etc/init.d/10Sqlite to 0 failed: No such file or directory
script aborted: set_perm: some changes failed
set_perm: some changes failed


Installer Error (Status 7)
 

Techguy777

Senior Member
May 24, 2018
494
133
43
Dear xda community



Any queries, comments etc - please shout :)

Hi I just order my fiio x5iii generation and im looking into TWRP, Root, and I want to install viper4android into the latest firmware if possible because I heard they got rid of it. I see your program to install TWRP and the kernel but what about rooting do you know if Magisk or Supersu will root and is viper4android able to be installed? I would really appreciate any help. Thank You I look forward to using your Kernel and TWRP. Should I stay on the first firmware also. My main goal is viper4android 2.3.4 with high quality driver and magisk if possible.
 

Techguy777

Senior Member
May 24, 2018
494
133
43
Thanks a lot for your work, jkbuha. Some friends also have the Fiio X5 iii and they all use your Kernel now. The Player is much smoother and faster.
I use the 1704 MHz version. For me its the best compromise of speed and battery lifetime.
With the 2016 MHz version my player gets very hot. Does your player also generate so much heat with this version?
Hi, Im new to fiio x5iii player but ive rooted and flashed tons of android phones. Im getting lost in all the directions online. If I have a brand new never updated fiio x5 player how would you recommend going about things? Should I flash TWRP and the kernel without updating the firmware? Im trying to get Twrp, Root, Kernel, and Viper4android 2.3.4 installed I know the fiio music has some viper options you have to pay for but id rather get all of them with 2.3.4 installed.
 

Techguy777

Senior Member
May 24, 2018
494
133
43
I would really appreciate some help. I've never used a high resolution player. I've rooted a dozen Androids and I know they can all have differences so that's why I'm curious.



Here's my plan

Install twrp from the 2.6 windows zip on stock firmware that's on it when I get it.
Make a backup
Flash SuperSU
Make another backup with root.
Install viper4 Android apk not zip
Install BusyBox


If there's some specific firmware I should be on for twrp to flash properly I would like to know.
If I want to upgrade firmware do I need to reinstall stock recovery or can I just update it using the update tool?
 

jkbuha

Member
May 31, 2009
46
20
0
Hello, i have a problem when installing kernel: "set_perm: some changes failed". In log file:
Installing Init.d Scripts
package_extract_file: can't open /system/etc/init.d/10Sqlite for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/20Zipalign for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/30FSTweak for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/40EXT4Tweak for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/50ReniceTimer for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/55GoogleDrainFix for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/60Main for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/98SuperSUDaemon for write: No such file or directory
package_extract_file: can't open /system/etc/init.d/99AutoReboot for write: No such file or directory
package_extract_file: can't open /system/bin/renice.sh for write: No such file or directory
set_perm: chown of /system/etc/init.d/10Sqlite to 0 0 failed: No such file or directory
set_perm: chmod of /system/etc/init.d/10Sqlite to 0 failed: No such file or directory
script aborted: set_perm: some changes failed
set_perm: some changes failed


Installer Error (Status 7)
Sounds like the /system partition didn't mount properly or you're out of free space. Try and mount it manually in TWRP and see if you can free some space and/or run the installer again
 

jkbuha

Member
May 31, 2009
46
20
0
Install twrp from the 2.6 windows zip on stock firmware that's on it when I get it.
Make a backup
Flash SuperSU
Make another backup with root.
Install viper4 Android apk not zip
Install BusyBox

If there's some specific firmware I should be on for twrp to flash properly I would like to know.
If I want to upgrade firmware do I need to reinstall stock recovery or can I just update it using the update tool?
Yes that approach is correct (the custom kernel also includes busybox so that last step is redundant). However V4A doesn't work system-wide on any FiiO firmware; you'd need to play around with the audio_policy.conf to make it work, and if you do I'd be happy to integrate your work into the latest kernel as an option install. Just be mindful of the loss in audio fidelity; you'd probably be better off using Neutron as I've explained on the head-fi forum.

TWRP works on all FiiO firmwares. For audiophiles, the recommended firmware is 1.2.3 (latest is 1.2.5) as the audio libraries seem to be the best though you can select which library you want in the custom kernel installer.

To upgrade firmware you need to install stock recovery. FiiO's update tool doesn't work with TWRP, which is understandable.
 
Last edited:

Techguy777

Senior Member
May 24, 2018
494
133
43
Yes that approach is correct (the custom kernel also includes busybox so that last step is redundant). However V4A doesn't work system-wide on any FiiO firmware; you'd need to play around with the audio_policy.conf to make it work, and if you do I'd be happy to integrate your work into the latest kernel as an option install. Just be mindful of the loss in audio fidelity; you'd probably be better off using Neutron as I've explained on the head-fi forum.

TWRP works on all FiiO firmwares. For audiophiles, the recommended firmware is 1.2.3 (latest is 1.2.5) as the audio libraries seem to be the best though you can select which library you want in the custom kernel installer.

To upgrade firmware you need to install stock recovery. FiiO's update tool doesn't work with TWRP, which is understandable.
Awesome I cant wait to get started. Its sounds like the fiio is pretty good for rooting and modding. If I can just install twrp and then if I want to update later use your tool to reinstall stock recovery to update it sounds pretty good.
If I can get viper to work ill let everyone know. Its fine if I lose fidelity a little for one backup then ill keep one with stock to go back to if I want.
 
  • Like
Reactions: jkbuha

Techguy777

Senior Member
May 24, 2018
494
133
43
Yes that approach is correct (the custom kernel also includes busybox so that last step is redundant). However V4A doesn't work system-wide on any FiiO firmware; you'd need to play around with the audio_policy.conf to make it work, and if you do I'd be happy to integrate your work into the latest kernel as an option install. Just be mindful of the loss in audio fidelity; you'd probably be better off using Neutron as I've explained on the head-fi forum.

TWRP works on all FiiO firmwares. For audiophiles, the recommended firmware is 1.2.3 (latest is 1.2.5) as the audio libraries seem to be the best though you can select which library you want in the custom kernel installer.

To upgrade firmware you need to install stock recovery. FiiO's update tool doesn't work with TWRP, which is understandable.
How does viper effects sound in the fiio music app? I've installed it on my phone and it's weird no music will play on it. I see that it has every setting I like except for headphone surround sound. My favorite settings are gain , clarity, dynamic system or bass but usually dynamic system, and headphone surround sound is all I need anyway. Wonder why they didn't include that. I also don't understand how it'll know you paid for the settings if you uninstall it or flash a new firmware. I paid for 2 day shipping and it hasn't even shipped yet cause of the holidays I can't wait.
 

jkbuha

Member
May 31, 2009
46
20
0
How does viper effects sound in the fiio music app? I've installed it on my phone and it's weird no music will play on it. I see that it has every setting I like except for headphone surround sound. My favorite settings are gain , clarity, dynamic system or bass but usually dynamic system, and headphone surround sound is all I need anyway. Wonder why they didn't include that. I also don't understand how it'll know you paid for the settings if you uninstall it or flash a new firmware. I paid for 2 day shipping and it hasn't even shipped yet cause of the holidays I can't wait.
FiiO Music is hard wired to play only on FiiO Players. Which of course is understandable. I'm sure someone could figure out to hack it if it's really worthwhile...

Viper on FiiO Music sounds the same as you'd expect on other players :)
 
  • Like
Reactions: Techguy777

Techguy777

Senior Member
May 24, 2018
494
133
43
FiiO Music is hard wired to play only on FiiO Players. Which of course is understandable. I'm sure someone could figure out to hack it if it's really worthwhile...

Viper on FiiO Music sounds the same as you'd expect on other players :)
Thats what i thought that the fiio app is probably hackable and if someone could do so its possible it would play on all androids without root maybe. Do you have a copy of the stock kernel by itself unrooted? I like to have a clean copy of everything. Also after flashing twrp and kernel what does "reset device" do does it go into twrp or reboot and wipe device?

I found a stock firmware 1.1.0 and got the boot img out of that. I cant find a firmware for 1.0.9 on fiios firmware its just a pdf manual and it says 1.0.9 but it isnt or purist rom 1.0.9 has been removed from all the links.

---------- Post added at 12:43 PM ---------- Previous post was at 11:59 AM ----------

I dont know if you guys know it but poweramp and neutron play DSD files on android. Matter of fact they play the top 256 no problem. This is new to me so im not sure if its the same. 512 is only on 5 songs so thats not necessary and 1024 doesn't exist yet.
 
Last edited: