2011/03/25

echo 改變顏色

echo $PATH | grep '4.2.2' > /dev/null
if [ $? = 0 ]; then
    echo -e "目前編譯環境為\033[32m[gcc 4.2.2]\033[0m"
fi

echo -e "\033[??m"
??為ANSI 顏色碼,從 man 查來的 → man 5 dir_colors
          0     to restore default color
          1     for brighter colors
          4     for underlined text
          5     for flashing text
         30     for black foreground
         31     for red foreground
         32     for green foreground
         33     for yellow (or brown) foreground
         34     for blue foreground
         35     for purple foreground
         36     for cyan foreground
         37     for white (or gray) foreground
         40     for black background
         41     for red background
         42     for green background
         43     for yellow (or brown) background
         44     for blue background
         45     for purple background
         46     for cyan background
         47     for white (or gray) background
前景背景可以一起使用,用分號隔開 Ex:echo -e "33[41;32m"

2011/03/15

Logo
安裝工具 (pngtopnm,pnmquant,pnmtoplainpnm)
# sudo get-apt install netpbm

a.========================================
# pngtopnm linuxlogo.png > linuxlogo.pnm
# pnmquant 224 linuxlogo.pnm > linuxlogo224.pnm
# pnmtoplainpnm linuxlogo224.pnm > linuxlogo224.ppm
b.==========================================
# bmptoppm linuxlogo.bmp > linuxlogo.ppm
# ppmquant 224 linuxlogo.ppm > linuxlogo.ppm 
# pnmnoraw linuxlogo.ppm > linuxlogo224.ppm  //ascii


 如何將開機logo中的游標去除

drivers/video/console/fbcon.c文件
將static void fb_flashcursor(void *private)製成空函數如下
     static void fb_flashcursor(void *private)
     {
     #if 0 //modify by yejj for clear cursor of lcdc
     struct fb_info *info = private;
     struct fbcon_ops *ops = info->fbcon_par;
     struct display *p;
     struct vc_data *vc = NULL;
     int c;
     int mode;
     .
     .
     .
     get_color(vc, info, c, 0));
     release_console_sem();
     #endif
     }
同樣的方法將函數static void fbcon_cursor(struct vc_data *vc, int mode)用空函數替換


另一種禁止光標的方法:
drivers/video/console/Makefile
#obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o softcursor.o
obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o

編譯遇到一個soft_cursor沒有定義的問題問題,註釋代碼:
drivers/video/console/bitblit.c
//ABING
//      if (err)
//              soft_cursor(info, &cursor);