应用层更换Linux机器开机启动LOGO

平台开机Logo默认是编译进内核的,更换起来很不方便,通过改写内核源码,可以实现应用层直接更换内核Logo。

1.uboot相关修改

网上教程一般会这么改

"loadlogo=mmc read 0x15000000 0x5800 0x2800;\0" \
"run loadlogo; " \

核心代码是mmc read 0x15000000 0x5800 0x2800;这个命令的作用是从MMC或SD卡的第22528(0x5800)个扇区开始,读取10240(0x2800)个扇区的数据,并将这些数据存储到内存地址0x15000000处。这种操作通常用于将存储设备上的数据加载到内存中,以便进行进一步的处理或执行。目的是将图片文件放到0x15000000处,用于后面logo.c文件中使用

但经过实践发现,这么改会存在"run loadlogo; "未执行的情况,从而导致LOGO更换不上。

故选择将最后一段改成:"else run netboot; fi; mmc read 0x15000000 0x5800 0x2800;" 解决。(可能还需要手动进uboot命令行,将bootcmd重置成默认)

2.kernel内核文件修改

修改drivers/video/logo/Kconfig文件

在最后新加一个LOGO_LINUX_CUSTOM_CLUT224的配置选项:

/* 在如下配置 */
config LOGO_LINUX_CUSTOM_CLUT224
bool "Custom 224-color linux logo"
default y
endif # LOGO

修改drivers/video/logo/logo.c文件

到这一步可以有两种修改办法,这取决于后续LOGO图片是怎么处理的

首先在头部增加如下代码

/* logo's are marked __initdata. Use __init_refok to tell
* modpost that it is intended that this function uses data
* marked __initdata.
*/ #ifdef CONFIG_LOGO_LINUX_CUSTOM_CLUT224 //新增
#define IMAGE_HEAD_SIZE 54
#define IMAGE_MAX_PIXEL 2048000
#define IMAGE_MAX_SIZE (IMAGE_HEAD_SIZE+IMAGE_MAX_PIXEL+1024)
#define COLOR_MAX_NUM 224 /* linux logo just support 224 colors */
#define IMAGE_MTD_NUM 4 /* the logo saved in MTD4 */
#define IMAGE_OFFSET 0x0 /* the logo's offset int the mtd area */
volatile static unsigned char* remapped_area;
static unsigned char logo_flash_clut224_data[IMAGE_MAX_PIXEL] __initdata = {0};
static unsigned char logo_flash_clut224_clut[COLOR_MAX_NUM * 3] __initdata = {0};
static struct linux_logo logo_flash_clut224 __initdata =
{
.type = LINUX_LOGO_CLUT224,
.width = 0,
.height = 0,
.clutsize = 0,
.clut = logo_flash_clut224_clut,
.data = logo_flash_clut224_data,
};
#endif const struct linux_logo * __init_refok fb_find_logo(int depth)
{
const struct linux_logo *logo = NULL; if (nologo)...

后续分成:LINUX上处理图片WINDOWS上处理图片

如果图片在Linux上处理,在if (depth >= 8)做如下修改:

if (depth >= 8)
{
#ifdef CONFIG_LOGO_LINUX_CUSTOM_CLUT224
unsigned char head[60] = {0};
unsigned char *image = NULL;
unsigned char *clut = NULL;
unsigned char *data = NULL; int clutsize = 0;
int size = 0;
int offset = 0;
int width = 0;
int height = 0;
int count = 0;
int compress = 0;
int sizeimage = 0;
int clrused = 0; int i = 0;
int j = 0;
int fi = 0;
int li = 0; unsigned int real_width = 0;
unsigned int logo_index = 0; remapped_area = __phys_to_virt(0x15000000);
memcpy(head, remapped_area, 58);
printk("image head:%c%c\n", head[0], head[1]); if(head[0] == 'K' && head[1] == 'I'&& head[2] == 'K')
{
printk("right ppm image head");
memcpy( &logo_flash_clut224.width, remapped_area+3, 4);
memcpy( &logo_flash_clut224.height, remapped_area + 4+3, 4);
memcpy( &logo_flash_clut224.clutsize, remapped_area + 8+3, 4);
memcpy( logo_flash_clut224.data, remapped_area + 15, logo_flash_clut224.width * logo_flash_clut224.height);
memcpy( logo_flash_clut224.clut, remapped_area + 15 + (logo_flash_clut224.width * logo_flash_clut224.height), logo_flash_clut224.clutsize * 3);
logo=&logo_flash_clut224;
}
else
{
#ifdef CONFIG_LOGO_LINUX_CLUT224
printk("LINUX_clut224\n");
logo = &logo_linux_clut224;
#endif
}
#endif

如果选择在Windows上处理LOGO图片,代码改成

#ifdef CONFIG_LOGO_LINUX_CUSTOM_CLUT224
unsigned char head[60] = {0};
unsigned char *image = NULL;
unsigned char *clut = NULL;
unsigned char *data = NULL; int clutsize = 0;
int size = 0;
int offset = 0;
int width = 0;
int height = 0;
int count = 0;
int compress = 0;
int sizeimage = 0;
int clrused = 0; int i = 0;
int j = 0;
int fi = 0;
int li = 0; unsigned int real_width = 0;
unsigned int logo_index = 0; remapped_area = __phys_to_virt(0x15000000);
memcpy(head, remapped_area, 58);
printk(" %s-%d:right image head:%c%c\n", __FILE__, __LINE__, head[0], head[1]); if(1)
{
printk("right ppm image head");
memcpy( &logo_flash_clut224.width, remapped_area+4, 4);
memcpy( &logo_flash_clut224.height, remapped_area + 8, 4);
memcpy( &logo_flash_clut224.clutsize, remapped_area + 12, 4);
memcpy( logo_flash_clut224.data, remapped_area + 16, logo_flash_clut224.width * logo_flash_clut224.height);
memcpy( logo_flash_clut224.clut, remapped_area + 16 + (logo_flash_clut224.width * logo_flash_clut224.height), logo_flash_clut224.clutsize * 3);
logo=&logo_flash_clut224;
}
else
{
#ifdef CONFIG_LOGO_LINUX_CLUT224
printk("LINUX_clut224\n");
logo = &logo_linux_clut224;
#endif
}
#endif

没错,就是因为后续图片格式会有所不一样,读取图片信息的方式也不同。

之后在然后重新编译内核。配置内核时,需要去掉logo路径下的其它选项,只保留Custom 224-color linux logo这一个选项。

3.LOGO图片修改

因为Logo图片中所使用的颜色数不能超过224种,如果超过将无法正常显示,因此我们需要制作符合要求的图像。

Linux环境下制作:

先下载附件res



Windows环境下制作:方法是我自己寻找制作的,因为有这种需求,安装包放在云盘中

链接:https://pan.baidu.com/s/1Yn7BtTh4GtVqoS-cc2nU8Q?pwd=1234

提取码:1234

按照文件中readme.txt一步步执行即可

两者都是为了把图片制作成mylogo.bin提供给logo.c解读,使LOGO修改生效

你用哪种方式,上述logo.c就改成哪种就行。

4.去除linux的开机光标

光标会导致LOGO图片显示时,左上角有黑块,方法如下:

在内核的当前目录进入到drivers/video/console/fbcon.c文件

将static void fb_flashcursor(void *private) 和 static void fbcon_cursor(struct vc_data *vc, int mode) 里的内容注释掉,使之变成空函数

我的建议是在这两个函数开头直接return;就行

参考连接:

如何修改 ARM Linux 系统的启动画面

去除linux的开机光标

应用层更换内核启动logo

Linux开机LOGO更换以及附带问题的更多相关文章

  1. Linux 开机 logo 修改

    从内核被解压到文件系统被挂载,我们看到的经典画面是一个小企鹅.如果嫌小企鹅枯燥,我们可以把它换掉. 1. 准备图片 这里需要的是 ppm 图片,所以,我们需要把常见格式给转换为 .ppm 才能使用.c ...

  2. 八、启动linux内核并修改开机logo

    1. 编译并烧写linux内核 1)先准备好内核源码包urbetter-linux2.6.28-v1.0.tgz,输入命令:tar -zxvf urbetter-linux2.6.28-v1.0.tg ...

  3. linux内核开机logo显示调试

    要使内核支持开机logo显示需要配置内核 配置如下: make menuconfig: Device Drivers  --->     Graphics support  --->    ...

  4. 小白自制Linux开发板 九. 修改开机Logo

    许久不见啊,今天我们继续来修改我们的系统. 通过前面的几篇文章我们已经能轻松驾驭我们的开发板了,但是现在都是追求个性化的时代,我们在开发板上打上了自己的Logo,那我们是否可以改变开机启动的Logo呢 ...

  5. Android5.1开机LOGO与开机动画【转】

    本文转载自:http://blog.csdn.net/u014770862/article/details/52624627 android5.1中,开机LOGO部分和之前版本的并不相同,主要区别在于 ...

  6. 全网络最正确的让 Linux 开机进入字符界面的方法及设置 FrameBuffer 分辨率的方法

    引言 这个标题有点长,是为了在标题中就把问题说清楚,以便搜索引擎能够把有需要的朋友准确地带到我这里来.目前在网络上,很多关于 Linux 方面的知识是过时的和错误的.我标题中指出的两个知识点就是其中的 ...

  7. 因为强行关机, 而导致的fedora23 不能重新启动, 卡在开机logo那里的 修复 解决方案

    其实, fedora23的U盘live 也很好用, 很流畅, 主要还是 要用一个比较好的/快的 U盘. 这样live U盘在4GB(3.75GiB)的内存中还是较快的 原来的U盘live系统用得很卡, ...

  8. 开机logo以及两种修改开机动画方法

    Android开机画面总共有三屏 一.第一屏:开机logo 1.选张png格式的图片,在Linux任意下执行(安装工具): sudo apt-get install pnmtoplainpm 2.在所 ...

  9. 安卓开机logo和开机动画的几种实现方法

    安卓4.2可用方法2-4,第一种方法未验证. 从理论上来说,android 有4个开机启动画面. 第一个应该是U-BOOT的启动画面,有些设备为了满足按动电源即有显示,在UBOOT里加了开机画面,实现 ...

  10. 安卓修改开机logo和开机动画的方法

    第一种和第二种方法亲测可用,安卓版本是4.2和安卓5.1均可.第二种方法待验证 以下三种方法 Android 开机其实总共会出现3个画面: 1.第一个就是 linux 系统启动,出现Linux小企鹅画 ...

随机推荐

  1. Rigid Body Simulation

    目录 0 前言 1 核心技术 1.1 Semi-implicit Euler 1.2 刚体模拟 1.3 Collision 2 实现 X Ref 0 前言 声明:此篇博客仅用于个人学习记录之用,并非是 ...

  2. C# 利用epplus导出excel,自动求和

    /// <summary> /// 生成xlsx /// </summary> /// <param name="dvLine">数据视图< ...

  3. Scala代码练习

    1.编程实现百分制转换成五级制,规则如下: 90~100分,返回优秀: 80~89分,返回良好: 70~79分,返回中等: 60~69分,返回及格: 60分以下,返回不及格. object grade ...

  4. C240817C. 团队协作:二分答案+贪心

    C240817C. 团队协作 二分显然,但是被check难住了. 以为只能把运动员按速度分成两类,然后二分图找最大匹配,但显然做不动. 然后考场上就被卡住了--- 看了题解突然勾起了对一道题远古的记忆 ...

  5. ubuntu系统下安装 steam 游戏平台

    方法1:安装命令: sudo snap install steam 方法2:下载安装: 地址: https://store.steampowered.com/about/

  6. HNCTF [Week1]Interesting_http

    <center>HNCTF [Week1]Interesting_http </center> 五毛钱翻译:请用post给我一个 want Burp Suite 抓包传参 &l ...

  7. 搭建离线yum源

    HTTP方式 安装步骤 系统:CentOS 7.6 yum install -y httpd vi /etc/httpd/conf/httpd.conf <Directory /> Opt ...

  8. 基于Java+SpringBoot+Mysql实现的快递柜寄取快递系统功能实现九

    一.前言介绍: 1.1 项目摘要 随着电子商务的迅猛发展和城市化进程的加快,快递业务量呈现出爆炸式增长的趋势.传统的快递寄取方式,如人工配送和定点领取,已经无法满足现代社会的快速.便捷需求.这些问题不 ...

  9. Groovy基础语法!

    Groovy是什么语言? Groovy是一种基于JVM(Java虚拟机)的敏捷开发语言,它结合了Python.Ruby和Smalltalk的许多强大的特性,Groovy 代码能够与 Java 代码很好 ...

  10. springboot 参数注解 注入参数

    什么时注解参数 说明 我们在 使用spring mvc 的时候会使用这样的注解 @ResponseBody 这样,spring mvc 会将 客户端传来的数据,自动构建成 相应类型的对象. 有些情况下 ...