1.. SPDX-License-Identifier: GPL-2.0+
2.. sectionauthor:: Dzmitry Sankouski <dsankouski@gmail.com>
3
4Qualcomm generic boards
5=======================
6
7About this
8----------
9This document describes how to build and run U-Boot for Qualcomm generic
10boards. Right now the generic target supports the Snapdragon 845 SoC, however
11it's expected to support more SoCs going forward.
12
13SDM845 - high-end qualcomm chip, introduced in late 2017.
14Mostly used in flagship phones and tablets of 2018.
15
16The current boot flow support loading u-boot as an Android boot image via
17Qualcomm's UEFI-based ABL (Android) Bootloader. The DTB used by U-Boot will
18be appended to the U-Boot image the same way as when booting Linux. U-Boot
19will then retrieve the DTB during init. This way the memory layout and KASLR
20offset will be populated by ABL.
21
22Installation
23------------
24Build
25^^^^^
26
27	$ ./tools/buildman/buildman -o .output qcom
28
29This will build ``.output/u-boot-nodtb.bin`` using the ``qcom_defconfig``.
30
31Generate FIT image (optional)
32^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33See doc/uImage.FIT for more details
34
35Pack android boot image
36^^^^^^^^^^^^^^^^^^^^^^^
37We'll assemble android boot image with ``u-boot-nodtb.bin`` instead of linux kernel,
38and FIT image instead of ``initramfs``. Android bootloader expect gzipped kernel
39with appended dtb, so let's mimic linux to satisfy stock bootloader.
40
41Boards
42------
43
44starqlte
45^^^^^^^^
46
47The starqltechn is a production board for Samsung S9 (SM-G9600) phone,
48based on the Qualcomm SDM845 SoC.
49
50This device is supported by the common qcom_defconfig.
51
52The DTB is called "sdm845-samsung-starqltechn.dtb"
53
54More information can be found on the `Samsung S9 page`_.
55
56dragonboard845c
57^^^^^^^^^^^^^^^
58
59The dragonboard845c is a Qualcomm Robotics RB3 Development Platform, based on
60the Qualcomm SDM845 SoC.
61
62This device is supported by the common qcom_defconfig
63
64The DTB is called "sdm845-db845c.dtb"
65
66More information can be found on the `DragonBoard 845c page`_.
67
68qcs404-evb
69^^^^^^^^^^
70
71The QCS404 EvB is a Qualcomm Development Platform, based on the Qualcomm QCS404 SoC.
72
73This device is supported by the common qcom_defconfig
74
75The DTB is called "qcs404-evb-4000.dtb"
76
77Building steps
78--------------
79
80Steps:
81
82- Build u-boot
83
84As above::
85
86	./tools/buildman/buildman -o .output qcom
87
88Or for db410c (and other boards not supported by the generic target)::
89
90	make CROSS_COMPILE=aarch64-linux-gnu- O=.output dragonboard410c_defconfig
91	make O=.output -j$(nproc)
92
93- gzip u-boot::
94
95	gzip u-boot-nodtb.bin
96
97- Append dtb to gzipped u-boot::
98
99	cat u-boot-nodtb.bin.gz arch/arm/dts/your-board.dtb > u-boot-nodtb.bin.gz-dtb
100
101- If you chose to build a FIT image, A ``qcom.its`` file can be found in ``board/qualcomm/generic/``
102  directory. It expects a folder as ``qcom_imgs/`` in the main directory containing pre-built kernel,
103  dts and ramdisk images. See ``qcom.its`` for full path to images::
104
105	mkimage -f qcom.its qcom.itb
106
107- Now we've got everything to build android boot image::
108
109	mkbootimg --kernel u-boot-nodtb.bin.gz-dtb --ramdisk db845c.itb \
110	--output boot.img --pagesize 4096 --base 0x80000000
111
112Or with no FIT image::
113
114	mkbootimg --kernel u-boot-nodtb.bin.gz-dtb \
115	--output boot.img --pagesize 4096 --base 0x80000000
116
117- Flash boot.img using fastboot and erase dtbo to avoid conflicts with our DTB:
118
119  .. code-block:: bash
120
121	fastboot flash boot boot.img
122	fastboot erase dtbo
123
124.. _Samsung S9 page: https://en.wikipedia.org/wiki/Samsung_Galaxy_S9
125.. _DragonBoard 845c page: https://www.96boards.org/product/rb3-platform/
126