Skip to content

Commit 5e341a5

Browse files
Merge pull request #27 from qualcomm-linux/quic-kaushalk-patch-10
Update Documentation.md
2 parents 6b9e4b9 + 53eeef9 commit 5e341a5

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

Documentation.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,70 @@ fastboot erase dtb_a && fastboot erase dtb_b &&
423423
fastboot flash dtb_a dtb.bin &&
424424
fastboot flash dtb_b dtb.bin
425425

426+
```
427+
428+
**Sample Workflow for Creation of FIT image for QLI based Boards**
429+
430+
UEFI firmware looks for the DTB image flashed in dtb_a partition via dtb.bin. If dtb.bin has "qclinux_fit.img", UEFI firmware proceeds with FIT based DT selection. If dtb.bin has "combined-dtb.dtb", it proceeds with legacy DT selection mechanism based on msm-id, board-id which are part of DT files itself.
431+
432+
For the FIT based DT selection, "qclinux_fit.img" contains qcom-fitimage.its along with all dtb/dtbo appended to it. The size and offset of each of the appended dtb/dtbo are part of generated FIT image.
433+
434+
For the Legacy DT selection, "combined-dtb.dtb" contains all dtb packed.
435+
Script based creation of FIT image can be achieved using kmake-image/make_fitimage.sh at main · qualcomm-linux/kmake-image.
436+
437+
For the manual creation of FIT image, steps are given below.
438+
```sh
439+
# Install the necessary tools:
440+
sudo apt-get install device-tree-compiler u-boot-tools mtools
441+
# Clone the qcom-dtb-metadata project
442+
git clone [email protected]:qualcomm-linux/qcom-dtb-metadata.git
443+
mkdir fit_image
444+
cp -rap qcom-dtb-metadata/qcom-fitimage.its qcom-dtb-metadata/qcom-next-fitimage.its qcom-dtb-metadata/qcom-metadata.dts fit_image/
445+
446+
# Copy the dtb/dtbo files from the kernel tree to the fit_image directory. For steps on cloning and building the Qualcomm Linux Kernel Tree, pls refer https://github.com/qualcomm-linux/kmake-image/blob/main/README.md.
447+
# Checkout and build Qualcomm Linux Kernel : main branch, if you need dtb/dtbo from upstream kernel (https://github.com/qualcomm-linux/kernel/tree/main)
448+
# Checkout and build Qualcomm Linux Kernel : qcom-next branch, if you need dtb/dtbo from qcom-next kernel (https://github.com/qualcomm-linux/kernel/tree/qcom-next).
449+
mkdir -p fit_image/arch/arm64/boot/dts/qcom/
450+
# Copy the compiled *dtb* files from the kernel's kobj directory into your fit_image directory
451+
cp -rap kobj/arch/arm64/boot/dts/qcom/*.dtb* fit_image/arch/arm64/boot/dts/qcom/
452+
453+
# Compile qcom-metadata.dts into qcom-metadata.dtb
454+
cd fit_image
455+
dtc -I dts -O dtb -o qcom-metadata.dtb qcom-metadata.dts
456+
457+
# Generate qclinux_fit.img from qcom-fitimage.its (or qcom-next-fitimage.its)
458+
# Name of .img file has to be qclinux_fit.img since this name is hardcoded in UEFI code.
459+
# Naming convention used in UEFI code:
460+
#define FIT_BINARY_FILE L"\\qclinux_fit.img"
461+
#define COMBINED_DTB_FILE L"\\combined-dtb.dtb"
462+
#define SECONDARY_DTB_FILE L"\\secondary-dtb.dtb"
463+
# "-E" flag places binary data outside the FIT structure. However, since /incbin/ is used in the .its file, all binaries are appended into the same image. The FIT structure contains the offset and size for each appended binary.
464+
# "-B 8" flag enforces 8‑byte alignment for the image since 8-byte alignment is normally recommended as per standards.
465+
mkdir out
466+
# For kernel main branch based FIT image creation
467+
mkimage -f qcom-fitimage.its out/qclinux_fit.img -E -B 8
468+
# For kernel qcom-next branch based FIT image creation
469+
mkimage -f qcom-next-fitimage.its out/qclinux_fit.img -E -B 8
470+
471+
# Pack qclinux_fit.img into fitimage.bin. This fitimage.bin shall be flashed onto dtb_a partition of the board.
472+
cd ..
473+
git clone [email protected]:qualcomm-linux/kmake-image.git
474+
cd kmake-image
475+
sudo chmod +x generate_boot_bins.sh
476+
./generate_boot_bins.sh bin --input ../fit_image/out/ --output ../fitimage.bin
477+
478+
# Steps to inspect the generated FIT image
479+
cd ..
480+
git clone https://github.com/PabloCastellano/extract-dtb.git
481+
# Create the "/dtb" folder containing each of the dtb/dtbo
482+
./extract-dtb/extract_dtb/extract_dtb.py fitimage.bin
483+
# To verify the ITS DTB contents
484+
fdtdump dtb/01_dtbdump_%i2\{.dtb
485+
# To verify the metadata DTB contents
486+
fdtdump dtb/02_dtbdump_Image_with_compressed_metadata_blob.dtb
487+
488+
# Flash the generated fitimage.bin into dtb_a partition
489+
fastboot flash dtb_a fitimage.bin
426490
```
427491
---
428492

0 commit comments

Comments
 (0)