TheKikGen / MPC-LiveXplore

Akai MPC Live/X/Force/One technical explorations and hacks
227 stars 26 forks source link

MPC Live - update image analysis #5

Closed mamatt closed 3 years ago

mamatt commented 4 years ago

Based on some of your work and https://niklasnisbeth.gitlab.io/mpc-internals/#the-audiomidi-control-board work, here is a beginning of the analysis of the update image for the MPC Live.

HEADER and FOOTER are the same between 2.7 and 2.6 except for the bytes below :

ADDR->  MPC 2.6                MPC 2.7

 ------------------ HEADER -----------------------------
0x04   -> 08 69 B5 37       08 7B 3E 9B

0x0C   -> 08 69 B1 10       08 7B 3A 74

0x24   -> 08 69 B0 D8       08 7B 3A 3C

0x4C   -> 5D 2D A0 F4       5D E0 E8 99 => date image ( hour_t) 32bit

0xB8   -> XX XX XX XX XX XX XX XX                 => version : 8 bytes string

0xFC   -> 08 69 AF 94       08 7B 38 F8     => compressed file size (Int32)

 --------------------- IMG -----------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX      => ext4.xz file

 ------------------ FOOTER -----------------------------

ADDR = header size + compressed file size +

0x3C-0x4F -> 20 bytes : hash ? MD5 sum ?

I didn't manage to unpack using https://github.com/neo-technologies/rockchip-mkbootimg/ , I'll keep trying !

By the way I am unable to get MPC firmware < 2.6, did you have a copy of the old updates ?

mamatt commented 4 years ago

Found 0x3C-0x4F :

this is an SHA1 hash of the ext4.xz file !

mamatt commented 4 years ago

0x04 => filesize 0x0C => not sur but seems to be a string table
0x24 => this is strange but is seems to be the adresse of the second byte of sha1 hash !

mamatt commented 4 years ago

I can confirm this is good for 2.2 too ! even if ext4 partition is not compressed !

To summarize :

Headers and footers are quite the same between different image except for those bits :

HEADER
0x04 => int32 MPC-Update filesize 
0x0C => 4 bytes Address of what seems to be a strings table
0x24 => 4 bytes this is strange but is seems to be the address of the second byte of sha1 hash !
0x4C => date image (hour_t) 32bit
0xB8 => 8 bytes string image version
0xFC => Int32 image(payload)  filesize

FOOTER (Addr relative to Footer address)
0x3C-0x4F => SHA1 hash of the payload (ext4 or compressed ext4)

With those infos we should be able to construct a valid MPX-2.X-update.img file and use if with InMusic/AkaiPro stuff to push modified image ;)

mamatt commented 4 years ago

In fact the whole image is a dtb !

you can decompress it with : dtc -I dtb -O dts -o MPX-2.X-update.dts MPX-2.X-update.img

TheKikGen commented 4 years ago

Nice ! I used an hex editor to save the compressed ext4 partiton. It is xy compressed since 2.6. Bien joué Matthieu :-) !

TheKikGen commented 4 years ago

For previous versions of MPC Live/x , it's here : https://www.akaipro.com/amfile/file/download/file/956/product/6/

TheKikGen commented 4 years ago
/dts-v1/;
/ 
{
    timestamp = <0x5de0e899>;
    description = "MPC upgrade image";
    compatible = "inmusic,acv5", "inmusic,acv8";
    inmusic,devices = <0x9e8403a 0x9e8403b>;
    inmusic,version = "2.7.0.43";
    images {
        rootfs {
            description = "Root filesystem";
            data = <  (binary data) >;
            partition = "rootfs";
            compression = "xz";
            hash {
                value = <0xba31c00 0x56e3a8f0 0x9a55019c 0x1e8f64c2 0xb173019b>;
                algo = "sha1";
            };
        };
    };
};.
plule commented 4 years ago

That’s nice, using those tools I could create an usb-installable image with ssh enabled :)

I’ve made that inefficient ugly script to ease extraction of the partition and recreation of the image: https://gist.github.com/plule/67e1c542e2f16d92ddda0ac479010c39

TheKikGen commented 4 years ago

Sure you can ! I will have a look. This could allow us to use the official Akai updater.

plule commented 4 years ago

Not sure about the computer installer, but the MPC itself accepts it without complaining (not using fastboot or the internal debug port)

TheKikGen commented 4 years ago

OK ! So it should work with the win/mac client tool. I will test later. I added you script to the repo with your credit and original url. "Pierre" , are you french ? (I'am)

Le mer. 27 mai 2020 à 16:23, Pierre Lulé notifications@github.com a écrit :

Not sure about the computer installer, but the MPC itself accepts it without complaining (not using fastboot or the internal debug port)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TheKikGen/MPC-LiveXplore/issues/5#issuecomment-634694884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQMVK6RCGNRQI3WT6MR6S3RTUO6HANCNFSM4KAEQPBQ .

plule commented 4 years ago

Oui !

TheKikGen commented 4 years ago

Ok ! J'ai amendé le script pour générer des images Force. J'ai testé avec la procédure de mise à jour depuis l'USB et cela fonctionne très bien.

Le sam. 30 mai 2020 à 16:02, Pierre Lulé notifications@github.com a écrit :

Oui !

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TheKikGen/MPC-LiveXplore/issues/5#issuecomment-636335199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQMVK5RJCNVR6BNRWBK6RDRUEGV7ANCNFSM4KAEQPBQ .

mamatt commented 4 years ago

Hello,

pourrais-tu utiliser mon pseudo à la place de mon nom complet dans le script stp ;)

BTW, je ne suis pas sur que diffuser les firmware live/force patchées soit bien vu par Akai :S

Merci

TheKikGen commented 4 years ago

OK. pas de souci pour ton pseudo. Pour les images, on verra si Akai réagit. Si c'est le cas, on arrêtera la diffusion. Linux est open source.

Le dim. 31 mai 2020 à 19:38, Matthieu Le Corre notifications@github.com a écrit :

Hello,

pourrais-tu utiliser mon pseudo à la place de mon nom complet dans le script stp ;)

BTW, je ne suis pas sur que diffuser les firmware live/force patchées soit bien vu par Akai :S

Merci

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TheKikGen/MPC-LiveXplore/issues/5#issuecomment-636503330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQMVK265QXBLBUXLZ3I7ITRUKI2TANCNFSM4KAEQPBQ .