Messages in this thread Patch in this message | | | Date | Fri, 7 Aug 1998 21:44:37 +0200 (MET DST) | From | Bernd Paysan <> | Subject | Linux boot logo |
| |
Hi!
Since there was some discussion about the beer-drinking penguin, I created a logo without beer (with a better scaled down penguin, sitting on the "ice" pattern from GIMP).
Most of the time I spent writing a logo-file creating program (ppm2logo), and the reverse (logo2ppm), which I want to contribute. This could be useful for Linux distributions to create their own logo with minimal effort (logos just must fit into the "221 color"/"16 colors with index 0 black and index 1 0x90 for r, g, and b", and "b/w").
I'd rather like to see a boot logo contest than discussing whether the current boot logo is "good" or even "politically correct". What about a penguin smoking a water-pipe with a hemp-leaf background for those religions where beer is considered evil ;-)?
To create a linux_logo.h file with my boot-logo, save the attached files, cd to linux/scripts, "make ppm2logo" and type
./ppm2logo <path>/boot_logo >/usr/include/linux/linux_logo.h
(you'd better save the old logo before).
Bernd Paysan "Late answers are wrong answers!" http://www.jwdt.com/~paysan/
--- linux/scripts/ppm2logo.c.orig Sun Aug 2 19:10:44 1998 +++ linux/scripts/ppm2logo.c Sun Aug 2 23:02:24 1998 @@ -0,0 +1,228 @@ +/* convert three ppm files to linux logo header */ + +#include <stdio.h> + +#define LOGO_W 80 +#define LOGO_H 80 +#define LINUX_LOGO_COLORS 221 + +int main(int argc, char ** argv, char ** env) +{ + int i; + FILE * fd; + char buf[0x100]; + if(argc < 2) { + fprintf(stderr, "Usage: %s <filename>\n", argv[0]); + exit(1); + } + sprintf(buf, "%s.ppm", argv[1]); + fd = fopen(buf, "r"); + { + unsigned char red [LINUX_LOGO_COLORS]; + unsigned char green[LINUX_LOGO_COLORS]; + unsigned char blue [LINUX_LOGO_COLORS]; + unsigned char linux_logo [LOGO_W*LOGO_H]; + unsigned char rgb[LOGO_W*LOGO_H*3]; + unsigned char buf[0x100]; + unsigned j, k = 0, l = 0; + + fgets(buf, 0x100, fd); /* should read "P6" */ + do { + fgets(buf, 0x100, fd); /* should read "#.*" */ + } while(buf[0] == '#'); + fgets(buf, 0x100, fd); /* should read "256" */ + fread(rgb, LOGO_W*LOGO_H, 3, fd); + + for(i=0; i<LOGO_W*LOGO_H*3; i+=3) { + unsigned r = rgb[i+0]; + unsigned g = rgb[i+1]; + unsigned b = rgb[i+2]; + for(j=0; j<k; j++) { + if((r == red[j]) && (g == green[j]) && (b == blue[j])) + break; + } + if(j == k) { + red [j] = r; + green[j] = g; + blue [j] = b; + k++; + } + linux_logo[l++] = j+256-224; + if(k > LINUX_LOGO_COLORS) { + fprintf(stderr, "Too many colors\n"); + exit(1); + } + } + + printf("/* $Id: linux_logo.h,v 1.3 1998/07/06 15:51:16 jj Exp $ + * include/linux/linux_logo.h: This is a linux logo + * to be displayed on boot. + * + * Created with ppm2logo, (c) 1998 by Bernd Paysan (bernd.paysan@gmx.de) + * + * You can put anything here, but: + * LINUX_LOGO_COLORS has to be less than 224 + * image size has to be 80x80 + * values have to start from 0x20 + * (i.e. RGB(linux_logo_red[0], + * linux_logo_green[0], + * linux_logo_blue[0]) is color 0x20) + * BW image has to be 80x80 as well, with MS bit + * on the left + * Serial_console ascii image can be any size, + * but should contain %%s to display the version + */ + +#if LINUX_LOGO_COLORS == 221 + +unsigned char linux_logo_red[] __initdata = {\n"); + for(i=0; i<LINUX_LOGO_COLORS-7; i+=8) { + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + red[i], red[i+1], red[i+2], red[i+3], + red[i+4], red[i+5], red[i+6], red[i+7]); + } + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", + red[i], red[i+1], red[i+2], red[i+3], red[i+4]); + printf("}; + +unsigned char linux_logo_green[] __initdata = {\n"); + for(i=0; i<LINUX_LOGO_COLORS-7; i+=8) { + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + green[i], green[i+1], green[i+2], green[i+3], + green[i+4], green[i+5], green[i+6], green[i+7]); + } + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", + green[i], green[i+1], green[i+2], green[i+3], green[i+4]); + + printf("}; + +unsigned char linux_logo_blue[] __initdata = {\n"); + for(i=0; i<LINUX_LOGO_COLORS-7; i+=8) { + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + blue[i], blue[i+1], blue[i+2], blue[i+3], + blue[i+4], blue[i+5], blue[i+6], blue[i+7]); + } + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", + blue[i], blue[i+1], blue[i+2], blue[i+3], blue[i+4]); + + printf("}; + +unsigned char linux_logo[] __initdata = {\n"); + for(i=0; i<LOGO_W*LOGO_H; i+=8) { + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + linux_logo[i], linux_logo[i+1], linux_logo[i+2], linux_logo[i+3], + linux_logo[i+4], linux_logo[i+5], linux_logo[i+6], linux_logo[i+7]); + } + printf("}; + +unsigned char linux_logo_bw[] __initdata = {\n"); + } + fclose(fd); + sprintf(buf, "%s.pbm", argv[1]); + fd = fopen(buf, "r"); + { + unsigned char linux_logo [LOGO_W*LOGO_H/8]; + unsigned char buf[0x100]; + fgets(buf, 0x100, fd); /* should read "P4" */ + do { + fgets(buf, 0x100, fd); /* should read "#.*" */ + } while(buf[0] == '#'); + fread(linux_logo, LOGO_W*LOGO_H/8, 1, fd); + for(i=0; i<LOGO_W*LOGO_H/8; i+=8) { + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + linux_logo[i], linux_logo[i+1], linux_logo[i+2], linux_logo[i+3], + linux_logo[i+4], linux_logo[i+5], linux_logo[i+6], linux_logo[i+7]); + } + printf("}; + +#endif + +#ifdef INCLUDE_LINUX_LOGO16 + +unsigned char linux_logo16_red[] __initdata = {\n"); + } + fclose(fd); + sprintf(buf, "%s16.ppm", argv[1]); + fd = fopen(buf, "r"); + { + unsigned char red [16]; + unsigned char green[16]; + unsigned char blue [16]; + unsigned char linux_logo [LOGO_W*LOGO_H]; + unsigned char rgb[LOGO_W*LOGO_H*3]; + unsigned char buf[0x100]; + unsigned j, k = 2, l = 0; + + red[0] = green[0] = blue[0] = 0; + red[1] = green[1] = blue[1] = 0x90; + + fgets(buf, 0x100, fd); /* should read "P6" */ + do { + fgets(buf, 0x100, fd); /* should read "#.*" */ + } while(buf[0] == '#'); + fgets(buf, 0x100, fd); /* should read "256" */ + fread(rgb, LOGO_W*LOGO_H, 3, fd); + + for(i=0; i<LOGO_W*LOGO_H*3; i+=3) { + unsigned r = rgb[i+0]; + unsigned g = rgb[i+1]; + unsigned b = rgb[i+2]; + for(j=0; j<k; j++) { + if((r == red[j]) && (g == green[j]) && (b == blue[j])) + break; + } + if(j == k) { + red [j] = r; + green[j] = g; + blue [j] = b; + k++; + } + linux_logo[l++] = j; + if(k > 16) { + fprintf(stderr, "Too many colors\n"); + exit(1); + } + } + + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + red[0], red[1], red[2], red[3], + red[4], red[5], red[6], red[7]); + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", + red[8], red[8+1], red[8+2], red[8+3], + red[8+4], red[8+5], red[8+6], red[8+7]); + printf("}; + +unsigned char linux_logo16_green[] __initdata = {\n"); + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + green[0], green[1], green[2], green[3], + green[4], green[5], green[6], green[7]); + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", + green[8], green[8+1], green[8+2], green[8+3], + green[8+4], green[8+5], green[8+6], green[8+7]); + + printf("}; + +unsigned char linux_logo16_blue[] __initdata = {\n"); + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X,\n", + blue[0], blue[1], blue[2], blue[3], + blue[4], blue[5], blue[6], blue[7]); + printf(" 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X\n", + blue[8], blue[8+1], blue[8+2], blue[8+3], + blue[8+4], blue[8+5], blue[8+6], blue[8+7]); + + printf("}; + +unsigned char linux_logo16[] __initdata = {\n"); + for(i=0; i<LOGO_W*LOGO_H; i+=16) { + printf(" 0x%01X%01X, 0x%01X%01X, 0x%01X%01X, 0x%01X%01X, 0x%01X%01X, 0x%01X%01X, 0x%01X%01X, 0x%01X%01X,\n", + linux_logo[i], linux_logo[i+1], linux_logo[i+2], linux_logo[i+3], + linux_logo[i+4], linux_logo[i+5], linux_logo[i+6], linux_logo[i+7], + linux_logo[i+8], linux_logo[i+9], linux_logo[i+10], linux_logo[i+11], + linux_logo[i+12], linux_logo[i+13], linux_logo[i+14], linux_logo[i+15]); + } + } + printf("}; + +#endif\n"); + fclose(fd); +} --- linux/scripts/logo2ppm.c.orig Sun Aug 2 19:10:48 1998 +++ linux/scripts/logo2ppm.c Sun Aug 2 22:57:42 1998 @@ -0,0 +1,51 @@ +/* converts linux logo to ppm */ + +#include <stdio.h> + +#define __initdata +#define LINUX_LOGO_COLORS 221 +#define INCLUDE_LINUX_LOGO16 + +#define LOGO_W 80 +#define LOGO_H 80 + +#include <linux/linux_logo.h> + +int main(int argc, char ** argv, char ** env) +{ + int i; + FILE * fd; + char buf[0x100]; + if(argc < 2) { + fprintf(stderr, "Usage: %s <filename>\n", argv[0]); + exit(1); + } + sprintf(buf, "%s.ppm", argv[1]); + fd = fopen(buf, "w"); + fprintf(fd, "P6\n# Linux Logo\n%d %d\n255\n", LOGO_W, LOGO_H); + for(i=0; i<LOGO_W*LOGO_H; i++) { + int k=linux_logo[i]-0xFC+221-1; + fprintf(fd, "%c%c%c", + linux_logo_red[k], linux_logo_green[k], linux_logo_blue[k]); + } + fclose(fd); + sprintf(buf, "%s16.ppm", argv[1]); + fd = fopen(buf, "w"); + fprintf(fd, "P6\n# Linux Logo 16 colors\n%d %d\n255\n", LOGO_W, LOGO_H); + for(i=0; i<LOGO_W*LOGO_H/2; i++) { + int k=(linux_logo16[i]>>4); + fprintf(fd, "%c%c%c", + linux_logo16_red[k], linux_logo16_green[k], linux_logo16_blue[k]); + k=(linux_logo16[i] & 0xF); + fprintf(fd, "%c%c%c", + linux_logo16_red[k], linux_logo16_green[k], linux_logo16_blue[k]); + } + fclose(fd); + sprintf(buf, "%s.pbm", argv[1]); + fd = fopen(buf, "w"); + fprintf(fd, "P4\n# Linux Logo BW\n%d %d\n", LOGO_W, LOGO_H); + for(i=0; i<LOGO_W*LOGO_H/8; i++) { + fprintf(fd, "%c", linux_logo_bw[i]); + } + fclose(fd); +} --- linux/scripts/Makefile.orig Sun Aug 2 19:12:04 1998 +++ linux/scripts/Makefile Sun Aug 2 22:57:19 1998 @@ -33,7 +33,11 @@ tkparse.o tkcond.o tkgen.o: $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $(@:.o=.c) +logo2ppm: logo2ppm.c + +ppm2logo: ppm2logo.c + clean: - rm -f *~ kconfig.tk *.o tkparse mkdep split-include + rm -f *~ kconfig.tk *.o tkparse mkdep split-include ppm2logo logo2ppm include $(TOPDIR)/Rules.make[unhandled content-type:image/x-portable-pixmap][unhandled content-type:image/x-portable-bitmap][unhandled content-type:image/x-portable-pixmap] | |