u-boot之開機logo篇
新增開機logo檔案
主要思路是將logo改變成二進位制檔案、下載進nandflash中。在其中新增一個分割槽,作為bootlogo分割槽。只要改動檔案時cmd_fastboot.c main.c cmd_mov.c和smdkv210single.c三個檔案
目前狀況是分割槽可以新增,下載進去,但是logo下載進去就會黑屏。
1
Lcd驅動
Lcd_init(){
1設定lcd_framebuffer->lcdbase
2取lcdbase地址
3清屏lcdclear(){1設定調色盤2設定背景顏色}
}
取消原來的logo 主要是LCD_tunnon
主要函式檔案是:fimdl.c pmic.h pmic_8937.h
logodl_config : unconfig
@$(MKCONFIG) $(@:_config=) arm pxa logodl
@rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo
2 logo顯示分析
CFG_LCD_FBUFFER 0x28000000
3 main.c
void s5p_lcd_draw_boot_logo(const unsigned char * buf)
{
unsigned long* pBuffer = (unsigned long*)CFG_LCD_FBUFFER;
memcpy((void*)(pBuffer),buf,480*400*4);
printf("buf value is : 0x%lx\n",buf);
}
#ifdef SHOW_BOOT_LOGO
char run_cmd[100];
char *argv[6] = { NULL, "read", "logo", 0xc3ffecdc, CFG_LCD_FBUFFER, NULL};//無
int argc = 5;
ulong rfs_size, addr,size2;
uint start_blk, blkcnt;
uint start_blk2, blkcnt2;
unsigned char* boot_logo;
unsigned char* boot_logo2;
rfs_size = (255*1024);//???80k?? ??750 KB 1500KB ??????
boot_logo = (unsigned char*)malloc(rfs_size);
printf("boot_logo: 0x%lx\n",boot_logo);
start_blk = ((7*1024*1024)/MOVI_BLKSIZE);
blkcnt = rfs_size/MOVI_BLKSIZE + ((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
//printf("%s bootlogo.. %ld, %ld, %08x ", "reading",start_blk, blkcnt,addr);
sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx","read",boot_logo, start_blk, blkcnt);
//do_movi(NULL, 0, argc, argv);
run_command(run_cmd,0);
extern void LCD_turnon();
memset((void*)CFG_LCD_FBUFFER, 0xFF, 480*800*4);
//LCD_turnon(0);
// LCD_turnon();
// printf("show boot logo--frank\n");
s5p_lcd_draw_boot_logo(boot_logo);
free(boot_logo);
/***************************????? *****************************************/
size2= (255*1024); //2
boot_logo2 = (unsigned char*)malloc(size2);
// printf("boot_logo2: 0x%lx\n",boot_logo2);//??
start_blk2 = start_blk+blkcnt;//??
blkcnt2 = size2/MOVI_BLKSIZE + ((size2&(MOVI_BLKSIZE-1)) ? 1 : 0);//??
//printf("%s bootlogo second frank!!!!!.. %ld, %ld\n","reading",start_blk2, blkcnt2);
sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx","read",boot_logo2, start_blk2, blkcnt2);
//do_movi(NULL, 0, argc, argv);
run_command(run_cmd,0);
//boot_logo2 ??
s5p_lcd_draw_boot_logo2(boot_logo2);
free(boot_logo2);
LCD_turnon();
/***************************????? end*****************************************/
#endif
0xe2700000 //看門狗電路的暫存器
ptn 1 name='bootlogo' start=N/A len=N/A (use hard-coded info. (cmd: movi))
二
1 cmd_fastboot.c中新增分割槽資訊
#ifdef SHOW_BOOT_LOGO //boot logo, zhf
/* bootlogo */
strcpy(ptable[pcount].name, "bootlogo");
ptable[pcount].start = 0;
ptable[pcount].length = 0;
ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MOVI_CMD;
pcount++;
#endif
#if defined(SHOW_BOOT_LOGO)
else if(!strcmp(ptn->name, "bootlogo"))
{
printf("go to download boot logo\n");
strncpy(part,"logo", 7);
argv[4] = length;
sprintf(length, "0x%x",
((size + CFG_FASTBOOT_SDMMC_BLOCKSIZE -1)
/CFG_FASTBOOT_SDMMC_BLOCKSIZE )*CFG_FASTBOOT_SDMMC_BLOCKSIZE);
argc++;
}
2 cmd_movi.c
#ifdef SHOW_BOOT_LOGO
/* for boot logo */
image[6].start_blk = ((7*1024*1024)/MOVI_BLKSIZE);
image[6].used_blk = (2* 1024 * 1024/MOVI_BLKSIZE);
image[6].size = (2* 1024 * 1024);//2M
image[6].attribute = 0x40;
strcpy(image[6].description, "bootlogo");//--frank
printf("logo: %d\n", image[6].start_blk);
#endif
#if defined(SHOW_BOOT_LOGO)
case 'l':
if(argc != 5)
goto usage;
attribute = 0x40;
addr = simple_strtoul(argv[3], NULL, 16);
break;
#endif
#if defined(SHOW_BOOT_LOGO)
if(attribute == 0x40)
{
rfs_size = simple_strtoul(argv[4], NULL, 16);
printf(" \n ");
printf(" \n");
printf("frank argv[4]:%x, rfs_size:%x\n",argv[4],rfs_size);
for (i=0, image = raw_area_control.image; i<15; i++) {
if (image[i].attribute == attribute)
break;
}
start_blk = image[i].start_blk;
blkcnt = rfs_size/MOVI_BLKSIZE +
((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
image[i].used_blk = blkcnt;
printf("%s bootlogo.. %ld, %ld, %08x ", rw ? "writing":"reading",
start_blk, blkcnt,addr);
sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx",
rw ? "write":"read",
addr, start_blk, blkcnt);
run_command(run_cmd, 0);
printf("completed\n");
return 1;
}
#endif
3 main.c
#ifdef SHOW_BOOT_LOGO
#include <movi.h>
void s5p_lcd_draw_boot_logo(const unsigned char * buf)
{
unsigned long* pBuffer = (unsigned long*)CFG_LCD_FBUFFER;
memcpy((void*)(pBuffer),buf,480*400*4);
printf("buf value is : 0x%lx\n",buf);
}
void s5p_lcd_draw_boot_logo2(const unsigned char * buf)
{
unsigned long* pBuffer = (unsigned long*)CFG_LCD_FBUFFER;
memcpy((void*)(pBuffer+480*400),buf,480*400*4);
}
#endif
ifdef SHOW_BOOT_LOGO
char run_cmd[100];
char *argv[6] = { NULL, "read", "logo", 0xc3ffecdc, CFG_LCD_FBUFFER, NULL};//無所謂的
int argc = 5;
ulong rfs_size, addr,size2;
uint start_blk, blkcnt;
uint start_blk2, blkcnt2;
unsigned char* boot_logo;
unsigned char* boot_logo2;
rfs_size = (255*1024);//???80k?? ??750 KB 1500KB ??????
boot_logo = (unsigned char*)malloc(rfs_size);
printf("boot_logo: 0x%lx\n",boot_logo);
start_blk = ((7*1024*1024)/MOVI_BLKSIZE);
blkcnt = rfs_size/MOVI_BLKSIZE + ((rfs_size&(MOVI_BLKSIZE-1)) ? 1 : 0);
printf("%s bootlogo.. %ld, %ld, %08x ", "reading",start_blk, blkcnt,addr);
sprintf(run_cmd,"mmc %s 0 0x%lx 0x%lx 0x%lx","read",boot_logo, start_blk, blkcnt);
//do_movi(NULL, 0, argc, argv);
LCD_turnon();
run_command(run_cmd,0);
//extern void LCD_turnon();
memset((void*)CFG_LCD_FBUFFER, 0xFF, 480*800*4);
printf("show boot logo--frank\n");
s5p_lcd_draw_boot_logo(boot_logo);
free(boot_logo);
// LCD_turnon();
#endif
<pmic_8973.h>
<fmid.c>