So Tired !_! 逆水行舟, 不进则退!

25Nov/12

[HOWTO] Build OpenWRT Trunk from svn on Mac OS X

Posted by Nick Xu

I recommend following these steps
1) Install XCode & Macports
2) Getting a build environment ready
3) Grabbing sources
4) Modifying Makefiles (e2fsprogs really doesn't like 64-bit Lion, and qemu refuses to compile)
5) Installing the missing dependancies
6) Building OpenWRT (from Updating Feeds on)

 

1. XCode & Macports
a. You will need to install Xcode 4.0 from the Apple developers' webpage, which will redirect you to the App Store entry for Xcode where you will follow the instructions on that page to install.

b. Then,  grab the latest MacPorts .pkg installer for Lion.
Mount the disk image and install MacPorts with the .pkg file. Open the Terminal.app from /Applications/Utilities

sudo port -v selfupdate && sudo port install subversion

Follow these directions if the above command does not work after mounting the dmg and installing.

Then:

port select --list gcc

Should give you an output similar to

air:~ alex$ port select --list gcc

Available versions for gcc:

apple-gcc42

gcc42

llvm-gcc42

mp-gcc44 (active)

none

I do not believe the version of gcc matters, but if it does, here's how to replicate my set up:

sudo port install gcc44 && sudo port select --set gcc mp-gcc44

Don't follow the above step unless you run into trouble later in the HOWTO when we try to compile OpenWRT.  The above command will build gcc-4.4 from scratch and that takes time. A lot of time.

 

2. Set up the build environment
a. Now install the packages needed to manipulate the OpenWRT source (horizontal scroll to see entire command, its long):

sudo port install coreutils asciidoc binutils bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurses

While this is compiling the packages for your system, continue on to 2b and 3a since they don't depend on any of the above packages.

b. The OpenWRT source is case-sensitive, unfortunately HFS+ drives formatted by Apple are not set to be case-sensitive; so we're going to create a .sparseimage workspace by opening Disk Utility in the /Applications/Utilities directory.

Click File -> New -> Blank Disk Image...
On the top of the dialog that just came up fill in "OpenWRT" without the quotes in the Save As: field and in the lower Name: field.

Choose a size larger than 3GB. My disk image is ~8G and will reach it's limit after compiling the packages and firmware images more than a few times.
IMPORTANT: In the Format: drop down, select  Mac OS Extended (case-sensitive

In the Image Format: drop down select "sparse disk image". Then click Create. The newly created disk image will be on the left panel of the Disk Utility, double clicking it will mount it on /Volumes/OpenWRT

3.Grabbing the source tree
a. Open the Terminal and type:

cd /Volumes/OpenWRT && svn co svn://svn.openwrt.org/openwrt/trunk/

Give it a few minutes while it pulls the source from the repository.

4. Modifying Makefiles
Open TextEdit.app and open /Volume/OpenWRT/trunk/tools/Makefile

cd /Volume/OpenWRT/trunk && open tools/Makefile

On line 17 erase the "e2fsprogs entry so it should look like this:

tools-y += sstrip ipkg-utils genext2fs  mtd-utils mkimage

Comment out line 22 like so:

#tools-$(CONFIG_TARGET_x86) += qemu

Then go on to comment out line 50, line 52, line 58; they are the build dependencies for mtd-utils (dep: e2fsprogs), qemu (dep: e2fsprogs), and e2fsprogs respectively.

5. Installing the missing dependencies
Now let's install and copy MacPort's e2fsprogs and osso-uuid's libraries and headers so we can build tools/mtd-utils correctly

sudo port install e2fsprogs osso-uuid

Followed by:

cd /Volumes/OpenWRT/trunk;

mkdir -p staging_dir/host/include/e2fsprogs;

cp -R /opt/local/include/ossp staging_dir/host/include/e2fsprogs/;

cp /opt/local/lib/libuuid* staging_dir/host/lib

Then follow this manual on how to build OpenWRT now that you have successfully built the necessary tools to compile OpenWRT images on Mac OS X 10.7 Lion.

Start from the section titled "Updating Feeds" and follow the wiki in it's entirety. Do not select any 'qemu' entries when you reach the make menuconfig step; qemu will not build on 64-bit Lion.

Tagged as: , , , , No Comments
29Jul/10

TortoiseSVN设置自动锁定功能

Posted by Nick Xu

在开发过程中,由于没有自动锁定,遇到不是特别细心的组员有可能没锁定就进行更改,会造成管理上的麻烦,为了避免这种情况我们特意加入一个设置,步骤如下:

1:在任意文件夹下右击空白处,弹出的菜单选择【TortoiseSVN】-->【设置】

2:在弹出的对话框中选择右边的【编辑】按钮后弹出一个文本对话框

3:将以下内容拷贝到文本的[auto-props]里面

enable-auto-props = yes

*.* = svn:needs-lock=*

* = svn:needs-lock=*

4:保存后确定即完成,以后开发的时候只要编辑就会自动锁定,被别人锁定的文件就不能直接编辑。

25May/10

将Subversion(svn) 安装成为windows service服务

Posted by Nick Xu

以前的svnserve要想成为windows服务,必须依赖于svnservice或其他工具。从Subversion1.4开 始,Subversion本身就集成Windows服务的工具。

1,安装svnservice在Windows NT中(包括Windows XP, Windows 2000, Windows 2003 Server)本身包含了一个安装服务的工具,叫做"Service Control",也就是sc.exe。
例如我的Subversion安装在"D:Subversion",版本库在"D:svnroot",而我希望对应的Subversion服务名为 svnservice,安装这个svn服务的命令就可以这样写:
sc create svnservice
binpath= "D:Subversionbinsvnserve.exe --service -r D:svnroot"
displayname= "SVNService"
depend= Tcpip

请注意,因为便于察看,上面的命令分为多行,但在实际执行时应该在一行里。另外,在以前启动svnserve时会使用"-d"选项,也就是守护进程模式, 在这里不能使用,会导致服务无法启动。同样,"-i"和"-t"选项也不能使用。
在命令行窗口执行完这个命令之后,服务还没有启动,你可以继续运行"net start svnservice"启动这个服务,然后使用"net stop svnservice"停止服务。
另 外还有两点需要小心处理。首先,如果路径中包括空格,一定要用“”处理“"”号,例如上面的例子中如果svnserve.exe在“c: program filessubversion”中,则命令应该写为“binpath= ""c:program filessubversionbinsvnserve.exe"”(“”中的内容),整个命令如下,红色部分是改变部分:
sc create svnservice
binpath= ""D:program filesSubversionbinsvnserve.exe" --service -r D:svnroot"
displayname= "SVNService"
depend= Tcpip

其次,sc对选项的格式还有要求,例如“depend= Tcpip”不能写为“depend = Tcpip”或“depend=Tcpip”,也就是“=”前不能有空各,而后面必须有空格。

2,删除服务如果服务安装的有问题,你可能需要删除服务。要删除前面添加的服务,只需要运行"sc delete svnservice","svnservice"就是我们创建服务时使用的名字。

3,配置服务是自动启动默认情况下安装的服务不会随Windows的启动而启动,为了使svn服务能够随Windows启动而启动,需要修改一下"sc create"命令(首先要删除),增加"start= auto"选项:
sc create svnservice
binpath= "D:Subversionbinsvnserve.exe --service -r D:svnroot"
displayname= "SVNService"
depend= Tcpip
start= auto

当然你也可以使用图形化的工具修改服务的属性,你可以在“开始->运行...”中执行"services.msc",然后在界面中修改。

25May/10

清除所有.svn目录

Posted by Nick Xu

从网上下载的开源项目,想把它集成到自己的系统中,需要先把里面的版本控制文件删除掉。

这里转载一下网上找到的删除方法,以备后用,以下内容转自:IceskYsl@1sters!

一、在linux下

删除这些目录是很简单的,命令如下
find . -type d -name ".svn"|xargs rm -rf

或者

find . -type d -iname ".svn" -exec rm -rf {} ;

全部搞定。(http://tech.techweb.com.cn/redirect.php?fid=26&tid=205673& amp;goto=nextnewset)

二、在windows下用以下法子:

1、在项目平级的目录,执行dos命令:
xcopy project_dir project_dir_1 /s /i

2、或者在项目根目录执行以下dos命令
for /r . %%a in (.) do @if exist "%%a.svn" rd /s /q "%%a.svn"

其实第二种方法可以用来干很多事的,比如把代码中的.svn替换为任意其他文件名并在硬盘根目录下执行,就可以从硬盘上删除所有的这个文件啦。

3、加注册表

Jon Galloway提供了一段注册表代码,可以将”Delete SVN Folders”命名增加到资源管理器的右键上,这样,鼠标点两下就能把选中目录下的所有.svn目录干掉了。Works just great!

代码为:

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINESOFTWAREClassesFoldershellDeleteSVN]
@="Delete SVN Folders" 

[HKEY_LOCAL_MACHINESOFTWAREClassesFoldershellDeleteSVNcommand]
@="cmd.exe /c "TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r "%1" %%f IN (.svn) DO RD /s /q "%%f" ""

将这段代码保存为一个.reg文件,双击确认导入注册表即可。

Tagged as: , No Comments
   
site
site