Finally Getting Somewhere with OE and U-Boot
By Bill » Wednesday, January 20 2010, 14:48
After what seems like forever, trying to resolve a problem getting consistently working images and kernels, I've finally figured out the problem.
The problem was with me not reading directions properly. But I'm not all to blame, you assume certain things sometimes that should in all rights, be ok to assume, but end up just being wrong.
I've learned as of writing this that the current Openembedded project doesn't work as is from their own website. You need a "special" version by the guy I mentioned in a previous post named buserror. Here are the links for his stuff...
http://bliterness.blogspot.com/ - His blog
http://code.google.com/p/mini2440/ ... - His Google code page.
http://repo.or.cz/w/openembedded/mi... - Git repository for the modified Openembedded
http://repo.or.cz/w/u-boot-openmoko... - Git repository for u-boot
You'll need to read over the blog, and google code pages thoroughly. It's full of information that's very very easy to overlook and isn't very well laid out. You'll have to use the openembedded from his git repo above otherwise you'll end up with weird stuff. The part above about me not being fully responsible for the failures I've had in making working images consistently, well my assumptions came from there being actual Mini2440 support in the main Openembedded project. So being new to this, I assumed that meant it worked and was tested. Obviously not. And again we come back to that same old thing of half written, half maintained, mostly broken crap that Linux consists of and how it just goes to prove that you get better software from commercial companies than from groups of people in open source projects where nobody seems to worth together smoothly to actually FINISH a product that works in the end.
You'll need to modify Buserror's code a little in openembedded. If you've looked at the tree layout for the real openembedded and the tree that is Buserror's.... They look different. I'm assuming this is an older version of Openembedded that he's based his mods on.
You'll need to edit:
base/conf/machine/mini2440.conf
and change the following line
EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --squash -s 0x200 -n -e 16KiB"
to this:
EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --squash -s 0x800 -n -e 128KiB"
This changes how the images are made with mkfs.jffs2 ... If you have a micro2440 SDK board with 128MB NAND, your erase block size is 128k and your sector size or page size is 2048bytes (2k, or 0x800 in hex)
Now you should be able to bitbake all you want. It should be known that it is very important that when you're using the NAND on your board, that your erase size and sector size are correct in the jffs2 image otherwise you'll end up with a screen full of errors, and your system won't boot. If your system does some how make it through the error and boot you could have dataloss, or it could take several minutes to get through those warnings and errors making your device slower. You must know your erase and sector size. U-Boot has a nifty command for helping with that.
In U-Boot type:
MINI2440 # nand info
And it'll report the sector size and the block size.
So, to summarize... you need to get most of your stuff from Buserror in order for things to work. He has a lot of work to do before it's perfect but he seems to be the only person actually smart enough and English speaking enough, to sit down and work on it. It's also a good idea to come back here often and check things. I'm trying really hard to keep everything I'm doing posted here so others who might be new to this type of thing, don't run in to the same problems I've had.

Comments
Hello,
First of all I wolud like to say thank you for your blog.
You have saved me a lot of from a lot of headache, and wasted time.
I have followed your tutorial, so now I have uboot on my board. I have built a console image with openembedded. The kernel boots fine, but I have some problems with the rootfs.
I have got a lot of messages like this after the kernel booted up:
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00980000: 0x93cd instead
My first idea was that, I have missed to remove the "--pad" part from the EXTRA_IMAGECMD_jffs2. But now I see that it is striked in the post's original command too. Is it a joke by the bbcode tags or the --pad part needed to be removed from the line?
ok that shouldn't be striked through on my post. I suppose its something retarded this blog software did. That is actually needed. it should be there. The only thing needing changing in the command is the -s and -e parameters. I'm going to try to correct that in the post. If your sector size and erase block sizes are wrong, you'll get tons of errors like you described and even get corrupted files. Please post here again after you've put that back and let me know if that corrected it.