jueves, 9 de noviembre de 2023

Freeing your phone from Linux (with heimdall for Samsung)

When I wrote about updating baseband I realised that I hadn't written about how to install an aftermarket ROM, so... here we go.

The typical journey of installing an aftermarket ROM Like LineageOS, crDroid, ... which means replacing the propietary ROM of your phone with a hopefully free OS that is updated more frequently and for a longer time, starts with unlocking your mobile phone's bootloader, that depends on your maker, or even your model, so you must find an specific guide on that, typically it means enabling developer mode oand then looking for a

OEM unlock option.

Then you must install a recovery, you have to choose the specific one for your phone from all the available ones. Both LineageOS and crDroid have their own simple recoveries, and you have of course the good old TeamWin, OrangeFox, ... you just need to find the one you like and is available for your phone and then we install it.

After installing the recovery we have half the work done, as we can boot into it and from there we can flash our chosen OS and then the Google Apps or maybe you prefer to choose microG instead.

But... how do we install the recovery... on some devices you have a fastboot bootloader, there you must use the fastboot tool doing something like:

fastboot flash recovery recovery.img either if you are on Windows or Linux, but for Samsung devices... you either use Samsung tools for Windows like the old Odin, or if you are on Linux... yes, you need the latest version of heimdall (2.0.2 as I write this).

Once you have the latest heimdall installed we get the phone to start the bootloader or download mode and plug it to our computer, there we can run

heimdall flash --VBMETA vbmeta.img --RECOVERY recovery.img where the vbmeta image is specific for your model and is needed so that we are allowed to install our recovery and our chosen OS. One thing about heimdall... you can use the --no-reboot option, and so the phone won't reboot after heimdall exits, however, on modern phones and at least on heimdall versions up to and including 2.2, you won't be able to run heimdall again to do some other task without rebooting, it will fail, so... you must reboot anyway.

After installing the recovery we must boot it, not the OS, if you boot to the OS just once, it will restore the old recovery and you'll have to start all over, so... after you execute heimdall, make sure you press the right keys to boot into recovery.

That's it, I know it sounds a bit complicated, but, if you do things right, you can forget about Samsung's crap forever and enjoy your chosen system for a hopefully long time. I hope this new experience with your phone pleases you, enjoy it!

viernes, 27 de octubre de 2023

Updating baseband on Samsung devices when you are running aftermarket ROMs.

Some time ago I wrote about heimdall and how you could flash a Samsung official ROM using it. This time we'll be talking quite about the opposite.

When you are running an aftermarket ROM (one that is not the one from the maker of your phone) like an official LineageOS or crDroid ROM you get regular updates from them, but what you typically don't get is updates for the baseband.

The baseband is the software that runs the communication processor or modem, it is an important part of your phone as it is in charge of all the communications, so having it updated is important, not only because of the functionalities, but also because of the security issues.

So... the problem here is... how do you update your baseband now that you are no longer running your phone's official ROM? You could backup and flash your updated Samsung official ROM and then reinstall your favourite ROM and restore from backup, but that's a nonsense, so...

How about flashing just the modem software and leave your favourite ROM untouched?

Well, for that we can rely on heimdall, just make sure that you run the latest version of heimdall (2.0.2 as I write this). First you must download the Samsung updated ROM from your favourite site, we need the CP archive, something like...


for the A70, note that while this ends on md5 it is just a normal tar file, then extract the files from it, in this case modem.bin.lz4 and uncompress it with unlz4 and you'll get the modem.bin file that you must flash, now we just need to find where we need to flash it, we look for the name of this file on the heimdall print-pit output and we'll get the Partition Name, in this case MODEM, so we run...

heimdall flash --MODEM modem.bin

That's it, enjoy your new baseband ;-)