2013年7月26日 星期五

Linux建立新的硬碟

fdisk -l
使用fdisk -l列出現有的硬碟~~~

???@???-lubuntu:~$ sudo fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders, total 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d073b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   124780543    62389248   83  Linux
/dev/sda2       124782590   125827071      522241    5  Extended
/dev/sda5       124782592   125827071      522240   82  Linux swap / Solaris

Disk /dev/sdb: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders, total 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbbb1368f

   Device Boot      Start         End      Blocks   Id  System

有一顆sdb沒有被分割~~~

使用fdisk /dev/sdb分割硬碟

???@???-lubuntu:~$ sudo fdisk /dev/sdb

Command (m for help): m   //輸入m找help
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n   //新增partation
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p   //主要磁碟
Partition number (1-4, default 1): 1
First sector (2048-134217727, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-134217727, default 134217727):
Using default value 134217727

Command (m for help): w   //寫入後離開
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

再看一次,已經分割好了~~~

???@???-lubuntu:~$ sudo fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders, total 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d073b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   124780543    62389248   83  Linux
/dev/sda2       124782590   125827071      522241    5  Extended
/dev/sda5       124782592   125827071      522240   82  Linux swap / Solaris

Disk /dev/sdb: 68.7 GB, 68719476736 bytes
171 heads, 8 sectors/track, 98112 cylinders, total 134217728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbbb1368f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   134217727    67107840   83  Linux

使用mkfs.ext3 /dev/sdb1格式化成ext3格式

???@???-lubuntu:~$ sudo mkfs.ext3 /dev/sdb1 
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
4194304 inodes, 16776960 blocks
838848 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
512 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Asus Eee PC 1005PE w/ Android x86使用Bluetooth分享手機網路

很簡單,因為基本的profile都包了~~~
把手機藍芽網路分享打開,讓Eee PC跟手機透過藍芽連線~~~

在Eee PC開啟控制台視窗,輸入"netcfg"會看到bnep0,Bluetooth網路~~~
由於預設並沒有設定,所以不會獲得IP.

下"netcfg bnep0 dhcp",透由DHCP獲得位置,網路就可以用了~~~
不知道能不能用dhcpcd bnep0,應該來試試的 ><

但是Bluetooth網路並沒有設定DNS server,不認得yahoo、google等這些網址,
可以透由"getprop net.dns1"看看DNS的設定。
透由"setprop net.dns1 8.8.8.8"設定DNS。
瀏覽器就可以用Bluetooth上網了。

/sys/class/net/bnep0,在這裡可以看到有bnep0。

透由pand設定Bluetooth role。

Name
pand - BlueZ Bluetooth PAN daemon

Description
The pand (PAN daemon) allows your computer to connect to Ethernet networks using Bluetooth.
Synposis
pand <options>
Options
--show --list -l
   Show active PAN connections
--listen -s
   Listen for PAN connections
--connect -c <bdaddr>
   Create PAN connection
--search -Q[duration]
   Search and connect
--kill -k <bdaddr>
   Kill PAN connection
--killall -K
   Kill all PAN connections
--role -r <role>
   Local PAN role (PANU, NAP, GN)
--service -d <role>
   Remote PAN service (PANU, NAP, GN)
--ethernet -e <name>
   Network interface name
--device -i <bdaddr>
   Source bdaddr
--nosdp -D
   Disable SDP
--encrypt -E
   Enable encryption
--secure -S
   Secure connection
--master -M
   Become the master of a piconet
--nodetach -n
   Do not become a daemon
--persist -p[interval]
   Persist mode
--cache -C[valid]
   Cache addresses
--pidfile -P <pidfile>
   Create PID file
--devup -u <script>
   Script to run when interface comes up
--devdown -o <script>
   Script to run when interface comes down
--autozap -z
   Disconnect automatically on exit
Scripts
    The devup/devdown script will be called with bluetooth device as first argument and bluetooth destination address as second argument.

2013年7月25日 星期四

在Asus Eee PC 1005PE安裝Android x86心得

        在還沒流行Tablet時,買了一台Asus Eee PC 1005PE,現在開始覺得不管跑windows xp/7都很慢,也試過lubuntu,還是頓噸的,直到用習慣Android後,突然想來找找,看看能不能將Android上在Eee PC,找到真的有支援Eee PC的Android呀!!! x86版本的 ^^

在這裡下載ios,光碟映像檔~~~
Android x86 - Porting Android to x86

        一開始試用android-x86-4.2-20130228.iso,不過一直不能安裝,找不到boot裝置,看別人的blog大家都可以安裝,終於找到是硬碟格式的問題。 雖然安裝過程可以自己格式化,不過有時候iso因為識別硬碟格式錯誤,安裝就會有問題。 所以先格式化再來安裝,就OK了。 不過這已經是後話了,因為一直以為有問題就先用了android-x86-4.0-RC2-eeepc.iso安裝,一切都沒問題。

android-x86-4.0-RC2-eeepc.iso遇到的問題:
        WiFi可以動作,可以連接AP Router,但連接我的Xperia V無線分享就是有問題,無法取得IP,連iPhone就沒問題,讓我越來越佩服iPhone了。 雖然改了設定檔後可以取得IP但卻無法連到網際網路,DNS server也設了,還是不行,後來爬了很久發現原來Android 4.0 WiFi有些bug呀!!! 我不可能換手機,只好再回去試 Android 4.2了。
        在回去試Android 4.2之前,有先試過用Bluetooth PAN連接,讓Eee PC透過Bluetooth連接至Xperia V然後上網,真的可以用耶,可以用瀏覽器瀏覽網頁,但是Google Play等都不能用呀 ><
原來Andoird-x86-4.0只支援WiFi ><

        4.2安裝完後,目前WiFi都沒問題,只是偶爾會自己斷線重連,也下載了一些APP,但是APP很少,很多都不支援x86,PPS不能用呀 >< 而且很多都是直式的APP,有的會讓螢幕轉90度,而且還不會恢復,搞死人呀 Orz
幸好找到快捷鍵,可以方便轉回來 =.=
Ctrl-P         開啟設定
Alt+F1       進入console模式
Alt+F7       回到GUI模式
Alt+F9       正常畫面
Alt+F10     畫面旋轉 180 度
Alt+F10     畫面旋轉 180 度
Alt+F11     畫面向左旋轉 90 度
Alt+F12     畫面向右旋轉 90 度
4.2有個最嚴重的問題,就是休眠後就起不來了,找不到醒來的按鍵,瞎啦!!!
(重開不就得了) 不,重開後,你會看到黑畫面,需要按鍵回鎖定頁,找不到那個鍵 Orz
就等於不能用了 >< 還好從boot流程可以進到鎖定頁,可以解鎖繼續使用。

Android x86目前還不成熟,不過各方都還在努力,期待有天我的小筆電能復活 ^^

Android x86 4.0:
1. WiFi有些問題。(但一般連線都算正常)
2. 內建APP較完整。
3. 畫面解析度較差。
4. 不會有休眠起不來的問題。

Android x86 4.2:
1. WiFi尚算OK。
2. 畫面較細緻。
3. 內建APP較少。(我找不到內建的Mail)
4. 休眠後就起不來了。
    (這個很嚴重,因為最長休眠時間只能設到30分鐘,表示你不能放著不用,不用就要關機,        這是另類的節能省碳、愛地球)

P.S. 4.2 iso檔並沒有eeepc字樣,而4.0有,4.0應該對eeepc支援度較高吧。

記得來安裝LIME HD中文輸入法。

2013年7月24日 星期三

找不到5G WiFi AP Router

找不到5GHz的WiFi AP Router!!!

網路上找了一下,Device是支援5280MHz~5320MHz、5745~5825MHz
而WiFi AP Router自動掃描設定在5240MHz,Device沒支援~~~
設成5745MHz,就認到了~~~

2013年7月4日 星期四

出現找不到xxx-gcc

安裝Cross Toolchain時,會export環境變數~~~
可以cat /etc/profile
#Cross Toolchain PATH
export PATH="/opt/target/bin:$PATH"
#
確定有寫export,但好像因為帳號權限問題,還是啥問題,就是認不到~~~
手動在compiler前export就可以了 ><

Show MTD

cat /proc/mtd
dev: size erasesize name
mtd0: 00X00000 000X0000 "ALL"
mtd1: 000X0000 000X0000 "Bootloader"
mtd2: 00XX0000 000X0000 "Kernel"

Build mkbootargs有問題

Build mkbootargs有問題,link不到一些library。
這問題很奇怪~~~

看了Makefile的寫法,
CC = gcc
TARGET = mkbootargs
all:
$(CC) -lz -o $(TARGET) mkbootargs.c
clean:
@rm $(TARGET) -rvf
@rm *.bin -rvf

把它改成醬,
$(CC) -o $(TARGET) mkbootargs.c -lz

很神奇,既然Build成功了,
這是怎麼回事 ><