EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

help needed to boot from compact flash

Started by Everett X. Wang January 24, 2005
Hi All,

I have trying to move my linux from harddrive to a compact flash without 
much success for a week. Here is what I am trying to do:

I already have my own kernel and modules, tested successfully on my computer 
on hard drive. I followed
the three article series from Bruce Perens here to make busybox and file 
system:

part 1 for busybox
http://www.linuxdevices.com/articles/AT6143283999.html

part 2 for file system,
http://linuxdevices.com/articles/AT9416075241.html
I used Ram disk intead of romfs described in book by Karim Yaghmour 
"Building embedded Linux systems"

The compact flash is connect to an IDE to CF, set to the master of the 
second channel.

Then I used grub to load my kernel and initrd. by running /sbin/grub
root (hd2,0)
setup (hd2,0)

When it boots, it gives me a grub prompt
I typed

kernel /boot/bzImage
initrd /boot/initrd.bin
boot

where the initrd.bin is a compressed Ram disk image from the whole rootfs.

Then I got this message
....
VFS: Mounted root (ext2 filesystems).
kmod: failed to exec /sbin/modeprobe -s -k block-major-3 errrno=2
VFS: Cann't open root device "" or 03:07
Please append a correct "root=" boot option
kernel panic: VFS: Unable to mount root fs on 03:07

I also tried to copy the filesystem directly to the flash and reboot
it also gives me a grub prompt
do the same for the kernel and initrd (I used the real initrd.img from 
mkinitrd this time)
I got this message:
hda hda1 hda1 hda3     (these are OK because I have three partitions on the 
compact flash)
hda7 bad access block 3 count 2
end-request I/O error dev 03:07 (hda) sector 2
unable to read superblock
...
I never have anything like hda7. It has only 3 partitions.

Can any one help me here? Do I have to compile all the modules into the 
kernel or keep them as modules as I am doing it now?

Thanks in advance.

Everett 


Everett X. Wang wrote:
> Hi All, > > I have trying to move my linux from harddrive to a compact flash
without
> much success for a week. Here is what I am trying to do: > > I already have my own kernel and modules, tested successfully on my
computer
> on hard drive. I followed > the three article series from Bruce Perens here to make busybox and
file
> system: > > part 1 for busybox > http://www.linuxdevices.com/articles/AT6143283999.html > > part 2 for file system, > http://linuxdevices.com/articles/AT9416075241.html > I used Ram disk intead of romfs described in book by Karim Yaghmour > "Building embedded Linux systems" > > The compact flash is connect to an IDE to CF, set to the master of
the
> second channel.
Have you tried booting from the primary channel?
> > Then I used grub to load my kernel and initrd. by running /sbin/grub > root (hd2,0) > setup (hd2,0) > > When it boots, it gives me a grub prompt > I typed > > kernel /boot/bzImage > initrd /boot/initrd.bin > boot > > where the initrd.bin is a compressed Ram disk image from the whole
rootfs.
> > Then I got this message > .... > VFS: Mounted root (ext2 filesystems). > kmod: failed to exec /sbin/modeprobe -s -k block-major-3 errrno=2 > VFS: Cann't open root device "" or 03:07 > Please append a correct "root=" boot option
What don't you try root=/dev/hdc?
> kernel panic: VFS: Unable to mount root fs on 03:07 > > I also tried to copy the filesystem directly to the flash and reboot > it also gives me a grub prompt > do the same for the kernel and initrd (I used the real initrd.img
from
> mkinitrd this time) > I got this message: > hda hda1 hda1 hda3 (these are OK because I have three partitions
on the
> compact flash) > hda7 bad access block 3 count 2 > end-request I/O error dev 03:07 (hda) sector 2 > unable to read superblock
But your CF is on hdc.
> ... > I never have anything like hda7. It has only 3 partitions. > > Can any one help me here? Do I have to compile all the modules into
the
> kernel or keep them as modules as I am doing it now? >
If all else fail, you can try our CD. It will load most CFs up to 256M. See: http://cfd.linnix.com
> Thanks in advance. > > Everett
Try doing this at your grub prompt:
grub> root(hd1,0)
grub> kernel (hd1,0)/boot/bzImage ro root=/dev/hd1  [hd1 = which ever device
where your flash is mounted.]
grub>initrd (hd1,0)/boot/initrd.img
grub>boot

Thanks
Uday


Hi Thanks for the suggestion.

For the grub installation, I copied stage1, stage2 into my boot/grub from my 
desktop linux directory. What are these files? Do I have to change them? And 
also when flash boots, it goes to grub prompt instead of linux directly. How 
to make it boot my linux directly?

Thanks.

Everett

"Uday Mullangi" <udaymullangi@lucent.com> wrote in message 
news:ct4ja5$8fp@netnews.proxy.lucent.com...
> Try doing this at your grub prompt: > grub> root(hd1,0) > grub> kernel (hd1,0)/boot/bzImage ro root=/dev/hd1 [hd1 = which ever > device > where your flash is mounted.] > grub>initrd (hd1,0)/boot/initrd.img > grub>boot > > Thanks > Uday > >
Copy grub.conf to /boot/grub/ and make a soft link to menu.lst.
See grub.conf file in your red-hat machine at /boot/grub/ directory
here you can create your own configuration as what linux image to boot with.

Also, you dont need to copy the stage1 and stage2 files...
Use grub-install utility and grub utility. It will create those file for u.

procedure:
    #mkdir /mnt/usb
    #mount /dev/sda1 /mnt/usb
    #grub-install --root-directory=/mnt/usb '(hd1)'
    #grub /dev/sda
            grub> root(hd1,0)
            grub>setup (hd1)

Here hd1 is my usb name as seen by the BIOS.You can get this information
from /boot/devices.map file.

Uday

"Everett X. Wang" <everteq@sbcglobal.net> wrote in message
news:MPuJd.5757$8Z1.4065@newssvr14.news.prodigy.com...
> Hi Thanks for the suggestion. > > For the grub installation, I copied stage1, stage2 into my boot/grub from
my
> desktop linux directory. What are these files? Do I have to change them?
And
> also when flash boots, it goes to grub prompt instead of linux directly.
How
> to make it boot my linux directly? > > Thanks. > > Everett > > "Uday Mullangi" <udaymullangi@lucent.com> wrote in message > news:ct4ja5$8fp@netnews.proxy.lucent.com... > > Try doing this at your grub prompt: > > grub> root(hd1,0) > > grub> kernel (hd1,0)/boot/bzImage ro root=/dev/hd1 [hd1 = which ever > > device > > where your flash is mounted.] > > grub>initrd (hd1,0)/boot/initrd.img > > grub>boot > > > > Thanks > > Uday > > > > > >
why don't u use redboot..

Everett X. Wang wrote:
> Hi All, > > I have trying to move my linux from harddrive to a compact flash
without
> much success for a week. Here is what I am trying to do: > > I already have my own kernel and modules, tested successfully on my
computer
> on hard drive. I followed > the three article series from Bruce Perens here to make busybox and
file
> system: > > part 1 for busybox > http://www.linuxdevices.com/articles/AT6143283999.html > > part 2 for file system, > http://linuxdevices.com/articles/AT9416075241.html > I used Ram disk intead of romfs described in book by Karim Yaghmour > "Building embedded Linux systems" > > The compact flash is connect to an IDE to CF, set to the master of
the
> second channel. > > Then I used grub to load my kernel and initrd. by running /sbin/grub > root (hd2,0) > setup (hd2,0) > > When it boots, it gives me a grub prompt > I typed > > kernel /boot/bzImage > initrd /boot/initrd.bin > boot > > where the initrd.bin is a compressed Ram disk image from the whole
rootfs.
> > Then I got this message > .... > VFS: Mounted root (ext2 filesystems). > kmod: failed to exec /sbin/modeprobe -s -k block-major-3 errrno=2 > VFS: Cann't open root device "" or 03:07 > Please append a correct "root=" boot option > kernel panic: VFS: Unable to mount root fs on 03:07 > > I also tried to copy the filesystem directly to the flash and reboot > it also gives me a grub prompt > do the same for the kernel and initrd (I used the real initrd.img
from
> mkinitrd this time) > I got this message: > hda hda1 hda1 hda3 (these are OK because I have three partitions
on the
> compact flash) > hda7 bad access block 3 count 2 > end-request I/O error dev 03:07 (hda) sector 2 > unable to read superblock > ... > I never have anything like hda7. It has only 3 partitions. > > Can any one help me here? Do I have to compile all the modules into
the
> kernel or keep them as modules as I am doing it now? > > Thanks in advance. > > Everett

The 2024 Embedded Online Conference