help-grub
[Top][All Lists]
Advanced

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

grub in mac


From: Peter Cheung
Subject: grub in mac
Date: Tue, 10 Nov 2015 12:33:02 +0800

hi, 
   i am nearly able to build a file system image with FAT partition in mac, but i stuck in this command: 

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 
/toolchain/sbin/grub-bios-setup: error: attempt to read or write outside of disk `hostdisk//dev/disk2'. 

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

reply via email to

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