bless command
PATCH 1/1 bless command
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"
Sorry, forgot to attach the file
Quoted 12 lines · Vladimir Serbinenko
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"
commands/hfspbless.c new file +199 -0
@@ -0,0 +1,199 @@ +/* hfspbless.c - set the hfs+ boot directory. */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/command.h> +#include <grub/fs.h> +#include <grub/misc.h> +#include <grub/dl.h> +#include <grub/device.h> +#include <grub/disk.h> +#include <grub/hfsplus.h> +#include <grub/hfs.h> +#include <grub/partition.h> +#include <grub/file.h> +#include <grub/mm.h> +#include <grub/err.h> + +static grub_uint64_t inode; +static char *dirname; + +static int find_inode (const char *filename, +const struct grub_dirhook_info *info) +{ +if ((grub_strcmp (dirname, filename) ==0 + || (info->case_insensitive &&grub_strcasecmp (dirname, filename) ==0 )) + && info->dir && info->inodeset) + inode = info->inode; +return 0 ; +} + +static grub_err_t +grub_cmd_hfspbless (grub_command_t cmd __attribute__ ((unused)), +int argc,char **args) +{ +char *device_name; +char *path =0 , *tail; +int embedded_offset; +grub_device_t dev; +grub_fs_t fs; + +union { +struct grub_hfs_sblock hfs; +struct grub_hfsplus_volheader hfsplus; + } volheader; + +if (argc !=1 ) +return grub_error (GRUB_ERR_BAD_ARGUMENT ,"directory required" ); + device_name =grub_file_get_device_name (args[0 ]); + dev =grub_device_open (device_name); + + path =grub_strchr (args[0 ],')' ); +if (! path) + path =grub_strdup (dirname); +else + path =grub_strdup (path +1 ); + +if (! path || *path ==0 || ! device_name) + { +if (dev) +grub_device_close (dev); + +grub_free (device_name); +grub_free (path); + +return grub_error (GRUB_ERR_BAD_ARGUMENT ,"invalid argument" ); + } + + fs =grub_fs_probe (dev); +if (! fs ||grub_strcmp (fs->name,"hfsplus" ) !=0 ) + { +grub_device_close (dev); +grub_free (device_name); +grub_free (path); + +return grub_error (GRUB_ERR_BAD_FS ,"no suitable FS found" ); + } + + tail = path +grub_strlen (path) -1 ; + +/* Remove trailing '/'. */ +while (tail != path && *tail =='/' ) + *(tail--) =0 ; + + tail =grub_strrchr (path,'/' ); + inode =0 ; + +if (tail) + { + *tail =0 ; + dirname = tail +1 ; + + (fs->dir) (dev, *path ==0 ?"/" :path, find_inode); + } +else + { + dirname = path +1 ; + (fs->dir) (dev,"/" , find_inode); + } +grub_free (path); + +if (inode ==0 ) + { +grub_device_close (dev); +grub_free (device_name); +return grub_error (GRUB_ERR_FILE_NOT_FOUND , +"%s not found or isn't a directory\n" , + args[0 ]); + } + +/* Read the bootblock. */ +grub_disk_read (dev->disk,GRUB_HFSPLUS_SBLOCK ,0 ,sizeof (volheader), + (char *) &volheader); +if (grub_errno) + { +grub_device_close (dev); +grub_free (device_name); +return grub_errno; + } + + embedded_offset =0 ; +if (grub_be_to_cpu16 (volheader.hfs.magic) ==GRUB_HFS_MAGIC ) + { +int extent_start; +int ablk_size; +int ablk_start; + +/* See if there's an embedded HFS+ filesystem. */ +if (grub_be_to_cpu16 (volheader.hfs.embed_sig) !=GRUB_HFSPLUS_MAGIC ) + { +grub_device_close (dev); +grub_free (device_name); +return grub_errno; + } + +/* Calculate the offset needed to translate HFS+ sector numbers. */ + extent_start =grub_be_to_cpu16 (volheader.hfs.embed_extent.first_block); + ablk_size =grub_be_to_cpu32 (volheader.hfs.blksz); + ablk_start =grub_be_to_cpu16 (volheader.hfs.first_block); + embedded_offset = (ablk_start + + extent_start + * (ablk_size >>GRUB_DISK_SECTOR_BITS )); + +grub_disk_read (dev->disk, embedded_offset +GRUB_HFSPLUS_SBLOCK ,0 , +sizeof (volheader), (char *) &volheader); +if (grub_errno) + { +grub_device_close (dev); +grub_free (device_name); +return grub_errno; + } + } + +/* Make sure this is an HFS+ filesystem. XXX: Do we really support +HFX? */ +if ((grub_be_to_cpu16 (volheader.hfsplus.magic) !=GRUB_HFSPLUS_MAGIC ) + && (grub_be_to_cpu16 (volheader.hfsplus.magic) !=GRUB_HFSPLUSX_MAGIC )) + { +grub_device_close (dev); +grub_free (device_name); +return grub_error (GRUB_ERR_BAD_FS ,"not a HFS+ filesystem" ); + } + volheader.hfsplus.bootdir =grub_be_to_cpu32 (inode); +grub_disk_write (dev->disk, embedded_offset +GRUB_HFSPLUS_SBLOCK ,0 , +sizeof (volheader), (char *) &volheader); + +grub_device_close (dev); +grub_free (device_name); +return grub_errno; +} + +static grub_command_t cmd; + +GRUB_MOD_INIT (hfspbless) +{ + (void ) mod;/* To stop warning. */ + cmd =grub_register_command ("hfspbless" , grub_cmd_hfspbless, +"hfspbless DIRECTORY" , +"Bless DIRECTORY of HFS+ partition." ); +} + +GRUB_MOD_FINI (hfspbless) +{ +grub_unregister_command (cmd); +}
conf/common.rmk +7 -0
@@ -531,3 +531,10 @@ gzio_mod_LDFLAGS = $(COMMON_LDFLAGS) bufio_mod_SOURCES = io/bufio.c bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) + +pkglib_MODULES += hfspbless.mod + +# For hfspbless.mod. +hfspbless_mod_SOURCES = commands/hfspbless.c +hfspbless_mod_CFLAGS = $(COMMON_CFLAGS) +hfspbless_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-pc.rmk +2 -1
@@ -122,6 +122,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ commands/configfile.c commands/echo.c commands/help.c \ commands/handler.c commands/ls.c commands/test.c \ commands/search.c commands/blocklist.c commands/hexdump.c \ + commands/hfspbless.c \ lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \ commands/i386/cpuid.c \ disk/host.c disk/loopback.c disk/scsi.c \
@@ -154,7 +155,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ \ disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/pcpart.c \ + commands/parttool.c parttool/pcpart.c \ grub_emu_init.c grub_emu_LDFLAGS = $(LIBCURSES)
fs/hfsplus.c +4 -134
156 lines not on this page · raw message
include/grub/fs.h +2 -0
@@ -32,7 +32,9 @@ struct grub_dirhook_info int dir:1; int mtimeset:1; int case_insensitive:1; + int inodeset:1;grub_int32_t mtime; +grub_uint64_t inode; };/* Filesystem descriptor. */
include/grub/hfsplus.h new file +167 -0
167 lines not on this page · raw message
Quoted 3 lines · Vladimir Serbinenko
Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes.
Could it be named 'hfsplusbless' (or possibly 'hfs+bless') (I guess our current naming style involves no underscores or other word-separation)? For example, Linux mount calls the filesystem hfsplus, and I like naming- consistency. But feel free to mention counterexamples too!
-Isaac
Hi,
Tested and works on Apple imac81 with Mac OSX 10.5, patch applied to r 2074
grub> hfspbless (hd0,3)/efi
Last login: Sun Apr 19 14:30:23 on console
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 52 => Blessed System Folder is /Volumes/hfsp/efi
finderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 0 => No OS 9 + X blessed X folder
64-bit VSDB volume id: 0x0F87F7680B9C5211
im81:~ pxw$
Now it just needs to bless the file in order to boot from grub.efi on Apple EFI
hfspbless <DIRECTORY> <FILE>
This would be VERY useful, making grub.efi boot possible on Apple Mac without needing Mac OSX or refit.
hfspbless is fine for a name
2009/4/19 Vladimir Serbinenko <[email protected]>
Quoted 18 lines
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Cros (pxw)
Hello, thank you for the testing. Two concepts together (system folder and system file) are clearly redundant. I thought that intel macs look which folder is blessed and load boot.efi file from this directory. Here I attach a patch which updates finderinfo[0] when argument is a directory and finderinfo[1] when argument is a file. Can you do a test and tell me which concept is really used by intel macs? When doing tests don't forget to hold option key and select your testing partition. I will do a similar test on my ppc mac
Quoted 55 lines · Peter Cros
Hi,
Tested and works on Apple imac81 with Mac OSX 10.5, patch applied to r 2074
grub> hfspbless (hd0,3)/efi
Last login: Sun Apr 19 14:30:23 on console
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 52 => Blessed System Folder is /Volumes/hfsp/efifinderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 0 => No OS 9 + X blessed X folder64-bit VSDB volume id:
0x0F87F7680B9C5211
im81:~ pxw$Now it just needs to bless the file in order to boot from grub.efi on Apple EFI
hfspbless <DIRECTORY> <FILE>
This would be VERY useful, making grub.efi boot possible on Apple Mac without needing Mac OSX or refit.
hfspbless is fine for a name
2009/4/19 Vladimir Serbinenko <[email protected]>
Quoted 12 lines
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Cros (pxw)
Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
commands/hfspbless.c new file +207 -0
@@ -0,0 +1,207 @@ +/* hfspbless.c - set the hfs+ boot directory. */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/command.h> +#include <grub/fs.h> +#include <grub/misc.h> +#include <grub/dl.h> +#include <grub/device.h> +#include <grub/disk.h> +#include <grub/hfsplus.h> +#include <grub/hfs.h> +#include <grub/partition.h> +#include <grub/file.h> +#include <grub/mm.h> +#include <grub/err.h> + +static grub_uint64_t inode; +static char *dirname; +static int found; + +static int find_inode (const char *filename, +const struct grub_dirhook_info *info) +{ +if ((grub_strcmp (dirname, filename) ==0 + || (info->case_insensitive &&grub_strcasecmp (dirname, filename) ==0 )) + && info->inodeset) + { + inode = info->inode; + found = info->dir ?2 :1 ; + } +return 0 ; +} + +static grub_err_t +grub_cmd_hfspbless (grub_command_t cmd __attribute__ ((unused)), +int argc,char **args) +{ +char *device_name; +char *path =0 , *tail; +int embedded_offset; +grub_device_t dev; +grub_fs_t fs; + +union { +struct grub_hfs_sblock hfs; +struct grub_hfsplus_volheader hfsplus; + } volheader; + +if (argc !=1 ) +return grub_error (GRUB_ERR_BAD_ARGUMENT ,"directory required" ); + device_name =grub_file_get_device_name (args[0 ]); + dev =grub_device_open (device_name); + + path =grub_strchr (args[0 ],')' ); +if (! path) + path =grub_strdup (dirname); +else + path =grub_strdup (path +1 ); + +if (! path || *path ==0 || ! device_name) + { +if (dev) +grub_device_close (dev); + +grub_free (device_name); +grub_free (path); + +return grub_error (GRUB_ERR_BAD_ARGUMENT ,"invalid argument" ); + } + + fs =grub_fs_probe (dev); +if (! fs ||grub_strcmp (fs->name,"hfsplus" ) !=0 ) + { +grub_device_close (dev); +grub_free (device_name); +grub_free (path); + +return grub_error (GRUB_ERR_BAD_FS ,"no suitable FS found" ); + } + + tail = path +grub_strlen (path) -1 ; + +/* Remove trailing '/'. */ +while (tail != path && *tail =='/' ) + *(tail--) =0 ; + + tail =grub_strrchr (path,'/' ); + found =0 ; + +if (tail) + { + *tail =0 ; + dirname = tail +1 ; + + (fs->dir) (dev, *path ==0 ?"/" :path, find_inode); + } +else + { + dirname = path +1 ; + (fs->dir) (dev,"/" , find_inode); + } +grub_free (path); + +if (! found) + { +grub_device_close (dev); +grub_free (device_name); +return grub_error (GRUB_ERR_FILE_NOT_FOUND , +"%s not found\n" , + args[0 ]); + } + +/* Read the bootblock. */ +grub_disk_read (dev->disk,GRUB_HFSPLUS_SBLOCK ,0 ,sizeof (volheader), + (char *) &volheader); +if (grub_errno) + { +grub_device_close (dev); +grub_free (device_name); +return grub_errno; + } + + embedded_offset =0 ; +if (grub_be_to_cpu16 (volheader.hfs.magic) ==GRUB_HFS_MAGIC ) + { +int extent_start; +int ablk_size; +int ablk_start; + +/* See if there's an embedded HFS+ filesystem. */ +if (grub_be_to_cpu16 (volheader.hfs.embed_sig) !=GRUB_HFSPLUS_MAGIC ) + { +grub_device_close (dev); +grub_free (device_name); +return grub_errno; + } + +/* Calculate the offset needed to translate HFS+ sector numbers. */ + extent_start =grub_be_to_cpu16 (volheader.hfs.embed_extent.first_block); + ablk_size =grub_be_to_cpu32 (volheader.hfs.blksz); + ablk_start =grub_be_to_cpu16 (volheader.hfs.first_block); + embedded_offset = (ablk_start + + extent_start + * (ablk_size >>GRUB_DISK_SECTOR_BITS )); + +grub_disk_read (dev->disk, embedded_offset +GRUB_HFSPLUS_SBLOCK ,0 , +sizeof (volheader), (char *) &volheader); +if (grub_errno) + { +grub_device_close (dev); +grub_free (device_name); +return grub_errno; + } + } + +/* Make sure this is an HFS+ filesystem. XXX: Do we really support +HFX? */ +if ((grub_be_to_cpu16 (volheader.hfsplus.magic) !=GRUB_HFSPLUS_MAGIC ) + && (grub_be_to_cpu16 (volheader.hfsplus.magic) !=GRUB_HFSPLUSX_MAGIC )) + { +grub_device_close (dev); +grub_free (device_name); +return grub_error (GRUB_ERR_BAD_FS ,"not a HFS+ filesystem" ); + } +if (found ==2 ) + volheader.hfsplus.bootdir =grub_be_to_cpu32 (inode); +else + volheader.hfsplus.bootfile =grub_be_to_cpu32 (inode); + +grub_disk_write (dev->disk, embedded_offset +GRUB_HFSPLUS_SBLOCK ,0 , +sizeof (volheader), (char *) &volheader); + +grub_device_close (dev); +grub_free (device_name); +return grub_errno; +} + +static grub_command_t cmd; + +GRUB_MOD_INIT (hfspbless) +{ + (void ) mod;/* To stop warning. */ + cmd =grub_register_command ("hfspbless" , grub_cmd_hfspbless, +"hfspbless DIRECTORY" , +"Bless DIRECTORY of HFS+ partition." ); +} + +GRUB_MOD_FINI (hfspbless) +{ +grub_unregister_command (cmd); +}
conf/common.rmk +7 -0
@@ -531,3 +531,10 @@ gzio_mod_LDFLAGS = $(COMMON_LDFLAGS) bufio_mod_SOURCES = io/bufio.c bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) + +pkglib_MODULES += hfspbless.mod + +# For hfspbless.mod. +hfspbless_mod_SOURCES = commands/hfspbless.c +hfspbless_mod_CFLAGS = $(COMMON_CFLAGS) +hfspbless_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-pc.rmk +2 -1
@@ -122,6 +122,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ commands/configfile.c commands/echo.c commands/help.c \ commands/handler.c commands/ls.c commands/test.c \ commands/search.c commands/blocklist.c commands/hexdump.c \ + commands/hfspbless.c \ lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \ commands/i386/cpuid.c \ disk/host.c disk/loopback.c disk/scsi.c \
@@ -154,7 +155,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ \ disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/pcpart.c \ + commands/parttool.c parttool/pcpart.c \ grub_emu_init.c grub_emu_LDFLAGS = $(LIBCURSES)
fs/hfsplus.c +4 -134
156 lines not on this page · raw message
include/grub/fs.h +2 -0
@@ -32,7 +32,9 @@ struct grub_dirhook_info int dir:1; int mtimeset:1; int case_insensitive:1; + int inodeset:1;grub_int32_t mtime; +grub_uint64_t inode; };/* Filesystem descriptor. */
include/grub/hfsplus.h new file +167 -0
167 lines not on this page · raw message
I'd also like to help test this as I have a first gen macintel mac pro that needs to run centos. It was difficult to get a 2nd gen machine to see the os drive last time I loaded centos...
---
Drew Rosen
Quoted 60 lines · Vladimir Serbinenko
Hello, thank you for the testing. Two concepts together (system folder and system file) are clearly redundant. I thought that intel macs look which folder is blessed and load boot.efi file from this directory. Here I attach a patch which updates finderinfo[0] when argument is a directory and finderinfo[1] when argument is a file. Can you do a test and tell me which concept is really used by intel macs? When doing tests don't forget to hold option key and select your testing partition. I will do a similar test on my ppc mac
On Sun, Apr 19, 2009 at 6:51 AM, Peter Cros <[email protected]> wrote:
Hi,Tested and works on Apple imac81 with Mac OSX 10.5, patch applied to r 2074
grub> hfspbless (hd0,3)/efi
Last login: Sun Apr 19 14:30:23 on console
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 52 => Blessed System Folder is /Volumes/hfsp/efifinderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 0 => No OS 9 + X blessed X folder64-bit VSDB volume id:
0x0F87F7680B9C5211
im81:~ pxw$Now it just needs to bless the file in order to boot from grub.efi on Apple EFI
hfspbless <DIRECTORY> <FILE>
This would be VERY useful, making grub.efi boot possible on Apple Mac without needing Mac OSX or refit.
hfspbless is fine for a name
2009/4/19 Vladimir Serbinenko <[email protected]>
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-develSignature · 15 lines
Cros (pxw) _______________________________________________ Grub-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/grub-devel <bless.diff> _______________________________________________ Grub-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/grub-devel
bless.diff version 2.
success.
cleared all bless on hfsplus partition in OSX.
grub> hfspbless (hd0,3)/efi/test/grub523.efi
Back to OSX -
Last login: Sun Apr 19 22:48:43 on console
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 75 => Blessed System Folder is <missing>
finderinfo[1]: 7857 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efi
finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 0 => No OS 9 + X blessed X folder
64-bit VSDB volume id: 0x0F87F7680B9C5211
It boots -
Restart with option key gives the Apple EFI disk icon, which boots grub523.efi
Confirmed with shutdown-restart again.
Redundant info -
I checked the OSX bless utility, it requires both folder and file, or it will not agree to bless the file.
im81:~ pxw$ sudo bless --folder /Volumes/hfsp/efi/test --file /Volumes/hfsp/efi/test/grub523.efi
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 7882 => Blessed System Folder is /Volumes/hfsp/efi/test
finderinfo[1]: 7885 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efi
Now all we need is --setBoot to make grub.efi the default boot, no Option key required.
Oh, and how do we get grub.efi booted to bless itself - the only way I know at present is to use a rEFIt CD, which is bootable by Apple EFI.
Quoted 81 lines · Vladimir Serbinenko
Hello, thank you for the testing. Two concepts together (system folder and system file) are clearly redundant. I thought that intel macs look which folder is blessed and load boot.efi file from this directory. Here I attach a patch which updates finderinfo[0] when argument is a directory and finderinfo[1] when argument is a file. Can you do a test and tell me which concept is really used by intel macs? When doing tests don't forget to hold option key and select your testing partition. I will do a similar test on my ppc mac
Quoted 56 lines · Peter Cros
Hi,
Tested and works on Apple imac81 with Mac OSX 10.5, patch applied to r 2074
grub> hfspbless (hd0,3)/efi
Last login: Sun Apr 19 14:30:23 on console
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 52 => Blessed System Folder is /Volumes/hfsp/efifinderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 0 => No OS 9 + X blessed X folder64-bit VSDB volume id:
0x0F87F7680B9C5211
im81:~ pxw$Now it just needs to bless the file in order to boot from grub.efi on Apple EFI
hfspbless <DIRECTORY> <FILE>
This would be VERY useful, making grub.efi boot possible on Apple Mac without needing Mac OSX or refit.
hfspbless is fine for a name
2009/4/19 Vladimir Serbinenko <[email protected]>
Quoted 12 lines
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Cros (pxw)Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Cros (pxw)
Thank you for the testing and info.
Quoted 5 lines
Redundant info -
I checked the OSX bless utility, it requires both folder and file, or it will not agree to bless the file.
I'm nearly sure now that folder blessing (+tbxi attribute) is used on ppc macs and file blessing on intel macs. Now the question is how we do it. We can either keep the current syntax or IMO it's better to have two commands:
intelmacbless and ppcmacbless both accepting file as an argument. First one updates finderInfo[1] and the second one updates finderInfo[0] and sets filetype of given file to tbxi and if any other file has the type tbxi in the same directory then change it to any other value (e.g. tbxj)
Quoted 4 lines
Now all we need is --setBoot to make grub.efi the default boot, no Option key required.
In my todo. Thanks to ams I have all the needed info now
Quoted 4 lines
Oh, and how do we get grub.efi booted to bless itself - the only way I know at present is to use a rEFIt CD, which is bootable by Apple EFI.
I don't understand your question but hfspbless works in grub-emu too. Also I guess we have to write grub-setup wrapper around hfspbless and grub-mkrescue. I've seen that genisoimage can create iso+hfs disks. Is anybody interested in writing corresponding script?
Quoted 98 lines · Vladimir Serbinenko
Quoted 76 lines
Hello, thank you for the testing. Two concepts together (system folder and system file) are clearly redundant. I thought that intel macs look which folder is blessed and load boot.efi file from this directory. Here I attach a patch which updates finderinfo[0] when argument is a directory and finderinfo[1] when argument is a file. Can you do a test and tell me which concept is really used by intel macs? When doing tests don't forget to hold option key and select your testing partition. I will do a similar test on my ppc mac
Quoted 56 lines · Peter Cros
Hi,
Tested and works on Apple imac81 with Mac OSX 10.5, patch applied to r 2074
grub> hfspbless (hd0,3)/efi
Last login: Sun Apr 19 14:30:23 on console
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 52 => Blessed System Folder is /Volumes/hfsp/efifinderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 0 => No OS 9 + X blessed X folder64-bit VSDB volume id:
0x0F87F7680B9C5211
im81:~ pxw$Now it just needs to bless the file in order to boot from grub.efi on Apple EFI
hfspbless <DIRECTORY> <FILE>
This would be VERY useful, making grub.efi boot possible on Apple Mac without needing Mac OSX or refit.
hfspbless is fine for a name
2009/4/19 Vladimir Serbinenko <[email protected]>
Quoted 12 lines
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Cros (pxw)Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-develQuoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Cros (pxw)_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Thanks that is going to be very useful.
Just some further comment from the little I know -
Quoted 3 lines · Vladimir Serbinenko
Quoted 2 lines
Now the question is how we do it. We can either keep the current syntax or
Quoted 6 lines
IMO it's better to have two commands:
intelmacbless and ppcmacbless both accepting file as an argument. First one updates finderInfo[1] and the second one updates finderInfo[0] and sets filetype of given file to tbxi and if any other file has the type tbxi in the same directory then change it to any other value (e.g. tbxj)
The finderinfo[1] file blessing does seem the best for intel mac, but just based on my imac81 test with current EFI.
Quoted 10 lines
Quoted 3 lines
Now all we need is --setBoot to make grub.efi the default boot, no Option key required.
In my todo. Thanks to ams I have all the needed info now
Quoted 3 lines
Oh, and how do we get grub.efi booted to bless itself - the only way I know at present is to use a rEFIt CD, which is bootable by Apple EFI.
I don't understand your question but hfspbless works in grub-emu too.
Do you mean run grub-emu as part of a linux installation to bless grub.ef? It seems to leave the problem of booting the linux installer, which is easy to do from grub.efi - if it is blessed.
At present we install grub.efi manually, using only grub-mkimage to build grub.efi, without using other grub utilities, and mostly just use preloaded modules.
Here is some more info for the intel mac -
Further checking shows that Apple EFI will detect and boot an unblessed file named boot.efi but only if the enclosing folder is blessed.
Will not boot unblessed grub.efi in the same folder.
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 7891 => Blessed System Folder is /Volumes/hfsp/efi/test
finderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset
finderinfo[5]: 7891 => OS X blessed folder is /Volumes/hfsp/efi/test
64-bit VSDB volume id: 0x0F87F7680B9C5211
im81:~ pxw$ ls /Volumes/hfsp/efi/test boot.efi grub.cfg grub523.efi grub523.icns grub64.icns im81:~ pxw$
That boots boot.efi using the Option key.
For OSX boot.efi -
im81:~ pxw$ bless --info /
finderinfo[0]: 149 => Blessed System Folder is
/System/Library/CoreServices
finderinfo[1]: 297081 => Blessed System File is
/System/Library/CoreServices/boot.efi
finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset
finderinfo[5]: 149 => OS X blessed folder is /System/Library/CoreServices
64-bit VSDB volume id: 0x0F8CB2A6A4C456E8
Quoted 20 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
--
Cros (pxw)Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Cros (pxw)
Hello
Quoted 7 lines
Do you mean run grub-emu as part of a linux installation to bless grub.ef? It seems to leave the problem of booting the linux installer, which is easy to do from grub.efi - if it is blessed.
At present we install grub.efi manually, using only grub-mkimage to build grub.efi, without using other grub utilities, and mostly just use preloaded modules.
You can use the bootable CD of your favourite distro. I hope that grub2.efi will become a default bootloader to install on efi system for major linux distributions
Quoted 14 lines
Here is some more info for the intel mac -
Further checking shows that Apple EFI will detect and boot an unblessed file named boot.efi but only if the enclosing folder is blessed. Will not boot unblessed grub.efi in the same folder.
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 7891 => Blessed System Folder is /Volumes/hfsp/efi/testfinderinfo[1]: 0 => No Blessed System File finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset
Quoted 8 lines
finderinfo[5]: 7891 => OS X blessed folder is /Volumes/hfsp/efi/test
64-bit VSDB volume id:0x0F87F7680B9C5211im81:~ pxw$ ls /Volumes/hfsp/efi/test boot.efi grub.cfg grub523.efi grub523.icns grub64.icns im81:~ pxw$
That boots boot.efi using the Option key.
Could you determine the priority? E.g. if you have both blessed file and boot.efi in blessed directory which one is loaded?
Quoted 47 lines
For OSX boot.efi -
im81:~ pxw$ bless --info /
finderinfo[0]: 149 => Blessed System Folder is
/System/Library/CoreServices
finderinfo[1]: 297081 => Blessed System File is
/System/Library/CoreServices/boot.efifinderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unsetfinderinfo[5]: 149 => OS X blessed folder is
/System/Library/CoreServices
64-bit VSDB volume id:0x0F8CB2A6A4C456E8Quoted 14 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
--
Cros (pxw)Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-develQuoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Cros (pxw)_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Hi,
Quoted 7 lines · Vladimir Serbinenko
Hello
Quoted 2 lines
You can use the bootable CD of your favourite distro. I hope that
grub2.efi will become a default bootloader to install on efi system for major linux distributions
The thought was just to avoid dependance on the apple pc-bios emulation and go toward a grub.efi installation as you suggest. (Also the apple Xserve machines do not have pc-bios emulation.)
Quoted 4 lines
Could you determine the priority? E.g. if you have both blessed file and
Quoted 2 lines
boot.efi in blessed directory which one is loaded?
In both these cases the blessed grub.efi file is selected and boots. The boot.efi file here is a copy of the OSX boot.efi
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 7891 => Blessed System Folder is <missing>
finderinfo[1]: 8123 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efi
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 8120 => Blessed System Folder is /Volumes/hfsp/efi/test
finderinfo[1]: 8123 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efi
im81:~ pxw$ ls /Volumes/hfsp/efi/test/*.efi
/Volumes/hfsp/efi/test/boot.efi
/Volumes/hfsp/efi/test/grub523.efi
Signature · 1 line
Cros (pxw)
Quoted 7 lines · Peter Cros
Hi,
Quoted 3 lines · Vladimir Serbinenko
Hello
Quoted 1 line
Quoted 10 lines
Quoted 4 lines
Quoted 1 line
You can use the bootable CD of your favourite distro. I hope that
grub2.efi will become a default bootloader to install on efi system for major linux distributions
The thought was just to avoid dependance on the apple pc-bios emulation and go toward a grub.efi installation as you suggest. (Also the apple Xserve machines do not have pc-bios emulation.)
The bootable cd can have both eltorito (bios) and grub2.efi
Quoted 7 lines
Could you determine the priority? E.g. if you have both blessed file and
Quoted 3 lines
Quoted 2 lines
boot.efi in blessed directory which one is loaded?
In both these cases the blessed grub.efi file is selected and boots. The boot.efi file here is a copy of the OSX boot.efi
But what happens if you do something like:
blessed folder -> /test1 contains boot.efi
blessed file -> /test2/grub2.efi
Quoted 26 lines
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 7891 => Blessed System Folder is <missing>
finderinfo[1]: 8123 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efiim81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 8120 => Blessed System Folder is /Volumes/hfsp/efi/test
finderinfo[1]: 8123 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efiim81:~ pxw$ ls /Volumes/hfsp/efi/test/*.efi
/Volumes/hfsp/efi/test/boot.efi
/Volumes/hfsp/efi/test/grub523.efi--
Cros (pxw)_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
My reply was delayed by network going down.
Quoted 5 lines · Vladimir Serbinenko
Quoted 3 lines
The bootable cd can have both eltorito (bios) and grub2.efi
I like the grub.efi CD.
Quoted 4 lines
But what happens if you do something like:
blessed folder -> /test1 contains boot.efi
blessed file -> /test2/grub2.efi
grub.efi wins.
We have this - (not exactly as above )
/Volumes/hfsp/boot.efi
/Volumes/hfsp/efi/test/grub523.efi
im81:~ pxw$ bless --info /Volumes/hfsp
finderinfo[0]: 2 => Blessed System Folder is /Volumes/hfsp/
finderinfo[1]: 8256 => Blessed System File is
/Volumes/hfsp/efi/test/grub523.efi
finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 2 => OS X blessed folder is /Volumes/hfsp/
64-bit VSDB volume id: 0x0F87F7680B9C5211
Apple Option restart shows the EFI boot icon, this boots grub523.efi,
Cros (pxw)
Hello
the bless command is nice.
2009/4/19 Vladimir Serbinenko <[email protected]>:
Quoted 9 lines
Thank you for the testing and info.
Quoted 4 lines
Redundant info -
I checked the OSX bless utility, it requires both folder and file, or it will not agree to bless the file.I'm nearly sure now that folder blessing (+tbxi attribute) is used on ppc macs and file blessing on intel macs. Now the question is how we do it. We can either keep the current syntax or IMO it's better to have two commands:
Wouldn't it be reasonable to bless both the file and the directory?
Quoted 4 lines
intelmacbless and ppcmacbless both accepting file as an argument. First one updates finderInfo[1] and the second one updates finderInfo[0] and sets filetype of given file to tbxi and if any other file has the type tbxi in the same directory then change it to any other value (e.g. tbxj)
Couldn't the bless command check the machine type of the file and change file type on ppc files and bless the file for i386 files?
It's OK if the command has parameters that specify what to do and are explained in the help but it should just do the right thing when you specify the file to bless.
Would it be possible to make an i386+ppc efi boot CD this way? Would the i386 grub boot on 64bit systems or are two CDs needed for i386 and amd64?
Thanks
Michal
Quoted 11 lines · Michal Suchanek
Hello
the bless command is nice.
2009/4/19 Vladimir Serbinenko <[email protected]>:
Quoted 6 lines
Thank you for the testing and info.
Quoted 4 lines
Redundant info -
I checked the OSX bless utility, it requires both folder and file, or it will not agree to bless the file.
Quoted 5 lines
Quoted 3 lines
I'm nearly sure now that folder blessing (+tbxi attribute) is used on ppc macs and file blessing on intel macs. Now the question is how we do it. We can either keep the current syntax or IMO it's better to have two commands:
Wouldn't it be reasonable to bless both the file and the directory?
Hi,
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
Quoted 9 lines
Quoted 5 lines
intelmacbless and ppcmacbless both accepting file as an argument. First one updates finderInfo[1] and the second one updates finderInfo[0] and sets filetype of given file to tbxi and if any other file has the type tbxi in the same directory then change it to any other value (e.g. tbxj)
Couldn't the bless command check the machine type of the file and change file type on ppc files and bless the file for i386 files?
Quoted 7 lines
It's OK if the command has parameters that specify what to do and are explained in the help but it should just do the right thing when you specify the file to bless.
Would it be possible to make an i386+ppc efi boot CD this way? Would the i386 grub boot on 64bit systems or are two CDs needed for i386 and amd64?
Yeah, osx support fat binaries that contains code from multiple architecture.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
Quoted 8 lines
Quoted 1 line
Wouldn't it be reasonable to bless both the file and the directory?
Hi,
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
AFAIK --file has no effect for intel macs.
Quoted 14 lines
Quoted 14 lines
Quoted 6 lines
intelmacbless and ppcmacbless both accepting file as an argument. First one updates finderInfo[1] and the second one updates finderInfo[0] and sets filetype of given file to tbxi and if any other file has the type tbxi in the same directory then change it to any other value (e.g. tbxj)
Couldn't the bless command check the machine type of the file and change file type on ppc files and bless the file for i386 files?
It's OK if the command has parameters that specify what to do and are explained in the help but it should just do the right thing when you specify the file to bless.
Quoted 6 lines
Quoted 3 lines
Would it be possible to make an i386+ppc efi boot CD this way? Would the i386 grub boot on 64bit systems or are two CDs needed for i386 and amd64?
Yeah, osx support fat binaries that contains code from multiple architecture.
In the case of OFW (and not EFI) boot for ppc macs You can (and have to) specify a completely different file. OSX bootable disks and partitions do it that way
Quoted 12 lines
--
Beangitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
AFAIK --file has no effect for intel macs.
Hi,
After more testing, I believe the booting process works like this:
One important difference between openfirmware and efi is that openfirmware stores file path in nvram, while efi stores device path. The default boot file for openfirmware is like this:
device:\\+tbxi
Which means the files which +tbxi attribute in the blessed directory.
But efi only store the boot device (uuid), so it needs to use the blessed file to boot.
So to distinguish these two situation, we can have too options for bless:
bless [--bootinfo PATH_TO_BOOTX] [[--bootefi PATH_TO_BOOTEFI]
--bootinfo set the blessed directory plus +tbxi, while --bootefi set the blessed file, this way we could specify different boot files for openfirmware and efi, something like this:
bless --bootinfo /grub.elf --bootefi grub.efi
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
2009/8/29 Bean <[email protected]>:
Quoted 25 lines
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
AFAIK --file has no effect for intel macs.
Hi,
After more testing, I believe the booting process works like this:
One important difference between openfirmware and efi is that openfirmware stores file path in nvram, while efi stores device path. The default boot file for openfirmware is like this:
device:\\+tbxi
Which means the files which +tbxi attribute in the blessed directory.
But efi only store the boot device (uuid), so it needs to use the blessed file to boot.
So to distinguish these two situation, we can have too options for bless:
Quoted 8 lines
bless [--bootinfo
PATH_TO_BOOTX] [[--bootefiPATH_TO_BOOTEFI]--bootinfo set the blessed directory plus +tbxi, while --bootefi set the blessed file, this way we could specify different boot files for openfirmware and efi, something like this:
bless --bootinfo /grub.elf --bootefi grub.efi
Wouldn't it be possible to do a check in bless that determines if the file is for openfirmware of efi?
Thanks
Michal
Quoted 32 lines · Michal Suchanek
2009/8/29 Bean <[email protected]>:
Quoted 31 lines
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
AFAIK --file has no effect for intel macs.
Hi,
After more testing, I believe the booting process works like this:
One important difference between openfirmware and efi is that openfirmware stores file path in nvram, while efi stores device path. The default boot file for openfirmware is like this:
device:\\+tbxi
Which means the files which +tbxi attribute in the blessed directory.
But efi only store the boot device (uuid), so it needs to use the blessed file to boot.
So to distinguish these two situation, we can have too options for bless:
bless [--bootinfo
PATH_TO_BOOTX] [[--bootefiPATH_TO_BOOTEFI]--bootinfo set the blessed directory plus +tbxi, while --bootefi set the blessed file, this way we could specify different boot files for openfirmware and efi, something like this:
Quoted 6 lines
Quoted 2 lines
bless --bootinfo /grub.elf --bootefi grub.efi
Wouldn't it be possible to do a check in bless that determines if the file is for openfirmware of efi?
Actually it's even easy. EFI files are exes (Mark Zbykowsky or some fat binaries signatures) while OFW files are ELF AFAIR
Quoted 10 lines
Thanks
Michal
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 32 lines · Michal Suchanek
2009/8/29 Bean <[email protected]>:
Quoted 31 lines
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
AFAIK --file has no effect for intel macs.
Hi,
After more testing, I believe the booting process works like this:
One important difference between openfirmware and efi is that openfirmware stores file path in nvram, while efi stores device path. The default boot file for openfirmware is like this:
device:\\+tbxi
Which means the files which +tbxi attribute in the blessed directory.
But efi only store the boot device (uuid), so it needs to use the blessed file to boot.
So to distinguish these two situation, we can have too options for bless:
bless [--bootinfo
PATH_TO_BOOTX] [[--bootefiPATH_TO_BOOTEFI]--bootinfo set the blessed directory plus +tbxi, while --bootefi set the blessed file, this way we could specify different boot files for openfirmware and efi, something like this:
Quoted 5 lines
Quoted 2 lines
bless --bootinfo /grub.elf --bootefi grub.efi
Wouldn't it be possible to do a check in bless that determines if the file is for openfirmware of efi?
Hi,
I think it would be better to specify the type explicitly, as there are multiple formats supports by both platform. OpenFirmware support bootinfo, xcoff and elf, while efi support i386-efi, x86_64-efi and fat binary.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
2009/8/29 Bean <[email protected]>:
Quoted 39 lines · Michal Suchanek
Quoted 32 lines
2009/8/29 Bean <[email protected]>:
Quoted 31 lines
Quoted 5 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines
Actually, I think the correct handling is to first bless a boot directory (storing the directory id in header), then bless a boot file (add +tbxi attribute), that's why the bless command in OSX needs needs both --folder and --file option.
AFAIK --file has no effect for intel macs.
Hi,
After more testing, I believe the booting process works like this:
One important difference between openfirmware and efi is that openfirmware stores file path in nvram, while efi stores device path. The default boot file for openfirmware is like this:
device:\\+tbxi
Which means the files which +tbxi attribute in the blessed directory.
But efi only store the boot device (uuid), so it needs to use the blessed file to boot.
So to distinguish these two situation, we can have too options for bless:
bless [--bootinfo
PATH_TO_BOOTX] [[--bootefiPATH_TO_BOOTEFI]--bootinfo set the blessed directory plus +tbxi, while --bootefi set the blessed file, this way we could specify different boot files for openfirmware and efi, something like this:
Quoted 5 lines
Quoted 2 lines
bless --bootinfo /grub.elf --bootefi grub.efi
Wouldn't it be possible to do a check in bless that determines if the file is for openfirmware of efi?
Quoted 7 lines
Hi,
I think it would be better to specify the type explicitly, as there are multiple formats supports by both platform. OpenFirmware support bootinfo, xcoff and elf, while efi support i386-efi, x86_64-efi and fat binary.
They are multiple but different. I guess automatic detection would be nice to have but writing detection for multiple formats might take some time so it would be better to get a bless command without detection initially and possibly add detection later.
Thanks
Michal
Quoted 17 lines
Hi,
After more testing, I believe the booting process works like this:
One important difference between openfirmware and efi is that openfirmware stores file path in nvram, while efi stores device path. The default boot file for openfirmware is like this:
device:\\+tbxi
Which means the files which +tbxi attribute in the blessed directory.
But efi only store the boot device (uuid), so it needs to use the blessed file to boot.
So to distinguish these two situation, we can have too options for bless:
Quoted 7 lines
bless [--bootinfo
PATH_TO_BOOTX] [[--bootefiPATH_TO_BOOTEFI]--bootinfo set the blessed directory plus +tbxi, while --bootefi set the blessed file, this way we could specify different boot files for openfirmware and efi, something like this:
bless --bootinfo /grub.elf --bootefi grub.efi
The --botinfo and --bootefi in this case are independent. I don't see why it would be stuffed in the same command. What about:
blessefi - change blessed file
blessofw - change blessed directory +tbxi
blessdir - change blessed directory
Quoted 13 lines
--
Beangitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Hi again,
Could the hfspbless patch be updated and hopefully committted to provide the hfspbless module as standard in grub2.
It is valuable to enable auto-booting grub.efi installation on Apple Intel Mac efi and also where Mac OSX/refit is not installed. Potentially for automated grub.efi installation on Apple.
The old patch has not caught up with subsequent changes to hfsplus.c and requires editing to get it to work.
Quoted 18 lines · Vladimir Serbinenko
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Cros (pxw)
Quoted 5 lines · Peter Cros
Hi again,
Could the hfspbless patch be updated and hopefully committted to provide the hfspbless module as standard in grub2.
Attached to this e-mail and on my personal git repository in branch bless
the rediff. I was thinking of adding ppc mac support but haven't done it yet I think we can incorporate apple intel support without the ppc counterpart yet. Does anyone object?
Quoted 42 lines
It is valuable to enable auto-booting grub.efi installation on Apple Intel Mac efi and also where Mac OSX/refit is not installed. Potentially for automated grub.efi installation on Apple.
The old patch has not caught up with subsequent changes to
hfsplus.cand requires editing to get it to work.Quoted 12 lines · Vladimir Serbinenko
Hello, due to request by ams I wrote this. It's an analog of "bless" command available under OSX rewritten using grub2 fs functions and according to apple specification of hfs+ on-disk format. This command only update the blessed folder on a partition it doesn't change which drive is used for booting. The later will be a separate command. Also you can choose which volume to boot from by holding option key. Syntax:
hfspbless <DIRECTORY>
It works only on HFS+ volumes. Also due to the lack of hardware I wasn't unable to test this "in vivo"Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Cros (pxw)_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
ChangeLog +15 -0
@@ -1,3 +1,18 @@ +2009-06-19 Vladimir Serbinenko <[email protected]> + + HFS+ blessing + + * commands/hfspbless.c: new file + * conf/common.rmk (pkglib_MODULES): add hfspbless.mod + (hfspbless_mod_SOURCES): new variable + (hfspbless_mod_CFLAGS): likewise + (hfspbless_mod_LDFLAGS): likewise + * conf/i386-pc.rmk (grub_emu_SOURCES): add commands/hfspbless.c + * fs/hfsplus.c: move definitions + * include/grub/hfsplus.h: here + * fs/hfsplus.c (grub_hfsplus_dir): set inode + * include/grub/fs.h (grub_dirhook_info): new fields inode and inodeset + 2009-06-18 Pavel Roskin <[email protected]> * conf/common.rmk: Add fs_file.mod.
commands/hfspbless.c new file +207 -0
207 lines not on this page · raw message
conf/common.rmk +7 -0
@@ -598,3 +598,10 @@ pkglib_MODULES += xnu_uuid.mod xnu_uuid_mod_SOURCES = commands/xnu_uuid.c xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS) xnu_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS) + +pkglib_MODULES += hfspbless.mod + +# For hfspbless.mod. +hfspbless_mod_SOURCES = commands/hfspbless.c +hfspbless_mod_CFLAGS = $(COMMON_CFLAGS) +hfspbless_mod_LDFLAGS = $(COMMON_LDFLAGS)
conf/i386-pc.rmk +2 -1
@@ -126,6 +126,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ commands/configfile.c commands/echo.c commands/help.c \ commands/handler.c commands/ls.c commands/test.c \ commands/search.c commands/blocklist.c commands/hexdump.c \ + commands/hfspbless.c \ lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \ commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ commands/i386/cpuid.c \
@@ -160,7 +161,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \ \ disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - commands/parttool.c parttool/pcpart.c \ + commands/parttool.c parttool/pcpart.c \ grub_emu_init.c grub_emu_LDFLAGS = $(LIBCURSES)
fs/hfsplus.c +2 -145
159 lines not on this page · raw message
include/grub/fs.h +2 -0
@@ -32,7 +32,9 @@ struct grub_dirhook_info int dir:1; int mtimeset:1; int case_insensitive:1; + int inodeset:1;grub_int32_t mtime; +grub_uint64_t inode; };/* Filesystem descriptor. */
include/grub/hfsplus.h new file +177 -0
177 lines not on this page · raw message
Quoted 4 lines · Vladimir 'phcoder' Serbinenko
Attached to this e-mail and on my personal git repository in branch
bless the rediff. I was thinking of adding ppc mac support but haven't done it yet I think we can incorporate apple intel support without the ppc counterpart yet. Does anyone object?
I don't see how PowerPC support would be different. It's a filesystem issue. Actually, on PowerPC blessing on HFS (not on HFS+) would be needed.
I think it would be better to name the command "hfsbless". The way, HFS support could be added to the same command later.
Adding commands/hfspbless.c to grub_emu_SOURCES only on i386-pc seems inconsistent. Either it should be added everywhere or nowhere. I think we need a build system reorganization to allow grub_emu_SOURCES to be mostly platform independent.
The spacing change in conf/i386-pc.rmk is unnecessary.
"(void) mod;" is unnecessary.
fs/hfsplus.c should include grub/hfsplus.h or it won't compile.
In find_inode(), the core start with
if(! info->inodeset)
return 0;
It's both faster and more readable.
Please run hfspbless.c through indent. It would fix such things as
(fs->dir) (dev, *path == 0 ?"/":path, find_inode);
Signature · 2 lines
Regards, Pavel Roskin
Quoted 11 lines · Pavel Roskin
Quoted 4 lines · Vladimir 'phcoder' Serbinenko
Attached to this e-mail and on my personal git repository in branch
bless the rediff. I was thinking of adding ppc mac support but haven't done it yet I think we can incorporate apple intel support without the ppc counterpart yet. Does anyone object?I don't see how PowerPC support would be different. It's a filesystem issue. Actually, on PowerPC blessing on HFS (not on HFS+) would be needed.
You need to set file type to tbxi on PowerPC. On HFS+ there are 2 relevant
entries: blessed directory and blessed file. On EFI it works like:
first tries blessed file if it's missing it tries (blessed directory)/boot.efi
On PowerPC it searches for the first file of type tbxi in blessed directory
Quoted 3 lines
I think it would be better to name the command "hfsbless". The way, HFS support could be added to the same command later.
I'm ok with renaming
Quoted 7 lines
Adding
commands/hfspbless.ctogrub_emu_SOURCESonly on i386-pc seems inconsistent. Either it should be added everywhere or nowhere. I think we need a build system reorganization to allowgrub_emu_SOURCESto be mostly platform independent.
I completely agree. Bean was interested in doing so. Bean: what's your status?
Quoted 9 lines
The spacing change in conf/i386-pc.rmk is unnecessary.
"(void) mod;" is unnecessary.
fs/hfsplus.cshould includegrub/hfsplus.hor it won't compile.In
find_inode(), the core start with
Quoted 9 lines
if(! info->inodeset)
return 0;It's both faster and more readable.
Please run
hfspbless.cthrough indent. It would fix such things as(
fs->dir) (dev, *path == 0 ?"/":path,find_inode);
Thank you for these comments. I'll fix it as soon as I finish the build system additions I promised Carles
Quoted 11 lines
--
Regards,
Pavel Roskin_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 11 lines · Vladimir 'phcoder' Serbinenko
Quoted 5 lines · Peter Cros
Hi again,
Could the hfspbless patch be updated and hopefully committted to provide the hfspbless module as standard in grub2.
Attached to this e-mail and on my personal git repository in branch bless
the rediff. I was thinking of adding ppc mac support but haven't done it yet I think we can incorporate apple intel support without the ppc counterpart yet. Does anyone object?
Hi!
Please observe the usual hierrachy, i.e. ieee1275-specific stuff in a ieee1275/ directory, same for powerpc-specific stuff, etc.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 13 lines · Robert Millan
Quoted 11 lines · Vladimir 'phcoder' Serbinenko
Quoted 5 lines · Peter Cros
Hi again,
Could the hfspbless patch be updated and hopefully committted to provide the hfspbless module as standard in grub2.
Attached to this e-mail and on my personal git repository in branch bless the rediff. I was thinking of adding ppc mac support but haven't done it yet I think we can incorporate apple intel support without the ppc counterpart yet. Does anyone object?
Quoted 5 lines
Hi!
Please observe the usual hierrachy, i.e. ieee1275-specific stuff in a ieee1275/ directory, same for powerpc-specific stuff, etc.
Actually it's not so platform-specific. It's just a value which stored in fs in a bit different places and not something to do with the platform itself
Quoted 13 lines
--
Robert MillanThe DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git