Skip to content

Commit 5a85dcd

Browse files
Update Documentation.md
Add sample workflow for creation and deployment of FIT image for QLI based Boards. Signed-off-by: Kaushal Kumar <[email protected]>
1 parent 6b9e4b9 commit 5a85dcd

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Documentation.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,64 @@ 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-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+
mkdir -p fit_image/arch/arm64/boot/dts/qcom/
448+
cp -rap kobj/arch/arm64/boot/dts/qcom/*.dtb* fit_image/arch/arm64/boot/dts/qcom/
449+
450+
# Compile qcom-metadata.dts into qcom-metadata.dtb
451+
cd fit_image
452+
dtc -I dts -O dtb -o qcom-metadata.dtb qcom-metadata.dts
453+
454+
# Generate qclinux_fit.img from qcom-fitimage.its
455+
# Name of .img file has to be qclinux_fit.img since this name is hardcoded in UEFI code.
456+
# Naming convention used in UEFI code:
457+
#define FIT_BINARY_FILE L"\\qclinux_fit.img"
458+
#define COMBINED_DTB_FILE L"\\combined-dtb.dtb"
459+
#define SECONDARY_DTB_FILE L"\\secondary-dtb.dtb"
460+
# "-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.
461+
# "-B 8" flag enforces 8‑byte alignment for the image since 8-byte alignment is normally recommended as per standards.
462+
mkdir out
463+
mkimage -f qcom-fitimage.its out/qclinux_fit.img -E -B 8
464+
465+
# Pack qclinux_fit.img into fitimage.bin. This fitimage.bin shall be flashed onto dtb_a partition of the board.
466+
cd ..
467+
git clone [email protected]:qualcomm-linux/kmake-image.git
468+
cd kmake-image
469+
sudo chmod +x generate_boot_bins.sh
470+
./generate_boot_bins.sh bin --input ../fit_image/out/ --output ../fitimage.bin
471+
472+
# Steps to inspect the generated FIT image
473+
cd ..
474+
git clone https://github.com/PabloCastellano/extract-dtb.git
475+
# Create the "/dtb" folder containing each of the dtb/dtbo
476+
./extract-dtb/extract_dtb/extract_dtb.py fitimage.bin
477+
# To verify the ITS DTB contents
478+
fdtdump dtb/01_dtbdump_%i2\{.dtb
479+
# To verify the metadata DTB contents
480+
fdtdump dtb/02_dtbdump_Image_with_compressed_metadata_blob.dtb
481+
482+
# Flash the generated fitimage.bin into dtb_a partition
483+
fastboot flash dtb_a fitimage.bin
426484
```
427485
---
428486

0 commit comments

Comments
 (0)