Repository navigation
microSD on the Galaxy S9, read only (sdcard=, off by default): Jesvi-iOS's dw-mshc driver + IOMedia moved to the 9810 - #422
Conversation
… (APSL-2.0)
Taken unchanged from Jesvi-iOS (github.com/jesvi-eulah/Jesvi-iOS, iOS 16.5 on the Galaxy S20, by jesvi-eulah), with the
Scion owner's approval of 26 November 2026, under the Apple Public Source License 2.0 that covers its xnu/files/:
xnu/files/bsd/dev/redwood_sdcard.c at b35cfdc ("Enable microSD writes and harden startup")
-> drivers/storage/sd/hakios.exynos_sd.c
xnu/files/iokit/Kernel/RedwoodSDMedia.cpp at 0b6bce9 ("Add opt-in microSD partition writes"; first in d838091)
-> drivers/storage/sd/hakios.sdmedia.cpp
Only the file names change here, so the next commit's adaptation to the Galaxy S9 (Exynos 9810, dwmmc2 at
0x11500000) shows as a diff. Not built by this commit (not yet in drivers/map or drivers/storage/conf).
…iOS's driver moved to the 9810's dwmmc2 The previous commit brought in Jesvi-iOS's S20 microSD driver and its IOMedia unchanged (jesvi-eulah: redwood_sdcard.c at b35cfdc, RedwoodSDMedia.cpp at 0b6bce9, APSL-2.0). This one moves them to the S9 and makes them read only: - the controller: dwmmc2 at 0x11500000 (Samsung's DT, Scion's XNU-MICROSD.md), still the 64-bit FIFO and S-Boot-style use of a slot left initialised; required now: VERID x270a, HCON data width 2, PWREN, CLKENA, CTYPE 4-bit; - before the controller is read, the card-detect pin (GPA1-5, 0x14050044 bit 5) and the three clock gates (CMU top 0x1a242070, FSYS1 0x11402030/0x11402034) are read; with the FSYS1 gates not forced on the controller is not touched (sdcard=1 writes nothing at all; sdcard=2 forces the gates on, read back, as XNU-MICROSD.md 2.3 step 2); - read only: the CMD24 path removed, write() EROFS, DKIOCISWRITABLE 0, the IOMedia Writable no; - boot-arg sdcard= (0 by default, 1 a look, 2 the card), sysctls under kern.hakios, names hakios_*; - driver EXYNOS_SD in drivers/storage/conf, drivers/map, started from hakios_input_init after UFS, a stub. docs/devices/starlte-microsd.md compares it with Jesvi's and with XNU-MICROSD.md and has the test plan. Not run on a phone: whether anything leaves the S9's card initialised is what sdcard=1 answers first. Files needs lifs.kext, which Scion does not load yet (Jesvi-iOS d838091, 6139189). Credited in NOTICE.
|
CI: GitHub Actions is disabled on this repository, so I ran this repo's own workflows (
|
…d boot-args regenerated)
|
Phone regression of current main, phone 2 (Galaxy S9, iOS 27.2.1), 28 Nov 2026 — PASS. Built: scion-kernel main
Home screen drawn on both (icons, widgets, dock, Wi-Fi + charging). Crash set = the earlier baselines' (locationd, chronod); no new crash loop. The S9's charger guard as before ( #421 ( |
What
A read-only microSD driver for the Galaxy S9 on iOS 16.5. It is off by default (
sdcard=) and not yet run on a phone.It is Jesvi-iOS's S20 microSD driver and IOMedia (jesvi-eulah, APSL-2.0), moved to the Exynos 9810's dwmmc2. The PR has two commits:
452fc93(author: jesvi-eulah) brings inredwood_sdcard.c@ b35cfdc andRedwoodSDMedia.cpp@ 0b6bce9 unchanged, renamed todrivers/storage/sd/hakios.exynos_sd.candhakios.sdmedia.cpp. Because they are unchanged, the second commit's adaptation reads as a diff.facc7f3(Claudius) makes the S9 adaptation:XNU-MICROSD.md).write()returns EROFS,DKIOCISWRITABLEis 0, and the IOMedia has Writable = no.kern.hakios.sdcard*; driverEXYNOS_SDindrivers/storage/confanddrivers/map, started after UFS, with a stub when it isn't built.Boot args
sdcard=0(the default): nothing.sdcard=1: a look, nothing written. Logs the card-detect pin and the gates, and the controller registers only if the gates are on.sdcard=2: forces the three card clock gates on and reads them back. Then, with a card in and the slot initialised, reads the MBR 6 s after start and publishes/dev/disk9,rdisk9,disk9s1,rdisk9s1and an externalIOBlockStorageDevice "SD Card"→IOMedia disk9→IOMedia disk9s1, all read only.Never written: the card, the PMIC, the pins, the clock dividers.
Compared with Scion's XNU-MICROSD.md
That design (for the iOS 26/27 forks) brings the card up itself: S2MPS18 LDO31/LDO2 through ACPM, then CMD0/8/ACMD41/2/3/9/7/ACMD6. This driver does not. It is the smaller step: it uses a slot that something earlier already initialised.
sdcard=1answers in one boot whether anything does that on the S9 (S-Boot, or Scion's loader if it read the card). If nothing does, the next PR ports section 2.3 of the design for this kernel. The comparison table is indocs/devices/starlte-microsd.md.Files: iOS 16.5's external-drive path needs Apple's
lifs.kext, which Scion does not load. On Jesvi-iOS that is done byredwood_kextload.c(d838091) plus a userfsd start-up wrapper (6139189). Until that is ported, the card appears as/dev/disk9s1and in the IORegistry, but not in Files.The checks run locally all pass: hakios-config-test, boot-args-test/--check, drivers-check, arch-check, hakios-device check, docs-gen --check, docs-check, provenance. The kernel build itself is left to CI (xnu-linux;
EXYNOS_SDis built by default, inert withoutsdcard=).Test plan (S9, iOS 16.5 image from this branch, FAT32 or exFAT card)
sdcard=1. Look forsdcard: sdcard=1: card detect GPA1 DAT 0x.. (a card); gates top 0x.., FSYS1 ACLK 0x.. SDCLKIN 0x.., followed by one of:the controller's clocks are not on …: not touched;dwmmc2: VERID … RESP0 …line andslot initialised;not as a loader leaves an initialised card.Send the lines. Then boot again without a card: the log should say
no card.slot initialised, boot withsdcard=2. After about 6 s the log should showsdcard: ready: disk9 … disk9s1 type 0x.. … (read only); IOKit published. Then check:dd if=/dev/rdisk9s1 bs=512 count=1 | xxd | headshows the FAT/exFAT boot sector;ioreg -l | grep -A3 'SD Card'shows the device;dd of=/dev/rdisk9s1fails with EROFS.dwmmc2:line, or ifsdcard_errorskeeps growing.Revert: boot without
sdcard=. Nothing is written to the card. The forced clock gates are volatile.Credits: Jesvi-iOS is added to NOTICE, with its licences (APSL-2.0 for its kernel files, MIT for the rest) and the source SHAs.
Not merging: the owner merges after a phone test.
🤖 Generated with Claude Code