Hi Jonathan,
So, the MTD partitions do not directly map to a kernel or a Linux filesystem. The "Q;Q;" blocks are an Amstrad specific way of putting data into those partitions, with a type + description associated with each one. For example the kernel lives in a Q;Q; block in mtd3 called "LINUX". mtd3 also has Q;Q; blocks for LDR (the second stage boot loader), and PARMS (the kernel boot parameters).
Agreed. I guessed a 32-byte struct based on various `Q;Q;'s seen.
$ qq() { > LC_ALL=C perl -0777ne 'print $& while /Q;Q;.{0,32}/g' "$@" | > hexdump -ve '36/1 "%_p" "\n"'; > } $ $ qq e3-nand-backup.3 Q;Q;...@............MEM............. Q;Q;................PARMS........... Q;Q;....Hf..........LDR............. Q;Q;.....x..........LINUX........... $
The CRAMFS filesystem is in mtd4; Q;Q; block name "LNXFSYS". There are 2 of them (I imagine to allow for an active + fallback).
$ qq e3-nand-backup.4 | grep LNXFSYS Q;Q;................LNXFSYS......... Q;Q;...6............LNXFSYS......... $
There are various other bits of content in mtd4 too - you can see them by doing:
hexdump -C e3-nand-backup.4 | grep -A 1 "Q;Q;"
That's where my 32-byte-long guess comes unstuck. A Q;Q; appears within the structs around LIBC's.
$ qq e3-nand-backup.4 | fgrep -3 .LIBC Q;Q;..^.. ..........WTL_MAILCON..... Q;Q;..... ..........WTL_RES......... Q;Q;..M. ........Q;Q;..... ........ Q;Q;..... ..........LIBC............ Q;Q;..... ........Q;Q;...Q. ........ ..WTL_WAV.........Q;Q;..... ........ ..WTL_CHUNK.......Q;Q;..$.. ........ $
And so it's out of step for a while. Perhaps there's Q;Q;-formatted data inside a Q;Q; block, or the last struct in the initial `list' is shorter and its struct's content indicate that.
$ qq e3-nand-backup.4 | grep -1 ^Q | grep -3 ^- Q;Q;..... ..........LIBC............ Q;Q;..... ........Q;Q;...Q. ........ ..WTL_WAV.........Q;Q;..... ........ -- ..M_USERPREF......Q;Q;.....V........ Q;Q;.....1..........M_WTL_WTAI...... Q;Q;.....A..........M_VPARSE........ $
I expect a bit of peering at the words in each struct would spot a length or similar of each `file's data to save searching through for the next Q;Q;.