Samsung Galaxy SII (samsung-i9100)/Installation

From postmarketOS

Installation

We're using the heimdall-isorec flash method, see deviceinfo_flash_methods for more information.

Enable ODIN (download) mode

  • Turn off phone
  • Connect USB cable
  • Hold VOLUME_DOWN + HOME + POWER until you get the "Warning!!" screen
  • Push VOLUME_UP to continue to ODIN mode, as per the instructions appearing on the screen

Option #1: Install to the internal memory (easiest)

  • Configure the image:
 $ pmbootstrap init

Use the channel "edge", vendor "samsung", device codename "i9100". It is recommended to use the mainline kernel, with the Phosh UI, and the WiFi firmwares for the best experience, but you can customize it to your needs.

Note Not all the configurations will work. See What works to confirm your choice.
  • Build the image:
 $ pmbootstrap install
  • Flash the OS to the internal memory:
 $ pmbootstrap flasher flash_kernel
 $ pmbootstrap flasher flash_rootfs

The phone will reboot between the two commands, make sure to re-enter the ODIN (download) mode to execute the last command. This one can take a very long time to start. Once the transfer is complete, the phone will reboot again and your phone should boot into PostmarketOS.

Option #2: Install to a SD card

  • As above, configure the image with:
 $ pmbootstrap init
  • Insert the SD card and find its path

One way is to run lsblk in a terminal and find the path to the SD card (e.g. /dev/sde). In the following steps, we will use /path/to/sdcard as a placeholder, which you should adapt to your system.

  • Install PostmarketOS to the SD card
 $ pmbootstrap install --sdcard=/path/to/sdcard
  • Insert the SD card into your Galaxy S2 and reboot. The system should boot (JonesV tested it with xfce4 and weston on 2020-08-20).

Option #3: Install from the recovery zip installer

  • Install a recovery like TWRP on your device
  • Configure the image
 $ pmbootstrap init
  • Prepare the installation
 $ pmbootstrap install --android-recovery-zip
  • Flash the image on the phone
 $ pmbootstrap flasher --method=adb sideload

Option #4: Export the recovery zip into the eMMC's UMS partition over MTP and install from recovery

Note Tacokoneko used this method for Samsung Galaxy S II Epic 4G Touch (d710) when none of the above methods worked for their device. Tacokoneko has not been able to enable WiFi with either downstream or mainline kernels as of 2021-08-25, but most other features in What works and 3D acceleration are functional.
Note Requirements:
  • Update pmbootstrap
 $ pmbootstrap pull
  • Configure the image, select samsung i9100
 $ pmbootstrap init
  • Download, prepare and compress postmarketOS into a recovery package for TWRP
 $ pmbootstrap install --android-recovery-zip
  • Extract the required temporary recovery and kernel created by Lanchon on XDA Forums
 $ unzip recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-\(by-arnab\).zip
 $ unzip kernel-Lanchon-20160406-cm-13.0-i9100.zip
  • Start the device in download mode (hold VOLUME_DOWN + POWER -> VOLUME_UP for d710) -> plug device into PC
  • Flash the temporary kernel and TWRP using heimdall
 $ heimdall flash --RECOVERY recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-\(by-arnab\)/isorec-ramdrive.cpio.lzo --KERNEL kernel-Lanchon-20160406-cm-13.0-i9100/boot.img --no-reboot
  • Unplug the device -> reboot to recovery (hold VOLUME_UP + POWER for d710)-> plug device back in -> in TWRP, mount -> disable MTP -> enable MTP -> back
  • Export the pmbootstrap chroot contents and create a symlink to them in /tmp/
 $ pmbootstrap export
  • Change directory to the location of pmos-samsung-i9100.zip
 $ cd $(dirname $(readlink /tmp/postmarketOS-export/pmos-*.zip))
  • Use an MTP client, for example gvfs-mtp with GNOME, to mount the device's eMMC UMS partition (virtual SD card) filesystem. If the one included with your Desktop Environment isn't working with this device, keep trying other MTP clients until you find one that does. The path it is mounted to may vary for you.
 $ cp pmos-samsung-i9100.zip /run/user/1000/gvfs/mtp:host=samsung_GT-I9100_0123456789ABCDEF/eMMC/
  • When the transfer is complete, in TWRP, install -> eMMC -> select pmos-samsung-i9100.zip -> swipe to flash postmarketOS into DATAFS
  • When complete, reboot to download mode and flash the postmarketOS kernel and recovery, overwriting the temporary ones
 $ pmbootstrap flasher flash_kernel
  • When complete, the device will reboot into postmarketOS

Use UMS partition as root filesystem

Note Warning: Tacokoneko used this method for Samsung Galaxy S II Epic 4G Touch (d710) when directly flashing the UMS partition with heimdall didn't work for their device. This erases everything that was in the Documents/Download/DCIM folders if Android was ever used previously, and it also makes the "installation via TWRP mounting the UMS partition" method above not work anymore until you reformat the UMS partition back to FAT32, so if you don't have a different installation method working and have to use the UMS partition for first the recovery zip and then the root filesystem, you should use caution because a failure could mean a lot of backtracking.

This installs postmarketOS to the 12 GB partition of the Galaxy S II's default OFW PIT instead of the 2 GB partition that is used by default:

  • Do all the steps to install postmarketOS normally, except use this before the step pmbootstrap flasher flash_kernel
 $ pmbootstrap initfs hook_add debug-shell
  • Reboot and wait for "debug-shell is active" to appear on the screen.
  • Use telnet 172.16.42.1 to connect and then use these commands once connected to the device:
 $ dd if=/dev/mmcblk0p10 of=/dev/mmcblk0p11
 $ sync
 $ dd if=/dev/zero of=/dev/mmcblk0p10 bs=1 count=512
  • Reboot back to Download Mode, then use these commands:
 $ pmbootstrap initfs hook_del debug-shell
 $ pmbootstrap flasher flash_kernel
  • When complete, the device will reboot into a postmarketOS installation on the 12 GB partition and automatically resize to fill the space.

Mainline kernel

The Galaxy SII can be used with the mainline kernel for Exynos devices, packaged by PostmarketOS. Simply choose the mainline kernel when running pmbootstrap init.

Firmware files

When running "pmbootstrap init", it will ask you if you want to enable the "device-samsung-i9100-nonfree-firmware" package. Write "y" to be able to use the embedded WiFi chip.

U-Boot bootloader (legacy)

Sekilsgs2 on Github created a u-boot bootloader port, based on the work done by the user astarasikov at this repository. It is possible to use it with PostmarketOS but it requires some things to be done by hand.

  • In pmbootstrap init, add u-boot-samsung-i9100 to the list of extra packages to enable.
  • Run pmbootstrap install to build the image.
  • Flash the OS using one of the methods listed above.
  • Now, we want both u-boot and the kernel to be installed to the same partition (KERNEL). So you need to concatenate the two files and flash the result:
 $ cp ~/.local/var/pmbootstrap/chroot_rootfs_samsung-i9100/boot/u-boot.bin /tmp/u-boot-with-kernel.img
 $ dd if=~/.local/var/pmbootstrap/chroot_rootfs_samsung-i9100/boot/vmlinuz-dtb of=/tmp/u-boot-with-kernel.img bs=512K seek=1 conv=notrunc
 $ heimdall flash --KERNEL /tmp/u-boot-with-kernel.img

Once flashed, the phone will reboot and you should see u-boot appear. Configuring the boot options is not trivial as it can only be done by editing the source code (file: include/configs/galaxys2.h). The critical part for me was to change boot parameters in the section "boot_android" to something like this:

 root=/dev/mmcblk1p1 rw rootfstype=ext4 rootwait init=/sbin/init ;

Where /dev/mmcblk1p1 was the ext4 partition with the root filesystem on the sd-card.

User:Onny is interested in porting the i9100 u-boot patches to newer versions of u-boot but currently u-boot fails with the newer s5p_sdhci driver introduced in newer versions, see Github issue here.

Sekilsgs2 is also working on (March 2020) supporting the Galaxy S2 in the latest u-boot version.

TALUAtGitHub has a recent commit (March 2020) git commit that might be helpful [1]