Dzmitry Sankouski | 4e6df40 | 2021-10-17 13:44:32 +0300 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | .. sectionauthor:: Dzmitry Sankouski <dsankouski@gmail.com> |
| 3 | |
| 4 | Snapdragon 845 |
| 5 | ================ |
| 6 | |
| 7 | About this |
| 8 | ---------- |
| 9 | This document describes the information about Qualcomm Snapdragon 845 |
| 10 | supported boards and it's usage steps. |
| 11 | |
| 12 | SDM845 - hi-end qualcomm chip, introduced in late 2017. |
| 13 | Mostly used in flagship phones and tablets of 2018. |
| 14 | |
| 15 | U-Boot can be used as a replacement for Qualcomm's original ABL (UEFI) bootloader. |
| 16 | It is loaded as an Android boot image through ABL |
| 17 | |
| 18 | Installation |
| 19 | ------------ |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 20 | Build |
| 21 | ^^^^^ |
| 22 | Setup ``CROSS_COMPILE`` for aarch64 and build U-Boot for your board:: |
Dzmitry Sankouski | 4e6df40 | 2021-10-17 13:44:32 +0300 | [diff] [blame] | 23 | |
| 24 | $ export CROSS_COMPILE=<aarch64 toolchain prefix> |
| 25 | $ make <your board name here, see Boards section>_defconfig |
| 26 | $ make |
| 27 | |
| 28 | This will build ``u-boot.bin`` in the configured output directory. |
| 29 | |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 30 | Generate FIT image |
| 31 | ^^^^^^^^^^^^^^^^^^ |
| 32 | See doc/uImage.FIT for more details |
| 33 | |
| 34 | Pack android boot image |
| 35 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 36 | We'll assemble android boot image with ``u-boot.bin`` instead of linux kernel, |
| 37 | and FIT image instead of ``initramfs``. Android bootloader expect gzipped kernel |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 38 | with appended dtb, so let's mimic linux to satisfy stock bootloader. |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 39 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 40 | Boards |
| 41 | ------------ |
| 42 | starqlte |
| 43 | ^^^^^^^^^^^^ |
| 44 | |
| 45 | The starqltechn is a production board for Samsung S9 (SM-G9600) phone, |
| 46 | based on the Qualcomm SDM845 SoC. |
| 47 | |
| 48 | Steps: |
| 49 | |
| 50 | - Build u-boot:: |
| 51 | |
| 52 | $ export CROSS_COMPILE=<aarch64 toolchain prefix> |
| 53 | $ make starqltechn_defconfig |
| 54 | $ make |
| 55 | |
| 56 | - Create dump dtb:: |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 57 | |
| 58 | workdir=/tmp/prepare_payload |
| 59 | mkdir -p "$workdir" |
| 60 | cd "$workdir" |
| 61 | mock_dtb="$workdir"/payload_mock.dtb |
| 62 | |
| 63 | dtc -I dts -O dtb -o "$mock_dtb" << EOF |
| 64 | /dts-v1/; |
| 65 | / { |
| 66 | memory { |
| 67 | /* We expect the bootloader to fill in the size */ |
| 68 | reg = <0 0 0 0>; |
| 69 | }; |
| 70 | |
| 71 | chosen { }; |
| 72 | }; |
| 73 | EOF |
| 74 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 75 | - gzip u-boot:: |
| 76 | |
| 77 | gzip u-boot.bin |
| 78 | |
| 79 | - Append dtb to gzipped u-boot:: |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 80 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 81 | cat u-boot.bin.gz "$mock_dtb" > u-boot.bin.gz-dtb |
| 82 | |
| 83 | - Now we've got everything to build android boot image:: |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 84 | |
| 85 | mkbootimg --base 0x0 --kernel_offset 0x00008000 \ |
| 86 | --ramdisk_offset 0x02000000 --tags_offset 0x01e00000 \ |
| 87 | --pagesize 4096 --second_offset 0x00f00000 \ |
| 88 | --ramdisk "$fit_image" \ |
| 89 | --kernel u-boot.bin.gz-dtb \ |
| 90 | -o boot.img |
| 91 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 92 | - Flash image with your phone's flashing method. |
Dzmitry Sankouski | 8e3bdd5 | 2022-02-22 21:49:53 +0300 | [diff] [blame] | 93 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 94 | More information can be found on the `Samsung S9 page`_. |
Dzmitry Sankouski | 4e6df40 | 2021-10-17 13:44:32 +0300 | [diff] [blame] | 95 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 96 | dragonboard845c |
| 97 | ^^^^^^^^^^^^^^^ |
Dzmitry Sankouski | 4e6df40 | 2021-10-17 13:44:32 +0300 | [diff] [blame] | 98 | |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 99 | The dragonboard845c is a Qualcomm Robotics RB3 Development Platform, based on |
| 100 | the Qualcomm SDM845 SoC. |
| 101 | |
| 102 | Steps: |
| 103 | |
| 104 | - Build u-boot:: |
| 105 | |
| 106 | $ export CROSS_COMPILE=<aarch64 toolchain prefix> |
| 107 | $ make dragonboard845c_defconfig |
| 108 | $ make |
| 109 | |
| 110 | - Create dummy dtb:: |
| 111 | |
| 112 | workdir=/tmp/prepare_payload |
| 113 | mkdir -p "$workdir" |
| 114 | mock_dtb="$workdir"/payload_mock.dtb |
| 115 | |
| 116 | dtc -I dts -O dtb -o "$mock_dtb" << EOF |
| 117 | /dts-v1/; |
| 118 | / { |
| 119 | #address-cells = <2>; |
| 120 | #size-cells = <2>; |
| 121 | |
| 122 | memory@80000000 { |
| 123 | device_type = "memory"; |
| 124 | /* We expect the bootloader to fill in the size */ |
| 125 | reg = <0 0x80000000 0 0>; |
| 126 | }; |
| 127 | |
| 128 | chosen { }; |
| 129 | }; |
| 130 | EOF |
| 131 | |
| 132 | - gzip u-boot:: |
| 133 | |
| 134 | gzip u-boot.bin |
| 135 | |
| 136 | - Append dtb to gzipped u-boot:: |
| 137 | |
| 138 | cat u-boot.bin.gz "$mock_dtb" > u-boot.bin.gz-dtb |
| 139 | |
| 140 | - A ``db845c.its`` file can be found in ``board/qualcomm/dragonboard845c/`` |
| 141 | directory. It expects a folder as ``db845c_imgs/`` in the main directory |
| 142 | containing pre-built kernel, dts and ramdisk images. See ``db845c.its`` |
| 143 | for full path to images:: |
| 144 | |
| 145 | mkimage -f db845c.its db845c.itb |
| 146 | |
| 147 | - Now we've got everything to build android boot image:: |
| 148 | |
| 149 | mkbootimg --kernel u-boot.bin.gz-dtb --ramdisk db845c.itb \ |
| 150 | --output boot.img --pagesize 4096 --base 0x80000000 |
| 151 | |
| 152 | - Flash boot.img using db845c fastboot method. |
| 153 | |
| 154 | More information can be found on the `DragonBoard 845c page`_. |
Dzmitry Sankouski | 4e6df40 | 2021-10-17 13:44:32 +0300 | [diff] [blame] | 155 | |
| 156 | .. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9 |
Sumit Garg | 5b32da4 | 2022-07-12 12:42:08 +0530 | [diff] [blame] | 157 | .. _DragonBoard 845c page: https://www.96boards.org/product/rb3-platform/ |