How to Make a GRUB Image...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bilbo

How to Make a GRUB Image...

Post by bilbo »

hi again....

     I just compiled GRUB on RH9 and I was wondering how to create an Image file that I could  copy to a floppy disk to load my kernel.. can anyone give me instructions on how to do this?... thanks
ezanahka

RE:How to Make a GRUB Image...

Post by ezanahka »

BTW you don't necessarily need a floppy disk... you can just use a loop device with the image and BOCHS.

- Esa
jester_fu

RE:How to Make a GRUB Image...

Post by jester_fu »

I did it by creating a flopp using grub-install and directing it to the floppy. Create another floppy with the stage1 and stage2 files on it, as per step 1 in the article on http://www.mega-tokyo.com/osfaq2/index. ... 20in%20one. Skip step 2... it doesn't work, or didn't for me and grub-install is far easier. Boot of the first disk with the grub install, then follow step 3 in the above article. Boot into your usual O/S then added the menu.cfg file to your flopp and fill it out as per directions in the tutorail above. Works great.
ezanahka

RE:How to Make a GRUB Image...

Post by ezanahka »

If you want to make a GRUB floppy image to use with
Bochs here is how I did it...

1. making an unformatted GRUB floppy image
  (you can find this information in many online tutorials)

2. making OS floppy image
  compile and link your OS
  make an empty directory for loop device mounting
  make an empty unformatted floppy image bximage
    run bximage with no arguments
      enter "fd"
      accept default [1.44]
      enter "img/your.img"
  use su to get root privileges
  create loop device /dev/loop0 from the floppy image
    "losetup /dev/loop0 your.img"
  format the floppy image with mkdosfs
    "mkdosfs /dev/loop0"
  mount the floppy image and copy your files into the image
    "mount /dev/loop0 [floppy-mount-directory]"
  unmount the floppy image
    "umount [floppy-mount-directory]"
  destroy the loop device
    "losetup -d /dev/loop0"
  exit su with exit
  run bochs with the unformatted GRUB image
    switch the floppy drive image to your.img
    type into the grub:
      "root (fd0)"
      "setup (fd0)"
    after GRUB completes the commands quit bochs

and voila! its done...
you should have a floppy image that has GRUB for booting...

- Esa
Post Reply