Last active
August 4, 2021 07:45
-
-
Save Informatic/2c1e14f4e326681b3df156dc3d403128 to your computer and use it in GitHub Desktop.
Example FIT image descriptor & buildroot post-image hook / https://blog.inf.re/buildroot-cheatsheet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/dts-v1/; | |
/ { | |
description = "Example FIT image"; | |
#address-cells = <1>; | |
images { | |
kernel@1 { | |
description = "default kernel"; | |
data = /incbin/("./zImage"); | |
type = "kernel"; | |
arch = "arm"; | |
os = "linux"; | |
compression = "none"; | |
load = <0x42000000>; | |
entry = <0x42000000>; | |
hash@1 { | |
algo = "sha1"; | |
}; | |
}; | |
ramdisk@1 { | |
description = "rootfs"; | |
data = /incbin/("./rootfs.cpio.gz"); | |
type = "ramdisk"; | |
arch = "arm"; | |
os = "linux"; | |
compression = "gzip"; | |
load = <00000000>; | |
entry = <00000000>; | |
hash@1 { | |
algo = "sha1"; | |
}; | |
}; | |
fdt@1 { | |
description = "device tree"; | |
data = /incbin/("./sun8i-h2-plus-orangepi-zero.dtb"); | |
type = "flat_dt"; | |
arch = "arm"; | |
compression = "none"; | |
hash@1 { | |
algo = "sha1"; | |
}; | |
}; | |
}; | |
configurations { | |
default = "config@1"; | |
config@1 { | |
description = "default configuration"; | |
kernel = "kernel@1"; | |
ramdisk = "ramdisk@1"; | |
fdt = "fdt@1"; | |
}; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# post-image.sh - build full .itb image | |
set -e | |
BOARD_DIR="$( dirname "${0}" )" | |
MKIMAGE="${HOST_DIR}/bin/mkimage" | |
IMAGE_ITS="image.its" | |
OUTPUT_NAME="image.itb" | |
# We have to copy .its file over to images/ for /incbin/ to work | |
cp "${BOARD_DIR}/${IMAGE_ITS}" "${BINARIES_DIR}" | |
cd "${BINARIES_DIR}" | |
# This will create ${BINARIES_DIR}/${OUTPUT_NAME} FIT image | |
"${MKIMAGE}" -f ${IMAGE_ITS} ${OUTPUT_NAME} | |
rm ${IMAGE_ITS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment