Development Installing GSI by repacking super.img on SM-127F and SM-A325F (Linux)

Search This thread

uluruman

Senior Member
Oct 23, 2021
125
21
Thx for the answer, but can i root it with Magisk?
That should be possible. Anyway if you install a system with phhusson's patches then you probably just can install the Magisk app (or any other superuser app) and don't patch anything, because the 'su' utility is already present in the system. As far as I understand, patching basically adds the su utility to the core system, while the Android app is just a user interface for it. At least that's the case with the Andy Yan's version of LineageOS: there is no Android-level app but there is su in the underlying Linux; you can install, for example, the 'Superuser' app from F-Droid and you'll have what's usually called the rooted system.
 

Franzyy

Member
May 16, 2022
25
2
Samsung Galaxy A32 4G
That should be possible. Anyway if you install a system with phhusson's patches then you probably just can install the Magisk app (or any other superuser app) and don't patch anything, because the 'su' utility is already present in the system. As far as I understand, patching basically adds the su utility to the core system, while the Android app is just a user interface for it. At least that's the case with the Andy Yan's version of LineageOS: there is no Android-level app but there is su in the underlying Linux; you can install, for example, the 'Superuser' app from F-Droid and you'll have what's usually called the rooted system.
Ok thx, but is it normal that is shows this error in download mode:

CARRIER_ID:EUX
SW REV CHECK FAIL: [super]
Fused 2 > Binary 0

After it says "PASS!" it shows this error in download mode but in yellow:

Set Warranty Bit: super
 

uluruman

Senior Member
Oct 23, 2021
125
21
Ok thx, but is it normal that is shows this error in download mode:

CARRIER_ID:EUX
SW REV CHECK FAIL: [super]
Fused 2 > Binary 0

After it says "PASS!" it shows this error in download mode but in yellow:

Set Warranty Bit: super
I remember that during experimentation I had that "SW REV CHECK FAIL" message myself and was a bit puzzled. Does your system boot and work okay? In general that message means that there is some inconsistency between the software revisions of the system components, for example if the Super partition is based on the U2 firmware, while your phone was previously flashed with the later U3 or U4. Or may be it's just because of moving back from Android 12 to 11... Full re-flashing of the stock firmware and then factory reset may help here (although I think that's a bit over the top). Or just ignore it, if it all works fine.
 

suiller

Senior Member
Jul 23, 2008
2,987
388
Turin (Piedmont)
ficca.bounceme.net
Thank you really much for your precious script, I've been able to successfully install latest PE rom on my galaxy A32 4g, as instructions I used the Linux (Ubuntu) subsystem in Windows11, all went smooth except I had issue to get into download mode (because I have full unlocked bootloader so at start it asks to press power to continue and this interfered with buttons combination to get in download mode)
 
  • Like
Reactions: uluruman

uluruman

Senior Member
Oct 23, 2021
125
21
Thank you really much for your precious script, I've been able to successfully install latest PE rom on my galaxy A32 4g, as instructions I used the Linux (Ubuntu) subsystem in Windows11, all went smooth except I had issue to get into download mode (because I have full unlocked bootloader so at start it asks to press power to continue and this interfered with buttons combination to get in download mode)
Hmmm. As far as I know virtually nothing can interfere with getting into Download mode, although it's (presumably) kept in a flash memory it is started by the primary bootloader which is kept in ROM. May be you just forgot plugging in the USB cable? It must be kept plugged into PC.
 

suiller

Senior Member
Jul 23, 2008
2,987
388
Turin (Piedmont)
ficca.bounceme.net
anyway, at least for me, is not possibile to flash directly from script... it says that device isn't in download mode (even if it is of course), I have to flash Super.Img.tar directly from Odin, and as mentioned above I get download mode trought adb: adb reboot download

my device is a Samsung Galaxy A32 (4g ver)
 

uluruman

Senior Member
Oct 23, 2021
125
21
anyway, at least for me, is not possibile to flash directly from script... it says that device isn't in download mode (even if it is of course), I have to flash Super.Img.tar directly from Odin, and as mentioned above I get download mode trought adb: adb reboot download

my device is a Samsung Galaxy A32 (4g ver)
That is exactly the device I currently use. Mine is SM-A325F/DS, made in India. I think your problem may be related to that you're using WSL and not native Linux. At least that's the only major difference between your and mine configuration.
 

Franzyy

Member
May 16, 2022
25
2
Samsung Galaxy A32 4G
Decided to flash the pixelexpierence gsi from june 2022, now it has a new error:
It says:
Checking the new system file format...
The new system file does not contain a ext2/3/4 filesystem. Exiting,,,
 

uluruman

Senior Member
Oct 23, 2021
125
21
Decided to flash the pixelexpierence gsi from june 2022, now it has a new error:
It says:
Checking the new system file format...
The new system file does not contain a ext2/3/4 filesystem. Exiting,,,
Try to repack everything from scratch by adding the -p parameter. And add full name of the output file, e.g. pixelexperience.tar or pixelexperience.img

P.S.: Indeed, the logic of repacksuper.sh is barely understandable now because it has started as a very simple thing and eventually embraced more and more features... It requires refactoring for sure, at least with splitting into two separate scripts.
 

Franzyy

Member
May 16, 2022
25
2
Samsung Galaxy A32 4G
Try to repack everything from scratch by adding the -p parameter. And add full name of the output file, e.g. pixelexperience.tar or pixelexperience.img

P.S.: Indeed, the logic of repacksuper.sh is barely understandable now because it has started as a very simple thing and eventually embraced more and more features... It requires refactoring for sure, at least with splitting into two separate scripts.
Ok, thx
I have one more question:
Does the script work with WSL, or do I have to use native Linux for this script to work?
 

uluruman

Senior Member
Oct 23, 2021
125
21
Ok, thx
I have one more question:
Does the script work with WSL, or do I have to use native Linux for this script to work?
At least two people reported success with WSL, but you have to choose .tar (e.g. pixelexperience.tar) as the output file name and then upload it with Odin. Uploading from the script via Heimdall does not work under Windows because Heimdall talks directly to USB via libusb, so choose No when it asks.
 

lorem-ipsum

New member
Jun 25, 2022
1
1
Thank you so much for the script uluruman.

It worked perfectly to install a GSI on a SM-127M.

I wanted to mention this if it is useful for anyone else that has this model. As far as I know there's no working custom recovery so this solution was great.
 
  • Like
Reactions: uluruman

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Thank you really much for your precious script, I've been able to successfully install latest PE rom on my galaxy A32 4g, as instructions I used the Linux (Ubuntu) subsystem in Windows11, all went smooth except I had issue to get into download mode (because I have full unlocked bootloader so at start it asks to press power to continue and this interfered with buttons combination to get in download mode)
    1
    Thank you so much for the script uluruman.

    It worked perfectly to install a GSI on a SM-127M.

    I wanted to mention this if it is useful for anyone else that has this model. As far as I know there's no working custom recovery so this solution was great.
  • 3
    repacksuper
    ===========

    Copyleft uluruman 2021-2022

    (for LINUX only)

    This is the minimalistic set of tools + script for Linux for the automated
    ground-up repacking and flashing of the Samsung Galaxy super.img, replacing
    the stock Android system with something much less intrusive and obtrusive
    (e.g. LineageOS). Or just something else.

    Theoretically should work for any Samsung A-series phones.
    Tested on SM-A127F/DSN made in India and Vietnam and SM-A325F/DS made in India,
    on Debian Linux 11 x64.


    Changelog
    ---------

    0.9: Initial release
    0.91: Non-sparse new system is now correctly moved into the super dir
    0.91a: Bug in the new system file format checking fixed
    0.91b: Better support for spaces in paths
    0.92: Added checking for system requirements and an optional parameter for
    setting of the final tar archive name.
    0.92a: Fixed file ownership issues inside the tar distribution archive
    0.93: Added support for SM-A325F. Several minor improvements.
    0.94: Added support for gzip-packed GSI images. Packing into .tar is now done
    without question if the command line parameter is given. Tar parameter
    now can include the full path. Without the full path the default tar
    location is now the same as the GSI. Several other minor changes.
    1.0: Finally added working native Linux flashing using Heimdall (HUGE thanks
    to amo13 and Benjamin Dobell). Two new options: using empty product.img
    and silent (non-interactive) mode. Colored text. Bugfixes and minor
    changes.
    1.01: Option to specify the SUPER partition name manually (needed for flashing
    SM-A127F with Heimdall). Now it is possible to place output .img and .tar
    files in any directory and give them any name. Text terminology a bit
    clarified, help text expanded. Done many internal optimizations,
    additional sanity checks and minor changes.


    P.S.: The first upload of v1.0 included the not-yet-working extractoptics.sh.
    Now it is removed.


    Requirements
    ------------

    Install from the official repositories of your distro:
    simg2img xz-utils lz4 unzip gzip jq file


    Instructions
    ------------

    Just run the script without args to see help.
    Better read
    this post for the step-by-step guide.
    Also be sure to read
    this post concerning the importance of optics.img.

    The included binaries for the lpunpack, lpmake and Heimdall were compiled for the x86_64 architecture. If your PC architecture is different (e.g. x86 32-bit or ARM) you have to compile these tools yourself. The full source code is included (or otherwise available on GitHub).

    Known issues (not solvable by the script):
    1. During the script run you can see several "Invalid sparse file format at header magic" warnings, just ignore them.
    2. In LineageOS, Dot OS and some other GSIs I tried the touch screen remains not responsive for about 6 seconds after waking up. The problem is not present at least with SM-127F/DSN phones made in India, but present at least in those made in Vietnam, which means it is not caused by the OS installation approach but rather by the quirks of the phone hardware itself. Solution should require tweaking of the kernel behavior but it's yet to be found.
    3. In LineageOS MTP file transfer does not work (at least on Linux). Unfortunately currently there is no solution (known to me) for this, so you have to resort to the ftpd, Bluetoothor some other method.
    P.S.: I really don't recommend using any of the Google services (GApps, Google Play, etc.). Don't let corporations gather your data. You bought the phone and from now on it should be all yours, with all of its data, like a PC in the good old days. You own your device, and nobody has the right to stick their nose into how you use your phone, gather any statistics and push you any ads. You always have a choice to turn down privacy-unfriendly stuff, the price of that "inconvenience" is actually ridiculous. From my point of view, there is simply no point in using non-stock systems if they are still littered with the privacy-unfriendly bloatware.
    2
    One more important thing: if, for example, you're using the Nepalese firmware as the basis for your GSI, while you reside in the UK, you may still need to download your actual regional firmware as well. Inside the CSC part of the firmware there is a file called optics.img which contains the lists of the cellular provider carrier data specific to your region, otherwise you (probably) will be limited in number of service providers available.

    You can extract and flash optics.img separately this way:
    1. download and unzip the full stock firmware for your region of residence
    2. unpack optics.img.lz4 from the CSC_OMC_ODM tar.md5 file using the standard tar utility (e.g. tar -f CSC_OMC_ODM_A325FODM2AUJ3_CL22736284_QB44664166_REV00_user_low_ship_MULTI_CERT.tar.md5 -x optics.img.lz4)
    3. now unpack it using lz4: unlz4 optics.img.lz4
    4. pack .img into tar: tar cf optics_native.tar optics.img
    5. flash it using Odin into the CSC slot
    You can do it at any time after installing the GSI, and you have to do it only once (unless you flash the full stock firmware or the CSC slot separately, of course).
    1
    I should test this for a127f
    1
    Thanks A LOT, this works! I am finally able to run LineageOS on my phone!

    For Windows 10+ users: WSL runs this script just fine with a few additional steps.
    1. Install WSL 2 and any Linux distribution from Microsoft Store
    2. Run the distribution to finish setup
    3. Install the required packages from the post (sudo apt install for Ubuntu/Debian)
    4. Shift + Right Click in the folder where you have the script, the AP and the GSI packages
    5. Open Linux shell there
    6. Unpack & run script as stated in its help

    Voila!
    1
    Thank you so much for the script uluruman.

    It worked perfectly to install a GSI on a SM-127M.

    I wanted to mention this if it is useful for anyone else that has this model. As far as I know there's no working custom recovery so this solution was great.