This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: n00b PC booting questions


Chuck McManis <ecos@mcmanis.com> writes:

> Does anyone on this list REALLY understand how PC's boot and help me
> understand this poorly documented topic?
> 
> Here is the deal, I'd like to boot ECOS from a flash chip that looks
> like an IDE drive (sold as "DiskOnChip").
> 
> Now my target is an IBM PC (doh!) and I've been building stuff with
> Redboot and startup "FLOPPY" which works fine. You dd the image on to
> the floppy and it boots without incident. But now I want to boot from
> my baby Flash Drive. So this is what I've learned/done.
> 
> So the flash is formatted with a PC valid "boot" sector with one
> partition defined that is active. Since I'm developing on a FreeBSD
> machine I've been snooping around how FreeBSD boots and one of the
> simpler ways is by using a master boot record whose source is in mbr.s
> in /usr/src/boot/i386/mbr/. Basically what this boot record does is
> look for the active partition, load its "boot sector" (aka first
> sector) and if offset 510 has 0xaa55 in it, then it jumps to the code
> it just loaded.
> 
> Now if I simply dd the redboot.bin file on to the flash at this sector
> it isn't recognized as being a bootable image because it doesn't have
> the 0xaa55 signature. Now if I add a bit of code that uses int 13h to
> try to read sector 2 - n (where n is the length of redboot) into
> address 0000:0200 and then try to jump to it nothing happens (well the
> PC doesn't complain about "no operating system" [generated by mbr.s])
> but I don't get the Redboot ........ banner either.)
> 
> So what I would *love* would be an option to Redboot which was "HD" as
> a startup method which would prepend to the binary a BIOS compatible
> boot sector that could have a fake partition table that I could poke
> with the real values needed, then I could dd(8) that file to the disk
> and have it boot like floppies boot today.
> 
> In lieu of that, I think I need to understand where redboot expects to
> land, and what it expects the system to have set up so that it can
> start up. Is there anywhere where this would be documented? (I've
> started browsing around the redboot code but the CDL stuff is
> something I've not been really deep into yet)
> 
> Pointers appreciated, I'm not completely helpless, but reading source
> code and writing a LOT of printf's is kind of painfully slow ;-)

The main problem with the floppy boot code is that it renders the
floppy totally useless for any other purpose, since it overwrites all
the blocks that would contain the MBR and filesystem boot
sector. Doing the equivalent on a hard disk or a CompactFlash would
also render that device useless for any other purposes.

Since in most embedded systems if you go to the effort of adding an
IDE device, you want to use it for something other than booting, what
we really require is a mechanism for booting eCos/Redboot out of a
filesystem.

And we have one: GRUB!

What you need to do is build Redboot for GRUB startup. Then format the
DiskOnChip with a FAT filesystem (probably from DOS running on a
floppy) and install GRUB on it (again from floppy). Then you can make
a suitable menu file for GRUB, and copy RedBoot onto the device from
floppy. GRUB should then boot it happily.

Everything you need to know is either in the GRUB documentation or in
the eCos documentation here:

http://ecos.sourceware.org/docs-latest/user-guide/setup-i386-pc.html


-- 
Nick Garnett                                          eCos Kernel Architect
http://www.ecoscentric.com                     The eCos and RedBoot experts
Besuchen Sie uns vom 14.-16.02.06 auf der Embedded World 2006, Stand 11-222
Visit us at Embedded World 2006, NÃrnberg, Germany, 14-16 Feb, Stand 11-222


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]