Svyatoslav Ryhel | df7c418 | 2024-11-16 14:33:47 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | U-Boot for the Xiaomi Mi Pad tablet |
| 4 | =================================== |
| 5 | |
| 6 | ``DISCLAMER!`` Moving your Xiaomi Mi Pad to use U-Boot assumes replacement |
| 7 | of the vendor bootloader. Vendor Android firmwares will no longer be able |
| 8 | to run on the device. This replacement IS reversible. |
| 9 | |
| 10 | Quick 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 | |
| 20 | Build U-Boot |
| 21 | ------------ |
| 22 | |
| 23 | .. code-block:: bash |
| 24 | |
| 25 | $ export CROSS_COMPILE=arm-none-eabi- |
| 26 | $ make mocha_defconfig |
| 27 | $ make |
| 28 | |
| 29 | After the build succeeds, you will obtain the final ``u-boot-dtb-tegra.bin`` |
| 30 | image, ready for booting or further processing. |
| 31 | |
| 32 | Boot U-Boot |
| 33 | ----------- |
| 34 | Existing tegrarcm loader can be used to pre-load U-Boot you have build |
| 35 | into 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 | |
| 41 | U-Boot will try to load Linux kernel and if fails, it will turn the |
| 42 | tablet off. While pre-loading U-Boot, hold the ``volume down`` button |
| 43 | which will trigger the bootmenu. |
| 44 | |
| 45 | Process and flash U-Boot |
| 46 | ------------------------ |
| 47 | |
| 48 | ``DISCLAMER!`` All questions related to the re-crypt work should be asked |
| 49 | in re-crypt repo issues. NOT HERE! |
| 50 | |
| 51 | re-crypt is a tool that processes the ``u-boot-dtb-tegra.bin`` binary into |
| 52 | form usable by device. This process is required only on the first |
| 53 | installation 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 | |
| 61 | The script will produce ``bct.img`` and ``ebt.img`` ready to flash. |
| 62 | |
| 63 | Permanent installation can be performed by pre-loading just built U-Boot |
| 64 | into RAM via tegrarcm. While pre-loading U-Boot, hold the ``volume down`` |
| 65 | button which will trigger the bootmenu. There, select ``fastboot`` using |
| 66 | the volume and power buttons. |
| 67 | |
| 68 | After, 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 | |
| 76 | Device will reboot. |
| 77 | |
| 78 | Boot Linux |
| 79 | ---------- |
| 80 | |
| 81 | To boot Linux, U-Boot will look for an ``extlinux.conf`` on MicroSD and then on |
| 82 | eMMC. Additionally, if the ``volume down`` button is pressed while booting, the |
| 83 | device will enter bootmenu. Bootmenu contains entries to mount MicroSD and eMMC |
| 84 | as mass storage, fastboot, reboot, reboot RCM, poweroff, enter U-Boot console |
| 85 | and update bootloader (check the next chapter). |
| 86 | |
| 87 | Flashing ``bct.img`` and ``ebt.img`` eliminates vendor restrictions on eMMC and |
| 88 | allows the user to use/partition it in any way the user desires. |
| 89 | |
| 90 | Self Upgrading |
| 91 | -------------- |
| 92 | |
| 93 | Place your ``u-boot-dtb-tegra.bin`` on the first partition of the MicroSD card |
| 94 | and insert it into the tablet. Enter bootmenu, choose update the bootloader |
| 95 | option with the Power button and U-Boot should update itself. Once the process |
| 96 | is completed, U-Boot will ask to press any button to reboot. |
| 97 | |
| 98 | Chainload configuration |
| 99 | ----------------------- |
| 100 | |
| 101 | To 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 |
| 108 | CONFIG_TEGRA_SUPPORT_NON_SECURE=y |
| 109 | |
| 110 | After the build succeeds, you will obtain the final ``u-boot-dtb.bin`` |
| 111 | file, ready for booting using vendor bootloader's fastboot or which can be |
| 112 | further processed into a flashable image. |