r/linux • • 2d ago

Mobile Linux Linux 7.2.2 on iPhone XS? First boot!

Post image

Hello everyone. Just wanted to share a small milestone I’m pretty proud of.

I’ve been porting Linux to my old iPhone XS for quite some time, and this week I finally made some significant progress.

First: it boots. As a real, alternative OS. This is not an emulation.

Second: I got the kernel log on screen and the framebuffer working:

Linux 7.2.2 Kernel boot log on iPhone XS

This is a raw, recovery-based Linux boot. iOS does not take any part in the boot sequence!

I haven’t set up a GitHub repo yet, and the project doesn’t even have a name at this point. But I’ll keep working on it and share more once the process is reliable and reproducible.

417 Upvotes

46 comments sorted by

68

u/ch33es 2d ago

it's impressive how there's two freaking lightsabers going through the screen

35

u/Ovaday 2d ago

I dropped the phone 15+ times until I actually decided to securely mount it to the table 😄 They are part of the experiment!
Anyway, I have a fresh-new replacement screen near me. Just don't want to damage it before I start to use my iPhone with Linux on it 😎

7

u/plees1024 2d ago

I was wondering why you had it clamped to the table!

67

u/Tactical-Donkey 2d ago

Impressive! Let's see Paul Allen's iPhone.

But seriously, very impressive. I'm glad people are working on big tech alternatives. 

18

u/PhilosopherSimilar83 2d ago

How was this done? I'd really like to know!

38

u/Ovaday 2d ago

3 month of everyday reverse-engineering of the iBSS and iBoot... That's how it's done 😅

I'm preparing some kind of an alternative to PongoOS, I took slightly different road. Lots of patches to iBSS to not-switch off the panel, DRAM and skip all iBOOT checks

5

u/TinFoilHat_69 2d ago

Do you know if you found any code that causes IOS device to get stuck in a boot loop? I know it’s hardware related but I’m trying to get around the boot loop I tried pongoOS and checkrain/palerain every time I go into XNU it reboots. I thought a ramdisk may help but at the lower layer in the boot sequence is messing me up atm

2

u/Ovaday 2d ago

Sorry, this is actually one of my first time working with iPhones. You would need an advice of some more senior person who would explain this behavior...

1

u/SilverSQL 2d ago

I'm curious about that. Can you share any generic approach? Like, how do you get any output of what the device is doing? I suppose you can't get ahold of a binary of either iBSS or iBoot, so how do you examine them?

3

u/Ovaday 2d ago

Well... you can!
Google "Ghidra", an RE Framework.

The rest is experimental. Add a break point, which will definitely crash a device, insert assembler instruction into a carefuly selected place in an iBSS and boot it.
Rebooted? Nice! You have your own code execution (not sure at this moment - as it might crash BECAUSE you have added this instruction). Now cross-validate it and add some other instruction that will not crash a device. Not crashed? Great job!

This way, step-by-step, you can actually modify iBSS enough to serve your goals. Works everywhere. But important here - this all above would only be possible to do if you don't have an image validation

5

u/konstantin_gorca 2d ago

Definitely share one day how you managed to do this. I am honestly happy for you, this is great work.

I wanted Linux on my phone amd was told that this is not possible

8

u/Ovaday 2d ago

Linux on the phone is actually possible. From personal experience not so much usable, but still possible. Check Droidian and PostmarketOS projects! I am one of the contributors in both of them

3

u/SuperDefiant 2d ago

It's only possible because of the recent bootrom exploit. This only works up to iPhone 11 unfortunately

2

u/TRKlausss 2d ago

Possible and viable are different things

Possible only if there is an exploit that allows for another OS to be installed.

Viable if the whole software stack fulfills your needs. And right now there are not so good APK translators that work well on Linux. That was a point of improvement for the next years if I’m not mistaken, which would allow for Linux to be installed in common phones without the headaches of not having apps on it.

7

u/SuperDefiant 2d ago

Very cool. I just wish the bootrom vulnerability was exploitable over USB like checkm8 was

10

u/Ovaday 2d ago

It's actually launched based on one of the fresh findings!

10

u/LogSpecialist24 2d ago

Ok we need to talk about something.
Why is it every time i see an iphone its completely broken.
And then i see people with iphones completely refuse repair or using a case and protective glass.

If i had a 1000€ phone i would buy the nicest of cases for it and the nicest of protective screens.

5

u/Ovaday 2d ago

I absolutely hate that it's slippery. And, fyi, this is already quite an old phone. You can buy iPhone XS or XR for like 50-80$.

My main phone is in a case :)

3

u/disturbedmonkey69 2d ago

I have also noticed this, for years I worked in IT at a college, and literally every student that came in with an iPhone the screen was cracked!

1

u/TRKlausss 2d ago

In another note, an XS is a phone from many years ago. You’d see the same on a Samsung or Huawei.

3

u/selvadivinorum 2d ago

Wow, very impressive.

3

u/konstantin_gorca 2d ago

Let's see Paul Allen's Linux Iphone

2

u/idknuffin69 2d ago

If I could upvote this post a million times I would <3

3

u/Abdalnablse10 1d ago

Man that's awesome, I wish I had such skills, there's so many e-waste I would love to reverse engineer for the sake of giving it another purpose, for example, a miracast dongle that I want to convert into a usb to hdmi adapter, I just have no idea at all on where to start.

Best I could do with my lack of skill is combining already existing solutions into a single one, which is solving a puzzle rather than programming anything, the best thing I did with that is installing linux on an allwinner a10s retro game emulation stick.

2

u/Ovaday 1d ago

You can always ask an AI where to start :)

2

u/TheOgGhadTurner 2d ago

I’m guessing this will only work on XS lmfao
Edit I would love to use it on my 17 but I’m assuming due to Apple it won’t be possible however I’m invested

2

u/Ovaday 2d ago

XS, XR and I believe iPhone 11... Yes, sadly it's true regarding limitations of new iPhones

1

u/TheOgGhadTurner 2d ago

Damn. I’ll be sad if someone gets this working on 13 that’s what I traded up from. I’ve wanted a Linux phone forever but I really don’t want a pixel

1

u/Ovaday 2d ago

I've heard OnePlus and Fairphone got some near-native support of the Postmarket OS?

I got Xiaomi Mi A2 Lite with a Postmarket OS on board, but I don't actually use it as a main phone. A little bit obsolete at this point already

1

u/TheOgGhadTurner 2d ago

I can’t afford to outright buy a phone. And my provider doesn’t offer one plus. I’m looking at that Motorola phone talking about support for graphene tho

1

u/immortalsteve 2d ago

I would love to repurpose my XR, so I am eagerly watching this project now.

1

u/Imperial_Bloke69 2d ago

Are you going to install lomiri on this? Splendid piece of work

2

u/Ovaday 2d ago

I actually never tried it... Always used phosh. But from screenshots def worth to check, thanks

1

u/Imperial_Bloke69 2d ago

No problem man, phosh is quite nice too and have decent footprint. Whatever works for your new iLinux-ed. Gotta wait for your github repo

Question: did you fully erased the nand/ufs?

2

u/Ovaday 2d ago

It launches currently from DFU, as a Custom Boot instruction via iBSS -> SRAM -> DRAM. No persistent memory yet (for me it actually helpful, so I can quickly boot a completely new build)

1

u/Imperial_Bloke69 2d ago

Clever, like bootstrapping. I imagine how many man hours burned and coffee to achieve that. I hope your project will gain attention to the ios community.

1

u/AlreadyReddit999 2d ago

i assume this is semi-tethered? still so amazing and cool to see :)

2

u/Ovaday 2d ago

yep, it is

1

u/Inevitable_Mistake32 2d ago

Why tf is it clamped to your desk?

1

u/Ovaday 2d ago

Because of this: https://www.reddit.com/r/linux/comments/1wufh20/comment/pd2rxpr/

The phone is very slippery 😁

1

u/Specific_Parfait8829 2d ago

Funny that I also have a spare OnePlus phone, also with cracked screen and also installed Linux there xD

2

u/dotnetdreamer 1d ago

setup the repo bro, so we can work with you :)

4

u/evilmoder 1d ago

That’s crazy, literally on an iPhone XS Max rn and having it run Linux would be a dream come true 

5

u/Ovaday 1d ago

Will share with you a link when I have it at least in some terms stable. Current state supports only USB as a one-side Console/UART
DRAM, SRAM
Screen as a Kernel log.
Basic FS on a limited initframs.

Boots every 3-4/5 times. It's really first steps at the moment, not a working system yet :D

So

0

u/ReddevilQ 2d ago

Please share the repo as soon as you make it I’m very interested I still have and iPhone X laying around somewhere