SQLite for uCLinux
1. Development Tools Need
hardware: Armsys44b0x development board
software: ucLinux_armsys_051111.tgz , sqlite 2.8.15, sqlite-2.8.13-uc0 patch
2. Steps
2.1 Download
Download SQLite 2.8.15 from SQLite home page
Download sqlite patch for ucLinux sqlite-2.8.13-uc0 patch, no patch for version 2.8.15 found , so we use sqlite-2.8.13-uc0 patch instead and it works well. The URL for the patch is:
http://www.menIE.org/georges/uCLinux/sqlite-2.8.13-uc0.patch.gz
2.2 Installation
Extract the sqlite-2.8.15 tarball into your uCLinux-dist/user directory:
tar -zxvf sqlite-2.8.15.tar.gz
Change the current working path to sqlite source directory and apply the patch
zcat sqlite-2.8.13-uc0.patch.gz |patch -p1
2.3 Compliation
In uCLinux-dist/user/makefile add the sqlite directory in the list of directorIEs to compile:
dir_y += sqlite # this is the line to add
compile and copy the generated sqlite binary to romfs/bin
make user_only
3. Test
# 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/s
q
sqlite> .schema
create table tbl1(one varchar(10), two smallint);
sqlite> .exit
#
# echo “select * from tbl1;” | sqlite ex1.db
hello!|10
goodbye|20
#
Tags: SQLite, uCLinux
參考了外文資料而成。