Ubuntu is composed of many software packages, the vast majority of which are distributed under a free software license. The only exceptions are some proprietary hardware drivers.The main license used is the GNU General Public License (GNU GPL) which, along with the GNU Lesser General Public License (GNU LGPL), explicitly declares that users are free to run, copy, distribute, study, change, develop and improve the software. On the other hand, there is also proprietary software available that can run on Ubuntu. Ubuntu focuses on usability, security and stability. The Ubiquity installer allows Ubuntu to be installed to the hard disk from within the Live CD environment, without the need for restarting the computer prior to installation. Ubuntu also emphasizes accessibility and internationalization to reach as many people as possible.
Custom Search

QEmacs, small emacs clone editor with HTML and DocBook editing support.

Monday, August 30, 2010

QEmacs, small emacs clone editor with HTML and DocBook editing support

QEmacs (for Quick Emacs) is a very small but powerful UNIX editor. It has features that even big editors lack :

    * Full screen editor with an Emacs look and feel with all Emacs common features: multi-buffer, multi-window, command mode, universal argument, keyboard macros, config file with C like syntax, minibuffer with completion and history.
    * Can edit files of hundreds of Megabytes without being slow by using a highly optimized internal representation and by mmaping the file.
    * Full Unicode support, including multi charset handling (8859-x, UTF8, SJIS, EUC-JP, ...) and bidirectional editing respecting the Unicode bidi algorithm. Arabic and Indic scripts handling (in progress).
    * WYSIWYG HTML/XML/CSS2 mode graphical editing. Also supports lynx like rendering on VT100 terminals.
    * WYSIWYG DocBook mode based on XML/CSS2 renderer.
    * C mode: coloring with immediate update. Emacs like auto-indent.
    * Shell mode: colorized VT100 emulation so that your shell work exactly as you expect. Compile mode with next/prev error.
    * Input methods for most languages, including Chinese (input methods come from the Yudit editor).
    * Hexadecimal editing mode with insertion and block commands. Unicode hexa editing is also supported.
    * Works on any VT100 terminals without termcap. UTF8 VT100 support included with double width glyphs.
    * X11 support. Support multiple proportionnal fonts at the same time (as XEmacs). X Input methods supported. Xft extension supported for anti aliased font display.
    * Small! Full version (including HTML/XML/CSS2/DocBook rendering and all charsets): 200KB big. Basic version (without bidir/unicode scripts/input/X11/C/Shell/HTML/dired): 49KB.

Configuration files:

QEmacs tries to load a configuration file in `~/.qe/config'. Each line of the configuration file is a QEmacs command with a C like syntax ('-' in command name can be replaced by '_').

Read the example file `config.eg' to have some examples.

The following commands are useful:

global_set_key(key, command)
    Set a global key binding to a command.
set_display_size(width, height)
    (X11) Set the window size, in character cells.
set_system_font(family, system_fonts)
    (X11) Maps a system font to a QEmacs font family. Multiple fonts can be given as fallback
set_style(stylename, css_property, css_value)
    Set a colorization style (see `qestyle.h' and `config.eg' for common style names)

Editing Modes
 C mode

This mode is currently activated by `M-x c-mode'. It is activated automatically when a C file is loaded.
 Hexadecimal, ascii and unihex modes

Unlike other editors, QEmacs has powerful hexadecimal editing modes: all common commands are working these modes, including the block commands.

The hexadecimal mode (M-x hex-mode) shows both the hexa decimal and ascii (bytes) values. You can toggle between the hexa and ascii columns with 'TAB'.

The ascii mode (M-x ascii-mode) only shows the ascii column.

The unihex mode (M-x unihex-mode) shows both the unicode and glyph associated to each character of the buffer by using the current buffer charset.

You can change the line width in these modes with 'C-left' and 'C-right'.
shell mode

You can activate it with M-x shell. Unlike other editors, a very complete colorized VT100 emulation is done [it means you can launch qemacs in the qemacs shell :-)].

By default, interactive mode is selected. It means that most keys you type are transmitted to the shell. This way, you can use the shell completion and editing functions. By pressing C-o, you toggle between interactive and editing mode. In editing mode, you can editing the shell buffer as any other buffer.
 Dired mode

You can activate it with C-x C-d. You can open the selected directory with RET or right. left is used to go to the parent directory. The current selected is opened in the right window.
 Bufed mode

You can activate it with C-x C-b. You can select with RET or right the current buffer.
 XML mode

This mode is currently activated by M-x xml-mode. It is activated automatically when an XML file is loaded.

Currently, only specific XML colorization is done in this mode. Javascript (in SCRIPT tags) is colored as in C mode. CSS Style sheets (in STYLE tags) are colorized with a specific color

 Graphical HTML2/CSS mode
 Usage

This mode is currently activated by M-x html-mode. It is activated automatically when an HTML file is loaded.
 Features

The XML/HTML/CSS2 renderer has the following features:

    * The parse errors are written in buffer '*xml-error*'.
    * Strict XML parser or relaxed mode for HTML pages.
    * Letter case can be ignored or strictly respected.
    * Integrated HTML to CSS2 converter so that the renderer do not depend on HTML quirks.
    * Quite complete CSS2 support (including generated content and counters).
    * Full Bidirectionnal Unicode support.
    * Table support with both 'fixed' and 'auto' layout algorithms.
    * 'tty' and 'screen' CSS2 medias are supported.

6.7.3 Known limitations

    * Cannot load external resources (e.g. style sheets) from other files.
    * No image handling (only a rectangle with 'ALT' name is drawn).
    * No javascript.
    * No frames.

Download:


Screenshots.













Adserver          610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola





Nihongo languages software packages for Ubuntu.

Nihongo is a language spoken by over 130 million people in Japan and in Japanese emigrant communities. It is a member of the  Japonic (or Japanese-Ryukyuan) language family.


There are a number of proposed relationships with other languages, but none of them has gained unanimous acceptance.


Japanese is an agglutinative language. It is distinguished by a complex system of honorifics reflecting the nature of Japanese society, with verb forms and particular vocabulary to indicate the relative status of the speaker, the listener, and persons mentioned in conversation. The language has a relatively small sound inventory, and a lexically significant pitch-accent system. Japanese is a mora-timed language.

ng-cjk Nihongo MicroGnuEmacs with CJK support.

Ng is Nihongo Mg, MicroGnuEmacs. It is a small lightweight Emacs-like editor. It can handle both Latin and CJK.

ng-cjk can handle ISO-2022-JP, Shift-JIS, EUC-JP as well as EUC-KR and EUC-CN(GB only). Latin is not supported.

Download:


Similar packages:
Nihongo MicroGnuEmacs with CJK and Canna support.

Ng is Nihongo Mg, MicroGnuEmacs. It is a small lightweight Emacs-like editor. It can handle both Latin and CJK.

ng-cjk-canna can handle ISO-2022-JP, Shift-JIS, EUC-JP as well as EUC-KR and EUC-CN(GB only). Latin is not supported. Canna, one of Japanese input methods, is also supported.

Download:


Similar packages: Common files used by ng-* packages.

Ng is Nihongo Mg, MicroGnuEmacs. It is a small lightweight Emacs-like editor. It can handle both Latin and CJK.

This package contains documents and a wrapper script.

Download:


Similar packages: Nihongo MicroGnuEmacs with Latin support.

Ng is Nihongo Mg, MicroGnuEmacs. It is a small lightweight Emacs-like editor. It can handle both Latin and CJK.

ng-latin can handle Latin (ISO-8859) encoding. CJK is not supported.

Download:


Similar packages:
Adserver          610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola



QDBM Quick Database Manager library of routines for managing a database.

Wednesday, August 25, 2010

This is the QDBM Database command package to be used as CGI commands.

QDBM is a library of routines for managing a database. The database is a simple data file containing records, each is a pair of a key and a value. Every key and value is serial bytes with variable length. Both binary data and character string can be used as a key and a value. There is neither concept of data tables nor data types. Records are organized in hash table or B+ tree.

As for database of hash table, each key must be unique within a database, so it is impossible to store two or more records with a key overlaps. The following access methods are provided to the database: storing a record with a key and a value, deleting a record by a key, retrieving a record by a key. Moreover, traversal access to every key are provided, although the order is arbitrary. These access methods are similar to ones of DBM (or its followers: NDBM and GDBM) library defined in the UNIX standard. QDBM is an alternative for DBM because of its higher performance.

As for database of B+ tree, records whose keys are duplicated can be stored. Access methods of storing, deleting, and retrieving are provided as with the database of hash table. Records are stored in order by a comparing function assigned by a user. It is possible to access each record with the cursor in ascending or descending order. According to this mechanism, forward matching search for strings and range search for integers are realized. Moreover, transaction is available in database of B+ tree.
Effective Implementation of Hash Database

QDBM is developed referring to GDBM for the purpose of the following three points: higher processing speed, smaller size of a database file, and simpler API. They have been achieved. Moreover, the following three restrictions of traditional DBM: a process can handle only one database, the size of a key and a value is bounded, a database file is sparse, are cleared.

QDBM uses hash algorithm to retrieve records. If a bucket array has sufficient number of elements, the time complexity of retrieval is 'O(1)'. That is, time required for retrieving a record is constant, regardless of the scale of a database. It is also the same about storing and deleting. Collision of hash values is managed by separate chaining. Data structure of the chains is binary search tree. Even if a bucket array has unusually scarce elements, the time complexity of retrieval is 'O(log n)'.

QDBM attains improvement in retrieval by loading RAM with the whole of a bucket array. If a bucket array is on RAM, it is possible to access a region of a target record by about one path of file operations. A bucket array saved in a file is not read into RAM with the 'read' call but directly mapped to RAM with the 'mmap' call. Therefore, preparation time on connecting to a database is very short, and two or more processes can share the same memory map.

If the number of elements of a bucket array is about half of records stored within a database, although it depends on characteristic of the input, the probability of collision of hash values is about 56.7% (36.8% if the same, 21.3% if twice, 11.5% if four times, 6.0% if eight times). In such case, it is possible to retrieve a record by two or less paths of file operations. If it is made into a performance index, in order to handle a database containing one million of records, a bucket array with half a million of elements is needed. The size of each element is 4 bytes. That is, if 2M bytes of RAM is available, a database containing one million records can be handled.

QDBM provides two modes to connect to a database: 'reader' and 'writer'. A reader can perform retrieving but neither storing nor deleting. A writer can perform all access methods. Exclusion control between processes is performed when connecting to a database by file locking. While a writer is connected to a database, neither readers nor writers can be connected. While a reader is connected to a database, other readers can be connect, but writers can not. According to this mechanism, data consistency is guaranteed with simultaneous connections in multitasking environment.

Traditional DBM provides two modes of the storing operations: 'insert' and 'replace'. In the case a key overlaps an existing record, the insert mode keeps the existing value, while the replace mode transposes it to the specified value. In addition to the two modes, QDBM provides 'concatenate' mode. In the mode, the specified value is concatenated at the end of the existing value and stored. This feature is useful when adding a element to a value as an array. Moreover, although DBM has a method to fetch out a value from a database only by reading the whole of a region of a record, QDBM has a method to fetch out a part of a region of a value. When a value is treated as an array, this feature is also useful.

Generally speaking, while succession of updating, fragmentation of available regions occurs, and the size of a database grows rapidly. QDBM deal with this problem by coalescence of dispensable regions and reuse of them, and featuring of optimization of a database. When overwriting a record with a value whose size is greater than the existing one, it is necessary to remove the region to another position of the file. Because the time complexity of the operation depends on the size of the region of a record, extending values successively is inefficient. However, QDBM deal with this problem by alignment. If increment can be put in padding, it is not necessary to remove the region.

As for many file systems, it is impossible to handle a file whose size is more than 2GB. To deal with this problem, QDBM provides a directory database containing multiple database files. Due to this feature, it is possible to handle a database whose total size is up to 1TB in theory. Moreover, because database files can be deployed on multiple disks, the speed of updating operations can be improved as with RAID-0 (striping). It is also possible for the database files to deploy on multiple file servers using NFS and so on.
Useful Implementation of B+ Tree Database

Although B+ tree database is slower than hash database, it features ordering access to each record. The order can be assigned by users. Records of B+ tree are sorted and arranged in logical pages. Sparse index organized in B tree that is multiway balanced tree are maintained for each page. Thus, the time complexity of retrieval and so on is 'O(log n)'. Cursor is provided to access each record in order. The cursor can jump to a position specified by a key and can step forward or backward from the current position. Because each page is arranged as double linked list, the time complexity of stepping cursor is 'O(1)'.

B+ tree database is implemented, based on above hash database. Because each page of B+ tree is stored as each record of hash database, B+ tree database inherits efficiency of storage management of hash database. Because the header of each record is smaller and alignment of each page is calculated statistically, in most cases, the size of database file is cut by half compared to one of hash database. Although operation of many pages are required to update B+ tree, QDBM expedites the process by caching pages and reducing file operations. In most cases, because whole of the sparse index is cached on memory, it is possible to retrieve a record by one or less path of file operations.

B+ tree database features transaction mechanism. It is possible to commit a series of operations between the beginning and the end of the transaction in a lump, or to abort the transaction and perform rollback to the state before the transaction. Even if the process of an application is crushed while the transaction, the database file is not broken.

In case that QDBM is built with ZLIB, LZO, or BZIP2 enabled, a lossless data-compression library, the content of each page of B+ tree is compressed and stored in a file. Because each record in a page has similar patterns, high efficiency of compression is expected due to the Lempel-Ziv algorithm and the like. In case handling text data, the size of a database is reduced to about 25%. If the scale of a database is large and disk I/O is the bottleneck, featuring compression makes the processing speed improved to a large extent.

Simple But Various Interfaces
.

QDBM provides very simple APIs. You can perform database I/O as usual file I/O with 'FILE' pointer defined in ANSI C. In the basic API of QDBM, entity of a database is recorded as one file. In the extended API, entity of a database is recorded as several files in one directory. Because the two APIs are very similar with each other, porting an application from one to the other is easy.

APIs which are compatible with NDBM and GDBM are also provided. As there are a lot of applications using NDBM or GDBM, it is easy to port them onto QDBM. In most cases, it is completed only by replacement of header including (#include) and re-compiling. However, QDBM can not handle database files made by the original NDBM or GDBM.

In order to handle records on memory easily, the utility API is provided. It implements memory allocating functions, sorting functions, extensible datum, array list, hash map, and so on. Using them, you can handle records in C language cheaply as in such script languages as Perl or Ruby.

B+ tree database is used with the advanced API. The advanced API is implemented using the basic API and the utility API. Because the advanced API is also similar to the basic API and the extended API, it is easy to learn how to use it.

In order to handle an inverted index which is used by full-text search systems, the inverted API is provided. If it is easy to handle an inverted index of documents, an application can focus on text processing and natural language processing. Because this API does not depend on character codes nor languages, it is possible to implement a full-text search system which can respond to various requests from users.

Along with APIs for C, QDBM provides APIs for C++, Java, Perl, and Ruby. APIs for C are composed of seven kinds: the basic API, the extended API, the NDBM-compatible API, the GDBM-compatible API, the utility API, the advanced API, and the inverted API. Command line interfaces corresponding to each API are also provided. They are useful for prototyping, testing, debugging, and so on. The C++ API encapsulates database handling functions of the basic API, the extended API, and the advanced API with class mechanism of C++. The Java API has native methods calling the basic API, the extended API, and the advanced API with Java Native Interface. The Perl API has methods calling the basic API, the extended API, and the advanced API with XS language. The Ruby API has method calling the basic API, the extended API, and the advanced API as modules of Ruby. Moreover, CGI scripts for administration of databases and full-text search are provided.
Wide Portability

QDBM is implemented being based on syntax of ANSI C (C89) and using only APIs defined in ANSI C or POSIX. Thus, QDBM works on most UNIX and its compatible OSs. As for C API, checking operations have been done at least on Linux 2.2, Linux 2.4, FreeBSD 4.8, FreeBSD 5.0, SunOS 5.7, SunOS 5.8, SunOS 5.9, HP-UX 11.00, Cygwin 1.3.10, Mac OS X 10.2, and RISC OS 5.03. Although a database file created by QDBM depends on byte order of the processor, to do with it, utilities to dump data in format which is independent to byte orders are provided.
Building

For building a program using QDBM, the program should be linked with a library file 'libqdbm.a' or 'libqdbm.so'. For example, the following command is executed to build 'sample' from 'sample.c'.

    gcc -I/usr/local/include -o sample sample.c -L/usr/local/lib -lqdbm

Download:

Adserver          610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola




Introduction to Das U-Boot, the universal open source bootloader.

Tuesday, August 24, 2010

Das U-Boot is an open source bootloader available for a wide range of embedded processor architectures. This article gently introduces bootloader concepts, traces the origins of Das U-Boot, and offers technical details and tips on using Das U-Boot in embedded Linux devices.

Das U-Boot: The Universal Boot Loader.

Exciting new embedded Linux devices are appearing at an astonishing rate. From tiny 3 inch "Gumstix" boards to PDAs and smart-phones embedded Linux is everywhere. Installing and booting Linux on these wildly varying boards is quite a chore. Without a good boot loader these machines are just complicated hunks of silicon with nothing to do. That's where Das U-Boot, a Free Software universal boot loader, steps in.

A boot loader, sometimes referred to as a boot monitor, is a small piece of software that executes soon after powering up a computer. On your desktop Linux PC you may be familiar with lilo or grub, which resides on the master boot record (MBR) of your hard drive. After the PC BIOS performs various system initializations it executes the boot loader located in the MBR. The boot loader then passes system information to the kernel and then executes the kernel. For instance, the boot loader tells the kernel which hard drive partition to mount as root.

In an embedded system the role of the boot loader is more complicated since these systems do not have a BIOS to perform the initial system configuration. The low level initialization of microprocessors, memory controllers, and other board specific hardware varies from board to board and CPU to CPU. These initializations must be performed before a Linux kernel image can execute.

At a minimum an embedded loader provides the following features:

    * Initializing the hardware, especially the memory controller.
    * Providing boot parameters for the Linux kernel.
    * Starting the Linux kernel

Additionally, most boot loaders also provide "convenience" features that simplify development:

    * Reading and writing arbitrary memory locations.
    * Uploading new binary images to the board's RAM via a serial line or Ethernet
    * Copying binary images from RAM to FLASH memory

Das U-Boot.

Das U-Boot is a GPL'ed cross-platform boot loader shepherded by project leader Wolfgang Denk and backed by an active developer and user community. U-Boot provides out-of-the-box support for hundreds of embedded boards and a wide variety of CPUs including PowerPC, ARM, XScale, MIPS, Coldfire, NIOS, Microblaze, and x86. You can easily configure U-Boot to strike the right balance between a rich feature set and a small binary footprint.

U-Boot has its origins in the 8xxROM project, a boot loader for 8xx PowerPC systems by Magnus Damm. When bringing that project to Sourceforge in 2000, current project leader Wolfgang Denk renamed the project 'PPCBoot," since Sourceforge did not allow project names to begin with a digit.

The openness and utility of PPCBoot fanned the flames of its popularity, driving developers to port PPCBoot to new architectures. By September, 2002, PPCBoot supported four different ARM processors, and the name PPCBoot was becoming quaint. In November, 2002, the PPCBoot team retired the project, which led directly to the surfacing of "Das U-Boot."

The strength of the Free Software development process is clearly evident in the success of U-Boot. The four freedoms expressed by the FSF's Free Software Definition directly fuel U-Boot's impressive progress and wide spread deployment.

You can jump start your next embedded Linux project using U-Boot to take care of the low-level board initializations, allowing you to focus on the core of your embedded application. Downloading images and flashing kernels should be the least of your worries. If the need arises, however, you have the source code, and can add support for new hardware or add a special feature.

Prerequisites.

Before building and installing U-Boot you need a cross-development tool chain for your target architecture. The term tool chain is a bit squishy, but generally means a C/C++ compiler, an assembler, a linker/loader, associated binary utilities and header files for a specific architecture, like PowerPC or ARM. Collectively these programs are called a tool chain.

You are probably familiar with the tool chain on your desktop Linux PC. That tool chain runs on an x86 platform and generates binaries for an x86 platform. A cross-development tool chain executes on one CPU architecture, but generates binaries for a different architecture. In my case the host architecture is x86 while the target architecture is ARM and PowerPC. Sometimes this process is also referred to as cross-compiling.

While it is possible to configure and build a tool chain from source it is time consuming and the myriad of configuration options makes it quite error prone. I highly recommend using a pre-built tool chain from a Linux vendor. The Embedded Linux Development Kit (ELDK), also by Wolfgang Denk, contains the tool chains used in this article.

Using cross-development tools makes it an absolute dream to develop embedded systems using Linux as the host development workstation. No need to maintain machines running other operating systems in order to run the compiler.

Configuring and Building.

Building U-Boot for a supported platform is very straight forward, very similar to the familiar "untar, configure, make" method used by many software projects. To setup a default configuration for a particular board type this at the shell prompt after untarring the U-Boot tarball,

localhost:$ cd u-boot
localhost:$ make mrproper
localhost:$ make _config

where board> matches the board you want to build. This step setups the CPU architecture and board type.

You can fine tune the default configuration for your particular environment and board by editing the configuration file, "include/configs/board>.h". This file contains several C-preprocessor #define macros that you can modify for your needs. Some common options you might want to change are:

/* Serial port configuration */
#define CONFIG_BAUDRATE         19200
#define CFG_BAUDRATE_TABLE      { 9600, 19200 }

/* Network configuration */
#define CONFIG_IPADDR           10.0.0.11
#define CONFIG_NETMASK          255.255.255.0
#define CONFIG_SERVERIP         10.0.0.1

These definitions are self explanatory, except for maybe CONFIG_SERVERIP, which is the IP address U-Boot uses for TFTP and NFS. Don't worry too much about these right now as you can change them later when U-Boot is running. For the complete list of configuration options see u-boot/README.

Now to build the binary image, u-boot.bin, type the following:

cd u-boot
make

You have several options for installing the binary image on your target board, and which option you select depends on your board and development environment. You might use a BDM/JTAG programmer, an existing vendor's boot loader or even an older version of U-Boot. While this step is crucial it is beyond the scope of this article to describe this procedure. From here on I will assume you have successfully installed U-Boot on your target board.

Getting Started.

The next step is configuring your host workstation for serial communications with your target platform. On my system I have a DB9 serial cable connected to /dev/ttyS0. U-Boot expects the serial line to be set for 8 data bits, 1 stop bit, no parity and no handshake.

You can use your favorite serial communications program to connect to U-Boot. I prefer to use Kermit and a tiny Kermit script from within an emacs shell buffer. I put the following Kermit script into a file called "serial-term" and make the file executable:

#!/usr/bin/kermit
echo connecting /dev/ttyS0 .....
set line /dev/ttyS0
set FLOW AUTO
set speed 19200
set serial 8n1
SET CARRIER-WATCH OFF
connect

I like running serial-term from within an emacs shell because emacs keeps track of my command history, which the U-Boot shell does not support. Trust me, while developing you will be hitting the reset button on your board a lot and want to "up arrow" to the previous load command you just entered.

The user interface to U-Boot consists of a command line interrupter, much like a Linux shell prompt. When connected via a serial line you can interactively enter commands and see the results. After power on the initial u-boot prompt looks like this:

U-Boot 1.1.2 (Aug  3 2004 - 17:31:20)
RAM Configuration:
Bank #0: 00000000  8 MB
Flash:  2 MB
In:    serial
Out:   serial
Err:   serial
u-boot #

This tells you that you have 8 megabytes of RAM starting at address 0x00000000, two megabytes of Flash and that the C-library file streams stdin, stdout and stderr are connected to the serial line.

You can receive more information about our board be issuing the board info command, bdinfo. In the folowing the commands typed by me appear in bold.

u-boot # bdinfo
DRAM bank = 0x00000000
-> start = 0x00000000
-> size = 0x00800000
ethaddr = 00:40:95:36:35:33
ip_addr = 10.0.0.11
baudrate = 19200 bps

Here you see the see the RAM configuration information again, the Ethernet MAC address, the IP address and serial port baud rate.

Environment Variables

Much like a traditional Linux shell the U-Boot shell uses environment variables to tailor its operation. The U-Boot commands to manipulate environment variables have the same names as the BASH shell. For instance printenv and setenv behave the same as their BASH shell counterparts.

In the following example you will dump the current environment variables using the "printenv" command and change the IP address of the TFTP server using the "setenv" command.

u-boot # printenv
baudrate=19200
ethaddr=00:40:95:36:35:33
netmask=255.255.255.0
ipaddr=10.0.0.11
serverip=10.0.0.1
stdin=serial
stdout=serial
stderr=serial
u-boot # setenv serverip 10.0.0.2
u-boot # printenv serverip
serverip=10.0.0.2

You can create short shell scripts by storing a sequence of U-Boot commands, separated by semicolons, in an environment variable. To execute the script use the "run" command followed by the variable name. This can be handy to automate repetitive tasks during development.

Network Commands

Having a network connection on your boot loader is very convenient during development. If your project requires several networked boards they can all download and boot the same kernel image from a centralized server. When you update the kernel you only need to update the single copy on the server and not each board individually.

U-Boot supports TFTP (Trivial FTP), a stripped down FTP that does not require user authentication, for downloading images into the board's RAM. The "tftp" command needs two pieces of information, the name of the file to download and where in memory to store the file as shown in the following example:

u-boot # tftp 8000 u-boot.bin
From server 10.0.0.1; our IP address is 10.0.0.11
Filename 'u-boot.bin'.
Load address: 0x8000
Loading: ###################
done
Bytes transferred = 95032 (17338 hex)

The size and location of the downloaded image are stored in the fileaddr and filesize environment variables for possible latter use by other shell commands and scripts.
U-Boot also supports NFS so you can download images from your existing NFS server as well.

Flash Commands

Some embedded projects only have access to a network while being programmed "in the factory". When deployed in the field the boards boot a kernel stored in the flash memory. The board can be updated in the field by reprogramming the flash memory with a new kernel. U-Boot offers several commands for programming, erasing and protecting the flash memory.

To see what type of flash memory your board has enter the flinfo command:

u-boot # flinfo
Bank # 1: AMD Am29LV160DB 16KB,2x8KB,32KB,31x64KB
Size: 2048 KB in 35 Sectors
Sector Start Addresses:
S00 @ 0x01000000 ! S01 @ 0x01004000 !
S02 @ 0x01006000 ! S03 @ 0x01008000 !
S04 @ 0x01010000 ! S05 @ 0x01020000 !
S06 @ 0x01030000 S07 @ 0x01040000
...
S32 @ 0x011D0000 S33 @ 0x011E0000
S34 @ 0x011F0000

The output carries quite a lot of information. Immediately you see the flash manufacturer, part number and sector layout. This particular part begins with a 16KB sector at address 0x01000000, followed by two 8KB sectors, a 32KB sector and 31 64KB sectors for a total of 2 megabytes in 35 sectors.

The exclamation points following sectors 0 through 5 indicate that those sectors are "protected". In this example sectors 0 through 4 contain the code for U-Boot itself, and sector 5 is used to store the environment variables. Any attempt to program these sectors without first unlocking them will fail. This offers some level of protection from "rm -rf /" type mistakes when programming the flash.

Continuing the TFTP example, let's assume the file you uploaded is a new version of U-Boot. You need to first unlock flash sectors 0 through 4 before programming the flash. Type "protect off 1:0-4", which instructs U-Boot to allow write access to flash bank 1, sectors 0 through 4.

u-boot # protect off 1:0-4
Un-Protect Flash Sectors 0-4 in Bank # 1

Next you must prepare the flash sectors for programming by erasing them. Enter "erase 1:0-4", which tells U-Boot to erase sectors 0 through 4 of flash bank 1.

u-boot # erase off 1:0-4
Erase Flash Sectors 0-4 in Bank # 1
Erasing Sector 0 @ 0x01000000 ... done
Erasing Sector 1 @ 0x01004000 ... done
Erasing Sector 2 @ 0x01006000 ... done
Erasing Sector 3 @ 0x01008000 ... done
Erasing Sector 4 @ 0x01010000 ... done
[end courier]

To program the flash memory you need to copy the image from RAM to the address of flash sector 0, 0x01000000, using the cp command. You will use the byte version of the command to copy the specified number of bytes. In this case you can use the fileaddr and filesize environment variables, which contains the RAM address and number of bytes loaded by the last TFTP command. Type cp.b ${fileaddr} 1000000 ${filesize} at the u-boot prompt.

u-boot # cp.b ${fileaddr} 1000000 ${filesize}
Copy to Flash... ................ done

Finally restore the write protection on flash sectors 0 through 4 by typing protect on 1:0-4 at the U-Boot prompt.

u-boot # protect on 1:0-4
Protect Flash Sectors 0-5 in Bank # 1

You have just updated the U-Boot code for you board. The next reboot will run the newly uploaded U-Boot code. Well done!

The final flash related command is the saveenv command, which like the name implies saves your current environment variables to a reserved flash sector. This allows your environment variables to persist across power cycles and reboots. You might want do this after updating the server IP address or when adding a new script. Type saveenv to save your environment.

u-boot # saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
Erasing Sector 5 @ 0x01020000 ... done
Erased 1 sectors
Writing to Flash... ................ done
Protected 1 sectors

As you can see the saveenv command bundles together the un-protect, erase, copy and protect steps you covered in the previous example.

Booting

OK, now you know how to load your image into RAM or flash. Next you want to run your kernel and boot into Linux. Most kernel images expect to start executing from a known location in memory, so you need to load your image into the correct place. The U-Boot distribution provides a nice utility for the host system called "mkimage" for just this purpose.

After creating your kernel image use mkimage to add a tiny header containing the load and execute address for the image, like this (all on one line):

localhost:$ mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "Linux 2.6.6" -d linux.bin uImage.bin

This command appends a small header containing the load and execute address 0x8000 to your kernel image and creates a new file called uImage.bin. The header also contains a CRC32 checksum, checked later during the image load. Remember the above command is run on your development workstation, not the embedded target.

You can now upload uImage.bin to your board and use the bootm command to boot your image. In the following example let's assume you stored uImage.bin at address 0x01030000 in the flash memory.

u-boot # bootm 1030000
## Booting image at 01030000 ...
Image Name: Linux 2.6.6
Image Type: ARM Linux Kernel Image
Data Size: 700256 Bytes = 683.8 kB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Starting kernel ...

And off you go! U-Boot uses the header information to copy your image to the correct location and then to start execution at the specified address. Notice that U-Boot also verifies the CRC32 checksum contained in the header before executing the kernel.
Adserver          610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola



Aprsdigi is a repeater for the Automatic Position Reporting System, APRS.

Saturday, August 21, 2010

Aprsdigi is a repeater for the Automatic Position Reporting System, APRS.

It also includes aprsmon, a one-way gateway to APRS on TCP/IP.

Aprsdigi is a specialized Amateur Packet Radio (AX.25) UI-frame digipeater for the Automatic Position Reporting Systems, APRS(tm). It uses the Linux kernel AX.25 network stack as well as the SOCK_PACKET facility to listen for packets on one or more radio interfaces (ports) and repeat those packets -- with several possible modifications -- on the same or other interfaces. Aprsdigi can also use the Internet to tunnel connections among other APRS digipeaters and nodes using IPv4 or IPv6 UDP unicast or multicast.


Aprsdigi implements conventional packet radio AX.25 digipeating, in which a packet is digipeated if the next hop (non-repeated) digipeater ("via") callsign matches the AX.25 port's callsign and sub-station ID (SSID) or an alias callsign and SSID.


There are a number of extensions to conventional digipeating that have been proposed for use in the APRS community. Some of these features have been adopted by Terminal Node Controller (TNC) manufacturers, notably Paccomm and Kantronics. Aprsdigi implements most if not all of the commercialy adopted and proposed features. See the APRS 1.0 Protocol Specification at www.tapr.org for protocol documentation. Aprsdigi attempts to minimally comply with the protocol specification as well as support experimental APRS features. Specific features implemented include:

* Single-interface conventional UI-frame digipeating.
* Cross-interface digipeating (also known as bridging, routing or gatewaying) and one-to-many fanout.
* Substitution of a digipeated alias with the interface's callsign (typically used to substitute RELAY, WIDE or TRACE aliases).
* WIDEn-n flooding algorithim.
* TRACEn-n route recording.
* Mic-Encoder(tm) support, including SSID-based digipeating, decompression of packets into the conventional APRS MIM format. (The Mic-Encoder compression is also used by other products such as the Kenwood TH-D7A and D700, and TAPR PIC-Encoder).
* TheNet X1J4 node beacon text translation (removal of the lqTheNet X1J4 (alias)rq prefix from the btext).

 

General Options.

-v --verbose
Produce verbose debugging output.
-T --testing
Test mode: listen to my packets too. This mode is useful for off-air experimentation and configuration testing. Do not use it on-air.
-D --kill_dupes
Suppress Duplicate packets. Remembers duplicate packets for the number of seconds given by the -k option and will not repeat them more than once. This reduces conjestion caused when several digipeaters that share a common flooding alias (e.g. WIDE) have overlapping footprints, causing geometric duplication of packets addressed via lqWIDE,WIDErq for example.
-L --kill_loops
Suppress Looping packets. Similar in function to duplicate packet suppression, but looks back through the list of already digipeated callsigns in the packet's digipeat list and kills any packets that list a callsign belonging to this aprsdigi. Note that only real callsigns are compared. Generic flooding aliases are not. Therefore, loop detection is only useful when callsign substitution is used.
-V --version
Print program version and exit.
-n|s|e|w --north|south|east|west
Set North|South|East|West SSID directional path.
-d --digipath
Set SSID omnidirectional next-hops when operating in a non flooding network (e.g. when WIDEn-n is not an option).
-f --flood
Set flooding alias. Use lq-f WIDErq to enable WIDEn-n flooding. Use -f multiple times to define several flooding aliases.
-F --trace
Set flooding trace callsign. Use lq-F TRACErq to enable TRACE and TRACEn-n flooding. Use -F multiple times to define several trace aliases.
-k --keep secs
Remember old packets for this long for duplicate packet detection. Default is 28 seconds.
-l --logfile file
Log digipeated packets to this file.

Per-Interface Options.


Put these options before each -p --interface to set new values as needed. The values you set are remembered for subsequent -p's so options you want to set for all interfaces need only be specified once, before the first -p. But you have to remember to unset an option if you don't want it to apply to subsequent interfaces.
-C (-c) --[no]subst_mycall
Do (not) perform callsign substitution. When enabled, aliases are replaced with the interface's callsign when repeated.
-M (-m) --[no]mice_xlate
Do (not) perform Mic-E to MIM translation. When enabled, compressed Mic-E reports are expanded into one MIM-style position report packet and optionally a second telemetry packet if telemetry was supplied in the Mic-E packet.
-X (-x) --[no]x1j4_xlate
Do (not) perform X1J4 translation. When enabled, the leading lqTheNet X1J4 (alias)rq text is removed when digipeated. This allows non-compliant APRS implementations to detect an APRS position report in an X1J4 beacon.
-i --idinterval secs
Seconds between ID transmissions. Set to 0 to disable IDs on this interface. Default is 570 (9 minutes 30 seconds). IDs are only sent if the interface transmitted anything since the last ID. ID packets are addressed to the lqIDrq callsign, have no digipeat path, and list the callsign and aliases for the interface the ID is being transmitted on.
-t --tag text
Text to append to received packets. Use -t - to reset to empty. Use this, for example, when gatewaying Mic-E packets from a voice repeater to the APRS net frequency to indicate where the report originated.
-3 --3rdparty
Enable 3rd party tunneling. Packets tunneled to a 3rd party interface are sent with the unused digipeaters removed from the digipeater list. Packets tunneled from a 3rd party interface have the Source Path Header prepended to the packet payload prefixed by the "}" character.
-0 --no3rdparty
Enable transparent tunneling. No special tricks are done when sending to or receiving from a tunneled interface. If the interface does not natively support AX.25 addresses (from-call, to-call, and digipeater list), then the address header is prepended to the payload in "cooked" format. Likewise, a cooked prepended header is stripped from a cooked interface and put back in the AX.25 address when going from a non-AX.25 to AX.25 interface.
-o r --norx
Disable receiving on the following interface(s).
-o R --rx
Enable receiving on the following interface(s).
-o t --notx
Disable transmitting on the following interface(s).
-o T --tx
Enable transmitting on the following interface(s).
-o s --notxsame
Disable retransmitting a received packet on the same interface.
-o S --txsame
Enable retransmitting a received packet on the same interface.
-o d --duplicate intf
Duplicate received packets without modification to the given interface (port).
-p --interface ax25:port:alias1,alias2,...
AX25 interface name (port) and optional list of aliases. The primary callsign is obtained from the interface's configuration. (See ifconfig(8)).
-p --interface udp:host/port/ttl:alias1,alias2,...
IP host name or address and list of aliases. IP addresses may be IPv4 unicast or multicast or IPv6 unicast. The primary callsign is obtained from the first alias.
-p --interface unix:filename:alias1,alias2,...
Unix file and list of aliases. Useful for debugging by setting up a simulated APRS network on one machine. You may want to make your FIFOs explicitly transmit- or receive-only to avoid confusion. The primary callsign is obtained from the first alias.
-B|b --[no]bud
addr Is similar to a TNC-2's BUDLIST. Use -B --bud to accept or -b --nobud to ignore packets from a sender or group of senders. Budlists are attached to each interface and can be reset with --bud -
You can set up a global budlist once, or per-interface budlists. The format of addr varies based on the interface type:
--bud ax25:callsign-ssid
matches only a given digipeater callsign and SSID. For example, -B ax25:n0clu-14.
--bud ax25:callsign
matches all SSIDs for the given callsign. For example -B ax25:n0clu.
--bud ip:hostname
matches one Internet host name (IPv6 or IPv4). For example -B ip:n0clu.ampr.net
--bud ip:address/maskbits
matches all IP addresses that have the given prefix. For example --bud ip:44.0.0.0/8 matches the entire class-A network. --bud ip:192.168.0.0/16 matches the entire class-B network. --bud ip:fe80::201:3ff:fe9a:38c6 matches a single IPv6 host. --bud ip:2002:905::/32 matches the 32-bit IPv6 prefix.

 Runtime controlls.

aprsdigi responds to the following signals:

SIGUSR1
Print cumulative statistics. For each port, the following counters are displayed: packets received and how many of those where ignored, duplicates, loops, mic-E formatted; packets transmitted and how many of those where conventional digipeats, flooding digipeats (WIDEn-n), SSID-based digipeats, and IDs. If a log file was specified with the -l --logfile option, then the statistics are written to that file. Otherwise they are written to stderr.

SIGUSR2
Prints the statistics and then resets all counters to zero.

All other normal termination signals cause final statistics to print before aprsdigi exits.

Download:

Similar packages:
Adserver          610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola



4 tools open source for amateur radio applications.

Sunday, August 15, 2010

Linux Radio Transmission Decoder.

The Multimon software can decode a variety of digital transmission modes commonly found on UHF radio. A standard PC soundcard is used to acquire the signal from a transceiver. The decoding is done completely in software. Currently, the following modes are supported:

    AX.25
        1200 Baud AFSK
        2400 Baud AFSK (2 variants)
        4800 Baud HAPN
        9600 Baud FSK (G3RUH)
    POCSAG
        512 Baud
        1200 Baud
        2400 Baud
    Miscellaneous
        DTMF
        ZVEI

An arbitrary set of the above modes may run concurrently on the same input signal (provided the CPU power is sufficient), so you do not have to know in advance which mode is used. Note however that some modes might require modifications to the radio (especially the 9600 baud FSK and the POCSAG modes) to work properly. POCSAG (Post Office Code Standards Advisory Group) is a common paging transmission format.

Download:

Similar packages:
'Morse Classic' is a morse-code training program for aspiring radio hams.

It can generate random tests or simulated QSOs resembling those used in the ARRL test (a QSO generator is included).

There are a plethora of options to vary the training method. In one of the simpler modes, this program will take text from standard input and render it as Morse-code beeps.

Download:

Similar packages:
Minimuf program to predict high frequency propagation data.


The Maverick Meerkat (active development)
Show details 3.5-2 release (universe) 15 weeks ago

The Lucid Lynx (current stable release)
Show details 3.5-2 release (universe) 39 weeks ago

The Karmic Koala (supported)
Show details 3.5-1 release (universe) 68 weeks ago

The Jaunty Jackalope (supported)
Show details 3.5-1 release (universe) 93 weeks ago

The Hardy Heron (supported)
Show details 3.5-1 release (universe) 147 weeks ago

The Dapper Drake (supported)
Show details 3.5-1 release (universe)


Marote Rig Control Program for the Elecraft K2.

This program uses a nice Qt GUI to control the Elecraft K2 amateur radio transmitter/receiver.

See http://www.elecraft.com for a description of the K2.

The serial port can be used with marote to control most of the K2's functionality.

Download:

Similar packages:

Adserver          610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

rss_trappola



My Favorites

Finance

Logo IWBank gif120x60 banner 9

Antipixel & Counters

Dr.5z5 Open Feed Directory BlogESfera Directorio de Blogs Hispanos - Agrega tu Blog BlogItalia.it - La directory italiana dei blog Software blogs Computers blogs Il Bloggatore Add to Technorati Favorites diigo it Peru Blogs Programming Blogs - Blog Catalog Blog Directory AddThis Social Bookmark Button Find the best blogs at Blogs.com. website counter
Social Bookmarking
Add to: Mr. Wong Add to: Webnews Add to: Icio Add to: Oneview Add to: Linkarena Add to: Favoriten Add to: Seekxl Add to: Kledy.de Add to: Social Bookmarking Tool Add to: BoniTrust Add to: Power Oldie Add to: Bookmarks.cc Add to: Favit Add to: Newskick Add to: Newsider Add to: Linksilo Add to: Readster Add to: Folkd Add to: Yigg Add to: Digg Add to: Del.icio.us Add to: Reddit Add to: Jumptags Add to: Upchuckr Add to: Simpy Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Spurl Add to: Google Add to: Blinklist Add to: Blogmarks Add to: Diigo Add to: Technorati Add to: Newsvine Add to: Blinkbits Add to: Ma.Gnolia Add to: Smarking Add to: Netvouz Information

Recent Posts