/* * Copyright (c) 2020 by UNISOC Technology(Shanghai), Inc. ALL RIGHTS RESERVED. * * These coded instructions, statements, and computer programs are the * copyrighted works and confidential proprietary information of * UNISOC Technology(Shanghai), Inc. They may not be modified, copied, reproduced, * distributed, or disclosed to third parties in any manner, medium, or form, * in whole or in part, without the prior written consent of UNISOC Technology(Shanghai), Inc. */ #include #ifndef _UNISOC_BOOT_IMAGE_H_ #define _UNISOC_BOOT_IMAGE_H_ #define UNISOC_BOOT_MAGIC "UNISOCBOOTIMAGE!" #define UNISOC_BOOT_MAGIC_SIZE 16 struct unioc_boot_img_hdr { uint8_t magic[UNISOC_BOOT_MAGIC_SIZE]; uint32_t kernel_size; /* size in bytes */ uint32_t kernel_addr; /* physical load addr */ uint32_t ramdisk_size; /* size in bytes */ uint32_t ramdisk_addr; /* physical load addr */ uint32_t page_size; /* flash page size we assume */ uint32_t dt_size; /* device tree in bytes */ uint32_t unused; /* future expansion: should be 0 */ } __attribute__((packed)); /* ** +-----------------+ ** | header | 1 page ** +-----------------+ ** | kernel | n pages ** +-----------------+ ** | ramdisk | m pages ** +-----------------+ ** | device tree | p pages ** +-----------------+ ** ** n = (kernel_size + page_size - 1) / page_size ** m = (ramdisk_size + page_size - 1) / page_size ** p = (dt_size + page_size - 1) / page_size ** ** 0. all entities are page_size aligned in flash ** 1. kernel and ramdisk are required (size != 0) ** 2. load each element (kernel, ramdisk, second) at ** the specified physical address (kernel_addr, etc) */ #endif