return 0;
}
-/**
- * android_image_check_header() - Check the magic of boot image
- *
- * This checks the header of Android boot image and verifies the
- * magic is "ANDROID!"
- *
- * @hdr: Pointer to boot image
- * Return: 0 if the magic is correct, non-zero if there is a magic mismatch
- */
-int android_image_check_header(const struct andr_boot_img_hdr_v0 *hdr)
+bool is_android_boot_image_header(const struct andr_boot_img_hdr_v0 *hdr)
{
- return memcmp(ANDR_BOOT_MAGIC, hdr->magic, ANDR_BOOT_MAGIC_SIZE);
+ return !memcmp(ANDR_BOOT_MAGIC, hdr, ANDR_BOOT_MAGIC_SIZE);
}
ulong android_image_get_end(const struct andr_boot_img_hdr_v0 *hdr)
bool ret = true;
hdr = map_sysmem(hdr_addr, sizeof(*hdr));
- if (android_image_check_header(hdr)) {
+ if (!is_android_boot_image_header(hdr)) {
printf("Error: Boot Image header is incorrect\n");
ret = false;
goto exit;
bool ret = true;
hdr = map_sysmem(hdr_addr, sizeof(*hdr));
- if (android_image_check_header(hdr)) {
+ if (!is_android_boot_image_header(hdr)) {
printf("Error: Boot Image header is incorrect\n");
ret = false;
goto exit;
return IMAGE_FORMAT_FIT;
}
if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE) &&
- !android_image_check_header(img_addr))
+ is_android_boot_image_header(img_addr))
return IMAGE_FORMAT_ANDROID;
return IMAGE_FORMAT_INVALID;
return CMD_RET_USAGE;
hdr = map_sysmem(abootimg_addr(), sizeof(*hdr));
- if (android_image_check_header(hdr)) {
+ if (!is_android_boot_image_header(hdr)) {
printf("Error: Boot Image header is incorrect\n");
res = CMD_RET_FAILURE;
goto exit;
return CMD_RET_USAGE;
hdr = map_sysmem(abootimg_addr(), sizeof(*hdr));
- if (android_image_check_header(hdr)) {
+ if (!is_android_boot_image_header(hdr)) {
printf("Error: Boot Image header is incorrect\n");
res = CMD_RET_FAILURE;
goto exit;
}
/* Check boot header magic string */
- res = android_image_check_header(hdr);
- if (res != 0) {
+ if (!is_android_boot_image_header(hdr)) {
pr_err("bad boot image magic\n");
fastboot_fail("boot partition not initialized", response);
return 0;
struct andr_boot_img_hdr_v0;
-/**
- * android_image_check_header() - Check the magic of boot image
- *
- * This checks the header of Android boot image and verifies the
- * magic is "ANDROID!"
- *
- * @hdr: Pointer to image header
- * Return: 0 if the magic is correct, non-zero if there is a magic mismatch
- */
-int android_image_check_header(const struct andr_boot_img_hdr_v0 *hdr);
-
/**
* android_image_get_kernel() - Processes kernel part of Android boot images
*
void android_print_contents(const struct andr_boot_img_hdr_v0 *hdr);
bool android_image_print_dtb_contents(ulong hdr_addr);
+/**
+ * is_android_boot_image_header() - Check the magic of boot image
+ *
+ * This checks the header of Android boot image and verifies the
+ * magic is "ANDROID!"
+ *
+ * @hdr: Pointer to boot image
+ * Return: non-zero if the magic is correct, zero otherwise
+ */
+bool is_android_boot_image_header(const struct andr_boot_img_hdr_v0 *hdr);
+
/**
* board_fit_config_name_match() - Check for a matching board name
*