1. 程式人生 > >linux在核心中設定開機logo

linux在核心中設定開機logo

1、獲取一張16色的bmp格式的logo圖片,其他格式可用:可牛影像,ps等工具轉換成bmp格式

2、製作ppm格式
    ubuntu安裝:netpbm工具
    sudo apt-get install netpbm 
#!/bin/bash
if [ "x$1" == "x" ];
then
    echo "usage:$0 logo_file"
    exit 0
fi

if [ -f "$1" ]
then
    echo $1
else
    echo "no find file [$1]"
    exit 0
fi

name=${1%%.*}
bmptopnm $1 > $name.pnm
pnmquant 224 $name.pnm > $name.clut224.pnm
pnmtoplainpnm $name.clut224.pnm > $name.ppm

3、核心配置

drivers/video/logo/Kconfig 檔案中新增一下內容(名字可自己定)

    config LOGO_ROTA_CLUT224
	bool "Standard 224-color ROTA logo"
	default y

drivers/video/logo/Makefile新增

obj-$(CONFIG_LOGO_ROTA_CLUT224) += logo_rota_clut224.o

drivers/video/logo/logo.c新增
#ifdef CONFIG_LOGO_ROTA_CLUT224
		logo = &logo_rota_clut224;
#endif

include/linux/linux_logo.h新增

extern const struct linux_logo logo_rota_clut224;

把之前生產的ppm圖片 拷貝到driver/video/logo/目錄下,並命名為logo_rota_clut224.ppm

重新編譯核心,系統會根據Kconfig配置,把logo_rota_clut224.ppm 轉換成 logo_rota_clut224.c檔案

然後編譯到核心中