[ECOS] HOW-TO boot eCos from IDE with GRUB on i386

Chris Nimmers chris@nimseus.com
Thu Apr 15 10:31:00 GMT 2004


I wrote this HOW-TO guide some time ago and thought that 
maybe this would be a helpful contribution to the eCos 

All comments are appreciated.


** Booting an eCos image from IDE (or IDE compatible compact 
flash) on an i386

1. Create a GRUB boot floppy

  1.1 Get hold of a binary build GRUB for i386 or build it 
according to the GRUB manual (section How to obtain and build 
GRUB). Note, building does not work under current Cygwin 
environment why this must be done on a *nix machine.

  1.2 During the build several files are created. Our main 
interest is the files stage1 and stage2. Copy these to a 
fresh floppy according to the GRUB manual (section Creating a 
GRUB boot floppy).

  #dd if=stage1 of=/dev/fd0 bs=512 count=1
  #dd if=stage2 of=/dev/fd0 bs=512 seek=1

  This floppy should now boot OK.

2. Prepare the IDE

  2.1  Format the IDE drive with a suitable filesystem 
recognizable by GRUB and make the first partition active 
(e.g. FAT16/MS DOS).

  2.2 Copy the files stage1 and stage2 (from 1.1) to location 
\boot\grub on the IDE. (This is a bit strange that we need to 
copy these files prior to adding GRUB but I was not able to 
find another solution).

  2.3 (If you have prior experience with GRUB you could also 
include a menu.lst file but it is not necessary for the boot 

3. Install GRUB on IDE

  3.1  Follow the instructions in the GRUB manual (section 
Installing GRUB natively). There are in reality only two 
commands necessary to do the install

  grub> root (hd0,0)

  which will tell GRUB that the root will be IDE drive 0 and 
partition 0 (i.e. first harddisk and first partition on this 

  grub> setup (hd0)

  This will install the GRUB in the MBR on the disk making it 

  The IDE should now boot OK without the floppy.

4. Configure eCos for GRUB load

  4.1  The startup type for the eCos image needs to be 
defined as GRUB. The parameter needed changing is located 

  Configuration | eCos HAL | i386 architecture | i386 PC 
Target | Startup type

  4.2 Selecting the GRUB startup type will also "disable" 
support for Redboot, meaning that the "auto" select of 
debugging output will no longer work why it may be 
also to change the parameter Diagnostic serial port. Setting 
this parameter to 2 makes sure that any output that 
previously (with Redboot) appeared on the PC screen will 
still be visible. The parameter is located under

  Configuration | eCos HAL | i386 architecture | i386 PC 
Target | Diagnostic serial port

  4.3 Build your application with the new eCos configuration.

5. Loading the eCos image with GRUB

  5.1 During the development phase it is quite handy to load 
the application via the network which can be done with GRUB. 
First we need to give GRUB a network address.

  grub> bootp

  This will get a ip address from a BOOTP server on the 
network. If no one is available	an alternative way is to set 
the address directly.

  grub> ifconfig --address= --mask=

  5.2  Next we load the eCos image over the network

  grub> root (nd)

  Sets our root to nd (Network Drive)

  grub> kernel (nd)/app.elf

  Load the eCos image, which has to be in ELF format (not S-
rec), into memory.

  grub> boot

  Leaves GRUB and starts app.elf

Another good source of information is 
3CDaemon version 2.0 revision 10. Freeware. 
Integrated TFTP/FTP/Syslog Daemon for Windows 95/98/NT 

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

More information about the Ecos-discuss mailing list