顯示具有 linux 標籤的文章。 顯示所有文章
顯示具有 linux 標籤的文章。 顯示所有文章

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);

2010/12/02

crosstool-ng

http://freshmeat.net/projects/crosstool-ng/
http://ymorin.is-a-geek.org/download/crosstool-ng/01-fixes/

$ sudo apt-get install subversion gcj g++
$ patch -p1 < 001-XXXX
$ ./configure --prefix=/opt/crosstool-ng
$ make
$ sudo make install $ echo "PATH=$PATH:/opt/crosstool-ng/bin" >> ~/.bashrc
$ source ~/.bashrc

$ mkdir ct_build
$ mkdir src
$ mkdir x-tools
$ cd ct_build
$ ct-ng arm-unknown-linux-gnueabi
$ ct-ng menuconfig

Target options --->
*** Target optimisations ***
(armv5te) Architecture level
(arm926ej-s) Emit assembly for CPU
(arm926ej-s) Tune for CPU

S3C2410/S3C2440
armv4t
arm920t
S3C2416/AT91SAM9263/AT91SAM9G45
armv5te
arm926ej-s
S3C6410
armv6
arm1176jzf-s

$ ct-ng build.2
=======================
1.cloog error
make: *** No rule to make target `/home/arthur/work/ct-atmel/targets/src/cloog-ppl-0.15.10/m4/libtool.m4', needed by `/home/arthur/work/ct-atmel/targets/src/cloog-ppl-0.15.10/Makefile.in'. Stop.

/opt/crosstool-ng/lib/ct-ng-1.9.0/scripts/build/companion_libs/c;oog.sh
diff -r 4d074e5882e5 -r be83d1a14c3d scripts/build/companion_libs/cloog.sh
--- a/scripts/build/companion_libs/cloog.sh Sun Oct 31 11:45:39 2010 +0200
+++ b/scripts/build/companion_libs/cloog.sh Thu Nov 04 18:23:35 2010 +0200
@@ -29,6 +29,7 @@
esac
CT_Pushd "${CT_SRC_DIR}/cloog-ppl${_t}"
CT_Patch nochdir "cloog-ppl" "${CT_CLOOG_VERSION}"
+ ./autogen.sh
CT_Popd
}

2.
[ALL ] In file included from ../sysdeps/unix/sysv/linux/syslog.c:10:
[ALL ] ../misc/syslog.c: In function '__vsyslog_chk':
[ALL ] ../misc/syslog.c:123: sorry, unimplemented: inlining failed in call to 'syslog': function body not available
[ALL ] ../misc/syslog.c:155: sorry, unimplemented: called from here
[ERROR] make[4]: *** [/home/arthur/work/ct-atmel/targets/arm-atmel-linux-gnueabi/build/build-libc/misc/syslog.o] Error 1

CT_LIBC_GLIBC_EXTRA_CFLAGS="-U_FORTIFY_SOURCE"

3.舊linux版會出現的error
[ERROR] /home/arthur/work/ct-2410/targets/src/linux-2.6.24/scripts/unifdef.c:209: error: conflicting types for 'getline'

root@arthur-VirtualBox:/home/arthur/work/ct-2410# find . -name 'unifdef.c'
./targets/src/linux-2.6.24/scripts/unifdef.c

+--- a/scripts/unifdef.c
++++ b/scripts/unifdef.c
+@@ -206,7 +206,7 @@ static void done(void);
+ static void error(const char *);
+ static int findsym(const char *);
+ static void flushline(bool);
+-static Linetype getline(void);
++static Linetype get_line(void);
+ static Linetype ifeval(const char **);
+ static void ignoreoff(void);
+ static void ignoreon(void);
+@@ -512,7 +512,7 @@ process(void)
+
+ for (;;) {
+ linenum++;
+- lineval = getline();
++ lineval = get_line();
+ trans_table[ifstate[depth]][lineval]();
+ debug("process %s -> %s depth %d",
+ linetype_name[lineval],
+@@ -526,7 +526,7 @@ process(void)
+ * help from skipcomment().
+ */
+ static Linetype
+-getline(void)
++get_line(void)
+ {
+ const char *cp;
+ int cursym;
+--


為工具鏈增加鏈接
$ cd arm-unknown-linux-gnueabi/bin
$ ./autoln.sh

autoln.sh是一個腳本,用來自動鏈接arm-unknown-linux-gnueabi的工具...
文件名:autoln.sh 拷到要自動建立鏈接的文件夾使用。
#!/bin/bash
#
# main
#
if [ $# -lt 1 ] ; then
echo "default path: ./"
BIN_PATH=./
else
BIN_PATH=$1
fi
if [ ! -d $1 ] ; then
echo "path error"
exit
fi
cd $BIN_PATH
SRC=`ls | awk '{print $1}'`

for i in $SRC ; do
if [ "$i" != "autoln.sh" ] ; then
#echo $i
TARGET=`echo $i | sed 's/arm-unknown-linux-gnueabi/arm-linux/g' `
echo $TARGET
ln -s $i $TARGET
fi
done

2010/11/24

embedded linux 開發常用工具及套件
1.編輯器
sudo apt-get install vim

2.GNU C/C++ Fortran編輯器及make工具
sudo apt-get install gcc build-essential fortran77-compiler make

3.GNU AWK語言支援
sudo apt-get install gawk

4.congiure及makefile 腳本自動化工具
sudo apt-get install automake autoconf

5.串列終端工具
sudo apt-get install minicom lrzsz

6.當前kernel 的headers檔案
sudo apt-get install linux-headers-$(uname -r)
*好像有改

7.text user interfaces 相關函式庫
sudo apt-get install ncurses-dev libncursesw5-dev libncurses5-dev

8.其他可能用到的工具函式
sudo apt-get install libtool bison flex texinfo binutils-dev libc6-dev linux-libc-dev

9.圖片格式轉換
sudo apt-get install netpbm libnerpbm10 libnetpbm10-dev

10.IA32-libs
sudo apt-get install ia32-libs-multiarch:i386
sudo apt-get install ia32-libs
(安裝有問題可以試sudo apt-get remove bluez ia32-libs,再重新安裝)

2010/11/18

sudo
/etc/sudoers
要使用sudo,首先是編輯/etc/sudoers

sudoers格式如下:
用戶名稱 主機名稱=(可變換的身份) 可執行的指令

arthur localhost=(hmi) /usr/bin/*
arthur只可在localhost變成hmi,並執行/usr/bin中的指令
arthur ALL=(ALL) ALL
arthur可以用任何指令
%admin ALL=(ALL) ALL
加上%符號代表群組,admin群組中的人都可以使用sudo,並執行任何指令

gksu,gksuexec
在使用圖形介面時使用gksu指令來啟動圖形介面的程式
gksu naulitus

gksuexec,在輸入指令
==================
ubuntu下修改root密碼
$ sudo su- //切換至root (需輸入目前使用者的密碼)
$ passwd //修改root的密碼

2010/06/19

PDFedit 它可以實現:書寫/創建/編輯PDF文件;
打印、保存PDF文檔;還可以把PDF文件轉化成XML等等
安裝
$sudo apt-get install pdfedit

運行PDFedit,只需輸入:
  $pdfedit /path/to/pdf.file &
  $pdfedit &

另外如只需要對pdf加註記的話,xournal 是一個不錯的選擇