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