help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating bootable image with a script


From: Kevin Hunter
Subject: Re: creating bootable image with a script
Date: Tue, 02 Feb 2010 01:23:33 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

At 11:39pm -0500 Thu, 28 Jan 2010, Michael Evans wrote:
> 2) Instead of dd if=/dev/zero of="$IMG_FILE" bs=1M count="$SIZE"
> look up 'truncate';

Awesome!  Better than syntactic sugar because it creates sparse files
too, and let's me use a better variable input.  Did not know about that
utility.  I'll update my script.  Thanks!

> 3) Loopback the entire device, tell grub what that device
> relates to with a device.map file.

I should note that I'm using GRUB2 (1.97~beta4).

> (hd0) /dev/loopX

This I've done, but I think I've encountered a bug in Grub as it
segfaults everytime during grub-install.  Here's what I do:

1. create 100M with truncate

2. parted 100M file into 2 parts (for now until I get grub installed)

  mklabel gpt
  1.  ~31.0KiB - ~95.5KiB
  2.  ~95.5KiB - 100% (rest of disk) Label = OS_Boot

3. set partition 1 bios_grub on

4. losetup file to /dev/loop0

5. mke2fs partition 2 (using losetup)

6. loop mount partition 2

7. execute these commands:

echo "(hd0) $LOOP" > $MOUNT_DIR/boot/grub/device.map
cat > $MOUNT_DIR/boot/grub/grub.cfg << EOF
set default=0
set timeout=5
set root=(hd0,2)
linux /vmlinuz initrd=/initrd.img quiet splash --
initrd /initrd.img
EOF

8. then finally attempt to install grub:

grub-install --root-directory="$MOUNT_DIR" "$LOOP"

This crashes with:

------
grub-setup: warn: Attempting to install GRUB to a partitionless disk.
 ...
Segmentation fault
------


This confuses me because, well, I've *just* partition the disk.

Any ideas?

Thanks very much for your pointers so far, Michael.  They've been a BIG
help.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]