DataBase on i.MX28

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

DataBase on i.MX28

1,445件の閲覧回数
alexandrglukhov
Contributor III

Hello, I have a question about databases. I need to install PostgreSQL on i.MX28, in which application will write data. I download postgresql-9.3.5.tar.bz2 from postgresql.org, install it in rootfs directory of LTIB. Then I create new database, and write into it three rows. Then I wrote SD card and launch i.mx. But when I try to launch any of scripts of pgsql, I get only errors.

root@freescale /pgsql/bin$ ./psql

./psql: line 1: syntax error: unexpected "("

root@freescale /pgsql/bin$ ./postgres

./postgres: line 1: syntax error: unexpected "("

And application can't connect to db too.

I tried to connect to db from application on windows, everything ok.

So, how can I start the PostgreSQL server on i.mx? Or there is something wrong?

And I also create a new user Admin to launch postgresql (because it is impossible to launch it under root), so should I create another user on i.mx?

Maybe there is another way of installation PostgreSQL on i.mx? With LTIB and .spec?

Thanks in advance.

ラベル(2)
タグ(3)
0 件の賞賛
返信
6 返答(返信)

1,079件の閲覧回数
b36401
NXP Employee
NXP Employee

By the way. I can offer you to use mysql instead.
It is included into the BSP for i.MX28.

0 件の賞賛
返信

1,079件の閲覧回数
alexandrglukhov
Contributor III

Okay, thank you for your answers. But I need to install PostgreSQL. Well, I should compile it from sources. That sounds good, but I don't know how) Please, could you give me any advices how to do it? Becaue I have no idea

0 件の賞賛
返信

1,079件の閲覧回数
b36401
NXP Employee
NXP Employee

To do that, first you need to download PostgreSQL source files.
For example you can get them from their official site:

And then you need to compile them on your host PC using cross compiler.
You can use toolchain from LTIB.
Or may try using use CodeSourcery (Mentor) toolchain on Windows host:

http://www.mentor.com/embedded-software/codesourcery
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/

Alternativelly you can compile PostgreSQL directly on the board if you install gcc there.
However I suppose this way is worse.

1,079件の閲覧回数
alexandrglukhov
Contributor III

I just tried to compile with LTIB. I downloaded postgresql-9.3.5.tar.bz2 from their site and put it  into rpm/SOURCES, and created in  dist/lfs-5.1 directory postgresql with file postgresql.spec in it. File contains:

%define pfx /opt/freescale/rootfs/%{_target_cpu}

Summary        : PostgreSQL for arm

Name            : postgresql

Version        : 9.3.5

Release        : 1

License        :

Vendor          : PostgreSQL

Packager        :

Group          : System Environment/Libraries

URL            : http://

Source          : %{name}-%{version}.tar.bz2

BuildRoot      : %{_tmppath}/%{name}

Prefix          : %{pfx}

%Description

%{summary}

%Prep

%setup

%Build

./configure --prefix=%{_prefix} --host=$CFGHOST --build=%{_build}

make

%Install

rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT/%{pfx}

%Clean

rm -rf $RPM_BUILD_ROOT

%Files

%defattr(-,root,root)

%{pfx}/*

After ./ltib -p postgresql.spec I get errors:

checking for zic... no

configure: error:

When cross-compiling, either use the option --with-system-tzdata to use

existing time-zone data, or set the environment variable ZIC to a zic

program to use during the build.

error: Bad exit status from /home/ubuntu/Projects/TionPro28/ltib/ltib/tmp/rpm-tmp.2856 (%build)

I think, my .spec file is bad, could you help me to create correct .spec? Or may be give an advise about it?

0 件の賞賛
返信

1,079件の閲覧回数
alexandrglukhov
Contributor III

I think, Buildroot (http://buildroot.org/download.html) contains that PostgreSQL, which is needed for i.mx28. But is it possible to take it from there and past into rootfs of ltib?

0 件の賞賛
返信

1,079件の閲覧回数
b36401
NXP Employee
NXP Employee

I suspect that you actually installed x86 PostgreSQL on your PC.

Such outputs

> ./psql: line 1: syntax error: unexpected "("
> ./postgres: line 1: syntax error: unexpected "("

mean that Linux OS running on the board does not recognize
psql and postgres as executable binaries and tryes to run them
as scriprs. It suggests me that psql and postgres are actually
x86 binaries.

Please check it with "file" utility such way. Here busybox
is i.MX28 binary and /bin/bash is x86 one:

vik@tecno:~/ltib/1012-28/ltib-perl/rootfs/bin$ file busybox
busybox: setuid ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
vik@tecno:~/ltib/1012-28/ltib-perl/rootfs/bin$ file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
vik@tecno:~/ltib/1012-28/ltib-perl/rootfs/bin$

If so you need to get PostgreSQL compiled for right architecture
or compile it from sources yourself.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信