HOWTO: Getting Started With OpenEmbedded
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 =>1.6.3.3
- bitbake =>1.8.18
- bison
- flex
- e2fsprogs
- m4
- curl
- ncurses libraries and development headers
- zlib development libraries and headers
- cvs
- subversion
- unzip
- bzip2 and its development libraries and headers
And anything else that bitbake tells you to install when you first run it.
Obtaining Openembedded:
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.
DL_DIR
BBFILES
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
# REMOVE_THIS_LINE....
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!

Comments
Bill this just keeps getting better. I read the part on SD cards. One of the Hiteg boards has IDE and I think I'll try it with a CF-II 8gig hard drive -- no worries about swap space wearing out NAND.
I'm glad you like it. If I end up getting enough information in this blog, I might convert it to a wiki at some point. But for now, this is easier since this was already set up. Let me know how your progress is with the CF card. My current project is bootstrapping Gentoo to the mini.
I've been "bitbaking" in your manner for a while and this helped me to get a little more used to *.bb files... I have my board running with my own kernel and my custom file system on a SD card but just when I was ready to start writing a few lines by myself I had the bad idea to update ( git pull ) my openembedded repository... Now I'm not able to compile my images anymore because the process hangs trying to fetch git_repo.or.cz.linux-2.6.mini2440.git_96bad25818c09985b0db62ae4f24fc6b15635923.tar.gz from the Angstrom site without success ( error 404 ). Every attempt to solve the error has failed up to now.. I was wondering if this is a problem of my own or a wrong reference from the repository.. Have you got the same issue?
Well I've not updated my openembedded set up in awhile. But that 404 is a file not found error from the webserver. There's nothing you can do about it really if the file is missing on the repository. I would, however, suggest possibly trying to create the clone of the repository in another directory just to make sure something isn't screwed up in your current directory layout. Please try that and let me know if that helps.
Hi Bill,
I need to add more drivers in the kernel than what is compiled by default. I know how to compile the kernel, but how do I do it with bitbake.
Is there any way I can run `make menuconfig`, choose what I want and save the config file, then run bitbake to get alln the modules I want.
Thanks in Advance
When I use this command: "sparky:~/oe/build$ bitbake -v task-base". I have a problem is "".
/usr/lib/pymodules/python2.6/bb/COW.py:29: DeprecationWarning: the sets module is deprecated
ERROR: IO Error: file 'conf/bitbake.conf' not found
plz, tell me why?
Hello ssh,
Are you sure you're exporting the BBPATH variable? Thats what it sounds like the problem is to me. Also what distro are you using and python version?
Bill
@suni : I recommend compiling the kernel by hand if you really want it with custom drivers. I'm not aware of any way to run menu config with bitbake... however, you should be able to modify the default config for the kernel if you're using the mini2440 sources for bitbake from BusError's git repository. It's in the config directory for the mini2440 files in bitbake. I don't have it installed right now to look, but i'm sure it's there.
Hello again ssh,
Please make sure you're also using the correct version of bitbake. I just tried with bitbake 1.8.12 which is whats coming with Ubuntu and it gives that same error. So make sure you're using 1.8.18 or newer.
Bill
yes I has install sucess. Thank a lot.
Bill,
I followed your instruction and was able to have a successful build. But i have two questions that you might have knowledge about.
1. I am unable to boot from the SD card using the .ext3 image. All i did was copy the kernel into partition2 and .ext3 image into partition3. And configured the bootargs. The kernel booted but booting stopped at
"Kernel panic - not syncing: No init found. Try passing init= option to kernel."
2. I installed the .jffs2 in flash instead. How do i automatically login without having to enter the password "root" (i.e. at mini2440 login: ) or disable the login. And where do i place this cmd (./calculator -qws) to startup my app after boot complete.
Thank you,
flux000
Hi flux000,
Did you copy an image file to an ext3 partition, or did you copy the files inside the ext3 image to the partition on your SD card? I think I might have addressed this on the mailing list if you asked it there.
If you just copied an .ext3 image file to an ext3 parition as one big file, that won't work. You have to have the files inside the ext3 image on the partition on the SD card... so that when you list the files on the SD card, you see a bunch of files and directories. Unless I'm misunderstanding what you've done.
If you don't know what I'm talking about, just do an "ls" on the mounted SD card parition and show me a list of files on it.
As for automatic login, this link might give you some help. Since I've never tried to make a system automatically log in, I don't know if it works or not, but the advice in this link sounds like it would.
http://www.linuxquestions.org/quest...
Let me know,
Bill
Bill,
Yes, I just copied .ext3 image to the ext3 partition on the SD card. How would i go about extracting the content of .ext3 image onto the SD card. I google but no answer.
As for the auto login, I am still working on it. The link provided only remove the login screen from the display. I still need to login via terminal.
Thank you for your speedy reply.
flux000
Hi Flux000,
Did you say you used openembedded to make your ext3 image? If so, edit your config file for openembedded and look for IMAGE_FSTYPES and it should look something like this
IMAGE_FSTYPES= "jffs2 ext3 tar"
make sure tar is on there too. Then rebuild your image. Once the image is complete, you should have a tarball of the filesystem contents as well as an .ext3 image, and a jffs2 image. Mount your SD card partition, copy it to the partition, and then untar it on the partition.
tar xvfo myimage.tar
if It is a tar.gz file, use xzvfo instead of just xvfo .... I don't remember if the images it makes are compressed with GZip or not.
When you do that, you should see it creating a ton of files on the SD card parition. It should boot then.
As for your question about autologin, are you talking about auto logging in to a GUI or auto logging in to a command prompt?
Bill,
Images in the build directory are jffs2, .ext3 and .tar.gz. I untar .tar.gz on the SD card and below are the messages i am getting.
NET: Registered protocol family 17
mmcblk0: mmc0:1234 SA02G 1.83 GiB
s3c2410-rtc s3c2410-rtc: setting system clock to 2010-09-29 01:18:29 UTC (1285723109)
Waiting 3sec before mounting root device...
kjournald starting. Commit interval 5 seconds
EXT3 FS on mmcblk0p3, internal journal
EXT3-fs: mounted filesystem with writeback data mode.
VFS: Mounted root (ext3 filesystem) on device 179:3.
Freeing init memory: 136K
init started: BusyBox v1.13.2 (2010-05-28 19:21:21 EDT)
Bad inittab entry at line 5
can't open /dev/si: No such file or directory
can't open /dev/~~: No such file or directory
can't open /dev/l0: No such file or directory
can't open /dev/l1: No such file or directory
can't open /dev/l2: No such file or directory
can't open /dev/l3: No such file or directory
can't open /dev/l4: No such file or directory
can't open /dev/l5: No such file or directory
can't open /dev/l6: No such file or directory
can't open /dev/z6: No such file or directory
can't open /dev/S: No such file or directory
can't open /dev/1: No such file or directory
process '/sbin/sulogin' (pid 734) exited. Scheduling for restart.
process '/sbin/getty 115200 ttySAC0' (pid 735) exited. Scheduling for restart.
process '/sbin/getty 38400 tty1' (pid 736) exited. Scheduling for restart.
can't open /dev/z6: No such file or directory
can't open /dev/S: No such file or directory
can't open /dev/1: No such file or directory
process '/sbin/sulogin' (pid 737) exited. Scheduling for restart.
process '/sbin/getty 115200 ttySAC0' (pid 738) exited. Scheduling for restart.
process '/sbin/getty 38400 tty1' (pid 739) exited. Scheduling for restart.
can't open /dev/z6: No such file or directory
can't open /dev/S: No such file or directory
can't open /dev/1: No such file or directory
process '/sbin/sulogin' (pid 740) exited. Scheduling for restart.
process '/sbin/getty 115200 ttySAC0' (pid 741) exited. Scheduling for restart.
process '/sbin/getty 38400 tty1' (pid 742) exited. Scheduling for restart.
can't open /dev/z6: No such file or directory
can't open /dev/S: No such file or directory
can't open /dev/1: No such file or directory
process '/sbin/sulogin' (pid 743) exited. Scheduling for restart.
process '/sbin/getty 115200 ttySAC0' (pid 744) exited. Scheduling for restart.
process '/sbin/getty 38400 tty1' (pid 745) exited. Scheduling for restart.
I will try to explain my autologin situation again. My objective is to have my Qt app start after bootup without logging in.
My current setup:
I put "./calculator -qws" in /etc/profile and after the system is booted up i have to login via terminal on my host machine and after i login, my Qt app is started.
If possible, can you upload your images.
Thank you,
flux000
Hi Everyone,
Could you please move your questions over to the forum. http://billforums.station51.net ... It's too hard to follow questions here on the blog because the comments aren't threaded. If you log in to the forum, you'll find all of these HOWTOs and you can post your questions there.
Thanks,
Bill