Friday, October 24, 2008

remove files in different directories

I used to know how to find files in different directories,
find . -name '*.raw' will list all the raw files, but how to delete them?

Here is the result:


[root@QSLENG13_FC5 xxx]# find . -name '*.raw' -exec ls {} \;
./SP-MIDI/output_midi.raw
./SMAF_MA-5/output_midi.raw
./SMAF_MA-3/output_midi.raw
./SMAF_MA-2/output_midi.raw
./MXMF/output_midi.raw
./MIDI_RIFF_Format_1/output_midi.raw
./MIDI_RIFF_Format_0/output_midi.raw
./MIDI_Format_1/output_midi.raw
./MIDI_Format_0/output_midi.raw
./KAR/output_midi.raw
./JTS/output_midi.raw
./iMelody/output_midi.raw
[root@QSLENG13_FC5 xxx]# find . -name '*.raw' -exec rm {} \;
[root@QSLENG13_FC5 xxx]# find . -name '*.raw' -exec ls {} \;


Another usage: I want remove GNU assembly code which is generated by ADS and all the other object files.


# find . \( -name '*.o.s' -o -name '*.o' \) -exec rm {} \;


or using "-ok" with control by the user (type 'y' or 'n' for each file).

[root@QSLENG13_FC5 linux]# find . \( -name '*.a' -o -name '*.so' \) -ok rm {} \;
< rm ... ./libmqcore32.a > ? n
< rm ... ./libmqcore32.so > ? n
< rm ... ./libq3di32.so > ? n
< rm ... ./libq3di32.a > ? n

Thursday, October 23, 2008

use of scp

My memory is easy to forget, usually I am using tftp and nfs to share files, but I can not do it through ssh. When one door is close, there is another door open, I can use 'scp' from my Linux PC to transfer files.

Wednesday, October 8, 2008

clone jffs2


mount -t jffs2 /dev/mtdblock4 /mnt/nand
mount /dev/mmcblk0p2 /mnt/mmc2


I use mmc card as the media to save the rootfs at nand flash. It is not as easy as type: "tar czvf /mnt/mmc2/target.tar.gz /mnt/nand/". It won't work within busybox from the ARM target, could be the problem of tar.

How ever here is the magic:

tar cf - -C /mnt/nand . | tar xvf - -C /mnt/mmc2/target


Then pull the SD card and connect to the Linux PC, copy the file system with simply "cp -r /tftpboot /mnt/mmc2/target".

Tuesday, October 7, 2008

tftp on FC5

1. edit tftp file in "/etc/xinetd.d"


service tftp
{
disable = no
socket_type = dgram
protocol = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
# disable = yes
per_source = 11
cps = 100 2
flags = IPv4
}


"/tftpboot" is my directory to be used by tftp. comment out "disable = yes" to enable tftp.

2. restart xinetd service.

$ sudo /sbin/service xinetd restart

Friday, October 3, 2008

compile mplayer with ALSA for ARM

1. download mplayer source code. I am using (MPlay-1.0rc2.tar.bz2)
2. extract it.
3. write a script mybuild.sh for configuring

export CROSS_CC=/opt/CodeSourcery/arm-2007q3-51
export PATH=$CROSS_CC/bin:$PATH
export TGT="your target file system"
./configure --enable-cross-compile -cc=arm-none-linux-gnueabi-gcc \
--host-cc=gcc --target=arm-linux --prefix=$TGT \
--disable-network --disable-x11 --disable-gui \
--with-extralibdir=$TGT/lib \
--with-extraincdir=$TGT/include


Here $TGT contains alsa include files and library "libasound.so.2".

4. type "make"

Thursday, September 18, 2008

patch

As I use cvs for code control, I found patch is a good tool that helps to build the actual release. To do actual release, some times I need to make changes on the code such as change the macro of "#define ENABLE_FOO 0" or some thing else, and these change may not be good to commit to cvs, and I also don't want to create branch with cvs, as each branch can be orphan if I forget to update. So the basic way is:

1. cvs tag
2. modify some code and build the release.
3. make patch (I use tortoriseCVS)

When you want to apply the patches, first make sure you can the patch is for what 'tag' version. after that
1. cvs co -r "tag" "module name"
2. go to the directory you just check out the source code.
3. patch -p0 < "your patch file"

Thursday, September 11, 2008

Macbook

My Macbook died a week ago, yesterday I got it back from west world who repaired it. The harddrive is changed, but all the data are lost.

I use all the systems (windows, Linux), but feel extremely addicted to Mac OS X. It mainly changed my way of surfing internet. Here is the trick:

1. delicouse2safari: save my delicious bookmarks to safari
2. Launchbar: rescan all the bookmarks, then I am ready to use.

The new Firefox (version 3.01) is released, yesterday I saw the new face on Mac for the first time, I don't feel it looks better than on the PC, but it works fine. I've been using vimperator for quite a while, it gave me quick access with firefox using vim-style key binding, but as the firefox3 pop up, I feel difficulty with vimperator. So I disable this add-on, hope the author of vimperator can improve it. (The most unhappy experience with vimperator, is I did not see tabs on the gui, although I can type "tabs" to show all the tabs in the buffer. I would like to see the tabs bar, not sure where the problem is)