By Bill » Tuesday, January 26 2010, 14:50
This not so small tutorial is designed to give you a starting point for building root filesystems for your Micro2440 and Mini2440 boards using the OpenEmbedded development "kit". I've discussed this some in previous entries on the blog, but I think it's time I show you how to do it for yourself.
My recommendation for a host distribution for this is Debian Lenny 32bit And that i will be assuming you have it installed and working. Currently I'm testing Ubuntu 32 and 64bit, and will begin testing 64bit Debian again. I'd like to say first though, that one big problem I have with Debian at the moment is its lack of modern packages. Debian is still not up to date with Python. Openembedded makes use of Python 2.6.4, and it will build it for you and for the most part, use it, BUT if your Debian Python and the openembedded Python don't match versions, I have personally noticed problems. Whether it's really that which is the problem I don't know. Someone with greater knowledge will have to debate that. But this tutorial will prime you on the proper way to work with openembedded and the results SHOULD produce working filesystems and kernels. If they don't, it isn't because this tutorial is wrong, it's very likely something else. Please be sure to read all the logs and try to set your scrollback buffer to very very large.
First you'll need to obtain your OpenEmbedded files. Please have the following tools:
- git =>126.96.36.199
- bitbake =>1.8.18
- ncurses libraries and development headers
- zlib development libraries and headers
- bzip2 and its development libraries and headers
And anything else that bitbake tells you to install when you first run it.
sparky:~ mkdir oe ; cd oe sparky:~/oe$ git clone git://repo.or.cz/openembedded/mini2440.git
Grab a cup of coffee. For me here in Sweden, this takes ages to download. Once it has finished, you'll have a directory called mini2440.
Now create a build directory and a sources directory. The build directory is where you'll always need to be to create your packages and filesystems. The sources directory is where bitbake downloads all the source tarballs etc.
sparky:~/oe$ mkdir build sparky:~/oe$ mkdir sources
Now we need to copy the sample configuration file to it's location.
sparky:~/oe$ mkdir build/conf sparky:~/oe$ cp mini2440/mini2440_local_conf_example.conf build/conf/local.conf
Next, we need to edit the configuration file you just copied and renamed. The new file is inside your build directory in a directory called conf. Edit local.conf from there and be sure you edit the following variables.
Modify those so that the paths are correct. The DL_DIR should point to your sources directory you just created. BBFILES should point to your mini2440 directory that was created when you downloaded openembedded with Git. Just modify that one so that it's path is correct. Don't remove the tailing part.
You'll also need to remove the last line of the config file that says
Thats basically a failsafe for any idiot who tries to do this without even looking at the config file. Make sure you read the entire config file and there are a few options in there you can tweak once you know what you're doing.
The next step is to set an environment variable called BBPATH like so.
sparky:~/oe$ export BBPATH=/path/to/openembedded:/path/to/build/directory
If you're running Ubuntu, you'll need to reconfigure /bin/sh to point to /bin/bash...
sudo dpkg-reconfigure dash
Choose NO when the menu pops up. (Updated March 6, 2010)
Now you're ready to begin building. PLace yourself inside the build directory and begin by building the base tools needed for everything.
sparky:~/oe/build$ bitbake -v task-base
This will run on forever and ever and ever building things. You might as well go have dinner and watch a movie or two.
When It's done. You'll have for the most part, all the basic cross compilers, libraries and things needed to begin building images or individual packages. I suggest starting with the console-image recipe.
sparky:~/oe/build$ bitbake -v console-image
Assuming this went ok, you should now have images in the tmp/deploy/glibc/images/mini2440 directory. You'll have a uImage which is your kernel and you'll have a console-image.jffs2 that you can flash to your Micro2440 or Mini2440 board.
I'd like to remind you, that if you have a Micro2440 board with 128MB NAND, you will need to modify Openembedded a little so that it creates images for the correct Eraseblock size and page file size for your board.
You can do that by editing the file mini2440/conf/machine/mini2440.conf and find the line at the end starting with EXTRA_IMAGECMD_jffs2 and change the 0x200 in it to 0x800, and change the 16KiB to 128KiB.
Another thing I'd like to mention is that all of the above assumes that your host distribution has all the required development libraries and whatnot installed. If you get errors, you'll need to examine your scroll back and try to find exactly what the error was. Usually this will tell you if you're missing something such as zlib or unzip or whatever it might be. Also problems during compiling can be from version differences in different distributions, as well as just plain old broken ass packages in Openembedded. I'd be glad to try to help anyone who has problems.
Please respond to this entry and let me know if you've succeeded or not. I'd love to hear that I've helped at least one person ;)
As a final note: If you're experiencing problems compiling binutils-cross with errors about yylex undefined, it's because bison isn't installed. And you should have flex installed as well.
If you have any questions, or need help, please visit my forum and ask for help!