View Single Post
Old 09-13-2026, 10:20 AM   #5
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 2,849
Karma: 7454319
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD, Clara BW, Libra Colour
Quote:
Originally Posted by ratiz View Post
That would interesting to see. Do you use a loop device? I don't see otherwise how you can do that without touching the partitions.
Yeah, I do a loop device, but the real trickery is that I have an additional init binary at /init (which takes priority) which mounts them, handles a/b switching, patches the loaded kernel via /dev/kmem (rather than a kernel module so it's universal) to swap the device major/minor for the sdcard partitions to the loop one (replacing an unused syscall with kmalloc to do the memory allocation for the hook trampoline from userspace), patches some scripts which care about it (there's only about 3, and it's relatively minor) by bind-mounting over it, then execs the real init. This allows everything else to work unmodified, including Kobo's USB mass storage mode. I originally wrote this for testing multiple firmware versions in parallel while working on patches. I didn't publish it since there are a few pitfalls, and new versions need to be audited (since if they started using udev netlink, this doesn't handle it).

I don't have time to polish it for the next 3 weeks, but you can probably get 90% of the way there having a LLM remake it from my description.
geek1011 is offline   Reply With Quote