steps:
1. 從 http://sourceforge.net/projects/strace/files/strace/ 下載strace source code
2. 解壓縮 source
3. ./configure --host=arm-linux CC=arm-unknown-linux-uclibcgnueabi-gcc LD=arm-unknown-linux-uclibcgnueabi-ld , 配置makefile
4. make CFLAGS="-static" , 產生靜態可執行檔
5. (可做可不做) arm-linux-strip strace , 縮減strace的size
完成, 之後就可以把strace copy到ARM 的 linux平台上執行了
source:
http://hamersun.blogspot.tw/2010/05/strace-for-arm.html
2014年12月29日 星期一
Linux 解/壓縮指令
source:
http://note.drx.tw/2008/04/command.html
http://note.drx.tw/2008/04/command.html
.tar (僅打包,無壓縮)
- 套件名稱:tar。
- 打包:
[ jonny@linux ~ ]
$ tar cvf FileName.tar DirName - 解包:
[ jonny@linux ~ ]
$ tar xvf FileName.tar
.gz
- 套件名稱:gzip。
- 壓縮
[ jonny@linux ~ ]
$ gzip FileName - 解壓縮1:
[ jonny@linux ~ ]
$ gunzip FileName.gz - 解壓縮2:
[ jonny@linux ~ ]
$ gzip -d FileName.gz
.tar.gz
- 套件名稱:gzip。
- 壓縮:
[ jonny@linux ~ ]
$ tar zcvf FileName.tar.gz DirName - 解壓縮:
[ jonny@linux ~ ]
$ tar zxvf FileName.tar.gz
bz
- 壓縮:unkown。
- 解壓縮1:
[ jonny@linux ~ ]
$ bzip2 -d FileName.bz - 解壓縮2:
[ jonny@linux ~ ]
$ bunzip2 FileName.bz
.tar.bz
- 壓縮:unkown。
- 解壓縮:
[ jonny@linux ~ ]
$ tar jxvf FileName.tar.bz
.bz2
- 套件名稱:bzip2。
- 壓縮:
[ jonny@linux ~ ]
$ bzip2 -z FileName - 解壓縮1:
[ jonny@linux ~ ]
$ bzip2 -d FileName.bz2 - 解壓縮2:
[ jonny@linux ~ ]
$ bunzip2 FileName.bz2
.tar.bz2
- 套件名稱:bzip2。
- 壓縮:
[ jonny@linux ~ ]
$ tar jcvf FileName.tar.bz2 DirName - 解壓縮:
[ jonny@linux ~ ]
$ tar jxvf FileName.tar.bz2
.xz
- 套件名稱:xz-utils。
- 壓縮:
[ jonny@linux ~ ]
$ xz -z FileName - 解壓縮:
[ jonny@linux ~ ]
$ xz -d FileName.xz
.tar.xz
- 套件名稱:xz-utils。
- 壓縮:
[ jonny@linux ~ ]
$ tar Jcvf FileName.tar.xz DirName - 解壓縮:
[ jonny@linux ~ ]
$ tar Jxvf FileName.tar.xz
.Z
- 壓縮:compress FileName
- 解壓縮:
[ jonny@linux ~ ]
$ uncompress FileName.Z
.tar.Z
- 壓縮:
[ jonny@linux ~ ]
$ tar Zcvf FileName.tar.Z DirName - 解壓縮:
[ jonny@linux ~ ]
$ tar Zxvf FileName.tar.Z
.tgz
- 套件名稱:gzip。
- 壓縮:
[ jonny@linux ~ ]
$ tar zcvf FileName.tgz FileName - 解壓縮:
[ jonny@linux ~ ]
$ tar zxvf FileName.tgz
.tar.tgz
- 套件名稱:gzip。
- 壓縮:
[ jonny@linux ~ ]
$ tar zcvf FileName.tar.tgz FileName - 解壓縮:
[ jonny@linux ~ ]
$ tar zxvf FileName.tar.tgz
.7z
- 套件名稱:p7zip-full。
- 壓縮:
[ jonny@linux ~ ]
$ 7z a FileName.7z FileName - 使用密碼 (PASSWORD) 壓縮:
[ jonny@linux ~ ]
$ 7z a FileName.7z FileName -pPASSWORD - 解壓縮:
[ jonny@linux ~ ]
$ 7z x FileName.7z
.zip
- 套件名稱:zip。
- 壓縮:
[ jonny@linux ~ ]
$ zip FileName.zip DirName - 解壓縮:
[ jonny@linux ~ ]
$ unzip FileName.zip
.rar
- 套件名稱:rar, unrar。
- 壓縮:
[ jonny@linux ~ ]
$ rar a FileName.rar DirName - 解壓縮1:
[ jonny@linux ~ ]
$ rar e FileName.rar - 解壓縮2:
[ jonny@linux ~ ]
$ unrar e FileName.rar
.lha
- 套件名稱:lha。
- 壓縮:
[ jonny@linux ~ ]
$ lha -a FileName.lha FileName - 解壓縮:
[ jonny@linux ~ ]
$ lha -e FileName.lha
2014年12月25日 星期四
Android
[安裝環境]
第一支Android app程式教學-
http://readandplay.pixnet.net/blog/post/140001110-%E7%AC%AC%E4%B8%80%E6%94%AFandroid-app%E7%A8%8B%E5%BC%8F%E6%95%99%E5%AD%B8
不管你幾歲,都能開發 Android App 2
http://jpress.tw/android-dev2
不管你幾歲,都能開發 Android App 1
http://jpress.tw/android-dev
[APP範例]
這是 Jacky 版大的「在這提供一個初學 Android APPS 開發的教學網站」主題內
教學網中的一個基礎練習,練習範例的程式名稱為 BMI ( 體質量指數 Body Mass Index )。
http://gphonefans.net/thread-94517-1-1.html
這是近日在找學寫 app 的練習中,個人覺得很值得推薦的一個,因它包含了一個
app 最基本的簡單運作,只要願意花點時間去了解這個範例,便可建立一個簡單的
架構概念,對於學習寫 app 有一定的幫助;特別是當不想買書,只想從網上學點兒
如何寫 app 時 ( 我就是這樣 XD )。
而教學網中,範例是以 Eclipse 3.6 版來展示,但若以較新的 Eclipse 3.7.2 版本
來進行練習,在使用者介面設定上,將出現偏差及些微指令不適用,在此將範例
以 Eclipse 3.7.2 整理了一遍 。
範例的流程及解說,須請移玉步到 Jacky 版大主題內的教學網中參考,謝謝!
網頁:
http://gphonefans.net/thread-132873-1-1.html
第一支Android app程式教學-
http://readandplay.pixnet.net/blog/post/140001110-%E7%AC%AC%E4%B8%80%E6%94%AFandroid-app%E7%A8%8B%E5%BC%8F%E6%95%99%E5%AD%B8
不管你幾歲,都能開發 Android App 2
http://jpress.tw/android-dev2
不管你幾歲,都能開發 Android App 1
http://jpress.tw/android-dev
[APP範例]
這是 Jacky 版大的「在這提供一個初學 Android APPS 開發的教學網站」主題內
教學網中的一個基礎練習,練習範例的程式名稱為 BMI ( 體質量指數 Body Mass Index )。
http://gphonefans.net/thread-94517-1-1.html
這是近日在找學寫 app 的練習中,個人覺得很值得推薦的一個,因它包含了一個
app 最基本的簡單運作,只要願意花點時間去了解這個範例,便可建立一個簡單的
架構概念,對於學習寫 app 有一定的幫助;特別是當不想買書,只想從網上學點兒
如何寫 app 時 ( 我就是這樣 XD )。
而教學網中,範例是以 Eclipse 3.6 版來展示,但若以較新的 Eclipse 3.7.2 版本
來進行練習,在使用者介面設定上,將出現偏差及些微指令不適用,在此將範例
以 Eclipse 3.7.2 整理了一遍 。
範例的流程及解說,須請移玉步到 Jacky 版大主題內的教學網中參考,謝謝!
網頁:
http://gphonefans.net/thread-132873-1-1.html
2014年12月23日 星期二
修改 u-boot (recover mode )
modify=>cmd_bootm.c ( extern do_recover )
modify=>auto_update.c (新增 do_recover)
modify=>gm8139.h (定義 nand or nor flash)
modify=>fw_env.h (修改 config 路徑 "/mnt/mtd/fw_env.config")
modify=>fw_env.config (修改 device offset 路徑")
modify=>fw_env_main.c (修改 lockname = "/var/locks/ ")
[command line]
workspace/uboot#./make_8136 =====>看哪個平台可以切換
workspace/uboot#cp u-boot.bin => 燒錄目錄
workspace/uboot#cat /proc/mtd => 看 parition
** command line 下 make 出可設定 uboot 的 tool
- 在/uboot/tools/env 底下
- fw_env.config
../gm8139.h 下定義
(SPI NOR)
workspace/uboot#export PATH=/usr/src/arm-linux-3.3/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin:$PATH
workspace/uboot#make HOSTCC=arm-unknown-linux-uclibcgnueabi-gcc HOSTSTRIP=arm-unknown-linux-uclibcgnueabi-strip env
workspace/uboot#cd tools/env
int do_recover(void)
{
char cmd_load_image[128];
unsigned int offset,partsz;
unsigned int *mem_tmp;
int flag = H_HIDE_DOT;
/* get u-boot environment */
ENTRY e, *ep;
flag &= ~H_HIDE_DOT;
e.key = "recover_check";
e.data = NULL;
hsearch_r(e, FIND, &ep, &env_htab, flag);
/* It must need to burn in the empty partition at the end of all */
/* first-time check after burn-in image */
if (ep == NULL)
{
printf("there is no recover_check and insert !! \n");
e.key = "recover_check"; // pattern name in u-boot environment
e.data = "0xaaaaaaaa"; // pattern value in u-boot environment
hsearch_r(e, ENTER, &ep, &env_htab, flag);
if (!ep) {
printf("error inserting for u-boot variable !!\n");
return -1;
}
saveenv();
return 1;
}
//printf("%s=%s\n", ep->key, ep->data);
/* check checksum */
if(strcmp(ep->data,"0xaaaaaaaa")==0)
{
printf("burned-in image: no problem ! \n");
return 1;
}
else
{
printf("burned-in image: error ! \n\n");
printf("start recover mode >>>>> \n");
printf("recover mode: copy image ...... \n");
/* recovered partition */
#ifdef CONFIG_SPI_NAND_GM
offset = nand_sys_hdr->image[4].addr;
partsz = nand_sys_hdr->image[4].size+nand_sys_hdr->image[5].size+nand_sys_hdr->image[6].size;
#else
offset = spi_sys_hdr->image[4].addr;
partsz = spi_sys_hdr->image[4].size+spi_sys_hdr->image[5].size+spi_sys_hdr->image[6].size;
#endif
printf("recover mode: offset = 0x%x size = 0x%x \n",offset , partsz);
/* clear the memory tmp */
mem_tmp = (unsigned int *)malloc(partsz);
memset(mem_tmp, 0x00, partsz);
#ifdef CONFIG_SPI_NAND_GM
sprintf(cmd_load_image, "nand read 0x%x 0x%x 0x%x", (unsigned int)mem_tmp ,offset , partsz);
offset = nand_sys_hdr->image[1].addr;
#else
sprintf(cmd_load_image, "sf probe 0:0;sf read 0x%x 0x%x 0x%x", (unsigned int)mem_tmp ,offset , partsz);
offset = spi_sys_hdr->image[1].addr;
#endif
/* start read from spi flash to memory */
if (run_command(cmd_load_image, 0) != 0) {
printf("copy image fail \n");
return -1;
}
printf("recover mode: recover image ...... \n");
printf("recover mode: offset = 0x%x size = 0x%x \n",offset , partsz);
/* start write from memory to spi flash */
#ifdef CONFIG_SPI_NAND_GM
sprintf(cmd_load_image, "nand erase 0x%x 0x%x", offset, partsz);
if (run_command(cmd_load_image, 0) != 0) {
printf("erase partition fail \n");
return -1;
}
/* update partition */
sprintf(cmd_load_image, "nand write 0x%x 0x%x 0x%x", (unsigned int)mem_tmp , offset ,partsz);
if (run_command(cmd_load_image, 0) != 0) {
printf("write partition fail \n");
return -1;
}
offset = nand_sys_hdr->image[6].size+nand_sys_hdr->image[6].addr;
#else
sprintf(cmd_load_image, "sf probe 0:0;sf update 0x%x 0x%x 0x%x", (unsigned int)mem_tmp , offset ,partsz);
if (run_command(cmd_load_image, 0) != 0) {
printf("update image fail \n");
return -1;
}
offset = spi_sys_hdr->image[6].size+spi_sys_hdr->image[6].addr;
#endif
printf("recover mode: recover finish ...... \n");
/* set checksum after recovering */
e.key = "recover_check";
e.data = "0xaaaaaaaa";
hsearch_r(e, ENTER, &ep, &env_htab, flag);
if (!ep) {
printf("Error inserting for u-boot variable !!\n");
return -1;
}
saveenv();
}
printf("\n");
do_reset(NULL, 0, 0, NULL); // reset the system after recover-mode
return 1;
}
modify=>auto_update.c (新增 do_recover)
modify=>gm8139.h (定義 nand or nor flash)
modify=>fw_env.h (修改 config 路徑 "/mnt/mtd/fw_env.config")
modify=>fw_env.config (修改 device offset 路徑")
modify=>fw_env_main.c (修改 lockname = "/var/locks/ ")
[command line]
workspace/uboot#./make_8136 =====>看哪個平台可以切換
workspace/uboot#cp u-boot.bin => 燒錄目錄
workspace/uboot#cat /proc/mtd => 看 parition
** command line 下 make 出可設定 uboot 的 tool
- 在/uboot/tools/env 底下
- fw_env.config
../gm8139.h 下定義
(SPI NOR)
#define CONFIG_ENV_OFFSET 0x50000
#define CONFIG_ENV_SIZE 0x10000
(SPI NAND)
#define CONFIG_ENV_OFFSET 0x220000
#define CONFIG_ENV_SIZE 0x20000
fw_env.config => SPI NOR
/dev/mtd0 A
0x10000
0x10000
1
如果燒錄的uboot位址是 0x10000
A = 0x50000-0x10000=0x40000
fw_env.h => 修改 config 路徑
#define CONFIG_FILE "/mnt/mtd/fw_env.config"
workspace/uboot#export PATH=/usr/src/arm-linux-3.3/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin:$PATH
workspace/uboot#make HOSTCC=arm-unknown-linux-uclibcgnueabi-gcc HOSTSTRIP=arm-unknown-linux-uclibcgnueabi-strip env
workspace/uboot#cd tools/env
int do_recover(void)
{
char cmd_load_image[128];
unsigned int offset,partsz;
unsigned int *mem_tmp;
int flag = H_HIDE_DOT;
/* get u-boot environment */
ENTRY e, *ep;
flag &= ~H_HIDE_DOT;
e.key = "recover_check";
e.data = NULL;
hsearch_r(e, FIND, &ep, &env_htab, flag);
/* It must need to burn in the empty partition at the end of all */
/* first-time check after burn-in image */
if (ep == NULL)
{
printf("there is no recover_check and insert !! \n");
e.key = "recover_check"; // pattern name in u-boot environment
e.data = "0xaaaaaaaa"; // pattern value in u-boot environment
hsearch_r(e, ENTER, &ep, &env_htab, flag);
if (!ep) {
printf("error inserting for u-boot variable !!\n");
return -1;
}
saveenv();
return 1;
}
//printf("%s=%s\n", ep->key, ep->data);
/* check checksum */
if(strcmp(ep->data,"0xaaaaaaaa")==0)
{
printf("burned-in image: no problem ! \n");
return 1;
}
else
{
printf("burned-in image: error ! \n\n");
printf("start recover mode >>>>> \n");
printf("recover mode: copy image ...... \n");
/* recovered partition */
#ifdef CONFIG_SPI_NAND_GM
offset = nand_sys_hdr->image[4].addr;
partsz = nand_sys_hdr->image[4].size+nand_sys_hdr->image[5].size+nand_sys_hdr->image[6].size;
#else
offset = spi_sys_hdr->image[4].addr;
partsz = spi_sys_hdr->image[4].size+spi_sys_hdr->image[5].size+spi_sys_hdr->image[6].size;
#endif
printf("recover mode: offset = 0x%x size = 0x%x \n",offset , partsz);
/* clear the memory tmp */
mem_tmp = (unsigned int *)malloc(partsz);
memset(mem_tmp, 0x00, partsz);
#ifdef CONFIG_SPI_NAND_GM
sprintf(cmd_load_image, "nand read 0x%x 0x%x 0x%x", (unsigned int)mem_tmp ,offset , partsz);
offset = nand_sys_hdr->image[1].addr;
#else
sprintf(cmd_load_image, "sf probe 0:0;sf read 0x%x 0x%x 0x%x", (unsigned int)mem_tmp ,offset , partsz);
offset = spi_sys_hdr->image[1].addr;
#endif
/* start read from spi flash to memory */
if (run_command(cmd_load_image, 0) != 0) {
printf("copy image fail \n");
return -1;
}
printf("recover mode: recover image ...... \n");
printf("recover mode: offset = 0x%x size = 0x%x \n",offset , partsz);
/* start write from memory to spi flash */
#ifdef CONFIG_SPI_NAND_GM
sprintf(cmd_load_image, "nand erase 0x%x 0x%x", offset, partsz);
if (run_command(cmd_load_image, 0) != 0) {
printf("erase partition fail \n");
return -1;
}
/* update partition */
sprintf(cmd_load_image, "nand write 0x%x 0x%x 0x%x", (unsigned int)mem_tmp , offset ,partsz);
if (run_command(cmd_load_image, 0) != 0) {
printf("write partition fail \n");
return -1;
}
offset = nand_sys_hdr->image[6].size+nand_sys_hdr->image[6].addr;
#else
sprintf(cmd_load_image, "sf probe 0:0;sf update 0x%x 0x%x 0x%x", (unsigned int)mem_tmp , offset ,partsz);
if (run_command(cmd_load_image, 0) != 0) {
printf("update image fail \n");
return -1;
}
offset = spi_sys_hdr->image[6].size+spi_sys_hdr->image[6].addr;
#endif
printf("recover mode: recover finish ...... \n");
/* set checksum after recovering */
e.key = "recover_check";
e.data = "0xaaaaaaaa";
hsearch_r(e, ENTER, &ep, &env_htab, flag);
if (!ep) {
printf("Error inserting for u-boot variable !!\n");
return -1;
}
saveenv();
}
printf("\n");
do_reset(NULL, 0, 0, NULL); // reset the system after recover-mode
return 1;
}
訂閱:
意見 (Atom)