Category Archives: IT

Notes about my development on embedded system, internet development, communication system, and wireless communications, etc; Technical articles about network configuration and administration; Anything about technology.

Install Qwt for Multiple Qt SDKs on Windows

I’ve installed Qt-4.8.6-MinGW and Qt-5.3.1-MSVC2013_64 together, because I’m going to build my application both 32bit (MinGW) and 64bit (MSVC2013). So I have to build Qwt for both Qt SDKs. What’s more, I’m using the only one QtCreator installed by Qt-5.3.1-MSVC2013_64, which has to support both SDKs with the same source code.

1. Build and Install Qwt Plugin for QtCreator
As said in Qwt User’s guide, QtCreator is “a different version of the Qt libraries you want to build your application with”, QtCreator supplied by Qt5 installed is built with MSVC2010 32bit (QtCreator –> Help –> About Qt Creator).
a) Build Qwt with MSVC2010 x86 Qt5 SDK (NOTICE: same version as QtCreator) first, and get plugin for QtCreator.
Just build following the user’s guide: update qwtconfig.pri, qmake qwt.pro, nmake, and nmake install.
b) Install plugin
Copy $QWT_INSTALL_PREFIX\plugins\designer\qwt_designer_plugin.dll to X:\Qt\Qt5.3.1\5.3\Tools\QtCreator\bin\plugins\designer\

2. Install Qwt Documentation
Open QtCreator, Tools –> Options –> Help –> Documentation –> Add
Select qwt-6.1.0.qch file downloaded from Qwt site

3. Build and Install Qwt Headers/Libraries for Qt SDKs
a) Build and Install Qwt with MSVC2013 x64 Qt5 SDK
     Build and install as the user’s guide, and then copy features/* (qwt.prf, qwtconfig.pri and qwtfunctions.pri) to X:\Qt\4.8.6_mingw482\mkspecs\features\win32\
b) Build and Install Qwt with MinGW x86 Qt4 SDK
     Build and install as the user’s guide, and then copy features/* (qwt.prf, qwtconfig.pri and qwtfunctions.pri) to D:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\mkspecs\features\win32\

4. Test
Copy qwt-6.1.0\examples\simpleplot.cpp to a test directory, let’s use “X:\simpleplot\”.
Create X:\simpleplot\simpleplot.pro with the following contents:

QT       += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG   += qwt
TARGET    = simpleplot
TEMPLATE  = app
SOURCES   =  simpleplot.cpp

Open project with QtCreator (you can see Qwt in UI designer now)

If you built Qwt with shared library (*.dll), maybe you should copy qwt.dll to the folder your exe exists.

[Reference]
http://qwt.sourceforge.net/qwtinstall.html
http://qt-project.org/doc/qt-4.8/qmake-advanced-usage.html#adding-new-configuration-features

Update password for Busybox system

On SMP865x board, passowrd is managed with “/etc/shadow” file by Busybox (crypt(3), MD5).

Here is how to update the password (On Debian only, Slackware doesn’t support it):

mkpasswd -5 -s 'YourPassWord'

Then use the output update /etc/shadow file.

And here is a python command for the same purpose too (Python 2.x. If using Python 3.x, replace print to print()):

python -c 'import crypt; print crypt.crypt("YOURPASS", "$1$YOURSALT")'

From http://serverfault.com/questions/330069/how-to-create-an-sha-512-hashed-password-for-shadow , we can change it for more purpose.

6 is the type of hash for SHA-512

  • 1 -> MD5
  • 2a -> Blowfish (not in mainline glibc; added in some Linux distributions)
  • 5 -> SHA-256 (since glibc 2.7)
  • 6 -> SHA-512 (since glibc 2.7)

I’d recommend you look up what salts are and such and as per smallclamgers comment the difference between encryption and hashing.

Update: The string produced is suitable for shadow and kickstart scripts.

To use the python script on Slackware automatically, I use mkpasswd to generate random salt (Only Slackware supported. It doesn’t work on Debian):

python -c 'import crypt; import os; print crypt.crypt("YOURPASS", "$1$" + os.popen("mkpasswd").read())'

I did not found a way working on every OS. —- It seems that I should learn more about crypt.

CentOS 6.4 安装配置心得

为DSMS系统配置了一个测试环境,装的CentOS 6.4,有些心得记录如下:

1、和Debian相比,CentOS的SELinux很恶心,配置后需要开启一些规则才能正常工作,一不小心就死活无法正常工作

2、yum类似apt,可以网络升级、安装,和Debian类似,如果需要一些特殊的包,需要用非官方的源,比如FFMPEG,最常用的是RPMREPO:

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

Edit /etc/yum.repos.d/rpmforge.repo to enable extras for newer version, such as subversion.

3、Install Java

http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-6-on-fedora-centos-red-hat-rhel/

http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

4、SELinux相关

/etc/sysconfig/iptables,注意文件中配置的顺序,别弄错地方了

SAMBA配置之后,需要setsebool -P samba_enable_home_dirs on

HTTPD配置了代理,需要setsebool -P httpd_can_network_connect true

5、其他

服务:service httpd start

启动:chkconfig –list 和 chkconfig httpd on

 

Linux 下分区后生成 /dev/ 下的设备

简述:

fdisk分区后不会主动通知内核设备重新分区过,一般说来,重启之后就可以识别到新分区的设备文件了,但重启很麻烦。

Linux下通常用partprobe工具通知内核,大多数发行版都使用udev管理设备文件,一般说来会自动生成设备文件的。

在我们板子上:

1、运行fdisk分区

2、通知内核: hdparm -z /your/block/device/such/as/dev/sda

3、生成设备文件:我们板子用mdev管理设备文件,因此:mdev -s

 

Compile QT 4.8.0 with MinGW

OS: Windows 7 (x64, EN)

I use zip packages because I wanna know what has been done clearly.

 

MinGW

As recommended by the official site of MinGW, I use mingw-get-0.4-mingw32-alpha-1-bin.tar.xz for my installation.

1. Extract all files to D:ToolsMinGW.

2. "Control Pannel" ==> "System" ==> "Advanced System Settings" ==> "Environment Variables", Add "D:ToolsMinGWbin" to "PATH".

3. cmd.

copy D:ToolsMinGWvarlibmingw-getdatadefaults.xml D:ToolsMinGWvarlibmingw-getdataprofile.xml
mingw-get update
mingw-get install binutils gcc g++ gdb gmp libiconv mingw32-make mpfr pthreads-w32

Which will install the following packages to D:ToolsMinGW.

binutils-2.22-1-mingw32-bin.tar.lzma
binutils-2.22-1-mingw32-doc.tar.lzma
binutils-2.22-1-mingw32-lang.tar.lzma
gcc-4.6.2-1-mingw32-doc.tar.lzma
gcc-4.6.2-1-mingw32-lang.tar.lzma
gcc-4.6.2-1-mingw32-lic.tar.lzma
gcc-c++-4.6.2-1-mingw32-bin.tar.lzma
gcc-core-4.6.2-1-mingw32-bin.tar.lzma
gdb-7.3.1-1-mingw32-bin.tar.lzma
gdb-7.3.1-1-mingw32-doc.tar.lzma
gmp-5.0.1-1-mingw32-dev.tar.lzma
gmp-5.0.1-1-mingw32-doc.tar.lzma
gmp-5.0.1-1-mingw32-lic.tar.lzma
libexpat-2.0.1-1-mingw32-dll-1.tar.gz
libgcc-4.6.2-1-mingw32-dll-1.tar.lzma
libgmp-5.0.1-1-mingw32-dll-10.tar.lzma
libgmpxx-5.0.1-1-mingw32-dll-4.tar.lzma
libgomp-4.6.2-1-mingw32-dll-1.tar.lzma
libiconv-1.14-2-mingw32-bin.tar.lzma
libiconv-1.14-2-mingw32-dev.tar.lzma
libiconv-1.14-2-mingw32-dll-2.tar.lzma
libiconv-1.14-2-mingw32-doc.tar.lzma
libiconv-1.14-2-mingw32-lic.tar.lzma
libintl-0.18.1.1-2-mingw32-dll-8.tar.lzma
libmpc-0.8.1-1-mingw32-dll-2.tar.lzma
libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma
libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2.tar.lzma
libquadmath-4.6.2-1-mingw32-dll-0.tar.lzma
libssp-4.6.2-1-mingw32-dll-0.tar.lzma
libstdc++-4.6.2-1-mingw32-dll-6.tar.lzma
make-3.82-5-mingw32-bin.tar.lzma
make-3.82-5-mingw32-doc.tar.lzma
make-3.82-5-mingw32-lang.tar.lzma
mingwrt-3.20-mingw32-dev.tar.gz
mingwrt-3.20-mingw32-dll.tar.gz
mpfr-2.4.1-1-mingw32-dev.tar.lzma
mpfr-2.4.1-1-mingw32-doc.tar.lzma
mpfr-2.4.1-1-mingw32-lic.tar.lzma
pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev.tar.lzma
pthreads-w32-2.9.0-mingw32-pre-20110507-2-doc.tar.lzma
pthreads-w32-2.9.0-mingw32-pre-20110507-2-lic.tar.lzma
w32api-3.17-2-mingw32-dev.tar.lzma

 

Perl

Also recommended by the official site, download: http://strawberryperl.com/download/5.12.3.0/strawberry-perl-5.12.3.0-64bit.zip

Extract to D:ToolsPerl.

Same as MinGW, expand "PATH Environment Variables" with "D:ToolsPerlperlbin;D:ToolsPerlperlsitebin".

 

QT

1. Download qt-everywhere-opensource-src-4.8.0.tar.gz and extract to "D:QTqt-4.8.0-gcc-4.6". NOTE: Don't use "g++" in the name, it will cause copy error.

2. Configure:

According to http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/, I wanna to reduce size of binary files.

Edit D:QTqt-4.8.0-gcc-4.6mkspecswin32-g++qmake.conf, with

QMAKE_CFLAGS_RELEASE = -Os -momit-leaf-frame-pointer

Open cmd, and configure:

cd D:QTqt-4.8.0-gcc-4.6
configure -release -opensource -developer-build -shared -ltcg -no-fast -exceptions -accessibility -stl -opengl desktop -no-openvg -platform win32-g++-4.6 -graphicssystem raster -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -incredibuild-xge -plugin-manifests -qmake -process -rtti -mmx -3dnow -sse -sse2 -no-openssl -no-dbus -no-phonon -phonon-backend -multimedia -audio-backend -webkit -script -scripttools -declarative -declarative-debug -no-directwrite -arch windows -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-style-plastique -qt-style-cleanlooks -qt-style-motif -qt-style-cde -qt-style-windowsce -qt-style-windowsmobile -qt-style-s60 -native-gestures -no-s60 -saveconfig 2012_01_02

NOTICE:

I disable database, ssl, directwrite, DirectX, etc. because they require header files or binary libraries out side of qt package. Also, there's a bug for OpenGL, so I disable OpenGL options. (https://bugreports.qt.nokia.com/browse/QTBUG-17997). In fact, OpenGL in the official QT SDK doesn't work on my box at all. 😦

And I use "-saveconfig 2012_01_02" to save my configuration.

This step requires perl installation which has been done before (syncqt).

3. Make:

Run and wait:

mingw32-make

Wish it works for you.

Use PuTTY to Access Windows Command Console (CMD)

Summary

I use WinSSHD to supply SSH service on Windows and PuTTY to connect. It works as well as "cmd".

I also tried Windows Telnet Service from Microsoft, but it doesn't work well.

 

Features of the default "cmd.exe" / "command.exe" of Windows is limited. I wanna a better console tool.

But either PuTTY or Mintty can't work well:

http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/win-command-prompt.html

http://code.google.com/p/mintty/issues/detail?id=234

 

1. PuTTY as CMD console

I use WinSSHD as a SSH server for Windows. http://www.bitvise.com/winsshd.html, Pernal edition is free of charge by non-commercial personal users. And PuTTY connects to the SSH server.

It works as well as in "cmd.exe". I haven't find any better solution till now.

NOTE:

To make "HOME", "END" and "DEL" key working, configure PuTTY: "Terminal" ==> "Keyboard" ==>

The Backspace key: Control-? (127)
The Home and End keys: Standard
The Function keys and keypad: SCO

 

2. Cygwin Terminal

(1). In fact, Mintty supplied by the latest Cygwin installation works very well.

(2). Project puttycyg patches original PuTTY to do that. http://code.google.com/p/puttycyg/

(3). You can also use the official way to do that, which compiles a "exe" for cygwin and simlate a telnet connection: http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/cygwin-terminal-window.html

 

3. Mintty as MSYS Terminal

mingw-get install msys-mintty
D:ToolsMinGWmsys1.0msys.bat -mintty

In my installation, MinGW has been installed to D:ToolsMinGW.