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.
lukasz1235
Posts: 12 Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:
Post
by lukasz1235 » Wed Jun 22, 2011 6:34 am
Hi!
I'm trying to create an iso image with GRUB2. I use these commands:
Code: Select all
grub-mkimage -p /boot -o tmp/core.img -O i386-pc biosdisk iso9660 multiboot configfile
cat /usr/lib/grub/i386-pc/cdboot.img tmp/core.img > eltorito.img
My /boot/grub.cfg:
Code: Select all
set timeout=15
set default=0
menuentry "LukOS"
{
multiboot /boot/LukOS.elf
boot
}
And GRUB2 write:
Code: Select all
error: "prefix" is not set.
error: no menuentry definition.
error: syntax error.
error: Incorrect command.
error: syntax error.
How to create a bootable iso image with grub2?
PS.
Code: Select all
$ grub-mkimage --version
grub-mkimage (GRUB) 1.99-6
Velko
Member
Posts: 153 Joined: Fri Oct 03, 2008 4:13 am
Location: Ogre, Latvia, EU
Post
by Velko » Wed Jun 22, 2011 9:06 am
I think, easiest way is to use GRUB2's
grub-mkrescue utility:
Code: Select all
grub-mkrescue -o velkos.iso runimage/
Contents of
runimage/ directory:
Code: Select all
runimage/boot/grub/grub.cfg
runimage/boot/kernel.bin
Contents of
grub.cfg :
Code: Select all
set default=0
set timeout=0
menuentry "VelkOS" {
set root='(hd96)'
multiboot /boot/kernel.bin
}
If something looks overcomplicated, most likely it is.
lukasz1235
Posts: 12 Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:
Post
by lukasz1235 » Wed Jun 22, 2011 10:04 am
Thanks. On qemu is probably OK, but on bochs, grub print:
Code: Select all
error: unknown filesystem.
Entering rescue mode...
xenos
Member
Posts: 1121 Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:
Post
by xenos » Wed Jun 22, 2011 1:23 pm
lukasz1235 wrote: Hi!
I'm trying to create an iso image with GRUB2. I use these commands:
I think you need to include the
sh module to enable parsing of the config file:
Code: Select all
grub-mkimage -p /boot -o tmp/core.img -O i386-pc biosdisk iso9660 multiboot configfile sh
cat /usr/lib/grub/i386-pc/cdboot.img tmp/core.img > eltorito.img
See
GRUB2 .
lukasz1235
Posts: 12 Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:
Post
by lukasz1235 » Thu Jun 23, 2011 5:17 am
Code: Select all
$ grub-mkimage -p /boot -o tmp/core.img -O i386-pc biosdisk iso9660 multiboot configfile sh
grub-mkimage: error: cannot stat /usr/lib/grub/i386-pc/sh.mod.
From GRUB changelog:
* util/grub-mkrescue.in (make_image): Remove sh module, which has been merged back into normal.
dschatz
Member
Posts: 61 Joined: Wed Nov 10, 2010 10:55 pm
Post
by dschatz » Mon Dec 26, 2011 11:44 am
How was this resolved? I'm having the same trouble making a grub 2 boot iso following the wiki.
lukasz1235
Posts: 12 Joined: Fri Mar 06, 2009 12:18 pm
Location: Poland
Contact:
Post
by lukasz1235 » Mon Dec 26, 2011 12:00 pm
I wrote own bootloader
StephanvanSchaik
Member
Posts: 127 Joined: Sat Sep 29, 2007 5:43 pm
Location: Amsterdam, The Netherlands
Post
by StephanvanSchaik » Tue Dec 27, 2011 9:24 am
Hi,
For those who want to create an ISO image containing GRUB 2, you might attempt to use the following commands as listed in one of my Makefiles:
Code: Select all
bootcd:
@echo Creating bootable CD image...
@grub-mkimage --format=i386-pc --prefix="(cd)" --output=bin/core.img \
--config="boot/default.cfg" loadenv biosdisk part_msdos part_gpt fat ntfs \
ext2 ntfscomp iso9660 loopback search linux boot minicmd cat cpuid chain \
halt help ls reboot echo test configfile normal sleep memdisk tar font \
gfxterm gettext true vbe vga video_bochs video_cirrus multiboot multiboot2
@cat /usr/lib/grub/i386-pc/cdboot.img bin/core.img > bin/grub.img
@genisoimage -graft-points -input-charset utf8 -A "Label" -quiet -R -b \
boot/grub/grub.img -no-emul-boot -boot-load-size 4 -boot-info-table \
-o bootcd.iso \
boot/kernel=bin/kernel \
boot/grub/grub.cfg=boot/grub.cfg \
boot/grub/grub.img=bin/grub.img
You might check out the OSDev wiki to figure out how most of these commands work. The rest should be pretty self-explanatory.
Yours faithfully,
S.J.R. van Schaik.
dschatz
Member
Posts: 61 Joined: Wed Nov 10, 2010 10:55 pm
Post
by dschatz » Thu Dec 29, 2011 1:49 pm
I was able to get a bootable grub 2 disc on the latest ubuntu server by doing the following:
Code: Select all
grub-mkrescue -o bootable.iso iso/
iso directory structure:
Code: Select all
iso/
boot/
grub/
grub.cfg
kernel.bin
grub.cfg:
Code: Select all
set default=0
set timeout=0
menuentry "OS" {
multiboot /boot/kernel.bin
boot
}