Port yaboot logic for various powerpc machine types
PATCH 1/1 Port yaboot logic for various powerpc machine types
Some powerpc machines require not updating the NVRAM, and some require adding a CHRP note. This can be handled by existing grub-install command-line options, but it's friendlier to detect this automatically. (Some of these machines may not be supported, but I made the list match for the sake of completeness.)
* grub-core/osdep/basic/platform.c (grub_install_get_default_powerpc_machtype): New function.
* grub-core/osdep/linux/platform.c (grub_install_get_default_powerpc_machtype): Likewise.
* grub-core/osdep/windows/platform.c (grub_install_get_default_powerpc_machtype): Likewise.
* include/grub/util/install.h (grub_install_get_default_powerpc_machtype): Add prototype.
* util/grub-install.c (main): Set update_nvram to 0 for pmac_oldworld, chrp_ibm, cell, and generic; set chrp_note to 1 for chrp_ibm. Pass chrp_note to grub_install_make_image_wrap.
--- grub-core/osdep/basic/platform.c | 5 +++ grub-core/osdep/linux/platform.c | 63 ++++++++++++++++++++++++++++++++++++++ grub-core/osdep/windows/platform.c | 6 ++++ include/grub/util/install.h | 3 ++ util/grub-install.c | 17 +++++++++- 5 files changed, 93 insertions(+), 1 deletion(-)
grub-core/osdep/basic/platform.c +5 -0
@@ -24,3 +24,8 @@ grub_install_get_default_x86_platform (void)return "i386-pc" ; } +const char * +grub_install_get_default_powerpc_machtype (void ) +{ +return "generic" ; +}
grub-core/osdep/linux/platform.c +63 -0
66 lines not on this page · raw message
grub-core/osdep/windows/platform.c +6 -0
@@ -128,6 +128,12 @@ grub_install_get_default_x86_platform (void)return "i386-efi" ; } +const char * +grub_install_get_default_powerpc_machtype (void ) +{ +return "generic" ; +} +static void *get_efi_variable (const wchar_t *varname,ssize_t *len) {
include/grub/util/install.h +3 -0
@@ -206,6 +206,9 @@ grub_install_create_envblk_file (const char *name);const char *grub_install_get_default_x86_platform (void ); +const char * +grub_install_get_default_powerpc_machtype (void ); + void grub_install_register_efi (grub_device_t efidir_grub_dev, const char *efifile_path,
util/grub-install.c +16 -1
@@ -57,6 +57,7 @@ static char *target;static int removable =0 ;static int recheck =0 ;static int update_nvram =1 ; +static int chrp_note =0 ;static char *install_device =NULL ;static char *debug_image =NULL ;static char *rootdir =NULL ;
@@ -1140,7 +1141,21 @@ main (int argc, char *argv[])if (platform ==GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275 ) { +const char *machtype =grub_install_get_default_powerpc_machtype ();int is_guess =0 ; + +if (strcmp (machtype,"pmac_oldworld" ) ==0 ) + update_nvram =0 ; +else if (strcmp (machtype,"chrp_ibm" ) ==0 ) + { + update_nvram =0 ; + chrp_note =1 ; + } +else if (strcmp (machtype,"cell" ) ==0 ) + update_nvram =0 ; +else if (strcmp (machtype,"generic" ) ==0 ) + update_nvram =0 ; +if (!macppcdir) {char *d;
@@ -1584,7 +1599,7 @@ main (int argc, char *argv[])/* output */ imgfile,/* memdisk */ NULL , have_load_cfg ? load_cfg :NULL , - /* image target */ mkimage_target, 0); + /* image target */ mkimage_target, chrp_note);/* Backward-compatibility kludges. */ switch (platform) {
Signature · 1 line
1.8.5.3
Quoted 1 line · Colin Watson
grub-core/osdep/linux/platform.c +0
-0
[...]
grub-core/osdep/linux/platform.c grub_install_get_default_x86_platform (void) · line 156
Quoted 2 lines
grub-core/osdep/linux/platform.c +2
-0+free (buf); +fclose (fp);
While test-building for i386-pc I noticed that this requires <stdio.h> and <stdlib.h>. Please pretend as if I included those in the previous patch.
Signature · 1 line
Colin Watson [[email protected]]
util/grub-install.c main (int argc, char *argv[]) · line 1157
Quoted 9 lines · Colin Watson
util/grub-install.c +9
-0+else if (strcmp (machtype,"chrp_ibm" ) ==0 ) + { + update_nvram =0 ; + chrp_note =1 ; + } +else if (strcmp (machtype,"cell" ) ==0 ) + update_nvram =0 ; +else if (strcmp (machtype,"generic" ) ==0 ) + update_nvram =0 ;
Why disable nvram on those? Especially "generic" seems doubtful and will probably break existing platforms.