支持logo替换和加密,密码:rkdroid

This commit is contained in:
yxj
2011-08-18 17:35:45 +08:00
parent 1a487a2d6f
commit 8e7102f7cc
5 changed files with 2359500 additions and 102 deletions

View File

@@ -82,9 +82,16 @@ config LOGO_M32R_CLUT224
depends on M32R
default y
config LOGO_PWON_CHARGER_CLUT224
bool "standard 224-color linux logo for power on charege"
default n
config LOGO_CHARGER_CLUT224
bool "standard 224-color linux logo for rk2918 phone"
default n
config LOGO_CRUZ_CLUT224
bool "standard 224-color cruz logo"
default n
endif # LOGO

View File

@@ -15,7 +15,8 @@ obj-$(CONFIG_LOGO_SUPERH_MONO) += logo_superh_mono.o
obj-$(CONFIG_LOGO_SUPERH_VGA16) += logo_superh_vga16.o
obj-$(CONFIG_LOGO_SUPERH_CLUT224) += logo_superh_clut224.o
obj-$(CONFIG_LOGO_M32R_CLUT224) += logo_m32r_clut224.o
obj-$(CONFIG_LOGO_CRUZ_CLUT224) +=logo_cruz_clut224.o
obj-$(CONFIG_LOGO_PWON_CHARGE_CLUT224) += logo_charge0100_clut224.o logo_charge0102_clut224.o logo_charge0103_clut224.o logo_charge0104_clut224.o logo_charge0105_clut224.o logo_charge0106_clut224.o logo_charge0108_clut224.o
obj-$(CONFIG_LOGO_CHARGER_CLUT224) += logo_charger00_clut224.o logo_charger01_clut224.o logo_charger02_clut224.o logo_charger03_clut224.o logo_charger04_clut224.o logo_charger05_clut224.o logo_charger06_clut224.o logo_charger07_clut224.o logo_charger08_clut224.o
obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o

View File

@@ -25,14 +25,27 @@ static int nologo;
module_param(nologo, bool, 0);
MODULE_PARM_DESC(nologo, "Disables startup logo");
extern const struct linux_logo logo_cruz_clut224;
const unsigned char password[32] = {
0x52, 0x4b, 0x20, 0x6c,
0x6f, 0x67, 0x6f, 0x20,
0x70, 0x61, 0x73, 0x73,
0x77, 0x6f, 0x72, 0x64,
0x31, 0x57, 0x8d, 0xeb,
0x18, 0x4b, 0xa9, 0x41,
0xd9, 0x47, 0xea, 0x2f,
0x7e, 0x60, 0xb1, 0x67
};
/* logo's are marked __initdata. Use __init_refok to tell
* modpost that it is intended that this function uses data
* marked __initdata.
*/
const struct linux_logo * __init_refok fb_find_logo(int depth)
{
const struct linux_logo *logo = NULL;
struct linux_logo *logo = NULL;
const struct linux_logo *m_logo = NULL;
if (nologo)
return NULL;
@@ -100,7 +113,18 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
/* M32R Linux logo */
logo = &logo_m32r_clut224;
#endif
#ifdef CONFIG_LOGO_CRUZ_CLUT224
logo = &logo_cruz_clut224;
#endif
logo->width = ((logo->data[0] << 8) + logo->data[1]);
logo->height = ((logo->data[2] << 8) + logo->data[3]);
logo->clutsize = logo->clut[0];
logo->data += 4;
logo->clut += 1;
}
return logo;
m_logo = logo;
return m_logo;
}
EXPORT_SYMBOL_GPL(fb_find_logo);

File diff suppressed because it is too large Load Diff

262
scripts/pnmtologo.c Normal file → Executable file
View File

@@ -27,7 +27,6 @@ static const char *logoname = "linux_logo";
static const char *outputname;
static FILE *out;
#define LINUX_LOGO_MONO 1 /* monochrome black/white */
#define LINUX_LOGO_VGA16 2 /* 16 colors VGA text palette */
#define LINUX_LOGO_CLUT224 3 /* 224 colors */
@@ -41,6 +40,8 @@ static const char *logo_types[LINUX_LOGO_GRAY256+1] = {
};
#define MAX_LINUX_LOGO_COLORS 224
#define MAX_LINUX_LOGO_WIDTH 1280
#define MAX_LINUX_LOGO_HEIGHT 800
struct color {
unsigned char red;
@@ -67,6 +68,23 @@ static const struct color clut_vga16[16] = {
{ 0xff, 0xff, 0xff },
};
unsigned char data_name[] = {
0x6C, 0x6F, 0x67,
0x6F, 0x5F, 0x52,
0x4B, 0x6C, 0x6F,
0x67, 0x6F, 0x5F,
0x64, 0x61, 0x74,
0x61
};
unsigned char clut_name[] = {
0x6C, 0x6F, 0x67,
0x6F, 0x5F, 0x52,
0x4B, 0x6C, 0x6F,
0x67, 0x6F, 0x5F,
0x63, 0x6C, 0x75,
0x74
};
static int logo_type = LINUX_LOGO_CLUT224;
static unsigned int logo_width;
@@ -79,7 +97,6 @@ static void die(const char *fmt, ...)
__attribute__ ((noreturn)) __attribute ((format (printf, 1, 2)));
static void usage(void) __attribute ((noreturn));
static unsigned int get_number(FILE *fp)
{
int c, val;
@@ -118,15 +135,15 @@ static unsigned int get_number255(FILE *fp, unsigned int maxval)
static void read_image(void)
{
FILE *fp;
unsigned int i, j;
int magic;
unsigned int maxval;
FILE *fp;
unsigned int i, j;
int magic;
unsigned int maxval;
/* open image file */
fp = fopen(filename, "r");
if (!fp)
die("Cannot open file %s: %s\n", filename, strerror(errno));
/* open image file */
fp = fopen(filename, "r");
if (!fp)
die("Cannot open file %s: %s\n", filename, strerror(errno));
/* check file type and read file header */
magic = fgetc(fp);
@@ -150,18 +167,19 @@ static void read_image(void)
default:
die("%s is not a PNM file\n", filename);
}
logo_width = get_number(fp);
logo_height = get_number(fp);
logo_width = get_number(fp);
logo_height = get_number(fp);
/* allocate image data */
logo_data = (struct color **)malloc(logo_height*sizeof(struct color *));
if (!logo_data)
die("%s\n", strerror(errno));
for (i = 0; i < logo_height; i++) {
logo_data[i] = malloc(logo_width*sizeof(struct color));
if (!logo_data[i])
die("%s\n", strerror(errno));
}
/* allocate image data */
logo_data = (struct color **)malloc(logo_height * sizeof(struct color *));
if (!logo_data)
die("%s\n", strerror(errno));
for (i = 0; i < logo_height; i++) {
logo_data[i] = (struct color *)malloc(logo_width * sizeof(struct color));
if (!logo_data[i])
die("%s\n", strerror(errno));
}
/* read image data */
switch (magic) {
@@ -218,48 +236,6 @@ static inline int is_equal(struct color c1, struct color c2)
return c1.red == c2.red && c1.green == c2.green && c1.blue == c2.blue;
}
static void write_header(void)
{
/* open logo file */
if (outputname) {
out = fopen(outputname, "w");
if (!out)
die("Cannot create file %s: %s\n", outputname, strerror(errno));
} else {
out = stdout;
}
fputs("/*\n", out);
fputs(" * DO NOT EDIT THIS FILE!\n", out);
fputs(" *\n", out);
fprintf(out, " * It was automatically generated from %s\n", filename);
fputs(" *\n", out);
fprintf(out, " * Linux logo %s\n", logoname);
fputs(" */\n\n", out);
fputs("#include <linux/linux_logo.h>\n\n", out);
fprintf(out, "static unsigned char %s_data[] __initdata = {\n",
logoname);
}
static void write_footer(void)
{
fputs("\n};\n\n", out);
fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname);
fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]);
fprintf(out, "\t.width\t\t= %d,\n", logo_width);
fprintf(out, "\t.height\t\t= %d,\n", logo_height);
if (logo_type == LINUX_LOGO_CLUT224) {
fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize);
fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname);
}
fprintf(out, "\t.data\t\t= %s_data\n", logoname);
fputs("};\n\n", out);
/* close logo file */
if (outputname)
fclose(out);
}
static int write_hex_cnt;
static void write_hex(unsigned char byte)
@@ -273,6 +249,55 @@ static void write_hex(unsigned char byte)
write_hex_cnt++;
}
static void write_header(void)
{
/* open logo file */
if (outputname) {
out = fopen(outputname, "w");
if (!out)
die("Cannot create file %s: %s\n", outputname, strerror(errno));
} else {
out = stdout;
}
fputs("/*\n", out);
fputs(" * DO NOT EDIT THIS FILE!\n", out);
fputs(" *\n", out);
fprintf(out, " * It was automatically generated from %s\n", filename);
fputs(" *\n", out);
fprintf(out, " * Linux logo %s\n", logoname);
fputs(" */\n\n", out);
fputs("#include <linux/linux_logo.h>\n\n", out);
fprintf(out, "static unsigned char %s_data[] __initdata = {\n",
logoname);
}
static void write_footer(void)
{
fputs("\n};\n\n", out);
fprintf(out, "const struct linux_logo %s __initconst = {\n", logoname);
fprintf(out, "\t.type\t\t= %s,\n", logo_types[logo_type]);
if (logo_type == LINUX_LOGO_CLUT224) {
fprintf(out, "\t.clut\t\t= &(%s_clut[%ld]),\n", logoname, sizeof(clut_name));
fprintf(out, "\t.data\t\t= &(%s_data[%ld])\n", logoname, sizeof(data_name));
} else {
fprintf(out, "\t.width\t\t= %d,\n", logo_width);
fprintf(out, "\t.height\t\t= %d,\n", logo_height);
if (logo_type == LINUX_LOGO_CLUT224) {
fprintf(out, "\t.clutsize\t= %d,\n", logo_clutsize);
fprintf(out, "\t.clut\t\t= %s_clut,\n", logoname);
}
fprintf(out, "\t.data\t\t= %s_data\n", logoname);
}
fputs("};\n\n", out);
/* close logo file */
if (outputname)
fclose(out);
}
static void write_logo_mono(void)
{
unsigned int i, j;
@@ -297,6 +322,7 @@ static void write_logo_mono(void)
}
}
/* write logo structure and file footer */
write_footer();
}
@@ -343,48 +369,88 @@ static void write_logo_vga16(void)
static void write_logo_clut224(void)
{
unsigned int i, j, k;
unsigned int i, j, k;
/* validate image */
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++) {
for (k = 0; k < logo_clutsize; k++)
if (is_equal(logo_data[i][j], logo_clut[k]))
break;
if (k == logo_clutsize) {
if (logo_clutsize == MAX_LINUX_LOGO_COLORS)
die("Image has more than %d colors\n"
"Use ppmquant(1) to reduce the number of colors\n",
MAX_LINUX_LOGO_COLORS);
logo_clut[logo_clutsize++] = logo_data[i][j];
}
logo_clutsize = 0;
/* validate image */
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++) {
for (k = 0; k < logo_clutsize; k++)
if (is_equal(logo_data[i][j], logo_clut[k]))
break;
if (k == logo_clutsize) {
if (logo_clutsize == MAX_LINUX_LOGO_COLORS)
die("Image has more than %d colors\n"
"Use ppmquant(1) to reduce the number of colors\n",
MAX_LINUX_LOGO_COLORS);
logo_clut[logo_clutsize++] = logo_data[i][j];
}
}
write_hex_cnt = 0;
/* write file header */
write_header();
for (i = 0; i < sizeof(data_name); i++){
write_hex(data_name[i]);
}
write_hex((unsigned char)(logo_width >> 8));
write_hex((unsigned char)logo_width);
write_hex((unsigned char)(logo_height >> 8));
write_hex((unsigned char)logo_height);
/* write logo data */
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++) {
for (k = 0; k < logo_clutsize; k++)
if (is_equal(logo_data[i][j], logo_clut[k]))
break;
write_hex(k+32);
}
if (logo_height < MAX_LINUX_LOGO_HEIGHT || logo_width < MAX_LINUX_LOGO_WIDTH) {
if (logo_height == MAX_LINUX_LOGO_HEIGHT) {
for (i = 0; i < MAX_LINUX_LOGO_HEIGHT; i++)
for (j = logo_width; j < MAX_LINUX_LOGO_WIDTH; j++)
write_hex(32);
} else if (logo_width == MAX_LINUX_LOGO_WIDTH) {
for (i = logo_height; i < MAX_LINUX_LOGO_HEIGHT; i++)
for (j = 0; j < MAX_LINUX_LOGO_WIDTH; j++)
write_hex(32);
} else {
for (i = logo_height; i < MAX_LINUX_LOGO_HEIGHT; i++)
for (j = 0; j < MAX_LINUX_LOGO_WIDTH; j++)
write_hex(32);
for (i = 0; i < logo_height; i++)
for (j = logo_width; j < MAX_LINUX_LOGO_WIDTH; j++)
write_hex(32);
}
}
/* write file header */
write_header();
fputs("\n};\n\n", out);
/* write logo data */
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++) {
for (k = 0; k < logo_clutsize; k++)
if (is_equal(logo_data[i][j], logo_clut[k]))
break;
write_hex(k+32);
/* write logo clut */
fprintf(out, "static unsigned char %s_clut[] __initdata = {\n",
logoname);
write_hex_cnt = 0;
for (i = 0; i < sizeof(clut_name); i++){
write_hex(clut_name[i]);
}
fputs("\n};\n\n", out);
write_hex(logo_clutsize);
/* write logo clut */
fprintf(out, "static unsigned char %s_clut[] __initdata = {\n",
logoname);
write_hex_cnt = 0;
for (i = 0; i < logo_clutsize; i++) {
write_hex(logo_clut[i].red);
write_hex(logo_clut[i].green);
write_hex(logo_clut[i].blue);
}
for (i = 0; i < logo_clutsize; i++) {
write_hex(logo_clut[i].red);
write_hex(logo_clut[i].green);
write_hex(logo_clut[i].blue);
}
/* write logo structure and file footer */
write_footer();
/* write logo structure and file footer */
write_footer();
}
static void write_logo_gray256(void)