blob: 230081e3287f4ce5a0ca544cc782b6117e52b8a8 [file] [log] [blame]
Svyatoslav Ryheldf7c4182024-11-16 14:33:47 +02001.. SPDX-License-Identifier: GPL-2.0+
2
3U-Boot for the Xiaomi Mi Pad tablet
4===================================
5
6``DISCLAMER!`` Moving your Xiaomi Mi Pad to use U-Boot assumes replacement
7of the vendor bootloader. Vendor Android firmwares will no longer be able
8to run on the device. This replacement IS reversible.
9
10Quick Start
11-----------
12
13- Build U-Boot
14- Boot U-Boot
15- Process and flash U-Boot
16- Boot Linux
17- Self Upgrading
18- Chainload configuration
19
20Build U-Boot
21------------
22
23.. code-block:: bash
24
25 $ export CROSS_COMPILE=arm-none-eabi-
26 $ make mocha_defconfig
27 $ make
28
29After the build succeeds, you will obtain the final ``u-boot-dtb-tegra.bin``
30image, ready for booting or further processing.
31
32Boot U-Boot
33-----------
34Existing tegrarcm loader can be used to pre-load U-Boot you have build
35into RAM and basically perform a tethered cold-boot.
36
37.. code-block:: bash
38
39 $ tegrarcm --bct mocha.bct --bootloader u-boot-dtb-tegra.bin --loadaddr 0x80108000
40
41U-Boot will try to load Linux kernel and if fails, it will turn the
42tablet off. While pre-loading U-Boot, hold the ``volume down`` button
43which will trigger the bootmenu.
44
45Process and flash U-Boot
46------------------------
47
48``DISCLAMER!`` All questions related to the re-crypt work should be asked
49in re-crypt repo issues. NOT HERE!
50
51re-crypt is a tool that processes the ``u-boot-dtb-tegra.bin`` binary into
52form usable by device. This process is required only on the first
53installation or to recover the device in case of a failed update.
54
55.. code-block:: bash
56
57 $ git clone https://gitlab.com/grate-driver/re-crypt.git
58 $ cd re-crypt # place your u-boot-dtb-tegra.bin here
59 $ ./re-crypt.py --dev mocha
60
61The script will produce ``bct.img`` and ``ebt.img`` ready to flash.
62
63Permanent installation can be performed by pre-loading just built U-Boot
64into RAM via tegrarcm. While pre-loading U-Boot, hold the ``volume down``
65button which will trigger the bootmenu. There, select ``fastboot`` using
66the volume and power buttons.
67
68After, on host PC, do:
69
70.. code-block:: bash
71
72 $ fastboot flash 0.1 bct.img
73 $ fastboot flash 0.2 ebt.img
74 $ fastboot reboot
75
76Device will reboot.
77
78Boot Linux
79----------
80
81To boot Linux, U-Boot will look for an ``extlinux.conf`` on MicroSD and then on
82eMMC. Additionally, if the ``volume down`` button is pressed while booting, the
83device will enter bootmenu. Bootmenu contains entries to mount MicroSD and eMMC
84as mass storage, fastboot, reboot, reboot RCM, poweroff, enter U-Boot console
85and update bootloader (check the next chapter).
86
87Flashing ``bct.img`` and ``ebt.img`` eliminates vendor restrictions on eMMC and
88allows the user to use/partition it in any way the user desires.
89
90Self Upgrading
91--------------
92
93Place your ``u-boot-dtb-tegra.bin`` on the first partition of the MicroSD card
94and insert it into the tablet. Enter bootmenu, choose update the bootloader
95option with the Power button and U-Boot should update itself. Once the process
96is completed, U-Boot will ask to press any button to reboot.
97
98Chainload configuration
99-----------------------
100
101To build U-Boot without SPL suitable for chainloading adjust mocha_defconfig:
102
103.. code-block::
104
105 CONFIG_TEXT_BASE=0x80A00000
106 CONFIG_SKIP_LOWLEVEL_INIT=y
107 # CONFIG_OF_BOARD_SETUP is not set
Svyatoslav Ryhela41be0f2025-04-15 11:55:28 +0300108 CONFIG_TEGRA_PRAM=y
Svyatoslav Ryheldf7c4182024-11-16 14:33:47 +0200109
110After the build succeeds, you will obtain the final ``u-boot-dtb.bin``
111file, ready for booting using vendor bootloader's fastboot or which can be
112further processed into a flashable image.