Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  New Ports
| | |-+  Fiio M3k
« previous next »
  • Print
Pages: 1 ... 4 5 [6] 7 8 ... 12

Author Topic: Fiio M3k  (Read 26852 times)

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #75 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.
* fiio-m3k-rb.zip.txt (3.03 kB - downloaded 28 times.)
« Last Edit: November 30, 2020, 01:21:00 PM by alexs »
Logged

Offline bahus

  • Member
  • *
  • Posts: 69
Re: Fiio M3k
« Reply #76 on: November 30, 2020, 12:59:50 PM »
Quote from: 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.

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)
« Last Edit: November 30, 2020, 01:10:21 PM by bahus »
Logged

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #77 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.
Logged

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #78 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.
Logged

Offline bahus

  • Member
  • *
  • Posts: 69
Re: Fiio M3k
« Reply #79 on: November 30, 2020, 01:44:14 PM »
Quote from: alexs on November 30, 2020, 01:32:59 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...
« Last Edit: November 30, 2020, 01:46:11 PM by bahus »
Logged

Offline speachy

  • Administrator
  • Member
  • *
  • Posts: 235
Re: Fiio M3k
« Reply #80 on: November 30, 2020, 01:47:21 PM »
Quote from: 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.

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.
« Last Edit: November 30, 2020, 01:51:33 PM by speachy »
Logged

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #81 on: November 30, 2020, 03:00:50 PM »
Quote from: 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".

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.
Logged

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #82 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.
* fiio-m3k-rb.zip.txt (3.61 kB - downloaded 32 times.)
« Last Edit: December 01, 2020, 12:18:45 PM by alexs »
Logged

Offline bahus

  • Member
  • *
  • Posts: 69
Re: Fiio M3k
« Reply #83 on: November 30, 2020, 05:12:08 PM »
Quote from: alexs on November 30, 2020, 04:25:09 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...
« Last Edit: November 30, 2020, 05:17:24 PM by bahus »
Logged

Offline whiskerc

  • Member
  • *
  • Posts: 5
Re: Fiio M3k
« Reply #84 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.
Logged

Offline vitt13

  • Member
  • *
  • Posts: 17
Re: Fiio M3k
« Reply #85 on: December 01, 2020, 12:38:01 PM »
Quote from: alexs on November 30, 2020, 03:00:50 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.

* usb_boot.png (61.63 kB, 936x602 - viewed 30 times.)

* boot_config_x1000e.png (79.82 kB, 723x549 - viewed 27 times.)
Logged

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #86 on: December 01, 2020, 01:26:51 PM »
Quote from: vitt13 on December 01, 2020, 12:38:01 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.
« Last Edit: December 01, 2020, 01:36:27 PM by alexs »
Logged

Offline alexs

  • Member
  • *
  • Posts: 15
Re: Fiio M3k
« Reply #87 on: December 01, 2020, 01:47:42 PM »
Quote from: vitt13 on December 01, 2020, 12:38:01 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.
« Last Edit: December 01, 2020, 01:59:13 PM by alexs »
Logged

Offline vitt13

  • Member
  • *
  • Posts: 17
Re: Fiio M3k
« Reply #88 on: December 03, 2020, 02:55:25 PM »
Quote from: alexs on December 01, 2020, 01:26:51 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?
Quote from: wodz on March 18, 2019, 05:08:56 AM
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.
Logged

Offline bahus

  • Member
  • *
  • Posts: 69
Re: Fiio M3k
« Reply #89 on: December 06, 2020, 10:51:05 AM »
Hm... And only now I've noticed that XVortex also provided a way to update rockbox right from boot menu. Go to Tools -> Update rockbox (and script copies .rockbox folder from SD card to internal player storage).

Compared to XVortex latest build has following flaws (no matter how it's been installed via alexs firmware or via Tools):
1) XVortex standard theme is better adjusted (bigger fonts, playing track info in lists etc)
2) Strange shutdown behavior. In latest build you need to press shutdown button way longer. It looks like it's now two stage shutdown (first screen then backlight)
3) It looks like there is power drain when player is shut down by Idle power off or Sleep timer. Noticed few times that after full charge it's been almost dead next day when it's been shut down by idle power off after only few minutes of real use.
« Last Edit: December 06, 2020, 10:58:48 AM by bahus »
Logged

  • Print
Pages: 1 ... 4 5 [6] 7 8 ... 12
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  New Ports
| | |-+  Fiio M3k
 

  • SMF 2.0.18 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.1 seconds with 16 queries.