blob: d3f218e835e0ee29a8855dbad4664bfae1bc0d1e [file] [log] [blame]
Dzmitry Sankouski80565ec2021-10-17 13:44:32 +03001.. SPDX-License-Identifier: GPL-2.0+
2.. sectionauthor:: Dzmitry Sankouski <dsankouski@gmail.com>
3
4Snapdragon 845
5================
6
7About this
8----------
9This document describes the information about Qualcomm Snapdragon 845
10supported boards and it's usage steps.
11
12SDM845 - hi-end qualcomm chip, introduced in late 2017.
13Mostly used in flagship phones and tablets of 2018.
14
Bhupesh Sharma20cbfd62023-04-20 16:58:48 +053015The current boot flow support loading u-boot as an Android boot image via
16Qualcomm's UEFI-based ABL (Android) Bootloader.
Dzmitry Sankouski80565ec2021-10-17 13:44:32 +030017
18Installation
19------------
Dzmitry Sankouskif8a1b332022-02-22 21:49:53 +030020Build
21^^^^^
22Setup ``CROSS_COMPILE`` for aarch64 and build U-Boot for your board::
Dzmitry Sankouski80565ec2021-10-17 13:44:32 +030023
24 $ export CROSS_COMPILE=<aarch64 toolchain prefix>
25 $ make <your board name here, see Boards section>_defconfig
26 $ make
27
28This will build ``u-boot.bin`` in the configured output directory.
29
Dzmitry Sankouskif8a1b332022-02-22 21:49:53 +030030Generate FIT image
31^^^^^^^^^^^^^^^^^^
32See doc/uImage.FIT for more details
33
34Pack android boot image
35^^^^^^^^^^^^^^^^^^^^^^^
36We'll assemble android boot image with ``u-boot.bin`` instead of linux kernel,
37and FIT image instead of ``initramfs``. Android bootloader expect gzipped kernel
Sumit Gargd35b2112022-07-12 12:42:08 +053038with appended dtb, so let's mimic linux to satisfy stock bootloader.
Dzmitry Sankouskif8a1b332022-02-22 21:49:53 +030039
Sumit Gargd35b2112022-07-12 12:42:08 +053040Boards
Sumit Garg96c4fec2023-08-24 18:14:20 +053041------
42
Sumit Gargd35b2112022-07-12 12:42:08 +053043starqlte
Sumit Garg96c4fec2023-08-24 18:14:20 +053044^^^^^^^^
Sumit Gargd35b2112022-07-12 12:42:08 +053045
46The starqltechn is a production board for Samsung S9 (SM-G9600) phone,
47based on the Qualcomm SDM845 SoC.
48
49Steps:
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 Sankouskif8a1b332022-02-22 21:49:53 +030058
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 Gargd35b2112022-07-12 12:42:08 +053076- gzip u-boot::
Dzmitry Sankouskif8a1b332022-02-22 21:49:53 +030077
Sumit Gargd35b2112022-07-12 12:42:08 +053078 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 Sankouskif8a1b332022-02-22 21:49:53 +030085
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 Gargd35b2112022-07-12 12:42:08 +053093- Flash image with your phone's flashing method.
Dzmitry Sankouski80565ec2021-10-17 13:44:32 +030094
95More information can be found on the `Samsung S9 page`_.
96
Sumit Gargd35b2112022-07-12 12:42:08 +053097dragonboard845c
98^^^^^^^^^^^^^^^
99
100The dragonboard845c is a Qualcomm Robotics RB3 Development Platform, based on
101the Qualcomm SDM845 SoC.
102
103Steps:
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 Garg96c4fec2023-08-24 18:14:20 +0530153- Flash boot.img using db845c fastboot method:
154
155 .. code-block:: bash
156
157 sudo fastboot flash boot boot.img
Sumit Gargd35b2112022-07-12 12:42:08 +0530158
159More information can be found on the `DragonBoard 845c page`_.
160
Dzmitry Sankouski80565ec2021-10-17 13:44:32 +0300161.. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9
Sumit Gargd35b2112022-07-12 12:42:08 +0530162.. _DragonBoard 845c page: https://www.96boards.org/product/rb3-platform/