Query based on : LILO for RTEMS

Angelo Fraietta angelo_f at bigpond.com
Mon Nov 18 21:08:05 UTC 2002


Find below the instructions / research into getting GRUB to work. See if 
it has something in it for you to work with. I originally had some 
problems with the install, however, I no longer do since following the 
instructions I made for myself.


Making a Grub Boot Disk

A custom Grub boot disk is required to boot the RTEMS operating system 
from a floppy disk.  After installing Grub onto your computer (I used 
Linux Red Hat 6.2), follow these instructions to make the customized 
Grub disk:


1.    Create a file called "floppy.lst" with the following entries
#this list requires that the executable "smart.exe: exists on this floppy
#timeout = 0 will make OS boot immediately
timeout = 0

default = 0

title RTEMS
root = (fd0)
#replace smart.exe with the name of your application
kernel =/smart.exe
2.    Copy the following files onto a standard FAT floppy disk: stage1, 
stage2, and floppy.lst.
3.    Boot your PC with a standard Grub disk. The instructions for this 
are in the file [grubdir]/docs/grub.info-1 under the heading "Installing 
GRUB on a floppy."
4.    Execute these commands at the Grub prompt:
grub> root = (fd0)
grub> install /stage1 (fd0) /stage2 /floppy.lst
5.    You can now boot your RTEMS exe by copying it to the floppy you 
just created and then booting your PC with that floppy.

This proved satisfactory at the beginning, however, swapping the floppy 
between the PC that runs the executable and the computer that I was 
using for development caused the floppy to wear out and start to jam in 
the computer.  The computer that was running RTEMS is attached to my 
network, so I decided to copy the built executable to the directory 
C:\rtems through the network while the computer was running Windows.  I 
would then re-boot the computer into RTEMS by using the following menu 
file on the Grub floppy:

# This is the amount GRUB waits in seconds before booting the default entry
# Set this when you're sure that the default entry is correct.
timeout 30

# Tell which entry to boot by default.  Note that this is origin zero
# from the beginning of the file.
default 0

title   Windows
rootnoverify (hd0,0)
chainloader +1
makeactive

title RTEMS
root = (hd0,0)
kernel =/rtems/smart.exe





grub> root = (fd0)
grub> install /stage1 (fd0) /stage2 /winmenu.lst

This now allows me to boot the computer to either Windows or RTEMS 
without ever having to remove the floppy disk from the drive.

The next stage was to eliminate Windows entirely from the target 
computer. This was done using a Dos 6.22 / Linux dual boot computer as 
the test computer.  The computer used was a 386 PC with no co-processor, 
therefore making the system very similar to my final embedded target.  
Linux was installed onto the second partition of the first hard drive, 
with LILO installed onto the superblock of the partition, thus allowing 
to boot the partition using the chainloader feature of Grub .  I created 
the following Menu file, named "test.lst", to select the appropriate 
operating system to load at boot time:

# This is the amount GRUB waits in seconds before booting the default entry
# Set this when you're sure that the default entry is correct.
timeout 30

# Tell which entry to boot by default.  Note that this is origin zero
# from the beginning of the file.
default 1


title   Dos
rootnoverify (hd0,0)
chainloader +1
makeactive


title Linux
rootnoverify (hd0,1)
chainloader +1
makeactive

title Paranoia
root = (hd0,1)
kernel =/home/test/paranoia.exe

title Smart Controller
root = (hd0,1)
kernel =/home/test/smart.exe

I copied stage1, stage2, and test.lst to the directory /boot while the 
target was running Linux and the host was running WS_FTP LE in Windows 
NT4. I installed Grub to the MBR of the hard drive using the following 
commands:

grub > root = (hd0,1)
grub > install /boot/stage1 (hd0) /boot/stage2 /boot/test.lst

Grub was installed to the MBR of the hard drive, however, there was no 
menu.  I attempted to install Grub again from the DOS partition, 
however, this did not resolve the problem. I attempted to use the 
fat_stage1_5 file from the DOS partition without success.  I then tried 
using the e2fs_stage1_5 on the Linux partition using the following commands:

grub > root = (hd0,1)
grub > install /boot/stage1 (hd0) /e2fs_stage1_5 /test.lst

which proved successful.  The menu list and the test RTEMS kernels can 
be modified using ftp.  The result is that I should never require a 
floppy disk in the test computer under normal testing circumstances.

I later had to re-install Linux, and as such, the e2fs_stage1_5 and 
test.lst were no longer on the partition.  I was then unable to install 
GRUB using the previous method as I would always get a sector out of 
alignment error message.  I eventually overcame this by booting with the 
GRUB floppy and inserting a DOS formatted floppy with the stage1 file on 
it.  The stage2 and test.lst files were on the Linux partition in the 
/boot directory.  I then executed the commands:

grub > root (fd0)
grub > install /stage1 (hd0) (hd0,1)/boot/stage2 (hd0,1)/boot/test.lst

which proved to be successful.  I decided to attempt to boot the 
computer with the stage2 and test.lst files on the DOS partition, just 
to prove that I did not just jag it.  I modified test.lst and saved it 
to the DOS partition.  The DOS partition had only stage2 and test.lst 
(as well as the whole of MSDOS).  I proceeded as per the previous 
example except the install command was as follows:
grub > install /stage1 (hd0) (hd0,0)/stage2 (hd0,0)/test.lst

The computer booted using the menu on the dos partition.  I proved this 
by booting into DOS and modifying test.lst.  The new menu appeared when 
I re-booted.  I then booted into Linux and removed the stage1 and the 
e2fs_stage1_5 files from that partition.  I re-booted with the GRUB 
floppy and installed GRUB with the menu and stage2 files on the /boot 
directory of the Linux partition.
grub > root (fd0)
grub > install /stage1 (hd0) (hd0,1)/boot/stage2 (hd0,1)/boot/test.lst


Erwin Rol wrote:

>Hello Rakesh,
>
>As you can see in the email header i also sent this mail to the RTEMS
>list, which is normaly the best place to ask "gerneral" questions. I
>personaly don't know grub to well , and can't really give you any help
>on that topic, i just sugested trying it to make sure the problem you
>had was really lilo related.
>
>To everybody else, just read the mails below and maybe someone can give
>Rakesh some help ?
>
>- Erwin
>
>On Thu, 2002-11-14 at 07:50, Rakesh.V.R wrote:
>
>>Hi Erwin,
>>     Thanks for your reply. I tried to boot with GRUB following the
>>directions specified in the HOWTO doc, provided along with the RTEMS
>>snapshot. But on giving the "install" command, "File Not Found" error is
>>displayed. I've attached the HOWTO doc with this mail.
>>I tried using plex86 simulator. Still not successful to run RTEMS based
>>application. Expecting your suggestions.
>>
>>Thanks,
>>Rakesh
>>
>>----- Original Message -----
>>From: "Erwin Rol" <erwin at muffin.org>
>>To: "Rakesh.V.R" <rakesh at atinav.com>
>>Sent: Thursday, November 14, 2002 2:44 AM
>>Subject: Re: Query based on : LILO for RTEMS
>>
>>
>>>Hello Rakesh,
>>>
>>>On Thu, 2002-11-07 at 07:17, Rakesh.V.R wrote:
>>>
>>>>Hello Erwin,
>>>>    I configured and build RTEMS for target i386-rtems and pc386 bsp.
>>>>
>>>Then I
>>>
>>>>edited the path in Makefile.inc provided in your liloboot package to
>>>>
>>>the
>>>
>>>>sample helloworld application created. I created the zImage and tried
>>>>
>>>to
>>>
>>>>boot the same using lilo. System successfully booted to RTEMS. But
>>>>
>>>instead
>>>
>>>>of printing *** HELLO WORLD TEST ***, etc specified in the printf()
>>>>statements, it printed number 8000 for some 10 times and stopped.
>>>>
>>>Could you
>>>
>>>>please suggest something in this regard.
>>>>
>>>Hmmm hard to say, i wrote the lilo stuff a _long_ time ago so it might
>>>be something with the newer RTEMS kernels that goes wrong. Did you try
>>>to boot with grub to verify that RTEMS itself works on your hardware ?
>>>
>>>>Is there any good pc386 emulator, which can be used for running the
>>>>application?
>>>>
>>>I used BOCH's to boot RTEMS, that should still work. Else you can try
>>>vmware. BOCH's is opensource vmware is closed commercial software.
>>>
>>>
>>>I know the reaction was a bit slow, but i hope it still helps you a bit,
>>>
>>>Erwin
>>>
>>>
>>>>Thanks,
>>>>Rakesh
>>>>
>>>>----- Original Message -----
>>>>From: "Erwin Rol" <erwin at muffin.org>
>>>>To: "RTEMS" <rtems-users at oarcorp.com>
>>>>Sent: Saturday, January 29, 2000 3:57 AM
>>>>Subject: LILO for RTEMS
>>>>
>>>>
>>>>>Hello all,
>>>>>
>>>>>due to the positive reactions here the source to
>>>>>make a image that can be booted with lilo.
>>>>>
>>>>>Few notes:
>>>>>it is hacked linux kernel code, which makes it GPL.
>>>>>The Makefile.inc holds the path to the "image" that should
>>>>>be booted. after a 'make' you will have a zImage wich can
>>>>>be dd'ed to floppy or booted with lilo.
>>>>>
>>>>>lilo offers the possibility pass boot parameters and to pass
>>>>>the memory size and it sets up the video modes.
>>>>>These things might be usefull for the pc386 BSP ?
>>>>>also I am interested to see if it solves those strange reboot
>>>>>
>>>problems.
>>>
>>>>>I never have had serious problems with the 4.0.0 version and grub
>>>>>
>>>and
>>>
>>>>>was very supriced to see the C++/sp/hello wolrd (the only ones i
>>>>>
>>>tried)
>>>
>>>>>worked in one go now.
>>>>>
>>>>>I hope it is usefull and maybe can be integrated in the pc386 BSP
>>>>>
>>>(even
>>>
>>>>>though
>>>>>it is GPL)
>>>>>
>>>>>- Erwin
>>>>>
>>>>>PS. can someone tell me what the best way would be to interegrate
>>>>>
>>>this
>>>
>>>>>into the
>>>>>build process ? now i run make manualy on it and have to chnage the
>>>>>image name in the makefile.
>>>>>
>>>>>
>

-- 
Angelo Fraietta

PO Box 859
Hamilton NSW 2303

Home Page


http://www.users.bigpond.com/angelo_f/

There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
    Bernard of Clairvaux (1090 - 1153)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20021119/0e85ee23/attachment.html>


More information about the users mailing list