Jump to content

Samsung Galaxy S III (samsung-m0): Difference between revisions

From postmarketOS Wiki
Add myself as maintainer
Halamix2 (talk | contribs)
mNo edit summary
 
(94 intermediate revisions by 24 users not shown)
Line 2: Line 2:
| manufacturer = Samsung
| manufacturer = Samsung
| name =  Galaxy S III
| name =  Galaxy S III
| codename = samsung-i9300, samsung-i9305
| codename = samsung-m0
| image = File:Samsung-i9300-galaxy-s-iii-ofic.jpg
| image = File:Samsung-m0.png
| imagecaption = Samsung Galaxy SIII
| imagecaption = Samsung Galaxy S III
| releaseyear = 2012
| releaseyear = 2012
| originalsoftware = Android 4.1.1
| category = community
| chipset = Exynos 4412 Quad
| originalsoftware = Android
| originalversion = 4.1.1
| chipset = Samsung Exynos 4412 Quad
| cpu = Quad-core 1.4 GHz Cortex-A9
| cpu = Quad-core 1.4 GHz Cortex-A9
| gpu = Mali-400MP4
| gpu = Mali 400 MP4
| storage = 16 GB/32 GB
| storage = 16 GB/32 GB
| display = 720x1280 Super AMOLED
| display = 720x1280 Super AMOLED
| memory = 1 GB(GT-i9300 & SHW-M440S)<br>2 GB(LTE Variants)
| memory = 1 GB (GT-i9300 & SHW-M440S)
| architecture = armv7
| architecture = armv7
| type = handset
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
| status_usbnet = Y
| status_usbnet = P
| status_flashing = Y
| status_flashing = Y
| status_touch = Y
| status_touch = Y
| status_screen = Y
| status_screen = Y
| status_wifi = Y
| status_wifi = Y
| status_xwayland = Y
| status_fde = Y
| status_fde = Y
| status_mainline = Y
| status_mainline = Y
| status_battery = P
| status_battery = Y
| status_3d = P
| status_3d = Y
| status_accel =  
| status_accel = Y
| status_audio = N
| status_audio = P
| status_bluetooth = N
| status_bluetooth = P
| status_camera =
| status_camera = P
| status_gps =  
| status_gps = N
| status_mobiledata = N
| status_mobiledata = N
| status_sms = N
| status_sms = N
| status_calls = N
| status_calls = N
| status_light = Y
| status_hdmidp = P
| status_otg = Y
| status_sdcard = Y
| status_emmc = Y
| status_nfc = -
| status_barometer = -
| status_powersensor = -
| status_keyboard = -
| status_touchpad = -
| status_usba = -
| status_irtx = -
| status_irrx = -
| status_stylus = -
| status_haptics = -
| status_dvb = -
| status_ethernet = -
| status_uart = Y
| status =
| status =
| status_fossbootloader = P
| status_uboot = yes
| status_uboot_mainline = N
| status_uboot_primary = Y
| status_uboot_secondary = -
| status_uboot_keyboard = -
| booting = yes
| booting = yes
}}
}}
{{warning|'''The mainline kernel for device has been reported to cause hardware failure!''' Specifically, resulting in broken panels and devices unable to boot properly. Be careful! See [[#Mainline_Kernel|the mainline section of this article]] for more information}}
__TOC__
== Contributors ==
== Contributors ==
* [[User:Thiagaoplusplus|Thiagaopluplus]]
* [[User:Thiagaoplusplus|Thiagaopluplus]]
* tyxieblub
* tyxieblub
* [[User:Colaur|Colaur]]
* [[User:Newbyte|Newbyte]]
* [[User:Grimler|Grimler]]


== Maintainer(s) ==
== Maintainer(s) ==
* [[User:Newbyte]]
* [[User:Newbyte|Newbyte]]


== Basic info ==
== Basic Info ==


So far, what works for samsung-i9305 (Galaxy SIII LTE version) also works for the samsung-i9300 (Galaxy SIII international GSM version without LTE, Also known as Galaxy S III 3G SHW-M440S in South Korea) and samsung-shv-e210s (a Korean variant). (None of these SIII models should be confused with the North American SIII models, which require OS builds.)
So far, what works for [[Samsung Galaxy S III LTE (samsung-m3)]] also works for the samsung-m0 (Galaxy S III international GSM version without LTE, Also known as Galaxy S III 3G SHW-M440S in South Korea) and samsung-shv-e210s (a Korean variant). (None of these S III models should be confused with the North American S III models, which require OS builds.)


Code name is MIDAS. Search for midas-mainline to find more info.  
Code name is MIDAS. Search for midas-mainline to find more info.  
Line 65: Line 87:
== Installation ==
== Installation ==


Set phone to ODIN mode
=== Step 1: Flash the system ===


  1. Turn off phone
==== Option 1: Flash the system to an SD card ====
  2. Connect USB cable
  3. Hold VOLUME_DOWN + HOME + POWER until you get Warning!! screen
  4. Push VOLUME_UP to continue to ODIN mode screen


<source lang="bash">
Start by flashing a pre-built postmarketOS rootfs image onto an SD card, as described in the [[installation]] article.
# Ready the build
pmbootstrap init # (weston or xfce4 should do)


# Install rootfs to Micro SD Card
==== Option 2: Flash the system to the phone's internal storage ====
pmbootstrap install --sdcard=/dev/something # (typically /dev/sd<x> or /dev/mmcblk<#>, will depend on where your Micro SD Card is mounted)
# You can now insert the sdcard into the device


# Put the i9305 / i9300 into odin mode with the steps above and flash the kernel (to boot from the Micro SD Card)
{{note|'''Note:''' If this runs into errors, please use option 1.}}
pmbootstrap flasher flash_kernel # (in odin mode)


# and it should reboot automatically and start pmos from the sdcard
'''Prepare img2simg'''
</source>


==Installing with downstream kernel==
Start by downloading and building [https://github.com/anestisb/android-simg2img/ simg2img], make sure that it's runnable from somewhere, you can just copy the generated binaries, (only 'img2simg' is needed), in /usr/bin and make them executable with chmod.


<source lang="bash">
'''Prepare needed images - Option 1: Use a ''pre-built'' image'''
#FIRST PMBOOTSTRAP INSTALL
mkdir ~/code
cd ~/code
git clone https://gitlab.com/postmarketOS/pmbootstrap.git


#CONFIG PMBOOTSTRAP
Download a pre-built postmarketOS rootfs image (GNOME mobile recommended, others ran into errors for me, more testing required), and extract it with any xz-supporting archive software, make sure to NOT extract the .img itself, only the .xz.  
alias pmbootstrap=~/code/pmbootstrap/pmbootstrap.py
pmbootstrap init
#work path default
#samsung
#i9305
#n
#wathever
#weston
#n
#none
#y
#samsung-i9305
#y


#FOR DEBUGGING (NOT REQUIRED)
'''Prepare needed images - Option 2: Use a image you built yourself with ''pmbootstrap'''''
pmbootstrap initfs hook_add debug-shell
#Check log with 'tail -f ~/.local/var/pmbootstrap/log.txt'


#CREATE RECOVERY ZIP (for flashing with TWRP)
Follow the instructions at [[Installation/Using_pmbootstrap|this Wiki page]] till "''Flashing''", since you won't flash the image yet, instead do
pmbootstrap install --android-recovery-zip
pmbootstrap export
and copy your rootfs image (usually named '''samsung-m0.img''') from the output directory to a working directory.


#COPY ON SDCARD
'''Convert the image into ''Android sparse format'''''
cp ~/.local/var/pmbootstrap/chroot_buildroot_armhf/var/lib/postmarketos-android-recovery-installer/pmos-samsung-i9305.zip /media/computer/sdcard/
#Insert sdcard in phone
#Reboot on recovery with up+home+power
#Install from zip
#Reboot


#IF BOOT STANDBY (DEBUG)
The next step is to convert the rootfs image into an ''Android sparse image''.
#Connect with USB cable
telnet 172.16.42.1
pmos_continue_boot
</source>


== WiFi ==
This is needed so we can flash the image in ''download mode''.


To get the WiFi working, you'll need to modify the wpa_supplicant configuration. If this is not done, wpa_supplicant starts with -ip2p0 which is not supported on our device.
To do this, we will use ''img2simg''. Run this in the directory where you downloaded/saved the rootfs image:
img2simg path-to-rootfs.img pmos-sparse.img
The command might take some time to be executed, but once done, you will have an Android sparse image of postmarketOS ("pmos-sparse.img").  


  $ echo 'wpa_supplicant_args="-Dwext"' | sudo tee /etc/conf.d/wpa_supplicant
'''Flash the image'''


You can use either NetworkManager or networking and wpa_supplicant. NetworkManager is recommend in most cases as it handles reconnection.
The next step is to flash that image with Heimdall. Note: you might need to repeat these steps if Android overwrites the USERDATA partition. Anyways, to flash the image, we need to enter ODIN mode as described in [https://wiki.postmarketos.org/wiki/Samsung_Galaxy_S_III_(samsung-m0)#Step_2:_Enter_ODIN_mode Enter ODIN mode], and run this command:
heimdall flash --USERDATA pmos-sparse.img


=== Network Manager ===
=== Step 2: Enter ODIN mode ===


Ensure the networkmanger service is running
To enter ODIN mode, follow these steps:
 
  $ sudo rc-status | grep 'networkmanager'


if it not visible, try to start the service:
  1. Turn off phone
  3. Hold Volume Down + Home + Power until you get Warning!! screen
  2. Connect USB cable
  4. Push Volume up to continue to ODIN mode screen


  $ sudo rc-service networkmanager start
=== Step 3: Flash the kernel via ODIN mode ===


Search for available WiFi networks and connect to network
Now, use Heimdall to flash the image with -boot at the end to your boot partition. Make sure that you extract it before flashing it (the downloaded file is a compressed .tar.xz archive).


  $ sudo nmcli device wifi list ifname wlan0
Flash it with this command:
  $ sudo nmcli --ask dev wifi connect SSID


Reboot and you should be connected.
heimdall flash --BOOT <Decompressed image filename> --verbose


=== Networking and wpa_supplicant ===
Note that it's important to write BOOT in all capitalised letters, as otherwise you will get an error about the partition not being found in the PIT.


You will need to manually configure the interfaces by creating <source>/etc/network/interfaces</source> e.g.,
After that's done, your device should now automatically reboot into postmarketOS!


  $ sudo vi /etc/network/interfaces
== WiFi ==


  <pre>
As of {{MR|2556|pmaports}}, WiFi should "just work" (on mainline).
  auto lo
  iface lo inet loopback
  auto wlan0
  iface wlan0 inet dhcp
  </pre>


Save changes and add networking to start with system
If WiFi networks show up but you can't connect to them, you can try using the nvram for samsung-m3/i9305. This is a hack and not necessarily endorsed, but at least one user has reported that their samsung-m0/i9300 needs this for WiFi to work. We would like to handle this better, but currently we don't have any way of doing this.


$ sudo rc-update add networking
To switch to the nvram meant for samsung-m3, run this command:


Add WiFi network information
<syntaxhighlight lang="shell-session>
$ cd /lib/firmware/brcm
$ sudo mv brcmfmac4334-sdio.samsung,i9300.txt brcmfmac4334-sdio.samsung,i9300.txt.bak
$ sudo ln -sf brcmfmac4334-sdio.samsung,i9305.txt brcmfmac4334-sdio.samsung,i9300.txt
</syntaxhighlight>


$ wpa_passphrase YOUR_SSID YOUR_PASSPHRASE | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
If it still refuses to connect, you might want to try replacing the contents of <code>/lib/firmware/bcrm/brcmfmac4334-sdio.samsung,i9300.txt</code> with [https://raw.githubusercontent.com/TheMuppets/proprietary_vendor_samsung/cm-14.1/smdk4412-common/proprietary/etc/wifi/nvram_net.txt the nvram from LineageOS]. Apparently this is necessary on some British i9300 models.


Restart services
Related issue: {{issue|1571|pmaports}}


$ sudo rc-service wpa_supplicant restart
== Video out ==
$ sudo rc-service networking start


=== WiFi on mainline ===
[[File:Samsung-m0-video-out.jpg|400px|thumb|right|Samsung Galaxy S III providing video out to a TV through an original Samsung dock (model name: EDD-S20EWE).]]


To get WiFi working on the mainline kernel install {{aport|linux-firmware-brcm}}, then on the device copy <code>nvram_net.txt</code> like this:
Video out should work as long as you use an 11pin MHL cable or dock (safest option would be an original Samsung dock/adapter from the time period, Samsung's EDD-S20EWE is known to work).


# cp /lib/firmware/postmarketos/nvram_net.txt /lib/firmware/brcm/brcmfmac4334-sdio.txt
In 2022-09, all hdmi related nodes were disabled ({{MR|3395|pmaports}}) as the kernel driver reports the wrong state, and this led to the Phosh stack not starting up.
A WIP to fix issue can be found at [https://gitlab.com/exynos4-mainline/linux/-/tree/m0-mhl-fixes gitlab.com/exynos4-mainline/linux/-/tree/m0-mhl-fixes].


On at least 5.13 and 5.14 the driver seem to expect a slightly different file name based on the device model so we can set up a symlink to handle both cases (replace i9305 with i9300 if you have i9300):
== Battery ==


# ln -s brcmfmac4334-sdio.txt /lib/firmware/brcm/brcmfmac4334-sdio.samsung,i9305.txt
With mainline, battery reporting works as of {{MR|2423|pmaports}}, and charging works as of {{MR|2546|pmaports}}. Charging allegedly randomly stops, but should that happen you can just unplug and re-plug the cable. Charging is also very slow and the device will probably lose power if you use it while charging.


Afterwards reboot the device and connect to a WiFi network with NetworkManager or wpa_supplicant.
Battery reporting and charging via postmarketOS does not work on the downstream kernel - the device gets stuck on whatever percentage it was on boot (although it does charge in recovery mode)


== Mainline Kernel ==
== Modem ==


'''I will preface this with the following reiteration of the warning at the top: The mainline kernel for this device has been reported to cause hardware failure. Reported failures include [https://drive.google.com/file/d/13cq-67ZOPo62tT_xhLBTU4u531fu6mXz screen/panel damage] and the device only turning on if a charger is plugged in (and also [https://drive.google.com/file/d/10zCTZp3sjg78zR9hRbcmVOhz11rvy2mk this]). Be careful when using the mainline kernel with this device, and don't use it unless you can risk effectively bricking your i9300/i9305. Issue is tracked/investigated in {{issue|1115|pmaports}}'''
The modem does not work in postmarketOS. That said, there was some work done to enable the modem on the i9300 variant of this device. It can be found here: https://github.com/fourkbomb/linux/tree/modem. Note that even if you apply this, you would likely need userspace patches as well for calls and mobile data to be usable.


Thanks in large part to the [http://blog.forkwhiletrue.me/pages/midas-mainline/ Midas on Mainline] work that was done a few years ago, we now have initial mainline support for this device. The pmOS patch that added initial support is [https://gitlab.com/postmarketOS/pmaports/-/commit/0bab9b5f8a99b6e80cf5def6590d82e6d5dddc3d here].
== Audio ==


The pmports repo for this device's linux-postmarketos-exynos4 mainline kernel is [https://gitlab.com/postmarketOS/pmaports/-/tree/master/main/linux-postmarketos-exynos4 here].
Audio mostly works. Notable omissions are input from the main microphone and headset audio out.


@pmOS_devices announcement from Nov 11, 2020: https://twitter.com/pmOS_devices/status/1326525105162293249
== GPS ==


Upstream dts: [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/exynos4412-i9305.dts exynos4412-i9305.dts]
The Galaxy S III uses [[Broadcom BCM4751 GPS]].


Blog announcement: https://postmarketos.org/blog/2020/11/06/postmarketOS-in-2020-11-part-1/#mainline-all-the-phones-and-tablets
== Miscellaneous mainline kernel information ==


Upstream kernel support matrix: [http://blog.forkwhiletrue.me/pages/midas-mainline/ Midas on Mainline].
The kernel package for this device in postmarketOS is {{Template:pmaport|linux-postmarketos-exynos4}}. The patches can be found in the [https://gitlab.com/exynos4-mainline/linux exynos4-mainline/linux repository on GitLab].


Note that [https://github.com/fourkbomb/linux/commit/2a6027178ae40c1d3baa965fe21b19cbf09493ce a patch is required] to make it work with the stock samsung bootloader and this is included in the pmports mainline repo above.
A large part of the mainlining process was done by [https://github.com/fourkbomb forkbomb]; see [http://blog.forkwhiletrue.me/pages/midas-mainline/ Midas on Mainline].


forkbomb from LineageOS got mainline u-boot running on this device and wrote about it in this blog post:
The Replicant project also provides good mainline support for the Galaxy S III; [https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/1219#note_85246108 they have expressed intent to collaborate with us]. Their support matrix can be found [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9300 on their wiki]. Relevant links:
https://blog.forkwhiletrue.me/posts/an-almost-fully-libre-galaxy-s3/


Replicant has this device booting with mainline Linux and almost mainline U-Boot with only the need for a few patches on top and would like to collaborate with us [https://github.com/postmarketOS/pmbootstrap/pull/1219#issuecomment-395876420]
* [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9300 General information]
* [https://redmine.replicant.us/projects/replicant/wiki/Exynos4Bootrom More bootloader research is here.]
* [https://git.replicant.us/replicant-next/kernel_replicant_linux Replicant's mainline kernel git repo]


The Qualcomm Gobi MDM9615 Modem seems to have mainline kernel support as well: https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9305#Hardware-table
Upstream DTS: [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/exynos4412-i9305.dts exynos4412-i9305.dts]


The Replicant project is working on getting the i9300 modem working with a mainline kernel in a way that pmOS can also utilize: https://redmine.replicant.us/issues/1954 https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem
=== Alternative bootloaders ===


LTE modem support with the mainline kernel on Replicant is being done here: https://redmine.replicant.us/issues/2206 The Note II discussed here has the same or very similar modem as the i9305.
* forkbomb got mainline u-boot running on this device and wrote about it in this blog post: https://blog.forkwhiletrue.me/posts/an-almost-fully-libre-galaxy-s3/
* [https://github.com/xboot/xboot/tree/b71fe8174882277897649bfe2177bf3ca300af69/src/arch/arm32/mach-exynos4412 xboot] might be a completely free bootloader option. Looks to have zero proprietary blobs.


Replicant and LineageOS successfully got the Lima driver for Mesa working on Mali when using mainline linux: [http://www.belg.in/replicant_9.webm video] [https://github.com/CustomROMs/android_local_manifests_i9300/issues/1#issuecomment-532308101 success announcement] linux-postmarketos-exynos4 now also has the same support.
=== Modem support ===


Replicant currently supports this device [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9300 in 6.0] and is doing a lot of research in order to get it running with [https://redmine.replicant.us/projects/replicant/wiki/Upstream a mainline kernel with a mainline bootloader] for Replicant 11. [https://redmine.replicant.us/projects/replicant/wiki/Exynos4Bootrom More bootloader research is here.]
Replicant supports the modem on mainline Linux, and they're working on getting the i9300 modem working with a mainline kernel in a way that pmOS can also utilize: https://redmine.replicant.us/issues/1954 https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem


Replicant's mainline kernel git repo: https://git.replicant.us/replicant-next/kernel_replicant_linux/
The Qualcomm Gobi MDM9615 Modem seems to have mainline kernel support as well: https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9305#Hardware-table


[https://github.com/xboot/xboot/tree/b71fe8174882277897649bfe2177bf3ca300af69/src/arch/arm32/mach-exynos4412 xboot] might be a completely free bootloader option. Looks to have zero proprietary blobs.
LTE modem support with the mainline kernel on Replicant is being done here: https://redmine.replicant.us/issues/2206 The Note II discussed here has the same or very similar modem as the i9305.


== Battery ==
== Warnings and considerations ==


While charging with the battery works, (I think) in TWRP at least, the current state of charging on Mainline or Downstream is unknown. There is an effort to get Mainline battery status reported correctly. [https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2423]
=== Power ===


== See also ==
It used to be that the battery percentage wasn't properly monitored and would get stuck at a set percentage at boot. While this was the case, the phone would not shut down when battery levels went too low, which could make the phone behave strangely on significantly worn batteries (in the ballpark of 50% wear). There are theories that this may have caused hardware failure for one user, but this is not proven. Battery level reporting has since been fixed, but it has not been extensively tested for reliability, so we recommend that you try to not let your phone's battery percentage fall too low. It should shut down on its own before anything adverse can happen, however.
* {{wikipedia|Samsung_Galaxy_S_III|Wikipedia}}
* {{Device package|samsung-i9300}}
* {{Kernel package|samsung-i9300}}
* [https://media.ccc.de/v/34c3-8784-emmc_hacking_or_how_i_fixed_long-dead_galaxy_s3_phones Fix long dead Galaxy S3 phone eMMC bug]
* [https://toomoch.github.io/i9300-EMMC-GUIDE/ Guide to revive a bricked i9300 EMMC]


=== Install with mainline kernel (WIP, not functional yet) ===
See {{issue|1115|pmaports}} for more information.


Note: Is now "linux-postmarketos-exynos4" .
=== eMMC firmware bugs ===


<source lang="bash">
Replicant has a good article about this: https://redmine.replicant.us/projects/replicant/wiki/EMMCFirmwareBugs
#Export image files in ~/.local/var/pmbootstrap/chroot_rootfs_samsung-i9305/boot/
pmbootstrap export


#5,3M -rw-r--r--  1 root root 5,3M déc.  22 20:31 boot.img-samsung-i9305 (initramfs + vmlinuz)
=== Heimdall does not consider partition sizes when flashing ===
#1,3M -rw-r--r--  1 root root 1,3M déc.  22 20:31 initramfs-samsung-i9305
#6,1M -rw-r--r--  1 root root 6,1M déc.  22 20:31 initramfs-samsung-i9305-extra
#4,1M -rw-r--r--  1 root root 4,1M nov.  5 17:30 vmlinuz-samsung-i9305


#Get linux-next
See {{github|494|Heimdall|Benjamin-Dobell}}
cd ~/code
# Case 1 : first checkout
git clone https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux
cd linux/
git fetch origin
git reset --hard origin/master
# Case 2 : update
cd linux/
git checkout master
git pull


#Prepare compile with i9305 defconfig in ~/code/linux/arch/arm/configs
== See also ==
source ~/code/pmbootstrap/helpers/envkernel.sh
* {{wikipedia|Samsung_Galaxy_S_III|Wikipedia}}
make exynos_defconfig
* {{Device package|samsung-m0|community}}
#DTS : Note that ~/code/linux/arch/arm/boot/dts/exynos4412-i9305.dts already exists and should work
* {{Kernel package|postmarketos-exynos4|community}}
#Makefile in ~/code/linux/arch/arm/boot/dts/ already contains this DTS
* [https://media.ccc.de/v/34c3-8784-emmc_hacking_or_how_i_fixed_long-dead_galaxy_s3_phones Fix long dead Galaxy S3 phone eMMC bug]
 
* [https://toomoch.github.io/i9300-EMMC-GUIDE/ Guide to revive a bricked i9300 EMMC]
#Kernel compilation
* {{MR|2556|pmaports}} Rename from i9300 to m0
make -j5
* [https://github.com/ungeskriptet/miscellaneous/raw/main/twrp-3.6.0_9-i9300_emmc-boot-partitions-patch.img TWRP with eMMC boot partitions patch], useful for flashing bootloaders
 
#Prepare shell
<code>
pmbootstrap chroot -- apk add abootimg android-tools mkbootimg dtbtool findutils
export DEVICE="$(pmbootstrap config device)"
export WORK="$(pmbootstrap config work)"
export TEMP="$WORK/chroot_native/tmp/mainline/"
mkdir -p "$TEMP"
 
#Patch boot image
cd ~/code/linux/.output/arch/arm/boot
cat zImage dts/exynos4412-i9305.dtb > "$TEMP"/zImage-dtb
cp "/tmp/postmarketOS-export/boot.img-$DEVICE" "$TEMP/boot.img"
pmbootstrap chroot
abootimg -u /tmp/mainline/boot.img -k /tmp/mainline/zImage-dtb -c bootsize=8955904
exit
 
#Flash with Heimdall - WARNING - NOT FUNCTIONNAL YET
# enter download mode with down+home+power
# Connect usb
# click 'up'
heimdall detect
heimdall flash --BOOT ~/.local/var/pmbootstrap/chroot_native/tmp/mainline/boot.img
</source>

Latest revision as of 11:33, 1 February 2025

Samsung Galaxy S III
Samsung Galaxy S III
Samsung Galaxy S III
Manufacturer Samsung
Name Galaxy S III
Codename samsung-m0
Released 2012
Type handset
Hardware
Chipset Samsung Exynos 4412 Quad
CPU Quad-core 1.4 GHz Cortex-A9
GPU Mali 400 MP4
Display 720x1280 Super AMOLED
Storage 16 GB/32 GB
Memory 1 GB (GT-i9300 & SHW-M440S)
Architecture armv7
Software
Original software Android
Original version 4.1.1
FOSS bootloader partial
postmarketOS
Category community
Pre-built images yes
Features
Flashing
Works
USB Networking
Partial
Internal storage
Works
SD card
Works
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Partial
Camera
Partial
Camera Flash
No data
Connectivity
WiFi
Works
Bluetooth
Partial
GPS
Broken
Modem
Calls
Broken
SMS
Broken
Mobile data
Broken
Miscellaneous
FDE
Works
USB OTG
Works
HDMI/DP
Partial
Sensors
Accelerometer
Works
Magnetometer
No data
Ambient Light
Works
Proximity
No data
Hall Effect
No data
U-Boot
Primary Bootloader
Works
Mainline
Broken
Internal Storage
No data
SD card
No data
USB Host
No data
USB Peripheral
No data
Display
No data
Buttons
No data

Contributors

Maintainer(s)

Basic Info

So far, what works for Samsung Galaxy S III LTE (samsung-m3) also works for the samsung-m0 (Galaxy S III international GSM version without LTE, Also known as Galaxy S III 3G SHW-M440S in South Korea) and samsung-shv-e210s (a Korean variant). (None of these S III models should be confused with the North American S III models, which require OS builds.)

Code name is MIDAS. Search for midas-mainline to find more info.

Users owning this device


How to enter flash mode

  • Hold power + Home + volume down
  • When prompted, release all buttons and press volume up

Installation

Step 1: Flash the system

Option 1: Flash the system to an SD card

Start by flashing a pre-built postmarketOS rootfs image onto an SD card, as described in the installation article.

Option 2: Flash the system to the phone's internal storage

Note Note: If this runs into errors, please use option 1.

Prepare img2simg

Start by downloading and building simg2img, make sure that it's runnable from somewhere, you can just copy the generated binaries, (only 'img2simg' is needed), in /usr/bin and make them executable with chmod.

Prepare needed images - Option 1: Use a pre-built image

Download a pre-built postmarketOS rootfs image (GNOME mobile recommended, others ran into errors for me, more testing required), and extract it with any xz-supporting archive software, make sure to NOT extract the .img itself, only the .xz.

Prepare needed images - Option 2: Use a image you built yourself with pmbootstrap

Follow the instructions at this Wiki page till "Flashing", since you won't flash the image yet, instead do

pmbootstrap export

and copy your rootfs image (usually named samsung-m0.img) from the output directory to a working directory.

Convert the image into Android sparse format

The next step is to convert the rootfs image into an Android sparse image.

This is needed so we can flash the image in download mode.

To do this, we will use img2simg. Run this in the directory where you downloaded/saved the rootfs image:

img2simg path-to-rootfs.img pmos-sparse.img

The command might take some time to be executed, but once done, you will have an Android sparse image of postmarketOS ("pmos-sparse.img").

Flash the image

The next step is to flash that image with Heimdall. Note: you might need to repeat these steps if Android overwrites the USERDATA partition. Anyways, to flash the image, we need to enter ODIN mode as described in Enter ODIN mode, and run this command:

heimdall flash --USERDATA pmos-sparse.img

Step 2: Enter ODIN mode

To enter ODIN mode, follow these steps:

 1. Turn off phone
 3. Hold Volume Down + Home + Power until you get Warning!! screen
 2. Connect USB cable
 4. Push Volume up to continue to ODIN mode screen

Step 3: Flash the kernel via ODIN mode

Now, use Heimdall to flash the image with -boot at the end to your boot partition. Make sure that you extract it before flashing it (the downloaded file is a compressed .tar.xz archive).

Flash it with this command:

heimdall flash --BOOT <Decompressed image filename> --verbose

Note that it's important to write BOOT in all capitalised letters, as otherwise you will get an error about the partition not being found in the PIT.

After that's done, your device should now automatically reboot into postmarketOS!

WiFi

As of pmaports!2556, WiFi should "just work" (on mainline).

If WiFi networks show up but you can't connect to them, you can try using the nvram for samsung-m3/i9305. This is a hack and not necessarily endorsed, but at least one user has reported that their samsung-m0/i9300 needs this for WiFi to work. We would like to handle this better, but currently we don't have any way of doing this.

To switch to the nvram meant for samsung-m3, run this command:

$ cd /lib/firmware/brcm
$ sudo mv brcmfmac4334-sdio.samsung,i9300.txt brcmfmac4334-sdio.samsung,i9300.txt.bak
$ sudo ln -sf brcmfmac4334-sdio.samsung,i9305.txt brcmfmac4334-sdio.samsung,i9300.txt

If it still refuses to connect, you might want to try replacing the contents of /lib/firmware/bcrm/brcmfmac4334-sdio.samsung,i9300.txt with the nvram from LineageOS. Apparently this is necessary on some British i9300 models.

Related issue: pmaports#1571

Video out

Samsung Galaxy S III providing video out to a TV through an original Samsung dock (model name: EDD-S20EWE).

Video out should work as long as you use an 11pin MHL cable or dock (safest option would be an original Samsung dock/adapter from the time period, Samsung's EDD-S20EWE is known to work).

In 2022-09, all hdmi related nodes were disabled (pmaports!3395) as the kernel driver reports the wrong state, and this led to the Phosh stack not starting up. A WIP to fix issue can be found at gitlab.com/exynos4-mainline/linux/-/tree/m0-mhl-fixes.

Battery

With mainline, battery reporting works as of pmaports!2423, and charging works as of pmaports!2546. Charging allegedly randomly stops, but should that happen you can just unplug and re-plug the cable. Charging is also very slow and the device will probably lose power if you use it while charging.

Battery reporting and charging via postmarketOS does not work on the downstream kernel - the device gets stuck on whatever percentage it was on boot (although it does charge in recovery mode)

Modem

The modem does not work in postmarketOS. That said, there was some work done to enable the modem on the i9300 variant of this device. It can be found here: https://github.com/fourkbomb/linux/tree/modem. Note that even if you apply this, you would likely need userspace patches as well for calls and mobile data to be usable.

Audio

Audio mostly works. Notable omissions are input from the main microphone and headset audio out.

GPS

The Galaxy S III uses Broadcom BCM4751 GPS.

Miscellaneous mainline kernel information

The kernel package for this device in postmarketOS is linux-postmarketos-exynos4PMOS. The patches can be found in the exynos4-mainline/linux repository on GitLab.

A large part of the mainlining process was done by forkbomb; see Midas on Mainline.

The Replicant project also provides good mainline support for the Galaxy S III; they have expressed intent to collaborate with us. Their support matrix can be found on their wiki. Relevant links:

Upstream DTS: exynos4412-i9305.dts

Alternative bootloaders

Modem support

Replicant supports the modem on mainline Linux, and they're working on getting the i9300 modem working with a mainline kernel in a way that pmOS can also utilize: https://redmine.replicant.us/issues/1954 https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem

The Qualcomm Gobi MDM9615 Modem seems to have mainline kernel support as well: https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9305#Hardware-table

LTE modem support with the mainline kernel on Replicant is being done here: https://redmine.replicant.us/issues/2206 The Note II discussed here has the same or very similar modem as the i9305.

Warnings and considerations

Power

It used to be that the battery percentage wasn't properly monitored and would get stuck at a set percentage at boot. While this was the case, the phone would not shut down when battery levels went too low, which could make the phone behave strangely on significantly worn batteries (in the ballpark of 50% wear). There are theories that this may have caused hardware failure for one user, but this is not proven. Battery level reporting has since been fixed, but it has not been extensively tested for reliability, so we recommend that you try to not let your phone's battery percentage fall too low. It should shut down on its own before anything adverse can happen, however.

See pmaports#1115 for more information.

eMMC firmware bugs

Replicant has a good article about this: https://redmine.replicant.us/projects/replicant/wiki/EMMCFirmwareBugs

Heimdall does not consider partition sizes when flashing

See Heimdall#494

See also