blob: a65f00df39f54a71a486945c182c2ec89c1a2a77 [file] [log] [blame]
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +03001.. SPDX-License-Identifier: GPL-2.0+
2.. sectionauthor:: Dzmitry Sankouski <dsankouski@gmail.com>
3
4Snapdragon 845
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +02005==============
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +03006
7About this
8----------
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +02009
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +030010This document describes the information about Qualcomm Snapdragon 845
11supported boards and it's usage steps.
12
13SDM845 - hi-end qualcomm chip, introduced in late 2017.
14Mostly used in flagship phones and tablets of 2018.
15
Bhupesh Sharma1f92ef12023-04-20 16:58:48 +053016The current boot flow support loading u-boot as an Android boot image via
17Qualcomm's UEFI-based ABL (Android) Bootloader.
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +030018
19Installation
20------------
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +020021
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030022Build
23^^^^^
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +020024
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030025Setup ``CROSS_COMPILE`` for aarch64 and build U-Boot for your board::
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +030026
27 $ export CROSS_COMPILE=<aarch64 toolchain prefix>
28 $ make <your board name here, see Boards section>_defconfig
29 $ make
30
31This will build ``u-boot.bin`` in the configured output directory.
32
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030033Generate FIT image
34^^^^^^^^^^^^^^^^^^
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +020035
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030036See doc/uImage.FIT for more details
37
38Pack android boot image
39^^^^^^^^^^^^^^^^^^^^^^^
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +020040
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030041We'll assemble android boot image with ``u-boot.bin`` instead of linux kernel,
42and FIT image instead of ``initramfs``. Android bootloader expect gzipped kernel
Sumit Garg5b32da42022-07-12 12:42:08 +053043with appended dtb, so let's mimic linux to satisfy stock bootloader.
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030044
Sumit Garg5b32da42022-07-12 12:42:08 +053045Boards
Sumit Gargc1d73dc2023-08-24 18:14:20 +053046------
47
Sumit Garg5b32da42022-07-12 12:42:08 +053048starqlte
Sumit Gargc1d73dc2023-08-24 18:14:20 +053049^^^^^^^^
Sumit Garg5b32da42022-07-12 12:42:08 +053050
51The starqltechn is a production board for Samsung S9 (SM-G9600) phone,
52based on the Qualcomm SDM845 SoC.
53
54Steps:
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 Sankouski8e3bdd52022-02-22 21:49:53 +030063
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 Garg5b32da42022-07-12 12:42:08 +053081- gzip u-boot::
82
83 gzip u-boot.bin
84
85- Append dtb to gzipped u-boot::
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030086
Sumit Garg5b32da42022-07-12 12:42:08 +053087 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 Sankouski8e3bdd52022-02-22 21:49:53 +030090
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 Garg5b32da42022-07-12 12:42:08 +053098- Flash image with your phone's flashing method.
Dzmitry Sankouski8e3bdd52022-02-22 21:49:53 +030099
Sumit Garg5b32da42022-07-12 12:42:08 +0530100More information can be found on the `Samsung S9 page`_.
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +0300101
Sumit Garg5b32da42022-07-12 12:42:08 +0530102dragonboard845c
103^^^^^^^^^^^^^^^
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +0300104
Sumit Garg5b32da42022-07-12 12:42:08 +0530105The dragonboard845c is a Qualcomm Robotics RB3 Development Platform, based on
106the Qualcomm SDM845 SoC.
107
108Steps:
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 Gargc1d73dc2023-08-24 18:14:20 +0530158- Flash boot.img using db845c fastboot method:
159
160 .. code-block:: bash
161
162 sudo fastboot flash boot boot.img
Sumit Garg5b32da42022-07-12 12:42:08 +0530163
164More information can be found on the `DragonBoard 845c page`_.
Dzmitry Sankouski4e6df402021-10-17 13:44:32 +0300165
166.. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9
Sumit Garg5b32da42022-07-12 12:42:08 +0530167.. _DragonBoard 845c page: https://www.96boards.org/product/rb3-platform/