|
|
|
Caleb is currently in integration hell (preparing to upstream) so please bare with!
|
|
|
|
|
|
|
|
Main feature branch is [`caleb/rbx-demo-cleanup`](https://git.codelinaro.org/linaro/qcomlt/u-boot/-/tree/caleb/rbx-demo-cleanup), clone U-Boot and check out that branch.
|
|
|
|
|
|
|
|
This is (roughly) the make wrapper I use to build U-Boot and wrap it up into the boot.img format for ABL. U-Boot includes it's own DT but we don't want to use that because it won't be seen by ABL. Instead we append the DTB to the gzipped U-Boot binary (just like with Linux) so that ABL will populate board specific bits like the memory node. This is in contrast to current dragonboard documentation in U-Boot which did rely on hardcoding everything.
|
|
|
|
|
|
|
|
Drop these somewhere and source them.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
KERNEL_OUTDIR=.output
|
|
|
|
|
|
|
|
# Make wrapper
|
|
|
|
mu() {
|
|
|
|
make O=$KERNEL_OUTDIR CROSS_COMPILE=aarch64-linux-gnu- -j"$(nproc --all)" $@
|
|
|
|
}
|
|
|
|
|
|
|
|
# Make and generate boot image wrapper
|
|
|
|
budt() {
|
|
|
|
mu || return 1
|
|
|
|
rm "$KERNEL_OUTDIR"/u-boot-nodtb.bin.gz 2>/dev/null || true
|
|
|
|
gzip "$KERNEL_OUTDIR"/u-boot-nodtb.bin
|
|
|
|
rm -f /tmp/dt.dtb
|
|
|
|
for DT in "$@"; do
|
|
|
|
cat "$KERNEL_OUTDIR"/arch/arm/dts/"$DT".dtb >> /tmp/dt.dtb
|
|
|
|
done
|
|
|
|
|
|
|
|
mkbootimg --base '0x00000000' \
|
|
|
|
--kernel_offset '0x00008000' \
|
|
|
|
--ramdisk_offset '0x01000000' \
|
|
|
|
--tags_offset '0x00000100' \
|
|
|
|
--pagesize '4096' \
|
|
|
|
--kernel /tmp/kernel-dtb -o '/tmp/u-boot.img'
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Now we can build U-Boot and boot it.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
mu rbx_defconfig
|
|
|
|
budt dragonboard845c
|
|
|
|
fastboot boot /tmp/u-boot.img
|
|
|
|
```
|
|
|
|
|
|
|
|
This will work on RB1/2/3/5 with their respective DTBs specified. From my testing, RB3 and 5 have "good enough" DTB selection in ABL so that a single image can work on both, demonstrated below by appending both DTBs.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
budt rb1
|
|
|
|
budt rb2
|
|
|
|
budt dragonboard845c rb5
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configuring
|
|
|
|
|
|
|
|
The default environment will scan UFS, sdcard, and USB, it will boot the first EFI bootloader it can find (a binary at patch `/EFI/Boot/bootaa64.efi` on the partition). This uses a feature called [standard boot](https://u-boot.readthedocs.io/en/latest/develop/bootstd.html). To boot a boot.img file it would be necessary to enable support for decoding Android boot images in U-Boot (some config option), and then adding a "bootmeth" which would discover the boot.img file at some well known path, unpack it and boot it. (see `boot/bootmeth_efi.c` as an example).
|
|
|
|
|
|
|
|
The environment can be adjusted in `include/configs/qcom-common.h`.
|
|
|
|
|
|
|
|
## Debugging
|
|
|
|
|
|
|
|
If necessary, open `configs/rbx_defconfig` and at the bottom enable `CONFIG_DEBUG_UART` and ensure that `CONFIG_DEBUG_UART_CLOCK=7372800` is set. The loglevel can also be adjusted, and U-Boot will print logs pre-relocation + device discovery logs. This can be a little verbose so a good alternative is to add `#define LOG_DEBUG` to the top of the files you want to debug. |
|
|
|
\ No newline at end of file |