Skip to content

Instantly share code, notes, and snippets.

@Informatic
Last active August 4, 2021 07:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Informatic/2c1e14f4e326681b3df156dc3d403128 to your computer and use it in GitHub Desktop.
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
/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";
};
};
};
#!/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