Rockbox Technical Forums

Rockbox Development => New Ports => Topic started by: chocovy on July 23, 2019, 05:04:46 AM

Title: Fiio M3k
Post by: chocovy on July 23, 2019, 05:04:46 AM
Gonna start a thread for the fiio m3k (not m3)

So far this is what I was able to gather on what's inside the player.

SoC: Ingenic X1000e
OS: Custom (linux-based)
DAC: AKM AK4376A
Power management IC: AXP192
Screen: 2.0 inch IPS TFT 240×320

Until I can figure out how I can disassemble the unit safely the pcb scans have to wait I guess...
Can't really help out on the software side of things as I'm only familiar with C++.

This is where the firmware updater (and other firmware versions of the player) is located
http://www.fiio.me/forum.php?mod=viewthread&tid=43627&extra=page=1

will update this thread on further findings
Title: Re: Fiio M3k
Post by: XVortex on August 18, 2019, 05:15:03 AM
I think it's possible

It’s coming...,
(http://xvtx.ru/rockbox/photos/m3k_rockbox_sm.png)
Title: Fiio M3K
Post by: Bilgus on August 29, 2019, 06:54:28 PM
Fiio M3K New Port Thread

Fiio M3K General Discussion
See: http://forums.rockbox.org/index.php/topic,52952.0.html
Title: Re: Fiio M3k Rockbox Port
Post by: XVortex on September 01, 2019, 12:10:54 PM
Here we go!
Rockbox for the FiiO M3K is available on my site:
http://xvtx.ru/rockbox/download.htm (http://xvtx.ru/rockbox/download.htm)

- Based on the stock FW v1.3.0 (which has also been optimized for speed and memory usage).
- It is flashed like a regular firmware (...and rolls back also).
- Almost everything works, but minor bugs will be fixed over time.

Enjoy!
(and please consider a donation for me or/and rb team if You'd like it).

P.S. source code will available later, when all settle a bit.
Title: Re: Fiio M3k
Post by: amtmart on September 03, 2019, 02:41:23 AM
Awesome work! How does one go about installing this on the player? What bugs have you noticed?
Title: Re: Fiio M3k
Post by: XVortex on September 03, 2019, 05:19:27 AM
You should install it as regular update: https://www.fiio.com/newsinfo/82055.html
There are several minor issues, they will be fixed in the next version. Nothing serious.
Title: Re: Fiio M3k
Post by: amtmart on September 04, 2019, 02:51:12 PM
I got it installed and its working pretty great, gotta say i absolutely love rockbox. only 2 errors so far, both errors on bus (one said 10 i believe and the other 11), first one happened when i tried to open my library before scanning the database, the second happened when listening to music and going through the plugins menu. Hope this helps!

Edit: also just noticed there doesnt seem to be a way to lock the screen with the physical screen lock button
Title: Re: Fiio M3k
Post by: Njones on September 04, 2019, 06:55:04 PM
Depends on which theme. Cabbie has the lock feature. Hold on /off button for 3 seconds to lock or unlock. Updated version available now through link in Rockbox general discussion forum.
Title: Re: Fiio M3k
Post by: amtmart on September 10, 2019, 01:17:58 PM
So I've used it for a few days now and here's the bugs I've encountered.

The worst is that I can no longer boot into the stock OS, it just freezes up after I select fiio music.
It also is completely off on the battery level, it'll be at 0 for a while but stay on, or say 30 then jump to 17 when I plug it in.
It also seems to have a problem keeping setting changes.
Also still experiencing crashes when loading large lists in file view.
Title: Re: Fiio M3k
Post by: snejdy on September 10, 2019, 01:34:59 PM
Hi, thanks for the port - good job.
I found one bug, however.  The left-right balance does not work for me. Volume in both headphones is turned down instead of just one side.
I would also like to ask if it is possible to make the volume control work even when the keys are locked.
Thanks for the reply.
Title: Re: Fiio M3k Rockbox Port
Post by: XVortex on September 11, 2019, 12:28:48 AM
The left-right balance does not work for me.
Will be fixed in the next version.
Title: Re: Fiio M3k
Post by: Bilgus on September 11, 2019, 01:32:17 AM
If the device has a physical lock button we don't put code for the soft lock stuff which allows keys to be pressed while locked
However it is possible to add it http://forums.rockbox.org/index.php/topic,52539.0.html
Title: Re: Fiio M3k Rockbox Port
Post by: jjjameson on September 13, 2019, 12:53:08 AM
The left-right balance does not work for me.
Will be fixed in the next version.

Just letting you know that the most recent version of Rockbox on your site for the M3K is basically unusable, as it doesn’t let you change the volume and instead defaults to just very very loud. Just letting you know.
Title: Re: Fiio M3k
Post by: snejdy on September 27, 2019, 07:56:12 AM
Just an update, im returning the m3k in favor of the fiio m6. this rockbox release constantly freezes my device at different menus, as well as destroying the amazing battery life. i also couldnt get it to boot back into stock fiio software while rockbox is installed. all in all its not worth the trouble, if you have a lot of music avoid the m3k, if you like a working m3k avoid the releases as of this post.


m3k works with this port without any problems, no freezing for me... Only the channel balance does not work...
Title: Re: Fiio M3k
Post by: Nelke on September 27, 2019, 08:13:49 AM
Hi,

my M3K works well with rockbox, thanks XVortex. :) I can boot into the stock player, freezes are only in some plugins but i don't need these.  With Rockbox I have a battery time of about 18-20 hours. Maybe, the runtime was a bit longer with the fiio player.

Before the update I had formatted a sd card in the M3K. Firmware version was 1.3.0. I don't know if it important.

The only problem I have, fast forward/rewind doesn't work in v1.3.0_5bbc553-190915.
That's why I went back to v1.3.0_70b135b-190913.
Title: Re: Fiio M3k
Post by: Njones on September 30, 2019, 09:58:33 AM
I Updated the M3k firmware to 1.4.3 and now I can't get rockbox to work?
Title: Re: Fiio M3k
Post by: swap on October 18, 2019, 06:55:34 AM
Thanks, Great Port.

I have a question.

Fiio m3k Rockbox provide USB support?

Im new en Rocbox and not found howto transfer file usb.

Thanks
Title: Re: Fiio M3k
Post by: diegopau on February 16, 2020, 01:51:05 PM
Hi XVortex,

Are there any plans to further update the firmware for the M3k?

I posted a few issues and suggestions in these messages
http://forums.rockbox.org/index.php/topic,52952.msg245026.html#msg245026
http://forums.rockbox.org/index.php/topic,52952.msg245080.html#msg245080

I would love to know if you plan to address any of those in the future.

Thanks again for bringing Rockbox to this player.
Title: Re: Fiio M3k
Post by: bbame on March 05, 2020, 10:22:13 AM
I was excited to find a rockbox port for my brand new Fiio M3k.  The stock firmware lacks features I've become used to on my old (now dead) SanDisk Clip+ which ran rockbox.  So first of all, thanks very much for doing this!!!

I do have one question, though.  Fast Forward and Rewind don't work - pressing/holding the buttons just makes the screen flash rapidly - and I was wondering if there was something I could do to fix it.  Maybe revert to an earlier version or play with the settings somehow?  Since I listen to a lot of audio books and podcasts and often find myself rewinding/relistening, or fast fowarding past boring parts (or advertising), lack of FF/RW is a big deal for me.

I found other reports of FF/RW not working on this forum - someone suggested changing FF/RW Accel to "Very fast", which I did, but it had no effect.  For now I have changed "skip length" from "skip track" to "30s", but that's really irritating when I'm listening to music and want to skip a song/track.

Any advice?

Specifics: Fiio M3K, originally with stock firmware 1.4.3, now with the latest M3K rockbox version (also 1.4.3).
Title: Re: Fiio M3k Rockbox Port
Post by: speachy on April 15, 2020, 10:18:13 PM
Here we go!
Rockbox for the FiiO M3K is available on my site:
http://xvtx.ru/rockbox/download.htm (http://xvtx.ru/rockbox/download.htm)

P.S. source code will available later, when all settle a bit.

It's been well over six months since you posted that initial version; Have things settled sufficiently for you to toss the source code our way?  I'd love to get this integrated into the mainline.
Title: Re: Fiio M3k
Post by: whiskerc on April 29, 2020, 11:46:28 AM
Two quick questions for anyone using Rockbox on the M3k.

- Can the dual boot screen be bypassed or set to be very short?
- Would you recommend this player and Rockbox port?

I am a longtime (many year) user of Rockbox on the Clip+, but like many others would like to get a replacement ready for when the Clip+ is no more. 

Long live Rockbox :)
Title: Re: Fiio M3k
Post by: speachy on April 29, 2020, 12:01:45 PM
- Can the dual boot screen be bypassed or set to be very short?
- Would you recommend this player and Rockbox port?

Given that the source code for the m3k port has not been publicly released, the answer to both question is, unfortunately, no.
Title: Re: Fiio M3k
Post by: sohnemann on May 12, 2020, 03:43:42 AM
@XVortex

Is there any timeline on when the source will be available?
Would love to contribute to this port.  :)

Cheers
sohnemann
Title: Re: Fiio M3k
Post by: efqw on May 13, 2020, 04:59:24 PM
UPDATE: I have wiki access now, and I'll be moving important bits from my posts to the wiki page soon. Internal pictures have already been uploaded, along with links to datasheets for every single chip found in this device and disassembly instructions.
https://www.rockbox.org/wiki/FiioM3K (https://www.rockbox.org/wiki/FiioM3K)

First of all, it seems like xvortex somehow has access to FiiO's firmware signing keys? The firmware is a zip archive containing around 66 1MB chunks (kernel and rootfs), and every single part is individually signed with apksign!!! The recovery partition is what verifies (I have not tested unsigned/self-signed chunks yet) the individual chunks and writes them to the internal SPI NAND. You can decompress all of the individual parts, concatenate all the rootfs segments together, and you'll have a regular UBI image to play with.

FiiO was accidentally being incredibly helpful here by not stripping the main player binary in the stock fw (xvortex stripped them to make more room for rockbox), so I managed to get a reliable serial console on xvortex's firmware without having to open up the device. You can save this script in your MicroSD and launch it from xvortex's bootloader menu to get a serial console over USB. I've spent a few hours looking at fiio's main player program with Ghidra a while ago, it loads these modules if you connect the device to USB without a MicroSD card inserted (presumably for writing serial numbers). The main player binary immediately hangs up/unloads the kernel modules if you send something into the serial connection, so I assume we won't get a proper shell from that. Luckily busybox was compiled with getty :D

Code: [Select]
#!/bin/ash
insmod /lib/modules/3.10.14/kernel/driver/staging/dwc2/dwc2.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/libcomposite.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/u_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_acm.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/g_serial.ko
getty /dev/ttyGS0 115200



Some thoughts:

1. FiiO's buildroot is based on Ingenic's Halley2 buildroot BSP. The Halley2 BSP kernel, u-boot, buildroot and other misc files can be obtained from their FTP server. Please try to mirror it if you can, ingenic has a habit of silently removing files from their FTP server: ftp://198.13.102.99/ingenic_support/X1000_X1000E_X1500/01_SW/00_Board-Level_Consolidation_Version/Kernel3.10.14_X1000_New_Version/08_ingenic-linux-kernel3.10.14-x1000-v9.0-20191212/ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2 (http://ftp://198.13.102.99/ingenic_support/X1000_X1000E_X1500/01_SW/00_Board-Level_Consolidation_Version/Kernel3.10.14_X1000_New_Version/08_ingenic-linux-kernel3.10.14-x1000-v9.0-20191212/ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2)

2. Regardless of whether xvortex ends up releasing the source (I certainly hope they do), we need a soulution for generating update packages that doesn't involve FiiO's signing keys. Getting a signed intermediary package would be interesting, and then perhaps we can patch the recovery to disable signature verification?

3. My attempts on opening this device non-destructively have not been successful because it was glued shut. Applying heat doesn't seem to do much good as the screen still can't be pulled off with a suction cup clamp. Without access to the PCB (native UART), I won't be able to easily recover the device if something goes wrong with the recovery partition, so I can't tinker with the recovery for now.


Finally, here is some system info. Let me know if you have any questions.

Code: [Select]
/proc/mtd:
dev:    size   erasesize  name
mtd0: 00020000 00020000 "uboot"
mtd1: 00400000 00020000 "kernel"
mtd2: 00500000 00020000 "recovery"
mtd3: 05000000 00020000 "rootfs"
mtd4: 026e0000 00020000 "data"

/proc/version:
Linux version 3.10.14-g60d92e8-dirty (fiio64@ubuntu) (gcc version 4.7.2 (Ingenic 2016.11) ) #3 PREEMPT Fri Sep 27 11:46:20 CST 2019

/proc/cpuinfo:
system type : halley2_v10
machine : Unknown
processor : 0
cpu model : Ingenic Xburst V4.15  FPU V0.0
BogoMIPS : 1001.88
wait instruction : yes
microsecond timers : no
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 1, address/irw mask: [0x0fff]
isa : mips32r1
ASEs implemented :
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

Hardware : halley2
Serial : 00000000 00000000 00000000 00000000

/proc/meminfo:
MemTotal:          58140 kB
MemFree:           43032 kB
Buffers:             476 kB
Cached:             2944 kB
SwapCached:            0 kB
Active:             2940 kB
Inactive:           1500 kB
Active(anon):       1024 kB
Inactive(anon):        4 kB
Active(file):       1916 kB
Inactive(file):     1496 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 8 kB
Writeback:             0 kB
AnonPages:          1024 kB
Mapped:             1308 kB
Shmem:                 8 kB
Slab:               3444 kB
SReclaimable:       1060 kB
SUnreclaim:         2384 kB
KernelStack:         352 kB
PageTables:          156 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       29068 kB
Committed_AS:      35264 kB
VmallocTotal:    1048372 kB
VmallocUsed:        2096 kB
VmallocChunk:    1045868 kB


/proc/mount_points:
rootfs on / type rootfs (rw)
ubi0:rootfs on / type ubifs (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=10240k)
tmpfs on /tmp type tmpfs (rw,relatime,size=10240k)
mdev on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime,size=5120k)
ubi1_0 on /data type ubifs (rw,relatime)
/dev/mmcblk0p1 on /mnt type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=936,iocharset=utf8,shortname=mixed,errors=remount-ro)


/proc/cmdline:
mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off  init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw loglevel=8

/etc/os-release:
NAME=Buildroot
VERSION=2014.05-00055-g03a0bb5
ID=buildroot
VERSION_ID=2014.05
PRETTY_NAME="Buildroot 2014.05"
Title: Re: Fiio M3k
Post by: speachy on May 13, 2020, 06:40:43 PM
First of all, it seems like xvortex somehow has access to FiiO's firmware signing keys? The firmware is a zip archive containing around 66 1MB chunks (kernel and rootfs), and every single part is individually signed with apksign!!! The recovery partition is what verifies (I have not tested unsigned/self-signed chunks yet) the individual chunks and writes them to the internal SPI NAND. You can decompress all of the individual parts, concatenate all the rootfs segments together, and you'll have a regular UBI image to play with.

This comes as a suprise; none of the other hiby-based players I've seen require signed firmware images.

2. Regardless of whether xvortex ends up releasing the source (I certainly hope they do), we need a soulution for generating update packages that doesn't involve FiiO's signing keys. Getting a signed intermediary package would be interesting, and then perhaps we can patch the recovery to disable signature verification?

This package generation mechanism already exists, but it relies on tooling that is Linux-specific (and also requires superuser permissions).  That said, once a suitably-patched package is generated, we can use that to generate binary patches that can be distributed from download.rockbox.org and automagically applied using rbutil.
Title: Re: Fiio M3k
Post by: efqw on May 14, 2020, 07:55:34 PM
Some updates that I forgot to mention in my last post:

1. The main player application is aggressively logging to /data/userfs/app.log. I'm really concerned about this wearing out my NAND, so I deleted it and made a symlink to /dev/null  :D

2. ubinfo:
Code: [Select]
# ubinfo /dev/ubi0
ubi0
Volumes count:                           1
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     640 (81264640 bytes, 77.5 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  20
Current maximum erase counter value:     15
Minimum input/output unit size:          2048 bytes
Character device major/minor:            250:0
Present volumes:                         0
# ubinfo /dev/ubi1
ubi1
Volumes count:                           1
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     311 (39489536 bytes, 37.7 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       0
Count of reserved physical eraseblocks:  3
Current maximum erase counter value:     11
Minimum input/output unit size:          2048 bytes
Character device major/minor:            249:0
Present volumes:                         0

3. It's possible that FiiO simply used some stock test keys to sign the packages, but the keys in ingenic-linux-kernel3.10.14-x1000-v9.0-20191212.tar.bz2 don't match. Maybe they have different test keys in older releases?
Title: Re: Fiio M3k
Post by: diegopau on May 20, 2020, 03:40:54 AM
Quote
The main player application is aggressively logging to /data/userfs/app.log. I'm really concerned about this wearing out my NAND, so I deleted it and made a symlink to /dev/null

Hi, now that you explained this I am concerned too. Would you mind posting some details about how I could do this myself?
Title: Re: Fiio M3k
Post by: efqw on May 25, 2020, 04:18:06 PM
Code: [Select]
rm /data/userfs/app.log
ln -s /dev/null /data/userfs/app.log
;)
Title: Re: Fiio M3k
Post by: diegopau on May 26, 2020, 04:14:50 AM
Sorry, I am a complete noob at this. I never started a serial console before so that's where I am stuck:

On the M3K:

1. I created a file named "serial_connection.sh" with the script:

Code: [Select]
#!/bin/ash
insmod /lib/modules/3.10.14/kernel/driver/staging/dwc2/dwc2.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/libcomposite.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/u_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_serial.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_acm.ko
insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/g_serial.ko
getty /dev/ttyGS0 115200

2. I placed the file in the root folder of the MicroSD.
3. Now with the M3K connected through USB and the MicroSD inside the M3K I turn it on and on the boot menu I go to TOOLS -> Run script. I select "serial_connection.sh" and I see a message "Running serial_connectio" that lasts around 5 seconds, then it's back to the boot menu.

On the computer I tried installing termite for windows https://www.compuphase.com/software_termite.htm and with the following settings: https://dl.dropboxusercontent.com/s/g2tr7ezcjxnjz7i/vivaldi_7Zpj9Vw9SW.png
I don't have more options than COM1.

It doesn't work and I don't know what else to try.
Title: Re: Fiio M3k
Post by: efqw on May 29, 2020, 11:17:53 AM
You'll be able to see a new serial port pop up on your computer after you launch the script, and the script is blocking, which means it won't quit unless you actually hang up in the serial terminal. I've never tried this in windows, maybe you could use a Linux vm?
Title: Re: Fiio M3k
Post by: diegopau on May 30, 2020, 02:15:51 PM
Done! thank you! I had to use
Code: [Select]
getty /dev/ttyS0 115200instead of
Code: [Select]
getty /dev/ttyGS0 115200
Title: Re: Fiio M3k
Post by: daps on June 20, 2020, 03:42:39 PM
Seems like the Fiio M3 Pro is the new hot budget player. Anyone messing around with it or is it similar to the M3k?
Title: Re: Fiio M3k
Post by: darkcity on June 21, 2020, 05:50:21 AM
It is similar to the M3k

https://www.fiio.com/m3pro_comparisons

It uses the same SoC, Ingenic X1000E, so hopefully rockboxable.

It has a larger touch sensitive screen. Battery life isn't as good.
Title: Re: Fiio M3k
Post by: efqw on July 15, 2020, 02:09:21 AM
Seems like the Fiio M3 Pro is the new hot budget player. Anyone messing around with it or is it similar to the M3k?

The hardware setup should be sufficiently similar to the M3K, but this is a full touchscreen device. While it is indeed more aesthetically pleasing, I don't think it'll work as well with rockbox as the M3K would.
Title: Re: Fiio M3k Rockbox Port
Post by: LuismaSP89 on August 05, 2020, 11:54:54 AM
The left-right balance does not work for me.
Will be fixed in the next version.

Hi  @Xvortex, do you know when you're going to release the next update? Like other users, the forward/rewind buttons doesn't work, and it's a shame since rockbox works with great performance on the M3K, but can't be used normally because of this bug. Also I can't change the track with the "next/previous" button if the loop option is selected for 1 track.

Thank you for taking your time developing this rockbox for M3K  ;)
Title: Re: Fiio M3k
Post by: ZoRG172 on September 03, 2020, 03:58:45 PM
Is there any way to make sure that the blocking blocks only the touch buttons, and the mechanical buttons continue to work as in the native firmware?

upd
I understand correctly that without the author of the port XVortex softlock cannot be installed in any way?
From this post https://forums.rockbox.org/index.php?topic=51589.0
I'm willing to pay for this function: Softlock Options: Disable Touch (Blocks touch screen buttons like the original (only for touch devices) and for fixing the rewind, but the author does not respond  :'(
As there is a device, it’s useless for me, I’ll have to sell it.