luckfox-pico-sdk/sysdrv/source/uboot/u-boot/include/boot_rkimg.h
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

86 lines
2.2 KiB
C

/*
* (C) Copyright 2017 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __BOOT_ROCKCHIP_H_
#define __BOOT_ROCKCHIP_H_
/* This is a copy from Android boot loader */
enum _boot_mode {
BOOT_MODE_NORMAL = 0,
BOOT_MODE_RECOVERY,
BOOT_MODE_BOOTLOADER, /* Android: Fastboot mode */
BOOT_MODE_LOADER, /* Rockchip: Rockusb download mode */
BOOT_MODE_CHARGING,
BOOT_MODE_UMS,
BOOT_MODE_BROM_DOWNLOAD,
BOOT_MODE_PANIC,
BOOT_MODE_WATCHDOG,
BOOT_MODE_DFU,
BOOT_MODE_QUIESCENT,
BOOT_MODE_UNDEFINE,
};
struct bootloader_message {
char command[32];
char status[32];
char recovery[768];
/*
* The 'recovery' field used to be 1024 bytes. It has only ever
* been used to store the recovery command line, so 768 bytes
* should be plenty. We carve off the last 256 bytes to store the
* stage string (for multistage packages) and possible future
* expansion.
*/
char stage[32];
char slot_suffix[32];
char reserved[192];
};
struct rockchip_image {
uint32_t tag;
uint32_t size;
int8_t image[1];
uint32_t crc;
};
#define RK_BLK_SIZE 512
#define TAG_KERNEL 0x4C4E524B
#define BCB_MESSAGE_BLK_OFFSET (16 * 1024 >> 9)
#define PART_UBOOT "uboot"
#define PART_TRUST "trust"
#define PART_MISC "misc"
#define PART_RESOURCE "resource"
#define PART_KERNEL "kernel"
#define PART_BOOT "boot"
#define PART_VENDOR_BOOT "vendor_boot"
#define PART_RECOVERY "recovery"
#define PART_DTBO "dtbo"
#define PART_LOGO "logo"
#define PART_ROOTFS "rootfs"
#define PART_SYSTEM "system"
#define PART_METADATA "metadata"
#define PART_USERDATA "userdata"
#define PART_META "meta"
struct blk_desc *rockchip_get_bootdev(void);
void rockchip_set_bootdev(struct blk_desc *desc);
void board_run_recovery_wipe_data(void);
void setup_download_mode(void);
int get_bcb_recovery_msg(void);
int rockchip_read_dtb_file(void *fdt_addr);
int rockchip_ram_read_dtb_file(void *img, void *fdt_addr);
int init_kernel_dtb(void);
int fit_write_trusty_rollback_index(u32 trusty_index);
int arch_fpga_init(void);
#ifndef CONFIG_SPL_BUILD
int rockchip_get_boot_mode(void);
#else
int rockchip_get_boot_mode(struct blk_desc *dev_desc, u32 bcb_sector_offset);
#endif
#endif