Overview
This article discusses how to customize the splash screen for the Linux SDK. The info was derived from this e2e forum post.
Steps
The "psplash" user space application is called at boot time, showing the TI logo splash screen. In order to change the displayed image, you need to first download the "psplash" package source code from here. The next steps are as follows:
1. Use the ./make-image-header.sh script included in the package to create a new header file with your new image: (you need to install libgdk-pixbuf2.0-dev library first)
./make-image-header.sh <path_to_image_file> <NAME>
Note: The <NAME> argument can be whatever you want it to be, but for the fastest approach you should use "POKY" as this is what is used by default in the psplash.c file. Unfortunately this isn't configurable and you have to edit the file manually if you wish to use different name.
- The above command will generate the header file with the image contents (<your_logo_filename>-img.h). - Open the psplash.c file and replace the file name in the following line at the top of the file:
#include "psplash-poky-img.h"
with
#include "<your_logo_filename>-img.h"
2.Export the needed variables and then configure and build psplash:
export CROSS_COMPILE=arm-linux-gnueabihf- export ARCH=arm export PATH=$PATH:$HOME/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin ./autogen.sh --host=arm-linux CC=arm-linux-gnueabihf-gcc make
3. Replace the /usr/bin/psplash file in your root file system with the generated psplash file.
首先通常运行时总出现一条横贯左右的白条,经查,该函数作怪,
/* Clear */
/*psplash_fb_draw_rect (fb,
0,
fb->height - (fb->height/6) - h,
fb->width,
h,
0xec, 0xec, 0xe1);*/
删后该问题解决。
关于进度条,先删了一个进度条的外框函数,感觉没什么用,删后效果还好,该函数为:
/* Draw progress bar border */
/*psplash_fb_draw_image (fb,
(fb->width - BAR_IMG_WIDTH)/2,
fb->height - (fb->height/10),
BAR_IMG_WIDTH,
BAR_IMG_HEIGHT,
BAR_IMG_BYTES_PER_PIXEL,
BAR_IMG_RLE_PIXEL_DATA);*/
查看psplash.c里边有关于进度条的函数,
psplash_draw_progress (PSplashFB *fb, int value)
{
int x, y, width, height, barwidth;
/* 4 pix border */
x = ((fb->width - BAR_IMG_WIDTH)/2) + 4 ;
y = fb->height - (fb->height/6) + 4;
width = BAR_IMG_WIDTH - 8;
height = BAR_IMG_HEIGHT - 8;
if (value > 0)
{
barwidth = (CLAMP(value,0,100) * width) / 100;
psplash_fb_draw_rect (fb, x + barwidth, y,
width - barwidth, height,
0xec, 0xec, 0xe1);
psplash_fb_draw_rect (fb, x, y, barwidth,
height, 0x6d, 0x6d, 0x70);
}
else
{
barwidth = (CLAMP(-value,0,100) * width) / 100;
psplash_fb_draw_rect (fb, x, y,
width - barwidth, height,
0xec, 0xec, 0xe1);
psplash_fb_draw_rect (fb, x + width - barwidth,
y, barwidth, height,
0x6d, 0x6d, 0x70);
}
DBG("value: %i, width: %i, barwidth :%i/n", value,
width, barwidth);
}
看了一下,也就是画方框,之后根据进度画着了色的进度框,改代码如下:
void
psplash_draw_progress (PSplashFB *fb, int value)
{
int x, y, width, height, barhight;
x = 100;
y = ((fb->height - BAR_IMG_WIDTH)/2) + 4;
width =BAR_IMG_HEIGHT - 16;//width = BAR_IMG_WIDTH - 8;
// height = BAR_IMG_HEIGHT - 8;
height = BAR_IMG_WIDTH - 8;//height = BAR_IMG_HEIGHT - 16;
if (value > 0)
{
//barwidth = (CLAMP(value,0,100) * width) / 100;
barhight = (CLAMP(value,0,100) * height ) / 100;
psplash_fb_draw_rect (fb, x , y+ barhight,//psplash_fb_draw_rect (fb, x + barwidth, y,
width , height- barhight,//width - barwidth, height,
0xec, 0xec, 0xe1);
psplash_fb_draw_rect (fb, x, y, width,
barhight, 0x6d, 0x6d, 0x70);
}
else
{
barhight = (CLAMP(-value,0,100) * height) / 100;
psplash_fb_draw_rect (fb, x, y,
width, height- barhight,
0xec, 0xec, 0xe1);
psplash_fb_draw_rect (fb, x,
y, width, barhight,
0x6d, 0x6d, 0x70);
}
DBG("value: %i, width: %i, barhight :%i/n", value,
width, barhight);
}