Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: Abbott on October 02, 2018, 11:42:50 PM

Title: Building 3.14 with mSATA patch
Post by: Abbott on October 02, 2018, 11:42:50 PM
Hi guys.

I just got an iFlash.xyz mSATA (https://www.iflash.xyz/store/iflash-sata/) adapter and a 500GB 860 EVO mSATA (https://www.amazon.com/gp/product/B07822P8JY/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1) drive for my iPod video 5G. I was able to throw the adapter and drive in and restore the iPod in iTunes, but I was having problems getting Rockbox working. I was getting

ATA error: -11 Press ON to debug

whenever I tried booting Rockbox. I googled around a bit and found this patch (http://gerrit.rockbox.org/r/#/c/469/) that claims to fix firmware timings with an mSATA drive. I applied the patch using these commands

Code: [Select]
$ git clone git clone http://gerrit.rockbox.org/rockbox
$ cd rockbox
$ git checkout v3.14
$ git fetch http://gerrit.rockbox.org/rockbox refs/changes/69/469/1 && git format-patch -1 --stdout FETCH_HEAD > msata.patch
$ git apply msata.patch

then built Rockbox, extracted the zip to the root of my iPod and rebooted. It loaded the main menu! If I tried to access anything on the drive though (initializing DB, playing something under files, choosing directories to scan in settings) the iPod would freeze and require a hard reboot. After some more googling, I found this post (http://forums.rockbox.org/index.php/topic,51250.msg237135.html#msg237135) where someone posted a prepatched and built version of Rockbox 3.13 that included support for mSATA drives. I downloaded this version and tried it and I have full Rockbox functionality... on 3.13.

The person on that thread didn't list what changes they made to allow for mSATA support, but from all of the other posts I've read, it sounds like it's just the path I linked to earlier. Is there something I did wrong when building Rockbox that I could change to get 3.14 working on my iPod?

Thanks
Title: Re: Building 3.14 with mSATA patch
Post by: saratoga on October 11, 2018, 06:34:36 PM
The patch applied to that build you linked is provided in the same post.  It is not the same change.  Probably you need to apply that to the current git version, although looking at the patch it is not very clean so you might need to tweak it to apply to modern versions of the source.
Title: Re: Building 3.14 with mSATA patch
Post by: Abbott on January 31, 2019, 09:54:45 PM
Okay, so these are the steps I've followed to get what I think is a working version of v3.14 with mSATA support:

1. Get a copy of the v3.14 source:
Code: [Select]
$ git clone http://gerrit.rockbox.org/rockbox
$ cd rockbox
$ git checkout v3.14

2. Get the patch and apply
Code: [Select]
$ wget https://gist.githubusercontent.com/anonymous/5f3bcab69a01fdfa9f47bac73b74cf10/raw/ea12373570d0cb0e78286c64112927162b77c2e6/ipod5g_msata_mod.patch
$ git apply -3 ipod5g_msata_mod.patch
I ignored the whitespace errors, as they were all on comment lines.

3. Resolve the conflict
The affected lines start at 460:
Code: [Select]
<<<<<<< ours
#ifdef STORAGE_WANTS_ALIGN
    /* align start and length for DMA */
    STORAGE_ALIGN_BUFFER(audiobuf, audiobuflen);
#else
    /* align start and length to 32 bit */
    ALIGN_BUFFER(audiobuf, audiobuflen, 4);
#endif
=======
    /* align start and length to 16 byte */
    align = (-(intptr_t)audiobuf) & 0xf;
    audiobuf += align;
    audiobuflen = (audiobuflen - align) & ~0xf;
>>>>>>> theirs
which I changed to:
Code: [Select]
    int align = (-(intptr_t)audiobuf) & 0xf;
    audiobuf += align;
    audiobuflen = (audiobuflen - align) & ~0xf;
#ifdef STORAGE_WANTS_ALIGN
    /* align start and length for DMA */
    STORAGE_ALIGN_BUFFER(audiobuf, audiobuflen);
#else
    /* align start and length to 16 byte */
    ALIGN_BUFFER(audiobuf, audiobuflen, 4);
#endif

4. Follow the rest of the build instructions found here (https://www.rockbox.org/wiki/HowToCompile)

If I check the version under System > Rockbox Info > Version, it says I'm running f2de779393M-190131
Rockbox seems to be working alright so far, but I can't say that this is a slam dunk because I'm not confident that changing the align the way I did is safe or appropriate.

Is this an unsafe build to run? Is there something I should change about how the aligning is being done?
Title: Re: Building 3.14 with mSATA patch
Post by: artlogic on February 16, 2019, 12:36:14 AM
Thanks for posting that patch. I made a small change to what you posted. Here's my diff:


diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 339bcb8020..e9b594aecd 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -461,8 +461,8 @@ enum plugin_status plugin_start(const void* parameter)
     /* align start and length for DMA */
     STORAGE_ALIGN_BUFFER(audiobuf, audiobuflen);
 #else
-    /* align start and length to 32 bit */
-    ALIGN_BUFFER(audiobuf, audiobuflen, 4);
+    /* align start and length to 16 bytes */
+    ALIGN_BUFFER(audiobuf, audiobuflen, 16);
 #endif


Not that it matters as this is just code in the test_disk app.
Title: Re: Building 3.14 with mSATA patch
Post by: Curandero on April 23, 2019, 12:40:59 AM
Hi Abbott and Artlogic

You have done exactly what I'm looking to do, patch v3.14 with the mSATA patch for my modded iPod video.

I was wondering if you could update me on how it's been running for you since you posted above?

Also, I've been reading a lot but I'm 14 years out of practice from compiling code. Currently I'm struggling with getting a Unix system to run through VirtualBox on my Windows 10 machine. Do you have any recommendations for tutorials to get this going? Or, if you're feeling extremely charitable would you consider emailing or linking me to the rockbox.zip of the patched v3.14?

Thanks in advance!
Title: Re: Building 3.14 with mSATA patch
Post by: burkjavier on June 09, 2019, 01:23:01 PM
Hi Abbott and Artlogic

You have done exactly what I'm looking to do, patch v3.14 with the mSATA patch for my modded iPod video.

I was wondering if you could update me on how it's been running for you since you posted above?

Also, I've been reading a lot but I'm 14 years out of practice from compiling code. Currently I'm struggling with getting a Unix system to run through VirtualBox on my Windows 10 machine. Do you have any recommendations for tutorials to get this going? Or, if you're feeling extremely charitable would you consider emailing or linking me to the rockbox.zip of the patched v3.14?

Thanks in advance!

Been messing around with mSATA on my IPod Video and, I think, I got this working with 3.14 (or at least the latest dev build...I did use the instructions here for git checkout v3.14).  Standard vanilla build I was having the same issues with my setup, would freeze up pretty quickly.

Use at your own risk of course but it's been working for me with some small testing, my compiled zip is here:
https://mega.nz/#!TVI3XCbb!21_4gwgO_0P7BA4QfgaU0GyeKX2a4tT2sAc1PWJ0CBM