LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices

Reply
 
Search this Thread
Old 01-07-2008, 11:13 AM   #1
swass
LQ Newbie
 
Registered: Jan 2008
Posts: 9

Rep: Reputation: 0
Busybox for embedded x86 boot issues


Good morning,

I'm having an issue that I am unable to figure out (at this point) to to get past. I am building a cross linux from scratch for an embedded x86 system.

Only having found bits and pieces out there to make it work, I've got a system with the latest busybox w/ glibc on it, am able to get the system to boot (to some extent) using the 2.6.23.12 kernel. It boots, but never seems to find it's devices. I tried manually creating an initrd for the boot process, then moving busybox on there and creating a linuxrc that should call busybox to populate dev "busybox mdev -s". That still doesn't seem to fix the issues, and I'm not even sure that it is ever running the script to begin with, since I have an echo statement that is never displayed to me when it boots. It does say it finds the initrd though.

Anyway, even hda1 is never really created in the dev tree, so it can't quite figure out how to mount the root file system, even though it is obviously doing so to some extent because it is running the rc.d/startup script -- I see init.d scripts being executed, and sometimes failing because they have no device. After that, the system automatically shuts down.

Any thoughts? I am using drivers that are specific to the SCx200 (Geode GX1), so I am not sure if even manually creating some of the devices is possible without knowing the major number for the driver -- unless they are the same no matter what?

I'll try to post the boot errors when I get home if that would be helpful. Perhaps someone has gone through the same headaches I am going through.

Thanks!
 
Old 01-28-2008, 04:45 AM   #2
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
Good Morning swass,

I am only sorry that I can not help you at the moment.
I am also building an embedded clfs X86 but my build is behind yours.
I am still slogging through typing in all those configuration scripts.

As its a little time now since you posted I was wondering if you had come
to anything.

How were you intending to boot it?
The bootloader section chapter 11 introduction is left to the readers
imagination.
Embedded clfs is still under development.
There is something for mips. Did you patch this for x86? Did it work?
I had in mind trying to boot from lilo on the host just to test my build.
Dont know yet if this is going to work.
After that I was going to try some of the many bootloaders like Das u-Boot.

You used the 2.6.23 kernel which is later than the book recommended 2.6.20.1.
How did that turn out?
I would like to use 2.6.23. There is no Linux_Tiny for 2.6.20.1. that I
can find. It looks as though it occurred when there was a change of maintainer.
I know you could do it yourself with 2.6.20.1 if you were good at kernel compiling
but I am not.

Please keep in touch.

John
 
Old 01-29-2008, 08:56 AM   #3
swass
LQ Newbie
 
Registered: Jan 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Actually, I did get everything working, finally. It took a lot of hacking around, but it all works 100% now and works very well. I actually made quite a number of deviations from the CLFS embedded, as it wasn't evidently intended for this type of embedded system.

I used the latest (at the time) Linux 2.6 kernel, as you noted. I also used the latest Busybox, substituted uclibc for glibc, changed the some of the bootup scripts, fixed the mdev configuration example file (which was broken), etc.

One thing I got hung up on for a while was how to boot. The issue turned out to be a couple things. First, there wasn't good documentation out there on what drivers and configuration I needed to have to properly take advantage of the features of the PC Engine's WRAP device, so I had to figure that one out. Second, the CLFS embedded documentation tells you to use the large vmlinux file in the root of the Kernel source when you are finished compiling. This is in error for x86 machines, as you need to create a bzImage using the same compile flags as they note in the CLFS embedded docs.

Something I found somewhat helpful was to use documentation from both CLFS and CLFS Embedded. This helped me also compile other things like dropbear, including a full build platform on my WRAP to compile new libraries and applications. This is nice, as I have been able to compile things like mysql, lighttpd, lua, php, etc, directly on the system when I got it running.

You didn't mention what embedded device you were using. Is it the same as me? I'd be happy to work with you directly, if they are similar enough, to help you get it running.

Thanks,
Mike
 
Old 01-29-2008, 01:19 PM   #4
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
Just at the moment I am going through it just for experience.
I am not a computer expert.

I began with x86 build as I figured out I could just put it
into an old pc for experience and learn more about embedded
before going further. Even use it to test devices.
I would like to see how little ram I can use.


You mentioned PC Engines. Please see the IDE to compact flash
adapter on their site. I have one of those together with a
Kingstone 1GB flash. I have been struggling for some time now to
make an ext2 file system on it. No luck. All I read on web sites
is that you just do it. Its the same thing as a hard disk. But for
me it just does not. Has anyone on the forum any experience they
would care to share?

The kernel I ended up with looks more like mainframe than embedded.

John
 
Old 01-29-2008, 07:07 PM   #5
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Quote:
Originally Posted by jowa45 View Post
Please see the IDE to compact flash adapter on their site. I have one of those together with a Kingstone 1GB flash. I have been struggling for some time now to make an ext2 file system on it.
You should really start a new thread on this, as interested people will not see your question otherwise. Also, can you partition it? Read/write to the raw device?
 
Old 01-30-2008, 03:19 AM   #6
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
I was intending to make a separate post after I had more experience but the subject of PC Engines just crept up. Even to write a review.
So far I have only tried in one computer running from a floppy Linux.
It is not the best computer in my collection.
I have not tried to partition it yet as I have no reason to want a partition but I will try this evening.
There is no problem with fdisk. I can change heads cylinders sectors file system type.
I tried to make it the same as the hard disk I had taken out.
Thought it could be a BIOS problem.
When I run mke2fs I get error message "Drive seek error".
The compact flash came DOS formatted and I could read/write to/from it mounting it -t vfat.
There are many options I could try like another computer/adapter/flash before I make a separate post.
This is really a hardware problem but this particular piece of hardware is of special interest to
embedded.

John
 
Old 01-30-2008, 03:46 AM   #7
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Quote:
Originally Posted by jowa45 View Post
I have not tried to partition it yet as I have no reason to want a partition but I will try this evening...

When I run mke2fs I get error message "Drive seek error"
I think you need to make a partition before you can format.
 
Old 01-30-2008, 04:55 AM   #8
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
What I ment was I just excepted the one big partition it came with and changed its type to Linux.

John
 
Old 01-31-2008, 09:26 AM   #9
swass
LQ Newbie
 
Registered: Jan 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Well, unless you're working with BSD style UNIX, I really think it should be more simple. I think you want to avoid changing the heads/cyl for the disk. I may not understand what you're trying to do, but here is what I did:

I took a USB compact flash adapter, plugged it into one of my linux systems. I then fdisk'd it to create one large partition, formatted it ext2, and I was finished. At that point you have your file system. Changing the disk geometry could be your issue there.

However, as the person noted above, you could simply be trying to format the raw disk rather than using the partition table. For example, /dev/sdb would be an example of the whole disk, whereas /dev/sdb1 would be the first partition on the disk. fdisk -l lists the available disks, so make sure you edit the correct one for obvious reasons.
As far as the linux kernel goes -- when you say it is more mainframe than embedded, what do you mean? Is it too large? If so, what file is too large?

Last edited by swass; 01-31-2008 at 09:29 AM.
 
Old 02-01-2008, 06:37 AM   #10
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
WRAP is described on the makers site as an end of life product.
So sorry not so interesting to me.

I will try to explain.

Why did I change geometry ?
When I first had problems I changed the flash
to be the same as the hard disk I had taken out.
That computer has a simple BIOS that can not be
changed or used to auto-detect so I changed the
flash.

I am going to try it in another computer.
I was hoping that the IDE to CF would work directly.
There are many other types of adapter like USB/CF,
pcmcia/CF and boards that go in the computer like a
network card does. My next endeavor would be to try
these. Use them to make a file system and then put the
flash back in the IDE adapter.

It is not fdisk I am having trouble with. I can change
what I like and it remains for next boot. It is when
I mke2fs.

I only use Linux. No BSD.

I have come to the end of the build but not tried it yet.
I just followed blindly the instructions in the book.
Using the lfs live CD as a host.
I am not expecting it to work. I just do not see how it can
boot. There was no boot loader.
I made a backup at the end of each chapter to save me a lot
of typing over again.

My kernel is 5.7MB. Dont mind that I have plenty of flash to put
it on but I dont have much ram.

John
 
Old 02-10-2008, 05:26 AM   #11
herman moolenaar
LQ Newbie
 
Registered: Feb 2008
Location: Rotterdam Netherlands
Distribution: ubuntu, gentoo, lfs
Posts: 2

Rep: Reputation: 0
Testing using QEMU

Hello guys,

I'm also experimenting with embedded linux. I've an old Pentium II and a Pentium III computer ready for testing. Guys please post your progress here?

I haven't tried clfs yet. But I've build a system based on TinyGentoo, using uclibc and busybox. For testing I used a 128 MB raw image that I loaded in QEMU.I didn't use an external flash device because the cycle time (creating a system, copying it to the image and booting it in QEMU) is faster using an image.

I had a couple of problems:
(1) I ended up with manually installing packages. Emerge tried to pull in glibc resulting in a bloated system. Building a system in Gentoo involves less work then based on (c)lfs. But the dependencies are not based on using uclibc and busybox. This is also the reason why I'm looking at clfs.
(2) I was unable to create a image file with a bootable partition in it using my host system. I think that this is a bug in fdisk. After spending an evening trying to accomplish this I started a virtual machine in QEMU and did it there. Now I mount my image using: mount -o loop,offset=16384 image.img mountpoint. The mentioned offset depends on the number of heads, sectors and cylinders specified in fdisk. I didn't use the default here because that would reserve a large amount of image space for the boot sector. The other handy commands: mke2fs and fsck work using a loop device and the command: losetup and specifying the same offset mentioned above.
 
Old 02-11-2008, 02:55 AM   #12
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
Hello Herman,

Welcome to our little discussion.

Progress for me is not so great but I am still trying.

The problem with the clfs embedded build is that it is
still a development project and important sections such
as the boot loader are left entirely to the readers imagination.
For a kernel you are just told to compile it.
There is no advice on making it suitable for embedded use.

Its a good project in many ways though.

Last night I tried to make a kernel following the Linux Tiny method.
It uses a program called quilt to automate patching and then I compiled
it as the book and ended up with a kernel 6.2MB. Larger than my own efforts.

Then I moved on to a boot loader and tried to follow the grub instructions in
the standard clfs build but I had to stop at the point where you need a floppy
to dd your results to. Did not have one so will continue tonight and report back
tomorrow.

John
 
Old 02-12-2008, 01:40 AM   #13
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
I put grub on last night following the instructions
in the standard clfs build.
When I tried to boot it just sat there saying grub.

Code:
grub >
Looked like the grub shell I used earlier.
Kernel is the one made following clfs embedded.
I guess I am in the same position now as swass
when this post began but mine is just an old PC
which boots well. No special drivers.

Will be continuing this evening and report back
tomorrow.

John
 
Old 02-13-2008, 01:34 PM   #14
herman moolenaar
LQ Newbie
 
Registered: Feb 2008
Location: Rotterdam Netherlands
Distribution: ubuntu, gentoo, lfs
Posts: 2

Rep: Reputation: 0
grub

Hello jowa45,

I think that I know what the problem is. You didn't configure grub, or grub cannot find the partition you specified during setup.

Grub needs a menu.lst file in /boot/grub and it needs to be installed in the MBR.
The memu.lst file is straight forward but the commands to enter in grub ar a bit special.
For the tinygentoo system I build I used someting like the following (from my memory, it may contain errors):

commands to enter in grub:
grub> device (hd0) /imagefile.img
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

the trick here is that the image file will be hda when the final system boots but it is not when copying the files to it.

I hope this is of any help.

Herman
 
Old 02-14-2008, 04:09 AM   #15
jowa45
Member
 
Registered: Apr 2007
Location: Stockholm, Sweden
Distribution: Slackware11&12
Posts: 94

Rep: Reputation: 15
My grub works fine.
I used the standard clfs approach.
I have other kernels on the same machine.
Grub identifies them as Linux-bzImage and
boots them just fine.

The kernel I made by trying my best to follow the
instructions in clfs embedded is not identified as
anything in particular. Think swass has a point that
the instructions fail to make a proper kernel.

Last night I just copied a kernel which works fine on
that machine over to my embedded build.
It started to boot but ran into trouble when it hit
the boot scripts. I was expecting this from when I
typed them in.

In chapter 10.9 network.conf I chose

Quote:
NETWORKING=no
The message from klogd was

Quote:
Networking is disabled in /etc/network.conf
and there the booting stopped.
Reading through the scripts I just do not see any alternative.
It is only if one had chosen NETWORKING=yes that the test is
valid and booting continues.

Will be sorting out the boot scripts next.

Herman Are you still considering clfs embedded. I can provide
some help from my own experience. I know that small distributions
can work and I use some but it is often difficult to add what you
want to them or make them work on another type of machine.

Some time ago I built an avr toolchain and although there were
difficulties building the toolchain it worked well and I have had
a lot of use from it. It is against this background that I am trying
a clfs embedded build.

John
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Topic Needed:BusyBox - Embedded Linux (or Similar) schenke Linux - Embedded & Single-board computer 2 01-04-2008 12:17 PM
how to create busybox for embedded system kumar_bst Linux - Kernel 2 07-28-2007 10:10 AM
Linux embedded light-boot on X86 FCustom Linux - General 1 05-07-2007 04:09 AM
LXer: Simplify Embedded Linux Systems with BusyBox LXer Syndicated Linux News 0 08-16-2006 09:54 AM


All times are GMT -5. The time now is 02:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration