diff --git a/DESIGN.md b/DESIGN.md index 3dc040c..df39c55 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -181,7 +181,11 @@ SDR104 like the real slot: their defaults, not the voltage. - CMD19 tunes the SDR104 sampling point through the same tuning circuit as the eMMC. hwtest reports a 199.68 MHz card clock. -- The CSD is an SD CSD 2.0 (SD 5.3.3): the image's size (32 GiB with none) +- With no image (`--sd`, or `sd.img` in the working directory) the slot is + empty: card detect (PZ1) reads no card and every SDMMC1 command times + out, as on a console with no card in. The config window can still insert + a blank card. +- The CSD is an SD CSD 2.0 (SD 5.3.3): the image's size (32 GiB for a blank card) and command classes that include class 8, so bdk reads the SD status. That (ACMD13) reports the bus width ACMD6 set and a Class 10, U1, V10 card with 4 MB AUs; the SCR sets SD_SPEC3. diff --git a/README.md b/README.md index 6ea9c77..5a1fe54 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ slow or destructive. - Read real eMMC (embedded MMC) dumps (`BOOT0`, multi-part `rawnand.bin.NN`) and decrypt them with XTS-AES-128 (XEX-based Tweaked-codebook with ciphertext stealing) against keys from `prod.keys`. -- Serve a real FAT32 SD image to the payload (`--sd sd.img`). +- Serve a real FAT32 SD image to the payload (`--sd sd.img`). Without one the + SD slot is empty. ## Quick start @@ -270,7 +271,7 @@ needed. | Flag | Argument | Purpose | | --------------------- | ------------- | --------------------------------------------------------- | -| `--sd` | `sd.img` | Back the SD card (SDMMC1) with this raw FAT32 image. | +| `--sd` | `sd.img` | Back the SD card (SDMMC1) with this raw FAT32 image. Without it (and with no `sd.img` in the working directory) the slot is empty. | | `--boot0` | `BOOT0` | eMMC BOOT0 partition file (SDMMC4). | | `--rawnand` | `rawnand.bin` | eMMC GPP partition prefix (auto-detects `.00`, `.01`, …). | | `--prod-keys` | `prod.keys` | Override BIS keys from a Lockpick-style key file. | diff --git a/main.cpp b/main.cpp index 09d6cd0..c51f905 100644 --- a/main.cpp +++ b/main.cpp @@ -412,6 +412,14 @@ int main(int argc, char *argv[]) { if (state.sd_fd < 0) perror("[emu] Failed to open SD image"); else printf("[emu] SD image opened: %s\n", sd_path); } + // No image, no card: the slot starts empty, so card detect (PZ1) reads + // empty and SDMMC1 commands time out, as on a console with no card in. + // This used to present a blank card that FatFs then found no volume on. + // The config window's SD toggle can still insert a blank card. + if (state.sd_fd < 0 && state.sd_inserted.load()) { + state.sd_inserted = false; + printf("[emu] No SD image: the SD slot is empty\n"); + } if (boot0_path) { state.emmc_boot0_fd = open(boot0_path, O_RDWR | O_BINARY); if (state.emmc_boot0_fd < 0) perror("[emu] Failed to open BOOT0 image");