1、修改u-boot开机logo步骤
-
a. 准备一张8位(256色)bmp格式的图片;
-
b. 将图片放到u-boot源码的
tools/logos/
目录下; -
c. 修改
tools/Makefile
指定显示的图片:# Use board logo and fallback to vendor ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),) LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp else ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),) LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp endif endif # 指定显示的图片,不用管前面设置的是什么,这里都会覆盖掉 LOGO_BMP= $(srctree)/$(src)/logos/test.bmp
-
d. 编译烧录即可。
2、修改kernel启动log步骤
-
a. 准备一张ppm格式的图片(Ubuntu环境下可参考以下命令生成):
sudo apt install netpbm # 安装必要的工具 pngtopnm logo-linux.png > logo-linux.pnm # 转换成pnm格式文件 pnmquant 224 logo-linux.pnm > logo-linux224.pnm # 修改最大颜色数量为224 pnmtoplainpnm logo-linux224.pnm > logo_linux_clut224.ppm # 转换为ascii格式
-
b. 覆盖掉原来的
drivers/video/logo/logo_linux_clut224.ppm
文件; -
c. 删除编译自动生成的
logo_linux_clut224.c
和logo_linux_clut224.o
文件; -
d. (可选)修改图片开始显示位置(这里以居中显示为例):
--- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -498,8 +498,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.dx = 0; + //image.dy = y; + image.dx = info->var.xres/2 - image.width/2; + image.dy = info->var.yres/2 - image.height/2; image.width = logo->width; image.height = logo->height;
-
e. (可选)禁止LCD光标显示(将函数改为空函数):
--- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -363,6 +363,7 @@ static void fbcon_update_softback(struct vc_data *vc) static void fb_flashcursor(struct work_struct *work) { +#if 0 struct fb_info *info = container_of(work, struct fb_info, queue); struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc = NULL; @@ -393,6 +394,7 @@ static void fb_flashcursor(struct work_struct *work) ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), get_color(vc, info, c, 0)); console_unlock(); +#endif }
-
f. 配置内核打开以下选项:
Device Drivers ---> Graphics support ---> [*] Bootup logo ---> [*] Standard 224-color Linux logo
-
g. 编译烧录即可。
3、添加开机进度条步骤
-
a. 安装必要的软件:
sudo apt install libgdk-pixbuf2.0-dev
-
b. 下载psplash源码:
git clone git://git.yoctoproject.org/psplash
-
c. 准备一张logo图片和一张进度条图片(皆为png格式,名字随意,如logo.png、log-bar.png;可以参考同目录下的
base-images
目录里的图片); -
d. 进入下载的psplash源码包里进行制作:
./make-image-header.sh logo.png POKY # 生成logo-img.h ./make-image-header.sh logo-bar.png BAR # 生成logo-bar-img.h
-
e. 修改
psplash.c
,将头文件包含修改为前面制作生成的://#include "psplash-poky-img.h" //#include "psplash-bar-img.h" #include "logo-img.h" #include "logo-bar-img.h"
-
f. 使用autotools工具生成Makefile文件:
aclocal && autoheader && automake --add-missing && autoconf
-
g. 修改
Makefile.am
文件,将psplash-poky-img.h
和psplash-bar-img.h
分别修改为前面生成的logo-img.h
和logo-bar-img.h
:psplash_SOURCES = psplash.c psplash.h psplash-fb.c psplash-fb.h \ psplash-console.c psplash-console.h \ psplash-colors.h psplash-config.h \ logo-img.h logo-bar-img.h $(FONT_NAME)-font.h
-
h. 配置生成
Makefile
文件:./configure --host=arm-linux-gnueabihf
-
i. 执行
make
命令进行编译,会在当前目录下生成psplash
和psplash-write
两个程序; -
j. 将生成的两个可执行程序替换掉系统中的
/usr/bin
目录下对应的程序(它们会被/etc/init.d/
或/etc/rcS.d
目录下的脚本在开机时执行)。