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