First Distro-agnostic series taken from Fedora Rawhide
v3 cover First Distro-agnostic series taken from Fedora Rawhide
This is the first patch series, taken from Fedora Rawhide spec [1] that is distro-agnostic. The goal is to merge most of them so all the community/distros would benefit.
Changes since v2:
- modified 0003-Disable-GRUB-video-support-for-IBM-power-machines.patch shorter commit description
- deleted 0013-Enable-pager-by-default.-985860.patch not accepted: may cause issues on headless devices
Changes since v1:
- deleted 0005-Allow-fallback-to-include-entries-by-title-not-just-.patch no longer supported (even if doc indicates the contrary)
- deleted 011-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch similar patch reviewed in a separate thread
- deleted 0014-Don-t-say-GNU-Linux-in-generated-menus.patch not accepted
- modified 0003-Disable-GRUB-video-support-for-IBM-power-machines.patch included commit description taken from bz
- modified 0008-Migrate-PPC-from-Yaboot-to-Grub2.patch included 'ieee1275' on summary and description and improve description
[1] https://src.fedoraproject.org/rpms/grub2
Fedora Ninjas (2):
Makefile.common: Add .eh_frame to list of relocations stripped normal/main: fw_path prefix when fallback searching for grub config
Mark Hamzy (1):
20_ppc_terminfo.in: Migrate ieee1275/PPC from Yaboot to Grub2
Paulo Flabiano Smorigo (4):
ieee1275/openfw: IBM client architecture (CAS) reboot support term/terminfo: for ppc, reset console display attr when clear screen
ieee1275: Disable GRUB video support for IBM power machines
normal: Add fw_path variable (revised)
Peter Jones (9):
configure.ac: Move bash completion script
misc: Make "exit" take a return code.
efi/init: Make efi machines load an env block from a variable
commands: Pass "\x[[:hex:]][[:hex:]]" straight through unmolested. 10_linux.in: Add devicetree loading
10_linux.in: Don't require a password to boot entries generated by
grub-mkconfig.
normal/main: Try mac/guid/etc before grub.cfg on tftp config files. 10_linux.in: Generate OS and CLASS in 10_linux from /etc/os-release normal/main: Try $prefix if $fw_path doesn't work.
Makefile.util.def | 7 ++ conf/Makefile.common | 2 +- configure.ac | 11 +++ grub-core/Makefile.core.def | 1 + grub-core/commands/minicmd.c | 20 ++++- grub-core/commands/wildcard.c | 16 +++- grub-core/kern/efi/efi.c | 9 +- grub-core/kern/efi/init.c | 34 ++++++++ grub-core/kern/emu/main.c | 2 +- grub-core/kern/emu/misc.c | 9 +- grub-core/kern/i386/coreboot/init.c | 2 +- grub-core/kern/i386/qemu/init.c | 2 +- grub-core/kern/ieee1275/cmain.c | 5 +- grub-core/kern/ieee1275/init.c | 30 ++++--- grub-core/kern/ieee1275/openfw.c | 63 ++++++++++++++ grub-core/kern/main.c | 13 ++- grub-core/kern/mips/arc/init.c | 2 +- grub-core/kern/mips/loongson/init.c | 2 +- grub-core/kern/mips/qemu_mips/init.c | 2 +- grub-core/kern/misc.c | 11 ++- grub-core/kern/uboot/init.c | 6 +- grub-core/kern/xen/init.c | 2 +- grub-core/lib/cmdline.c | 25 +++++- grub-core/net/net.c | 2 +- grub-core/normal/main.c | 122 ++++++++++++++++++--------- grub-core/script/execute.c | 50 +++++++++-- grub-core/term/terminfo.c | 2 +- grub-core/video/ieee1275.c | 9 +- include/grub/ieee1275/ieee1275.h | 4 + include/grub/misc.h | 2 +- util/bash-completion.d/Makefile.am | 1 - util/grub-mkconfig.in | 3 +- util/grub.d/10_linux.in | 20 ++++- util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++ 34 files changed, 504 insertions(+), 101 deletions(-) create mode 100644 util/grub.d/20_ppc_terminfo.in
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 1/16 ieee1275/openfw: IBM client architecture (CAS) reboot support
From: Paulo Flabiano Smorigo <[email protected]>
This is an implementation of IBM client architecture (CAS) reboot for GRUB.
There are cases where the POWER firmware must reboot in order to support specific features requested by a kernel. The kernel calls ibm,client-architecture-support and it may either return or reboot with the new feature set. eg:
Calling ibm,client-architecture-support.../
Elapsed time since release of system processors: 70959 mins 50 secs Welcome to GRUB!
Instead of return to the GRUB menu, it will check if the flag for CAS reboot is set. If so, grub will automatically boot the last booted kernel using the same parameters
--- grub-core/kern/ieee1275/openfw.c | 63 ++++++++++++++++++++++++++++++++ grub-core/normal/main.c | 19 ++++++++++ grub-core/script/execute.c | 7 ++++ include/grub/ieee1275/ieee1275.h | 2 + 4 files changed, 91 insertions(+)
grub-core/kern/ieee1275/openfw.c +63 -0
@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void)return bootpath; } + +/* Check if it's a CAS reboot. If so, set the script to be executed. */ +int +grub_ieee1275_cas_reboot (char *script) +{ +grub_uint32_t ibm_ca_support_reboot; +grub_uint32_t ibm_fw_nbr_reboots; +char property_value[10 ]; +grub_ssize_t actual; +grub_ieee1275_ihandle_t options; + +if (grub_ieee1275_finddevice ("/options" , &options) <0 ) +return -1 ; + +/* Check two properties, one is enough to get cas reboot value */ + ibm_ca_support_reboot =0 ; +if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, +"ibm,client-architecture-support-reboot" , + &ibm_ca_support_reboot, +sizeof (ibm_ca_support_reboot), + &actual) >=0 ) +grub_dprintf ("ieee1275" ,"ibm,client-architecture-support-reboot: %u\n" , + ibm_ca_support_reboot); + + ibm_fw_nbr_reboots =0 ; +if (grub_ieee1275_get_property (options,"ibm,fw-nbr-reboots" , + property_value,sizeof (property_value), + &actual) >=0 ) + { + property_value[sizeof (property_value) -1 ] =0 ; + ibm_fw_nbr_reboots = (grub_uint8_t )grub_strtoul (property_value,0 ,10 ); +grub_dprintf ("ieee1275" ,"ibm,fw-nbr-reboots: %u\n" , ibm_fw_nbr_reboots); + } + +if (ibm_ca_support_reboot || ibm_fw_nbr_reboots) + { +if (!grub_ieee1275_get_property_length (options,"boot-last-label" , &actual)) + { +if (actual >1024 ) + script =grub_realloc (script, actual +1 ); +grub_ieee1275_get_property (options,"boot-last-label" , script, actual, + &actual); +return 0 ; + } + } + +grub_ieee1275_set_boot_last_label ("" ); + +return -1 ; +} + +int grub_ieee1275_set_boot_last_label (const char *text) +{ +grub_ieee1275_ihandle_t options; +grub_ssize_t actual; + +grub_dprintf ("ieee1275" ,"set boot_last_label (size: %u)\n" ,grub_strlen (text)); +if (!grub_ieee1275_finddevice ("/options" , &options) && + options != (grub_ieee1275_ihandle_t) -1 ) +grub_ieee1275_set_property (options,"boot-last-label" , text, +grub_strlen (text), &actual); +return 0 ; +}
grub-core/normal/main.c +19 -0
@@ -34,6 +34,9 @@#include <grub/charset.h> #include <grub/script_sh.h> #include <grub/bufio.h> +#ifdef GRUB_MACHINE_IEEE1275 +#include <grub/ieee1275/ieee1275.h> +#endif GRUB_MOD_LICENSE ("GPLv3+" );
@@ -276,6 +279,22 @@ grub_normal_execute (const char *config, int nested, int batch) { menu =read_config_file (config); +#ifdef GRUB_MACHINE_IEEE1275 +int boot; + boot =0 ; +char *script; + script =grub_malloc (1024 ); +if (!grub_ieee1275_cas_reboot (script)) + { +char *dummy[1 ] = {NULL }; +if (!grub_script_execute_sourcecode (script)) + boot =1 ; + } +grub_free (script); +if (boot) +grub_command_execute ("boot" ,0 ,0 ); +#endif +/* Ignore any error. */ grub_errno =GRUB_ERR_NONE ; }
grub-core/script/execute.c +7 -0
@@ -28,6 +28,9 @@#include <grub/extcmd.h> #include <grub/i18n.h> #include <grub/verify.h> +#ifdef GRUB_MACHINE_IEEE1275 +#include <grub/ieee1275/ieee1275.h> +#endif /* Max digits for a char is 3 (0xFF is 255), similarly for an int it is sizeof (int) * 3, and one extra for a possible -ve sign. */
@@ -883,6 +886,10 @@ grub_script_execute_sourcecode (const char *source)grub_err_t ret =0 ;struct grub_script *parsed_script; +#ifdef GRUB_MACHINE_IEEE1275 +grub_ieee1275_set_boot_last_label (source); +#endif +while (source) {char *line;
include/grub/ieee1275/ieee1275.h +2 -0
@@ -251,6 +251,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *alivoid EXPORT_FUNC (grub_ieee1275_children_peer ) (struct grub_ieee1275_devalias *alias);void EXPORT_FUNC (grub_ieee1275_children_first ) (const char *devpath,struct grub_ieee1275_devalias *alias); +int EXPORT_FUNC (grub_ieee1275_cas_reboot ) (char *script); +int EXPORT_FUNC (grub_ieee1275_set_boot_last_label ) (const char *text);char *EXPORT_FUNC (grub_ieee1275_get_boot_dev ) (void );
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 2/16 term/terminfo: for ppc, reset console display attr when clear screen
In reply to Leo SandovalFrom: Paulo Flabiano Smorigo <[email protected]>
v2: Also use \x0c instead of a literal ^L to make future patches less awkward.
This should fix this bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=908519
--- grub-core/term/terminfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/term/terminfo.c +1 -1
@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,/* Clear the screen. Using serial console, screen(1) only recognizes the * ANSI escape sequence. Using video console, Apple Open Firmware * (version 3.1.1) only recognizes the literal ^L. So use both. */ - data->cls =grub_strdup ("\e[2J" ); + data->cls =grub_strdup ("\x0c\e[2J\e[m" ); data->reverse_video_on =grub_strdup ("\e[7m" ); data->reverse_video_off =grub_strdup ("\e[m" );if (grub_strcmp ("ieee1275" , str) ==0 )
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 3/16 ieee1275: Disable GRUB video support for IBM power machines
In reply to Leo SandovalFrom: Paulo Flabiano Smorigo <[email protected]>
GRUB gets the display card node address from OpenFirmware, however this address is truncated to 32-bits (OpenFirmware works on 32-bits, so GRUB) effectively getting an invalid address. This change disables the video support on IBM power machines. More details can be found at [1].
[1] https://bugzilla.redhat.com/show_bug.cgi?id=973205
--- grub-core/kern/ieee1275/cmain.c | 5 ++++- grub-core/video/ieee1275.c | 9 ++++++--- include/grub/ieee1275/ieee1275.h | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-)
grub-core/kern/ieee1275/cmain.c +4 -1
@@ -89,7 +89,10 @@ grub_ieee1275_find_options (void) }if (rc >=0 &&grub_strncmp (tmp,"IBM" ,3 ) ==0 ) -grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS ); + { +grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS ); +grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT ); + }/* Old Macs have no key repeat, newer ones have fully working one. The ones inbetween when repeated key generates an escaoe sequence
grub-core/video/ieee1275.c +6 -3
@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =GRUB_MOD_INIT (ieee1275_fb) { -find_display (); -if (display) -grub_video_register (&grub_video_ieee1275_adapter); +if (!grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT )) + { +find_display (); +if (display) +grub_video_register (&grub_video_ieee1275_adapter); + } }GRUB_MOD_FINI (ieee1275_fb)
include/grub/ieee1275/ieee1275.h +2 -0
@@ -145,6 +145,8 @@ enum grub_ieee1275_flagGRUB_IEEE1275_FLAG_POWER_VM ,GRUB_IEEE1275_FLAG_POWER_KVM , + + GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT };extern int EXPORT_FUNC (grub_ieee1275_test_flag ) (enum grub_ieee1275_flag flag);
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 4/16 configure.ac: Move bash completion script
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=922997
Apparently these go in a new place now.
--- configure.ac | 11 +++++++++++ util/bash-completion.d/Makefile.am | 1 - 2 files changed, 11 insertions(+), 1 deletion(-)
configure.ac +11 -0
@@ -319,6 +319,14 @@ AC_SUBST(grubdirname) AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname", [Default grub directory name]) +PKG_PROG_PKG_CONFIG +AS_IF([$($PKG_CONFIG --exists bash-completion)], [ + bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion) +] , [ + bashcompletiondir=${datadir}/bash-completion/completions +]) +AC_SUBST(bashcompletiondir) + # # Checks for build programs. #
@@ -534,6 +542,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags" # Check for target programs. # +# This makes sure pkg.m4 is available. +m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config]) + # Find tools for the target. if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then tmp_ac_tool_prefix="$ac_tool_prefix"
util/bash-completion.d/Makefile.am +0 -1
@@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source) CLEANFILES = $(bash_completion_script) config.log -bashcompletiondir = $(sysconfdir)/bash_completion.d bashcompletion_DATA = $(bash_completion_script) $(bash_completion_script): $(bash_completion_source) $(top_builddir)/config.status
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 5/16 misc: Make "exit" take a return code.
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
This adds "exit" with a return code. With this patch, any "exit" command /may/ include a return code, and on platforms that support returning with an exit status, we will do so. By default we return the same exit status we did before this patch.
--- grub-core/commands/minicmd.c | 20 ++++++++++++++++---- grub-core/kern/efi/efi.c | 9 +++++++-- grub-core/kern/emu/main.c | 2 +- grub-core/kern/emu/misc.c | 9 +++++---- grub-core/kern/i386/coreboot/init.c | 2 +- grub-core/kern/i386/qemu/init.c | 2 +- grub-core/kern/ieee1275/init.c | 2 +- grub-core/kern/mips/arc/init.c | 2 +- grub-core/kern/mips/loongson/init.c | 2 +- grub-core/kern/mips/qemu_mips/init.c | 2 +- grub-core/kern/misc.c | 11 ++++++++++- grub-core/kern/uboot/init.c | 6 +++--- grub-core/kern/xen/init.c | 2 +- include/grub/misc.h | 2 +- 14 files changed, 50 insertions(+), 23 deletions(-)
grub-core/commands/minicmd.c +16 -4
@@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)), }/* exit */ -static grub_err_t __attribute__ ((noreturn)) +static grub_err_t grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)), -int argc __attribute__ ((unused)), -char *argv[] __attribute__ ((unused))) +int argc,char *argv[]) { -grub_exit (); +int retval =-1 ; +unsigned long n; + +if (argc <0 || argc >1 ) +return grub_error (GRUB_ERR_BAD_ARGUMENT ,N_ ("one argument expected" )); + +if (argc ==1 ) + { + n =grub_strtoul (argv[0 ],0 ,10 ); +if (n != ~0UL ) + retval = n; + } + +grub_exit (retval);/* Not reached. */ }
grub-core/kern/efi/efi.c +7 -2
@@ -175,11 +175,16 @@ grub_reboot (void) }void -grub_exit (void ) +grub_exit (int retval) { +int rc =GRUB_EFI_LOAD_ERROR ; + +if (retval ==0 ) + rc =GRUB_EFI_SUCCESS ; +grub_machine_fini (GRUB_LOADER_FLAG_NORETURN ); grub_efi_system_table->boot_services->exit (grub_efi_image_handle, -GRUB_EFI_SUCCESS ,0 ,0 ); + rc,0 ,0 );for (;;) ; }
grub-core/kern/emu/main.c +1 -1
@@ -67,7 +67,7 @@ grub_reboot (void) }void -grub_exit (void ) +grub_exit (int retval __attribute__((unused))) {grub_reboot (); }
grub-core/kern/emu/misc.c +5 -4
@@ -83,7 +83,7 @@ grub_util_error (const char *fmt, ...)vfprintf (stderr, fmt, ap);va_end (ap);fprintf (stderr,".\n" ); -grub_exit (); +grub_exit (1 ); } void *
@@ -152,12 +152,13 @@ xasprintf (const char *fmt, ...)#if !defined (GRUB_MACHINE_EMU ) || defined (GRUB_UTIL )void -grub_exit (void ) +__attribute__ ((noreturn)) +grub_exit (int rc) { -#if defined (GRUB_KERNEL ) +#if defined (GRUB_KERNEL ) && !defined (GRUB_MACHINE_EFI )grub_reboot ();#endif -exit (1 ); +exit (rc <0 ?1 : rc); }#endif
grub-core/kern/i386/coreboot/init.c +1 -1
@@ -41,7 +41,7 @@ extern grub_uint8_t _end[];extern grub_uint8_t _edata[];void __attribute__ ((noreturn)) -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {/* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
grub-core/kern/i386/qemu/init.c +1 -1
@@ -42,7 +42,7 @@ extern grub_uint8_t _end[];extern grub_uint8_t _edata[];void __attribute__ ((noreturn)) -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {/* We can't use grub_fatal() in this function. This would create an infinite loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
grub-core/kern/ieee1275/init.c +1 -1
@@ -114,7 +114,7 @@ grub_addr_t grub_ieee1275_original_stack;#define BYTE22 (DY_MEM_V2 | DRC_INFO)void -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {grub_ieee1275_exit (); }
grub-core/kern/mips/arc/init.c +1 -1
@@ -276,7 +276,7 @@ grub_halt (void) }void -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {GRUB_ARC_FIRMWARE_VECTOR ->exit ();
grub-core/kern/mips/loongson/init.c +1 -1
@@ -304,7 +304,7 @@ grub_halt (void) }void -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {grub_halt (); }
grub-core/kern/mips/qemu_mips/init.c +1 -1
@@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused))) }void -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {grub_halt (); }
grub-core/kern/misc.c +10 -1
@@ -1311,9 +1311,18 @@ grub_abort (void)grub_getkey (); } -grub_exit (); +grub_exit (1 ); } +#if defined (__clang__) && !defined (GRUB_UTIL ) +/* clang emits references to abort(). */ +void __attribute__ ((noreturn)) +abort (void ) +{ +grub_abort (); +} +#endif +void grub_fatal (const char *fmt, ...) {
grub-core/kern/uboot/init.c +3 -3
@@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size;static unsigned long timer_start;void -grub_exit (void ) +grub_exit (int rc) { -grub_uboot_return (0 ); +grub_uboot_return (rc <0 ?1 : rc); } static grub_uint64_t
@@ -78,7 +78,7 @@ grub_machine_init (void)if (!ver) {/* Don't even have a console to log errors to... */ -grub_exit (); +grub_exit (-1 ); }else if (ver >API_SIG_VERSION ) {
grub-core/kern/xen/init.c +1 -1
@@ -584,7 +584,7 @@ grub_machine_init (void) }void -grub_exit (void ) +grub_exit (int rc __attribute__((unused))) {struct sched_shutdown arg;
include/grub/misc.h +1 -1
@@ -385,7 +385,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;char *EXPORT_FUNC (grub_xvasprintf ) (const char *fmt,va_list args)WARN_UNUSED_RESULT ; -void EXPORT_FUNC (grub_exit ) (void ) __attribute__ ((noreturn)); +void EXPORT_FUNC (grub_exit ) (int rc) __attribute__ ((noreturn));void EXPORT_FUNC (grub_abort ) (void ) __attribute__ ((noreturn)); grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, grub_uint64_t d,
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 6/16 efi/init: Make efi machines load an env block from a variable
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
--- grub-core/Makefile.core.def | 1 + grub-core/kern/efi/init.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
grub-core/Makefile.core.def +1 -0
@@ -219,6 +219,7 @@ kernel = { efi = kern/efi/acpi.c; efi = kern/efi/sb.c; efi = kern/lockdown.c; + efi = lib/envblk.c; i386_coreboot = kern/i386/pc/acpi.c; i386_multiboot = kern/i386/pc/acpi.c; i386_coreboot = kern/acpi.c;
grub-core/kern/efi/init.c +34 -0
@@ -28,8 +28,11 @@#include <grub/env.h> #include <grub/mm.h> #include <grub/kernel.h> +#include <grub/stack_protector.h> +#include <grub/lib/envblk.h> +#ifdef GRUB_STACK_PROTECTOR static grub_efi_char16_t stack_chk_fail_msg[] =
@@ -103,6 +106,36 @@ stack_protector_init (void)grub_addr_t grub_modbase; +#define GRUB_EFI_GRUB_VARIABLE_GUID \ + { 0x91376aff, 0xcba6, 0x42be, \ + { 0x94, 0x9d, 0x06, 0xfd, 0xe8, 0x11, 0x28, 0xe8 } \ + } + +/* Helper for grub_efi_env_init */ +static int +set_var (const char *name,const char *value, +void *whitelist __attribute__((__unused__))) +{ +grub_env_set (name, value); +return 0 ; +} + +static void +grub_efi_env_init (void ) +{ +grub_guid_t efi_grub_guid =GRUB_EFI_GRUB_VARIABLE_GUID ; +struct grub_envblk envblk_s = {NULL ,0 }; +grub_envblk_t envblk = &envblk_s; + +grub_efi_get_variable ("GRUB_ENV" , &efi_grub_guid, &envblk_s.size, + (void **) &envblk_s.buf); +if (!envblk_s.buf || envblk_s.size <1 ) +return ; + +grub_envblk_iterate (envblk,NULL , set_var); +grub_free (envblk_s.buf); +} + __attribute__ ((__optimize__ ("-fno-stack-protector" )))void grub_efi_init (void ) {
@@ -128,6 +161,7 @@ grub_efi_init (void) grub_efi_system_table->boot_services->set_watchdog_timer (0 ,0 ,0 ,NULL ); +grub_efi_env_init ();grub_efidisk_init ();grub_efi_register_debug_commands ();
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 7/16 20_ppc_terminfo.in: Migrate ieee1275/PPC from Yaboot to Grub2
In reply to Leo SandovalFrom: Mark Hamzy <[email protected]>
Add configuration support for ieee1275/PPC ofconsole serial terminal.
--- Makefile.util.def | 7 ++ util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 util/grub.d/20_ppc_terminfo.in
Makefile.util.def +7 -0
@@ -517,6 +517,13 @@ script = { installdir = grubconf; }; +script = { + name = '20_ppc_terminfo'; + common = util/grub.d/20_ppc_terminfo.in; + installdir = grubconf; + condition = COND_HOST_LINUX; +}; + script = { name = '30_os-prober'; common = util/grub.d/30_os-prober.in;
util/grub.d/20_ppc_terminfo.in new file +114 -0
114 lines not on this page · raw message
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 8/16 normal: Add fw_path variable (revised)
In reply to Leo SandovalFrom: Paulo Flabiano Smorigo <[email protected]>
This patch makes grub look for its config file on efi where the app was found. It was originally written by Matthew Garrett, and adapted to fix the "No modules are loaded on grub2 network boot" issue:
https://bugzilla.redhat.com/show_bug.cgi?id=857936
--- grub-core/kern/main.c | 13 ++++++------- grub-core/normal/main.c | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 8 deletions(-)
grub-core/kern/main.c +6 -7
@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void)grub_machine_get_bootlocation (&fwdevice, &fwpath); -if (fwdevice) +if (fwdevice && fwpath) { -char *cmdpath; +char *fw_path; - cmdpath =grub_xasprintf ("(%s)%s" , fwdevice, fwpath ? :"" ); -if (cmdpath) + fw_path =grub_xasprintf ("(%s)/%s" , fwdevice, fwpath); +if (fw_path) { -grub_env_set ("cmdpath" , cmdpath); -grub_env_export ("cmdpath" ); -grub_free (cmdpath); +grub_env_set ("fw_path" , fw_path); +grub_free (fw_path); } }
grub-core/normal/main.c +24 -1
@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),/* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; -const char *prefix; +const char *prefix, *fw_path; + + fw_path =grub_env_get ("fw_path" ); +if (fw_path) + { + config =grub_xasprintf ("%s/grub.cfg" , fw_path); +if (config) + { +grub_file_t file; + + file =grub_file_open (config,GRUB_FILE_TYPE_CONFIG ); +if (file) + { +grub_file_close (file); +grub_enter_normal_mode (config); + } +else + { +/* Ignore all errors. */ + grub_errno =0 ; + } +grub_free (config); + } + } prefix =grub_env_get ("prefix" );if (prefix)
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 08/16] normal: Add fw_path variable (revised)
Quoted 29 lines · Leo Sandoval
From: Paulo Flabiano Smorigo <[email protected]>
This patch makes grub look for its config file on efi where the app was found. It was originally written by Matthew Garrett, and adapted to fix the "No modules are loaded on grub2 network boot" issue:
https://bugzilla.redhat.com/show_bug.cgi?id=857936
Signed-off-by Paulo Flabiano Smorigo <[email protected]>Signed-off-by Robbie Harwood <[email protected]>--- grub-core/kern/main.c | 13 ++++++------- grub-core/normal/main.c | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 8 deletions(-)grub-core/kern/main.c +2
-2@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void)grub_machine_get_bootlocation (&fwdevice, &fwpath); -if (fwdevice) +if (fwdevice && fwpath) { -char *cmdpath; +char *fw_path;
grub-core/kern/main.c grub_set_prefix_and_root (void) · line 139
Quoted 10 lines
grub-core/kern/main.c +4
-5- cmdpath =grub_xasprintf ("(%s)%s" , fwdevice, fwpath ? :"" ); -if (cmdpath) + fw_path =grub_xasprintf ("(%s)/%s" , fwdevice, fwpath); +if (fw_path) { -grub_env_set ("cmdpath" , cmdpath); -grub_env_export ("cmdpath" ); -grub_free (cmdpath); +grub_env_set ("fw_path" , fw_path); +grub_free (fw_path);
I believe $cmdpath is an important and well-known public variable. It is officially documented [1], and therefore, it shouldn't be removed or renamed without formal notice.
A quick google search [2] shows many references to $cmdpath, and many custom grub scripts would rely on it to function properly.
IMHO removing or renaming it would introduce a breaking change. Adding $fw_path would be fine, but it's unclear to me why that would be necessary either.
[1]
https://www.gnu.org/software/grub/manual/grub/html_node/cmdpath.html
[2]
https://wiki.archlinux.org/title/GRUB/Tips_and_tricks
https://superuser.com/questions/1757526/get-device-part-of-a-file-path-within-grub-cfg
https://github.com/opencomputeproject/onie/blob/master/build-config/scripts/mk-grub-efi-image
https://stackoverflow.com/questions/35269943/how-does-the-grub-2-uefi-loader-know-where-to-look-for-the-configuration-file-o
Thanks,
Michael
Quoted 47 lines
grub-core/kern/main.c +0
-0} }grub-core/normal/main.c +24
-1@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),/* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; -const char *prefix; +const char *prefix, *fw_path; + + fw_path =grub_env_get ("fw_path" ); +if (fw_path) + { + config =grub_xasprintf ("%s/grub.cfg" , fw_path); +if (config) + { +grub_file_t file; + + file =grub_file_open (config,GRUB_FILE_TYPE_CONFIG ); +if (file) + { +grub_file_close (file); +grub_enter_normal_mode (config); + } +else + { +/* Ignore all errors. */ + grub_errno =0 ; + } +grub_free (config); + } + } prefix =grub_env_get ("prefix" );if (prefix)Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 08/16] normal: Add fw_path variable (revised)
Quoted 47 lines · Michael Chang via Grub-devel
Quoted 4 lines · Leo Sandoval
From: Paulo Flabiano Smorigo <[email protected]>
This patch makes grub look for its config file on efi where the app was found. It was originally written by Matthew Garrett, and adapted to fix
the
Quoted 25 lines
"No modules are loaded on grub2 network boot" issue:
https://bugzilla.redhat.com/show_bug.cgi?id=857936
Signed-off-by Paulo Flabiano Smorigo <[email protected]>Signed-off-by Robbie Harwood <[email protected]>--- grub-core/kern/main.c | 13 ++++++------- grub-core/normal/main.c | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 8 deletions(-)grub-core/kern/main.c +2
-2@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void)grub_machine_get_bootlocation (&fwdevice, &fwpath); -if (fwdevice) +if (fwdevice && fwpath) { -char *cmdpath; +char *fw_path;grub-core/kern/main.c grub_set_prefix_and_root (void) · line 139
Quoted 10 lines
grub-core/kern/main.c +4
-5- cmdpath =grub_xasprintf ("(%s)%s" , fwdevice, fwpath ? :"" ); -if (cmdpath) + fw_path =grub_xasprintf ("(%s)/%s" , fwdevice, fwpath); +if (fw_path) { -grub_env_set ("cmdpath" , cmdpath); -grub_env_export ("cmdpath" ); -grub_free (cmdpath); +grub_env_set ("fw_path" , fw_path); +grub_free (fw_path);I believe $cmdpath is an important and well-known public variable. It is officially documented [1], and therefore, it shouldn't be removed or renamed without formal notice.
Quoted 3 lines
A quick google search [2] shows many references to $cmdpath, and many custom grub scripts would rely on it to function properly.
My thoughts exactly. I totally agree.
Quoted 65 lines
IMHO removing or renaming it would introduce a breaking change. Adding $fw_path would be fine, but it's unclear to me why that would be necessary either.
[1]
https://www.gnu.org/software/grub/manual/grub/html_node/cmdpath.html[2]
https://wiki.archlinux.org/title/GRUB/Tips_and_trickshttps://superuser.com/questions/1757526/get-device-part-of-a-file-path-within-grub-cfg
https://github.com/opencomputeproject/onie/blob/master/build-config/scripts/mk-grub-efi-image
Thanks,
Michaelgrub-core/normal/main.c grub_cmd_normal (struct grub_command *cmd
Quoted 8 lines
grub-core/kern/main.c +0
-0} }grub-core/normal/main.c +0
-0@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd
__attribute__((unused)),grub-core/normal/main.c grub_cmd_normal (struct grub_command *cmd · line 339
Quoted 1 line
grub-core/normal/main.c +0
-0/* Guess the config filename. It is necessary to make CONFIG static,
Quoted 34 lines
grub-core/normal/main.c +24
-2so that it won't get broken by longjmp. */ char *config; -const char *prefix; +const char *prefix, *fw_path; + + fw_path =grub_env_get ("fw_path" ); +if (fw_path) + { + config =grub_xasprintf ("%s/grub.cfg" , fw_path); +if (config) + { +grub_file_t file; + + file =grub_file_open (config,GRUB_FILE_TYPE_CONFIG ); +if (file) + { +grub_file_close (file); +grub_enter_normal_mode (config); + } +else + { +/* Ignore all errors. */ + grub_errno =0 ; + } +grub_free (config); + } + } prefix =grub_env_get ("prefix" );if (prefix) --2.46.2
Quoted 10 lines
Quoted 4 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 9/16 commands: Pass "\x[[:hex:]][[:hex:]]" straight through unmolested.
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
Don't munge raw spaces when we're doing our cmdline escaping (#923374)
--- grub-core/commands/wildcard.c | 16 ++++++++++++- grub-core/lib/cmdline.c | 25 ++++++++++++++++++-- grub-core/script/execute.c | 43 ++++++++++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 9 deletions(-)
grub-core/commands/wildcard.c +15 -1
@@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename)return ctx.found; } +static int +is_hex (char c) +{ +return ((c >='0' && c <='9' ) || (c >='a' && c <='f' ) || (c >='A' && c <='F' )); +} +static void unescape (char *out,const char *in,const char *end) {
@@ -496,7 +502,15 @@ unescape (char *out, const char *in, const char *end)for (optr = out, iptr = in; iptr < end;) { -if (*iptr =='\\' && iptr +1 < end) +if (*iptr =='\\' && iptr +3 < end && iptr[1 ] =='x' &&is_hex (iptr[2 ]) &&is_hex (iptr[3 ])) + { + *optr++ = *iptr++; + *optr++ = *iptr++; + *optr++ = *iptr++; + *optr++ = *iptr++; +continue ; + } +else if (*iptr =='\\' && iptr +1 < end) { *optr++ = iptr[1 ]; iptr +=2 ;
grub-core/lib/cmdline.c +23 -2
@@ -20,6 +20,12 @@#include <grub/lib/cmdline.h> #include <grub/misc.h> +static int +is_hex (char c) +{ +return ((c >='0' && c <='9' ) || (c >='a' && c <='f' ) || (c >='A' && c <='F' )); +} +static unsigned int check_arg (char *c,int *has_space) {int space =0 ;
@@ -27,7 +33,13 @@ static unsigned int check_arg (char *c, int *has_space)while (*c) { -if (*c =='\\' || *c =='\'' || *c =='"' ) +if (*c =='\\' && *(c+1 ) =='x' &&is_hex (*(c+2 )) &&is_hex (*(c+3 ))) + { + size +=4 ; + c +=4 ; +continue ; + } +else if (*c =='\\' || *c =='\'' || *c =='"' ) size++;else if (*c ==' ' ) space =1 ;
@@ -86,7 +98,16 @@ grub_create_loader_cmdline (int argc, char *argv[], char *buf,while (*c) { -if (*c =='\\' || *c =='\'' || *c =='"' ) +if (*c =='\\' && *(c+1 ) =='x' && +is_hex (*(c+2 )) &&is_hex (*(c+3 ))) + { + *buf++ = *c++; + *buf++ = *c++; + *buf++ = *c++; + *buf++ = *c++; +continue ; + } +else if (*c =='\\' || *c =='\'' || *c =='"' ) *buf++ ='\\' ; *buf++ = *c;
grub-core/script/execute.c +37 -6
67 lines not on this page · raw message
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 10/16 10_linux.in: Add devicetree loading
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
Switch to use APM Mustang device tree, for hardware testing.
Use the default device tree from the grub default file
instead of hardcoding a value.
--- util/grub-mkconfig.in | 3 ++- util/grub.d/10_linux.in | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
util/grub-mkconfig.in +2 -1
@@ -255,7 +255,8 @@ export GRUB_DEFAULT \ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ - GRUB_DISABLE_SUBMENU + GRUB_DISABLE_SUBMENU \ + GRUB_DEFAULT_DTB if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new"
util/grub.d/10_linux.in +15 -0
@@ -155,6 +155,13 @@ EOF sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' initrd $(echo $initrd_path) +EOF + fi + if test -n "${fdt}" ; then + message="$(gettext_printf "Loading fdt ...")" + sed "s/^/$submenu_indentation/" << EOF + echo '$(echo "$message" | grub_quote)' + devicetree ${rel_dirname}/${fdt} EOF fi sed "s/^/$submenu_indentation/" << EOF
@@ -250,6 +257,14 @@ for linux in ${reverse_sorted_list}; do gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 fi + fdt= + for i in "dtb-${version}" "dtb-${alt_version}"; do + if test -f "${dirname}/${i}/${GRUB_DEFAULT_DTB}" ; then + fdt="${i}/${GRUB_DEFAULT_DTB}" + break + fi + done + config= for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do if test -e "${i}" ; then
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 11/16 Makefile.common: Add .eh_frame to list of relocations stripped
In reply to Leo SandovalFrom: Fedora Ninjas <[email protected]>
--- conf/Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
conf/Makefile.common +1 -1
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) -STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx +STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx if !COND_emu if COND_HAVE_ASM_USCORE LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 12/16 10_linux.in: Don't require a password to boot entries generated by grub-mkconfig.
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
When we set a password, we just want that to mean you can't /edit/ an entry.
Resolves: rhbz#1030176
--- util/grub.d/10_linux.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/grub.d/10_linux.in +1 -1
@@ -26,7 +26,7 @@ datarootdir="@datarootdir@" export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAINDIR="@localedir@" -CLASS="--class gnu-linux --class gnu --class os" +CLASS="--class gnu-linux --class gnu --class os --unrestricted" if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU/Linux
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 13/16 normal/main: fw_path prefix when fallback searching for grub config
In reply to Leo SandovalFrom: Fedora Ninjas <[email protected]>
When PXE booting via UEFI firmware, grub was searching for grub.cfg in the fw_path directory where the grub application was found. If that didn't exist, a fallback search would look for config file names based on MAC and IP address. However, the search would look in the prefix directory which may not be the same fw_path. This patch changes that behavior to use the fw_path directory for the fallback search. Only if fw_path is NULL will the prefix directory be searched.
--- grub-core/normal/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
grub-core/normal/main.c +3 -2
@@ -341,7 +341,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),char *config;const char *prefix, *fw_path; - fw_path =grub_env_get ("fw_path" ); + prefix = fw_path =grub_env_get ("fw_path" );if (fw_path) { config =grub_xasprintf ("%s/grub.cfg" , fw_path);
@@ -364,7 +364,8 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), } } - prefix =grub_env_get ("prefix" ); +if (! prefix) + prefix =grub_env_get ("prefix" );if (prefix) {grub_size_t config_len;
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 14/16 normal/main: Try mac/guid/etc before grub.cfg on tftp config files.
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
--- grub-core/normal/main.c | 93 ++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 44 deletions(-)
grub-core/normal/main.c +49 -44
@@ -339,61 +339,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),/* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; -const char *prefix, *fw_path; - - prefix = fw_path =grub_env_get ("fw_path" ); -if (fw_path) - { - config =grub_xasprintf ("%s/grub.cfg" , fw_path); -if (config) - { -grub_file_t file; - - file =grub_file_open (config,GRUB_FILE_TYPE_CONFIG ); -if (file) - { -grub_file_close (file); -grub_enter_normal_mode (config); - } -else - { -/* Ignore all errors. */ - grub_errno =0 ; - } -grub_free (config); - } - } +const char *prefix; +const char *net_search_cfg; +int disable_net_search =0 ; + prefix =grub_env_get ("fw_path" );if (! prefix) prefix =grub_env_get ("prefix" ); + + net_search_cfg =grub_env_get ("feature_net_search_cfg" ); +if (net_search_cfg && net_search_cfg[0 ] =='n' ) + disable_net_search =1 ; +if (prefix) { -grub_size_t config_len; -int disable_net_search =0 ; -const char *net_search_cfg; - - config_len =grub_strlen (prefix) + -sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ); - config =grub_malloc (config_len); +if (grub_strncmp (prefix +1 ,"tftp" ,sizeof ("tftp" ) -1 ) ==0 && + !disable_net_search) + { +grub_size_t config_len; + config_len =grub_strlen (prefix) + +sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ); + config =grub_malloc (config_len); -if (!config) - goto quit; +if (! config) + goto quit; -grub_snprintf (config, config_len,"%s/grub.cfg" , prefix); +grub_snprintf (config, config_len,"%s/grub.cfg" , prefix); - net_search_cfg =grub_env_get ("feature_net_search_cfg" ); -if (net_search_cfg && net_search_cfg[0 ] =='n' ) - disable_net_search =1 ; +grub_net_search_configfile (config); -if (grub_strncmp (prefix +1 ,"tftp" ,sizeof ("tftp" ) -1 ) ==0 && - !disable_net_search) -grub_net_search_config_file (config); +grub_enter_normal_mode (config); +grub_free (config); + config =NULL ; + } -grub_enter_normal_mode (config); -grub_free (config); - } +if (!config) + { + config =grub_xasprintf ("%s/grub.cfg" , prefix); +if (config) + { +grub_file_t file; + + file =grub_file_open (config,GRUB_FILE_TYPE_CONFIG ); +if (file) + { +grub_file_close (file); +grub_enter_normal_mode (config); + } +else + { +/* Ignore all errors. */ + grub_errno =0 ; + } +grub_free (config); + } + } + }else -grub_enter_normal_mode (0 ); + { +grub_enter_normal_mode (0 ); + } }else grub_enter_normal_mode (argv[0 ]);
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 15/16 10_linux.in: Generate OS and CLASS in 10_linux from /etc/os-release
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
This makes us use pretty names in the titles we generate in grub2-mkconfig when GRUB_DISTRIBUTOR isn't set.
Resolves: rhbz#996794
--- util/grub.d/10_linux.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
util/grub.d/10_linux.in +2 -1
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" CLASS="--class gnu-linux --class gnu --class os --unrestricted" if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=GNU/Linux + OS="$(eval $(grep PRETTY_NAME /etc/os-release) ; echo ${PRETTY_NAME})" + CLASS="--class $(eval $(grep '^ID_LIKE=\|^ID=' /etc/os-release) ; [ -n "${ID_LIKE}" ] && echo ${ID_LIKE} || echo ${ID}) ${CLASS}" else OS="${GRUB_DISTRIBUTOR} GNU/Linux" CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 16/16 normal/main: Try $prefix if $fw_path doesn't work.
In reply to Leo SandovalFrom: Peter Jones <[email protected]>
Related: rhbz#1148652
--- grub-core/kern/ieee1275/init.c | 28 +++---- grub-core/net/net.c | 2 +- grub-core/normal/main.c | 132 ++++++++++++++++----------------- 3 files changed, 81 insertions(+), 81 deletions(-)
grub-core/kern/ieee1275/init.c +15 -13
@@ -170,23 +170,25 @@ grub_machine_get_bootlocation (char **device, char **path)grub_free (canon); }else - *device =grub_ieee1275_encode_devname (bootpath); -grub_free (type); - - filename =grub_ieee1275_get_filename (bootpath); -if (filename) { -char *lastslash =grub_strrchr (filename,'\\' ); - -/* Truncate at last directory. */ -if (lastslash) + filename =grub_ieee1275_get_filename (bootpath); +if (filename) { - *lastslash ='\0' ; -grub_translate_ieee1275_path (filename); +char *lastslash =grub_strrchr (filename,'\\' ); - *path = filename; - } +/* Truncate at last directory. */ +if (lastslash) + { + *lastslash ='\0' ; +grub_translate_ieee1275_path (filename); + + *path = filename; + } + } + *device =grub_ieee1275_encode_devname (bootpath); } + +grub_free (type);grub_free (bootpath); }
grub-core/net/net.c +1 -1
@@ -2005,7 +2005,7 @@ grub_net_search_config_file (char *config)/* Remove the remaining minus sign at the end. */ config[config_len] ='\0' ; -return GRUB_ERR_NONE ; +return GRUB_ERR_FILE_NOT_FOUND ; }static struct grub_preboot *fini_hnd;
grub-core/normal/main.c +65 -67
146 lines not on this page · raw message
Signature · 7 lines
2.46.2 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Leo,
Quoted 3 lines · Leo Sandoval
This is the first patch series, taken from Fedora Rawhide spec [1] that is distro-agnostic. The goal is to merge most of them so all the community/distros would benefit.
I think it will be much easier to deal with patches if series contain just somehow related ones. So, I think we should focus on EFI and Btrfs changes first. Just post two series containing these two things only. We can get back to other patches from series you sent when we merge the EFI and Btrfs stuff.
Anyway, thank you for taking a stab at this.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Hi Daniel,
Thanks for your feedback, comment inline.
Quoted 5 lines · Daniel Kiper
Leo,
Quoted 2 lines · Leo Sandoval
This is the first patch series, taken from Fedora Rawhide spec [1] that is distro-agnostic. The goal is to merge most of them so all the
Quoted 9 lines
community/distros
Quoted 1 line
would benefit.
I think it will be much easier to deal with patches if series contain just somehow related ones. So, I think we should focus on EFI and Btrfs changes first. Just post two series containing these two things only. We can get back to other patches from series you sent when we merge the EFI and Btrfs stuff.
sounds like a better approach. Once I started this work last month, I tried creating series per area for all Fedora patches but patch dependencies between areas created merge issues so I abandoned this idea.
Let me try it again with these two sets, EFI and BTRFS and see how it goes.
Quoted 7 lines
Anyway, thank you for taking a stab at this.
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel