2009年1月22日星期四

AP Hacking

[引言]

看着家里沉睡已久的AP成品, 突发奇想要玩玩里面的Linux, 可是更新完自己编译的系统后, AP就默默得睡着了,郁闷!只有一条路---把串口接出来!

[串口]

打开壳子发现了4个孔,貌似串口 TX RX GND VCC。产品都为了Cost Down所以串口部分都没做出来,需要自己加232转TTL的芯片才能让串口工作。

1. 华强北买串口公母转接头(方便串口转换)
2. taobao网购RS232转TTL转换器(本想去华强搞定此东西,不过走进赛格,商铺让我眼花缭乱,找了半天未果)
3. 从其他废旧板子中找到5pin排针,剪掉一pin,找美女帮我焊接到板之上, 都怪自己不会烙铁 :-(

哈哈, 串口有信息了, 提示内存不足, 只怪我的Image太大了!晕!看来非要把FLASH启下来重新来过.

[FLASH]

我没有系统的Loader, 找朋友把FLASH焊接下来,去烧录器上把2M的FLASH内容读了出来。我知道Loader是64K,所以我只需要前面的64K内容,用UltraEdit进入Hex编译模式选中COPY,然后到我的Fedora下用Cat把原是的Image(mini版本) cat到Loader后面,形成Loader+Image的文件,烧录到Flash中!好激动啊!系统马上可以动了!

[调试]

晕, 放上去什么反应都没有, 又劳驾朋友帮我重新焊接一次!但是系统继续没反应!时间也不早了, 不想继续麻烦朋友了, 下班回家!半夜我睡不踏实总在研究问题出在哪里!

翌日再战!对比一下发现用UltraEdit复制出来的64K文件竟然和从FLASH里面读出来的文件有出入!这UltraEdit复制粘贴怎么这么逊啊!还是Linux好,用dd很方便就把2M文件的前64K搞了出来。后悔自己为何用Ultraedit干这傻事,以后坚决用Linux思维方式解决问题!再次麻烦朋友帮忙焊接FLASH, 我烧录好自己重新整合的Loader+Image文件. 哈哈!系统OK了!可以轻松进去Shell Hack, 不错不错!终于有一块开发板可以Hacking了!

[后记]

烙铁要学习, 总麻烦朋友过意不去啊 =.=

2009年1月18日星期日

Unix shell 家谱

Thompson shell
The Thompson shell was the first Unix shell, introduced in the first version of Unix in 1971, and was written by Ken Thompson.

Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh.

Korn shell
The Korn shell (ksh) is a Unix shell which was developed by David Korn (AT&T Bell Laboratories) in the early 1980s. It is backwards-compatible with the Bourne shell and includes many features of the C shell as well, such as a command history, which was inspired by the requests of Bell Labs users.

Bash(derive for Bourne shell)
Bash is a free software Unix shell written for the GNU Project. Its name is an acronym which stands for Bourne-again shell.[1] The name is a pun on the name of the Bourne shell (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978,[2] and the concept of being "born again". Bash was created in 1987 by Brian Fox. In 1990 Chet Ramey became the primary maintainer.[3]

Almquist shell(derive for Bourne shell)
The Almquist shell (also known as A Shell, ash and sh) was originally Kenneth Almquist's clone of the SVR4-variant of the Bourne shell; it is a fast, small, POSIX-compatible Unix shell designed to replace the Bourne shell in later BSD distributions. By intention it did not feature line editing or command history mechanisms originally, because Almquist felt that such should be moved into the terminal driver. Current variants have emacs and vi modes.

Debian Almquist shell(derive for Almquist shell)
Debian Almquist shell (dash) is a Unix shell, much smaller than bash but still aiming at POSIX-compliancy. It requires less disk space but is also less feature-rich. Some missing features, such as the $LINENO variable, are required by POSIX.

/bin/sh != /bin/bash

继续研究bash,惊奇发现自己是个白痴.原来以为/bin/sh和/bin/bash是一个东西,可是发现绝对不是那么回事.我还没搞懂这个dash是什么东西.晕!