sun60iw2: load BPI-M8 logo from Armbian bootfs
This commit is contained in:
parent
27760ba44e
commit
f5a03ef7f7
@ -52,6 +52,7 @@
|
||||
|
||||
platform:platform@45000004 {
|
||||
device_type = "platform";
|
||||
dragonboard_test = <0>;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <linux/list.h>
|
||||
#include <video.h>
|
||||
#include <command.h>
|
||||
#include <fs.h>
|
||||
#include <drm/drm_modes.h>
|
||||
#include <drm/drm_connector.h>
|
||||
#include <drm/drm_logo.h>
|
||||
@ -45,6 +46,85 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static int armbian_unload_file(struct file_info_t *file)
|
||||
{
|
||||
if (!file)
|
||||
return -1;
|
||||
|
||||
free(file->name);
|
||||
free(file->path);
|
||||
free(file->file_addr);
|
||||
free(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int armbian_print_file_info(struct file_info_t *file)
|
||||
{
|
||||
if (!file)
|
||||
return -1;
|
||||
|
||||
pr_err("File name:%s\n", file->name);
|
||||
pr_err("Partition name:%s\n", file->path);
|
||||
pr_err("File size:%u\n", file->file_size);
|
||||
pr_err("File addr:%p\n", file->file_addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_info_t *load_armbian_boot_logo(const char *name)
|
||||
{
|
||||
loff_t file_size, read_size;
|
||||
struct file_info_t *file;
|
||||
|
||||
if (!name || fs_set_blk_dev("mmc", "0:1", FS_TYPE_FAT))
|
||||
return NULL;
|
||||
|
||||
if (!fs_exists(name))
|
||||
return NULL;
|
||||
|
||||
if (fs_size(name, &file_size) || !file_size)
|
||||
return NULL;
|
||||
|
||||
file = malloc(sizeof(*file));
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
memset(file, 0, sizeof(*file));
|
||||
file->file_size = (unsigned int)file_size;
|
||||
file->name = malloc(strlen(name) + 1);
|
||||
file->path = malloc(strlen("mmc0:1") + 1);
|
||||
file->file_addr = memalign(4096, file->file_size);
|
||||
if (!file->name || !file->path || !file->file_addr)
|
||||
goto err_free;
|
||||
|
||||
strncpy(file->name, name, strlen(name) + 1);
|
||||
strncpy(file->path, "mmc0:1", strlen("mmc0:1") + 1);
|
||||
|
||||
if (fs_read(name, (ulong)file->file_addr, 0, 0, &read_size) ||
|
||||
read_size != file_size)
|
||||
goto err_free;
|
||||
|
||||
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
|
||||
flush_dcache_range((ulong)file->file_addr,
|
||||
ALIGN((ulong)(file->file_addr + file->file_size),
|
||||
CONFIG_SYS_CACHELINE_SIZE));
|
||||
#endif
|
||||
|
||||
file->unload_file = armbian_unload_file;
|
||||
file->print_file_info = armbian_print_file_info;
|
||||
|
||||
return file;
|
||||
|
||||
err_free:
|
||||
free(file->name);
|
||||
free(file->path);
|
||||
free(file->file_addr);
|
||||
free(file);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int check_drm_debug_mode(void)
|
||||
{
|
||||
int debug_mode;
|
||||
@ -825,10 +905,17 @@ static int load_bmp_logo(struct display_state *state, char *bmp_name)
|
||||
state->logo = NULL;
|
||||
}
|
||||
|
||||
state->logo = load_file(bmp_name, "bootloader");
|
||||
if (!state->logo) {
|
||||
state->logo = load_armbian_boot_logo("boot.bmp");
|
||||
if (!state->logo)
|
||||
state->logo = load_armbian_boot_logo("bootlogo.bmp");
|
||||
if (!state->logo && strcmp(bmp_name, "boot.bmp") &&
|
||||
strcmp(bmp_name, "bootlogo.bmp"))
|
||||
state->logo = load_armbian_boot_logo(bmp_name);
|
||||
|
||||
if (!state->logo)
|
||||
state->logo = load_file(bmp_name, "bootloader");
|
||||
if (!state->logo)
|
||||
state->logo = load_file(bmp_name, "boot-resource");
|
||||
}
|
||||
|
||||
if (!state->logo) {
|
||||
DRM_ERROR("Can not load %s file!\n", bmp_name);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user