Fixed one important bug in grub

I am doing kernel development in mac, my kernel is loaded up by grub because it relay on multiboot spec. I was unable to install grub in a loopback device on mac, so my mac is running a small linux vm in virtual box, i write a simple php to let me upload my kernel, pack the grub and file system, then download it back to mac from vm. It is very stupid.

My hard disk is out of space, so i have to fix this grub bug. The root cause is : the following if-loop (grub-core/osdep/unix/hostdisk.c) are never be true in apple

#if GRUB_DISK_DEVS_ARE_CHAR
  if (S_ISCHR (st.st_mode))
#else
  if (S_ISBLK (st.st_mode))
#endif
ret = grub_util_get_fd_size_os (fd, name, log_secsize)
So i force the line “ret = grub_util_get_fd_size_os (fd, name, log_secsize);” to be execute, then everything work. I am using this command to mount my loopback.
hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount hd.img
Now i can do kernel programming using mac ONLY
pack grub in mac
pack grub in mac
thanks
from Peter

Leave a Reply

Your email address will not be published. Required fields are marked *