help-grub
[Top][All Lists]
Advanced

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

RE: grub in mac


From: Peter Cheung
Subject: RE: grub in mac
Date: Wed, 11 Nov 2015 11:05:44 +0800

Hi
    yes, it is a loopback device in mac,

/Users/peter>diskutil list

/dev/disk0 (internal, physical):

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:      GUID_partition_scheme                        *251.0 GB   disk0

   1:                        EFI EFI                     209.7 MB   disk0s1

   2:          Apple_CoreStorage Macintosh HD            250.1 GB   disk0s2

   3:                 Apple_Boot Recovery HD             650.1 MB   disk0s3

/dev/disk1 (internal, virtual):

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:                  Apple_HFS Macintosh HD           +249.8 GB   disk1

                                 Logical Volume on disk0s2

                                 AD00F0B6-B785-409F-B32F-F77FE8E2108E

                                 Unlocked Encrypted

/dev/disk2 (disk image):

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:     FDisk_partition_scheme                        +104.9 MB   disk2

   1:                 DOS_FAT_32 A                       104.8 MB   disk2s1

/Users/peter>


This is my device.map:


/Users/peter>cat NetBeansProjects/PeterI/device.map 

(hd0) /dev/loop0


The device.map work in linux, no sure it is the problem or not.

thanks

from Peter


> Date: Tue, 10 Nov 2015 10:02:28 +0300
> Subject: Re: grub in mac
> From: address@hidden
> To: address@hidden
> CC: address@hidden
>
> On Tue, Nov 10, 2015 at 9:59 AM, Peter Cheung <address@hidden> wrote:
> > Hi Andrei
> > the $deviceName is /dev/disk2, which is correct because i can see it
> > using mac command "diskutil list".
> >
> > I am create a single file, containing a partition. I will use bochs emulator
> > to boot that single file FS image.
> >
>
> Is it something similar to Linux loop device then? I.e. /dev/disk2
> actually refers to this file you mention? Correct? What is in your
> device.map?
>
> > thanks
> > from Peter
> >
> >> Date: Tue, 10 Nov 2015 09:27:19 +0300
> >> Subject: Re: grub in mac
> >> From: address@hidden
> >> To: address@hidden
> >> CC: address@hidden
> >
> >>
> >> On Tue, Nov 10, 2015 at 7:33 AM, Peter Cheung <address@hidden>
> >> wrote:
> >> > hi,
> >> > i am nearly able to build a file system image with FAT partition in mac,
> >> > but i stuck in this command:
> >> >
> >>
> >> Do you mean you create hard disk image and want to install GRUB on this
> >> image?
> >>
> >> > sudo $base/sbin/grub-bios-setup --no-rs-codes -m device.map -c
> >> > ../../`pwd`/temp/boot/grub/core.img -b
> >> > ../../toolchain/lib/grub/i386-pc/boot.img $deviceName
> >>
> >> And what is $deviceName?
> >>
> >> > /toolchain/sbin/grub-bios-setup: error: attempt to read or write outside
> >> > of
> >> > disk `hostdisk//dev/disk2'.
> >> >
> >>
> >> This means GRUB does not detect $deviceName as device available at
> >> boot time. Usual big hammer is suitable device.map.
> >>
> >> > I cross compiled my grub by :
> >> >
> >> > ./configure --prefix=$PREFIX --target=i586-peter-elf
> >> >
> >> > Any tips?
> >> >
> >> >
> >> > Below is my script to make the fs image:
> >> >
> >> > base=/toolchain
> >> >
> >> > rm -fr hd.img
> >> >
> >> > tempDeviceName=`hdiutil info|grep FDisk|cut -d$'\t' -f1`
> >> >
> >> > hdiutil eject $tempDeviceName
> >> >
> >> > commands=( `which dd` `which kpartx` $base/bin/grub-mkimage
> >> > $base/sbin/grub-bios-setup )
> >> >
> >> > error="false"
> >> >
> >> > for c in address@hidden; do
> >> >
> >> > if [ ! -x $c ]; then
> >> >
> >> > echo "************************************************************";
> >> >
> >> > echo "$c not found!";
> >> >
> >> > echo "************************************************************";
> >> >
> >> > error="true";
> >> >
> >> > fi
> >> >
> >> > done
> >> >
> >> >
> >> > if [ "$error" == "true" ]; then
> >> >
> >> > exit;
> >> >
> >> > fi
> >> >
> >> >
> >> > dd if=/dev/zero of=hd.img count=10240 bs=10240
> >> >
> >> > #kpartx -d hd.img
> >> >
> >> > deviceName=`hdiutil attach -imagekey diskimage-class=CRawDiskImage
> >> > -nomount
> >> > hd.img`
> >> >
> >> > deviceName=${deviceName//[[:space:]]/}
> >> >
> >> > echo "deviceName="$deviceName
> >> >
> >> >
> >> > umount temp
> >> >
> >> > rm -fr temp
> >> >
> >> > mkdir temp
> >> >
> >> > # create partition
> >> >
> >> > diskutil partitionDisk $deviceName MBRFormat "MS-DOS FAT32" "A" 100%
> >> >
> >> > umount /Volumes/a
> >> >
> >> > # end create partition
> >> >
> >> > mount -t msdos $deviceName"s1" temp
> >> >
> >> > mkdir -p temp/boot/grub
> >> >
> >> > cp grub.cfg temp/boot/grub/
> >> >
> >> > cp kernel/kernel temp/boot/
> >> >
> >> >
> >> > # setup grub
> >> >
> >> > echo "(hd0) /dev/loop0" > device.map
> >> >
> >> > echo "set prefix=(hd0,msdos1)/boot/grub" > mycfg.cfg
> >> >
> >> >
> >> > $base/bin/grub-mkimage --config=mycfg.cfg -p /boot -O i386-pc -o
> >> > temp/boot/grub/core.img biosdisk part_msdos fat vbe vga echo configfile
> >> > multiboot multiboot2
> >> >
> >> > cp $base/lib/grub/i386-pc/boot.img temp/boot/grub/
> >> >
> >> >
> >> > $base/sbin/grub-bios-setup --no-rs-codes -m device.map -c
> >> > ../../`pwd`/temp/boot/grub/core.img -b
> >> > ../../toolchain/lib/grub/i386-pc/boot.img $deviceName
> >> >
> >> > # end setup grub
> >> >
> >> >
> >> > umount temp
> >> >
> >> > #kpartx -d hd.img
> >> >
> >> > hdiutil eject $deviceName
> >> >
> >> > rm -fr temp
> >> >
> >> > rm -fr device.map
> >> >
> >> > rm -fr mycfg.cfg
> >> >
> >> >
> >> > thanks
> >> > from Peter (address@hidden)
> >> >
> >> > _______________________________________________
> >> > Help-grub mailing list
> >> > address@hidden
> >> > https://lists.gnu.org/mailman/listinfo/help-grub
> >> >
>
> _______________________________________________
> Help-grub mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-grub

reply via email to

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