Linux Startup image and kernel Separation

Source: Internet
Author: User

 

First, let's talk about the environment: 2.6.33-rc4, arm9-running, 640*480

 

The basic idea is to delete the static ppm file from the kernel and put the generated array into the memory. The steps are as follows:

 

1. decompress the kernel and modify drivers/video/logo/Makefile.

 

Only obj-$ headers are reserved. obj-$ (CONFIG_LOGO) + = logo. o

 

The purpose is to remove the process of generating xxx_logo_xxx.c, because we do not need

 

 

 

 

2. The image displayed in linux is 224 colors. If we do not remove the auto-generated image, we can see that it will generate the following struct.

 

Const struct linux_logo logo_linux_clut.pdf = {

 

. Type = linux_logo_clut.pdf,

 

. Width = 640,

 

. Size = 480,

 

. Clutsize = 217, // the actual number of colors used, up to 224

 

. Clut = logo_linux_clut224_clut, // The size is clutsize * 3, which is used as the color palette. Each color stores three rgb values.

 

. Data = logo_linux_clut224_data // 640*480, each value represents the index in the palette

 

};

 

The color palette is used for 224 colors. The principle is similar to the bmp format for 256 colors, but the color palette is 224 colors.

 

Add definitions in drivers/video/logo. c.

 

Volatile static unsigned char * remapped_area;

 

Static unsigned char clut [224*3]; // 1 ~ 224 colors

 

Static unsigned char data [640*480]; // fixed size

 

Const struct linux_logo logo_buf = {

 

. Type = 3, // linux_logo_clut.pdf,

 

. Width = 640,

 

. Size = 480,

 

. Clutsize = 224,

 

. Clut = clut,

 

. Data = data

 

};

 

 

Modify a function

 

Const struct linux_logo * _ init_refok fb_find_logo (int depth)

 

{

 

Struct linux_logo * logo = NULL;

 

If (nologo)

 

Return NULL;

 

Logo = & logo_buf;

 

Remapped_area = (volatile unsigned char *) ioremap (0xc1700000, 640*480 + 224*3 + 4); // my uImage is moved from 0xc0700000, where 16 m is moved backwards, enough Kernel

 

Memcpy (logo-> data, remapped_area, 640*480 );

 

Memcpy (& logo-> clutsize, remapped_area + 640*480, 4 );

 

Memcpy (logo-> clut, remapped_area + 640*480 + 4, logo-> clutsize * 3 );

 

Iounmap (remapped_area );

 

Return logo;

 

}

 

 

 

 

3. Compile the kernel

 

 

 

 

 

4. Prepare image data,

 

First, use gimp in windows to create a 224-color ppm (asicc) image (similar to the previous one) and place it in any folder in linux, such as/tmp/1.ppm.

 

There is a script/pnmtolog in the Linux kernel,

 

Run./your kernel source code/scripts/pnmtologo-t clut1_- n logo_linux_clut1_- o/tmp/1.c/tmp/1.ppm

 

The generated 1.C is the same as the xxx_logo.c generated by the compiled kernel. The total color (4 bytes), the total color (640*480 bytes), and The logo_linux_clut224_clut array (color x 3)

 

Write the logo. dat in a file.

 

 

 

5. Burn images and kernels into different flash locations

 

 

 

6. Modify the startup parameter to read the image to 0xc1700000, and then read the kernel to 0xc0700000 (the memory address can be changed)

 

From ma100's column

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.