List the dynamic libraries used by a program

In order to know which dynamic libraries a particular binary is using, just type ldd. For example with busybox: sh-3.00# ldd /bin/busybox /bin/busybox: is setuid libcrypt.so.0 => /lib/libcrypt.so.0 (0x2aaed000) libm.so.0 => /lib/libm.so.0 (0x2ab41000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ab9c000) libc.so.0 => /lib/libc.so.0 (0x2abeb000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000) Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Digital Signage: Implementing a smooth scrolling text

Many digital signage hardware feature scroll text. However, in many cases the scrolling text is either not smooth, sometimes teared or very slow. It may depends on the performance of the hardware used but also on the implementation of the software. Once easy way to implemented scrolling text is just to redraw the text again and again at different position. However, this is very slow and yields poor results unless maybe you have a Truetype accelerator or similar hardware font accelerator. The next step is then to convert the text into pixmaps. This can either be done in the digital signage manager software (Windows PC/MAC or Linux based) or the digital signage player. Doing so in the latter makes it much more flexible. So you may create 2 pixmaps whose width and length match the region to be displayed, you write the text on those 2 pixmaps, then simply move […]

Script to convert Twitter RSS feeds into text

[Update Nov 2012: URLs such as http://twitter.com/statuses/user_timeline/759251.rss do not work anymore, but you can get a Twitter timeline RSS feed by using http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=xxxxx, where xxxxx is the screen name such as cnxsoft] We needed to convert Twitter RSS feeds to UTF-16 text for displaying them into a digital signage (That did not support RSS feed directly).  This digital signage supports regular http download, .e.g every 5 minutes. Here’s the script (called with crontab) we used for CNN News Twitter RSS feed. #!/bin/sh # CNN Twitter wget http://twitter.com/statuses/user_timeline/759251.rss sleep 10 cat 759251.rss | grep title | sed s/\<title\>// | sed s/\<\\/title\>// > cnn.txt rm 759251.rss iconv -f utf-8 -t UCS-2LE cnn.txt > cnn-utf16.txt cp cnn-utf16.txt /var/www/html/livepics/cnn.txt The resulting text file looks like: Twitter / CNN CNN: BREAKING NEWS: Military: Last U.S. brigade combat team leaves Iraq; 56,000 troops remain. Fifty-thousand set to stay past August 31. CNN: NY Gov. David Paterson […]

Enabling swap in embedded systems

If your embedded system running Linux does not have enough memory, you can enable swap to get more memory. However if your platform does not have MMU (Memory Management Unit) as is the case for Sigma Designs EM8620 series, it won’t support swap, so forget it. If your platform does have MMU, as is the case for many newer platforms such as Sigma Designs SMP8630, SMP8640 and SMP8650 series, you can enable swap support. First you’ll have to make sure swap support is enabled in your kernel:

and swapon/swapoff is enabled in busybox. So for example if you have an IDE harddisk with the second partition configured as swap. (Use fdisk to create a partition and mkswap /dev/hda2 to initialize the partition), you can enable the swap as follows:

If you get out-of-memory killer kernel error, you can change the “swapiness” to avoid oom-killer to kick in.

[…]

How to Generate CVS Changelog Automatically

There is a perl script called cvs2cl.pl provided by Red-Bean You can get the latest version thru cvs: cvs -d :pserver:[email protected]:/usr/local/cvs co cvs2cl/cvs2cl.pl Copy the script in a directory that belong to the path e.g.: cp cvs2cl.pl /usr/local/bin Then just checkout your project and run cvs2cl.pl to generate a ChangeLog that will look like: 2010-01-18 developer1 * app/cnxapp/Makefile: Added support for SMP8652 target 2010-01-17 developer2 * app/cnxapp/cnx_download.c: Added HTTP resume support [Bug 1250]: Fixed potential buffer overflow … where developer1 and developer2 are the linux usernames of the developers, app/cnxapp/Makefile, app/cnxapp/cnx_download.c the files that have been modified, and the comments correspond to the messages input during cvs commit. cvs2cl.pl also have other options such as XML output, date selection etc… Just type cvs2cl.pl –help to get the full options. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, […]

Block CVS Commits without message

If you are in my case, and you found it difficult to make some people in your team make proper comments/messages or any comments at all (cvs commit -m “Description of the changes”) while committing their changes to CVS, here’s what can be done to block commit without comments and with short comments. Checkout the CVSROOT directory cvs co CVSROOT Edit verifymsg in CVSROOT as follows #Set the verifymsg file to run a script DEFAULT /usr/local/bin/validate-cvs-log.sh Create /usr/local/bin/validate-cvs-log.sh script (make it executable for all cvs users): #!/bin/sh # # validate-cvs-log.sh logfile # test that log message has some characters in it if [ cat $1 | wc -c -lt 12 ] ; then echo “log message too short; please enter a description for the changes” exit 1 else exit 0 fi Commit verifymsg cvs commit -m “Added script to set minimum message size to 12 characters” verifymsg That’s it ! […]

uClinux kernel panic: Stack overflow

If you’re using ucLinux, you may get kernel panic errors coming out of nowhere. There may be several reasons (buffer overflow, out of memory..), but the most common is stack overflow for the process or one of the threads. To increase the stack size of a flat binary you’ll need to adjust the LDFLAGS as follows:

This will set the stack size to 64KB. To change the stack size of a thread (e.g. 32KB below), you’ll need to set the stack size attribute:

How to detect which thread suffers from stack overflow? First, you can check your code for recursive function calls and local variables (especially arrays) both of which will be added at runtime to the stack to estimate what should be the stack size. So if you have large arrays you may use a pointer + a call to malloc instead. If this can not fix […]

Finding large files in a Linux system

To list large files in a directory and subdirectories

This command looks for files larger than 10MB in /home/user directory and displays the result as follows: /home/user/largefile1.tar.bz2: 32M /home/user/bugzilla.sql: 21M Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com