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