Commit graph

1801 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
5e619f408d Fix wildcard escaping.
* grub-core/commands/wildcard.c (wildcard_escape): Moved from here ...
	* grub-core/script/execute.c (wildcard_escape): .. to here.
	Don't escape dot.
	* grub-core/commands/wildcard.c (wildcard_unescape): Moved from here ...
	* grub-core/script/execute.c (wildcard_unescape): .. to here.
	Don't escape dot.
	* grub-core/script/execute.c (gettext_append): Always escape.
	(grub_script_arglist_to_argv): Always handle escaping/unescaping.
	* grub-core/script/yylex.l: Don't cut away the escaping.
	* tests/grub_script_echo1.in: Add tests with wildcard.
2012-06-08 22:54:21 +02:00
Vladimir 'phcoder' Serbinenko
61c42af084 ESCC serial driver for conducting sautomated tests in qemu.
Not tested on real hardware.

	* include/grub/serial.h (grub_serial_port): New field escc_desc.
	* grub-core/term/ieee1275/escc.c: New file.
	* grub-core/Makefile.core.def (escc): New module.
2012-06-08 19:42:59 +02:00
Vladimir 'phcoder' Serbinenko
08dafeeaae Add a 1.5 stop bits value.
* grub-core/term/serial.c (grub_cmd_serial): Handle 1.5.
	* include/grub/serial.h (grub_serial_stop_bits_t): Add
	GRUB_SERIAL_STOP_BITS_1_5.
2012-06-08 19:32:57 +02:00
Vladimir 'phcoder' Serbinenko
c5c81ff978 Pass PCIINFO on BIOS to OpenBSD since otherwise it fails to boot
on some qemu versions with GRUB.

	* include/grub/i386/openbsd_bootarg.h (OPENBSD_BOOTARG_PCIBIOS): New
	define.
	(grub_openbsd_bootarg_pcibios): New struct.
	* grub-core/loader/i386/bsd.c (grub_openbsd_boot) [GRUB_MACHINE_PCBIOS]:
	Add PCIINFO.
2012-06-07 16:41:52 +02:00
Vladimir 'phcoder' Serbinenko
558d3a6023 * util/getroot.c (grub_util_get_dm_node_linear_info): Moved from here...
* grub-core/kern/emu/hostdisk.c (grub_util_get_dm_node_linear_info):
	to here. New return value start. All users updated.
	Recursively scan linear mappings.
	* include/grub/emu/hostdisk.h (grub_util_get_dm_node_linear_info): New
	proto.
	* grub-core/kern/emu/hostdisk.c (grub_hostdisk_find_partition_start):
	Use grub_util_get_dm_node_linear_info.
	* util/getroot.c (convert_system_partition_to_system_disk): Use
	grub_util_info rather than grub_dprintf.
	(grub_util_biosdisk_get_grub_dev): Add a new grub_util_info.
2012-06-07 14:24:48 +02:00
Vladimir 'phcoder' Serbinenko
24bd8838f1 * include/grub/types.h (grub_set_unaligned64): New function.
* util/grub-setup.c (write_rootdev): Use unaligned access functions.
	(setup): Likewise.
2012-06-07 14:07:02 +02:00
Peter Jones
bcc75fb3f7 * include/grub/i386/linux.h (linux_kernel_params): Add v206.
* grub-core/loader/i386/linux.c (grub_linux_boot): Use v206.
	(grub_cmd_linux) [__x86_64__]: Validate grub_efi_system_table.
2012-05-31 13:23:30 +02:00
Vladimir 'phcoder' Serbinenko
a4e5ca80d9 Fix handling of EFI with big memory maps.
* grub-core/loader/i386/linux.c (GRUB_LINUX_CL_OFFSET): Removed.
	(real_mode_mem): Likewise.
	(real_mode_target): Likewise.
	(real_mode_pages): Likewise.
	(prot_mode_pages): Likewise.
	(linux_params): New var.
	(linux_cmdline): Likewise.
	(free_pages): Don't set real mode variables.
	(allocate_pages): Don't allocate real mode memory.
	(grub_e820_add_region): Remove the limit.
	(grub_linux_boot): Allocate and copy real mode memory.
	(grub_linux_unload): Free linux_cmdline.
	(grub_cmd_linux): Use temporary storage for parameters.
	(grub_cmd_initrd): Likewise.
	* include/grub/i386/linux.h (GRUB_E820_MAX_ENTRY): Removed.
	(linux_kernel_params): Make it 1K big.
2012-05-30 14:56:53 +02:00
Vladimir 'phcoder' Serbinenko
e6ad0555e4 * grub-core/efiemu/runtime/efiemu.c: Replace APPLE_CC with __APPLE__.
* grub-core/kern/misc.c: Likewise.
	* grub-core/loader/i386/xnu.c: Likewise.
	* include/grub/i386/tsc.h: Likewise.
	* include/grub/symbol.h: Likewise.
2012-05-28 17:49:18 +02:00
Vladimir 'phcoder' Serbinenko
4a5a3c4abc * include/grub/list.h (grub_bad_type_cast_real): Remove return.
* include/grub/misc.h (ATTRIBUTE_ERROR): Make into noreturn attribute
	on older compiler.
2012-05-28 17:45:53 +02:00
Vladimir 'phcoder' Serbinenko
f7194551c4 * include/grub/misc.h (memcmp) [__APPLE__]: Mark as regparm 0.
(memmove) [__APPLE__]: Likewise.
	(memcpy) [__APPLE__]: Likewise.
	(memset) [__APPLE__]: Likewise.
	* grub-core/kern/misc.c (memcmp) [__APPLE__]: Likewise.
	(memmove) [__APPLE__]: Likewise.
	(memcpy) [__APPLE__]: Likewise.
	(memset) [__APPLE__]: Likewise.
2012-05-28 17:37:18 +02:00
Peter Jones
2787ae53d6 The old code gives arguments to a printf function which can't work
correctly, and the compiler complains.

	* grub-core/tests/example_functional_test.c (example_test): Add
	missing text.
	* grub-core/tests/lib/test.c (add_failure): Rewrite.
	* include/grub/test.h (grub_test_assert_helper): New declaration.
	(grub_test_assert): Use grub_test_assert_helper.
2012-05-27 14:26:18 +02:00
Matthew Garrett
4ce776d23e * grub-core/term/efi/console.c (grub_efi_console_init): Set text mode.
(grub_efi_console_fini): Likewise.
	* grub-core/video/efi_gop.c (framebuffer): New field offscreen.
	(grub_video_gop_fill_mode_info): Rename to ...
	(grub_video_gop_fill_real_mode_info): ... this.
	(grub_video_gop_fill_mode_info): New function.
	(grub_video_gop_setup): Setup double framebuffer.
	(grub_video_gop_get_info_and_fini): Use original framebuffer.
	Free offscreen.
	(grub_video_gop_swap_buffers): Copy framebuffer.
	(grub_video_gop_fini): Free offscreen buffer.
	* include/grub/efi/graphics_output.h (grub_efi_gop_blt_operation_t):
	New enum.
	(grub_efi_gop_blt_pixel): New struct.
2012-05-26 13:33:34 +02:00
Vladimir 'phcoder' Serbinenko
7086ad524f Remove unjustified hard dependency of normal.mod on gfxterm.
* include/grub/term.h (grub_term_output): New member fullscreen.
	* include/grub/gfxterm.h (grub_gfxterm_fullscreen): Removed.
	* grub-core/term/gfxterm.c (grub_gfxterm_fullscreen): Make static.
	(grub_gfxterm): Set .fullscreen.
	* grub-core/normal/menu.c (menu_init): Use fullscreen.
	* grub-core/gfxmenu/gfxmenu.c (GRUB_MOD_INIT): Likewise.
2012-05-21 22:17:11 +02:00
Vladimir 'phcoder' Serbinenko
e28e5fe519 * include/grub/ntfs.h (grub_ntfs_comp_table_element): New struct.
(grub_ntfs_comp): Use grub_ntfs_comp_table_element for comp_table.
	All users updated.
2012-05-15 17:09:14 +02:00
Vladimir 'phcoder' Serbinenko
d2fcfb0cef * include/grub/charset.h (GRUB_UTF16_UPPER_SURROGATE): Fix mask sizes.
(GRUB_UTF16_LOWER_SURROGATE): Likewise.
	(grub_utf16_to_utf8): Likewise.
2012-05-14 10:18:42 +02:00
Vladimir 'phcoder' Serbinenko
5560e9d6e1 * grub-core/disk/ieee1275/ofdisk.c (scan): Don't scan device tree if
GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS is set.
	* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
	GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS on IBM hardware.
	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum value
	GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS.
2012-05-13 20:29:23 +02:00
Vladimir 'phcoder' Serbinenko
f417ed0432 Fix wrapped HFS+ handling.
* grub-core/fs/fshelp.c (grub_fshelp_read_file): New argument
	blocks_start. All users updated.
	* grub-core/fs/hfsplus.c (grub_hfsplus_read_block): Don't add
	wrapping offset.
	(grub_hfsplus_read_file): Pass embedding offset to fshelp_read_file.
2012-05-09 13:02:59 +02:00
Bean
5efb817d64 * grub-core/net/ip.c (reassemble): Make asm_buffer into asm_netbuff.
All users updated.
	(free_rsm): Free header as well.
	(free_old_fragments): Fix memory leak.
	* grub-core/net/netbuff.c (grub_netbuff_free): Make return void.
	* grub-core/net/tftp.c (tftp_receive): Fix memory leak.
	(destroy_pq): Likewise.
	* include/grub/net/netbuff.h (grub_netbuff_free): Make return void.
2012-05-08 16:03:02 +02:00
Vladimir 'phcoder' Serbinenko
1b8463f2c4 Fix errors on compressed NTFS with 512B clusters.
* include/grub/ntfs.h (grub_ntfscomp_func_t): Use appropriately sized
	types.
	* grub-core/fs/ntfs.c (grub_ntfs_read): Return correct -1 on error and
	not 0.
	* grub-core/fs/ntfscomp.c (read_block): Use appropriately-sized types.
	Relax check for inline extents.
	(ntfscomp): Return correct -1 on error and not 0.
2012-05-04 17:37:17 +02:00
Vladimir 'phcoder' Serbinenko
ce41ab7aab * grub-core/kern/misc.c (grub_strcmp): Use unsigned comparison as
per common usage and preffered in several parts of code.
	(grub_memcmp): Likewise.
	(grub_strncmp): Likewise.
	* include/grub/misc.h (grub_strcasecmp): Likewise.
	(grub_strncasecmp): Likewise.
	* Makefile.util.def (cmp_test): New test.
	(grub_script_strcmp): Likewise.
	* tests/cmp_unit_test.c: New file.
	* tests/grub_script_strcmp.in: Likewise.
	* grub-core/fs/hfsplus.c (grub_hfsplus_cmp_catkey): Add a comment.
2012-05-04 12:08:22 +02:00
Vladimir 'phcoder' Serbinenko
49717bf429 * include/grub/pci.h: Move enums into no-asm part. 2012-05-04 10:54:38 +02:00
Matthew Garrett
9d34bb85da Suspend broadcom cards in order to stop their DMA.
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add pci.h on x86 EFI.
	* grub-core/Makefile.core.def (kernel): Add pci.c on x86 EFI.
	(pci): Don't build on x86 EFI.
	* grub-core/bus/pci.c (grub_pci_find_capability): New function.
	* grub-core/kern/efi/mm.c (stop_broadcom) [__i386__ || __x86_64__]:
	New function.
	(grub_efi_finish_boot_services) [__i386__ || __x86_64__]: Call
	stop_broadcom if running on EFI.
	* include/grub/pci.h (GRUB_PCI_CLASS_NETWORK): New enum value.
	(GRUB_PCI_CAP_POWER_MANAGEMENT): Likewise.
	(GRUB_PCI_VENDOR_BROADCOM): Likewise.
	(grub_pci_find_capability): New proto.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-05-03 17:26:55 +02:00
Vladimir 'phcoder' Serbinenko
b72d44a11a Scan mdraid before LVM.
* include/grub/diskfilter.h (grub_diskfilter_register): Renamed to ..
	(grub_diskfilter_register_front): ... this.
	(grub_diskfilter_register_back): New function.
	All users of grub_diskfilter_register updated.
2012-04-18 23:11:33 +02:00
Vladimir 'phcoder' Serbinenko
3c491b479c Terminate UNDI and PXE before launching the payload to avoid problems
with DMA.

	* grub-core/commands/boot.c (grub_loader_noreturn): Rename to ...
	(grub_loader_flags): ... this. All users updated.
	(grub_loader_boot): Check for GRUB_LOADER_FLAG_NORETURN.
	* grub-core/loader/i386/pc/pxechainloader.c (grub_cmd_pxechain): Mark
	loader as GRUB_LOADER_FLAG_PXE_NOT_UNLOAD.
	* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_shutdown): New
	function.
	(grub_pxe_restore): Likewise.
	(fini_hnd): New var.
	(GRUB_MOD_INIT): Register shutdown hook.
	(GRUB_MOD_FINI): Shutdown and unregister shutdown hook.
	* include/grub/loader.h (GRUB_LOADER_FLAG_NORETURN): New const.
	(GRUB_LOADER_FLAG_PXE_NOT_UNLOAD): Likewise.
	(grub_loader_set): Rename second argument to flags.
2012-04-11 22:32:31 +02:00
Vladimir 'phcoder' Serbinenko
851ffadac2 * grub-core/normal/charset.c (grub_ucs4_to_utf8): Return number of
written bytes.
	(grub_get_num_of_utf8_bytes): New function.
	(grub_ucs4_to_utf8_alloc): Use grub_get_num_of_utf8_bytes.
	* grub-core/normal/menu_entry.c (run): Convert entry to UTF-8 before
	executing it.
	* include/grub/charset.h (grub_get_num_of_utf8_bytes): New proto.
	(grub_ucs4_to_utf8): Change return type.
2012-04-07 20:11:04 +02:00
Vladimir 'phcoder' Serbinenko
e44092dbb9 * include/grub/diskfilter.h (grub_diskfilter_vg): Increase extent_size
to uint64_t to prevent overflow.
	(grub_diskfilter_lv): Increase start_extent and extent_count
	to uint64_t to prevent overflow.
2012-04-04 14:31:22 +02:00
Vladimir 'phcoder' Serbinenko
9576977eab * include/grub/datetime.h (grub_datetime2unixtime): Fix handling of days
after 29th of February.
2012-03-31 21:04:56 +02:00
Anton Blanchard
bbb39a458b Fix btrfs endianness handling.
* grub-core/fs/btrfs.c (key_cmp): Use grub_le_to_cpu for clarity.
	(lower_bound): Make root uint64_t. Use root in le.
	(grub_btrfs_read_logical): Fix template key init. Fix address byteswap.
	(find_path): Fix template key init.
	(grub_btrfs_dir): Fix mtime byteswap.
	* include/grub/types.h (grub_cpu_to_le64_compile_time): New macro.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-03-31 18:45:13 +02:00
Vladimir 'phcoder' Serbinenko
e1bd676b4e Fix tab and wide character handling in editor and menu.
* grub-core/normal/charset.c (grub_unicode_aglomerate_comb): Don't
	agglomerate control characters with combining marks.
	(bidi_line_wrap): Allow break on tab.
	(grub_unicode_get_comb_start): New function.
	* grub-core/normal/menu_entry.c: Restructure to handle wide characters
	and tab correctly.
	* grub-core/normal/menu_text.c (print_entry): Replace \n, \r, \b and \e
	with a space.
	* grub-core/normal/term.c (print_ucs4_terminal): New argument
	fixed_tab_size. All users updated.
	* include/grub/term.h (GRUB_TERM_TAB_WIDTH): New const.
	(grub_term_getcharwidth): Handle \t.
	* include/grub/unicode.h (grub_unicode_glyph_dup): Fix allocation
	and copy.
2012-03-27 17:07:26 +02:00
Vladimir 'phcoder' Serbinenko
17f38c0f8c Fix gettext reload bugs (e.g. inability to disable gettext
once enabled).

	* grub-core/gettext/gettext.c: Encapsulate all static variables in
	main_context and secondary_context. All functions updated.
	(grub_gettext_translate): Rename to ...
	(grub_gettext_translate_real): ... this. Return NULL on failed
	translate.
	(grub_gettext_translate): Handle secondary context.
	(grub_gettext_delete_list): Close file and zero-out the context.
	(grub_mofile_open): Don't call grub_gettext_delete_list.
	Don't close file.
	(grub_gettext_init_ext): Call grub_gettext_init_ext. Skip loading
	if locale="" to avoid pointless error message.
	(grub_gettext_env_write_lang): Update lang even if load fails.
	Handle secondary context.
	(grub_gettext_reread_prefix): New function.
	(read_main): Likewise.
	(read_secondary): Likewise.
	(GRUB_MOD_INIT): Handle secondary context. Hook and export variables.
	(GRUB_MOD_FINI): Handle secondary context. Don't close file.
	* grub-core/normal/main.c (read_lists): Call grub_gettext_reread_prefix.
	* include/grub/normal.h (grub_gettext_reread_prefix): New proto.
2012-03-10 23:25:34 +01:00
Vladimir 'phcoder' Serbinenko
1ecd61a47a Fix efi chainloader on network root.
* grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Handle
	network devices.
	* grub-core/net/drivers/efi/efinet.c (grub_efinet_get_device_handle):
	New function.
2012-03-10 20:41:28 +01:00
Vladimir 'phcoder' Serbinenko
1a2fd1e674 * include/grub/misc.h (ALIGN_UP_OVERHEAD): New define.
* grub-core/loader/i386/linux.c (grub_cmd_initrd): Align initrds at 4.
	* grub-core/loader/i386/pc/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/ia64/efi/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/mips/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/powerpc/ieee1275/linux.c (grub_cmd_initrd): Likewise.
	* grub-core/loader/sparc64/ieee1275/linux.c (grub_cmd_initrd): Likewise.
2012-03-05 01:17:55 +01:00
Vladimir 'phcoder' Serbinenko
d9bef9bc43 Fix menu title instability bug.
* grub-core/commands/menuentry.c (options): New option --id.
	(grub_normal_add_menu_entry): New argument id. All users updated.
	(grub_cmd_menuentry): Handle --id.
	(grub_menu_init): Accept unknown arguments.
	* grub-core/normal/main.c (features): Add feature_menuentry_id and
	feature_menuentry_options.
	* grub-core/normal/menu.c (grub_menu_execute_entry): Use id for
	saved_entry.
	(get_entry_number): Match with id as well.
	* include/grub/menu.h (grub_menu_entry): New member id.
	* util/grub-mkconfig_lib.in (grub_get_device_id): New function.
	* util/grub.d/00_header.in: Define menuentry_id_option.
	* util/grub.d/10_hurd.in: Define id.
	* util/grub.d/10_illumos.in: Likewise.
	* util/grub.d/10_kfreebsd.in: Likewise.
	* util/grub.d/10_linux.in: Likewise.
	* util/grub.d/10_netbsd.in: Likewise.
	* util/grub.d/10_windows.in: Likewise.
	* util/grub.d/20_linux_xen.in: Likewise.
	* util/grub.d/30_os-prober.in: Likewise.
2012-03-04 14:55:13 +01:00
Vladimir 'phcoder' Serbinenko
7c8d0ce7f4 * include/grub/i386/linux.h (linux_kernel_header): Fix init_size type.
* grub-core/loader/i386/linux.c (grub_cmd_linux): Differentiate between
	prot_size and prot_file_size.
2012-03-04 12:13:05 +01:00
Vladimir 'phcoder' Serbinenko
49de079bbe * grub-core/disk/diskfilter.c (is_lv_readable): New argument "easily".
All users updated. If easily=1 require raid-5/-6 to be full.
	(is_node_readable): Likewise.
	(scan_devices): Scan incomplete but readable LVs at the end.
	(grub_diskfilter_memberlist): Pull missing devices.
	(insert_array): Skip scanning until device is complete or scan is
	done otherwise.
	* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Fix wrong
	check.
	* include/grub/diskfilter.h (grub_diskfilter_lv): New member scanned.
	* util/raid.c (grub_util_raid_getmembers): Handle "removed" disks.
2012-03-04 01:33:09 +01:00
Matthew Garrett
aff05d45f9 Avoid EFI boot services when loading Linux.
* grub-core/lib/i386/relocator.c (grub_relocator32_boot): New argument
	avoid_efi_bootservices. All users updated.
	* grub-core/lib/relocator.c (grub_relocator_alloc_chunk_align): New
	argument avoid_efi_bootservices. All users updated.
	Use grub_efi_mmap_iterate on EFI, grub_mmap_iterate if available.
	* grub-core/loader/i386/linux.c (allocate_pages): New arguments
	align, min_align, relocatable, prefered_address. All users updated.
	Allocate avoiding boot services if kernel is relocatable.
	(grub_cmd_linux): Check if kernel is relocatable.
	* grub-core/mmap/efi/mmap.c (grub_machine_mmap_iterate): Move most to ..
	(grub_efi_mmap_iterate): ... here. New argument avoid_efi_boot_services.
	Skip GRUB_EFI_BOOT_SERVICES_DATA and GRUB_EFI_BOOT_SERVICES_CODE if
	avoid_efi_boot_services.
	(grub_machine_mmap_iterate): Wrap grub_efi_mmap_iterate.
	* include/grub/i386/linux.h (linux_kernel_header): Update to 2.10.
	(linux_kernel_params): Likewise.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-03-04 01:10:55 +01:00
Matthew Garrett
3935dde2f2 Use EDID on EFI.
* grub-core/kern/efi/efi.c (grub_efi_get_variable): New argument
	datasize_out.
	* grub-core/video/efi_gop.c (check_protocol): Check that GOP has usable
	modes. Set gop_handle.
	(grub_video_gop_get_edid): New function.
	(grub_gop_get_preferred_mode): Likewise.
	(grub_video_gop_setup): Use grub_gop_get_preferred_mode.
	(grub_video_efi_gop_adapter): Set .get_edid.
	* include/grub/efi/edid.h: New file.
	* include/grub/efi/efi.h (grub_efi_get_variable): Update proto.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-03-04 00:48:21 +01:00
Vladimir 'phcoder' Serbinenko
1e95b56e59 Fix compile error 2012-03-03 20:12:03 +01:00
Vladimir 'phcoder' Serbinenko
9be4c45dbe boot services avoid code based on the patch by Matthew Garrett 2012-03-03 20:06:41 +01:00
Matthew Garrett
86e5ab4b81 2012-03-03 18:05:16 +01:00
Vladimir 'phcoder' Serbinenko
a132afc371 * include/grub/kernel.h (FOR_MODULES): Check module magic. 2012-02-29 19:02:18 +01:00
Vladimir 'phcoder' Serbinenko
97304d7c53 * include/grub/libgcc.h (__STDC_VERSION__): Define if it's not yet so
to avoid the warning.
2012-02-29 15:28:02 +01:00
Vladimir 'phcoder' Serbinenko
a121c9648e Use the common size routine in hostfs so we can read disks as well.
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Rename to ..
	(grub_util_get_fd_size): ... this. Return size in bytes.
	All users updated.
	* grub-core/kern/emu/hostfs.c (grub_hostfs_open): Use
	grub_util_get_fd_size.
2012-02-29 15:23:31 +01:00
Vladimir 'phcoder' Serbinenko
c4b7e58882 * include/grub/dl.h: Switch from APPLE_CC to __APPLE__.
(GRUB_MOD_LICENSE) [ASM_FILE]: Make into macro. All users updated.
2012-02-29 14:51:09 +01:00
Vladimir 'phcoder' Serbinenko
5982495738 * include/grub/symbol.h (EXT_C) [!ASM_FILE]: Redefine with strings.
* grub-core/lib/i386/backtrace.c (grub_backtrace): Use EXT_C.
2012-02-29 14:48:58 +01:00
Vladimir 'phcoder' Serbinenko
99ce1597a4 Add LZSS Mach-O support (needed for new xnu kernelcache).
* grub-core/Makefile.core.def (xnu): Add file lzss.c
	* grub-core/loader/lzss.c: New file.
	* grub-core/loader/xnu.c (grub_xnu_load_driver): Close binaryfile
	on Mach-O open failure.
	* grub-core/loader/macho.c (grub_macho_close): Free uncompressedXX.
	Don't free cmdsXX in uncompressedXX is set.
	(grub_macho_file): Init new fields.
	New argument is_64bit. All users updated.
	Handle compressed. Error out if no suitable architecture is found.
	Don't close file.
	(grub_macho_open): New argument is_64bit. All users updated.
	* grub-core/loader/macho32.c: Add defines for new fields.
	* grub-core/loader/macho64.c: Likewise.
	* grub-core/loader/machoXX.c (grub_macho_contains_macho): Make static.
	(grub_macho_parse): Handle compressed.
	Defer actual processing if compressed.
	(grub_macho_cmds_iterate): Decompress if compressed. New argument
	"filename". All users updated.
	(grub_macho_size): New argument "filename". All users updated.
	(grub_macho_get_entry_point): Likewise.
	(grub_macho_load): Handle compressed.
	* include/grub/macho.h (grub_macho_lzss_header): New struct.
	(GRUB_MACHO_LZSS_OFFSET): New define.
	(grub_decompress_lzss): New proto.
	* include/grub/machoload.h (grub_macho_file): New fields to handle
	compressed.
	(grub_macho_contains_macho64): Remove proto.
	(grub_macho_contains_macho32): Likewise.
	* util/grub.d/30_os-prober.in: Use kernel cache if available.
2012-02-29 13:26:13 +01:00
Vladimir 'phcoder' Serbinenko
83ddae2333 Support v2 xnu boot arguments.
* grub-core/loader/i386/xnu.c (grub_cpu_xnu_fill_devicetree):
	New argument fsbfreq_out.
	(grub_xnu_set_video): Receive an argument grub_xnu_boot_params_common.
	(grub_xnu_boot): Support v2 arguments. Disable PIC so that APIC can
	be used.
	* grub-core/loader/machoXX.c (grub_macho_load): New argument
	darwin_version.
	* grub-core/loader/xnu.c (grub_xnu_darwin_version): New variable.
	* include/grub/i386/xnu.h (grub_xnu_boot_params_common): New struct.
	(grub_xnu_boot_params): Rename to ...
	(grub_xnu_boot_params_v1): ...this. Use grub_xnu_boot_params_common.
	(grub_xnu_boot_params_v2): New struct.
2012-02-28 04:04:19 +01:00
Colin Watson
e3c78337c3 * include/grub/partition.h (grub_partition_map): Change prototype of
embed to take a maximum value for nsectors.
	* include/grub/emu/hostdisk.h (grub_util_ldm_embed): Likewise.
	* include/grub/fs.h (grub_fs): Likewise.
	* grub-core/partmap/msdos.c (embed_signatures): New array.
	(pc_partition_map_embed): Check for and avoid sectors matching any
	of the signatures in embed_signatures, up to max_nsectors.
	* grub-core/partmap/gpt.c (gpt_partition_map_embed): Restrict
	returned sector map to max_nsectors.
	* grub-core/disk/ldm.c (grub_util_ldm_embed): Likewise.
	* grub-core/fs/btrfs.c (grub_btrfs_embed): Likewise.
	* grub-core/fs/zfs/zfs.c (grub_zfs_embed): Likewise.
	* util/grub-setup.c (setup): Allow for the embedding area being
	split into multiple blocklists.  Tell dest_partmap->embed the
	maximum number of sectors we care about.
2012-02-27 22:25:39 +01:00
Vladimir 'phcoder' Serbinenko
e1e49678b9 * util/grub-install.in: Clarify strings.
Fix source dir check.
2012-02-27 21:36:58 +01:00
Vladimir 'phcoder' Serbinenko
c36e5cd162 Remove any awareness of *.c util files about target.
* Makefile.util.def (grub-setup): Split to ...
	(grub-bios-setup): ... and this.
	(grub-sparc64-setup): ... and this.
	* configure.ac: Don't add machine_CPPFLAGS into HOST_CPPFLAGS.
	* docs/man/grub-setup.h2m: Split into ...
	* docs/man/grub-sparc64-setup.h2m: ... this.
	* docs/man/grub-bios-setup.h2m: ... and this.
	* include/grub/dl.h (grub_dl) [GRUB_UTIL]: Remove struct.
	* include/grub/elf.h (Elf_*) [GRUB_UTIL]: Remove types.
	(GRUB_TARGET_WORDSIZE) [GRUB_UTIL]: Remove.
	(grub_target_addr_t): Remove.
	(grub_target_size_t): Remove.
	(grub_target_ssize_t): Remove.
	* util/grub-install.in: Use new grub-*-setup.
	* util/grub-mkimagexx.c (Elf_Word): New define.
	(Elf_Half): Likewise.
	(Elf_Section): Likewise.
	(ELF_ST_TYPE): Likewise.
	* util/grub-setup.c: Switch from GRUB_MACHINE_SPARC64 to
	GRUB_SETUP_SPARC64 and from GRUB_MACHINE_PCBIOS to GRUB_SETUP_BIOS.
2012-02-27 14:24:22 +01:00
Vladimir 'phcoder' Serbinenko
5a0dc6fb2a * include/grub/efi/api.h (grub_efi_runtime_services): Add missing
const qualifier for vendor_guid.
2012-02-27 14:09:09 +01:00
Vladimir 'phcoder' Serbinenko
49017b1719 Fix missing console prototype on qemu-mips.
* include/grub/mips/qemu_mips/console.h: New file.
2012-02-27 14:06:33 +01:00
Matthew Garrett
c598862958 * grub-core/kern/efi/efi.c (grub_efi_get_variable): Add new function.
* include/grub/efi/efi.h: Likewise.
	* include/grub/efi/api.h: Add guid for EFI-specified variables.
	* include/grub/charset.h (GRUB_MAX_UTF16_PER_UTF8): New definition.
	* grub-core/normal/charset.c (grub_utf8_process): Move from here ...
	* include/grub/charset.h (grub_utf8_process): ... to here. Inline.
	* grub-core/normal/charset.c (grub_utf8_to_utf16): Move from here ...
	* include/grub/charset.h (grub_utf8_to_utf16): ... to here. Inline.
2012-02-27 12:02:57 +01:00
Matthew Garrett
e33f8d692f * include/grub/efi/pci.h: New file to define EFI PCI protocols. 2012-02-27 11:42:23 +01:00
Vladimir 'phcoder' Serbinenko
036985b8ce Remove grub_{modname}_init and grub_{modname}_fini. They should never
be used directly if it's really a module and GRUB_MOD_INIT shouldn't
	be used on non-modules.

	* grub-core/commands/boot.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]:
	Rename to grub_boot_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_fini.
	* grub-core/commands/keylayouts.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_fini.
	* grub-core/font/font_cmd.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_font_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_font_fini.
	* grub-core/kern/mips/loongson/init.c: Replace explicit protos with
	includes.
	(grub_machine_init): Remove empty inits.
	* grub-core/kern/mips/qemu_mips/init.c: Replace explicit protos with
	includes.
	(grub_machine_init): Remove empty inits.
	* grub-core/term/arc/console.c: Remove explicit proto.
	* grub-core/term/at_keyboard.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_at_keyboard_fini.
	* grub-core/term/gfxterm.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_gfxterm_fini.
	* grub-core/term/i386/pc/vga_text.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_vgatext_fini.
	* grub-core/term/ieee1275/console.c: Remove explicit proto.
	* grub-core/term/serial.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_serial_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_serial_fini.
	* grub-core/term/terminfo.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_terminfo_fini.
	* grub-core/video/bitmap.c (GRUB_MOD_INIT): Removed.
	(GRUB_MOD_FINI): Likewise.
	* grub-core/video/radeon_fuloong2e.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_radeon_fuloong2e_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_radeon_fuloong2e_fini.
	* grub-core/video/sis315pro.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_sis315pro_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_sis315pro_fini.
	* grub-core/video/sm712.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_sm712_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_sm712_fini.
	* include/grub/at_keyboard.h (grub_at_keyboard_init): New proto.
	(grub_at_keyboard_fini): Likewise.
	* include/grub/dl.h (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]:
	Don't declare grub_{modname}_init.
	(GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_fini.
	* include/grub/keyboard_layouts.h (grub_keylayouts_init) [!EMU]:
	New proto.
	(grub_keylayouts_fini) [!EMU]: Likewise.
	* include/grub/serial.h (grub_serial_init) [!EMU]:
	New proto.
	(grub_serial_fini) [!EMU]: Likewise.
	* include/grub/terminfo.h (grub_terminfo_init) [!EMU]:
	New proto.
	(grub_terminfo_fini) [!EMU]: Likewise.
	* include/grub/video.h (grub_font_init) [!EMU]:
	New proto.
	(grub_font_fini) [!EMU]: Likewise.
	(grub_gfxterm_init) [!EMU]: Likewise.
	(grub_gfxterm_fini) [!EMU]: Likewise.
	(grub_video_sm712_init) [!EMU]: Likewise.
	(grub_video_sm712_fini) [!EMU]: Likewise.
	(grub_video_sis315pro_init) [!EMU]: Likewise.
	(grub_video_sis315pro_fini) [!EMU]: Likewise.
	(grub_video_radeon_fuloong2e_init) [!EMU]: Likewise.
	(grub_video_radeon_fuloong2e_fini) [!EMU]: Likewise.
2012-02-27 00:28:45 +01:00
Vladimir 'phcoder' Serbinenko
10133b5ff3 * grub-core/kern/misc.c (grub_stpcpy): Move from here ...
* include/grub/misc.h (grub_stpcpy): ... to here. Inlined.
2012-02-26 23:55:18 +01:00
Vladimir 'phcoder' Serbinenko
8e307a625d * include/grub/env.h (grub_env_find): Remove prototype.
* grub-core/kern/env.c (grub_env_find): Make static.
	(grub_env_set): Remove useless set.
2012-02-26 23:53:21 +01:00
Vladimir 'phcoder' Serbinenko
d87893d5dc * include/grub/dl.h (grub_dl_load_file): Don't export. 2012-02-26 23:44:39 +01:00
Vladimir 'phcoder' Serbinenko
e2a833958e Don't export grub_get_rtc.
* include/grub/i386/pc/time.h (grub_get_rtc): Don't export.
	* grub-core/commands/i386/pc/play.c (play): Use grub_get_time_ms.
2012-02-26 23:25:47 +01:00
Vladimir 'phcoder' Serbinenko
eece3349ea Remove prio_list.
* include/grub/list.h (grub_prio_list): Removed.
	(GRUB_PRIO_LIST_PRIO_MASK): Removed. All users switched to
	GRUB_COMMAND_PRIO_MASK.
	(GRUB_PRIO_LIST_FLAG_ACTIVE): Removed. All users switched to
	GRUB_COMMAND_FLAG_ACTIVE.
	(grub_prio_list_insert): Removed.
	(grub_prio_list_remove): Likewise.
	(GRUB_AS_PRIO_LIST): Likewise.
	(GRUB_AS_PRIO_LIST_P): Likewise.
	* include/grub/command.h (GRUB_COMMAND_PRIO_MASK): New define.
	(GRUB_COMMAND_FLAG_ACTIVE): Likewise.
	* grub-core/kern/list.c (grub_prio_list_insert): Remove.
	* grub-core/kern/command.c (grub_register_command_prio): Inline
	the prio_list code.
	(grub_unregister_command): Likewise.
2012-02-26 22:49:24 +01:00
Vladimir 'phcoder' Serbinenko
94f064b4c9 Fix interrupt mixup from previous commit.
* include/grub/i386/pc/int.h (grub_i386_idt): New struct.
	(grub_realidt): New var.
	* grub-core/lib/i386/relocator16.S (grub_relocator16_idt): New variable
	Load idt.
	* grub-core/lib/i386/relocator.c (grub_relocator16_idt):
	New declaration.
	(grub_relocator16_boot): Set grub_relocator16_idt.
	* grub-core/kern/i386/realmode.S (realidt): Renamed to ...
	(LOCAL(realidt)): ... this.
	* grub-core/boot/i386/pc/startup_raw.S: Pass pointer to realidt in eax.
	* grub-core/kern/i386/pc/startup.S: Save pointer to realidt.
	(grub_realidt): New variable.
2012-02-26 22:10:13 +01:00
Lubomir Kundrak
ff27c3dd5d GDB serial and backtrace support.
* grub-core/kern/i386/realmode.S (real_to_prot): Reload IDT.
	(prot_to_real): Likewise.
	* grub-core/kern/i386/int.S (grub_bios_interrupt): Remove IDT reload.
	* grub-core/Makefile.core.def (backtrace): New module.
	(gdb): Likewise.
	* grub-core/gdb/cstub.c: New file.
	* grub-core/gdb/gdb.c: Likewise.
	* grub-core/gdb/i386/idt.c: Likewise.
	* grub-core/gdb/i386/machdep.S: Likewise.
	* grub-core/gdb/i386/signal.c: Likewise.
	* grub-core/lib/i386/backtrace.c: Likewise.
	* include/grub/backtrace.h: Likewise.
	* include/grub/gdb.h: Likewise.
	* include/grub/i386/gdb.h: Likewise.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-02-26 19:17:37 +01:00
Vladimir 'phcoder' Serbinenko
1948a3b714 Several cleanups 2012-02-26 19:10:52 +01:00
Vladimir 'phcoder' Serbinenko
7e8fac16ad $"..." support in scripts.
* grub-core/script/execute.c (grub_script_arglist_to_argv): Handle
	GRUB_SCRIPT_ARG_TYPE_GETTEXT.
	* grub-core/script/yylex.l: Likewise.
	* include/grub/script_sh.h (GRUB_SCRIPT_ARG_TYPE_GETTEXT): New enum
	value.
2012-02-26 19:02:46 +01:00
Vladimir 'phcoder' Serbinenko
8b282ad222 * grub-core/normal/charset.c (grub_utf8_to_ucs4_alloc): Fix return type
to grub_ssize_t.
	* grub-core/normal/main.c (grub_normal_init_page): Fix msg_len type.
	* include/grub/charset.h (grub_utf8_to_ucs4_alloc): Fix prototype.
2012-02-26 17:20:30 +01:00
Vladimir 'phcoder' Serbinenko
a9c7fd1c6c Implement serial on IEEE1275 and EFI.
* docs/grub.texi (Platform-specific limitations): Fix the columen video
	on emu. Mention arc and emu as the only platforms without serial
	support.
	* grub-core/Makefile.core.def (serial): Enable on all terminfomodule and
	ieee1275 platforms.
	* grub-core/term/efi/serial.c: New file.
	* grub-core/term/ieee1275/serial.c: Likewise.
	* grub-core/term/serial.c (grub_serial_find): Disable direct port
	specification if no ns8250 driver is available.
	(grub_cmd_serial): Likewise.
	(GRUB_MOD_INIT) [GRUB_MACHINE_IEEE1275]: Init ofserial.
	(GRUB_MOD_INIT) [GRUB_MACHINE_EFI]: Init efiserial.
	* include/grub/efi/api.h (GRUB_EFI_SERIAL_IO_GUID): New define.
	(grub_efi_parity_type_t): New type.
	(grub_efi_stop_bits_t): Likewise.
	(grub_efi_serial_io_interface): New struct.
	* include/grub/serial.h (grub_serial_port): Make 'broken' field
	available for all interfaces.
	Add EFI and IEEE1275 fields.
	(grub_ofserial_init): New proto.
	(grub_efiserial_init): Likeiwse.
	* util/grub.d/00_header.in: Don't check for the presence of serial
	module.
2012-02-26 17:08:11 +01:00
Vladimir 'phcoder' Serbinenko
463dcadca3 * include/grub/acpi.h (GRUB_ASCII_OPCODE): Add
GRUB_ACPI_OPCODE_STRING_CONST, GRUB_ACPI_OPCODE_BUFFER,
	GRUB_ACPI_OPCODE_CREATE_WORD_FIELD
	and GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD.
	* grub-core/commands/acpihalt.c [GRUB_DSDT_TEST]: Replace include of
	i18n with gettext no-op.
	(skip_data_ref_object): Support GRUB_ACPI_OPCODE_BUFFER and
	GRUB_ACPI_OPCODE_STRING_CONST.
	(get_sleep_type): Support GRUB_ACPI_OPCODE_CREATE_WORD_FIELD and
	GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD. Add handling of unknown opcodes.
2012-02-22 16:02:03 +01:00
Vladimir 'phcoder' Serbinenko
b00d7fb6c5 Make list_push and list_remove functions rather than inline functions
to decrease size and avoid aliasing violations.

	* include/grub/list.h (grub_list_push): Move to ...
	* grub-core/kern/list.c (grub_list_push): ... here. Don't inline.
	* include/grub/list.h (grub_list_remove): Move to ...
	* grub-core/kern/list.c (grub_list_remove): ... here. Don't inline.
2012-02-22 05:01:20 +01:00
Vladimir 'phcoder' Serbinenko
515e8007fc merge mainline into gdb 2012-02-18 21:00:13 +01:00
Vladimir 'phcoder' Serbinenko
fc400bfd74 merge backtrace into gdb 2012-02-18 20:59:42 +01:00
Vladimir 'phcoder' Serbinenko
a8f16eab1a Replace grub_checkkey with grub_getkey_noblock.
* grub-core/kern/term.c (grub_checkkey): Replaced with ...
	(grub_getkey_noblock): ... this. All users updated.
2012-02-18 19:59:01 +01:00
Vladimir 'phcoder' Serbinenko
e51b56667a * include/grub/test.h (grub_unit_test_init): Add missing prototype.
(grub_unit_test_fini): Likewise.
	* tests/lib/unit_test.c (main): Remove extra nested external prototype.
2012-02-12 22:04:55 +01:00
Vladimir 'phcoder' Serbinenko
0331e102c9 Efiemu stylistic fixes and gettext.
* grub-core/efiemu/i386/loadcore32.c
	(grub_arch_efiemu_relocate_symbols32): Avoid set in if.
	* grub-core/efiemu/i386/loadcore64.c
	(grub_arch_efiemu_relocate_symbols64): Likewise.
	* grub-core/efiemu/i386/pc/cfgtables.c
	(grub_machine_efiemu_init_tables): Likewise.
	* grub-core/efiemu/loadcore.c (grub_efiemu_resolve_symbols): Likewise.
	(grub_efiemu_loadcore_initXX): Add a filename argument.
	All users updated.
	Improved error message.
	* grub-core/efiemu/loadcore_common.c (grub_efiemu_loadcore_init):
	Add a filename argument.
	All users updated.
	* grub-core/efiemu/symbols.c (grub_efiemu_set_virtual_address_map):
	Reclassify double relocation as GRUB_ERR_BUG.
2012-02-12 18:43:39 +01:00
Vladimir 'phcoder' Serbinenko
f991dd3c32 * include/grub/misc.h (grub_error_save): Fix cleaning grub_errno. 2012-02-12 17:21:09 +01:00
Vladimir 'phcoder' Serbinenko
d61386e21d Improve string. Gettextize. 2012-02-12 15:25:25 +01:00
Vladimir 'phcoder' Serbinenko
ead2a8822b Remove prio_list 2012-02-12 03:52:17 +01:00
Vladimir 'phcoder' Serbinenko
4786a90fee * grub-core/disk/diskfilter.c (grub_diskfilter_print_partmap)
[GRUB_UTIL]: New function.
	(insert_array) [GRUB_UTIL]: Store partmaps.
	* include/grub/diskfilter.h (grub_diskfilter_pv) [GRUB_UTIL]: New member
	partmaps.
	(grub_diskfilter_print_partmap) [GRUB_UTIL]: New proto.
	* util/grub-probe.c (probe_partmap): Call grub_diskfilter_print_partmap.
	(probe_abstraction): Print diskfilter and not raid.
	Reported by: Lennart Sorensen
2012-02-11 11:57:47 +01:00
Vladimir 'phcoder' Serbinenko
dfdffd0d94 * include/grub/emu/misc.h (grub_util_warn): Add missing format
attribute.
	(grub_util_info): Likewise.
	(grub_util_error): Likewise.
2012-02-10 14:15:14 +01:00
Vladimir 'phcoder' Serbinenko
164ebb480d * include/grub/symbol.h (EXT_C) [GRUB_UTIL]: Removed.
(FUNCTION) [GRUB_UTIL]: Likewise.
	(VARIABLE) [GRUB_UTIL]: Likewise.
2012-02-10 12:47:42 +01:00
Vladimir 'phcoder' Serbinenko
44318d6168 * include/grub/misc.h: Avoid evaluationg NEED_ENABLE_EXECUTE_STACK and
NEED_REGISTER_FRAME_INFO in GRUB_UTIL.
2012-02-10 12:45:32 +01:00
Vladimir 'phcoder' Serbinenko
ccc3b1b898 * grub-core/kern/emu/full.c (grub_emu_post_init): Remove raid reinit.
* include/grub/disk.h [GRUB_MACHINE_EMU]: Remove now useless LVM/RAID
	declarations.
2012-02-09 23:15:27 +01:00
Vladimir 'phcoder' Serbinenko
b2c0c4a6c6 * include/grub/net.h: Remove double declarations. 2012-02-09 22:44:28 +01:00
Vladimir 'phcoder' Serbinenko
e4e37e8dfa Fix `help' with unloaded modules.
* include/grub/normal.h (grub_dyncmd_get_cmd): New proto.
	* grub-core/normal/dyncmd.c (grub_dyncmd_get_cmd): New function.
	(grub_dyncmd_dispatcher): Small stylistic fix.
	* grub-core/commands/help.c (grub_cmd_help): Load missing modules when
	explicit help is requested.
2012-02-09 14:38:34 +01:00
Vladimir 'phcoder' Serbinenko
9c4b5c13e6 Improve gettext support. Stylistic fixes and error handling fixes while
on it.
2012-02-08 19:26:01 +01:00
Vladimir 'phcoder' Serbinenko
215c90cb82 * grub-core/lib/i386/relocator16.S: Revert moving A20 code into PM
part. Instead setup the correct stack in RM.
	* grub-core/lib/i386/relocator.c (grub_relocator16_boot): Reserve place
	for stack.
	* include/grub/i386/relocator_private.h: New file.
2012-02-07 22:31:14 +01:00
Vladimir 'phcoder' Serbinenko
0ae70393ba Improve and unify messages.
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Add argument
	name. All users updated.
	Print filename in error.
	(read_device_map): Print filename in error.
	* util/getroot.c (grub_guess_root_devices): Print filename in error.
	(grub_util_get_os_disk): Likewise.
	(grub_util_biosdisk_get_grub_dev): Likewise.
	(grub_util_check_block_device): Likewise.
	(grub_util_check_char_device): Likewise.
	(grub_make_system_path_relative_to_its_root): Likewise.
	* util/grub-editenv.c (create_envblk_file): Likewise.
	(open_envblk_file): Likewise.
	(write_envblk): Likewise.
	* util/grub-fstest.c (cmd_cp): Likewise.
	(cmd_cat): Likewise.
	(cmd_cmp): Likewise.
	* util/grub-menulst2cfg.c (main): Likewise.
	* util/grub-mkfont.c (write_font_ascii_bitmap): Likewise.
	(write_font_width_spec): Likewise.
	(write_font_pf2): Likewise.
	* util/grub-mkimage.c (generate_image): New argument outname.
	All users updated.
	Remove unreacheable message.
	(options): Unify messages.
	(help_filter): Likewise.
	* util/grub-mklayout.c (usage): Removed (unused).
	(main): Print filename in error.
	* util/grub-mkrescue.in: Fix wrong quoting.
	* util/grub-setup.c (setup): Print filename in error.
	* util/ieee1275/ofpath.c (vendor_is_ATA): Likewise.
	(check_sas): Likewise.
	* util/misc.c (grub_util_get_fp_size): Removed.
	(grub_util_get_image_size): Print filename in error.
	(grub_util_read_at): Removed.
	(grub_util_read_image): Print filename in error.
	(grub_util_load_image): Likewise.
	(grub_util_write_image_at): New argument filename. All users updated.
	Print filename in error.
	(grub_util_write_image): New argument filename. All users updated.
	Print filename in error.
	* util/raid.c (grub_util_raid_getmembers): Print filename in error.
	* util/resolve.c (grub_util_resolve_dependencies): Likewise.
2012-02-05 11:07:33 +01:00
Vladimir 'phcoder' Serbinenko
0a96117de7 * grub-core/Makefile.core.def (pxechain): New module.
* grub-core/loader/i386/pc/pxechainloader.c: New file.
	* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_get_cached): New
	function.
	(grub_pc_net_config_real): Use grub_pxe_get_cached.
	* include/grub/i386/pc/pxe.h (grub_pxe_get_cached): New proto.
2012-02-05 10:33:52 +01:00
Vladimir 'phcoder' Serbinenko
aca002f7e4 * grub-core/kern/err.c (GRUB_MAX_ERRMSG): Move to ...
* include/grub/err.h (GRUB_MAX_ERRMSG): ... here.
	* include/grub/err.h (grub_error_saved): New struct.
	(grub_errmsg): Make array size explicit.
	* include/grub/misc.h (grub_error_save): New function.
	(grub_error_load): Likewise.
	* grub-core/kern/err.c (grub_error_stack_items): Use grub_error_saved.
	(grub_error_push): Update `errno' member name.
	(grub_error_pop): Likewise
	* grub-core/net/tftp.c (tftp_data): New member save_err.
	(tftp_receive): Save error.
	(tftp_open): Restore error.
2012-02-05 10:24:53 +01:00
Vladimir 'phcoder' Serbinenko
db606889a9 * grub-core/kern/ieee1275/openfw.c (grub_claimmap): Change to
grub_error framework. All users updated.
2012-02-04 14:00:23 +01:00
Vladimir 'phcoder' Serbinenko
8be63f2ef6 * Makefile.util.def (grub-mkdevicemap): Removed.
* include/grub/emu/hostdisk.h (grub_util_get_os_disk): New proto.
	* include/grub/util/deviceiter.h: Removed.
	* util/deviceiter.c: Likewise.
	* util/getroot.c (grub_util_get_os_disk): New function.
	* util/grub-install.in: Remove grub-mkdevicemap. Use -t disk as
	replacement for EFI.
	* util/grub-mkdevicemap.c: Removed.
	* util/grub-probe.c (probe): Handle PRINT_DISK.
	(argp_parser): Handle -t disk.
2012-02-03 22:36:51 +01:00
Vladimir 'phcoder' Serbinenko
cf5f7ee788 Support install on multi-device filesystems.
* include/grub/emu/getroot.h (grub_guess_root_device): Renamed to ...
	(grub_guess_root_devices): ...this. Return char **. All users updated.
	* include/grub/emu/misc.h (grub_find_root_device_from_mountinfo):
	Removed.
	* util/getroot.c (find_root_device_from_libzfs): Moved pool logic to ...
	(find_root_devices_from_poolname): ... here.
	(grub_find_root_devices_from_mountinfo): Return char **. Make static.
	Support zfs-fuse.
	(grub_guess_root_device): Rename to ...
	(grub_guess_root_devices): ... this. Return char **. All users updated.
	* util/grub-install.in: Handle multi-device filesystems.
	* util/grub-probe.c (probe). Make device_names a char **. Add delim
	argument. All users updated.
	Handle multi-device filesystems.
	Use 'delim' as separator.
	Remove device check to allow filesystems on file.
	(main): Support -0 argument. Handle multi-device.
	* util/grub-setup.c (setup): Remove root argument. Handle multi-device.
	Fix a cross-device check while on it.
	(arguments): Remove root_dev.
	(argp_parser): Remove -r.
	(main): Remove root_dev.
2012-02-03 10:35:28 +01:00
Vladimir 'phcoder' Serbinenko
d68538e928 merge mainline into cbi 2012-02-01 14:30:40 +01:00
Vladimir 'phcoder' Serbinenko
cefa01261b merge mainline into ehci 2012-02-01 13:19:42 +01:00
Vladimir 'phcoder' Serbinenko
9c08ad8707 * grub-core/disk/scsi.c (grub_scsi_read_capacity): Renamed to ...
(grub_scsi_read_capacity10): ... this.
	(grub_scsi_read_capacity16): New function.
	(grub_scsi_open): Use read_capacity16 if read_capacity10 returned
	0xffffffff.
	Fix off-by-one error.
	* include/grub/scsi.h (grub_scsi): Rename size to last_block and make it
	64-bit unsigned.
	* include/grub/scsicmd.h (grub_scsi_read_capacity): Rename to ...
	(grub_scsi_read_capacity10): ... this.
	(grub_scsi_read_capacity_data): Rename to ...
	(grub_scsi_read_capacity10_data): ... this. Rename size to last_block.
	(grub_scsi_read_capacity16): New struct.
	(grub_scsi_read_capacity16_data): Likewise.
	(grub_scsi_cmd_t): Rename grub_scsi_cmd_read_capacity to
	grub_scsi_cmd_read_capacity10.
	New command grub_scsi_cmd_read_capacity16.
2012-01-30 18:33:11 +01:00
Vladimir 'phcoder' Serbinenko
bc8d0f45a5 SCSI >2TiB support.
* grub-core/disk/scsi.c (grub_scsi_read16): New function.
	(grub_scsi_write16): Likewise.
	(grub_scsi_read): Use read16 when necessary.
	(grub_scsi_write): Likewise.
	* include/grub/scsicmd.h (grub_scsi_read16): New struct.
	(grub_scsi_write16): Likewise.
	(grub_scsi_cmd_t): Add READ16 and WRITE16.
2012-01-30 12:47:26 +01:00
Vladimir 'phcoder' Serbinenko
cc774926f1 SCSI write support (for usbms mainly).
* grub-core/disk/scsi.c (grub_scsi_write10): Uncomment. Make buffer
	a const pointer.
	(grub_scsi_write): Implement.
	* include/grub/scsi.h (grub_scsi_dev): Make write buffer a const pointer
2012-01-30 12:26:11 +01:00
Vladimir 'phcoder' Serbinenko
0b3b3b38bd * grub-core/lib/posix_wrap/limits.h (SHRT_MAX): New define.
(INT_MAX): Likewise.
	* grub-core/lib/posix_wrap/stdio.h (snprintf): New function.
	* grub-core/lib/posix_wrap/stdlib.h (abs): Likewise.
	* grub-core/lib/posix_wrap/string.h (memcmp): Likewise.
	(strcpy): Likewise.
	(strstr): Likewise.
	(strchr): Likewise.
	(strncpy): Likewise.
	(strcat): Likewise.
	(strncat): Likewise.
	(strcoll): Likewise.
	* include/grub/types.h (GRUB_SHRT_MAX): New define.
	(GRUB_INT_MAX): Likewise.
2012-01-29 23:27:31 +01:00
Vladimir 'phcoder' Serbinenko
f37c87e1ba * grub-core/boot/i386/pc/lnxboot.S: Use
GRUB_DECOMPRESSOR_MAX_DECOMPRESSOR_SIZE.
	* grub-core/boot/i386/pc/startup_raw.S: Ensure about boot_dev
	location.
	* include/grub/offsets.h (GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE): New
	definition.
	(GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE): Likewise.
2012-01-29 23:20:02 +01:00
Vladimir 'phcoder' Serbinenko
63fe43f3c3 * util/getroot.c (grub_util_get_dm_node_linear_info): Fix memory leak.
* grub-core/disk/cryptodisk.c (cryptodisk_cleanup): Disable for
	now to avoid double free.
	* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_dev): Rename to
	hostdisk.
	* include/grub/disk.h (grub_disk_dev_id): New id HOSTDISK.
	* util/grub-probe.c (escape_of_path): Always return a new copy.
	(print_full_name): Escape path.
	(probe): Don't call grub_util_devname_to_ofpath on NULL.
	Fix hints on abstractions.
2012-01-29 21:49:44 +01:00