Archive for March, 2011

More tips on tunning postfix

These are from python.org server

default_destination_concurrency_limit=50
default_destination_recipient_limit=50
default_process_limit=200
smtp_mx_session_limit=100
smtpd_client_connection_count_limit=100
smtp_destination_concurrency_limit=100
maximal_backoff_time = 1000s
minimal_backoff_time = 300s

Leave a comment

Debug shell script

Simple add and -x to your shebang

#!/bin/bash -x

Leave a comment

Cross Compiling streamer from xawtv using LTIB

1 – Get source code from http://www.kraxel.org/releases/xawtv/xawtv-3.95.tar.gz

2 – Aplly these patches


diff -urN ../tmp-orig/xawtv-3.95/console/fbtools.c ./console/fbtools.c
--- xawtv-3.95/console/fbtools.c 2003-02-14 14:14:04.000000000 +0000
+++ xawtv-3.95/console/fbtools.c 2011-03-12 10:57:40.000000000 +0000
@@ -21,8 +21,6 @@
#include
#include

-#include
-
#include "fbtools.h"

/* -------------------------------------------------------------------- */
@@ -424,7 +422,7 @@
goto err;
}
#endif
- fb_mem_offset = (unsigned long)(fb_fix.smem_start) & (~PAGE_MASK);
+ fb_mem_offset = (unsigned long)(fb_fix.smem_start) & ~(sysconf(_SC_PAGE_SIZE)-1);
fb_mem = mmap(NULL,fb_fix.smem_len+fb_mem_offset,
PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);
if (-1L == (long)fb_mem) {
diff -urN ../tmp-orig/xawtv-3.95/console/matrox.c ./console/matrox.c
--- xawtv-3.95/console/matrox.c 2005-02-03 10:40:41.000000000 +0000
+++ xawtv-3.95/console/matrox.c 2011-03-12 11:09:51.000000000 +0000
@@ -9,7 +9,6 @@
#include
#include

-#include /* PAGE_SIZE */
#include

#include "byteswap.h"
@@ -226,7 +225,7 @@
return -1;
}
off = (unsigned long)fb_fix.mmio_start -
- ((unsigned long)fb_fix.mmio_start & ~(PAGE_SIZE-1));
+ ((unsigned long)fb_fix.mmio_start & ~(sysconf(_SC_PAGE_SIZE)-1));
bmmio += off;
mmio = (uint32_t*)bmmio;
return 0;


3- Prepare the compilatio using

./configure –disable-xfree-ext  –disable-xvideo  –disable-lirc –disable-quicktime –disable-motif –disable-aa–disable-alsa  –disable-zvbi –disable-gl  –disable-dv  –disable-xft –without-x

4- After configure, modify Makefile

# include stuff
# must come firstinclude $(srcdir)/common/Subdir.mk
# subdirsinclude $(srcdir)/console/Subdir.mkinclude $(srcdir)/debug/Subdir.mkinclude $(srcdir)/frequencies/Subdir.mkinclude $(srcdir)/libng/Subdir.mkinclude $(srcdir)/libng/plugins/Subdir.mk#include $(srcdir)/libng/contrib-plugins/Subdir.mk#include $(srcdir)/man/Subdir.mk#include $(srcdir)/scripts/Subdir.mk#include $(srcdir)/vbistuff/Subdir.mk#include $(srcdir)/x11/Subdir.mk
# dependencies-include $(depfiles)
——————————————————
#Compiling only streamer
# targets to buildTARGETS-console := \    console/streamer
console/streamer: \    console/streamer.o \    common/channel-no-x11.o \    $(OBJS-common-capture)
console/streamer : LDLIBS  += $(THREAD_LIBS) -ljpeg -lm -L${JPEG_ROOT}/libconsole/streamer : LDFLAGS := $(DLFLAGS)
# global targetsall:: $(TARGETS-console)

install::    $(INSTALL_PROGRAM) $(TARGETS-console) $(bindir)
distclean::    rm -f $(TARGETS-console

5- Run make

Thanks to Jeyner Gil Caga  http://lists.zerezo.com/video4linux/msg22603.html

Leave a comment

Git clone SVN repository

git svn clone git@git-server:project.git
cd project
git remote add beanstalk git@mmarco.beanstalkapp.com:/userwish.git
git push beanstalk master

 

Leave a comment

Undo git last commit

git reset --soft HEAD^

Leave a comment

Load Python in 32bit mode

VERSIONER_PYTHON_PREFER_32_BIT=yes python

 

Leave a comment

Convert Canon CR2 raw images to JPEG images

#!/bin/bash

for i in *.cr2; do dcraw -c -q 0 -w -H 5 -b 8 $i | cjpeg -quality 100 > $i.jpg; done

Tip from http://snipt.net

Leave a comment

Compiling Busybox for ARM and Android

# Download the source from git

hamilton@saygon:/tmp$ git clone git://busybox.net/busybox.git

hamilton@saygon:/tmp$ cd busybox/

#Export ARCH and  CROSS_COMPILE (check your toolchain)

export ARCH=arm
export CROSS_COMPILE=/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-

#Enter the configuration interface

hamilton@saygon:/tmp/busybox$ make menuconfig

#and follow these procedures

$ Busybox Settings --> Build Options --> Build Busybox as a static binary (no shared libs)  -  Enable this option by pressing "Y"
$ Busybox Settings --> Build Options --> Cross compiler prefix  -  Set this option equal to "arm-none-linux-gnueabi-"
$ Busybox Settings --> Installation Options --> Don't use /usr  -  Enable this option by pressing "Y"
$ Linux Module Utilities --> () Default directory containing modules - Set this option to nothing
$ Linux Module Utilities --> () Default name of modules.dep - Set this option to nothing

#Select desired packages and save your configuration and run make, after compilation you will have a busybox binary

hamilton@saygon:/tmp/busybox$ file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, stripped

#Upload the file to your adb device and install busybox using ./busybox –install -s

#You can find more tips here http://omapzoom.org/wiki/Android_Installing_Busybox_Command_Line_Tools

2 Comments

Ltib fails to compile in Ubuntu 10.10 file not recognized problem

ccache /usr/bin/gcc -B/usr/bin/  -g -O2   -o makedoc  makedoc.o ../lib/libtxi.a -lncurses

makedoc.o: file not recognized: File format not recognized

collect2: ld returned 1 exit status

make[4]: *** [makedoc] Error 1

make[4]: Leaving directory `/opt/freescale/ltib/usr/src/rpm/BUILD/texinfo-4.8/tools/info’

To solve that just

$ sudo rm -rf ~/.ccache

and start all over.

Leave a comment

Parallel bzipping with pbzip2

PBZIP2 is a parallel implementation of the bzip2 block-sorting file compressor that uses pthreads and achieves near-linear speedup on SMP machines. The output of this version is fully compatible with bzip2 v1.0.2 or newer

Compression :


$ pbzip2 file

Unzip:

$ pbzip2 -d file.bz2

Read more at http://compression.ca/pbzip2/

Leave a comment