Jul 24 2010

iPhone 3G的GPS不工作的修复方法

Category: Uncategorizedwuxicn @ 4:23 PM

今天早上刷完机以后,发现iPhone 3G的GPS不工作了,不管用什么软件都定位不了。在国外的论坛找到了fix的办法,非常有效,转过来:

- Go to settings, general, auto-lock, change it from 1 Minute to NEVER
- Go to settings, general, reset, reset network settings (THIS WILL REBOOT YOUR IPHONE)
- Go outside, in a clear place with NO tree’s, buildings, or anything blocking your view of the sky
- Open “MAPS”, click NO on all that wi-fi crap, then click the little gps icon, and let it sync up with the satellites (this could take a few minutes)

Tags:


Jul 05 2010

OpenSSH公钥授权方式

Category: Uncategorizedwuxicn @ 7:49 PM

用公钥授权(Public key Authentication)的方式可以实现ssh服务器与本机之间的配对,实现不用输入密码联入SSH服务器。

具体做法:

1) 在本机(ssh客户机)生成密钥文件:

client$ cd ~/.ssh
client$ ssh-keygen -q -f id_rsa -t rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

在提示输入密码阶段时(Enter passphrase…),直接Enter,这样以后在本机就不用输入密码了。
这样,在.ssh/目录下就会生产2个文件:id_rsaid_rsa.pub .
注意:保密好这两个文件!

2) 分发公钥文件:

将你的公钥文件 (id_rsa.pub) 分发到你的SSH服务器上:

# Step 1: 将你的id_rsa.pub文件上传到服务器上
client$ scp ~/.ssh/id_rsa.pub user@your.ssh.server:~/.ssh/

# Step 2: 在服务器上安装公钥文件
server$ chmod 700 ~/.ssh
server$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/.ssh/id_rsa.pub

注意:这个地方要用>>追加到authorized_keys文件末尾,以免冲到以前的一些公钥授权。

好了,现在大功告成了,enjoy!
PS: 以上方法只保证在OpenSSH服务器上有效,其他SSH服务器不知道。

Tags: ,


Jun 29 2010

iPhone上手动安装deb软件

Category: Uncategorizedwuxicn @ 1:12 AM

1. 下载deb软件,并通过scp或者ftp传到iphone上。

2. 安装deb:
dpkg -i /full/path/to/filename.deb
例如:在iphone上安装vim:
dpkg -i vim_7.1-3_iphoneos-arm.deb

PS: 下面是一些可以下载iphone deb软件的地方:
Cydia的saurik源: http://apt.saurik.com/cydia/debs/
saurik源下软件列表:http://apt.saurik.com/dists/tangelo-3.7/main/binary-iphoneos-arm/Packages

Tags: ,


Jun 29 2010

用SSH链接iPhone

Category: Uncategorizedwuxicn @ 12:05 AM

Step 0. 前提条件

你的iPhone是越狱过的(即你的iPhone里有Cydia软件),如果还没有,可以见这篇文章进行越狱:http://icoder.me/2010/06/24/how-to-jailbreak-and-unlock-ios-4-on-mac/

Step 1. 通过Cydia下载并安装OpenSSH

OpenSSH程序是一个后台程序,安装完后桌面没有多任何图标,我们需要继续安装其他工具来控制开启/关闭OpenSSH,见Step 2.

Step 2. OpenSSH开关工具

可以在Cydia中选择下面3个工具的任何一个(或者都选):
1. Toggle SSH (推荐)
2. SBSetting (推荐)
3. Boss Prefs

Step 3. 打开OpenSSH

开启wifi,记住你的IP。可以在下面软件中看到iphone的IP或者在wifi设置中点右边的箭头看到IP地址。
1. 在Toggle SSH中直接点”Enable SSH”开启SSH。
2. 在SBSetting中点SSH图标使其变绿即开启了SSH。
3. 略。
然后在 Settings » General » Auto Lock 中设置自动锁屏时间为 “Never”.

Step 4. 通过SSH客户端软件链接iphone

在Mac下直接在终端中输入:(将”YOUR.IPHONE.IP”替换成上面记下来的IP地址)
ssh root@YOUR.IPHONE.IP

在Win下可以通过SSH软件链接,如puTTY。

Username: root
Password: alpine

注意:在第一次链接的时候会比较慢(大概30s以上)。

Tags: ,


Jun 24 2010

iOS 4越狱+解锁教程 (Mac)

Category: Uncategorizedwuxicn @ 2:37 PM

作者:Wuxi (欢迎来我的博客: http://iCoder.me/)
============
PWNED iOS 4!

本教程介绍在Mac系统下如何越狱和解锁iOS 4,适用于iPhone 3G/3GS和iPod touch 2G(我仅在我的iPhone 3G上试过)。如果你是Win系统请找别的教程。

特别感谢iPhone Dev-Team的Hacker们为自由事业作出的贡献!
同时感谢RedmondPie网站[1]提供了非常详细的教程,喜欢看E文的同学可以直接去这个网站。
Continue reading “iOS 4越狱+解锁教程 (Mac)”

Tags: , ,


Jun 10 2010

1. “Hello world” ── 引导程序(Boot loader)

Category: OSDevwuxicn @ 9:23 AM
« Previous TOP » Next

======

1. “Hello world” ── 引导程序(Boot loader)

做好了准备工作,现在可以开始写操作系统了。一般学习编程的第一个程序都是“hello world”,因此我们的操作系统也不例外。下面看看用10分钟的时间如何写一个可以在裸机(虚拟机)上直接运行的“操作系统”。

我们的 “Hello world” 操作系统

Continue reading “1. “Hello world” ── 引导程序(Boot loader)”

Tags: ,


May 26 2010

Chrome + Switchy! + SSH Tunnel 自动翻墙

Category: Uncategorizedwuxicn @ 10:28 AM

感谢党、感谢国家!我们在日常上网生活中学会了很多网络技术,其中翻墙是最常用的一种。

1. 安装chrome Switchy! 插件。

2. 设置一个SSH tunnel:见我的另一篇BLOG:http://icoder.me/2010/04/21/ssh-tunnel/

3. 设置 Switchy! 的 socks 代理:
Switchy! Socks proxy setting

4. 让 Switchy! 根据被 GFW 强的网站自动翻墙:
Online Rule setting

gfwlist.txt 地址: http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt

注意: 第一次使用的时候 “Reload Every” 设置成15分钟,当翻墙成功后可以设成3小时。

5. 最后将 Switchy! 代理设成 “Auto Switch Mode“,这样就大功告成了!以后 Switchy! 就会根据GFW列表自动启用代理了。

Tags:


May 10 2010

做一个操作系统的准备工作

Category: OSDevwuxicn @ 1:10 PM
« Previous TOP » Next

======

工欲善其事,必先利其器!

想要做一个操作系统,好用的工具必不可少,下面介绍所需要工具。
Continue reading “做一个操作系统的准备工作”

Tags:


May 05 2010

Install GDB cross debugger for i386 ELF on Mac OS X

Category: Uncategorizedwuxicn @ 9:31 AM

1. Download and install gettext: http://www.gnu.org/software/gettext/

2. Install i386-elf-gcc from MacPorts:

sudo port install i386-elf-gcc
sudo port -f activate i386-elf-gcc

You may need to create some symbolic links:

cd /opt/local/bin
sudo ln -s i386-elf-gcc-4.3.2 i386-elf-gcc
sudo ln -s i386-elf-g++-4.3.2 i386-elf-g++

3. Download GDB: http://www.gnu.org/software/gdb/download/

4. Configure and install GDB for i386-ELF:

./configure --prefix=/opt/local \
            --program-prefix=i386-elf- \
            --target=i386-elf \
            --with-gmp=/opt/local \
            --with-libelf=/opt/local \
            --with-build-libsubdir=/opt/local
make
sudo make install

Then the i386-ELF GDB will be installed in /opt/local with program name i386-elf-gdb.

Note: option ‘–target=i386-elf’ specifies guest(target) type ‘i386 ELF’.

Tags: , , , , ,


Apr 25 2010

[zz]Guide: Function Calling Conventions

Category: Uncategorizedwuxicn @ 9:55 PM

Guide: Function Calling Conventions

GCC follows certain rules in generating and calling its functions. If you are writing portable C or C++ code, you never need to know about these rules. However, if you are writing assembly language or nonportable code that depends on these rules, you need to know what they are. This document attemps to describe them, and gives some examples.

Notes

This document assumes a familiarity with assembly language. The assembler code used here is written in the AT&T syntax, as used by GNU as. If you’re using an Intel-syntax assembler, like nasm, you’ll have to translate appropriately.

What’s described here are GCC’s standard calling conventions. Many can be changed by using options like -mregparm, but that’s outside the scope of this document.

These conventions apply to C. C++ introduces several additional complications (such as class pointers and name mangling), some of which can change between compiler versions. Thus, I suggest that asm functions called from C++ code be declared as extern "C". This will cause C calling conventions to be used.

Writing Assembly-Language Functions

Naming

In DJGPP, a function’s assembly-language name is the same as its C name, with an underscore (“_“) prepended. Thus, the C function foo would be named _foo in assembly language. (This is in fact true for all symbol names, such as variables.) C++ has some much more complicated rules.

Registers

GCC requires that some registers not change across a function call. If you want to use these registers in an assembly function, you must save and restore their values. They are:

  • %ebx
  • %esi
  • %edi
  • %ebp
  • The segment registers %ds%es and %ss

Other registers are available for your use (though some have other special uses; read on).

  • Integers (of any size up to 32 bits) and pointers are returned in the %eax register.
  • Floating point values are returned in the 387 top-of-stack register, st(0).
  • Return values of type long long int are returned in %edx:%eax (the most significant word in %edx and the least significant in %eax).
  • Returning a structure is complicated and rarely useful; try to avoid it. (Note that this is different from returning a pointer to a structure.)

If your function returns void (e.g. no value), the contents of these registers are not used.

          Last argument
	  ...
4(%esp)	  First argument
(%esp)    Return address

  • Integers up to 32 bits and pointers are pushed as a single longword.
  • long long int is pushed as two longwords; the least significant is pushed last (and so is located first in memory).
  • float and double are pushed as a double-precision value, occupying 8 bytes.
  • long double is pushed as an extended-precision value followed by 2 bytes of padding, totalling 12 bytes.
  • As before, structures are more complicated and best avoided.

These rules also apply to functions which take a variable number of arguments (like printf). As with any variadic function, the function must find its own way of determining how many arguments were actually passed (usually based on one of the required args).

The stack below the return address is available for temporary storage, but be sure to decrement %esp appropriately. Memory below %esp may be overwritten asynchronously, by interrupt handlers and such. Restore its value when exiting, so that the return works correctly. You may also push and pop at will.

You may modify your arguments in place if you wish; they will not be reused by the caller. Do not, however, attempt to pop them; the caller handles this.

Calling C Functions From Assembly Language

An assembly language function may wish to call a function written in C, either your own or one from the standard library. The same rules already explained apply; you just see them from the other side.

First, you push the function’s arguments (if any) onto the stack, last argument first. See above for the formats used. (Floating point values are usually most easily handled by making space on the stack and then executing a store instruction; i.e. subl $8,%esp; fstpl (%esp).)

Use a simple call instruction to call the function.

You are responsible for removing the arguments you have pushed. They may have changed, so you may not reuse them. You need not, however, discard them at once; it may be more convenient when calling several functions to leave the arguments on the stack and pop them all together at the end. addl n,%esp is an efficient way to do this. It may also be convenient in this case to use %ebp as a frame pointer, since it need not change all the time. (The C compiler does this.)

The return value may be found as detailed above.

Expect the registers %eax%ecx, and %edx, as well as the floating-point stack, to have changed. Standard library functions may modify the %gs register, and the_far* functions may modify %fs. Other registers will be preserved.

Conclusion

These are the basic calling conventions used by GCC; however, there are special cases, optional modifications, etc. that can apply in situations not covered here. In this case, gcc -S is your best friend – from assembly output, you can usually figure out the rules. Also helpful is the GCC source: see i386.h and i386.md inconfig/i386. They are well commented.

Examples

(略,见原文)

原文:http://www.delorie.com/djgpp/doc/ug/asm/calling.html

Tags: , ,


Next Page »