2010年11月12日 星期五

build busybox for imx51

1. 官網下載
version 1.17.3

2. 解壓縮
tar jxvf busybox-1.17.3.tar.bz2.tar

3. 設定環境變數

export CROSS_COMPILE=/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-

cross compile工具跟你系統會有關係
所以通常需要修改此部份

FAQ網頁有說明如果要使用cross_compile要設定CROSS_COMPILE參數

4. build busybox
make defconfig
/*
To enable all features, use "make defconfig", which produces the largest
general-purpose configuration.
*/
make menuconfig
  # select Busybox Settings
  #   then General Configuration
  #     then exec prefers applets
  #   exit back to top level menu
  #   select Shells
  #     then Standalone shell
  #   exit back to top level menu
  # exit and save new configuration
make

檢查一下busybox檔案屬性
file busybox

busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped

如果想要build出static
此篇文章有教學

再看一次
nelsonchung@gps1004:~/busybox-1.17.3$ file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, stripped

最後感謝checko告知要使用stty在嵌入式系統上  可以利用busybox
感謝auron告知busybox相關information, 他真的很專業

Reference:

透過Facebook分享

2010年11月11日 星期四

Samba分享目錄

環境:Ubuntu 10.04
安裝samba
sudo apt-get install samba

message
nelsonchung@nelsonchung-laptop:~$ sudo apt-get update
[sudo] password for nelsonchung:
已有 http://tw.archive.ubuntu.com lucid Release.gpg
下載:1 http://tw.archive.ubuntu.com/ubuntu/ lucid/main Translation-zh_TW [56.4kB]
已有 http://security.ubuntu.com lucid-security Release.gpg                    
已有 http://us.archive.ubuntu.com jaunty Release.gpg                          
略過 http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-zh_TW 
下載:2 http://us.archive.ubuntu.com/ubuntu/ jaunty/multiverse Translation-zh_TW [810B]
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-zh_TW  
略過 http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-zh_TW
已有 http://us.archive.ubuntu.com jaunty-updates Release.gpg                  
下載:3 http://tw.archive.ubuntu.com/ubuntu/ lucid/universe Translation-zh_TW [29.7kB]
略過 http://security.ubuntu.com/ubuntu/ lucid-security/universe Translation-zh_TW
略過 http://us.archive.ubuntu.com/ubuntu/ jaunty-updates/multiverse Translation-zh_TW
下載:4 http://tw.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-zh_TW [3,024B]
下載:5 http://tw.archive.ubuntu.com lucid-updates Release.gpg [198B]          
已有 http://us.archive.ubuntu.com jaunty Release           
略過 http://security.ubuntu.com/ubuntu/ lucid-security/multiverse Translation-zh_TW
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main Translation-zh_TW
已有 http://us.archive.ubuntu.com jaunty-updates Release                      
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Translation-zh_TW
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/universe Translation-zh_TW
已有 http://us.archive.ubuntu.com jaunty/multiverse Packages                  
已有 http://security.ubuntu.com lucid-security Release                        
略過 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse Translation-zh_TW
已有 http://tw.archive.ubuntu.com lucid Release                               
已有 http://security.ubuntu.com lucid-security/main Packages                  
已有 http://us.archive.ubuntu.com jaunty-updates/multiverse Packages          
下載:6 http://tw.archive.ubuntu.com lucid-updates Release [44.7kB]            
已有 http://security.ubuntu.com lucid-security/restricted Packages
已有 http://security.ubuntu.com lucid-security/main Sources                   
已有 http://security.ubuntu.com lucid-security/restricted Sources             
已有 http://security.ubuntu.com lucid-security/universe Packages              
已有 http://tw.archive.ubuntu.com lucid/main Packages                         
已有 http://security.ubuntu.com lucid-security/universe Sources               
已有 http://tw.archive.ubuntu.com lucid/restricted Packages        
已有 http://tw.archive.ubuntu.com lucid/main Sources               
已有 http://tw.archive.ubuntu.com lucid/restricted Sources         
已有 http://security.ubuntu.com lucid-security/multiverse Packages 
已有 http://tw.archive.ubuntu.com lucid/universe Packages          
已有 http://tw.archive.ubuntu.com lucid/universe Sources           
已有 http://tw.archive.ubuntu.com lucid/multiverse Packages        
已有 http://tw.archive.ubuntu.com lucid/multiverse Sources         
已有 http://security.ubuntu.com lucid-security/multiverse Sources  
下載:7 http://tw.archive.ubuntu.com lucid-updates/main Packages [343kB]       
下載:8 http://tw.archive.ubuntu.com lucid-updates/restricted Packages [3,240B]
下載:9 http://tw.archive.ubuntu.com lucid-updates/main Sources [134kB]        
下載:10 http://tw.archive.ubuntu.com lucid-updates/restricted Sources [1,443B]
下載:11 http://tw.archive.ubuntu.com lucid-updates/universe Packages [146kB]  
下載:12 http://tw.archive.ubuntu.com lucid-updates/universe Sources [56.8kB]  
下載:13 http://tw.archive.ubuntu.com lucid-updates/multiverse Packages [7,373B]
下載:14 http://tw.archive.ubuntu.com lucid-updates/multiverse Sources [3,669B]
取得 831kB 用了 16s (51.1kB/s)                                                
正在讀取套件清單... 完成
nelsonchung@nelsonchung-laptop:~$ sudo apt-get samba
E: 無效的操作 samba
nelsonchung@nelsonchung-laptop:~$ sudo apt-get install samba
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
以下套件是被自動安裝進來的,且已不再會被用到了:
  linux-headers-2.6.32-24 linux-headers-2.6.32-24-generic
使用 'apt-get autoremove' 來將其移除。
建議套件:
  openbsd-inetd inet-superserver smbldap-tools ldb-tools
下列【新】套件將會被安裝:
  samba
升級 0 個,新安裝 1 個,移除 0 個,有 34 個未被升級。
需要下載 6,275kB 的套件檔。
此操作完成之後,會多佔用 17.1MB 的磁碟空間。
下載:1 http://tw.archive.ubuntu.com/ubuntu/ lucid-updates/main samba 2:3.4.7~dfsg-1ubuntu3.2 [6,275kB]
取得 6,275kB 用了 47s (133kB/s)                                               
正在預先設定套件 ...
選取了原先未被選取的套件 samba。
(正在讀取資料庫 ... 系統目前共安裝了 159964 個檔案和目錄。)
正在解開 samba (從 .../samba_2%3a3.4.7~dfsg-1ubuntu3.2_i386.deb)...
正在進行 man-db 的觸發程式 ...
正在進行 ufw 的觸發程式 ...
正在進行 ureadahead 的觸發程式 ...
ureadahead will be reprofiled on next reboot
正在設定 samba (2:3.4.7~dfsg-1ubuntu3.2) ...
Generating /etc/default/samba...
Importing account for nobody...ok
Importing account for nelsonchung...ok
update-alternatives: using /usr/bin/smbstatus.samba3 to provide /usr/bin/smbstatus (smbstatus) in auto mode.
smbd start/running, process 1644
nmbd start/running, process 1652

切換到/etc/samba

編輯smb.conf
sudo vim smb.conf

搜尋Share Definitions
/Share Definitions
將下列部份
;[homes]
;   comment = Home Directories
;   browseable = no
修改成
[homes]
   comment = Home Directories
   browseable = yes
:wq #存檔離開

設定使用者帳號密碼
sudo smbpasswd -a nelsonchung
之後輸入密碼
(意義解釋:
smbpasswd: 修改使用者SMB password
       -a
           This option specifies that the username following should be added
           to the local smbpasswd file, with the new password typed (type
           for the old password). This option is ignored if the
           username following already exists in the smbpasswd file and it is
           treated like a regular change password command. Note that the
           default passdb backends require the user to already exist in the
           system password file (usually /etc/passwd), else the request to add
           the user will fail.

所以我猜
-a 是為了不要修改到使用者系統密碼 而單純修改samba裡面的密碼而使用的)

重新啟動
sudo service smbd restart

重新開機

在windows環境
開啟檔案總管
\\192.168.144.125\nelsonchung
此時會出現輸入帳號密碼對話框
輸入正確就可以看到嚕

想要有寫入的權限
還需要修改/etc/samba/smb.conf
sudo vim smb.conf

找到下列資訊
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.

# read only = yes

修改成
   read only = no

重新啟動服務
sudo service smbd restart
就可以寫入檔案嚕

透過Facebook分享

2010年11月10日 星期三

如何找出.git目錄

開發android
要搜尋某個字串 在整個android內
想要跳過.git目錄不搜尋
藉此來降低搜尋上的時間

如何找出該目錄下的.git目錄了

find . -type d -name '\.git'

-type d 找目錄
-type f 找檔案

-name '\.git'
找尋.git目錄

感謝charles教學
要犧牲下班時間教學
尤其感動

所以我要把所有.git刪掉才可以下班

Update 20101112
Checko提供的指令完全正確

完全正確
真的是太神了
find . -type d -name '\.git' -print0 | xargs -0 rm -rf

find
-print0
True; print the full file name on the standard output, followed
by a null character (instead of the newline character that
-print uses). This allows file names that contain newlines or
other types of white space to be correctly interpreted by pro‐
grams that process the find output. This option corresponds to
the -0 option of xargs.

xargs - build and execute command lines from standard input

--null
-0 Input items are terminated by a null character instead of by
whitespace, and the quotes and backslash are not special (every
character is taken literally). Disables the end of file string,
which is treated like any other argument. Useful when input
items might contain white space, quote marks, or backslashes.
The GNU find -print0 option produces input suitable for this
mode.

透過Facebook分享

計算某個目錄的容量大小 by using du

切換到該目錄下
使用du -sh

-h: print sizes in human readable format
-s: display only a total for each argument

需要等待一段時間才會顯示結果
ex.
4.6G

透過Facebook分享

使用tar解壓縮到特定目錄

需要加上-C

ex.
cd ~
tar zxvf aaa.tar -C ~/bbb

切換到home目錄下
將aa.tar解壓縮到home目錄下的bbb目錄

透過Facebook分享

2010年11月9日 星期二

sd卡 fdisk紀錄

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

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-976, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-976, default 976): +1300M



Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 2

First cylinder (661-976, default 661):

Using default value 661

Last cylinder, +cylinders or +size{K,M,G} (661-976, default 976): +200M



Command (m for help): n

Command action

e extended

p primary partition (1-4)

e

Partition number (1-4): 3

First cylinder (763-976, default 763):

Using default value 763

Last cylinder, +cylinders or +size{K,M,G} (763-976, default 976): +300M



Command (m for help): p



Disk /dev/sdb: 2014 MB, 2014838784 bytes

64 heads, 63 sectors/track, 976 cylinders

Units = cylinders of 4032 * 512 = 2064384 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



所用裝置 Boot Start End Blocks Id System

/dev/sdb1 1 661 1331551+ 83 Linux

/dev/sdb2 661 763 205632 83 Linux

/dev/sdb3 763 915 306432 5 延伸的



Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

l

First cylinder (764-915, default 764):

Using default value 764

Last cylinder, +cylinders or +size{K,M,G} (764-915, default 915): +150M



Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

l

First cylinder (841-915, default 841):

Using default value 841

Last cylinder, +cylinders or +size{K,M,G} (841-915, default 915): +150M

Value out of range.

Last cylinder, +cylinders or +size{K,M,G} (841-915, default 915):

Using default value 915



Command (m for help): p



Disk /dev/sdb: 2014 MB, 2014838784 bytes

64 heads, 63 sectors/track, 976 cylinders

Units = cylinders of 4032 * 512 = 2064384 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



所用裝置 Boot Start End Blocks Id System

/dev/sdb1 1 661 1331551+ 83 Linux

/dev/sdb2 661 763 205632 83 Linux

/dev/sdb3 763 915 306432 5 延伸的

/dev/sdb5 764 840 154208 83 Linux

/dev/sdb6 841 915 150175+ 83 Linux



Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

p

Selected partition 4

First cylinder (915-976, default 915):

Using default value 915

Last cylinder, +cylinders or +size{K,M,G} (915-976, default 976):

Using default value 976



Command (m for help): p



Disk /dev/sdb: 2014 MB, 2014838784 bytes

64 heads, 63 sectors/track, 976 cylinders

Units = cylinders of 4032 * 512 = 2064384 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



所用裝置 Boot Start End Blocks Id System

/dev/sdb1 1 661 1331551+ 83 Linux

/dev/sdb2 661 763 205632 83 Linux

/dev/sdb3 763 915 306432 5 延伸的

/dev/sdb4 915 976 122976+ 83 Linux

/dev/sdb5 764 840 154208 83 Linux

/dev/sdb6 841 915 150175+ 83 Linux

Command (m for help): w


The partition table has been altered!



Calling ioctl() to re-read partition table.

Syncing disks.

透過Facebook分享

dd command

dd:
convert and copy a file

if: 輸入檔案or位置
of: 輸出檔案or位置

bs: 一次read or write數目 以bytes

ibs=BYTES read BYTES bytes at a time (default: 512)

obs=BYTES write BYTES bytes at a time (default: 512)




seek=BLOCKS

skip BLOCKS obs-sized blocks at start of output
跳過obs-sized blocks設置的大小後
做輸出

skip=BLOCKS

skip BLOCKS ibs-sized blocks at start of input
跳過ibs-sized blocks設置的大小後
做輸入

ex.
dd if=./uboot.bin of=/dev/sdb bs=1K seek=1
將當目錄下的uboot.bin寫到/dev/sdb去
先跳過1Kbytes
寫入uboot.bin

ex.
dd if=./uImage of=/dev/sdb bs=1M seek=1

將當目錄下的uImage寫到/dev/sdb去
先跳過1Mbytes
寫入uboot.bin

當seek=1 bs所代表的值就等於offset大小
感謝Auron大教學


透過Facebook分享

dd error : 「/dev/sdb」: 拒絕不符權限的操作

nelsonchung@nelsonchung-laptop:~/myandroid/bootable/bootloader/uboot-imx$ dd if=./u-boot-no-padding.bin of=/dev/sdb bs=1K seek=1

dd: 正在開啟 「/dev/sdb」: 拒絕不符權限的操作

nelsonchung@nelsonchung-laptop:~/myandroid/bootable/bootloader/uboot-imx$ dd if=./u-boot-no-padding.bin of=/dev/sdb bs=1K seek=1

dd: 正在開啟 「/dev/sdb」: 拒絕不符權限的操作

nelsonchung@nelsonchung-laptop:~/myandroid/bootable/bootloader/uboot-imx$ dd if=./u-boot-no-padding.bin of=/dev/sdb bs=1K seek=1

dd: 正在開啟 「/dev/sdb」: 拒絕不符權限的操作

請使用sudo
nelsonchung@nelsonchung-laptop:~/myandroid/bootable/bootloader/uboot-imx$ sudo dd if=./u-boot-no-padding.bin of=/dev/sdb bs=1K seek=1

[sudo] password for nelsonchung:

154+1 records in

154+1 records out

158576 bytes (159 kB) copied, 0.000793345 s, 200 MB/s

透過Facebook分享

build android image for imx51

make PRODUCT-imx51_bbg-eng 2>&1 | tee build_imx51_bbg_android.log
發現找不到product name

Solution: BBG要大寫
make PRODUCT-imx51_BBG-eng 2>&1 | tee build_imx51_bbg_android.log

透過Facebook分享

你一定要活的比我久

昨天老婆跟我說了這句話

我知道
她想起了我岳父的事情

我辛酸了一下
我說我才不要
可是想到她要留著  替我流淚
我很不捨
我就跟她說  我一定會活著比妳久

"樹欲靜而風不止 子欲養而親不在"
這句話我現在看來最有感觸

所以不管生活如何忙碌

一定要每天能夠跟至親至愛的人 見面  說話
我想這是無價的

透過Facebook分享