SQLite for uClinux

Software download

The uClinux distribution needed is 20040218.

Download the following files :

Installation

extract the sqlite tarball into the uClinux-dist/user directory, then apply the patch as follow:

cd path_to_sqlite_subdir; zcat path_to_sqlite_patch_file | patch -p1

Compilation

Quick setup

In uClinux-dist/user/makefile add the sqlite directory in the list of directories to compile:

dir_y += games
dir_y += sqlite    # this is the line to add

all: config

then compile a new image.

Normal setup

Create a new config option to compile sqlite in uClinux-dist/config/config.in and add the corresponding rule in uClinux-dist/user/Makefile. For more info, have a look at Adding-User-Apps-HOWTO in the uClinux-dist/Documentation directory.

then compile a new image.

Runtime installation

The sqlite binary is installed in /bin. When you launch sqlite, be sure to specify a database on the writable filesystem.

A test session would be:

# cd /var
# sqlite ex1.db
SQLite version 2.8.12
Enter ".help" for instructions
sqlite> create table tbl1(one varchar(10), two smallint);
sqlite> insert into tbl1 values('hello!',10);
sqlite> insert into tbl1 values('goodbye', 20);
sqlite> select * from tbl1;
hello!|10
goodbye|20
sqlite> .databases
0           main        /var/ex1.db
1           temp        /var/tmp/sq
sqlite> .schema
create table tbl1(one varchar(10), two smallint);
sqlite> .exit
#
#  echo "select * from tbl1;"  | sqlite ex1.db
hello!|10
goodbye|20
#

uClinux port bug

Be warned that the locking mechanism is not activated, so you should not open a database by several process at the same time.

To save stack size, the maximum number of column displayed by the shell has been reduced to 20 (instead of 100 in the original code), this allow to run the sqlite binary with a 12kB stack.

sig