summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-06-21 11:27:53 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-21 13:11:57 +0200
commit484cde18daf38c981c01800448ba84050a17f710 (patch)
tree73e7015f4eb3f353267bdc9123aabdbd499651cb
parent6f70a240a9d49228ad27f3dd020db4d25537113d (diff)
downloadbarebox-484cde18daf38c981c01800448ba84050a17f710.tar.gz
barebox-484cde18daf38c981c01800448ba84050a17f710.tar.xz
filetype: Add Rockchip boot image type
Newer Rockchip SoCs boot images starting with the magic "RKNS". There are older image formats currently not supported, this one is at least supported on the RK3568. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210615141641.31577-4-s.hauer@pengutronix.de Link: https://lore.barebox.org/20210621092802.27275-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/filetype.c3
-rw-r--r--include/filetype.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 0cae00abaa..9edebb2cd8 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -73,6 +73,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_stm32_image_v1] = { "STM32 image (v1)", "stm32-image-v1" },
[filetype_zynq_image] = { "Zynq image", "zynq-image" },
[filetype_mxs_sd_image] = { "i.MX23/28 SD card image", "mxs-sd-image" },
+ [filetype_rockchip_rkns_image] = { "Rockchip boot image", "rk-image" },
};
const char *file_type_to_string(enum filetype f)
@@ -309,6 +310,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
return filetype_riscv_linux_image;
if (le32_to_cpu(buf[14]) == 0x56435352 && !memcmp(&buf[12], "barebox", 8))
return filetype_riscv_barebox_image;
+ if (strncmp(buf8, "RKNS", 4) == 0)
+ return filetype_rockchip_rkns_image;
if ((buf8[0] == 0x5a || buf8[0] == 0x69 || buf8[0] == 0x78 ||
buf8[0] == 0x8b || buf8[0] == 0x9c) &&
buf8[0x1] == 0 && buf8[0x2] == 0 && buf8[0x3] == 0 &&
diff --git a/include/filetype.h b/include/filetype.h
index fd339f9564..4d4481effd 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -54,6 +54,7 @@ enum filetype {
filetype_stm32_image_v1,
filetype_zynq_image,
filetype_mxs_sd_image,
+ filetype_rockchip_rkns_image,
filetype_max,
};