Kernel启动阶段添加显示动画 准备文件:启动动画的连续图片 如果是png格式,使用 pngtopnm logo.png > logo.pnm 转化为pnm (没有pngtopnm /bmptopnm 命令,使用sudo apt-get install pnmtoplainpm命令安装) 如果是bmp格式,使用 bmptopnm logo.bmp > logo.pnm 转化为pnm 然后使用 pnmquant 224 logo.pnm > logo224.pnm pnmtoplainpnm logo224.pnm > logo_linux_clut224.ppm 将图片转化为ppm格式 将图片拷贝到OK3568-linux-source/kernel/drivers/video/logo下 重命名为_clut224.ppm结尾,方便Makefile识别 修改Makefile 修改logo.c 修改OK3568-linux-source/kernel/include/linux/linux_logo.h 修改OK3568-linux-source/arch/arm64/configs/OK3568-C-linux_defconfig将kernel logo打开 diff --git a/arch/arm64/configs/OK3568-C-linux_defconfig b/arch/arm64/configs/OK3568-C-linux_defconfig index 97d46ceff..d5af9f21d 100644 --- a/arch/arm64/configs/OK3568-C-linux_defconfig +++ b/arch/arm64/configs/OK3568-C-linux_defconfig @@ -590,3 +590,45 @@ CONFIG_RCU_CPU_STALL_TIMEOUT=60 CONFIG_FUNCTION_TRACER=y CONFIG_BLK_DEV_IO_TRACE=y CONFIG_LKDTM=y + +# +# Console display driver support +# +CONFIG_FONT_8x8=n +CONFIG_VGA_CONSOLE=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMMY_CONSOLE_COLUMNS=80 +CONFIG_DUMMY_CONSOLE_ROWS=25 +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_MONO=n +CONFIG_LOGO_LINUX_VGA16=n +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +CONFIG_SND_PCM_ELD=y +CONFIG_SND_PCM_IEC958=y +CONFIG_SND_SEQ_DEVICE=y +CONFIG_SND_COMPRESS_OFFLOAD=y +CONFIG_SND_JACK=y +CONFIG_SND_JACK_INPUT_DEV=y +# CONFIG_SND_OSSEMUL is not set +CONFIG_SND_PCM_TIMER=y +CONFIG_SND_HRTIMER=y +CONFIG_SND_DYNAMIC_MINORS=y +CONFIG_SND_MAX_CARDS=32 +# CONFIG_SND_SUPPORT_OLD_API is not set +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_DMA_SGBUF=y +CONFIG_SND_SEQUENCER=y +CONFIG_SND_SEQ_DUMMY=y +CONFIG_SND_SEQ_HRTIMER_DEFAULT=y +CONFIG_SND_DRIVERS=y 修改OK3568-linux-source/kernel/drivers/video/fbdev/core/fbcon.c OK3568-linux-source/kernel/drivers/video/fbdev/core/fbmem.c 调整logo显示位置居中和连续显示 diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index bf7959fdf..2607ac9cb 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -569,6 +569,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, if (fb_get_color_depth(&info->var, &info->fix) == 1) erase &= ~0x400; logo_height = fb_prepare_logo(info, ops->rotate); + logo_height += (info->var.yres / 2) - (logo_height / 2); logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); q = (unsigned short *) (vc->vc_origin + vc->vc_size_row * rows); @@ -2037,6 +2038,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, return 0; }
+extern int fb_get_logo(struct fb_info *info, int rotate); + static int fbcon_switch(struct vc_data *vc) { struct fb_info *info, *old_info = NULL; @@ -2158,7 +2161,14 @@ static int fbcon_switch(struct vc_data *vc)
logo_shown = fg_console; /* This is protected above by initmem_freed */ - fb_show_logo(info, ops->rotate); + //fb_show_logo(info, ops->rotate); +#if 1 + for(i = 0; i < 25; i++){ + fb_get_logo(info, i); + fb_show_logo(info, ops->rotate); + msleep(50);// 睡眠 50 ms 作为显示图片的切换间隔 + } +#endif update_region(vc, vc->vc_origin + vc->vc_size_row * vc->vc_top, vc->vc_size_row * (vc->vc_bottom -
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 7a70e7b80..63cfad4c0 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -509,10 +509,10 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, fb_set_logo(info, logo, logo_new, fb_logo.depth); }
- image.dx = 0; - image.dy = y; image.width = logo->width; image.height = logo->height; + image.dx = (info->var.xres / 2) - (logo->width / 2); + image.dy = (info->var.yres / 2) - (logo->height / 2);
if (rotate) { logo_rotate = kmalloc_array(logo->width, logo->height, @@ -681,12 +681,25 @@ int fb_show_logo(struct fb_info *info, int rotate)
return y; } + +int fb_get_logo(struct fb_info *info, int num) +{ + int depth = fb_get_color_depth(&info->var, &info->fix); + depth |= num << 16; + fb_logo.logo = fb_find_logo(depth); + if(!fb_logo.logo) { + return -1; + } + return 0; +} #else int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } int fb_show_logo(struct fb_info *info, int rotate) { return 0; } +int fb_get_logo(struct fb_info *info, int rotate) { return 0; } #endif /* CONFIG_LOGO */ EXPORT_SYMBOL(fb_prepare_logo); EXPORT_SYMBOL(fb_show_logo); +EXPORT_SYMBOL(fb_get_logo);
static void *fb_seq_start(struct seq_file *m, loff_t *pos) { 此时开机会发现显示logo时屏幕有一个闪烁的光标,修改OK3568-linux-source/kernel/drivers/video/fbdev/core/bitblit.c去掉光标 iff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c index 436365efa..e8e874653 100644 --- a/drivers/video/fbdev/core/bitblit.c +++ b/drivers/video/fbdev/core/bitblit.c @@ -373,7 +373,8 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, if (info->fbops->fb_cursor) err = info->fbops->fb_cursor(info, &cursor);
- if (err) + //if (err) + if (0) soft_cursor(info, &cursor);
ops->cursor_reset = 0; 此时开机可以看到动画在屏幕中间正常播放 本文参考https://blog.csdn.net/qq_37596943/article/details/127976078如有侵权,请联系删除
|
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-16 12:44
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.