Wednesday, September 29, 2010

Changing Firmware

I earlier posted how to create your environment to change ctb. In the mean time I learned a lot more and use different ways to build firmware components.
To prepare a component I execute the following commands:
export MACHINE_NAME=dr1000s
autoreconf --install
intltoolize
./configure --host=arm-poky-linux-gnueabi --sysconfdir=/etc --prefix=/usr
Make/copy cycles look as follows:
make install-strip DESTDIR=~/Development/4.0/Install/
scp ../../Install/usr/bin/sysd root@qemu:/media/mmcblk0p1/Programs/_mackxpatch/bin/
scp ../../Install/usr/bin/popupmenu root@qemu:/media/mmcblk0p1/Programs/_mackxpatch/bin/
scp ../../Install/usr/bin/ctb root@qemu:/media/mmcblk0p1/Programs/_mackxpatch/bin/
I included copy-examples for sysd, popupmenu and ctb.
I copy them first to some location in the qemu and from there to the final location /usr/bin, since direct copying is not possible, so execute the following:
ssh qemu
to log-in to the emulator and then:
cp /media/mmcblk0p1/Programs/_mackxpatch/bin/popupmenu /usr/bin/
cp /media/mmcblk0p1/Programs/_mackxpatch/bin/sysd /usr/bin/
cp /media/mmcblk0p1/Programs/_mackxpatch/bin/ctb /usr/bin/
to copy the binaries to the final position.
Other changed data generated during the build can be copied directly:
scp ../../Install/usr/share/ctb/settings/global.db root@qemu:/usr/share/ctb/settings/
scp ../../Install/usr/share/ctb/settings/lastapps.desktop root@qemu:/usr/share/ctb/settings/

Emulator Tip

One of the most used key-combinations that I use on qemu is Ctrl-Alt-1 and Ctrl-Alt-3 to switch between the UI and the stdout/stderr. Specially when changing firmware.

Friday, July 2, 2010

Compiling ctb

1) First setup your environment:
source /usr/local/poky/eabi-glibc/arm/environment-setup

2) Pick your machine
export MACHINE_NAME=dr1000s
or
export MACHINE_NAME=dr800sw

3) Then prepare for configure:
autoreconf --install
intltoolize

4) For configure you need to use the following options:
./configure --host=arm-poky-linux-gnueabi --sysconfdir=/etc --prefix=/usr

5) Then build it:
make

6) and copy to target:
scp src/ctb root@qemu:~/

7) To reduce the size of the ctb binary use:
arm-poky-linux-gnueabi-strip src/ctb
which will reduce the binary from anout 300K to 90K. (copy again)
8) login to the emulator
ssh qemu

9) and copy it to the correct place (it is not possible to do this directly via scp)
(Note that this only copies the ctb-binary and assumes that all files it depends on are already on the emulator, which is true if you did not do any strange things)
cp /usr/bin/ctb ~/ctb.org <-- only do this once :-) cp ~/ctb /usr/bin/

10) Now restart the qemu
shutdown now
and then restart via Anjuta (or any other way)
11) By pressing Ctrl-Alt-3 you can see the system logging of qemu, use Ctrl-Alt-1 to go back.

And by now you have spend a lot of time and changed nothing :-)

Hello World 2

Since (I think it was) R1.6 an extra step is needed to build the hello-world example.
Before the first configure of any of the irex components (like hello-world) a call to intltoolize is needed.

Sunday, April 11, 2010

Settings in R2.0

The way that settings are handled has changed in R2.0. Settings is now not anymore a separate application, but it is a special folder with short-cuts to settings applications. The old settings are still implemented in the settings-app, but with a new argument for the application, one of the old settings windows can be selected.
The special folder for settings is located in /usr/share/ctb/settings on the device. See \iRex\ctb\data\settings in the sources to see how the settings are now implemented with the .desktop files.
When adding new settings a separate application can be written, a shortcut to the application needs to be added to /usr/share/ctb/settings so that they become avaialble when the user selects settings. An example of a settings application can be found in: \iRex\hello-world\settings.

Monday, March 8, 2010

Which Libraries do I need?

Sometimes when porting programs it is not clear which libraries you still need. The program build nicely, but does not run on the emulator or DR itself. The trick is to use the readelf-command.
arm-poky-linux-gnueabi-readelf -d your-app
shows a list of required libraries (among others).

Porting Libraries

When porting exsisting programs to the DR1000, the program itself is mostly not the problem, but the libraries it needs are. From the MobileRead forum I gathered the following receipt:
I assume you will be working in an environment in which you succeeded to build hello-world.
1) Configure
./configure --host=arm-poky-linux-gnueabi --prefix=/usr
With this line you indicate that you are going to build for arm and that the root of the resulting files should go in the /usr folder.
2) Building
make
Duh!...
3) Creating the installables
make install DESTDIR=/home/user/mylib
cd /home/user/mylib
tar -czf mylib.tar.gz usr
This creates the stuff that is normally needed to install a library (.so .a) and to use it during building (.h).
4) installing in build environment
sudo tar -xzvf mylib.tar.gz -C /usr/local/poky/eabi-glibc/arm/arm-poky-linux-gnueabi/
This copies the libraries and header files into the correct place of the development environment.

You should now be able to use the library for porting other apps.

This ofcourse only works for libabries that come with a configure script.