Dzmitry Sankouski | 83af4cb | 2021-10-17 13:45:42 +0300 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | .. sectionauthor:: Dzmitry Sankouski <dsankouski@gmail.com> |
| 3 | |
| 4 | Samsung 2017 A series phones |
| 5 | ============================ |
| 6 | |
| 7 | About this |
| 8 | ---------- |
| 9 | This document describes the information about Samsung A(7/5/3) 2017 midrange |
| 10 | phones and u-boot usage steps. |
| 11 | |
| 12 | U-Boot can be used as a chain-loaded bootloader to replace Samsung's original SBOOT bootloader. |
| 13 | It is loaded as an Android boot image through SBOOT. |
| 14 | |
| 15 | Phone specs |
| 16 | ----------- |
Henrik Grimler | 2492c46 | 2022-01-07 20:12:55 +0100 | [diff] [blame] | 17 | A3 (SM-A320) (a3y17lte) |
Tom Rini | d833980 | 2022-01-19 11:06:07 -0500 | [diff] [blame] | 18 | ^^^^^^^^^^^^^^^^^^^^^^^ |
Dzmitry Sankouski | 83af4cb | 2021-10-17 13:45:42 +0300 | [diff] [blame] | 19 | - 4.7 AMOLED display |
| 20 | - Exynos 7870 SoC |
| 21 | - 16GB flash |
| 22 | - 2GB RAM |
| 23 | |
| 24 | .. A3 2017 wiki page: https://en.wikipedia.org/wiki/Samsung_Galaxy_A3_(2017) |
| 25 | |
Henrik Grimler | 2492c46 | 2022-01-07 20:12:55 +0100 | [diff] [blame] | 26 | A5 (SM-A520) (a5y17lte) |
Tom Rini | d833980 | 2022-01-19 11:06:07 -0500 | [diff] [blame] | 27 | ^^^^^^^^^^^^^^^^^^^^^^^ |
Dzmitry Sankouski | 83af4cb | 2021-10-17 13:45:42 +0300 | [diff] [blame] | 28 | - 5.2 AMOLED display |
| 29 | - Exynos 7880 SoC |
| 30 | - 32GB flash |
| 31 | - 3GB RAM |
| 32 | |
| 33 | .. A5 2017 wiki page: https://en.wikipedia.org/wiki/Samsung_Galaxy_A5_(2017) |
| 34 | |
Henrik Grimler | 2492c46 | 2022-01-07 20:12:55 +0100 | [diff] [blame] | 35 | A7 (SM-A720) (a5y17lte) |
Tom Rini | d833980 | 2022-01-19 11:06:07 -0500 | [diff] [blame] | 36 | ^^^^^^^^^^^^^^^^^^^^^^^ |
Dzmitry Sankouski | 83af4cb | 2021-10-17 13:45:42 +0300 | [diff] [blame] | 37 | - 5.7 AMOLED display |
| 38 | - Exynos 7880 SoC |
| 39 | - 32GB flash |
| 40 | - 3GB RAM |
| 41 | |
| 42 | .. A7 2017 wiki page: https://en.wikipedia.org/wiki/Samsung_Galaxy_A7_(2017) |
| 43 | |
| 44 | Installation |
| 45 | ------------ |
| 46 | |
| 47 | Building u-boot |
| 48 | ^^^^^^^^^^^^^^^ |
| 49 | |
| 50 | First, setup ``CROSS_COMPILE`` for aarch64. |
| 51 | Then, build U-Boot for your phone, for example ``a5y17lte``:: |
| 52 | |
| 53 | $ export CROSS_COMPILE=<aarch64 toolchain prefix> |
| 54 | $ make a5y17lte_defconfig |
| 55 | $ make |
| 56 | |
| 57 | This will build ``u-boot.bin`` in the configured output directory. |
| 58 | |
| 59 | Payload |
| 60 | ^^^^^^^ |
| 61 | What is a payload? |
| 62 | """""""""""""""""" |
| 63 | A payload file is a file to be used instead of linux kernel in android boot image. |
| 64 | This file will be loaded into memory, and executed by SBOOT, |
| 65 | and is therefore SBOOT's payload. |
| 66 | It may be pure u-boot (with loading u-boot's payload from flash in mind), |
| 67 | or u-boot + u-boot's payload. |
| 68 | |
| 69 | It should be kept in mind, that SBOOT binary patches it's payload after loading |
| 70 | in address range 0x401f8550-0x401f9280. Given SBOOT loads payload to 0x40001000, |
| 71 | a range of 0x1f7550-0x1f8280 (2061648-2065024) in a payload file |
| 72 | will be corrupted after loading to RAM. |
| 73 | |
| 74 | Creating payload file |
| 75 | """"""""""""""""""""" |
| 76 | - Assemble FIT image for your kernel |
| 77 | - Create a file for u-boot payload ``touch sboot-payload`` |
| 78 | - Write zeroes till 0x200000 address to be sure SBOOT won't corrupt your info |
| 79 | ``dd if=/dev/zero of=sboot-payload bs=$((0x200000)) count=1`` |
| 80 | - Write u-boot to the start of the payload ``dd if=<u-boot.bin path> of=sboot-payload`` |
| 81 | - Write FIT image to payload from 0x200000 address |
| 82 | ``dd if=<FIT image path> of=sboot-payload seek=1 bs=2M`` |
| 83 | |
| 84 | Creating android boot image |
| 85 | """"""""""""""""""""""""""" |
| 86 | Once payload created, it's time for android image:: |
| 87 | |
| 88 | mkbootimg --base 0x40000000 --kernel_offset 0x00000000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --pagesize 2048 --second_offset 0x00f00000 --kernel <sboot-payload path> -o uboot.img |
| 89 | |
| 90 | Note, that stock Samsung bootloader ignores offsets, set in mkbootimg. |
| 91 | |
| 92 | Flashing |
| 93 | """""""" |
| 94 | Flash like regular android boot image. |