A dica vem do Sylvio César (sylvio@ios.com.br) "Bem, para quem usa o grub ou o lilo com suporte a framebuffer com certeza já percebeu o "tux" no canto superior direito, pois é aqui vai uma dica de como alterar essa imagem."
Caso voce não saiba colocar suporte a framebuffer no Grub ou no LILO, aqui vai uma tabelinha que voce pode se guiar:
# VESA framebuffer console @ 1024x768x256
# vga = 773
# Normal VGA console
# vga = normal
# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769
Se voce estiver usando LILO, basta acrescentar a linha "vga" com um valor de acordo com a tabela acima.
Ja para os que utilizam o GRUB, a opcao "vga" deve ser colocada no final da linha do kernel no /boot/grub/menu.lst
Com o GRUB ou LILO já configurados, vamos comecar a mudar nossa "figurinha"
# PASSO 1 - O arquivo do "tux" original que é visualizado durante o boot é o:
root@sylvio:~# ls /usr/src/linux/include/linux/linux_logo.h
OBS.: Para tal procedimento o pacote source do kernel deve esta instalado.
# PASSO 2 - Agora vamos substituir o "pinguim". A criacao, tratamento e finalizacao da imagem que sera utilizada esta detalhado no "PASSO 3"
Siga os passos abaixo:
root@sylvio:~# cd /usr/src/linux/include/linux/
root@sylvio:/usr/src/linux/include/linux# cp /caminho_onde_esta_sua_imagem/linux_logo-minha.h linux_logo-minha.h
root@sylvio:/usr/src/linux/include/linux# mv linux_logo.h linux_logo-original.h
root@sylvio:/usr/src/linux/include/linux# ln -s linux_logo-minha.h linux_logo.h
# PASSO 3 - Para voce poder colocar a imagem que vc desejar, faca o seguinte:
Crie sua imagem no Gimp, ou em qualquer outro da sua preferencia, salve com extensao .xpm, .gif ou .jpg e use o "convert" para "preparar a imagem para o passo final, com a seguinte sintaxe:
root@sylvio:~# convert imagem.jpg -colors 256 -geometry 96x96! imagem.xpm
Agora com a "imagem.xpm" criada pelo "convert" use o programa gen-img (o codigo dele esta no fim desse howto)
E seu uso será assim,
Copie o código e salve com o nome de gen-img.c e compile da seguinte forma:
gcc gen-img.c -o gen-img
Feito isso, agora faça:
root@sylvio:/usr/src/linux/include/linux# ./gen-img imagem.xpm imagem_final off > linux_logo-minha.h
Depois disso, basta seguir os passos acima descritos para a substituição da imagem do kernel.
# PASSO 4 - GEN-IMG.C
#---------------------------- INICIO --------------------------------------#
/*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include
#include
int
main(int argc, char *argv[])
{
FILE *fp;
char **xpm;
int lines;
char buf[16384];
if (argc != 4 || (strcmp(argv[3], "on") && strcmp(argv[3], "off"))) {
fprintf(stderr, "Usage: %s filename.xpm name on|off\n"
"\tname is the base name of variables.\n"
"\ton or off means __initdata.\n", argv[0]);
exit(1);
}
if ((fp = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "Cannot open %s\n.", argv[1]);
exit(1);
}
lines = 0;
xpm = NULL;
while (fgets(buf, sizeof(buf), fp)) {
int len = strlen(buf);
char *tmp = buf + len - 1;
if (buf[len - 1] != '\n') {
fprintf(stderr, "Line too long.\n");
exit(1);
}
if (*buf == '"') {
xpm = (char **)realloc(xpm, (lines + 1) * sizeof(char*));
while (*tmp != '"')
*tmp-- = '\0';
*tmp-- = '\0';
xpm[lines] = (char *)malloc(tmp - buf + 1);
strcpy(xpm[lines], buf + 1);
lines++;
}
}
fclose(fp);
image(argv[2], xpm, strcmp(argv[3], "off") ? "__initdata" : "");
return (0);
}
int
image(char *name, char **xpm, char *initdata)
{
int i, j, k, add;
int width, height, ncolors, cpp;
short *buf;
unsigned char *cbuf;
char *tmp;
if (strcmp(name, "linux_logo") == 0)
add = 0x20;
else
add = 0;
if (sscanf(xpm[0], "%d %d %d %d", &width, &height, &ncolors, &cpp) != 4) {
fprintf(stderr, "error reading image header\n");
exit(1);
}
for (i = 0; i < ncolors; i++) {
char *color = xpm[i + 1];
int val = color[0] | (color[1] << 8);
int cval = color[0];
for (k = 0; k < height; k++) {
if (cpp == 1) {
cbuf = (unsigned char*)(xpm[ncolors + 1 + k]);
for (j = 0; j < width; j++)
if (cbuf[j] == cval)
cbuf[j] = i;
}
else if (cpp == 2) {
buf = (short*)(xpm[ncolors + 1 + k]);
for (j = 0; j < width; j++)
if (buf[j] == val)
buf[j] = i;
}
}
tmp = strchr(xpm[i + 1] + 2, '#') + 1;
memmove(xpm[i + 1], tmp, strlen(tmp) + 1);
}
printf("#define %s_width %d\n", name, width);
printf("#define %s_height %d\n", name, height);
printf("#define %s_colors %d\n\n", name, ncolors);
printf("\
unsigned char %s_red[] %s = {", name, initdata);
for (i = 0; i < ncolors; i++) {
if ((i % 8) == 0)
printf("\n ");
printf(" 0x%c%c,", xpm[i+1][0], xpm[i+1][1]);
}
printf("\n};\n");
k = strlen(xpm[1]) > 6 ? 4 : 2;
printf("\nunsigned char %s_green[] %s = {", name, initdata);
for (i = 0; i < ncolors; i++) {
if ((i % 8) == 0)
printf("\n ");
printf(" 0x%c%c,", xpm[i+1][k], xpm[i+1][k + 1]);
}
printf("\n};\n");
printf("\nunsigned char %s_blue[] %s = {", name, initdata);
for (i = 0; i < ncolors; i++) {
if ((i % 8) == 0)
printf("\n ");
printf(" 0x%c%c,", xpm[i+1][k * 2], xpm[i+1][k * 2 + 1]);
}
printf("\n};\n");
printf("\nunsigned char %s[] %s = {", name, initdata);
for (i = 0; i < height; i++) {
if (cpp == 1) {
cbuf = (unsigned char*)(xpm[ncolors + 1 + i]);
for (j = 0; j < width; j++) {
if ((((i * width) + j) % 8) == 0)
printf("\n ");
printf(" 0x%02x,", cbuf[j] + add);
}
}
else if (cpp == 2) {
buf = (short*)(xpm[ncolors + 1 + i]);
for (j = 0; j < width; j++) {
if ((((i * width) + j) % 8) == 0)
printf("\n ");
printf(" 0x%02x,", buf[j] + add);
}
}
}
printf("\n};\n\n");
}
#---------------------------- FIM --------------------------------------#
Qualquer problema ou sugestão: sylvio@ios.com.br
Autor: Sylvio César
Administrador Linux/BSD
RHCE
» Postado por: fabio em março 9, 2004 02:29 PM, 200.192.113:
Quais são as bibliotecas??? No código GEN-IMG.C foi cortado os #includes, e tbm tudo o mais que estivesse entre > e < . Gostaria de saber tbm qual o tamanho que a imagem deve ser pixpellXpixell
» Postado por: fabio em março 9, 2004 02:30 PM, 200.192.113:
Quais são as bibliotecas??? No código GEN-IMG.C foi cortado os #includes, e tbm tudo o mais que estivesse entre > e < . Gostaria de saber tbm qual o tamanho que a imagem deve ser pixpellXpixell
O Arquivo Histórico do BR-Linux.org mantém no ar (sem alteração, exceto quanto à formatação) notícias, artigos e outros textos publicados originalmente no site na segunda metade da década de 1990 e na primeira década do século XXI, que contam parte considerável a história do Linux e do Open Source no Brasil. Exceto quando indicado em contrário, a autoria dos textos é de Augusto Campos, e os termos de uso podem ser consultados na capa do BR-Linux.org. Considerando seu caráter histórico, é provável que boa parte dos links estejam quebrados, e que as informações deste texto estejam desatualizadas.