Checking out Game Stick Lite
I bought one of those cheap HDMI game collection sticks and unfortunatelly there's no option to add my own game images to play with the included emulators. So I tried inserting the included SD card into my PC which unfortunatelly could not detect any filesystems on it (and yes, I'm not using Wiondows - duh!). So here is how I try to gain access.
First, I made a dd
copy of the card:
dd if=/dev/sdc bs=8M status=progress of=disk.img
```2,8M list
9,5M res
45G roms
160K save
48K System Volume Information
Then threw `binwalk` at it and that really looks promissing:
```bash
binwalk disk.img
Output:
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
328688 0x503F0 CRC32 polynomial table, little endian
336097 0x520E1 Sega MegaDrive/Genesis raw ROM dump, Name: "", "KEY_TIMING_RSV0",
348681 0x55209 AES S-Box
348948 0x55314 AES Inverse S-Box
375429 0x5BA85 Android bootimg, kernel size: 1918988288 bytes, kernel addr: 0x33752061, ramdisk size: 1953055282 bytes, ramdisk addr: 0x756C6156, product name: "ction is input, write can not operate."
2097152 0x200000 uImage header, header size: 64 bytes, header CRC: 0xA9AB0BCB, created: 2024-10-14 16:09:02, image size: 7941016 bytes, Data Address: 0x2000000, Entry Point: 0x2000000, data CRC: 0xD2CB1127, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: "Linux-3.18.24_s40"
2097216 0x200040 Linux kernel ARM boot executable zImage (little-endian)
2115656 0x204848 gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)
9697374 0x93F85E MySQL MISAM index file Version 2
10031072 0x990FE0 Flattened device tree, size: 7160 bytes, version: 17
12582912 0xC00000 Linux EXT filesystem, blocks count: 286720, image size: 293601280, rev 1.0, ext3 filesystem data, UUID=3f3e0776-91ef-4c1b-835b-9855109f109f
327155712 0x13800000 Linux EXT filesystem, blocks count: 65536, image size: 67108864, rev 1.0, ext3 filesystem data, UUID=13f09be3-7189-4ed0-8564-6c29f19ef19e
406847488 0x18400000 ELF, 32-bit LSB executable, ARM, version 1 (SYSV)
406861204 0x18403594 Copyright string: "Copyright (C) 2001-2020 Charles Cazabon."
471859200 0x1C200000 ELF, 32-bit LSB executable, ARM, version 1 (SYSV)
471872916 0x1C203594 Copyright string: "Copyright (C) 2001-2020 Charles Cazabon."
...
933679896 0x37A6D318 ISO 9660 Primary Volume, System Identifier: "00000000000000000000000", Volume Identifier: "00000000000000000000000000000000"
Most interesting here are of course the Linux EXT filesystem
entries. I wrote down the decimal offsets.
Next step is to mount those folesystems. I'm on a test system so I just do everything as root to make it easier.
# Load a loop device onto the file with an offsett to the file system
losetup -o 12582912 /dev/loop0 disk.img
# This one is optional, I think, but gives you an idea if it worked
fsck -fv /dev/loop0
# Mount the loop device
mkdir /mnt/disk
mount /dev/loop0 /mnt/disk
Now I can check out the filesystem: ls -l
Output:
drwxr-xr-x 2 root root 1024 Oct 14 2024 bin/
drwxr-xr-x 2 root root 1024 Oct 14 2024 data/
drwxr-xr-x 2 root root 1024 Oct 14 2024 db/
drwxr-xr-x 2 root root 1024 Oct 14 2024 font/
drwxr-xr-x 2 root root 5120 Oct 14 2024 lib/
drwx------ 2 root root 12288 Oct 14 2024 lost+found/
drwxr-xr-x 5 root root 3072 Oct 14 2024 modules/
drwxr-xr-x 2 root root 1024 Oct 14 2024 settings/
drwxr-xr-x 11 root root 1024 Oct 14 2024 ui_m8/
drwxr-xr-x 11 root root 1024 Oct 14 2024 ui_m8_cut/
-rw-r--r-- 1 root root 25 Oct 14 2024 version
drwxr-xr-x 2 root root 1024 Oct 14 2024 wav/
drwxr-xr-x 2 root root 1024 Oct 14 2024 xml/
drwxr-xr-x 3 root root 1024 Oct 14 2024 xml_cut/
The version file gave me the following information: cat version
Output:
SEGAM-M8
V8.0 2024-10-15
A quick size check shows that there's not much to see here though: du -sh *
Output:
4,8M bin
1,0K data
9,0K db
23M font
102M lib
12K lost+found
16M modules
3,0K settings
6,9M ui_m8
9,0M ui_m8_cut
1,0K version
60M wav
53K xml
40K xml_cut
So let's have a look at the second filesystem - just close the first one first:
umount /dev/loop0
losetup -d /dev/loop0
I mounted the second one the same way I did the first one and there' even less data on there: ls -lR
drwxr-xr-x 2 root root 1024 Feb 21 2024 bin/
drwx------ 2 root root 12288 Feb 21 2024 lost+found/
drwxr-xr-x 2 root root 1024 Jan 1 1970 res/
drwxr-xr-x 3 root root 16384 Apr 19 2024 list/
drwxr-xr-x 3 root root 16384 Dec 31 1979 res/
drwxr-xr-x 12 root root 16384 Dec 31 1979 roms/
drwxr-xr-x 11 root root 16384 Dec 31 1979 save/
drwxr-xr-x 2 root root 16384 May 6 2024 'System Volume Information'/
./res:
-rw-r--r-- 1 root root 2924544 Jan 1 1970 game_list.db
-rw-r--r-- 1 root root 0 Jan 1 1970 mmcdev_dl_is_fat
-rw-r--r-- 1 root root 0 Jan 1 1970 mmcdev_roms_is_fat
The file game_list.db
is a SQLite3 database which seem to contain all the game's meta data / configuration. Otherwise there is only that falenames which seem to hint at a FAT filesystem being present which binwalk 2.3.3 didn't seem to find; it didn't find any other filesystems, either.
So I continue my search manually. I take the filesystem information of the last known filesystem and try to find the other one by just adding its size to its start: 327155712+67108864 = 394264576
(0x17800000). If I try to mount at that offset, I get a swap partition and I don't know how to determin its size, so I guessed: 512MB, 1024MB, 2048GB, 4096GB - nothing!
This is where I gave up until I remembered that I have an old file recovery tool for Windows: PC Inspector File Revocery. This can easily and quickly scan for filesystems, so I use that to locate them on the SD card. That way it findes 4 filesystems which I can preview directly inside the tool and the 3rd entry seems promising:
Sector 3915776
Total sectors: 98484224
Sectors per cluster: 32
FAT type detected: FAT32
OEM name: mkdosfs
Label:
The disk information shows 512 bytes per sector so that the offset of this file system is: 3915776*512 = 2004877312
(0x77800000)
drwxr-xr-x 3 root root 16384 Apr 19 2024 list/
drwxr-xr-x 3 root root 16384 Dec 31 1979 res/
drwxr-xr-x 12 root root 16384 Dec 31 1979 roms/
drwxr-xr-x 11 root root 16384 Dec 31 1979 save/
drwxr-xr-x 2 root root 16384 May 6 2024 'System Volume Information'/
Folder sizes:
2,8M list
9,5M res
45G roms
160K save
48K System Volume Information
So this seems correct. YAY. Now I can try to add my own games. So this is my setup to edit the SD card backup:
# Mount
losetup -o 327155712 /dev/loop0 Game\ Stick\ Lite.dsk
losetup -o 2004877312 /dev/loop1 Game\ Stick\ Lite.dsk
mkdir -p /mnt/game0
mkdir -p /mnt/game1
mount /dev/loop0 /mnt/game0
mount /dev/loop1 /mnt/game1
# Umount
umount /dev/loop0
umount /dev/loop1
losetup -d /dev/loop0
losetup -d /dev/loop1
Current state
So, my current state is, that I can edit the FAT filesystem and delete games. You'll have to mount the second EXT and the FAT filesystem. Open the SQLite3 database res/game_list.db
from the EXT filesystem in an SQLite explorer. You'll be able to remove the game from this registry and they won't be listed in the menu enymore. Additionally you can delete the connected game images.
Where I'm still stuck is at adding games. I can add game images and the registry entry, the only thing missing is the image_name
which seems to be a MD5 checksum of something, but it's not theone of the filename of image file. Without that the game is listed but cannot be started, it seems.
I'll have to experiment a bit more when I have time (and interest).