分类目录归档:技术文献

Ubuntu 14.04 更新源

1、备份源
# sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、编辑源文件/etc/apt/sources.list,并添加以下地址
# sudo gedit /etc/apt/sources.list

网易163源:
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

搜狐源:
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse

oschina源:
deb http://mirrors.oschina.net/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-backports main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-updates main restricted universe multiverse

3、 更新源索引,使新源生效
# sudo apt-get update

Ubuntu Linux系统下的SVN客户端工具PySVN

在Windows下面一直在用TortoiseSVN做为SVN客户端工具,但它居然没提供Linux版本,无视Linux用户的存在。它视我如空气,偶视它如废土。开始探索尝试其他跨平台的SVN客户端,最后在试用了几个后,发现PySvn相对比较好。在这里介绍给大家:

PySVN官方网站:http://pysvn.tigris.org/

Mission

The pysvn project's goal is to enable Tools to be written in Python that use Subversion.

Windows, Mac OS X, Linux and other unix platforms are supported.

pysvn Extension FeaturesSupports all svn client featuresSupports svn transaction features required to write svn pre-commit hooksEasy to learn and usePython like interfaceGood Documentation and examplesNo need to understand the Subversion C APIpysvn WorkBench FeaturesEasy to learn and useAll subversion client operations in a GUIEnhanced subversion operations (rename of modified files etc)Support software development workflowBuiltin GUI diff showing line and character diffsAbility to diff between revisions in a files historyRuns on Windows, Mac OS X and Unix platformsImplemented in Python, allowing customisation。

对于Ubuntu Linux用户的话可以使用ubuntu软件中心来获取这个软件:在软件中心它的名字为:Svn Workbemch.你也可以使用如下命令来安装:

sudo apt-get install python-svn
sudo apt-get install svn-workbench

最后,安装好后新建project就可以开始在Linux下使用SVN 了。很简单,如下图。

Ubuntu,Linux

交叉编译ARM版 Qt

       因实际项目需求,需将Qt编译成LINUX-ARM版,以下为整个操作过程,使用Qt编写的程序已在实际开发板上运行,在此贴出,但愿能为需要的朋友提供上帮助。

准备工作:
Linux内核版本:
Linux 2.6.35-22-generic #33-Ubuntu

交叉编译工具:
arm-none-linux-gnueabi 4.4.1

Qt安装包:
qt-everywhere-opensource-src-4.7.3.tar.gz

安装
一.安装交叉编译工具
1.本机使用的交叉编译工具是:arm-none-linux-gnueabi

2.添加交叉编译工具的路径至相应环境变量中:
export PATH=/usr/CodeSourcery/Sourcery_G++_Lite/bin/:$PATH

3.通过以下命令查看arm-none-linux-gnueabi编译工具是否安装成功
a. 执行:arm-none-linux-gnueabi-g++ -v
b. 执行:arm-none-linux-gnueabi-gcc -v
如果以上两步都能正确打印对应的版本信息,则表明arm-none-linux-gnueabi编译工具
已安装成功!

二.交叉编译ARM版Qt
1.下载Qt源码包 qt-everywhere-opensource-src-4.7.3.tar.gz;

2.解压Qt源码包
tar -xvfz qt-everywhere-opensource-src-4.7.3.tar.gz

3.修改文件: /usr/local/qt-4.7.3-linux-arm/mkspecs/qws/linux-arm-g++/qmake.conf

# 设置交叉编译工具链:
# 本项目使用的交叉编译工具是 arm-none-linux-gnueabi-g++
#
QMAKE_CC                         = arm-none-linux-gnueabi-gcc
QMAKE_CXX                      = arm-none-linux-gnueabi-g++
QMAKE_LINK                      = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++

QMAKE_AR                   = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY      = arm-none-linux-gnueabi-objcopy
QMAKE_STRIP             = arm-none-linux-gnueabi-strip

4.(如有需要,需修改g++.conf文件)
修改文件: /usr/local/qt-4.7.3-linux-arm/mkspecs/common/g++.conf

# 设置使用ARM高级特性的编译标志:
#
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a -mtune=cortex-a9 -mfloat-abi=softfp

5.配置Qt编译选项

进入Qt解压目录,执行如下命令:
./configure -prefix /usr/local/qt-4.7.3-linux-arm-install -embedded arm -host-little-endian -no-cups -no-3dnow -nomake examples -nomake demos -nomake docs -xplatform /qws/linux-arm-g++

6.执行 make 命令;
该步骤大致需要2~3个小时

7.执行 make install 命令;

8.修改用户环境变量
export ARMQTDIR=/usr/local/qt-4.7.3-linux-arm-install
export PATH=$ARMQTDIR/bin:$PATH
export MANPATH=$ARMQTDIR/man:$MANPATH
export LD_LIBRARY_PATH=$ARMQTDIR/lib:$LD_LIBRARY_PATH

9.测试 ARM 版 QT 是否安装并配置成功:
a. 执行:qmake -v
打印以下对应信息:
QMake version 2.01a
Using Qt version 4.7.3 in /usr/local/qt-4.7.3-linux-arm-install/lib
b. 执行:which qmake
打印以下对应信息:
/usr/local/qt-4.7.3-linux-arm-install/bin/qmake

c. 编写一个简单的测试程序,文件名为hello.cpp,进入该文件目录,进行工程编译,看是否能正确通编译

hello.cpp源码:
#include <QApplication>
#include <QDebug>
int main(int argc,char *argv[])
{
qDebug("Hello, welcome to Qt world!");
return 0;
}

顺序执行以下操作:
@1. 执行:qmake -project hello1.cpp
生成 hello1.pro 工程文件
@2. 执行:qmake hello1.pro
生成 Makefile 文件
@3. 执行:make
生成 hello.o, hello 文件

如果执行@2步骤时出现以下错误:
QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: hello1.pro
则是 QMAKESPEC 变量没有设置好,执行:
export QMAKESPEC=/usr/local/qt-4.7.3-linux-arm-install/mkspecs/qws/linux-arm-g++

如果以上对应的信息都能正确打印,说明 ARM 版 QT 安装并配置成功,大功告成,可以你的ARM版QT之旅了!

友情提示:
在以上所有过程中,请务必注意相关路径,及环境变量的配置,另外,请根据自己的路径对相应部分做修改。

Linux Kernel configuration for Virtualbox/VirtualPC/VMware hardware

Device Drivers

  • SCSI device support --->
    • [*] legacy /proc/scsi/ support
    • [*] SCSI disk support
    • [*] SCSI CDROM support
    • [*] SCSI generic support
    • [*] SCSI low-level drivers (VMWare Player)
      • [*] LSI MPT Fusion SAS 2.0 Device Driver
  • [*] Serial ATA and Parallel ATA drivers --->
    • [*] Verbose ATA error reporting
    • [*] AHCI SATA Support
    • [*] ATA SFF support
      • [*] ATA BMDMA support
        • [*] Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support
    • < > Generic ATA support
  • [*] Fusion MPT device support ---> (VMWare Player)
    • [*] Fusion MPT ScsiHost drivers for SPI
    • [*] Fusion MPT ScsiHost drivers for SAS
  • [*] Network device support --->
    • [*] Ethernet (10 or 100Mbit) --->
      • [*] "Tulip" family network devices support ---> (Virtual PC)
        • [*] DECchip Tulip (dc2114x) PCI support
        • [*] Generic DECchip & DIGITAL EtherWORKS PCI/EISA
      • [*] EISA, VLB, PCI and on board controllers ---> (VMWare Player)
        • [*] AMD PCnet32 PCI support
    • [*] Ethernet (1000Mbit) ---> (Virtualbox)
      • [*] Intel(R) PRO/1000 Gigabit Ethernet support
      • [*] Intel(R) PCI-Express PRO/1000 Gigabit Ethernet support
    • [*] VMware VMXNET3 ethernet driver (VMWare Player)

Bus options (PCI etc.)

  • [*] PCI support
  • [*] PCI Express support
  • [ ] ISA support
  • < > PCCard (PCMCIA/CardBus) support --->
  • < > Support for PCI Hotplug --->

Windows下VMware Workstation虚拟机自动开关机

企业需求:

       虽然Windows下的vmware workstation在企业里面相对应用的少,但是也会有存在使用的可能性,今天一个朋友和我说,现在公司里面搞了一个服务器装了一个vmware workstation里面有很多虚拟机,但是发现有一个问题,就是在关闭宿主机的时候,里面的虚拟机不能够正常开关机,造成内部系统或数据损坏,而且每次宿主机自动启动以后,不登录系统人为启动对应的虚拟机,虚拟机不会自动启用,这很是麻烦,怎么解决了?

       经过查看一此相关资料与官方知识库,做了一系列的测试,成功的测试出了上续需求,在这里共享出现,希望有需要的朋友可以试一下。

解决方法:

Windows 2003 OR XP 虚拟机在寄宿主机关机之前关闭虚拟机

       执行“gpedit.msc”,逐级打开“本地计算机策略”-->“计算机配置”-->“Windows设置”-->“脚本”,在窗口右栏中点击“关机”,把需要执行的关机或挂起命令写入一个 .bat 批处理程序中,添加到这里即可。

       需要说明的是,系统关机脚本的执行时机是系统注销所有用户登录后、系统关机之前,因此,对于从Windows登录用户界面启动的虚拟机,这些命令是不会起作用的,因为在用户注销的时候,Windows系统已经自动停止了用户的虚拟机进程。

Windows7虚拟机在寄宿主机关机之前关闭虚拟机

在win7环境中,在执行关机脚本之前,win7会强制终止所有非系统进程,关机脚本还是不会发生作用。这是可以修改如下设置:

执行“gpedit.msc”,逐级打开“本地计算机策略”-->“计算机配置”-->“管理模板”-->“系统”-->“关机选项”,将“关闭会阻止或取消关机的应用程序的自动终止功能”策略启用,即可让我们设定的用于关闭虚拟机的Windows关机脚本生效。

相关脚本:

1、系统自动启动VMware虚拟机

"C:\Program Files\VMware\VMware Workstation\vmrun.exe" -T ws start "D:\system\Windows XP Professional\Windows XP Professional.vmx"

2、系统自动关闭VMware虚拟机

"C:\Program Files\VMware\VMware Workstation\vmrun.exe" -T ws stop "D:\system\Windows XP Professional\Windows XP Professional.vmx" soft

3、系统自动挂起VMware虚拟机

"C:\Program Files\VMware\VMware Workstation\vmrun.exe" –T ws suspend "D:\system\Windows Server 2003 Enterprise Edition\Windows Server 2003 Enterprise Edition.vmx"

4、系统自动重启VMware虚拟机

"C:\Program Files\VMware\VMware Workstation\vmrun.exe" -T ws reset "D:\system\Windows XP Professional\Windows XP Professional.vmx“

5、系统自动暂停VMware虚拟机

"C:\Program Files\VMware\VMware Workstation\vmrun.exe" -T ws pause "D:\system\Windows XP Professional\Windows XP Professional.vmx"

6、系统自动暂停恢复VMware虚拟机

"C:\Program Files\VMware\VMware Workstation\vmrun.exe" -T ws unpause "D:\system\Windows XP Professional\Windows XP Professional.vmx"