Commit graph

14 commits

Author SHA1 Message Date
Colin Watson
d6ceebf1d9 2009-12-07 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Check for vasprintf.
	* util/misc.c (asprintf): Move allocation from here ...
	(vasprintf): ... to here.  New function.
	(xasprintf): New function.
	* include/grub/util/misc.h (vasprintf, xasprintf): Add
	prototypes.
	* util/getroot.c (grub_util_get_grub_dev): Use xasprintf.
	* util/grub-mkfont.c (write_font): Likewise.
	* util/grub-probe.c (probe): Likewise.
	* util/hostdisk.c (make_device_name): Likewise.
2009-12-07 16:46:24 +00:00
Robert Millan
8a4c07fd6a 2009-11-26 Robert Millan <rmh.grub@aybabtu.com>
* conf/common.rmk (sbin_UTILITIES): Add `grub-mkdevicemap'.
        (grub_mkdevicemap_SOURCES): New variable.
        (grub_probe_SOURCES, grub_fstest_SOURCES, grub_mkfont_SOURCES)
        (grub_mkrelpath_SOURCES, grub_editenv_SOURCES)
        (grub_pe2elf_SOURCES): Add `gnulib/progname.c'.
        * conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-mkdevicemap'.
        (grub_mkdevicemap_SOURCES): Remove.
        * conf/i386-efi.rmk: Likewise.
        * conf/i386-ieee1275.rmk: Likewise.
        * conf/i386-pc.rmk: Likewise.
        * conf/powerpc-ieee1275.rmk: Likewise.
        * conf/sparc64-ieee1275.rmk: Likewise.
        * conf/x86_64-efi.rmk: Likewise.
        * util/elf/grub-mkimage.c: Include `<grub/i18n.h>' and `"progname.h"'.
        (usage): Fix strings to use `program_name'.
        (main): Initialize gettext.
        * util/grub-editenv.c: Likewise.
        * util/grub-emu.c: Likewise.
        * util/grub-fstest.c: Likewise.
        * util/grub-mkdevicemap.c: Likewise.
        * util/grub-mkfont.c: Likewise.
        * util/grub-mkrelpath.c: Likewise.
        * util/grub-pe2elf.c: Likewise.
        * util/grub-probe.c: Likewise.
        * util/sparc64/ieee1275/grub-mkimage.c: Likewise.
        * util/sparc64/ieee1275/grub-ofpathname.c: Likewise.
        * util/sparc64/ieee1275/grub-setup.c: Likewise.

        * util/misc.c: Include `"progname.h"'.
        (progname): Remove variable.
        (grub_util_warn, grub_util_info, grub_util_error): Use `program_name'.
2009-11-25 23:10:02 +00:00
cjwatson
9031b03aac 2009-10-26 Colin Watson <cjwatson@ubuntu.com>
* util/grub-editenv.c (main): If only a command is given, use
	DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG as a default file name.
	(usage): FILENAME is now optional and has a default.
2009-10-26 16:33:13 +00:00
cjwatson
50dcabcf94 2009-10-01 Colin Watson <cjwatson@ubuntu.com>
* util/grub-editenv.c (create_envblk_file): Write new block with a
	.new suffix and then rename it into place, to ensure atomic
	creation.
2009-10-01 18:22:43 +00:00
fzielcke
b39f9d20a9 remove all trailing whitespace 2009-06-10 21:04:23 +00:00
okuji
5709cfc4d1 2009-03-29 Yoshinori K. Okuji <okuji@enbug.org>
Make the format of Environment Block plain text. The boot loader
    part is not tested well yet.
    
    * util/grub-editenv.c (DEFAULT_ENVBLK_SIZE): New macro.
    (buffer): Removed.
    (envblk): Likewise.
    (usage): Remove "info" and "clear". Add "unset". Update the
    description of "set", as this does not delete variables any
    longer.
    (create_envblk_file): Complete rewrite.
    (open_envblk_file): Likewise.
    (cmd_info): Removed.
    (cmd_list): Likewise.
    (cmd_set): Likewise.
    (cmd_clear): Likewise.
    (list_variables): New function.
    (write_envblk): Likewise.
    (set_variables): Likewise.
    (unset_variables): Likewise.
    (main): Complete rewrite.

    * commands/loadenv.c (buffer): Removed.
    (envblk): Likewise.
    (open_envblk_file): New function.
    (read_envblk_file): Complete rewrite.
    (grub_cmd_load_env): Likewise.
    (grub_cmd_list_env): Likewise.
    (struct blocklist): New struct.
    (free_blocklists): New function.
    (check_blocklists): Likewise.
    (write_blocklists): Likewise.
    (grub_cmd_save_env): Complete rewrite.

    * include/grub/lib/envblk.h (GRUB_ENVBLK_SIGNATURE): Replaced with
    a plain text signature.
    (GRUB_ENVBLK_MAXLEN): Removed.
    (struct grub_envblk): Complete rewrite.
    (grub_envblk_find): Removed.
    (grub_envblk_insert): Likewise.
    (grub_envblk_open): New prototype.
    (grub_envblk_set): Likewise.
    (grub_envblk_delete): Put const to VALUE.
    (grub_envblk_iterate): Put const to NAME and VALUE.
    (grub_envblk_close): New prototype.
    (grub_envblk_buffer): New inline function.
    (grub_envblk_size): Likewise.

    * lib/envblk.c: Include grub/mm.h.
    (grub_env_find): Removed.
    (grub_envblk_open): New function.
    (grub_envblk_close): Likewise.
    (escaped_value_len): Likewise.
    (find_next_line): Likewise.
    (grub_envblk_insert): Removed.
    (grub_envblk_set): New function.
    (grub_envblk_delete): Complete rewrite.
    (grub_envblk_iterate): Likewise.
2009-03-28 19:58:15 +00:00
bean
71b9f36193 2009-03-01 Bean <bean123ch@gmail.com>
* commands/terminal.c: Removed.

	* commands/handler.c: New file.

	* include/grub/list.h: Likewise.

	* include/grub/handler.h: Likewise.

	* kern/list.c: Likewise.

	* kern/handler.c: Likewise.

	* kern/term.h: Include header file <grub/handler.h>.
	(grub_term_input): Move next field to the beginning.
	(grub_term_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_output_class): Likewise.
	(grub_term_register_input): Changed to inline function.
	(grub_term_register_output): Likewise.
	(grub_term_unregister_input): Likewise.
	(grub_term_unregister_output): Likewise.
	(grub_term_set_current_input): Likewise.
	(grub_term_set_current_output): Likewise.
	(grub_term_get_current_input): Likewise.
	(grub_term_get_current_output): Likewise.
	(grub_term_iterate_input): Removed.
	(grub_term_iterate_output): Likewise.

	* kern/term.c (grub_term_list_input): Removed.
	(grub_term_list_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_output_class): Likewise.
	(grub_cur_term_input): Change varaible as macro.
	(grub_cur_term_output): Likewise.
	(grub_term_register_input): Removed.
	(grub_term_register_output): Likewise.
	(grub_term_unregister_input): Likewise.
	(grub_term_unregister_output): Likewise.
	(grub_term_set_current_input): Likewise.
	(grub_term_set_current_output): Likewise.
	(grub_term_iterate_input): Likewise.
	(grub_term_iterate_output): Likewise.
	(grub_term_get_current_input): Likewise.
	(grub_term_get_current_output): Likewise.

	* util/grub-editenv.c: Include header file <grub/handler.h>.
	(grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* util/grub-fstest.c (grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* util/grub-probe.c (grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* util/i386/pc/grub-setup.c (grub_term_get_current_input): Removed.
	(grub_term_get_current_output): Likewise.
	(grub_term_input_class): New variable.
	(grub_term_outout_class): Likewise.

	* conf/common.rmk (pkglib_MODULES): Replace terminal with handler.
	(terminal_mod_SOURCES): Likewise.
	(terminal_mod_CFLAGS): Likewise.
	(terminal_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_img_SOURCES): Add list.c and handler.c.
	(kernel_img_HEADERS): Add list.h and handler.h.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_mod_SOURCES): Add list.c and handler.c.
	(kernel_mod_HEADERS): Add list.h and handler.h.

	* conf/i386-coreboot.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_elf_SOURCES): Add list.c and handler.c.
	(kernel_elf_HEADERS): Add list.h and handler.h.

	* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_elf_SOURCES): Add list.c and handler.c.
	(kernel_elf_HEADERS): Add list.h and handler.h.

	* conf/x86_64-efi.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_mod_SOURCES): Add list.c and handler.c.
	(kernel_mod_HEADERS): Add list.h and handler.h.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Replace terminal.c with
	handler.c.
	(kernel_elf_SOURCES): Add list.c and handler.c.
	(kernel_elf_HEADERS): Add list.h and handler.h.
2009-03-01 17:51:44 +00:00
proski
4a412913d1 2009-01-13 Carles Pina i Estany <carles@pina.cat>
* util/grub-editenv.c (main): Use fseeko(), not fseek().
2009-01-14 00:17:12 +00:00
robertmh
651c29b79e 2008-11-07 Robert Millan <rmh@aybabtu.com>
Modularize at_keyboard.mod:

            * conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
            (at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
            (at_keyboard_mod_LDFLAGS): New variables.

            Actual terminal split:

            * include/grub/term.h (struct grub_term): Split in ...
            (struct grub_term_input): ... this, and ...
            (struct grub_term_output): ... this.  Update all users.
            (grub_term_set_current): Split in ...
            (grub_term_set_current_input): ... this, and ...
            (grub_term_set_current_output): ... this.
            (grub_term_get_current): Split in ...
            (grub_term_get_current_input): ... this, and ...
            (grub_term_get_current_output): ... this.
            (grub_term_register): Split in ...
            (grub_term_register_input): ... this, and ...
            (grub_term_register_output): ... this.
            (grub_term_unregister): Split in ...
            (grub_term_unregister_input): ... this, and ...
            (grub_term_unregister_output): ... this.
            (grub_term_iterate): Split in ...
            (grub_term_iterate_input): ... this, and ...
            (grub_term_iterate_output): ... this.

            * kern/term.c (grub_term_list): Split in ...
            (grub_term_list_input): ... this, and ...
            (grub_term_list_output): ... this.  Update all users.
            (grub_cur_term): Split in ...
            (grub_cur_term_input): ... this, and ...
            (grub_cur_term_output): ... this.  Update all users.
            (grub_term_set_current): Split in ...
            (grub_term_set_current_input): ... this, and ...
            (grub_term_set_current_output): ... this.
            (grub_term_get_current): Split in ...
            (grub_term_get_current_input): ... this, and ...
            (grub_term_get_current_output): ... this.
            (grub_term_register): Split in ...
            (grub_term_register_input): ... this, and ...
            (grub_term_register_output): ... this.
            (grub_term_unregister): Split in ...
            (grub_term_unregister_input): ... this, and ...
            (grub_term_unregister_output): ... this.
            (grub_term_iterate): Split in ...
            (grub_term_iterate_input): ... this, and ...
            (grub_term_iterate_output): ... this.

            * kern/misc.c (grub_abort): Split use of grub_term_get_current() into
            a check for input and one for output (and only attempt to get keys
            from user when input works).

            * util/grub-probe.c (grub_term_get_current): Split in ...
            (grub_term_get_current_input): ... this, and ...
            (grub_term_get_current_output): ... this.
            * util/grub-fstest.c: Likewise.
            * util/i386/pc/grub-setup.c: Likewise.
            * util/grub-editenv.c: Likewise.

            Portability adjustments:

            * conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
            `term/i386/pc/at_keyboard.c'.
            * kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
            grub_keyboard_controller_init() (now handled by terminal .init).
            * kern/i386/coreboot/init.c (grub_machine_init): Add call to
            grub_at_keyboard_init().
            * include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
            (grub_console_checkkey, grub_console_getkey): Remove (now provided by
            at_keyboard.mod via input terminal interface).
            * include/grub/i386/coreboot/console.h: Convert into a stub for
            `<grub/i386/pc/console.h>'.

            Migrate full terminals to new API:

            * term/efi/console.c (grub_console_term): Split into ...
            (grub_console_term_input): ... this, and ...
            (grub_console_term_output): ... this.  Update all users.
            * term/ieee1275/ofconsole.c: Remove __i386__ hack.
            (grub_ofconsole_init): Split into ...
            (grub_ofconsole_init_input): ... this, and ...
            (grub_ofconsole_init_output): ... this.
            (grub_ofconsole_term): Split into ...
            (grub_ofconsole_term_input): ... this, and ...
            (grub_ofconsole_term_output): ... this.  Update all users.
            * term/i386/pc/serial.c (grub_serial_term): Split into ...
            (grub_serial_term_input): ... this, and ...
            (grub_serial_term_output): ... this.  Update all users.
            * term/i386/pc/console.c (grub_console_term): Split into ...
            (grub_console_term_input): ... this, and ...
            (grub_console_term_output): ... this.  Update all users.
            (grub_console_term_input): Only enable it on PC/BIOS platform.
            (grub_console_init): Remove grub_keyboard_controller_init() call.

            Migrate input terminals to new API:

            * term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
            `i386' and `i386/pc' to enable build on x86_64 (this driver is
            i386-specific anyway).
            (grub_console_checkkey): Rename to ...
            (grub_at_keyboard_checkkey): ... this.  Static-ize.  Update all
            users.
            (grub_keyboard_controller_orig): New variable.
            (grub_console_getkey): Rename to ...
            (grub_at_keyboard_getkey): ... this.  Static-ize.  Update all
            users.
            (grub_keyboard_controller_init): Static-ize.  Save original
            controller value so that it can be restored ...
            (grub_keyboard_controller_fini): ... here (new function).
            (grub_at_keyboard_term): New structure.
            (GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
            functions.

            Migrate output terminals to new API:

            * term/i386/pc/vga.c (grub_vga_term): Change type to
            `struct  grub_term_output'.  Remove `.checkkey' and `.getkey'
            members.  Update all users.
            * term/gfxterm.c (grub_video_term): Change type to
            `struct  grub_term_output'.  Remove `.checkkey' and `.getkey'
            members.  Update all users.
            * include/grub/i386/pc/console.h (grub_console_checkkey)
            (grub_console_getkey): Do not export (no longer needed by gfxterm,
            etc).

            Migrate `terminal' command and userland tools to new API:

            * commands/terminal.c (grub_cmd_terminal): Split into ...
            (grub_cmd_terminal_input): ... this, and ...
            (grub_cmd_terminal_output): ... this.
            (GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
            `terminal_input' and `terminal_output'.
            * util/grub.d/00_header.in: Adjust `terminal' calls to new
            `terminal_input' / `terminal_output' API.
            * util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
            ${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
            provided ${GRUB_TERMINAL}, convert it).
2008-11-07 19:11:39 +00:00
bean
a85cd5a0b5 2008-07-27 Bean <bean123ch@gmail.com>
* commands/crc.c: New file.

	* lib/crc.c: Likewise.

	* include/grub/lib/crc.h: Likewise.

	* util/grub-fstest.c: grub/hexdump.h => grub/lib/hexdump.h.

	* commands/hexdump.c: grub/hexdump.h => grub/lib/hexdump.h.
	(hexdump): Move this function to ...

	* lib/hexdump.c: ... here.

	* include/grub/hexdump.h: Renamed to ...

	* include/grub/lib/hexdump.h: ... this.

	* commands/loadenv.c: grub/envblk.h => grub/lib/envblk.h

	* util/grub-editenv.c: Likewise.

	* include/envblk.h: Renamed to ...

	* include/lib/envblk.h: ... this.

	* util/envblk.c: Renamed to ...

	* lib/envblk.c: ... this.

	* conf/common.rmk (grub_fstest_SOURCES): commands/hexdump.c =>
	lib/hexdump.c.
	(grub_editenv_SOURCES): util/envblk.c => lib/envblk.c
	(pkglib_MODULES): Add crc.mod.
	(hexdump_mod_SOURCES): Add lib/hexdump.c.
	(loadenv_mod_SOURCES): util/envblk.c => lib/envblk.c.
	(crc_mod_SOURCES): New macro.
	(crc_mod_CFLAGS): Likewise.
	(crc_mod_LDFLAGS): Likewise.

	* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add lib/hexdump.c.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.

	* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
2008-07-27 13:51:30 +00:00
proski
11e16b157b 2008-07-02 Pavel Roskin <proski@gnu.org>
* util/grub-editenv.c (cmd_info): Cast argument to long
	explicitly.  ptrdiff_t reduces to int on i386.
2008-07-02 22:00:42 +00:00
proski
cbabfdd464 2008-07-02 Pavel Roskin <proski@gnu.org>
* util/grub-editenv.c (main): Be specific which parameter is
	missing.
2008-07-02 20:51:46 +00:00
proski
08d3ef095f 2008-07-02 Pavel Roskin <proski@gnu.org>
* util/grub-editenv.c (cmd_info): Fix warning in printf format.
2008-07-02 19:11:26 +00:00
bean
2270f77bea 2008-07-02 Bean <bean123ch@gmail.com>
* conf/common.rmk (bin_UTILITIES): Add grub-editenv.
	(grub_editenv_SOURCES): New variable.
	(pkglib_MODULES): Add loadenv.mod.
	(loadenv_mod_SOURCES): New variable.
	(loadenv_mod_CFLAGS): Likewise.
	(loadenv_mod_LDFLAGS): Likewise.

	* include/grub/envblk.h: New file.

	* util/envblk.c: New file.

	* util/grub-editenv.c: New file.

	* commands/loadenv.c: New file.
2008-07-02 07:20:11 +00:00