= SQLite = '''Status:''' Exploratory SQLite was originally designed to be an embedded database for on-board guided missile destroyers, for the US Navy ''The Definitive Guide to Sqlite By Michael Owens''. Unlike many database program, SQLite is designed to be an itegral part of the embedded system. SQLite doesn't use interprocess communication, which makes it much faster than a database system that does. = Porting SQLite to RTEMS = This is a very rough first stab at porting SQLite to RTEMS. It's designed to help a developer that might be interested in designing the [http://www.rtems.org/wiki/index.php/RTEMS_DBKit RTEMS_DBKit]... ''Note: there is room to port a stable release...'' I also used the [http://www.rtems.com/wiki/index.php/RTEMS_Add-On_Packages RTEMS Addon Packages] to get the necessary configurations to build on rtems. = Development Repository Editon SQLite = To build SQLite from the development repository, you need TCL and fossil. TCL is part of the SQLite build system, while fossil is another version control system. ~$ sudo apt-get install tcl8.5 fossil SQLite uses fossil for their development branch, so if you use their development branch, you have some steps to go through: First, check out a "fossil" which is a single file with all the information ~/rtems-addon-packages$ fossil clone http://www.sqlite.org/cgi/src/dir trunk.fossil Second, make and navigate into an sqlite directory: ~/rtems-addon-packages$ mkdir sqlite ~/rtems-addon-packages$ cd sqlite Third, open the fossil file ~/rtems-addon-packages/sqlite$ fossil open ../trunk.fossil Fourth, archive the sqlite folder (so you have an old copy to fall back on)... ~/rtems-addon-packages/sqlite$ cd .. ~/rtems-addon-packages$ tar -acf sqlite.fossil.tar.bz2 sqlite DO NOT close the fossil file! It will remove manifest.uuid and not compile! = Makefile.sqlite = Just figured out how to get SQLite to compile! First, install the rtems-graphics-toolkit/mman_kit, so that SQLite can use shared memory, (shm). Second, comment out the references to popen and pclose in rtems-addon-packages/sqlite/src/shell.c Third, copy the Makefile below into rtems-addon-packages/RTEMS_Makefiles/Makefile.sqlite {{{ # # Configure/build/install the sqlite library # note: comment out the references to popen and pclose in src/shell.c # until a reasonable substitution can be found include ../RTEMS_Makefiles/Makefile.common all: CFLAGS='-DPROT_READ=0x01' \ CFLAGS='-DPROT_WRITE=0x02' \ CFLAGS='-DMAP_SHARED=0x001' \ CFLAGS='-DSQLITE_OMIT_ALTERTABLE=2 ' \ LDFLAGS='-lmmap_kit' \ ../sqlite/configure \ --prefix=$(exec_prefix) \ --build=i686-linux-gnu \ --host=i386-rtems4.11 \ --disable-largefile \ --enable-cross-thread-connections \ --disable-tcl \ --disable-readline \ --disable-amalgamation \ --libdir=$(exec_prefix)/$(RTEMS_BSP)/lib \ --includedir=$(exec_prefix)/$(RTEMS_BSP)/lib/include make make install }}}= Flags Explained = # PROT_READ, PROT_WRITE, and MAP_SHARED all relate to shared memory support, and they're definitions can be found in the FreeBSD sys/mman.h header. # The SQLite omit altertable was defined to enhance security and reduce code size. # The mmap_kit was linked to provide definitions for mmap and munmap for shared memory support. = Configurations Explained = # The build had to be defined because the June 2012 sqlite developer repository couldn't recognize the build of my laptop. # As RTEMS is mostly on 32-bit (or smaller) architectures, I disabled largfile support. # Cross-thread connections looked useful for RTEMS, so I put it in there. # I disabled tcl and readline support to reduce dependencies, and # I disabled amalgamation to isolate porting issues. = Testing Ideas = Originally I thought it would be necessary to define a src/os_rtems.c because of issues with shared memory support, and thus would need to use the network filesystem, but as that is no longer an issue, I would suggest using one of the network-demos with a filesystem as a code-base to copy and the [http://www.sqlite.org/quickstart.html SQLite quickstart] guide as guideline for the database demo. = Porting Issues = The major porting issue left for a completely satisfactory build is: either declaring popen and pclose, or replacing them using the threading counter-parts may be more desirable in the long run. (After all SQLite builds okay once they are commented out). It may also be necessary to fill out the mmap_kit calls to mmap, munmap, and some other functions. = End of Report = This is all I have so far. = = References ==