help-grub
[Top][All Lists]
Advanced

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

Re: grub in mac


From: Andrei Borzenkov
Subject: Re: grub in mac
Date: Tue, 10 Nov 2015 10:02:28 +0300

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
>> >



reply via email to

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