|
Setup a Software Development Environment for The iRex DR1000
|
||||||||||||||||
| ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
| ||||||||||||||||
|
Use the lastest Ubuntu distribution for development. Hardy Heron was used for this document. The first step in getting the development setup running in Ubuntu is specifying the apt source for the Opened Hand file source. In Ubuntu you need to have APT sources set up in order to get your application files from the correct resources. I am referring to the "apt-get" command that allows you to install and remove software on your Ubuntu machine. By supplying the location of the source files we can ensure that we are getting the proper files for our Ubuntu installation. In order to get some more information about apt-get you can go here: http://www.linux.com/feature/40745 Opened Hand is the company that is responsible for supplying the poky plugin that allows us to use the poky toolchain from within the Anjuta IDE. From the OpenedHand website:
In order for us to get the proper files for our desired platform we need to add http://debian.o-hand.com to our APT sources:
The distribution of Ubuntu that I am using for this example is “Hardy Heron” so I chose the line ending in “hardy”. Add this line to the bottom of your sources.list file. Once this line is integrated into the sources.list file you can try running an update on the system. This will look at this new sources.list entry and try to start retreiving the files related to it. Run the following command which gets all the updates to the lines added to the sources.list file:
Next I ran the poky install to get the correct dependencies for the Poky environment.
Next get the poky snapshot downloaded from here: Move the poky snapshot into the ROOT directory. It will probably have a .tar.bz2 extension so unzip and untar it with the following commands:
(note: your file names may be different depending on if you have a more recent version) Since the tar file is in your root directory untarring the snapshot file creates a “poky” directory in the “/usr/local” directory.
Note: for some reason it came up with an error when I tried to run this bzip2 command. I thought that the file was corrupt, but when I tried in windows I was able to unzip the file with WinRAR just fine. I then copied the resulting file over to my Ubuntu machine. Maybe someone can enlighten me on the reason for the problem. At this point you have all the necessary files to make the Anjuta system work with all the iRex supplied images and files. Source the environment setup script from within the new poky directory:
For now I will move on to the Anjuta installation. This creates a development environment with poky using Anjuta so we don't have to worry about the command line approach to use poky. | ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
Just to be clear, it's important to understand the following two key facts:
Use Synaptic package manager to install Anjuta which has a bunch of dependencies. The dependencies will install automatically. Then move on to the anjuta-plugin-sdk again. From the install file for the anjuta-plugin:
Therefore, the following commands should configure, build, and install this package:
Once the plugin is installed, Anjuta is ready to go. Open Anjuta at a command prompt:
| ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
Add Poky in the preferences section. In Anjuta click on Edit -> preferences. Select the "General" tab then go down to Poky SDK and check the box next to it in order to include it in Anjuta. Here it would be a good idea to just close out of Anjuta and open it back up again to ensure that the Poky SDK stuck in the preferences. Go back to Edit -> preferences to see the options for the Anjuta plugin. You’ll notice that there’s two choices at the top of the preferences on the screenshot I have supplied.
http://developer.irexnet.com/pub/iOn/
SDK root: this is just telling Anjuta where to find the files relating to your cross-compiler. Set it to the “arm” folder of the poky directory structure which was created when you untarred the poky toolchain snapshot. Setting it to the “arm” directory supplied by iRex will give Anjuta the necessary information to use the Poky plugin to create an appropriate set of output files tailored for the ARM processor inside the iRex DR1000. The other options provided relate to the Target Options.
Kernel: Point this to your zImage file: “zImage-2.6.23-qemuarm-20081016230544.bin” in my case. This is the Linux version 2.6.23 image that is made for use with the DR1000. It’s likely a stripped-down version of this linux distrubution with minimal drivers and used specifically for this one hardware platform. Tailoring for the DR1000 would shave off a lot of unnecessary memory hogs – a necessary step in pretty much any embedded project.
Here's what my preferences looked like when I was done: From the Poky readme file you can see that they describe everything in a more compact form:
| ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
Install the following packages through the synapsis package manager.
New -> project should work fine now. Questions:
In order to make things run smoothly, you need to run the following line:
Otherwise you'll run into the following error:
To make this a permanent change you need to modify the /etc/sysctl.cfg file. Make sure the variable vm.mmap_min_addr is set to zero. Just keep in mind that this file won’t affect the system until you reboot. You can run the "sudo..." line mentioned above instead of rebooting for now. Run Tools -> Start QEMU in order to test that the QEMU emulator is working properly. It will slowly pop up with a black window with a logo. Next task is to get the source code from iRex for a desired program that you want to try out. The first one you should just try out is the hellow_world program. I downloaded hello_world program from open hello_world.anjuta within Anjuta to get the project opened I tried Build -> Run Autogenerate...
After running Autogenerate I was able to follow the anjuta-plugin-sdk README for further instructions on how to get the project built:
For our purposes the project we want to run is “hello_world”. Enter your root password if prompted.
That gets you as far as running the project on the iRex DR1000 emulator using the QEMU option in Anjuta. | ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
Download the 1.03 iOn code from the iRex website:
Also download the 1.03 version of hello-world and put it into your projects directory. Within the newly created hello-world directory you need to run the build script:
This ran into a problem at LIBERXX:
Didn’t find LIBERXX in synaptic package manager so I went back to the iRex instructions.
The first line has a <space> after the “cd” command. The tail command is just showing you the tail-end of the text file specified (.bashrc). Tried the ./build_all_from_scratch.sh again. worked this time just fine. Change settings in anjuta’s poky plugin to point to the new files Tried autogenerate but it failed with permissions problems:
Found out that the autom4te.cache is actually in the project directory. Change ownership of the entire projects directory. This is wherever your projects are located so for me it’s the following:
Project autogenerate worked fine now Also tried running config. Keep in mind that Anjuta asks if you want any variables passed into the configure command. Leave this blank. The variables are unnecessary because we already took care of that within the Poky preferences menu. As you can see from the output below, the –host variable is already passed into the configuration. Here are the results from the messages window of anjuta:
Tools -> Start QEMU
Wait for the screen to change – it may take a few seconds so be patient. After that is taken care of just confirm that you’re running the 1.03 software by checking the Settings -> About within the emulator. Tools -> Deploy | ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
Go to a directory with a file that you want to copy to the emulator (in this case I’m using “testfile.pdf”). Then type in the following:
It will ask for the root’s password. Just press enter because the root password for the DR1000 is blank. scp is a secure copy program for copying files between hosts on a network. Since the emulator is technically a host with its own IP address this is how you will copy files over to it. look at your DR1000 emulator’s file structure with the following command:
Press enter when it asks for a password again Now, how do we view the pdf file you just put into the emulator? Currently, using ssh, you're looking at the kernel directories in your filesystem. You can’t "view" system files on the emulator and right now your pdf is essentially a system file. If you had the physical device you'd just put your pdf onto the SD card supplied with your device and this is exactly what you need to do with the emulator as well. In order to show a pdf file, for example, you need to upload it to your (virtual) SD memory card and then you can open it within the emulator environment. So, create a virtual SD card, mount it in the emulator, then upload your files to it: Create the SD card image in Ubuntu Linux:
Move to the tmp directory where the image resides, then make the filesystem:
choose yes when it asks to proceed. You’ll get output something like the following:
Use scp again to copy the file over to the emulator:
Once the SDcard image is done uploading to the emulator, we need to change it so we can see it as a filesystem. First we connect to the device again with ssh:
At this point you have a mounted filesystem which is to be our SD card and a subfolder called eBooks. However, you won't be able to immediately see this folder in the emulator. You need to restart the Xserver in order to get it working. At the ssh prompt for the emulator, you first find the PID of Xfbdev then you start Xserver:
This displays the running applications then kills the application with PID 1952. Use whatever your PID is for Xfbdev when you find it in the list. The last line starts up Xserver again. Once QEMU starts up there should be a "Documents" folder and this will have your eBooks folder under it. Upload new ebooks or other pdfs to the folder with the following command:
Now you should be able to see the file in that eBooks folder. Open up the file. I found that it took longer in the emulator to open a file than it does on the physical device. Here is the output of the front cover of an eBook that I uploaded to the emulator: (click the image for a bigger view) And yes, it really does look that good. The device has very high resolution. I have not included the full view of the cover because the computer I'm using has a screen that's a little too small to show the whole view of the emulator. Once I get on a machine with a larger screen I'll put a full cover screenshot up. Also I'll add a screenshot of a document showing some small text content so you can see what a full page of text looks like.
The next step after that is to get the project onto the physical device. Detailed instructions on this part of the process is pretty important since you could potentially mess up your device if you do it wrong. Then again the worst that can happen, I think, is that you'll have to re-install the software onto your SD card. You can find instructions on this below in the links section. | ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
Apt-get update problem When I ran this at first I ran into this error:
I ran the aptitude update instead
This did not result in any errors though I'm not quite sure if it worked correctly. After poking around on the net for some answers about the "hash sum mismatch" problem I decided to run the poky install to get the correct dependencies for the Poky environment. This is a necessary step for later anyways and if you run into a roadblock sometimes it's good to move on to something else.
Poky dependencies error
I then ran into the following error:
At first I thought this was likely due to the error mentioned above which was seen during the update step. Then I found out that the reason poky-scripts wasn't found is because the poky-scripts don't exist for the Hardy Heron version of Ubuntu yet! (even though it is listed as existing in the readme file for the plugin.) That solves that problem. I contacted the developer and he said he would add the necessary code in order to allow for this to work correctly for Hardy Heron. By the time you read this it should be working correctly, but for now we can just install it by hand. To get all the dependencies and install them individuallly run the following lines:
Running poky from command line: According to the readme file you can get something running from the command prompt. I decided to test this out by trying the following:
Tried running the following command according to this convention:
For some reason I couldn't set this to zero – tried with vim but it said I couldn't write to it. Current setting is 65536. You can see how to fix this in a later step on this page. After I figured out how to set this value to zero I never came back to trying this command line approach, but if I try it out I'll document the outcome here. Looking at it now I should have added "qemuarm" to the beginning of that last command.
mmap_min_addr to 0 error:
This is the same problem that I ran into in an earlier stage. I looked through the net for an answer on this and found a command that will fix this:
Subversion question
I wanted to get a project to succeed in building so I moved on to that instead of worrying about the subversion attempts.
Autogenerate problems I tried Build -> Run Autogenerate...
Tried looking on synaptic for a autoreconf package. Autoconf came up so I tried that. I got a different error:
Found out that aclocal is part of automake. Looked for package in synaptic. Found and installed it. Autogenerate worked, but there was no “Build project” option afterwards and there were a couple of red X's at the end of the generate sequence. New option “Run Configure” came up though in the build menu. Tried this and it came up with an error:
These tools extract documentation embedded in GNOME source code, and produce a good looking easy to read output via DocBook SGML. Found out my problems were only related to the fact that the Anjuta preferences for Poky had disappeared. SO – I just had to re-activate the poky plugin within the preferences menu and everything worked fine again. | ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
If you have some information to contribute to this tutorial please contact me or just leave a comment below. I would like to add as much information as possible to help people get over the initial steep learning curve of using the available tools for software development on the iRex Dr1000 ereader device. It was hard enough getting this far along and I just don't think it should be necessary to fight with a lot of development environment tools. The tools should work for us, not the other way around. Our main focus should be on developing code and deploying it to the DR1000. Agreed? | ||||||||||||||||
|
| ||||||||||||||||
| ||||||||||||||||
|
| ||||||||||||||||
|
| ||||||||||||||||
|
| ||||||||||||||||
|
| ||||||||||||||||
|
|


![[ ]](/projects/project2/images/compressed.gif)
![[ ]](/projects/project2/images/unknown.gif)
![[ ]](/projects/project2/images/binary.gif)