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.
Title: Re: Fiio M3k
Post by: speachy on September 28, 2020, 09:50:12 PM
FYI, over the weekend I received the M3K sources from xvortex.

It's probably going to take a week or two but I'm working on getting the patch sliced into more mergable/reviewable chunks.
Title: Re: Fiio M3k
Post by: chinchin on September 29, 2020, 04:02:47 AM
That's great news. Thanks so much to you both.
Title: Re: Fiio M3k
Post by: fossphile on October 01, 2020, 12:26:42 AM
+1 great news to read. Will be very happy to see skip bug fixed :D.
Title: Re: Fiio M3k
Post by: speachy on October 01, 2020, 07:52:46 AM
+1 great news to read. Will be very happy to see skip bug fixed :D.

For my reference, what exactly is this "skip bug" and how would one go about recreating it?    (Basically, is it something unique to the m3k, or is it shared with other devices?)
Title: Re: Fiio M3k
Post by: Thew on October 03, 2020, 03:05:20 AM
I think “fossphile” is referring to the fact that the two screen buttons for track skipping forward and back don’t work in “vortex's” second Rockbox version. They also don’t work for continuous fast-forward and rewind. They both work correctly in “vortex’s” first Rockbox download.
Title: Re: Fiio M3k
Post by: Summer Element on October 03, 2020, 07:17:28 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).

Actually, it can be fixed by changing some setting. Turn to setting-playback settings-fast_forward/rewind and change the step. My M3k has been okay now after that.  ;)
Title: Re: Fiio M3k
Post by: lubatur on October 03, 2020, 08:39:19 AM
Turning to: setting > playback settings > fast_forward/rewind didn't work quite well for me, but:
installing Vortex's firmware M3K_v1.3.0_eef591e-190901.zip, found here: http://xvtx.ru/rockbox/download.htm (http://xvtx.ru/rockbox/download.htm) > FiiO M3K > All versions, FF/RW works as usual.
Thanks to member bbame for finding out/testing and informing.
Title: Re: Fiio M3k
Post by: Njones on October 03, 2020, 01:18:15 PM
How  do you add additional themes to this update?
Title: Re: Fiio M3k
Post by: speachy on October 03, 2020, 01:20:00 PM
With regards to the seek problem, I found and fixed the underlying problem in the vortex code dump -- it was a "Fix" for the LCD not getting shut off properly, but it had some nasty side effects on all of the hosted targets too.

the m3k-specific stuff is close to being mergeable but we need to be able to patch a new bootloader/launcher into the m3k flash image before it'll be of any use to anyone.

Title: Re: Fiio M3k
Post by: speachy on October 04, 2020, 07:59:49 PM
Good news:  The code is finally cleaned up to the point where the m3k binary and bootloader compile cleanly, and it's only a few to-dos away from being ready to merge:

   https://gerrit.rockbox.org/r/#/c/2804/

The bad news is that this code remains completely untested.  We do not yet have the technical ability to generate the patched firmware update image that is necessary to install our bootloader/launcher.  Figuring that out (in a way that can be scripted) is next.
Title: Re: Fiio M3k
Post by: Thew on October 05, 2020, 03:35:06 PM
I’d just like to add my appreciation of your efforts. I have two M3Ks, one of which I’ve Rockboxed with Xvortex’s first version. I particular enjoy creating my own custom User Interface and the initial promise of Rockbox on the M3K is very good. If things work out OK perhaps I’ll end with Rockbox on both my players.
Title: Re: Fiio M3k
Post by: speachy on October 09, 2020, 09:15:49 PM
The port code has landed in the main rockbox repo, and builds are now being generated by the build farm.

Again, this can *not* be deployed on top of an existing xVortex port.  Please do not attempt to do so.

I have not started to work on inserting our loader/launcher into an existing (stock) firmware image.  I do not know how long that will take.
Title: Re: Fiio M3k
Post by: fossphile on October 09, 2020, 10:00:35 PM
yay! brill news. looking forward to installing it on my m3k  :D :D :D
Title: Re: Fiio M3k
Post by: fossphile on October 09, 2020, 10:04:06 PM
With regards to the seek problem, I found and fixed the underlying problem in the vortex code dump -- it was a "Fix" for the LCD not getting shut off properly, but it had some nasty side effects on all of the hosted targets too.

the m3k-specific stuff is close to being mergeable but we need to be able to patch a new bootloader/launcher into the m3k flash image before it'll be of any use to anyone.

YAY!!!!  :D :D :D :D ;D :D :D :D :D that bug has been so annoying!
Title: Re: Fiio M3k
Post by: fossphile on October 09, 2020, 10:07:26 PM
I think “fossphile” is referring to the fact that the two screen buttons for track skipping forward and back don’t work in “vortex's” second Rockbox version. They also don’t work for continuous fast-forward and rewind. They both work correctly in “vortex’s” first Rockbox download.

it was fast forward/backward. i was annoyed at the compromise of losing skip back/forth in order to tap to skip x sec instead of hold down for fast forward/rewind.
Thank you for mentioning my woe.  :)
Title: Re: Fiio M3k
Post by: diegopau on October 10, 2020, 04:50:59 PM
This is great news! quite exciting, I am using the M3K heavily and it is great device even with the existing firmware limitations. Thank you speachy for working on this.

Some suggestions that I already posted in a different thread. I know it is too early, I just wanted to leave them documented since this is where the development is being reported.

- While playing any audio file, in the "While Playing" screen, there are no actions assigned to the touchpad (scrolling up / down), I think it would be a great feature to control the volumen up/down there by swipping up/down the touchpad button. That way we don't need to use the hardware buttons to control volume as long as we are seeing that screen.  even better if it is customizable, some people might prefer brightness up/down, right now there is no action assigned to scroll up/down the touchpad during playback.
- It would be good to remove the problem that efqw explained about how the firmware is constantly logging to a file and maybe wearing out the NAND.
- Is it possible to setup the M3K so it just starts directly to Rockbox without any countdown and just with a single click on the power button (instead of long press)? that's how the clip zip is setup by default: quick click to power button runs Rockbox, power button + volume down button runs Sansa firmware. This makes it quick to turn it on and it is also more gentle on the power button, it will last longer.
- Currently there doesn't seem to be a way to stop the playback, the playback can be paused, but not stopped. I think this is important for the power saving options. So if for example in the clip zip I used to be able to tap in a button that will create a bookmark and stop the playback, and if there is a automated power off setting for 5 minutes of standby, then in 5 minutes the device is off. In the M3K if I am listening to an audiobook and I can only pause the playback and then the automatic stand by power off setting is never triggered.
- It is currently a bit difficult to reach the screen that allows you to select the playback speed, i use it to slowdown a bit audiobooks. I mean this one https://www.dropbox.com/s/jnl5ddplhm6w0p7/IMG_20191112_203959.jpg?dl=0, in the clip zip I accessed it by long pressing the pause/play button, I can't find any button that takes me there in the Fiio M3K, but I did see that there is a way to access it by navigating quite a bit.


Issues that I had
- I have a big file (a long audiobook) that plays perfectly on the Sansa Clip Zip with Rockbox, and also in the Fiio M3K when using Fiio firmware. It doesn't however play when using Rockbox in Fiio M3K, it doesn't do anything. Are there any logs that I can attach? where can I find them? The file properties can be seen here https://www.dropbox.com/s/rh5u0227297uf3q/SMPlayer%20-%20File%20properties%202019-11-12%2020.38.28.png?dl=0, I can share it with you in private if that helps.
- The problems with transferring files through USB, in general this doesn't seem to work. Not a big deal to me, I just transfer them directly to the sd card.
Title: Re: Fiio M3k
Post by: speachy on October 10, 2020, 05:37:29 PM
Some suggestions that I already posted in a different thread. I know it is too early, I just wanted to leave them documented since this is where the development is being reported.

It is _far_ too early to talk about feature/bugrequests, especially versus an unofficial build/fork.

I can only promise you that when the "official" binaries are finally installable, they will present a different set of bugs than what you're used to.
Title: Re: Fiio M3k
Post by: fossphile on October 12, 2020, 12:56:53 PM
I can only promise you that when the "official" binaries are finally installable, they will present a different set of bugs than what you're used to.
Sounds like a improvement :)
Title: Re: Fiio M3k
Post by: bahus on October 21, 2020, 11:59:36 AM
Would be cool to have option to replace volume buttons with next/prev actions and move volume control to touch slider (so making control very similar to iriver h10). I believe it would make it conveniently controlled from the pocket.
Title: Re: Fiio M3k
Post by: alexs on November 07, 2020, 07:41:41 PM
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.

No idea what's the current status here, so just in case, I think I have a way (or one more way) of installing pretty much anything on this device now. There's nothing really Linux-specific about it, but it does involve a valid original M3K.fw. It is however very easy to patch out once discovered, assuming anyone at FiiO cares.

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

Shanling M0 uses the same kind of signed update packages. With the same exact public key for signature checks.

1. The main player application is aggressively logging to /data/userfs/app.log.

A bit of trivia. Navigate to Settings -> About, and press the pause button TWELVE times. The player will copy app.log to the SD card, along with the kernel log. If there's a file named "fiio_linux_app_debug_cmd" in the root directory of the SD card, it will also attempt to capture and copy core dumps of the player application.
Title: Re: Fiio M3k
Post by: speachy on November 08, 2020, 09:51:55 AM
Shanling M0 uses the same kind of signed update packages. With the same exact public key for signature checks.

In other words, it's probably the default Ingenic signing key, probably hiding somewhere in the bowels of their SDK sources...
Title: Re: Fiio M3k
Post by: whiskerc on November 24, 2020, 08:28:26 AM
Just checked in and discovered that progress is being made on the M3K port.  This is excellent news.  Thank you!

When it comes to the point where you are looking for testers, I would be more than happy to help in any way possible.   I have an M3K currently running xvortex M3K_v1.4.3_e99db03-191013.
Title: Re: Fiio M3k
Post by: bahus on November 29, 2020, 03:55:46 PM
when the "official" binaries are finally installable, they will present a different set of bugs than what you're used to.

Why there is no daily builds for this target?
I got that's it's not automatically installable - but isn't it the case for other targets like Xuelin?


I think I have a way (or one more way) of installing pretty much anything on this device now. There's nothing really Linux-specific about it, but it does involve a valid original M3K.fw. It is however very easy to patch out once discovered, assuming anyone at FiiO cares.
If I understand correctly there is some way that can be used for manual installation.
So daily builds might be useful if alexs shares his manual installation method..
Title: Re: Fiio M3k
Post by: saratoga on November 29, 2020, 06:03:31 PM
https://build.rockbox.org/data/rockbox-fiiom3k.zip
Title: Re: Fiio M3k
Post by: Njones on November 29, 2020, 08:05:03 PM
Do you load the zip file or do you unzip it first? Also do you delete the previous rockbox file first?
Title: Re: Fiio M3k
Post by: Njones on November 29, 2020, 08:21:17 PM
Nevermind updated rockbox through tools. The problem that no matter which theme I use it only fills about 1/4 of the screen.
Title: Re: Fiio M3k
Post by: speachy on November 29, 2020, 08:36:04 PM
It seems I need to repeat myself:

The port code has landed in the main rockbox repo, and builds are now being generated by the build farm.

Again, this can *not* be deployed on top of an existing xVortex port.  Please do not attempt to do so.
Title: Re: Fiio M3k
Post by: Njones on November 29, 2020, 08:45:54 PM
Does that mean Delete the previous version and then install this latest one or is this one not ready yet. Please Bear with me , I'm a 69 year old non tech savvy music lover who has used rockbox on several sansa players and the agptek Rocker.
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 05:30:55 AM
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)
Removed... But I found the tutorial and the link on that archive http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html (http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html). It's on Baidu net disk.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 07:57:58 AM
The tool I used for getting shell access / injecting files into the rootfs. Base64 ZIP. Instructions inside.

Best I can tell, this trick should also work on M3 Pro, I have one ordered and I'll try it once it arrives.
But it's 2020 so that might be next week or next year.

Also I got my test device into the USB boot mode and it works great! but I cannot boot the system like that yet.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 08:26:30 AM
Removed... But I found the tutorial and the link on that archive http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html (http://www.ingenic.com.cn/?newsshow/tp/228/id/775.html). It's on Baidu net disk.

The kernel itself is here: https://github.com/FiiOapp/FiiO_Kernel_M3K
They did not even bother renaminig halley2 files, so arch/mips/xburst/soc-x1000/chip-x1000/halley2 is in fact M3K.
The docs for the SoC are also easily available on Github.

Getting the rest of the SDK from Baidu would be nice though.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 08:33:15 AM
Base64 ZIP. Instructions inside.

Well.. That's doesn't look as simple instruction for windows user... Just in case attaching decoded txt directly to zip (just remove .txt extension from downloaded file)..
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 09:50:44 AM
The tool I used for getting shell access / injecting files into the rootfs. ... Also I got my test device into the USB boot mode and it works great! but I cannot boot the system like that yet.
Nice! It would be great to steal raw content (with dd tool?) as is all the partitions to be able re-flash (be able recover) with the factory tool "USB cloner v2.5.0". We have only bootloader, kernel image and system ubi image extracted from M3K.fw.
I mean the tool I found here under "burning tools" http://www.ingenic.com.cn/en/?product/id/9/lm/4.html
Just found that Chinese page has the newest tools http://www.ingenic.com.cn/?product/id/9/lm/3.html
Someone have to find out what config we need to use with M3K.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 10:22:03 AM
Well.. That's doesn't look as simple instruction for windows user... Just in case attaching decoded txt directly to zip (just remove .txt extension from downloaded file)..

The only idea of a simple solution for Windows (or Mac) users I can come up with right now is to provide them with a pre-modified M3K.fw. So somebody would build Rockbox, prepare the files and put them up for download. All that on a Linux host of course. The Window users would need to transfer a couple of files onto an SD card and boot the device with the button pressed.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 10:33:12 AM
We have only bootloader, kernel image and system ubi image extracted from M3K.fw.

There are two more partitions there: recovery, which we also have, and userdata which doesn't containt anything important.
Keep in mind rootfs and userdata are both ubi partitions, so dd'ing them is not the best idea.

Quote
Someone have to find out what config we need to use with M3K.

One of the -sfc-nand- options. There's no NOR flash there and this device is not configured to boot from MMC.

That tool will only work with the device in bootrom / USB boot mode. There are two ways to get there: wiping the bootloader (which is what I did on my device) or soldering one of the bootconfig resistors (which should be possible but requires opening the case). Unmodified device running stock firmware will not respond to those requests.

You don't need their Windows tool either. There's a Linux package called ingenic-boot which has the tools to do all of that I think. It's for earlier Ingenic chips but it did not take much for me to make it work with x1000. It's also very simple on the Linux side, because fundamentally all it does is uploading raw code into device's RAM and letting it run there.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 10:46:04 AM
So somebody would build Rockbox

Well this part is already done - daily fiio m3k builds available here: https://build.rockbox.org/data/rockbox-fiiom3k.zip
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 10:52:50 AM
alexs, Thank you for clarifying.
You don't need their Windows tool either.
Just a note: they also provide Linux tool.
Title: Re: Fiio M3k
Post by: vitt13 on November 30, 2020, 11:15:34 AM
alexs, I thought it should have a trick action to get fastboot mode and then use "Clone tool".
I found there is a set of action for Ingenic XBurst M200S based smart watch https://forum.xda-developers.com/smartwatch/other-smartwatches/amazfit-boot-fastboot-directly-t3546829 and how recovery it with Ingenic Clone tool https://forum.xda-developers.com/smartwatch/amazfit/tutorial-ingenic-cloner-tool-aamzfit-t3908237
but as you say it's not possible for M3K...
Title: Re: Fiio M3k
Post by: speachy on November 30, 2020, 11:39:11 AM
Well this part is already done - daily fiio m3k builds available here: https://build.rockbox.org/data/rockbox-fiiom3k.zip

That's actually updated on every commit; there are no "daily" build snapshots kept for the M3K.

But while there is a rockbox build, the necessary platform integration (ie the rockbox loader application, system scripts, etc) remains to be done.  And there's a lot of work to be done on that front -- While the loader is written, it has seen no meaningful testing, and worse yet, the m3k's underlying Linux kernel and base OS is a real hacky mess, with stuff we take for granted on every other platform simply not working. As an example of this, custom userspace code needs to be written to *shut down* the player because the kernel doesn't have the correct stuff hooked up to be able to use the standard Linux APIs that have been around for literally decades.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 12:15:35 PM
Well it turned out to be quite easy, although I wouldn't call Rockbox usable at this point.

Tool attached. Put the modified M3K.fw together with rockbox-fiiom3k.zip on an SD card and update the player.
The modified M3K.fw can be reused as long as .rockbox/rockbox.m3k path in the zip remains the same.

Edit: "No Rockbox directory, installation incomplete". Well that would explain things.

Edit 2: DON'T USE this script it is wrong, see below.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 12:59:50 PM
Well it turned out to be quite easy, although I wouldn't call Rockbox usable at this point.

Are you saying it's less usable than builds provided by XVortex? https://mega.nz/folder/0wckiIIZ#o_-7wp3aT_ob-EoxsteNqw/folder/EpVAQQ7K (M3K_v1.3.0_eef591e-190901.zip is less buggy than latest)

Can you share modified M3K.fw (using google drive or some free file sharing services like https://gofile.io/ or https://mega.nz)
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 01:07:42 PM
Nah, I got it playing and it looks much better now.

This build wants the .rockbox directory to be on the SD card. Not in the internal rootfs where I tried to put it initially.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 01:32:59 PM
Ok so if the idea was to keep Rockbox completely on the SD, I can see how that could work, but I'll need some time to think how to set it up in way that would make any sense. SD cards are removable and hot-pluggable on this device.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 01:44:14 PM
I'll need some time to think how to set it up in way that would make any sense. SD cards are removable and hot-pluggable on this device.

That's also true for all recent Chinese targets (all xDuoo and Aigo ports, Agptek Rocker, ...) where internal memory is not exposed. All of them load rockbox from external SD - that makes rockbox update pretty easy... So I see nothing to worry about it...
Title: Re: Fiio M3k
Post by: speachy on November 30, 2020, 01:47:21 PM
Ok so if the idea was to keep Rockbox completely on the SD, I can see how that could work, but I'll need some time to think how to set it up in way that would make any sense. SD cards are removable and hot-pluggable on this device.

General approach:

1) updated rockbox launcher copied to onboard flash, and startup script modified to launch it.
2) mdev rules updated to auto mount/unmount filesystems upon hotplug.
3) fix bugs as they come up.


As an example of what we care about with (1) and (2), see https://git.rockbox.org/cgit/rockbox.git/tree/tools/hiby_patcher.pl starting around line 137.

EDIT:   The stuff targeting the m3k specifically starts on line 229.  It is _very_ incomplete.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 03:00:50 PM
alexs, I thought it should have a trick action to get fastboot mode and then use "Clone tool".

It might be implemented in the recovery tool. I poked around a lot with Ghidra there, but it's a pretty large piece of code and I wasn't looking for input related things. It does seem to have some input handling code even though it doesn't appear interactive at all. You might be on to something here. Or it might be just some stray code from their GUI library. Either way, it will likely take some time to find out.

I can tell for sure that the 2nd stage bootloader (x-loader) does not support fastboot, and cannot re-activate the bootrom USB mode. The only choice it makes is between the main kernel and the recovery kernel. The USB mode I was talking about is not fastboot either, it's Ingenic specific and it's much simpler than fastboot. I assumed Ingenic tools would use it over fastboot, but now that I think of it, the recovery tool was probably developed by Ingenic as well, so who knows.
Title: Re: Fiio M3k
Post by: alexs on November 30, 2020, 04:25:09 PM
Updated scripts. Should properly run rockbox from SD by copying the loader to internal storage.

Booting without SD card in the slot = USB console.
Booting with SD but no .rockbox there = FiiO player.
Booting with SD and .rockbox is there = RockBox.

Modified M3K.fw: https://gofile.io/d/giokMw

Do not forget to unpack rockbox-fiiom3k.zip onto the SD, there are no Rockbox parts in that M3K.fw.
Title: Re: Fiio M3k
Post by: bahus on November 30, 2020, 05:12:08 PM
Should properly run rockbox from SD by copying to loader to internal storage.
Cool! Thanks! I gave a quick look... Noticed issues: Shutdown doesn't work properly - button backlight is on after shutdown (need to keep power button pressed longer - backlight will be off too) ; USB storage mode doesn't work - only charges on USB insertion...
Title: Re: Fiio M3k
Post by: whiskerc on December 01, 2020, 10:42:26 AM
>Updated scripts. Should properly run rockbox from SD by copying to loader to internal storage.

Yes, clear instructions.  The M3K starts up right to Rockbox when the SD card is loaded.  Will wait to do more testing but wanted to pass on the news that it does work on another M3K.
Title: Re: Fiio M3k
Post by: vitt13 on December 01, 2020, 12:38:01 PM
It might be implemented in the recovery tool.
I've just found the IRC https://www.rockbox.org/irc/log-20200706 messages from efqw_

Quote
With Ingenic's USB Cloner tool, the entire flash can be overwritten without disassembling the device. I have already tried erasing the entire NAND and flashing back my own NAND dumps and it worked perfectly fine.

From what I can see, it loads a ~6kB u-boot SPL into the memory which does memory initialization, and then loads a pre-built u-boot binary, and this is what interacts with the cloner device from now on.

So we can replace the bootloader with u-boot or even re-partition the NAND in theory, but I'm not sure if that's worth the effort to be honest.
Unfortunately there is no detail how he got own NAND dumps.

But I still have not complete understanding how efqw_ did that. I read the X1000/E DS and flow chart shows that USB boot takes part after fail with SFC boot and MSC1 (not presented in FiiO M3K obviously) boot. It seems like SFC boot fails with presented USB connections, or he found magical button pressing set, other than
Quote
Darn it. I was trying to find the boot select pins on the FiiO M3K, and looks like I won't be able to find it unless I pull the SoC off.

boot_sel[0] (PB28) is tied to Volume Down, which is nice I guess

What I wanted was PB29, which is not defined in the source unfortunately. I could make it boot from mmc if I pull down PB29.
Title: Re: Fiio M3k
Post by: alexs on December 01, 2020, 01:26:51 PM
From what I can see, it loads a ~6kB u-boot SPL into the memory which does memory initialization

Oh ok so this what I was messing with. It can only be done if the device is in the USB boot mode. Then it would allow you to upload the SPL.

Quote
boot_sel[0] (PB28) is tied to Volume Down, which is nice I guess

OMFG I'm an idiot. Bingo! That's all you need to flash the device. No need for my unzip hack. No need for Ghidra.
It might take some work to get u-boot working and/or write something custom but it's a clear and straighforward task now.

Power the device down, then plug it into a USB host while holding vol-down button.
It will light up the buttons and enumerate as Ingenic x1000. That's the USB boot mode.

Code: [Select]
[3114458.858415] usb 1-3: new high-speed USB device number 86 using xhci_hcd
[3114459.000769] usb 1-3: New USB device found, idVendor=a108, idProduct=1000, bcdDevice= 1.00
[3114459.000775] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[3114459.000778] usb 1-3: Product: X\x10
[3114459.000781] usb 1-3: Manufacturer: Ingenic

Just for reference, I got to this mode by wiping the header of the NAND bootloader from Linux.
If the header is invalid, SFC boot always fails, so it proceeds to the next option which is USB.

Edit: and I was trying hold-button-power-up with each button! But apparently messed up somewhere.
Title: Re: Fiio M3k
Post by: alexs on December 01, 2020, 01:47:42 PM
Quote
What I wanted was PB29, which is not defined in the source unfortunately. I could make it boot from mmc if I pull down PB29.

Really no need for this by the way. An SPL/TPL capable of loading the next stage from SD card would be enough.

Ingenic x-loader seems to support MMC boot by the way. So it might be really easy.
u-boot is another option, although I don't think this device needs u-boot.
Title: Re: Fiio M3k
Post by: vitt13 on December 03, 2020, 02:55:25 PM
That's all you need to flash the device. No need for my unzip hack. No need for Ghidra.
It might take some work to get u-boot working and/or write something custom but it's a clear and straighforward task now.
It's clear for me now, thanks.

So, generally, running M3K port has to be close to AGPTEK Rocker port (X1000 based), right?
Let me elaborate a bit to clarify situation (please refer to https://www.rockbox.org/wiki/AgptekRocker for additional info). Agptek first loads tiny bit of binary code (SPL) into cold cache which main role is to configure PLL (aka clocks) and RAM controller. Then it loads bootloader (uboot) into ram and passes control to it. Uboot loads linux kernel either from mtd2 or mtd3 (normal kernel or recovery kernel) and passes control to linux. If it is normal boot, kernel mounts UBIFS rootfs from mtd4, if it is recovery boot, kernel loads rootfs from concatenated to itself image. Kernel (both normal and recovery) calls init process (the parent of all processes). Init runs startup scripts to run various services and finally runs hiby player binary which presents GUI for the user.

Now after this lengthy introduction - we patch normal rootfs to call rockbox bootloader binary instead of hiby player binary. So from the technical point of view we DO NOT patch bootloader (uboot) and we do not touch recovery image. This makes all process pretty safe.

And another difference is how OF file is packed.
Quote from: efqw_
efqw_   This device is very similar to the AGPTEK ROCKER in terms of hardware spec (no radio, X1000E instead of X1000, different I2S DAC, same PMU, I2C touch controls instead of a D-PAD).
efqw_   Additionally, this device is using X-Loader instead of U-Boot, and system updates are performed with a recovery partition instead.
efqw_   Firmware packages are split into ~1MB chunks and signed individually with apksign, and then zipped together along with a manifest file.
efqw_   This setup is drastically different from the hiby stuff, where the .upt file is an ISO9660 volume and the blobs are not signed.
So, XVortex has the signature cert. from FiiO Tech.Support but we have not. alexs, your unzip hack is genius and quite useful to have access on system console.

I hope my a bit off-topic messages about possible repairing/recovering are not such distracting from main target.