2009年12月29日

如何在vmware workstation安裝vmware tools

http://paul.pixnet.net/blog/post/18926350

重點:
1.要開啟client系統
2.按下vmware外框的時候,會出現掛載光碟的選項
3.複製tar.gz檔案到自己的目錄下安裝
4.解壓縮
5../vmware......執行安裝腳本
6.連續按下好多的enter後就可以安裝完畢

2009年12月22日

進階linux指令

先行觀念:
kernel-->rootfs(/etc) (inittab)(使用busybox製作)-->filesystem


ctags[space]-R 建立目錄夾底下文件的(變數)標籤

cscope(GUI介面,trace code用)

vim .....c其中看函式方法:ctr+}  回來:ctr+t

find . -name "*" | xargs grep "ooxx"全文檢索(暴力法)

一般人錯誤用法:grep -rR "ooxx"這種做法會找不到


busybox也是可以menuconfig的
cd app/busybox1.3.2
make menuconfig


vim中的"/"是尋找指令(類似ctr+f)

ramfs: kernel+ramfs



vim建立tag:

:ta start_kernel
:ts

嵌入式linux重要筆記(大概吧)

在root filesystem中,裡面的/etc/init.d/rcS新增

mount /dev/sda1 /CF
chroot /CF
./init
即可不須透過手動-->rootfs-->Android可自動執行

印象中不是我去實作的,所以此筆記待確認

2009年12月12日

如何進入英文版的minicom(手動設定)

參考網址
http://www.ubuntuchina.com/viewthread.php?tid=7138


終端機輸入:
env LANG=en_US minicom

即可

若不想每次打這麼麻煩的指令,可以去修改使用者目錄底下的.bashrc

在.bashrc最後加上:
alias minicom=‘env LANG=en_US minicom

即可

2009年12月8日

phpmyadmin : 控管MySQL資料庫的PHP API 安裝設定(windows XP)

參考網址:

http://wenching520.pixnet.net/blog/post/22205918
http://any296.blogspot.com/2007/09/phpmyadmin.html

1.下載phpMyAdmin-3.2.4-all-languages.zip

http://www.phpmyadmin.net/home_page/index.php

2.眾多文件(包含index.php)解壓縮到E:\DB\www\phpmyadmin中

3.用瀏覽器輸入
localhost/phpmyadmin

會自動去找E:\DB\www\phpmyadmin\index.php執行phpmyadmin程式

4.如果沒有問題,即可進入視窗介面的SQL控管介面


當然會有問題,
在瀏覽器中出現了紅色警告:
Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

解決方法:

1.更改我的電腦上方目錄的[工具]-->[資料夾選項]-->[顯示]-->取消勾選[使用簡易檔案共用]
2.在E:\DB\temp\php按滑鼠右鍵,內容-->安全性-->權限設定成host主機名(完全控制--允許)
3.E:\DB\serv\PHP\php.ini中session.auto_start的值改為1(啟動),默認是0(禁用)。
4. E:\DB\serv\PHP\php.ini改session.save_path="E:\DB\temp\php"
5.重啟apache確認可運行
6.phpmyadmin即可在瀏覽器中輸入
localhost/phpmyadmin進入帳密(sql帳密)輸入的地方,前提是Mysql的帳號管理要做確實管理才不會有問題...



linux解法(參考用)
1.將/etc/php5/apache2/php.ini中的session.auto_start的值改為1(啟動),默認是0(禁用)。
2.在/etc/php5/apache2/php.ini找到session.save_path 這一行,設成 session.save_path = /var/lib/php/session
3.#chown vuser:vgroup /var/lib/php/session 修改該目錄的所屬用戶和組,改為apache的啟動用戶和組即可,並要有寫入的權限。
3.1. mkdir /var/lib/php
3.2. mkdir /var/lib/php/session
3.3. chown www-data:www-data /var/lib/php/session (N.B., www-data is the apache2 account in Ubuntu 8.10.)

2009年11月29日

MySQL5.1.41 以及管理者創建

解決無法看到show database中的mysql...

下載MySQL5.1.41版本
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41-win32.msi/from/pick#mirrors

安裝過程中,在MySQL Server Instance Config Wizard選項中,先選擇standard安裝,
並且記得選擇自動加入環境變數到電腦中,以及最後會要你輸入第一次的新密碼。

把C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/
之中的檔案全部複製到E:\DB\serv\Mysql\data



my.ini中修改datadir路徑:
刪掉
C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/
改為(注意斜線方向)

#Path to the database root
datadir="E:/DB/serv/Mysql/data"

CMD中進入MySQL的root帳戶:(其實在E:\DB\serv\Mysql\data目錄底下新增一個普通檔案資料夾,在下列範例中,我們新增了一個test2資料夾,就是增加一個test2的database)


C:\Documents and Settings\Jim>mysql -u root --password=密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| test2              |
+--------------------+
4 rows in set (0.00 sec)

mysql>



mysql> GRANT ALL PRIVILEGES ON *.* TO jimsql@220.132.116.19 IDENTIFIED BY '密碼';
Query OK, 0 rows affected (0.00 sec)



mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| test2              |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql;
Database changed
mysql> show tables
    -> ;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
23 rows in set (0.01 sec)

mysql> use user;
ERROR 1049 (42000): Unknown database 'user'
mysql> SELECT  user, host, password FROM user;
+--------+----------------+-------------------------------------------+
| user   | host           | password                                  |
+--------+----------------+-------------------------------------------+
| root   | localhost      | * |
| jimsql | 220.132.116.19 | * |
+--------+----------------+-------------------------------------------+
2 rows in set (0.00 sec)

mysql>







C:\Documents and Settings\Jim>mysql --user=jimsql --password=密碼
ERROR 1045 (28000): Access denied for user 'jimsql'@'localhost' (using password:
 YES)

C:\Documents and Settings\Jim>mysql --user=jimsql@localhost --password=密碼
ERROR 1045 (28000): Access denied for user 'jimsql@localhost'@'localhost' (using
 password: YES)

C:\Documents and Settings\Jim>mysql --user=root --password=密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO jimsql@localhost IDENTIFIED BY '密碼';
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;
Database changed
mysql> SELECT  user, host, password FROM user;
+--------+----------------+-------------------------------------------+
| user   | host           | password                                  |
+--------+----------------+-------------------------------------------+
| root   | localhost      | * |
| jimsql | 220.132.116.19 | *1 |
| jimsql | localhost      | * |
+--------+----------------+-------------------------------------------+
3 rows in set (0.00 sec)

mysql> exit
Bye

C:\Documents and Settings\Jim>mysql --user=jimsql --password=密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| test2              |
+--------------------+
4 rows in set (0.00 sec)

mysql>

未完 待續

請打開此網頁


2009年11月28日

mysql error 1067第二次處理文章

除了
http://jimju319.blogspot.com/2009/10/apache22-mysql-5139-php-530.html

中提到的解決方法之外,
使用mysql中的MySQL Server Instance Config Wizard設定完之後,
刪除my.ini中的default-storage-engine=INNODB

在net start mysql就可以了


參考文章:
http://www.51testing.com/?uid-155898-action-viewspace-itemid-131579

Apache注意 - 是否右下角的服務沒啟動

如果自己架設的網頁不能被別人連進來,

注意右下角的Apache圖示,滑鼠移到上面之後,
如果顯示"none of service is running"

就要重新用滑鼠右鍵按下start才可以解決。

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

解決方法:(未知原因,在此做個記錄而已,也就是重新remove和install和讀取my.ini,完全不知所云!)

C:\Documents and Settings\Jim>mysql
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)






C:\Documents and Settings\Jim>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。


C:\Documents and Settings\Jim>net stop mysql
MySQL 服務正在停止.
MySQL 服務已經成功停止。


C:\Documents and Settings\Jim>mysqld --remove
Service successfully removed.

C:\Documents and Settings\Jim>mysqld --defaults-file = my.ini

C:\Documents and Settings\Jim>net start mysql
服務名稱無效。

詳細資料,請輸入 NET HELPMSG 2185。


C:\Documents and Settings\Jim>mysqld --install
Service successfully installed.

C:\Documents and Settings\Jim>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。


C:\Documents and Settings\Jim>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.39-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

2009年11月24日

NOKIA是否有備份簡訊的軟體?

http://www.nokia.com.hk/get-support-and-software-ch/software/s60/s60-phone-and-application-download/nokia-n73

其中的第七個應用程式:
短訊存檔
《短訊存檔》能把收件匣內的全部SMS短訊以純文字檔案匯出至你指定的文件夾。該檔案更可透過藍牙或傳輸線傳送至電腦/其他裝置作備份之用

超級好用的,

使用方法:

1.把想要備份的簡訊放到"收件夾"中
2.安裝此應用程式後,執行
3.點選想要輸出的資料夾(建議:記憶卡的某個文件夾)
4.就可以透過電腦看到一堆txt檔案囉,並且方便備份!

參考資料:

2009年11月18日

EFIX 台灣較常見惡意程式清除工具 (轉貼)

http://reinfors.blogspot.com/

其實病毒這玩意,真的對一些不懂電腦的人很棘手,
但是懂電腦的人也不見得會解病毒,
就像婦產科醫生不見得懂得看牙齒,

因此就引用這篇文章,讓大家知道

真的中毒的時候,就要用最新的疫苗,不見得有效!

但是總比舊有疫苗效果好太多了!

android kernel設定 待解說

ARM System Type ->pxa2xx/pxa3xx-based
/*ARN cpu for pxa2xx and pxa3xx*/
Intel Implementations ->PXA3XX form factor platform (aka littleton)
/*Intel平台for pxa3xx (又名 littleton)*/
Thumb Instruction -> support thumb user binaries
/*對於儲存系統資料匯流排為16位的應用系統,ARM體系提供了Thumb指令集


7.ARM指令與Thumb指令的區別
答:在ARM架構中,ARM指令集中的指令是32位的指令,其執行效率很高。對于儲存系統資料匯流排為16位的應用系統,ARM體系提供了Thumb指令集。Thumb指令集是對ARM指令集的一個子集重新編碼得到的,指令長度為16位。通常在處理器執行ARM程式時,稱處理器處于ARM狀態;當處理器執行Thumb程式時,稱處理器處于Thumb狀態。Thumb指令集并沒有改變ARM體系地層的程式設計模型,只是在該模型上加上了一些限制條件。Thumb指令集中的資料處理指令的運算元仍然為32位,指令定址位址也是32位的。
http://tw.myblog.yahoo.com/blue-comic/article?mid=542&prev=546&next=533&l=f&fid=20

*/

ARM EABI ->use the ARM EABI to compile the kernel


ABI

ABI,application binary interface,應用程式和作業系統的"low-level interface"。意思是,ABI有一套規則,如果遵循這個規則產生出的object,就能在相對應的系統上正確的運作。這個規則包括了data type的size,alignment,calling convention,function參數傳遞與回傳值,system call的調用等。很明顯的,這跟平台很有關係。比如說,不管用哪一個compiler,只要能生出符合ELF格式的binary,就可以在Linux上跑,或呼叫其library。

而EABI,embedded-application binary interface則規定了embedded software program的規則。跟一般的作業系統的主要差異為: 應用程式可以使用privileged instruction,dynamic linking不是required,更簡潔的stack frame用以省下memory。

ARM EABI

而arm 的EABI有些改進,特別是floating point的運算。現在的arm應該都有實作FPA(Floating Point Accelerator),但如果compiler使用了FPU來做floting的運算,且CPU沒有FPU時,就會產生exception。其panelty會是將指令轉為software的floating運算,當然系統也就變慢了。所以支援EABI的kernel與Cross-compiler,加上支援有實作FPA的arm,performance就會好很多。

http://kezeodsnx.pixnet.net/blog


boot option ->
/*沒差啦~這是kernel的開機設定*/

floating point emulation->NWPPE math emulation
userspace binary formats->kernel support for ELF binaries
power management support
sysfs interface->?
networking ->TCP/IP networking
screen resolution ->Horizonta 640 / vertical 480
input event->event interface
keypad driver->pxa27x/pxa3xx keypad support
touchschreen driver ->WM9713 Touchscreen interface support
serial port driver ->PXA serial port support和console on pxa serial port
network file system->NFS client support
                   ->NFS client supprot for NFS version
                   ->NFS client support for NFS version4 (EXPERIMENTAL)
                   ->root file system on NFS
save an alternate configuration file

2009年11月16日

pxa300 和 release-sourceforge 的/init/fstab 比較(rootfs) pxa300 MMC卡fstab實作

延伸閱讀:
http://blog.xuite.net/travisnauto/linuxgo/19857186

E:\cygwin\home\Jim\release-sourceforge\android-pxa270\rootfs\rootfs_from_tiny_rootfs_tgz\etc\fstab

E:\cygwin\home\Jim\300\src\preview-kit\rootfs\rootfs\etc\fstab

比較過後的結果:一樣
#/dev/root  /            defaults 0 0
none   /tmp      ramfs   defaults 0 0
none   /proc     proc    defaults 0 0
none   /dev/pts  devpts  mode=0622  0 0
sysfs  /sys      sysfs   defaults   0 0
至於fstab內容的意義,請見下方解說:


引用
陈景忠的空间
http://hi.baidu.com/jingzhongchen/blog/item/8e6f552dcead7ce98b139952.html

有很多人經常修改/etc/fstab檔,但是其中卻有很多人對這個檔所表達的意義不太清楚,因為只要按照一定的模式,就可以輕而易舉地添加一行掛載資訊,而不需要完全理解其中的原理。

/etc/fstab是用來存放檔案系統的靜態資訊的檔。位於/etc/目錄下,可以用命令less /etc/fstab 來查看,如果要修改的話,則用命令 vi /etc/fstab 來修改。

當系統啟動的時候,系統會自動地從這個檔讀取資訊,並且會自動將此檔中指定的檔案系統掛載到指定的目錄。下面我來介紹如何在此檔下填寫資訊。

在這個檔下,我們要關注的是它的六個域,分別為:file system、mount point、type 、options、dump、pass。下面將詳細介紹這六個域的詳細意義。

1、file system 這裡用來指定你要掛載的檔案系統的設備名稱或塊資訊,也可以是遠端的檔案系統。做過嵌入式linux開發的朋友都可能知道 mount 192.168.1.56:/home/nfs /mnt/nfs/ -o nolock (可以是其他IP)命令所代表的意義。它的任務是把IP為192.168.1.56的遠端主機上的/home/nfs/目錄掛載到本機的/mnt/nfs /目錄之下。如果要把它寫進/etc/fstab檔中,file system這部分應填寫為:/192.168.1.56:/home/nfs/。

如果想把本機上的某個設備(device)掛載上來,寫法如:/dev/sda1、/dev/hda2或/dev/cdrom,其中,/dev/sda1 表示第一個串口硬碟的第一個分區,也可以是第一個SCSI硬碟的第一個分區,/dev/hda1表示第一個IDE硬碟的第一個分區,/dev/cdrom 表示光碟機。

此外,還可以label(標籤)或UUID(Universally Unique Identifier全域唯一識別碼)來表示。用label表示之前,先要e2label創建標籤,如:e2label /dir_1 /dir_2,其意思是說用/dir_2來表示/dir_1的名稱。然後,再在/etc/fstab下按如下形式添加:LABEL=/dir_2 /dir_2 。重啟後,系統就會將/dir_1掛載到/dir_2目錄上。對於UUID,可以用vol_id -u /dev/sdax來獲取。比如我想掛載第一塊硬碟的第十一個分區,先用命令vol_id -u /dev/sda11 來取得UUID,比如是:5dc08a62-3472-471b-9ef5-0a91e5e2c126,然後在這個域上填寫: UUID=5dc08a62-3472-471b-9ef5-0a91e5e2c126,即可表示/dev/sda11。Red Hat linux 一般會使用label,而Ubuntu linux 一般會用UUID。

2、mount point 掛載點,也就是自己找一個或創建一個dir(目錄),然後把檔案系統掛到這個目錄上,然後就可以從這個目錄中訪問要掛載檔案系統。對於swap分區,這個域應該填寫:none,表示沒有掛載點。

3、type 這裡用來指定檔案系統的類型。下面的檔案系統都是目前Linux所能支持的:adfs、befs、cifs、ext3、 ext2、ext、iso9660、kafs、minix、msdos、vfat、umsdos、proc、reiserfs、swap、 squashfs、nfs、hpfs、ncpfs、ntfs、affs、ufs。

4、options 這裡用來填寫設置選項,各個選項用逗號隔開。由於選項非常多,而這裡篇幅有限,所以不再作詳細介紹,如需瞭解,請用命令 man mount 來查看。但在這裡有個非常重要的關鍵字需要瞭解一下:defaults,它代表包含了選項rw,suid,dev,exec,auto,nouser和 async。

5、dump 此處為1的話,表示要將整個裡的內容備份;為0的話,表示不備份。現在很少用到dump這個工具,在這裡一般選0。

6、pass 這裡用來指定如何使用fsck來檢查硬碟。如果這裡填0,則不檢查;掛載點為 / 的(即根分區),必須在這裡填寫1,其他的都不能填寫1。如果有分區填寫大於1的話,則在檢查完根分區後,接著按填寫的數字從小到大依次檢查下去。同數字的同時檢查。比如第一和第二個分區填寫2,第三和第四個分區填寫3,則系統在檢查完根分區後,接著同時檢查第一和第二個分區,然後再同時檢查第三和第四個分區。




實作部分:pxa300


修改/etc/fstab內容(先行在開機init過程中做mount的動作)

新增一行:

none /tmp ramfs defaults 0 0
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
sysfs /sys sysfs defaults 0 0
/dev/mss/blk0p1 /home/jim/mountsd ext2 defaults 0 0

開機訊息:
Device major:254, first minor:0
mss/blk0: p1


[root@Linux /]#df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock2 49152 41456 7696 84% /
/dev/mss/blk0p1 30333 383 28384 1% /home/jim/mountsd
[root@Linux /]#cd /home/jim/mountsd/
[root@Linux mountsd]#ls
5465456165 jimkokokokok lost+found

2009年11月15日

pxa300 回碩教學 及 記憶體空間配置圖

參考文件:
XSBASE300-S LINUX測試手冊.pdf


1.掌握pxa300 nandflash記憶體配置

0x60000(start)

   0x200000(kernel image大小 2MB最大(tftp和下nandwrite指令時不需設定kernel image大小))

0x260000(start)

   0x3000000(filesysytem大小 39.2MB最大)

0x8000000(start)

   0x40000(wince的eboot.nb存放區)

   nk.bin存放區(類似wince 的filesystem 約22.9MB)


2.掌握重新燒寫pxa300原本kernel image方法(zImage:1.7MB)

(1)進入minicom: 在等待k7或k8選項時按下enter-->可進入blob bootloader
(2)設定ip位址:
setip server 140.129.20.45
setip client 140.129.20.156

ps.140.129.20.45為ubuntu hosy
140.129.20.156為pxa300平台的ip

(3)把kernel image檔案(zImage:1.7mb)放進host的/var/lib/tftpboot中
(4)bootloader輸入tftp zImage
會自動抓/var/lib/tftpboot中的檔案
(5)nandwrite -z 0x80800000 0x60000 0x200000
寫到flash中,重新開機即可



3.linux filesystem燒寫步驟部分,
掌握重新燒寫pxa300原本QT filesystem方法(rootfs.jffs2)

(1)進入minicom: 在等待k7或k8選項時按下enter-->可進入blob bootloader
(2)設定ip位址:
setip server 192.168.0.5
setip client 192.168.0.20

ps.192.168.0.5為ubuntu hosy
192.168.0.20為pxa300平台的ip

(3)把filesystem image檔案(rootfs.jffs2:39.2mb)放進host的/var/lib/tftpboot中
(4)bootloader輸入tftp rootfs.jffs2
會自動抓/var/lib/tftpboot中的檔案
(5)nanderase -j 0x260000 0x3000000
(6)nandwrite -j 0x80800000 0x260000 0x2740000
寫到flash中,重新開機即可

 (7)0x2740000要看filesystem的大小,要設定成比他大一點的空間
(8)重新開機後,qt會要求設定地區和時間,不過下次開機時就不用設定觸控點了(以前為啥要?)

ps.仍有問題部份,待下次解決:
1.為啥進入linux後,不定時會無法顯示觸控螢幕的畫面,但是還是可以進入filesystem,一定要在reboot一次才可以正常顯示linux畫面
2.wince的filesystem 是否為nk.bin? ans:應該是啦~反正就是wince
3.為啥pxa 300 linux中,usb插進去不能讀到檔案? ans:可讀 但還不能寫

pxa300 QT filesystem掌握,usb仍舊寫不進去資料

今天依舊有陽光,但是mmc有個怪問題 (此篇文章全部是用廠商提供的source去編譯出來的kernel+filesystem 2.6.21)

1.仿照之前做的mount /dev/mss/blk1p1 /home/jim/mountsd/掛不上去
去了pxa300的/dev下看,並沒有mms資料夾

原來原因是在未開機之前就插入mmc卡,開機後拔掉在重新插就可以看到訊息:


[root@Linux mss]#mount /dev/mss/blk0p1 /home/jim/mountsd/                      
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended          
[root@Linux mss]#cd /home/jim/mountsd/                                         
[root@Linux mountsd]#ls                                                        
jimkokokokok  lost+found


但是偵測到的卻不是之前的blk1p1了,而是blk0p1


插入usb顯示的訊息:(4gUSB用ubuntu gparted軟體格式化為ext2)
 

[root@Linux /dev]#usb 1-1: new full speed USB device using pxa3xx-ohci and addr9
usb 1-1: device not accepting address 19, error -62                            
usb 1-1: new full speed USB device using pxa3xx-ohci and address 21            
usb 1-1: configuration #1 chosen from 1 choice                                 
scsi1 : SCSI emulation for USB Mass Storage devices                            
scsi 1:0:0:0: Direct-Access     USB 2.0  USB Flash Drive  1100 PQ: 0 ANSI: 0 CCS
SCSI device sda: 7831552 512-byte hdwr sectors (4010 MB)                       
sda: Write Protect is off                                                      
sda: assuming drive cache: write through                                       
SCSI device sda: 7831552 512-byte hdwr sectors (4010 MB)                       
sda: Write Protect is off                                                      
sda: assuming drive cache: write through                                       
 sda: sda1 sda2 < sda5 >                                                       
sd 1:0:0:0: Attached scsi removable disk sda                                   
                     
[root@Linux /dev]#mount sda /home/jim/mountusb/                                
VFS: Can't find an ext2 filesystem on dev sda.                                 
FAT: invalid media value (0xb9)                                                
VFS: Can't find a valid FAT filesystem on dev sda.                             
FAT: invalid media value (0xb9)                                                
VFS: Can't find a valid FAT filesystem on dev sda.                             
mount: Mounting /dev/sda on /home/jim/mountusb failed: Invalid argument        
[root@Linux /dev]#mount sda1 /home/jim/mountusb/                               
EXT2-fs warning: checktime reached, running e2fsck is recommended              
[root@Linux /dev]#cd /home/jim/mountusb/                                       
[root@Linux mountusb]#ls                                                       
lost+found        


但是可以看見usb中的檔案卻不能寫入,奇怪


另外,幫pxa300的filesystem(Qt)作好準備,以免到時候搞壞啦

                             

 Press K7 will go to linux OS                                                  
Press K8 will go to wince OS                                                  
.                                                                             
SMC91x detected with MAC address 00-00-00-00-00-00                            
Searching for network... network found, but auto-negotiate failed.            
                                                                              
Autoboot aborted                                                              
Type "help" to get a list of commands                                         
blob> setip server 192.168.0.5                                                
Set IP to 192.168.0.5                                                         
blob> setip client 192.168.0.20                                               
Set IP to 192.168.0.20                                                        
blob> tftp rootfs.jffs2                                                       
smc_send: memory allocation time out. (要等一下子)                                         
TFTPing rootfs.jffs2*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
received 80224 blocks (41074172 bytes)                                        
tftp_cmd: file 'rootfs.jffs2' loaded via tftp to address 0x80800000.          
blob> nanderase -j 0x260000 0x3000000                                         
Erase 0x3000000 length data from flash: 0x260000                              
Erase flash from 0x260000, length 0x3000000                                   
...............................................................................e
blob> nandwrite -j 0x80800000 0x260000 0x2740000                              
Write 0x2740000 length data from RAM: 0x80800000 to flash: 0x260000           
Write flash from 0x260000, length 0x2740000                                   
Erase flash from 0x260000, length 0x2740000                                   
...............................................................................e
...............................................................................e
blob>

第一次進去時要先設定時間和地區~(沒設定也沒差)


rootfs.jffs2為放在pxa300中的rel/target/中

最後wince還是可以順利進去,接下來flash就任我搞了!


















2009年11月14日

Device /dev/ttyS0 is locked minicom

when using minicom,you get the title message
pls remove the lock file from /var/lock

sudo rm -f /var/lock

tftp安裝 littleton的config到底是啥? qvga_transfer_config() error處理

早晨起床,忽然想把pxa300網路問題搞定,於是本來在.config好好的設定檔如下

CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS0,38400 mem=64M"
改為
CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 ip=192.168.0.21:192.168.0.1::255.255.255.0::eth0:on console=ttyS0,38400 mem=64M"

同時,在~/300/src/preview-kit/linux/arch/arm/kernel/head.S中新增了bootloader問題
ENTRY(stext)
LDR r1,=0x56C

安裝tftp

sudo apt-get install tftpd-hpa xinetd
cat /etc/xinetd.conf
sudo vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

cd /etc/
jim@jim-ubuntu:/etc/default$ cat tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="no"
OPTIONS="-l -s /var/lib/tftpboot"
jim@jim-ubuntu:/etc/default$ sudo vim tftpd-hpa
jim@jim-ubuntu:/etc/default$ cat tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

jim@jim-ubuntu:/etc/default$ sudo /etc/init.d/tftpd-hpa restart
Restarting HPA's tftpd: in.tftpd.
jim@jim-ubuntu:/etc/default$ netstat -l | grep tftp
udp 0 0 *:tftp *:*

sudo chmod 777 /var/lib/tftpboot

sudo cp /home/jim/300/src/preview-kit/linux/arch/arm/boot/zIamge /var/lib/tftpboot
sudo chmod 777 zImage

把zIMage寫進flash中開機會卡
Starting kernel at 0x80800000...

Uncompressing Linux...
we will gunzip the kernel 1.
................................................................................
done, booting the kernel.

把r1砍掉,在~/300/src/preview-kit/linux/arch/arm/kernel/head.S中
ENTRY(stext)
LDR r1,=0x56C


還是一樣
Starting kernel at 0x80800000...                                               
                                                                               
Uncompressing Linux...                                                         
we will gunzip the kernel 1.                                                   
................................................................................
 done, booting the kernel.  卡住啦

修改.config
CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 ip=192.168.0.20:192.168.0.5::255.255.255.0::eth0:on console=ttyS0,38400 mem=64M"

仍卡住同地方

修改.config(最原本的)
CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS0,38400 mem=64M"

還是一樣!哇哩咧!!!

讀取在arch/arm/configs/中的
littletonl-org_defconfig
重新編譯

arch/arm/mach-pxa/littleton.c: In function 'littleton_irda_transceiver_mode':
arch/arm/mach-pxa/littleton.c:377: error: 'MFP_PIN_GPIO137' undeclared (first use in this function)
arch/arm/mach-pxa/littleton.c:377: error: (Each undeclared identifier is reported only once
arch/arm/mach-pxa/littleton.c:377: error: for each function it appears in.)
make[1]: *** [arch/arm/mach-pxa/littleton.o] Error 1
make: *** [arch/arm/mach-pxa] Error 2

trace code找不到0137這行,只好先讀取別的config
/home/jim/300/src/preview-kit/linux/arch/arm/configs/littletonlv_defconfig

但是!
In file included from include/asm/arch/hardware.h:142,
                 from include/asm/hardware.h:16,
                 from include/asm/arch/io.h:9,
                 from include/asm/io.h:76,
                 from init/main.c:58:
include/asm/arch/littleton.h:768:2: error: #error "please define MFP pins for your platform!"
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2

換成littletonl_old_defconfig試試看
/home/jim/300/src/preview-kit/linux/arch/arm/configs/littletonl_old_defconfig


rch/arm/mach-pxa/littleton.c: In function 'littleton_irda_transceiver_mode':
arch/arm/mach-pxa/littleton.c:377: error: 'MFP_PIN_GPIO137' undeclared (first use in this function)

看來不解決這個MFP_PIN_GPI0137不行了

回過頭來載入
/home/jim/300/src/preview-kit/linux/arch/arm/configs/littletonl_defconfig
載入後觀察一下是怎樣才可以pass的:
編譯訊息如下:
arch/arm/mach-pxa/clock.o
  CC      arch/arm/mach-pxa/generic.o
arch/arm/mach-pxa/generic.c: In function 'pxa_set_cken':
arch/arm/mach-pxa/generic.c:230: warning: left shift count >= width of type
  CC      arch/arm/mach-pxa/irq.o
  CC      arch/arm/mach-pxa/dma.o
  CC      arch/arm/mach-pxa/time.o
  CC      arch/arm/mach-pxa/pxa3xx.o
  CC      arch/arm/mach-pxa/mfp.o
  CC      arch/arm/mach-pxa/pxa3xx_gpio.o
  CC      arch/arm/mach-pxa/littleton.o
(等等再來處理)

燒入image後,卡在LCD的地方
turn off/on LCD                                                                
Configuring Littleton LCD panel...                                             
qvga_pass_through_mode                                                         
qvga_transfer_config()                                                         
Console: switching to colour frame buffer device 30x20


用今日最強指令:
find . -name "*" | xargs grep "搜尋字串"
在根目錄找"qvga_transfer_config",發現存在於~/300/src/preview-kit/linux/arch/arm/mach-pxa/littleton.c

旁邊有個函式"vga_transfer_config"
看樣子是不用去動這些所謂的board.c檔案了,乾脆直接修改.config檔

#
# Frame buffer hardware drivers
#
# CONFIG_FB_S1D13XXX is not set
CONFIG_FB_PXA=y
CONFIG_FB_PXA_MINILCD=y
# CONFIG_FB_PXA_LCD_QVGA is not set
CONFIG_FB_PXA_LCD_VGA=y

於是就通過了難關~
Configuring Littleton LCD panel...                                             
vga_transfer_mode()                                                            
SCSI subsystem initialized                                                     
usbcore: registered new interface driver usbfs                               

最後有留下可用的.config和kernel image(1.7MB)放在
/home/jim/used_data/pxa300/091115_finish_in_home

pxa300 檢測 處理MMC問題

環境:Wingows XP sp3
平台測試:Marvell pxa300 (littleton)

1.xp中的超級終端機設定:
使用連線:COM1
每秒傳輸位元:38400
資料位元:8
同位檢查:無
停止位元:1
流量控制:無

設定完畢後,打開px300電源,即可看到開機畫面

2.
錄音功能正常(需外接麥克風)
喇叭正常(沒有外接擴音器)
喇叭正常(有外接擴音器)

3.
usb鍵盤正常,不過有接鍵盤的情況下,觸控螢幕會失去作用(開機時並沒有要求需要點測試點)
一拔掉usb鍵盤後,觸控功能即恢復(須重新開機)

4.
SD卡無效,看不見檔案

5.
usb隨身碟可用,但要有開機磁區才行


Your choice [1,2,3,4,5,6,7,8,9,A,B,C,D,E,S,H,Q] >8
Test USB port .....................

VFS: Can't find an ext2 filesystem on dev sda1.

Test result:
The usb disk test correct, the content of usb:
ls: /mnt/usb/台北大學.ppt: No such file or directory
ls: /mnt/usb/大學會~1.ppt: No such file or directory
ls: /mnt/usb/大學會~1.rar: No such file or directory
ls: /mnt/usb/北大歡姆.doc: No such file or directory
ls: /mnt/usb/守位前輩.doc: No such file or directory
ls: /mnt/usb/網站製~1.3開: No such file or directory
ls: /mnt/usb/網站製~1.htm: No such file or directory
______~1      db-hw-~1.doc  mysql~1.htm   ubuntu~1      作業程序
___roo~1      for091~1      npp55i~1.exe  ubuntu~1.rar  桌面.7z
a12935~1.pdf  init          source        五年一~1.doc
ashmem        linux-~1.gz   trash-~1      卡持緲.doc
Please confirm the result, and hit the keyboard again >read: 328: arg count



嘗試掛載usb,但是失敗囉~

[root@Linux /test]#df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock2           49152     40300      8852  82% /
[root@Linux /test]#cd /dev/mtdblock2
cd: 249: can't cd to /dev/mtdblock2

[root@Linux /test]#mount /dev/mtdblock2 /home/jim
VFS: Can't find an ext2 filesystem on dev mtdblock2.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev mtdblock2.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev mtdblock2.
mount: Mounting /dev/mtdblock2 on /home/jim failed: Invalid argument


6.電量ok

Your choice [1,2,3,4,5,6,7,8,9,A,B,C,D,E,S,H,Q] >b
Test battery.........................

the date read from is 255
the battery is 100 percent
the date read from is 255
the battery is 100 percent
the date read from is 255
the battery is 100 percent
the date read from is 255
the battery is 100 percent

7.解決minicom亂碼問題(家用主機一樣是ttyS0)
env LANG=env_US minicom -s
*A - Serial device : /dev/ttyS0
*E - (串口速度): 115200 bps,
8N1,
No,
No.

8.目標:順利在pxa300中mount MMC卡(32MB)
8.1.
把MMC卡放入pxa300中,不能順利mount
8.2.
於是把MMC卡用ubuntu的gparted格式化,卻沒想到越切越小(31MB到23MB)
8.3.
回到xp底下使用hp格式化工具把MMC卡還原成31MB(正常大小)
8.4.
到ubuntu的gparted工具格式化為ext2格式
8.5.
插入MMC卡的訊息:
[root@Linux /]#Device major:254, first minor:8                                 
 mss/blk1: p1                                                                  
                                                                               
[root@Linux /]#cd /dev/mss/                                                    
[root@Linux mss]#ls                                                            
blk1    blk1p1                                                                 
[root@Linux mss]#mount /dev/mss/blk1p1 /home/jim/mountsd/                      
EXT2-fs warning: checktime reached, running e2fsck is recommended              
[root@Linux mss]#cd /home/jim/mountsd/                                         
[root@Linux mountsd]#ls                                                        
jimkokokokok  lost+found                                                       
[root@Linux mountsd]#vi /etc/fstab
#/dev/root              /                               defaults        0 0
none                    /tmp                    ramfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/pts                devpts  mode=0622       0 0
sysfs                   /sys                    sysfs   defaults        0 0

/dev/mss/blk0 /home/jim/mountsd msdos defaults 0 0

8.6.fstab似乎不用去動他...總之成功了


http://www.mdn.idv.tw/viewtopic.php?f=11&t=101&start=30&st=0&sk=t&sd=a

2009年11月12日

pxa300原始碼scripts/mod/sumversion.c error: `PATH_MAX' undeclared

在 ~/300/src/preview-kit/linux/打入sudo make zImage後發生error:

HOSTCC  scripts/mod/sumversion.o
scripts/mod/sumversion.c: In function `get_src_version':
scripts/mod/sumversion.c:384: error: `PATH_MAX' undeclared (first use in this function)
scripts/mod/sumversion.c:384: error: (Each undeclared identifier is reported only once
scripts/mod/sumversion.c:384: error: for each function it appears in.)
scripts/mod/sumversion.c:384: warning: unused variable `filelist'
make[2]: *** [scripts/mod/sumversion.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2

solution:

 
~/300/src/preview-kit/linux/scripts/mod$ vim sumversion.c
新增 #include 


#include 
#include 
#include "modpost.h"
#include 


如何與電腦和平共處?

外科醫生進去開刀房後,所表現出來的態度絕對不是緊張,
而是謹慎。

當電腦有故障問題的時候,我們不能單純地抱怨,抱怨為什麼電腦這麼爛,
但是電腦這玩意可不像古早電視,左敲敲右敲敲就可以了,
一旦沒有處理妥當,(爆炸機率少之又少),可能就要花不少冤枉錢。

以下提供幾點,讓大家可以在面對電腦不聽話的時候,當一個最會照顧病患的護士:

1.遊戲安裝好後卻不能玩?
ans:
首先檢查是哪邊出問題,像是螢幕閃爍,錯誤訊息,進遊戲後馬上跳出,硬體問題?

2.開心農場網頁開不起來?
ans:
檢查電腦屁股的網路線有沒有插好,其他網站可不可以上網,或是開心農場遠端的主機是不是正在維修,晚點再玩?

3.電腦會自動重新開機
ans:
總電源是否負擔太重?是不是中毒了?還是剛剛有安裝什麼應用程式衝到了?

4.電腦用久之後會變慢
ans:
是不是太久沒有做電腦的"重組"了?硬碟容量夠用嗎?


小結:
其實流程就是,電腦怪怪的-->找出哪邊怪怪的-->說明/找出原因-->冷靜維修

和看病差不多,人不舒服-->感覺哪裡不舒服-->跟醫生說哪裡不舒服-->乖乖吃藥!!

傳說中的"nk.bin"

早晨頭腦正清醒,夢見了為啥linux的root filesystem為何沒有獨立出來?
於是想說知己知彼~百戰百勝,首先要摸清WinCE的底細,
於是乎,首先我們的敵人是,傳說中的"nk.bin"

1.
WinCE驅動程式學習雜記
http://jusweny.spaces.live.com/blog/cns!88C641BFCCD350D4!2202.entry?sa=901009079


(1.)影像檔建構程序:(1)Sysgen;(2)Build;(3)Buildrel;(4)makeimage

(2.)產生的影像檔為nk.bin,若要下載到BSP,需要板上已經有boot loader,否則需要先查BSP的boot loader燒錄方法,將boot loader燒入。

(3.)產生影像檔時makeimg.exe會呼叫:(1)cenlscmp.exe(2)fmerge.exe(3)regcomp.exe(4)txt2ucde.exe(5)romimage.exe,讀取ce.bib檔案以結合需要檔案成為nk.bin


nk.bin和nk.nb0文件格式分析
http://prothesworld.spaces.eepw.com.cn/articles/article/item/38667


Romimage.exe is a locator application that creates Windows CE binary image (.bin) files, usually limited to a single file called Nk.bin. This means that Romimage

             Reads Ce.bib to determine which %_FLATRELEASEDIR% binaries and files to include in the run-time image.

             Assigns physical memory addresses to these binaries and files.

             Creates the run-time image Nk.bin.


進階文章:解析NK.BIN
http://blog.csdn.net/shuiii/archive/2008/02/27/2125138.aspx

2.總而言之,pxa300上面已經平均地把兩區128MB各分配給linux和wince了(nand flash總大小,256MB),nk.bin就不深入研究啦~

inittab和rcS初探

本來只是想說要看pxa300啟動時跑的畫面的,結果...

BusyBox v1.01 (2006.08.31-08:53+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
Processing /etc/profile... Done


找到了/etc/profile
E:\cygwin\home\Jim\300\rel\target\rootfs_from_rootfs_tar_gz\etc\profile
echo
echo -n "Processing /etc/profile... "
export QTDIR="/usr/qpe"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:/lib:/usr/qpe/lib:/lib/lib"

export HOSTNAME="$(hostname)"

export OLDPWD=/root
export HOME=/root

後來又想到之前提過的init和rcS檔,所以就翻了一下學長論文,其中提到
Linux kernel 在執行完系統初始化設定(包含設置記憶體、Scheduler、中斷向量表 載入驅動程式等等) 之後,會將控制權以 kernel thread 的形式轉移給 user space的第一個程式:init

在 Embedded Linux 的環境下,init 一般包含於 busybox 中

當Linux kernel將控制權轉移給init時,init會讀取/etc下的相關檔案,一般是讀取/etc/inittab,再由/etc/inittab引入/etc/init.d/rcS等相關檔案執行系統環境的設定及初始化的動作,包含掛載檔案系統、執行相關應用程式及產生shell讓使用者可以透過特定指令與作業系統互動;busybox透過以上的流程來完成系統最後的相關設定。


於是就跑去研究了一下busybox,inittab的語法(和pc上的busybox不太一樣)

Understanding Busybox Inittab
http://linuxembedded.blogspot.com/2006/11/understanding-busybox-inittab.html

BusyBox init 详解
http://blog.chinaunix.net/u3/100239/showart_2035495.html

busybox的init初始化进程
http://linux.chinaunix.net/techdoc/net/2009/02/11/1061665.shtml

其實在busybox的目錄下就有一個inittab範例,說明都寫得很詳細了
E:\cygwin\home\Jim\release-sourceforge\android-pxa270\app\busybox-1.6.1\examples\inittab
用pxa300的inittab和學長的tiny rootfs的inittab比較過後,發現長得差不多

E:\cygwin\home\Jim\300\rel\target\rootfs_from_rootfs_tar_gz\etc\inittab
::sysinit:/etc/init.d/rcS
ttyS0::respawn:-/bin/sh
#ttyS2::respawn:-/bin/sh
#tty1::respawn:-/bin/sh
#tty2::respawn:-/bin/sh
::ctrlaltdel:/bin/umount -a -

E:\cygwin\home\Jim\release-sourceforge\android-pxa270\rootfs\rootfs_from_tiny_rootfs_tgz\etc\inittab
::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
#::once:-/bin/sh
#ttyS0::respawn:-/bin/sh
#ttyS2::respawn:-/bin/sh
#tty1::respawn:-/bin/sh
#tty2::respawn:-/bin/sh
::ctrlaltdel:/bin/umount -a -
看完後,摸摸腦袋,還是不太了解,總之inittab之後要執行的就是rcS啦,到時候會把要開機所做的事情都放在那邊,設定路徑等等的...


E:\cygwin\home\Jim\release-sourceforge\android-pxa270\rootfs\rootfs_from_tiny_rootfs_tgz\etc\init.d\rcS
#! /bin/sh

# Set the path
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

hostname -F /etc/HOSTNAME

# mount proc and devpts filesystem
/bin/mount -a
mount -o remount,rw /dev/root /

if [ -n "$IN_INITLOG" ]; then
    IN_INITLOG=
fi

if [ ! -f /etc/HOSTNAME ]; then
    echo ${HOSTNAME} > /etc/HOSTNAME
fi

touch /var/log/wtmp
chmod 0664 /var/run/utmp /var/log/wtmp

# Delete stale subsystem files.
rm -f /var/lock/subsys/*

# Delete stale pid files
rm -f /var/run/*.pid

# Load modules
if [ -f /etc/rc.d/rc.modules ]; then
 /etc/rc.d/rc.modules
fi

/etc/init.d/rc.local

Linux開機流程 - 從CONFIG_DEBUG_LL開始談起

利用CONFIG_DEBUG_LL除錯

在網路上查詢CONFIG_DEBUG_LL的結果
http://cateee.net/lkddb/web-lkddb/DEBUG_LL.html
arch/arm/Kconfig

The configuration item CONFIG_DEBUG_LL:

prompt: Kernel low-level debugging functions

type: tristate(三種選擇:yes/no/module)
depends on: CONFIG_DEBUG_KERNEL
(要先選擇此depend後才能有CONFIG_DEBUG_LL選項)


defined in arch/arm/Kconfig
found in Linux Kernels: before 2.6.0 version still available on 2.6.31 release
Help text

Say Y here to include definitions of printascii, printchar, printhex in the kernel. This is helpful if you are debugging code that executes before the console is initialized.

研讀Android 2.6.25原始碼後,亦有DEBUG_LL,存在於Kconfig.debug中
(但是在學長的creator_android_pxa270_defconfig裡面並沒有把此項選擇yes)

release-sourceforge\android-pxa270\kernel\linux-2.6.25-android-1.0_r1\arch\arm\Kconfig.debug
# These options are only for real kernel hackers who want to get their hands dirty.
config DEBUG_LL
 bool "Kernel low-level debugging functions"
 depends on DEBUG_KERNEL

不過在pxa300中的config檔案中就有出現了

所以要解決的事情是:
使pxa300開機時,bootloader和kernel中的machine type號碼要一致

1.到\300\src\preview-kit\linux\arch\arm\tools\mach-types
查看littleton的號碼為:1388,用小算盤換成16進制,0x56C



2.修改\300\src\preview-kit\linux\arch\arm\kernel\head.S中,ENTRY(stext)底下新增一行
LDR     r1,=0x56C


(應該可以吧...還沒測試)

2009年11月11日

Kconfig 和 Makefile (Linux device driver初學)

Kconfig 和 Makefile

目標:
把驅動程式加入到可選擇的menuconfig中!

所需檔案:
pxa300原始碼
lt_backlight.c(driver source code)

1.把lt_backlight.c放進E:\cygwin\home\Jim\300\src\preview-kit\linux\drivers\char中

2.在同目錄底下E:\cygwin\home\Jim\300\src\preview-kit\linux\drivers\char的Kconfig要加入以下設定
config LITTLETON_BACKLIGHT
 bool "backlight driver for Littleton Platform"
 depends on PXA3xx && MACH_LITTLETON && PXA3xx_MICCO
 help
   Please say Y here if want to support LCD/Keypad backlight
   auto-off/auto-dim for Littleton Platform

3.在同目錄底下E:\cygwin\home\Jim\300\src\preview-kit\linux\drivers\char的Makefile要增加編譯


obj-$(CONFIG_LITTLETON_BACKLIGHT) += lt_backlight.o


另外,如何解釋這三個步驟呢?

一開始只有去看littletonl_defconfig(pxa300的預設config檔)

E:\cygwin\home\Jim\300\src\preview-kit\linux\arch\arm\configs\littletonl_defconfig

但後來發現它會自動產生autoconf.h

E:\cygwin\home\Jim\300\src\preview-kit\linux\include\linux\autoconf.h

在littletonl_defconfig之中,有這麼一行:

CONFIG_LITTLETON_BACKLIGHT=y

搭配上本書內容,於是找到了\300\src\preview-kit\linux\drivers\char\Makefile

obj-$(CONFIG_LITTLETON_BACKLIGHT) += lt_backlight.o
當littletonl_defconfig被選擇成要編進kernel的時候,就編譯成.obj檔

於是大約瞭解了添加driver的步驟

vim 的環境設定 ( vimrc ) (引用)

引用網址:
http://greenisland.csie.nctu.edu.tw/wp/2005/09/21/341/

最近喜歡上vim了,強大的文書編輯功能(?),打垮微軟的word(?)
話不多說,此篇是介紹如何修改在xp底下的gvim編輯器設定,
包括:
換行時自動鍵入tab, 為每一行前增加行數, 標記顏色等...
(雙引號" 後面可以加上註解)


以下是我在E:\Program Files\Vim\_vimrc檔案裡面增加的設定!(夠用就好 花招別太多)

"ai is auto-tab.
set ai

set ic

"this lien is presenting line's number
set number

"this line is marking tag's color.
set nohls

想知道更多的可以看此篇引用網站喔!

修正 Ubuntu 9.04 (Jaunty Jackalope) 中文字型模糊 (引用)

http://justintime545.blogspot.com/2009/05/ubuntu-904-jaunty-jackalope.html

修改
/etc/fonts/conf.d/69-language-selector-zh-tw.conf

<fontconfig>

        <match target="pattern">
                <test qual="any" name="family">
                        <string>serif</string>
                </test>
                <edit name="family" mode="prepend" binding="strong">
                        <string>AR PL UMing TW</string>
                        <string>AR PL ShanHeiSun Uni</string>
                        <string>WenQuanYi Bitmap Song</string>
                        <string>Bitstream Vera Serif</string>
                        <string>DejaVu Serif</string>
                        <string>AR PL UKai TW</string>
                        <string>AR PL ZenKai Uni</string>
                </edit>

        </match>
        <match target="pattern">
                <test qual="any" name="family">
                        <string>sans-serif</string>
                </test>
                <edit name="family" mode="prepend" binding="strong">
                        <string>Bitstream Vera Sans</string>
                        <string>DejaVu Sans</string>
                        <string>AR PL UMing TW</string>
                        <string>AR PL ShanHeiSun Uni</string>
                        <string>WenQuanYi Bitmap Song</string>
                        <string>WenQuanYi Zen Hei</string>
                        <string>AR PL UKai TW</string>
                        <string>AR PL ZenKai Uni</string>
                </edit>

        </match>
        <match target="pattern">
                <test qual="any" name="family">
                        <string>monospace</string>
                </test>
                <edit name="family" mode="prepend" binding="strong">
                        <string>Bitstream Vera Sans Mono</string>
                        <string>DejaVu Sans Mono</string>
                        <string>AR PL UMing TW</string>
                        <string>AR PL ShanHeiSun Uni</string>
                        <string>WenQuanYi Bitmap Song</string>
                        <string>WenQuanYi Zen Hei</string>
                        <string>AR PL UKai TW</string>
                        <string>AR PL ZenKai Uni</string>
                </edit>

        </match>

</fontconfig>

ctags指令學習:其一

Ctrl+] " 根據游標所在位置的字串常做關鍵字,跳進去(快速鍵:tj)。
Ctrl+t " 跳出來。
:tselect " 當有多個關鍵字在tags file中被找到時,可用tselect來選。
:tags " 查看現跳到那裡了快速鍵:ta)。
:tnext " 跳到下一個被找到的tag(快速鍵:tn)。
:tprev "跳到前一個被找到的tag(快速鍵:tp)。

推薦資料:

打造自己的VIM: 源碼追蹤(ctags+cscope)及預覽視窗SrcExpl
http://rickey-nctu.blogspot.com/2009/02/vim-srcexpl.html


預定下次目標,學會只用csope或是taglist

2009年11月10日

Linux kernel linux-2.6.15.5.tar.bz2 啟動流程(i386)

kernel:linux-2.6.15.5.tar.bz2

配合Linux裝置驅動程式之開發詳解一書3.4章節閱讀

必備工具知識:vim,ctags使用,vim中可使用"/"來搜尋字串,並用"n"來搜尋下一個字串

i386中
1.bzImage被呼叫時,從/arch/i386/boot/setup.S的start:開始執行,並進行一些基本硬體設定
start:
jmp     trampoline

# This is the setup header, 
and it must start at %cs:2 (old 0x9020:2)

.ascii  "HdrS"          # header signature

2.接著呼叫/arch/i386/boot/compressed/head.S
# jump to startup_32 in arch/i386/boot/compressed/head.S
3./arch/i386/boot/compressed/head.S之中有個startup_32常式,其主要功能為設定基本的執行環境,如堆疊,之後清除BSS段,並呼叫/arch/i386/boot/compressed/misc.c的decompress_kernel()解壓縮核心到記憶體,再跳到新的kernel

(/arch/i386/boot/compressed/head.S)
.globl startup_32

startup_32:
cld
cli
movl $(__BOOT_DS),%eax
movl %eax,%ds

/*
* Clear BSS
*/
xorl %eax,%eax
movl $_edata,%edi
movl $_end,%ecx
subl %edi,%ecx
cld
rep
stosb
......
/*
* Do the decompression, and jump to the new kernel..
*/
......
call decompress_kernel


(/arch/i386/boot/compressed/misc.c)

asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode)
{
real_mode = rmode;

if (RM_SCREEN_INFO.orig_video_mode == 7) {
vidmem = (char *) 0xb0000;
vidport = 0x3b4;
} else {
vidmem = (char *) 0xb8000;
vidport = 0x3d4;
}

lines = RM_SCREEN_INFO.orig_video_lines;
cols = RM_SCREEN_INFO.orig_video_cols;

if (free_mem_ptr < 0x100000) setup_normal_output_buffer();
else setup_output_buffer_if_we_run_high(mv);

makecrc();
putstr("Uncompressing Linux... ");
gunzip();
putstr("Ok, booting the kernel.\n");
if (high_loaded) close_output_buffer_if_we_run_high(mv);
return high_loaded;
}
4.核心被解壓縮到記憶體後,會再呼叫/arch/i386/kernel/head.S的startup_32常式,會初始化page table,並啟用記憶體分頁機制
ENTRY(startup_32)
5.而上述做完之後,/init/main.c的start_kernel()被呼叫,進入和平台架構無關的linux核心部份,此時呼叫一堆初始化函式來設定中斷,和進一步的記憶體設定
/*
*      Activate the first processor.
*/

asmlinkage void __init start_kernel(void)
{
6.而/arch/i386/kernel/process.c中kernel_thread()啟動第一個核心thread,此執行緒執行init(),再來呼叫cpu_idle()等待排程 ?????? 7./init/main.c此時為核心執行緒,完成週邊設備和其driver的載入和初始化,和掛載根目錄,他會搜索檔案系統裡面的init程式,並使用execve()系統呼叫來執行init程式,順序為如下:
run_init_process("/sbin/init");
run_init_process("/etc/init");
run_init_process("/bin/init");
run_init_process("/bin/sh");
ps.多數情況下,嵌入式系統可以給核心傳入一個簡單的shell命令搞(script)來啟動必須的嵌入式應用程式 到目前為止,慢長得LInux核心初始化和啟動過程就結束了,而init()對應的,和由start_kernel()創見的第一個執行緒也進入使用者模式

loopback深入淺出解釋

......loopback,說白了就像PC機上的lo介面一樣,是機器虛擬出來的一個介面。

......loopback就是回環(自己發,自己收),有兩種實現方法,一是邏輯另一種是物理回環。



我到許多有關127.0.0.1這個ip的說明都說這個ip是用來作為本機回路的測試!
我不懂回路測試到底在作什麼?為什麼要作回路測試?

 Ans:
不用想那麼複雜,loopback 就是自己。



您可叫自己是 "" ,別人也可叫自己是 ""...
雖然都是人,但此人不同彼人。

延伸概念:
您的機器叫自己為 loopback ,別的機器也可稱自己為 loopback
雖然都是 loopback,但此 loopback 不同彼 loopback

若您瞭解一個 connetction 就是 A output B input 的話,
那麼,一個 loopback connection output input 都是自己。

pxa300 mkrootfs.sh 閱讀筆記

(300\src\preview-kit\busybox\busybox-1.01\examples\bootfloppy\mkrootfs.sh)


#!/bin/bash
#
# mkrootfs.sh - creates a root file system


此檔為建立file system的腳本

# TODO: need to add checks here to verify that busybox, uClibc and bzImage
# exist


# command-line settable variables
設定busybox和uclibc的目錄夾
BUSYBOX_DIR=..
UCLIBC_DIR=../../uClibc
TARGET_DIR=./loop
FSSIZE=4000
CLEANUP=1
MKFS='mkfs.ext2 -F'

# don't-touch variables
BASE_DIR=`pwd`


while getopts 'b:u:s:t:Cm' opt
do
case $opt in
b) BUSYBOX_DIR=$OPTARG ;;
u) UCLIBC_DIR=$OPTARG ;;
t) TARGET_DIR=$OPTARG ;;
s) FSSIZE=$OPTARG ;;
C) CLEANUP=0 ;;
m) MKFS='mkfs.minix' ;;
*)
echo "usage: `basename $0` [-bu]"
echo " -b DIR path to busybox direcory (default ..)"
echo " -u DIR path to uClibc direcory (default ../../uClibc)"
echo " -t DIR path to target direcory (default ./loop)"
echo " -s SIZE size of root filesystem in Kbytes (default 4000)"
echo " -C don't perform cleanup (umount target dir, gzip rootfs, etc.)"
echo " (this allows you to 'chroot loop/ /bin/sh' to test it)"
echo " -m use minix filesystem (default is ext2)"
exit 1
;;
esac
done




# clean up from any previous work
清除了之前殘留的檔案
mount | grep -q loop
[ $? -eq 0 ] && umount $TARGET_DIR
[ -d $TARGET_DIR ] && rm -rf $TARGET_DIR/
[ -f rootfs ] && rm -f rootfs
[ -f rootfs.gz ] && rm -f rootfs.gz


# prepare root file system and mount as loopback
準備loopback??
dd if=/dev/zero of=rootfs bs=1k count=$FSSIZE
$MKFS -i 2000 rootfs
mkdir $TARGET_DIR
mount -o loop,exec rootfs $TARGET_DIR # must be root


# install uClibc
安裝uClibc和複製一些.so檔
mkdir -p $TARGET_DIR/lib
cd $UCLIBC_DIR
make INSTALL_DIR=
cp -a libc.so* $BASE_DIR/$TARGET_DIR/lib
cp -a uClibc*.so $BASE_DIR/$TARGET_DIR/lib
cp -a ld.so-1/d-link/ld-linux-uclibc.so* $BASE_DIR/$TARGET_DIR/lib
cp -a ld.so-1/libdl/libdl.so* $BASE_DIR/$TARGET_DIR/lib
cp -a crypt/libcrypt.so* $BASE_DIR/$TARGET_DIR/lib
cd $BASE_DIR


# install busybox and components
安裝busybox和元件
cd $BUSYBOX_DIR
make distclean
make CC=$BASE_DIR/$UCLIBC_DIR/extra/gcc-uClibc/i386-uclibc-gcc
make PREFIX=$BASE_DIR/$TARGET_DIR install
cd $BASE_DIR


# make files in /dev
mkdir $TARGET_DIR/dev
./mkdevs.sh $TARGET_DIR/dev


# make files in /etc
cp -a etc $TARGET_DIR
ln -s /proc/mounts $TARGET_DIR/etc/mtab


# other miscellaneous setup
建立initrd和proc目錄
mkdir $TARGET_DIR/initrd
mkdir $TARGET_DIR/proc


# Done. Maybe do cleanup.
if [ $CLEANUP -eq 1 ]
then
umount $TARGET_DIR
rmdir $TARGET_DIR
gzip -9 rootfs
fi


為了瞭解什麼是.so檔(share object)

預備知識:
1.程式Compile流程
http://www.prudentman.idv.tw/2008/05/compile.html

2.Chapter 4. GNU Compiler Collection(此篇很難...看不太懂)
http://www.study-area.org/cyril/opentools/opentools/gcc.html

其中比較明確的解釋為:


1.preprocess 先處理那些#ifdef #define這些東西並做一些巨集代換

2.compile 做語意分析,翻譯成組合語言(assembly language)

3.assemble 翻成機器碼與OS有關的格式,做成relocatable obj檔。

4.link 找到symbol(函式,變數名)與程式庫(shared obj)中的副程式 ,做成可執行obj檔(executable obj)。


shared obj函式庫裡的程式碼為Position Independent Code (PIC), 也就是它的位址可能會隨著不同process而有不同


另外還對gcc參數做了一下功課:
-S
只進行到compiler便停止,因此輸出為一組合語
言檔,在內定的輸出檔名為輸入檔名去除.c或.i
等字尾之後加上.s而成。

-c
只 compile或assemble輸入檔案,而不作連結,
因此輸出為一目的檔(object file), 內定的檔
名為去除.c、.i或是.s等之後加上.o而成。

-o FILE
不管在那一階段結束動作,都可用此參數將內定
的輸出檔名改成"FILE"
;若是沒用此參數,最後
產生的可執行檔檔名內定為 "a.out",在各階段
結束的輸出內定檔名請看上列參數。




2009年11月9日

讓全世界看到你的網站(XP Apache架站)

今天為了解決家用電腦如何透過之前所架好的三種軟體:
Apache
MySQL
PHP

透過我家的中華電信ADSL小烏龜和Dlink 300無線路由器,
可讓在全世界連上我的網站(E:\DB\www)目錄下

所以上網查資料後做了以下動作(或許有些是多餘的,待確認)

1.
修改Apache httpd.conf內容
E:\DB\serv\Apache\conf\httpd.conf

新增加此行
ServerName 我的固定IP:80


2.
控制台--Windows防火牆--例外--新增apache目錄底下的httpd.exe

3.固定好router分配的區域IP
區域連線--滑鼠右鍵--內容--TCP/IP--內容

ip:192.168.0.7
mask:255.255.255.0
gateway:192.168.0.1

DNS:168.95.1.1
DNS2:168.95.192.1


4.
關掉趨勢防火牆以及windows防火牆

5.
進入dlink 300 路由器設定畫面:
進階--服務器轉埠--

名稱HTTP
IP位址192.168.0.7
公用服務埠80~80
私人服務埠80
網路流量類型 TCP

名稱HTTP
IP位址192.168.0.7
公用服務埠80~80
私人服務埠80
網路流量類型 UDP

記得打勾--儲存


就可以用ADSL的固定IP透過Apache讓別人存取你的網頁囉

2009年11月5日

超漂亮英文字形哪裡找?(引用)

引用:
http://www.plurk.com/ACHI_2009

阿奇跟你分享 20種英文手寫字體 以及 50種英文手寫字體~

 20種英文手寫字體
http://aext.net/2009/08/20-awesome-handwriting-fonts-for-a-beautiful-design-you-should-not-miss/

50種英文手寫字體
http://www.instantshift.com/2009/06/08/50-free-handwritten-fonts-for-web-designers-and-logo-artists/

下載完字型檔後,貼到控制台的"字型",xp就會自動安裝了,可以到word中確認可不可以使用喔!

如何在Blogger文章中插入程式碼

引用文章:
高登的工作室 http://gordon168.tw/?p=200


首先針對:「要能夠直接打< 和 >而不用轉換。」Blogger有人將SyntaxHighlight的Javascript轉成Blogger可以用,但是高登看了一下對一般人而言有些難度,所以找到這一個解決方案,這個不只是Blogger可以用,所有的部落格或是網站都可以用。

HTML Encoder網站


請到「HTML Encoder」這個網頁將你的程式碼貼上,按下〔Encode〕按鈕,就可以在下方看到已經將你的「<」和「>」都轉好了,複製起來就可以用了。


接下來就針對「要加一段
pre用的CSS,裡面要有防止溢位的功能」的解決方案:

修改Blogger CSS

用Blogger/Blogspot的好處就是所有原始程式是公開的,只要你會改就沒有什麼太大的限制。接下來在你的Blogger後台選擇〔版面配置〕→〔修改HTML〕→勾選〔展開小裝置範本〕,插入這一段CSS程式碼:


.post pre {
  background: #F0F0F0 url(http://你的圖片網址/blogger-code.gif) repeat-y scroll left top;
  border: 1px solid #CCCCCC;
  color: #333333;
  display: block;
  font-family: Courier New;
  font-size: 10pt;
  line-height: 120%;
  margin: 5px 0 0 20px;
  max-height: 200px;
  overflow: auto;
  padding: 10px 10px 10px 21px;
  width: 90%;
}
請記得將「圖片網址」改成你自己上傳的圖片網址,還有這段程式碼我是放在「.post-body」的前面,你也不一定要放在這裡,但是相關的放在一起會比較好找,好了之後〔儲存範本〕就一切OK了。

發文

這樣子你以後要插入程式碼只要用
pre
包住:

就可以像WordPress一樣的快樂貼程式碼了。

至於其他的BSP就等大家自己試囉!

如何在google blog網頁插入空白字元("&nbsp;")


今天遇到一個問題:在兩個控制項中間插入空白,但不論我怎麼試都試不出來,最後參考了網路文章才寫出來
解決方法:

Dim divTmp As New LiteralControl 
divTmp.Text = "&nbsp;" 
 
Control.Add(divTmp)
這樣作就可以在控制項之間插入空白了。




在google blog中,如果在編輯文章的時候,想要用"修改"HTML"方式編輯文章,
看到有  就是空白字元的意思。

NO-CARRIER 網卡無法啟動

 工作時,由於想要啟動linux OS的網卡, 發現某張新設定的網卡一直無法啟動,就算下指令UP了,但是也沒有順利啟動 所以爬文後,想要確認該網卡的status, 發現某行為: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu...