Samsung Galaxy A5 (2017)



Galaxy A5 (2017)



System Type






Supports Stage-0



Mobile NixOS repository


Building and installing

There are multiple installation methods for your Samsung Galaxy A5 (2017). They all rely on flashing one or more partitions on your device.


All installation methods can lead to data loss.

Flashing a partition will erase everything on the partition. Additionally, the common backups methods, e.g. TWRP, will not backup the userdata partition, which may be the installation target.

Make backups.

Using Heimdall

This will produce a folder with a flashing script, and the partition images for your Samsung Galaxy A5 (2017).

$ nix-build --argstr device samsung-a5y17lte -A

Alternatively, you can build a specific partition image:

$ nix-build --argstr device samsung-a5y17lte -A
$ nix-build --argstr device samsung-a5y17lte -A build.rootfs

The device will need to be booted in its bootloader, or odin, mode.

The boot images can be installed using the following command, assuming the android-fastboot-images output was used.

$ result/

If you have a system image (system.img) built, you can use heimdall to flash it to the device. Note that it might be too big to fit over the SYSTEM partition. In such case, it can be flashed on the USERDATA partition.

$ heimdall flash --USERDATA system.img

Using a flashable zip

An alternative installation method is to use a flashable zip. The flashable zip can be built for your Samsung Galaxy A5 (2017) using one of the following commands:

$ nix-build --argstr device samsung-a5y17lte -A
$ nix-build --argstr device samsung-a5y17lte -A
$ nix-build --argstr device samsung-a5y17lte -A

The first two will flash only a specific partition. The last one contains the partitions of the two previous one.

The zip can either be copied to the device and selected in a compatible Android recovery, or sent to the device through adb sideload.

$ adb sideload /nix/store/

By default it will flash to the system partition. Some configurations may change this to flash to the userdata partition. In that case, no warning is given before flashing.

Device-specific notes


To force-reboot the device, hold Volume Down + Home + Power for a couple of seconds.

Odin mode

Holding Volume Down + Home + Power during power-up will go to the Samsung specific bootloader mode.


Holding Volume Up + Home + Power during power-up will boot the recovery boot image.

Flashing system image

Using heimdall to flash system.img, either on the USERDATA or on the SYSTEM partition seems to fail, for unclear reasons.

One can use TWRP to flash the partitions:

 $ adb shell dd of=/dev/block/platform/13540000.dwmmc0/by-name/SYSTEM bs=8M < .../system.img
 $ # or
 $ adb shell dd of=/dev/block/platform/13540000.dwmmc0/by-name/USERDATA bs=8M < .../system.img